diff --git a/.changeset/true-pens-give.md b/.changeset/true-pens-give.md new file mode 100644 index 0000000..83fe511 --- /dev/null +++ b/.changeset/true-pens-give.md @@ -0,0 +1,5 @@ +--- +"@itwin/scenes-client": patch +--- + +Add `lastModifiedById` to `Scene`, `SceneObject`, and `Tag` response interfaces. Tracks the id of the user who last made changes. diff --git a/packages/scenes-client/README.md b/packages/scenes-client/README.md index 8bb94fd..08abb13 100644 --- a/packages/scenes-client/README.md +++ b/packages/scenes-client/README.md @@ -44,6 +44,7 @@ console.log(sceneResponse.scene); displayName: "My Scene", iTwinId: "", createdById: "", + lastModifiedById: "", creationTime: "2025-01-01T10:00:00.000Z", lastModified: "2025-01-01T10:01:00.000Z", sceneData: { objects: [...] }, @@ -176,6 +177,7 @@ console.log(objectResponse.object); version: "1.0.0", data: { ... }, createdById: "", + lastModifiedById: "", creationTime: "2025-01-01T10:00:00.000Z", lastModified: "2025-01-01T10:01:00.000Z" } @@ -470,6 +472,7 @@ console.log(tagResponse.tag); displayName: "Structural", iTwinId: "", createdById: "", + lastModifiedById: "", creationTime: "2025-01-01T10:00:00.000Z", lastModified: "2025-01-01T10:01:00.000Z" } diff --git a/packages/scenes-client/src/models/object/sceneObject.ts b/packages/scenes-client/src/models/object/sceneObject.ts index 7134db6..17bd32e 100644 --- a/packages/scenes-client/src/models/object/sceneObject.ts +++ b/packages/scenes-client/src/models/object/sceneObject.ts @@ -21,6 +21,8 @@ interface SceneObjectResponseMetadata { sceneId: string; /** Id of the user who created the scene object (UUID). */ createdById: string; + /** Id of the user who last modified the scene object (UUID). */ + lastModifiedById: string; /** Time the scene object was created as an ISO8601 string, 'YYYY-MM-DDTHH:mm:ss.sssZ'. */ creationTime: string; /** Time the scene object was last modified as an ISO8601 string, 'YYYY-MM-DDTHH:mm:ss.sssZ'. */ @@ -65,6 +67,7 @@ export function isSceneObject(v: unknown): v is SceneObject { typeof v.id === "string" && typeof v.sceneId === "string" && typeof v.createdById === "string" && + typeof v.lastModifiedById === "string" && typeof v.creationTime === "string" && typeof v.lastModified === "string" && isSceneObjectCreate(v) diff --git a/packages/scenes-client/src/models/object/sceneObjectMinimal.ts b/packages/scenes-client/src/models/object/sceneObjectMinimal.ts index 4f063b6..5a4c175 100644 --- a/packages/scenes-client/src/models/object/sceneObjectMinimal.ts +++ b/packages/scenes-client/src/models/object/sceneObjectMinimal.ts @@ -8,7 +8,7 @@ import { isSceneObjectCreate } from "./sceneObjectCreate.js"; export type SceneObjectMinimal = UnionOmit< SceneObject, - "sceneId" | "createdById" | "creationTime" | "lastModified" + "sceneId" | "createdById" | "lastModifiedById" | "creationTime" | "lastModified" >; export function isSceneObjectMinimal(v: unknown): v is SceneObjectMinimal { diff --git a/packages/scenes-client/src/models/scene/sceneMinimal.ts b/packages/scenes-client/src/models/scene/sceneMinimal.ts index 9a7e909..c337771 100644 --- a/packages/scenes-client/src/models/scene/sceneMinimal.ts +++ b/packages/scenes-client/src/models/scene/sceneMinimal.ts @@ -16,6 +16,8 @@ export interface SceneMinimal { description?: string; /** Id of the user who created the scene (UUID). */ createdById: string; + /** Id of the user who last modified the scene (UUID). */ + lastModifiedById: string; /** iTwin Id associated with the scene (UUID). */ iTwinId: string; /** Time the scene was created as an ISO8601 string, 'YYYY-MM-DDTHH:mm:ss.sssZ'. */ @@ -32,6 +34,7 @@ export function isSceneMinimal(v: unknown): v is SceneMinimal { typeof v.id === "string" && typeof v.displayName === "string" && typeof v.createdById === "string" && + typeof v.lastModifiedById === "string" && typeof v.iTwinId === "string" && typeof v.creationTime === "string" && typeof v.lastModified === "string" && diff --git a/packages/scenes-client/src/models/tag/tag.ts b/packages/scenes-client/src/models/tag/tag.ts index 7cdeb49..47fac22 100644 --- a/packages/scenes-client/src/models/tag/tag.ts +++ b/packages/scenes-client/src/models/tag/tag.ts @@ -11,6 +11,8 @@ export interface Tag extends TagMinimal { iTwinId: string; /** Id of the user who created the tag (UUID). */ createdById: string; + /** Id of the user who last modified the tag (UUID). */ + lastModifiedById: string; /** Time the tag was created as an ISO8601 string, 'YYYY-MM-DDTHH:mm:ss.sssZ'. */ creationTime: string; /** Time the tag was last modified as an ISO8601 string, 'YYYY-MM-DDTHH:mm:ss.sssZ'. */ @@ -23,6 +25,7 @@ export function isTag(v: unknown): v is Tag { isTagMinimal(v) && typeof v.iTwinId === "string" && typeof v.createdById === "string" && + typeof v.lastModifiedById === "string" && typeof v.creationTime === "string" && typeof v.lastModified === "string" ); diff --git a/packages/scenes-client/tests/unit.test.ts b/packages/scenes-client/tests/unit.test.ts index 54b0cb1..ba7b547 100644 --- a/packages/scenes-client/tests/unit.test.ts +++ b/packages/scenes-client/tests/unit.test.ts @@ -765,6 +765,7 @@ const exampleSceneResponse: SceneResponse = { description: "Some Description XYZ123", iTwinId: "itwin-1", createdById: "user-1", + lastModifiedById: "user-1", creationTime: "2025-07-16T15:00:00.000Z", lastModified: "2025-07-16T15:00:00.000Z", tags: [{ id: "tag-1", displayName: "Tag 1" }], @@ -788,6 +789,7 @@ const exampleSceneMetadataResponse: SceneMetadataResponse = { description: "Some Description XYZ123", iTwinId: "itwin-1", createdById: "user-1", + lastModifiedById: "user-1", creationTime: "2025-07-16T15:00:00.000Z", lastModified: "2025-07-16T15:00:00.000Z", tags: [{ id: "tag-1", displayName: "Tag 1" }], @@ -807,6 +809,7 @@ const exampleSceneListResponse: SceneListResponse = { description: "Some Description XYZ123", iTwinId: "itwin-1", createdById: "user-1", + lastModifiedById: "user-1", creationTime: "2025-07-16T15:00:00.000Z", lastModified: "2025-07-16T15:00:00.000Z", tags: [{ id: "tag-1", displayName: "Tag 1" }], @@ -821,6 +824,7 @@ const exampleTagResponse: TagResponse = { displayName: "Tag 1", iTwinId: "itwin-1", createdById: "user-1", + lastModifiedById: "user-1", creationTime: "2025-07-16T15:00:00.000Z", lastModified: "2025-07-16T15:00:00.000Z", }, @@ -840,6 +844,7 @@ const exampleSceneObjectResponse: SceneObjectResponse = { data: {}, sceneId: "scene-1", createdById: "user-1", + lastModifiedById: "user-1", creationTime: "2025-07-16T15:00:00.000Z", lastModified: "2025-07-16T15:00:00.000Z", },