@twin.org/auditable-item-graph-service 0.0.3-next.3 → 0.0.3-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -788,7 +788,7 @@ export class AuditableItemGraphService {
788
788
  if (!Is.stringValue(storedChangeset.proofId)) {
789
789
  verified = false;
790
790
  storedChangesetJsonLd.verification = {
791
- "@context": ImmutableProofContexts.Namespace,
791
+ "@context": ImmutableProofContexts.Context,
792
792
  type: ImmutableProofTypes.ImmutableProofVerification,
793
793
  verified: false,
794
794
  failure: ImmutableProofFailure.ProofMissing
@@ -1 +1 @@
1
- {"version":3,"file":"auditableItemGraphService.js","sourceRoot":"","sources":["../../src/auditableItemGraphService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,WAAW,EAUX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,EAAE,EACF,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,GAAG,EACH,UAAU,EAGV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,eAAe,EAA0B,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,aAAa,EAEb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACN,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EAEnB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,MAAM,gCAAgC,CAAC;AASxC;;GAEG;AACH,MAAM,OAAO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,EAAE,EAAE,GAAG;aACP,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,SAAS,CAAC,sBAAsB,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,YAAY,CAAC,yBAAyB,CAAC,UAAU,EAAE,eAAe,EAAE;gBAC7E,MAAM,EAAE,GAAG;aACX,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,SAAS,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,KAAK,yBAAyB,CAAC,cAAc,EAAE,CAAC;YACxF,MAAM,IAAI,YAAY,CAAC,yBAAyB,CAAC,UAAU,EAAE,eAAe,EAAE;gBAC7E,MAAM,EAAE,GAAG;aACX,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACK,UAAU,CAAC,QAAgB,EAAE,MAAc;QAClD,OAAO,IAAI,GAAG,CAAC,yBAAyB,CAAC,SAAS,EAAE;YACnD,QAAQ;YACR,yBAAyB,CAAC,cAAc;YACxC,MAAM;SACN,CAAC,CAAC,QAAQ,EAAE,CAAC;IACf,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tAuditableItemGraphContexts,\n\tAuditableItemGraphTopics,\n\tAuditableItemGraphTypes,\n\tVerifyDepth,\n\ttype IAuditableItemGraphAlias,\n\ttype IAuditableItemGraphChangeset,\n\ttype IAuditableItemGraphComponent,\n\ttype IAuditableItemGraphEdge,\n\ttype IAuditableItemGraphEventBusVertexCreated,\n\ttype IAuditableItemGraphEventBusVertexUpdated,\n\ttype IAuditableItemGraphResource,\n\ttype IAuditableItemGraphVertex,\n\ttype IAuditableItemGraphVertexList\n} from \"@twin.org/auditable-item-graph-models\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tArrayHelper,\n\tComponentFactory,\n\tConverter,\n\tGeneralError,\n\tGuards,\n\tIs,\n\tJsonHelper,\n\tNotFoundError,\n\tObjectHelper,\n\tRandomHelper,\n\tStringHelper,\n\tUrn,\n\tValidation,\n\ttype IPatchOperation,\n\ttype IValidationFailure\n} from \"@twin.org/core\";\nimport { JsonLdHelper, JsonLdProcessor, type IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport {\n\tComparisonOperator,\n\tLogicalOperator,\n\tSortDirection,\n\ttype IComparator\n} from \"@twin.org/entity\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport type { IEventBusComponent } from \"@twin.org/event-bus-models\";\nimport {\n\tImmutableProofContexts,\n\tImmutableProofFailure,\n\tImmutableProofTypes,\n\ttype IImmutableProofComponent\n} from \"@twin.org/immutable-proof-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\tSchemaOrgContexts,\n\tSchemaOrgDataTypes,\n\tSchemaOrgTypes\n} from \"@twin.org/standards-schema-org\";\nimport type { AuditableItemGraphAlias } from \"./entities/auditableItemGraphAlias.js\";\nimport type { AuditableItemGraphChangeset } from \"./entities/auditableItemGraphChangeset.js\";\nimport type { AuditableItemGraphEdge } from \"./entities/auditableItemGraphEdge.js\";\nimport type { AuditableItemGraphResource } from \"./entities/auditableItemGraphResource.js\";\nimport type { AuditableItemGraphVertex } from \"./entities/auditableItemGraphVertex.js\";\nimport type { IAuditableItemGraphServiceConstructorOptions } from \"./models/IAuditableItemGraphServiceConstructorOptions.js\";\nimport type { IAuditableItemGraphServiceContext } from \"./models/IAuditableItemGraphServiceContext.js\";\n\n/**\n * Class for performing auditable item graph operations.\n */\nexport class AuditableItemGraphService implements IAuditableItemGraphComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<AuditableItemGraphService>();\n\n\t/**\n\t * The namespace for the service.\n\t * @internal\n\t */\n\tpublic static readonly NAMESPACE: string = \"aig\";\n\n\t/**\n\t * The namespace for the service changeset.\n\t */\n\tpublic static readonly NAMESPACE_CHANGESET: string = \"changeset\";\n\n\t/**\n\t * The namespace for the service edge.\n\t */\n\tpublic static readonly NAMESPACE_EDGE: string = \"edge\";\n\n\t/**\n\t * The keys to pick when creating the proof for the stream.\n\t * @internal\n\t */\n\tprivate static readonly _PROOF_KEYS_CHANGESET: (keyof AuditableItemGraphChangeset)[] = [\n\t\t\"id\",\n\t\t\"vertexId\",\n\t\t\"userIdentity\",\n\t\t\"dateCreated\",\n\t\t\"patches\"\n\t];\n\n\t/**\n\t * The immutable proof component.\n\t * @internal\n\t */\n\tprivate readonly _immutableProofComponent: IImmutableProofComponent;\n\n\t/**\n\t * The entity storage for vertices.\n\t * @internal\n\t */\n\tprivate readonly _vertexStorage: IEntityStorageConnector<AuditableItemGraphVertex>;\n\n\t/**\n\t * The entity storage for changesets.\n\t * @internal\n\t */\n\tprivate readonly _changesetStorage: IEntityStorageConnector<AuditableItemGraphChangeset>;\n\n\t/**\n\t * The event bus component.\n\t * @internal\n\t */\n\tprivate readonly _eventBusComponent?: IEventBusComponent;\n\n\t/**\n\t * Create a new instance of AuditableItemGraphService.\n\t * @param options The dependencies for the auditable item graph connector.\n\t */\n\tconstructor(options?: IAuditableItemGraphServiceConstructorOptions) {\n\t\tthis._immutableProofComponent = ComponentFactory.get(\n\t\t\toptions?.immutableProofComponentType ?? \"immutable-proof\"\n\t\t);\n\n\t\tthis._vertexStorage = EntityStorageConnectorFactory.get(\n\t\t\toptions?.vertexEntityStorageType ?? nameofKebabCase<AuditableItemGraphVertex>()\n\t\t);\n\n\t\tthis._changesetStorage = EntityStorageConnectorFactory.get(\n\t\t\toptions?.changesetEntityStorageType ?? nameofKebabCase<AuditableItemGraphChangeset>()\n\t\t);\n\n\t\tif (Is.stringValue(options?.eventBusComponentType)) {\n\t\t\tthis._eventBusComponent = ComponentFactory.get(options.eventBusComponentType);\n\t\t}\n\n\t\tSchemaOrgDataTypes.registerRedirects();\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn AuditableItemGraphService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a new graph vertex.\n\t * @param vertex The vertex to create.\n\t * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.\n\t * @param vertex.aliases Alternative aliases that can be used to identify the vertex.\n\t * @param vertex.resources The resources attached to the vertex.\n\t * @param vertex.edges The edges connected to the vertex.\n\t * @returns The id of the new graph item.\n\t */\n\tpublic async create(vertex: {\n\t\tannotationObject?: IJsonLdNodeObject;\n\t\taliases?: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tunique?: boolean;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tresources?: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tedges?: {\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t}): Promise<string> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(vertex), vertex);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\n\t\ttry {\n\t\t\tif (Is.object(vertex.annotationObject)) {\n\t\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\t\tawait JsonLdHelper.validate(vertex.annotationObject, validationFailures);\n\t\t\t\tValidation.asValidationError(\n\t\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\tnameof(vertex.annotationObject),\n\t\t\t\t\tvalidationFailures\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst id = Converter.bytesToHex(RandomHelper.generate(32), false);\n\n\t\t\tconst context: IAuditableItemGraphServiceContext = {\n\t\t\t\tnow: new Date(Date.now()).toISOString(),\n\t\t\t\tcontextIds\n\t\t\t};\n\n\t\t\tconst vertexModel: AuditableItemGraphVertex = {\n\t\t\t\tid,\n\t\t\t\torganizationIdentity: contextIds?.[ContextIdKeys.Organization],\n\t\t\t\tdateCreated: context.now\n\t\t\t};\n\t\t\tconst originalEntity = ObjectHelper.clone(vertexModel);\n\n\t\t\tvertexModel.annotationObject = vertex.annotationObject;\n\n\t\t\tawait this.updateAliasList(context, vertexModel, vertex.aliases);\n\t\t\tawait this.updateResourceList(context, vertexModel, vertex.resources);\n\t\t\tawait this.updateEdgeList(context, vertexModel, vertex.edges);\n\n\t\t\tdelete originalEntity.aliasIndex;\n\t\t\tdelete originalEntity.resourceTypeIndex;\n\t\t\tawait this.addChangeset(context, originalEntity, vertexModel, true);\n\n\t\t\tawait this._vertexStorage.set({\n\t\t\t\t...vertexModel,\n\t\t\t\t...this.buildIndexes(vertexModel)\n\t\t\t});\n\n\t\t\tconst fullId = new Urn(AuditableItemGraphService.NAMESPACE, id).toString();\n\n\t\t\tawait this._eventBusComponent?.publish<IAuditableItemGraphEventBusVertexCreated>(\n\t\t\t\tAuditableItemGraphTopics.VertexCreated,\n\t\t\t\t{ id: fullId }\n\t\t\t);\n\n\t\t\treturn fullId;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\"createFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Get a graph vertex.\n\t * @param id The id of the vertex to get.\n\t * @param options Additional options for the get operation.\n\t * @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.\n\t * @param options.includeChangesets Whether to include the changesets of the vertex, defaults to false.\n\t * @param options.verifySignatureDepth How many signatures to verify, defaults to \"none\".\n\t * @returns The vertex if found.\n\t * @throws NotFoundError if the vertex is not found.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tincludeDeleted?: boolean;\n\t\t\tincludeChangesets?: boolean;\n\t\t\tverifySignatureDepth?: VerifyDepth;\n\t\t}\n\t): Promise<IAuditableItemGraphVertex> {\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(id), id);\n\n\t\tconst urnParsed = Urn.fromValidString(id);\n\n\t\tif (urnParsed.namespaceIdentifier() !== AuditableItemGraphService.NAMESPACE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: AuditableItemGraphService.NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tconst vertexId = urnParsed.namespaceSpecific(0);\n\n\t\t\tconst vertexEntity = await this._vertexStorage.get(vertexId);\n\n\t\t\tif (Is.empty(vertexEntity)) {\n\t\t\t\tthrow new NotFoundError(AuditableItemGraphService.CLASS_NAME, \"vertexNotFound\", id);\n\t\t\t}\n\n\t\t\tconst vertexModel = this.vertexEntityToJsonLd(vertexEntity);\n\n\t\t\tconst includeChangesets = options?.includeChangesets ?? false;\n\t\t\tconst verifySignatureDepth = options?.verifySignatureDepth ?? \"none\";\n\n\t\t\tlet verified: boolean | undefined;\n\t\t\tlet changesets: IAuditableItemGraphChangeset[] | undefined;\n\n\t\t\tif (\n\t\t\t\tverifySignatureDepth === VerifyDepth.Current ||\n\t\t\t\tverifySignatureDepth === VerifyDepth.All ||\n\t\t\t\tincludeChangesets\n\t\t\t) {\n\t\t\t\tconst verifyResult = await this.verifyChangesets(vertexModel, verifySignatureDepth);\n\t\t\t\tverified = verifyResult.verified;\n\t\t\t\tchangesets = verifyResult.changesets;\n\t\t\t\tvertexModel[\"@context\"].push(ImmutableProofContexts.Context);\n\t\t\t}\n\n\t\t\tif (!(options?.includeDeleted ?? false)) {\n\t\t\t\tif (Is.arrayValue(vertexModel.aliases)) {\n\t\t\t\t\tvertexModel.aliases = vertexModel.aliases.filter(a => Is.undefined(a.dateDeleted));\n\t\t\t\t\tif (vertexModel.aliases.length === 0) {\n\t\t\t\t\t\tdelete vertexModel.aliases;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (Is.arrayValue(vertexModel.resources)) {\n\t\t\t\t\tvertexModel.resources = vertexModel.resources.filter(r => Is.undefined(r.dateDeleted));\n\t\t\t\t\tif (vertexModel.resources.length === 0) {\n\t\t\t\t\t\tdelete vertexModel.resources;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (Is.arrayValue(vertexModel.edges)) {\n\t\t\t\t\tvertexModel.edges = vertexModel.edges.filter(r => Is.undefined(r.dateDeleted));\n\t\t\t\t\tif (vertexModel.edges.length === 0) {\n\t\t\t\t\t\tdelete vertexModel.edges;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (includeChangesets) {\n\t\t\t\tvertexModel.changesets = changesets;\n\t\t\t}\n\n\t\t\tif (verifySignatureDepth !== VerifyDepth.None) {\n\t\t\t\tvertexModel.verified = verified;\n\t\t\t}\n\n\t\t\tconst result = await JsonLdProcessor.compact(vertexModel, vertexModel[\"@context\"]);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update a graph vertex.\n\t * @param vertex The vertex to update.\n\t * @param vertex.id The id of the vertex to update.\n\t * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.\n\t * @param vertex.aliases Alternative aliases that can be used to identify the vertex.\n\t * @param vertex.resources The resources attached to the vertex.\n\t * @param vertex.edges The edges connected to the vertex.\n\t * @returns Nothing.\n\t */\n\tpublic async update(vertex: {\n\t\tid: string;\n\t\tannotationObject?: IJsonLdNodeObject;\n\t\taliases?: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tresources?: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tedges?: {\n\t\t\tid?: string;\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t}): Promise<void> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(vertex), vertex);\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(vertex.id), vertex.id);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\n\t\tconst urnParsed = Urn.fromValidString(vertex.id);\n\n\t\tif (urnParsed.namespaceIdentifier() !== AuditableItemGraphService.NAMESPACE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: AuditableItemGraphService.NAMESPACE,\n\t\t\t\tid: vertex.id\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tconst vertexId = urnParsed.namespaceSpecific(0);\n\t\t\tconst vertexEntity = await this._vertexStorage.get(vertexId);\n\n\t\t\tif (Is.empty(vertexEntity)) {\n\t\t\t\tthrow new NotFoundError(AuditableItemGraphService.CLASS_NAME, \"vertexNotFound\", vertex.id);\n\t\t\t}\n\n\t\t\tif (Is.object(vertex.annotationObject)) {\n\t\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\t\tawait JsonLdHelper.validate(vertex.annotationObject, validationFailures);\n\t\t\t\tValidation.asValidationError(\n\t\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\tnameof(vertex.annotationObject),\n\t\t\t\t\tvalidationFailures\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst context: IAuditableItemGraphServiceContext = {\n\t\t\t\tnow: new Date(Date.now()).toISOString(),\n\t\t\t\tcontextIds\n\t\t\t};\n\n\t\t\tdelete vertexEntity.aliasIndex;\n\t\t\tconst originalEntity = ObjectHelper.clone(vertexEntity);\n\t\t\tconst newEntity = ObjectHelper.clone(vertexEntity);\n\n\t\t\tnewEntity.annotationObject = vertex.annotationObject;\n\n\t\t\tawait this.updateAliasList(context, newEntity, vertex.aliases);\n\t\t\tawait this.updateResourceList(context, newEntity, vertex.resources);\n\t\t\tawait this.updateEdgeList(context, newEntity, vertex.edges);\n\n\t\t\tconst patches = await this.addChangeset(context, originalEntity, newEntity, false);\n\t\t\tif (patches.length > 0) {\n\t\t\t\tnewEntity.dateModified = context.now;\n\n\t\t\t\tconst indexes = this.buildIndexes(newEntity);\n\n\t\t\t\tawait this._vertexStorage.set({\n\t\t\t\t\t...newEntity,\n\t\t\t\t\t...indexes\n\t\t\t\t});\n\n\t\t\t\tawait this._eventBusComponent?.publish<IAuditableItemGraphEventBusVertexUpdated>(\n\t\t\t\t\tAuditableItemGraphTopics.VertexUpdated,\n\t\t\t\t\t{ id: vertex.id, patches }\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\"updatingFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Remove the verifiable storage for an item.\n\t * @param id The id of the vertex to get.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the vertex is not found.\n\t */\n\tpublic async removeVerifiable(id: string): Promise<void> {\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(id), id);\n\n\t\tconst urnParsed = Urn.fromValidString(id);\n\n\t\tif (urnParsed.namespaceIdentifier() !== AuditableItemGraphService.NAMESPACE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: AuditableItemGraphService.NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tconst vertexId = urnParsed.namespaceSpecific(0);\n\t\t\tconst vertexEntity = await this._vertexStorage.get(vertexId);\n\n\t\t\tif (Is.empty(vertexEntity)) {\n\t\t\t\tthrow new NotFoundError(AuditableItemGraphService.CLASS_NAME, \"vertexNotFound\", id);\n\t\t\t}\n\n\t\t\tlet changesetsResult;\n\t\t\tdo {\n\t\t\t\tchangesetsResult = await this._changesetStorage.query(\n\t\t\t\t\t{\n\t\t\t\t\t\tproperty: \"vertexId\",\n\t\t\t\t\t\tvalue: vertexId,\n\t\t\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tproperty: \"dateCreated\",\n\t\t\t\t\t\t\tsortDirection: SortDirection.Ascending\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tundefined,\n\t\t\t\t\tchangesetsResult?.cursor\n\t\t\t\t);\n\n\t\t\t\tfor (const changeset of changesetsResult.entities) {\n\t\t\t\t\tif (Is.stringValue(changeset.proofId)) {\n\t\t\t\t\t\tawait this._immutableProofComponent.removeVerifiable(changeset.proofId);\n\t\t\t\t\t\tdelete changeset.proofId;\n\t\t\t\t\t\tawait this._changesetStorage.set(changeset as AuditableItemGraphChangeset);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (Is.stringValue(changesetsResult.cursor));\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\"removeVerifiableFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Query the graph for vertices.\n\t * @param options The query options.\n\t * @param options.id The optional id to look for.\n\t * @param options.idMode Look in id, alias or both, defaults to both.\n\t * @param options.idExact Find only exact matches, default to false meaning partial matching.\n\t * @param options.includesResourceTypes Include vertices with specific resource types.\n\t * @param conditions Conditions to use in the query.\n\t * @param orderBy The order for the results, defaults to created.\n\t * @param orderByDirection The direction for the order, defaults to desc.\n\t * @param properties The properties to return, if not provided defaults to id, created, aliases and object.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit Limit the number of entities to return.\n\t * @returns The entities, which can be partial if a limited keys list was provided.\n\t */\n\tpublic async query(\n\t\toptions?: {\n\t\t\tid?: string;\n\t\t\tidMode?: \"id\" | \"alias\" | \"both\";\n\t\t\tidExact?: boolean;\n\t\t\tincludesResourceTypes?: string[];\n\t\t},\n\t\tconditions?: IComparator[],\n\t\torderBy?: keyof Pick<IAuditableItemGraphVertex, \"dateCreated\" | \"dateModified\">,\n\t\torderByDirection?: SortDirection,\n\t\tproperties?: (keyof IAuditableItemGraphVertex)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<IAuditableItemGraphVertexList> {\n\t\ttry {\n\t\t\tconst propertiesToReturn: (keyof IAuditableItemGraphVertex)[] = properties ?? [\n\t\t\t\t\"id\",\n\t\t\t\t\"dateCreated\",\n\t\t\t\t\"dateModified\",\n\t\t\t\t\"aliases\",\n\t\t\t\t\"annotationObject\"\n\t\t\t];\n\t\t\tconst combinedConditions = conditions ?? [];\n\t\t\tconst orderProperty = orderBy ?? \"dateCreated\";\n\t\t\tconst orderDirection = orderByDirection ?? SortDirection.Descending;\n\t\t\tconst idExact = options?.idExact ?? false;\n\n\t\t\tconst idOrAlias = options?.id;\n\t\t\tif (Is.stringValue(idOrAlias)) {\n\t\t\t\tconst idMode = options?.idMode ?? \"both\";\n\t\t\t\tif (idMode === \"id\" || idMode === \"both\") {\n\t\t\t\t\tcombinedConditions.push({\n\t\t\t\t\t\tproperty: \"id\",\n\t\t\t\t\t\tcomparison: idExact ? ComparisonOperator.Equals : ComparisonOperator.Includes,\n\t\t\t\t\t\tvalue: idOrAlias\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (idMode === \"alias\" || idMode === \"both\") {\n\t\t\t\t\tcombinedConditions.push({\n\t\t\t\t\t\tproperty: \"aliasIndex\",\n\t\t\t\t\t\tcomparison: ComparisonOperator.Includes,\n\t\t\t\t\t\tvalue: idExact ? `||${idOrAlias.toLowerCase()}||` : idOrAlias.toLowerCase()\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (Is.arrayValue(options?.includesResourceTypes)) {\n\t\t\t\tfor (const resourceType of options.includesResourceTypes) {\n\t\t\t\t\tcombinedConditions.push({\n\t\t\t\t\t\tproperty: \"resourceTypeIndex\",\n\t\t\t\t\t\tcomparison: ComparisonOperator.Includes,\n\t\t\t\t\t\tvalue: `||${resourceType.toLowerCase()}||`\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!propertiesToReturn.includes(\"id\")) {\n\t\t\t\tpropertiesToReturn.unshift(\"id\");\n\t\t\t}\n\n\t\t\tconst results = await this._vertexStorage.query(\n\t\t\t\tcombinedConditions.length > 0\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tconditions: combinedConditions,\n\t\t\t\t\t\t\tlogicalOperator: LogicalOperator.Or\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tproperty: orderProperty,\n\t\t\t\t\t\tsortDirection: orderDirection\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tpropertiesToReturn as (keyof AuditableItemGraphVertex)[],\n\t\t\t\tcursor,\n\t\t\t\tlimit\n\t\t\t);\n\n\t\t\tconst models: IAuditableItemGraphVertex[] = results.entities.map(e =>\n\t\t\t\tthis.vertexEntityToJsonLd(e as AuditableItemGraphVertex)\n\t\t\t);\n\n\t\t\tconst vertexList: IAuditableItemGraphVertexList = {\n\t\t\t\t\"@context\": [\n\t\t\t\t\tSchemaOrgContexts.Context,\n\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\tAuditableItemGraphContexts.ContextCommon\n\t\t\t\t],\n\t\t\t\ttype: [SchemaOrgTypes.ItemList, AuditableItemGraphTypes.VertexList],\n\t\t\t\t[SchemaOrgTypes.ItemListElement]: models,\n\t\t\t\t[SchemaOrgTypes.NextItem]: results.cursor\n\t\t\t};\n\n\t\t\tconst result = await JsonLdProcessor.compact(vertexList, vertexList[\"@context\"]);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\"queryingFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Map the vertex entity to JSON-LD.\n\t * @param vertexEntity The vertex entity.\n\t * @returns The model.\n\t * @internal\n\t */\n\tprivate vertexEntityToJsonLd(vertexEntity: AuditableItemGraphVertex): IAuditableItemGraphVertex {\n\t\tconst model: IAuditableItemGraphVertex = {\n\t\t\t\"@context\": [\n\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\tSchemaOrgContexts.Context\n\t\t\t],\n\t\t\ttype: AuditableItemGraphTypes.Vertex,\n\t\t\tid: new Urn(AuditableItemGraphService.NAMESPACE, vertexEntity.id).toString(),\n\t\t\tdateCreated: vertexEntity.dateCreated,\n\t\t\tdateModified: vertexEntity.dateModified,\n\t\t\torganizationIdentity: vertexEntity.organizationIdentity,\n\t\t\tannotationObject: vertexEntity.annotationObject\n\t\t};\n\n\t\tif (Is.arrayValue(vertexEntity.aliases)) {\n\t\t\tmodel.aliases ??= [];\n\t\t\tfor (const aliasEntity of vertexEntity.aliases) {\n\t\t\t\tconst aliasModel: IAuditableItemGraphAlias = {\n\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t],\n\t\t\t\t\ttype: AuditableItemGraphTypes.Alias,\n\t\t\t\t\tid: aliasEntity.id,\n\t\t\t\t\taliasFormat: aliasEntity.aliasFormat,\n\t\t\t\t\tdateCreated: aliasEntity.dateCreated,\n\t\t\t\t\tdateModified: aliasEntity.dateModified,\n\t\t\t\t\tdateDeleted: aliasEntity.dateDeleted,\n\t\t\t\t\tannotationObject: aliasEntity.annotationObject\n\t\t\t\t};\n\t\t\t\tmodel.aliases.push(aliasModel);\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(vertexEntity.resources)) {\n\t\t\tmodel.resources ??= [];\n\t\t\tfor (const resourceEntity of vertexEntity.resources) {\n\t\t\t\tconst resourceModel: IAuditableItemGraphResource = {\n\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t],\n\t\t\t\t\ttype: AuditableItemGraphTypes.Resource,\n\t\t\t\t\tid: resourceEntity.id,\n\t\t\t\t\tdateCreated: resourceEntity.dateCreated,\n\t\t\t\t\tdateModified: resourceEntity.dateModified,\n\t\t\t\t\tdateDeleted: resourceEntity.dateDeleted,\n\t\t\t\t\tresourceObject: resourceEntity.resourceObject\n\t\t\t\t};\n\t\t\t\tmodel.resources.push(resourceModel);\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(vertexEntity.edges)) {\n\t\t\tmodel.edges ??= [];\n\t\t\tfor (const edgeEntity of vertexEntity.edges) {\n\t\t\t\tconst edgeModel: IAuditableItemGraphEdge = {\n\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t],\n\t\t\t\t\ttype: AuditableItemGraphTypes.Edge,\n\t\t\t\t\tid: this.fullEdgeId(vertexEntity.id, edgeEntity.id),\n\t\t\t\t\ttargetId: edgeEntity.targetId,\n\t\t\t\t\tdateCreated: edgeEntity.dateCreated,\n\t\t\t\t\tdateModified: edgeEntity.dateModified,\n\t\t\t\t\tdateDeleted: edgeEntity.dateDeleted,\n\t\t\t\t\tedgeRelationships: edgeEntity.edgeRelationships,\n\t\t\t\t\tannotationObject: edgeEntity.annotationObject\n\t\t\t\t};\n\t\t\t\tmodel.edges.push(edgeModel);\n\t\t\t}\n\t\t}\n\n\t\treturn model;\n\t}\n\n\t/**\n\t * Map the changeset entity to a JSON-LD.\n\t * @param vertexId The id of the vertex the changeset belongs to.\n\t * @param changesetEntity The changeset entity.\n\t * @returns The model.\n\t * @internal\n\t */\n\tprivate changesetEntityToJsonLd(\n\t\tvertexId: string,\n\t\tchangesetEntity: AuditableItemGraphChangeset\n\t): IAuditableItemGraphChangeset {\n\t\tconst model: IAuditableItemGraphChangeset = {\n\t\t\t\"@context\": [\n\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\tSchemaOrgContexts.Context\n\t\t\t],\n\t\t\ttype: AuditableItemGraphTypes.Changeset,\n\t\t\tid: new Urn(AuditableItemGraphService.NAMESPACE, [\n\t\t\t\tvertexId,\n\t\t\t\tAuditableItemGraphService.NAMESPACE_CHANGESET,\n\t\t\t\tchangesetEntity.id\n\t\t\t]).toString(),\n\t\t\tdateCreated: changesetEntity.dateCreated,\n\t\t\tuserIdentity: changesetEntity.userIdentity,\n\t\t\tpatches: changesetEntity.patches.map(p => ({\n\t\t\t\t\"@context\": [\n\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t],\n\t\t\t\ttype: AuditableItemGraphTypes.PatchOperation,\n\t\t\t\tpatchOperation: p.op,\n\t\t\t\tpatchPath: p.path,\n\t\t\t\tpatchFrom: p.from,\n\t\t\t\tpatchValue: p.value\n\t\t\t})),\n\t\t\tproofId: changesetEntity.proofId\n\t\t};\n\n\t\treturn model;\n\t}\n\n\t/**\n\t * Update the aliases of a vertex model.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param aliases The aliases to update.\n\t * @internal\n\t */\n\tprivate async updateAliasList(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\taliases?: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[]\n\t): Promise<void> {\n\t\tconst active = vertex.aliases?.filter(a => Is.empty(a.dateDeleted)) ?? [];\n\n\t\t// The active aliases that are not in the update list should be marked as deleted.\n\t\tif (Is.arrayValue(active)) {\n\t\t\tfor (const alias of active) {\n\t\t\t\tif (!aliases?.find(a => a.id === alias.id)) {\n\t\t\t\t\talias.dateDeleted = context.now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(aliases)) {\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tawait this.updateAlias(context, vertex, alias);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update an alias in the vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param alias The alias.\n\t * @internal\n\t */\n\tprivate async updateAlias(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\talias: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tunique?: boolean;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}\n\t): Promise<void> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(alias), alias);\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(alias.id), alias.id);\n\n\t\tif (alias.unique ?? false) {\n\t\t\tconst existingVertices = await this.findMatchingVertices(context, vertex.id, alias.id);\n\t\t\tif (existingVertices) {\n\t\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"aliasNotUnique\", {\n\t\t\t\t\taliasId: alias.id\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (Is.object(alias.annotationObject)) {\n\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\tawait JsonLdHelper.validate(alias.annotationObject, validationFailures);\n\t\t\tValidation.asValidationError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\tnameof(alias.annotationObject),\n\t\t\t\tvalidationFailures\n\t\t\t);\n\t\t}\n\n\t\t// Try to find an existing alias with the same id.\n\t\tconst existing = vertex.aliases?.find(a => a.id === alias.id);\n\n\t\tif (Is.empty(existing) || !Is.empty(existing?.dateDeleted)) {\n\t\t\t// Did not find a matching item, or found one which is deleted.\n\t\t\tvertex.aliases ??= [];\n\n\t\t\tconst model: AuditableItemGraphAlias = {\n\t\t\t\tid: alias.id,\n\t\t\t\taliasFormat: alias.aliasFormat,\n\t\t\t\tdateCreated: context.now,\n\t\t\t\tannotationObject: alias.annotationObject\n\t\t\t};\n\n\t\t\tvertex.aliases.push(model);\n\t\t} else if (\n\t\t\texisting.aliasFormat !== alias.aliasFormat ||\n\t\t\t!ObjectHelper.equal(existing.annotationObject, alias.annotationObject, false)\n\t\t) {\n\t\t\t// Existing alias found, update the annotationObject.\n\t\t\texisting.dateModified = context.now;\n\t\t\texisting.aliasFormat = alias.aliasFormat;\n\t\t\texisting.annotationObject = alias.annotationObject;\n\t\t}\n\t}\n\n\t/**\n\t * Update the resources of a vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param resources The resources to update.\n\t * @internal\n\t */\n\tprivate async updateResourceList(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\tresources?: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}[]\n\t): Promise<void> {\n\t\tif (Is.arrayValue(resources)) {\n\t\t\tfor (let i = 0; i < resources.length; i++) {\n\t\t\t\tconst id = this.getResourceId(resources[i]);\n\t\t\t\tif (Is.empty(id)) {\n\t\t\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"resourceIdMissing\", {\n\t\t\t\t\t\tindex: i\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst active = vertex.resources?.filter(r => Is.empty(r.dateDeleted)) ?? [];\n\n\t\t// The active resources that are not in the update list should be marked as deleted.\n\t\tif (Is.arrayValue(active)) {\n\t\t\tfor (const resource of active) {\n\t\t\t\tif (!resources?.find(a => this.getResourceId(a) === this.getResourceId(resource))) {\n\t\t\t\t\tresource.dateDeleted = context.now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(resources)) {\n\t\t\tfor (const resource of resources) {\n\t\t\t\tawait this.updateResource(context, vertex, resource);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Add a resource to the vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param resource The resource.\n\t * @internal\n\t */\n\tprivate async updateResource(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\tresource: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}\n\t): Promise<void> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(resource), resource);\n\n\t\tif (Is.object(resource.resourceObject)) {\n\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\tawait JsonLdHelper.validate(resource.resourceObject, validationFailures);\n\t\t\tValidation.asValidationError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\tnameof(resource.resourceObject),\n\t\t\t\tvalidationFailures\n\t\t\t);\n\t\t}\n\n\t\t// Try to find an existing resource with the same id.\n\t\tconst existing = vertex.resources?.find(\n\t\t\tr => this.getResourceId(r) === this.getResourceId(resource)\n\t\t);\n\n\t\tif (Is.empty(existing) || !Is.empty(existing?.dateDeleted)) {\n\t\t\t// Did not find a matching item, or found one which is deleted.\n\t\t\tvertex.resources ??= [];\n\n\t\t\tconst model: AuditableItemGraphResource = {\n\t\t\t\tid: resource.id,\n\t\t\t\tdateCreated: context.now,\n\t\t\t\tresourceObject: resource.resourceObject\n\t\t\t};\n\n\t\t\tvertex.resources.push(model);\n\t\t} else if (!ObjectHelper.equal(existing.resourceObject, resource.resourceObject, false)) {\n\t\t\t// Existing resource found, update the resourceObject.\n\t\t\texisting.dateModified = context.now;\n\t\t\texisting.resourceObject = resource.resourceObject;\n\t\t}\n\t}\n\n\t/**\n\t * Update the edges of a vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param edges The edges to update.\n\t * @internal\n\t */\n\tprivate async updateEdgeList(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\tedges?: {\n\t\t\tid?: string;\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[]\n\t): Promise<void> {\n\t\tconst active = vertex.edges?.filter(e => Is.empty(e.dateDeleted)) ?? [];\n\n\t\t// The active edges that are not in the update list should be marked as deleted.\n\t\tif (Is.arrayValue(active)) {\n\t\t\tfor (const edge of active) {\n\t\t\t\tif (!edges?.find(e => Is.stringValue(e.id) && this.reduceEdgeId(e.id) === edge.id)) {\n\t\t\t\t\tedge.dateDeleted = context.now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(edges)) {\n\t\t\tfor (const edge of edges) {\n\t\t\t\tawait this.updateEdge(context, vertex, edge);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Add an edge to the vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param edge The edge.\n\t * @internal\n\t */\n\tprivate async updateEdge(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\tedge: {\n\t\t\tid?: string;\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}\n\t): Promise<void> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(edge), edge);\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(edge.targetId), edge.targetId);\n\t\tGuards.arrayValue(\n\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\tnameof(edge.edgeRelationships),\n\t\t\tedge.edgeRelationships\n\t\t);\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tif (edge.targetId === vertex.id) {\n\t\t\tvalidationFailures.push({\n\t\t\t\tproperty: \"id\",\n\t\t\t\treason: `validation.${StringHelper.camelCase(AuditableItemGraphService.CLASS_NAME)}.edgeIdSameAsVertexId`,\n\t\t\t\tproperties: {\n\t\t\t\t\ttargetId: edge.targetId\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (Is.object(edge.annotationObject)) {\n\t\t\tawait JsonLdHelper.validate(edge.annotationObject, validationFailures);\n\t\t}\n\t\tValidation.asValidationError(\n\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\tnameof(edge.annotationObject),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tlet findId = Is.stringValue(edge.id) ? this.reduceEdgeId(edge.id) : undefined;\n\t\tif (Is.empty(findId)) {\n\t\t\tfindId = Converter.bytesToHex(RandomHelper.generate(32), false);\n\t\t}\n\n\t\t// Try to find an existing edge with the same id.\n\t\tconst existing = vertex.edges?.find(r => r.id === findId);\n\n\t\tif (Is.empty(existing) || !Is.empty(existing?.dateDeleted)) {\n\t\t\t// Did not find a matching item, or found one which is deleted.\n\t\t\tvertex.edges ??= [];\n\n\t\t\tconst model: AuditableItemGraphEdge = {\n\t\t\t\tid: findId,\n\t\t\t\ttargetId: edge.targetId,\n\t\t\t\tdateCreated: context.now,\n\t\t\t\tannotationObject: edge.annotationObject,\n\t\t\t\tedgeRelationships: edge.edgeRelationships\n\t\t\t};\n\n\t\t\tvertex.edges.push(model);\n\t\t} else if (\n\t\t\texisting.targetId !== edge.targetId ||\n\t\t\t!ArrayHelper.matches(existing.edgeRelationships, edge.edgeRelationships) ||\n\t\t\t!ObjectHelper.equal(existing.annotationObject, edge.annotationObject, false)\n\t\t) {\n\t\t\t// Existing edge found, update the properties.\n\t\t\texisting.targetId = edge.targetId;\n\t\t\texisting.dateModified = context.now;\n\t\t\texisting.edgeRelationships = edge.edgeRelationships;\n\t\t\texisting.annotationObject = edge.annotationObject;\n\t\t}\n\t}\n\n\t/**\n\t * Add a changeset to the vertex and generate the associated verifications.\n\t * @param context The context for the operation.\n\t * @param original The original vertex.\n\t * @param updated The updated vertex.\n\t * @param isNew Whether this is a new item.\n\t * @returns True if there were changes.\n\t * @internal\n\t */\n\tprivate async addChangeset(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\toriginal: AuditableItemGraphVertex,\n\t\tupdated: AuditableItemGraphVertex,\n\t\tisNew: boolean\n\t): Promise<IPatchOperation[]> {\n\t\tconst patches = JsonHelper.diff(original, updated);\n\n\t\t// If there is a diff set or this is the first time the item is created.\n\t\tif (patches.length > 0 || isNew) {\n\t\t\tconst changesetEntity: AuditableItemGraphChangeset = {\n\t\t\t\tid: Converter.bytesToHex(RandomHelper.generate(32), false),\n\t\t\t\tvertexId: updated.id,\n\t\t\t\tdateCreated: context.now,\n\t\t\t\tuserIdentity: context.contextIds?.[ContextIdKeys.User],\n\t\t\t\tpatches\n\t\t\t};\n\n\t\t\t// Create the JSON-LD object we want to use for the proof\n\t\t\t// this is a subset of fixed properties from the changeset object.\n\t\t\tconst reducedChangesetJsonLd = this.changesetEntityToJsonLd(\n\t\t\t\toriginal.id,\n\t\t\t\tObjectHelper.pick(\n\t\t\t\t\tchangesetEntity,\n\t\t\t\t\tAuditableItemGraphService._PROOF_KEYS_CHANGESET\n\t\t\t\t) as AuditableItemGraphChangeset\n\t\t\t);\n\n\t\t\t// Create the proof for the changeset object\n\t\t\tchangesetEntity.proofId = await this._immutableProofComponent.create(\n\t\t\t\treducedChangesetJsonLd as unknown as IJsonLdNodeObject\n\t\t\t);\n\n\t\t\t// Link the verifiable storage id to the changeset\n\t\t\tawait this._changesetStorage.set(changesetEntity);\n\n\t\t\treturn patches;\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Verify the changesets of a vertex.\n\t * @param vertex The vertex to verify.\n\t * @param verifySignatureDepth How many signatures to verify.\n\t * @param contextIds The context ids to perform the operation with.\n\t * @internal\n\t */\n\tprivate async verifyChangesets(\n\t\tvertex: IAuditableItemGraphVertex,\n\t\tverifySignatureDepth: VerifyDepth,\n\t\tpartitionKey?: string\n\t): Promise<{\n\t\tverified: boolean;\n\t\tchangesets: IAuditableItemGraphChangeset[];\n\t}> {\n\t\tconst changesets: IAuditableItemGraphChangeset[] = [];\n\n\t\tlet changesetsResult;\n\t\tlet verified = true;\n\n\t\tconst vertexId = Urn.fromValidString(vertex.id);\n\n\t\tdo {\n\t\t\tchangesetsResult = await this._changesetStorage.query(\n\t\t\t\t{\n\t\t\t\t\tproperty: \"vertexId\",\n\t\t\t\t\tvalue: vertexId.namespaceSpecific(),\n\t\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t\t},\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tproperty: \"dateCreated\",\n\t\t\t\t\t\tsortDirection: SortDirection.Ascending\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tundefined,\n\t\t\t\tchangesetsResult?.cursor\n\t\t\t);\n\n\t\t\tconst storedChangesets = changesetsResult.entities as AuditableItemGraphChangeset[];\n\t\t\tif (Is.arrayValue(storedChangesets)) {\n\t\t\t\tfor (let i = 0; i < storedChangesets.length; i++) {\n\t\t\t\t\tconst storedChangeset = storedChangesets[i];\n\n\t\t\t\t\tconst storedChangesetJsonLd = this.changesetEntityToJsonLd(\n\t\t\t\t\t\tvertexId.namespaceSpecific(),\n\t\t\t\t\t\tstoredChangeset\n\t\t\t\t\t);\n\t\t\t\t\tchangesets.push(storedChangesetJsonLd);\n\n\t\t\t\t\t// If we are verifying all signatures\n\t\t\t\t\t// or this is the last changeset (cursor is empty)\n\t\t\t\t\t// and the changeset has a proofId, then verify the proof.\n\t\t\t\t\tif (\n\t\t\t\t\t\tverifySignatureDepth === VerifyDepth.All ||\n\t\t\t\t\t\t(verifySignatureDepth === VerifyDepth.Current &&\n\t\t\t\t\t\t\t!Is.stringValue(changesetsResult.cursor) &&\n\t\t\t\t\t\t\ti === storedChangesets.length - 1)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (!Is.stringValue(storedChangeset.proofId)) {\n\t\t\t\t\t\t\tverified = false;\n\t\t\t\t\t\t\tstoredChangesetJsonLd.verification = {\n\t\t\t\t\t\t\t\t\"@context\": ImmutableProofContexts.Namespace,\n\t\t\t\t\t\t\t\ttype: ImmutableProofTypes.ImmutableProofVerification,\n\t\t\t\t\t\t\t\tverified: false,\n\t\t\t\t\t\t\t\tfailure: ImmutableProofFailure.ProofMissing\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Verify the proof for the changeset object\n\t\t\t\t\t\t\tstoredChangesetJsonLd.verification = await this._immutableProofComponent.verify(\n\t\t\t\t\t\t\t\tstoredChangeset.proofId\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (!storedChangesetJsonLd.verification.verified) {\n\t\t\t\t\t\t\t\tverified = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} while (Is.stringValue(changesetsResult.cursor));\n\n\t\treturn {\n\t\t\tverified,\n\t\t\tchangesets\n\t\t};\n\t}\n\n\t/**\n\t * Get the resource id from a resource object.\n\t * @param resource The resource.\n\t * @param resource.id The id of the resource.\n\t * @param resource.resourceObject The resource object.\n\t * @returns The resource id if it can find one.\n\t */\n\tprivate getResourceId(resource: {\n\t\tid?: string;\n\t\tresourceObject?: IJsonLdNodeObject;\n\t}): string | undefined {\n\t\treturn (\n\t\t\tresource.id ??\n\t\t\tObjectHelper.extractProperty<string>(resource.resourceObject, [\"id\", \"@id\"], false)\n\t\t);\n\t}\n\n\t/**\n\t * Build the indexes for the vertex.\n\t * @param vertex The vertex to build the indexes for.\n\t * @returns The indexes.\n\t * @internal\n\t */\n\tprivate buildIndexes(vertex: AuditableItemGraphVertex): {\n\t\taliasIndex?: string;\n\t\tresourceTypeIndex?: string;\n\t} {\n\t\tconst aliasIndex = vertex.aliases\n\t\t\t?.filter(a => Is.empty(a.dateDeleted))\n\t\t\t.map(a => a.id)\n\t\t\t.join(\"||\")\n\t\t\t.toLowerCase();\n\n\t\tconst resourceTypes: string[] = [];\n\t\tif (Is.arrayValue(vertex.resources)) {\n\t\t\tfor (const resource of vertex.resources) {\n\t\t\t\tconst resourceType = ObjectHelper.extractProperty<string>(\n\t\t\t\t\tresource.resourceObject,\n\t\t\t\t\t[\"@type\", \"type\"],\n\t\t\t\t\tfalse\n\t\t\t\t);\n\n\t\t\t\tif (Is.stringValue(resourceType) && !resourceTypes.includes(resourceType)) {\n\t\t\t\t\tresourceTypes.push(resourceType);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst resourceTypeIndex = resourceTypes.join(\"||\").toLowerCase();\n\n\t\treturn {\n\t\t\taliasIndex: Is.stringValue(aliasIndex) ? `||${aliasIndex}||` : undefined,\n\t\t\tresourceTypeIndex: Is.stringValue(resourceTypeIndex) ? `||${resourceTypeIndex}||` : undefined\n\t\t};\n\t}\n\n\t/**\n\t * Find vertices with matching aliases.\n\t * @param context The context for the operation.\n\t * @param vertexId The id of the vertex to exclude from the search.\n\t * @param aliasId The alias id to try and find.\n\t * @returns True if any other vertices have matching aliases.\n\t * @internal\n\t */\n\tprivate async findMatchingVertices(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertexId: string,\n\t\taliasId: string\n\t): Promise<boolean> {\n\t\tconst results = await this._vertexStorage.query({\n\t\t\tconditions: [\n\t\t\t\t{\n\t\t\t\t\tproperty: \"aliasIndex\",\n\t\t\t\t\tcomparison: ComparisonOperator.Includes,\n\t\t\t\t\tvalue: `||${aliasId.toLowerCase()}||`\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: \"id\",\n\t\t\t\t\tvalue: vertexId,\n\t\t\t\t\tcomparison: ComparisonOperator.NotEquals\n\t\t\t\t}\n\t\t\t],\n\t\t\tlogicalOperator: LogicalOperator.And\n\t\t});\n\n\t\treturn results.entities.length > 0;\n\t}\n\n\t/**\n\t * Reduce the edge ID from a URN.\n\t * @param urn The URN to reduce.\n\t * @returns The edge ID.\n\t * @throws GeneralError if the URN is not valid or not an edge URN.\n\t * @internal\n\t */\n\tprivate reduceEdgeId(urn: string): string {\n\t\tconst urnParsed = Urn.fromValidString(urn);\n\t\tif (urnParsed.namespaceIdentifier() !== AuditableItemGraphService.NAMESPACE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: AuditableItemGraphService.NAMESPACE,\n\t\t\t\tid: urn\n\t\t\t});\n\t\t}\n\t\tif (urnParsed.namespaceSpecificParts().length !== 3) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"invalidEdgeId\", {\n\t\t\t\tedgeId: urn\n\t\t\t});\n\t\t}\n\t\tif (urnParsed.namespaceSpecificParts()[1] !== AuditableItemGraphService.NAMESPACE_EDGE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"invalidEdgeId\", {\n\t\t\t\tedgeId: urn\n\t\t\t});\n\t\t}\n\t\treturn urnParsed.namespaceSpecificParts()[2];\n\t}\n\n\t/**\n\t * Create a full edge ID URN from a vertex ID and edge ID.\n\t * @param vertexId The vertex id the edge belongs to.\n\t * @param edgeId The edge id.\n\t * @returns The full edge ID URN.\n\t * @internal\n\t */\n\tprivate fullEdgeId(vertexId: string, edgeId: string): string {\n\t\treturn new Urn(AuditableItemGraphService.NAMESPACE, [\n\t\t\tvertexId,\n\t\t\tAuditableItemGraphService.NAMESPACE_EDGE,\n\t\t\tedgeId\n\t\t]).toString();\n\t}\n}\n"]}
1
+ {"version":3,"file":"auditableItemGraphService.js","sourceRoot":"","sources":["../../src/auditableItemGraphService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAA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,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACK,UAAU,CAAC,QAAgB,EAAE,MAAc;QAClD,OAAO,IAAI,GAAG,CAAC,yBAAyB,CAAC,SAAS,EAAE;YACnD,QAAQ;YACR,yBAAyB,CAAC,cAAc;YACxC,MAAM;SACN,CAAC,CAAC,QAAQ,EAAE,CAAC;IACf,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tAuditableItemGraphContexts,\n\tAuditableItemGraphTopics,\n\tAuditableItemGraphTypes,\n\tVerifyDepth,\n\ttype IAuditableItemGraphAlias,\n\ttype IAuditableItemGraphChangeset,\n\ttype IAuditableItemGraphComponent,\n\ttype IAuditableItemGraphEdge,\n\ttype IAuditableItemGraphEventBusVertexCreated,\n\ttype IAuditableItemGraphEventBusVertexUpdated,\n\ttype IAuditableItemGraphResource,\n\ttype IAuditableItemGraphVertex,\n\ttype IAuditableItemGraphVertexList\n} from \"@twin.org/auditable-item-graph-models\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tArrayHelper,\n\tComponentFactory,\n\tConverter,\n\tGeneralError,\n\tGuards,\n\tIs,\n\tJsonHelper,\n\tNotFoundError,\n\tObjectHelper,\n\tRandomHelper,\n\tStringHelper,\n\tUrn,\n\tValidation,\n\ttype IPatchOperation,\n\ttype IValidationFailure\n} from \"@twin.org/core\";\nimport { JsonLdHelper, JsonLdProcessor, type IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport {\n\tComparisonOperator,\n\tLogicalOperator,\n\tSortDirection,\n\ttype IComparator\n} from \"@twin.org/entity\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport type { IEventBusComponent } from \"@twin.org/event-bus-models\";\nimport {\n\tImmutableProofContexts,\n\tImmutableProofFailure,\n\tImmutableProofTypes,\n\ttype IImmutableProofComponent\n} from \"@twin.org/immutable-proof-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\tSchemaOrgContexts,\n\tSchemaOrgDataTypes,\n\tSchemaOrgTypes\n} from \"@twin.org/standards-schema-org\";\nimport type { AuditableItemGraphAlias } from \"./entities/auditableItemGraphAlias.js\";\nimport type { AuditableItemGraphChangeset } from \"./entities/auditableItemGraphChangeset.js\";\nimport type { AuditableItemGraphEdge } from \"./entities/auditableItemGraphEdge.js\";\nimport type { AuditableItemGraphResource } from \"./entities/auditableItemGraphResource.js\";\nimport type { AuditableItemGraphVertex } from \"./entities/auditableItemGraphVertex.js\";\nimport type { IAuditableItemGraphServiceConstructorOptions } from \"./models/IAuditableItemGraphServiceConstructorOptions.js\";\nimport type { IAuditableItemGraphServiceContext } from \"./models/IAuditableItemGraphServiceContext.js\";\n\n/**\n * Class for performing auditable item graph operations.\n */\nexport class AuditableItemGraphService implements IAuditableItemGraphComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<AuditableItemGraphService>();\n\n\t/**\n\t * The namespace for the service.\n\t * @internal\n\t */\n\tpublic static readonly NAMESPACE: string = \"aig\";\n\n\t/**\n\t * The namespace for the service changeset.\n\t */\n\tpublic static readonly NAMESPACE_CHANGESET: string = \"changeset\";\n\n\t/**\n\t * The namespace for the service edge.\n\t */\n\tpublic static readonly NAMESPACE_EDGE: string = \"edge\";\n\n\t/**\n\t * The keys to pick when creating the proof for the stream.\n\t * @internal\n\t */\n\tprivate static readonly _PROOF_KEYS_CHANGESET: (keyof AuditableItemGraphChangeset)[] = [\n\t\t\"id\",\n\t\t\"vertexId\",\n\t\t\"userIdentity\",\n\t\t\"dateCreated\",\n\t\t\"patches\"\n\t];\n\n\t/**\n\t * The immutable proof component.\n\t * @internal\n\t */\n\tprivate readonly _immutableProofComponent: IImmutableProofComponent;\n\n\t/**\n\t * The entity storage for vertices.\n\t * @internal\n\t */\n\tprivate readonly _vertexStorage: IEntityStorageConnector<AuditableItemGraphVertex>;\n\n\t/**\n\t * The entity storage for changesets.\n\t * @internal\n\t */\n\tprivate readonly _changesetStorage: IEntityStorageConnector<AuditableItemGraphChangeset>;\n\n\t/**\n\t * The event bus component.\n\t * @internal\n\t */\n\tprivate readonly _eventBusComponent?: IEventBusComponent;\n\n\t/**\n\t * Create a new instance of AuditableItemGraphService.\n\t * @param options The dependencies for the auditable item graph connector.\n\t */\n\tconstructor(options?: IAuditableItemGraphServiceConstructorOptions) {\n\t\tthis._immutableProofComponent = ComponentFactory.get(\n\t\t\toptions?.immutableProofComponentType ?? \"immutable-proof\"\n\t\t);\n\n\t\tthis._vertexStorage = EntityStorageConnectorFactory.get(\n\t\t\toptions?.vertexEntityStorageType ?? nameofKebabCase<AuditableItemGraphVertex>()\n\t\t);\n\n\t\tthis._changesetStorage = EntityStorageConnectorFactory.get(\n\t\t\toptions?.changesetEntityStorageType ?? nameofKebabCase<AuditableItemGraphChangeset>()\n\t\t);\n\n\t\tif (Is.stringValue(options?.eventBusComponentType)) {\n\t\t\tthis._eventBusComponent = ComponentFactory.get(options.eventBusComponentType);\n\t\t}\n\n\t\tSchemaOrgDataTypes.registerRedirects();\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn AuditableItemGraphService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a new graph vertex.\n\t * @param vertex The vertex to create.\n\t * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.\n\t * @param vertex.aliases Alternative aliases that can be used to identify the vertex.\n\t * @param vertex.resources The resources attached to the vertex.\n\t * @param vertex.edges The edges connected to the vertex.\n\t * @returns The id of the new graph item.\n\t */\n\tpublic async create(vertex: {\n\t\tannotationObject?: IJsonLdNodeObject;\n\t\taliases?: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tunique?: boolean;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tresources?: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tedges?: {\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t}): Promise<string> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(vertex), vertex);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\n\t\ttry {\n\t\t\tif (Is.object(vertex.annotationObject)) {\n\t\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\t\tawait JsonLdHelper.validate(vertex.annotationObject, validationFailures);\n\t\t\t\tValidation.asValidationError(\n\t\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\tnameof(vertex.annotationObject),\n\t\t\t\t\tvalidationFailures\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst id = Converter.bytesToHex(RandomHelper.generate(32), false);\n\n\t\t\tconst context: IAuditableItemGraphServiceContext = {\n\t\t\t\tnow: new Date(Date.now()).toISOString(),\n\t\t\t\tcontextIds\n\t\t\t};\n\n\t\t\tconst vertexModel: AuditableItemGraphVertex = {\n\t\t\t\tid,\n\t\t\t\torganizationIdentity: contextIds?.[ContextIdKeys.Organization],\n\t\t\t\tdateCreated: context.now\n\t\t\t};\n\t\t\tconst originalEntity = ObjectHelper.clone(vertexModel);\n\n\t\t\tvertexModel.annotationObject = vertex.annotationObject;\n\n\t\t\tawait this.updateAliasList(context, vertexModel, vertex.aliases);\n\t\t\tawait this.updateResourceList(context, vertexModel, vertex.resources);\n\t\t\tawait this.updateEdgeList(context, vertexModel, vertex.edges);\n\n\t\t\tdelete originalEntity.aliasIndex;\n\t\t\tdelete originalEntity.resourceTypeIndex;\n\t\t\tawait this.addChangeset(context, originalEntity, vertexModel, true);\n\n\t\t\tawait this._vertexStorage.set({\n\t\t\t\t...vertexModel,\n\t\t\t\t...this.buildIndexes(vertexModel)\n\t\t\t});\n\n\t\t\tconst fullId = new Urn(AuditableItemGraphService.NAMESPACE, id).toString();\n\n\t\t\tawait this._eventBusComponent?.publish<IAuditableItemGraphEventBusVertexCreated>(\n\t\t\t\tAuditableItemGraphTopics.VertexCreated,\n\t\t\t\t{ id: fullId }\n\t\t\t);\n\n\t\t\treturn fullId;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\"createFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Get a graph vertex.\n\t * @param id The id of the vertex to get.\n\t * @param options Additional options for the get operation.\n\t * @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.\n\t * @param options.includeChangesets Whether to include the changesets of the vertex, defaults to false.\n\t * @param options.verifySignatureDepth How many signatures to verify, defaults to \"none\".\n\t * @returns The vertex if found.\n\t * @throws NotFoundError if the vertex is not found.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tincludeDeleted?: boolean;\n\t\t\tincludeChangesets?: boolean;\n\t\t\tverifySignatureDepth?: VerifyDepth;\n\t\t}\n\t): Promise<IAuditableItemGraphVertex> {\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(id), id);\n\n\t\tconst urnParsed = Urn.fromValidString(id);\n\n\t\tif (urnParsed.namespaceIdentifier() !== AuditableItemGraphService.NAMESPACE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: AuditableItemGraphService.NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tconst vertexId = urnParsed.namespaceSpecific(0);\n\n\t\t\tconst vertexEntity = await this._vertexStorage.get(vertexId);\n\n\t\t\tif (Is.empty(vertexEntity)) {\n\t\t\t\tthrow new NotFoundError(AuditableItemGraphService.CLASS_NAME, \"vertexNotFound\", id);\n\t\t\t}\n\n\t\t\tconst vertexModel = this.vertexEntityToJsonLd(vertexEntity);\n\n\t\t\tconst includeChangesets = options?.includeChangesets ?? false;\n\t\t\tconst verifySignatureDepth = options?.verifySignatureDepth ?? \"none\";\n\n\t\t\tlet verified: boolean | undefined;\n\t\t\tlet changesets: IAuditableItemGraphChangeset[] | undefined;\n\n\t\t\tif (\n\t\t\t\tverifySignatureDepth === VerifyDepth.Current ||\n\t\t\t\tverifySignatureDepth === VerifyDepth.All ||\n\t\t\t\tincludeChangesets\n\t\t\t) {\n\t\t\t\tconst verifyResult = await this.verifyChangesets(vertexModel, verifySignatureDepth);\n\t\t\t\tverified = verifyResult.verified;\n\t\t\t\tchangesets = verifyResult.changesets;\n\t\t\t\tvertexModel[\"@context\"].push(ImmutableProofContexts.Context);\n\t\t\t}\n\n\t\t\tif (!(options?.includeDeleted ?? false)) {\n\t\t\t\tif (Is.arrayValue(vertexModel.aliases)) {\n\t\t\t\t\tvertexModel.aliases = vertexModel.aliases.filter(a => Is.undefined(a.dateDeleted));\n\t\t\t\t\tif (vertexModel.aliases.length === 0) {\n\t\t\t\t\t\tdelete vertexModel.aliases;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (Is.arrayValue(vertexModel.resources)) {\n\t\t\t\t\tvertexModel.resources = vertexModel.resources.filter(r => Is.undefined(r.dateDeleted));\n\t\t\t\t\tif (vertexModel.resources.length === 0) {\n\t\t\t\t\t\tdelete vertexModel.resources;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (Is.arrayValue(vertexModel.edges)) {\n\t\t\t\t\tvertexModel.edges = vertexModel.edges.filter(r => Is.undefined(r.dateDeleted));\n\t\t\t\t\tif (vertexModel.edges.length === 0) {\n\t\t\t\t\t\tdelete vertexModel.edges;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (includeChangesets) {\n\t\t\t\tvertexModel.changesets = changesets;\n\t\t\t}\n\n\t\t\tif (verifySignatureDepth !== VerifyDepth.None) {\n\t\t\t\tvertexModel.verified = verified;\n\t\t\t}\n\n\t\t\tconst result = await JsonLdProcessor.compact(vertexModel, vertexModel[\"@context\"]);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update a graph vertex.\n\t * @param vertex The vertex to update.\n\t * @param vertex.id The id of the vertex to update.\n\t * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.\n\t * @param vertex.aliases Alternative aliases that can be used to identify the vertex.\n\t * @param vertex.resources The resources attached to the vertex.\n\t * @param vertex.edges The edges connected to the vertex.\n\t * @returns Nothing.\n\t */\n\tpublic async update(vertex: {\n\t\tid: string;\n\t\tannotationObject?: IJsonLdNodeObject;\n\t\taliases?: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tresources?: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}[];\n\t\tedges?: {\n\t\t\tid?: string;\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[];\n\t}): Promise<void> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(vertex), vertex);\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(vertex.id), vertex.id);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\n\t\tconst urnParsed = Urn.fromValidString(vertex.id);\n\n\t\tif (urnParsed.namespaceIdentifier() !== AuditableItemGraphService.NAMESPACE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: AuditableItemGraphService.NAMESPACE,\n\t\t\t\tid: vertex.id\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tconst vertexId = urnParsed.namespaceSpecific(0);\n\t\t\tconst vertexEntity = await this._vertexStorage.get(vertexId);\n\n\t\t\tif (Is.empty(vertexEntity)) {\n\t\t\t\tthrow new NotFoundError(AuditableItemGraphService.CLASS_NAME, \"vertexNotFound\", vertex.id);\n\t\t\t}\n\n\t\t\tif (Is.object(vertex.annotationObject)) {\n\t\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\t\tawait JsonLdHelper.validate(vertex.annotationObject, validationFailures);\n\t\t\t\tValidation.asValidationError(\n\t\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\tnameof(vertex.annotationObject),\n\t\t\t\t\tvalidationFailures\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst context: IAuditableItemGraphServiceContext = {\n\t\t\t\tnow: new Date(Date.now()).toISOString(),\n\t\t\t\tcontextIds\n\t\t\t};\n\n\t\t\tdelete vertexEntity.aliasIndex;\n\t\t\tconst originalEntity = ObjectHelper.clone(vertexEntity);\n\t\t\tconst newEntity = ObjectHelper.clone(vertexEntity);\n\n\t\t\tnewEntity.annotationObject = vertex.annotationObject;\n\n\t\t\tawait this.updateAliasList(context, newEntity, vertex.aliases);\n\t\t\tawait this.updateResourceList(context, newEntity, vertex.resources);\n\t\t\tawait this.updateEdgeList(context, newEntity, vertex.edges);\n\n\t\t\tconst patches = await this.addChangeset(context, originalEntity, newEntity, false);\n\t\t\tif (patches.length > 0) {\n\t\t\t\tnewEntity.dateModified = context.now;\n\n\t\t\t\tconst indexes = this.buildIndexes(newEntity);\n\n\t\t\t\tawait this._vertexStorage.set({\n\t\t\t\t\t...newEntity,\n\t\t\t\t\t...indexes\n\t\t\t\t});\n\n\t\t\t\tawait this._eventBusComponent?.publish<IAuditableItemGraphEventBusVertexUpdated>(\n\t\t\t\t\tAuditableItemGraphTopics.VertexUpdated,\n\t\t\t\t\t{ id: vertex.id, patches }\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\"updatingFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Remove the verifiable storage for an item.\n\t * @param id The id of the vertex to get.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the vertex is not found.\n\t */\n\tpublic async removeVerifiable(id: string): Promise<void> {\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(id), id);\n\n\t\tconst urnParsed = Urn.fromValidString(id);\n\n\t\tif (urnParsed.namespaceIdentifier() !== AuditableItemGraphService.NAMESPACE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: AuditableItemGraphService.NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tconst vertexId = urnParsed.namespaceSpecific(0);\n\t\t\tconst vertexEntity = await this._vertexStorage.get(vertexId);\n\n\t\t\tif (Is.empty(vertexEntity)) {\n\t\t\t\tthrow new NotFoundError(AuditableItemGraphService.CLASS_NAME, \"vertexNotFound\", id);\n\t\t\t}\n\n\t\t\tlet changesetsResult;\n\t\t\tdo {\n\t\t\t\tchangesetsResult = await this._changesetStorage.query(\n\t\t\t\t\t{\n\t\t\t\t\t\tproperty: \"vertexId\",\n\t\t\t\t\t\tvalue: vertexId,\n\t\t\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tproperty: \"dateCreated\",\n\t\t\t\t\t\t\tsortDirection: SortDirection.Ascending\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tundefined,\n\t\t\t\t\tchangesetsResult?.cursor\n\t\t\t\t);\n\n\t\t\t\tfor (const changeset of changesetsResult.entities) {\n\t\t\t\t\tif (Is.stringValue(changeset.proofId)) {\n\t\t\t\t\t\tawait this._immutableProofComponent.removeVerifiable(changeset.proofId);\n\t\t\t\t\t\tdelete changeset.proofId;\n\t\t\t\t\t\tawait this._changesetStorage.set(changeset as AuditableItemGraphChangeset);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (Is.stringValue(changesetsResult.cursor));\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\"removeVerifiableFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Query the graph for vertices.\n\t * @param options The query options.\n\t * @param options.id The optional id to look for.\n\t * @param options.idMode Look in id, alias or both, defaults to both.\n\t * @param options.idExact Find only exact matches, default to false meaning partial matching.\n\t * @param options.includesResourceTypes Include vertices with specific resource types.\n\t * @param conditions Conditions to use in the query.\n\t * @param orderBy The order for the results, defaults to created.\n\t * @param orderByDirection The direction for the order, defaults to desc.\n\t * @param properties The properties to return, if not provided defaults to id, created, aliases and object.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit Limit the number of entities to return.\n\t * @returns The entities, which can be partial if a limited keys list was provided.\n\t */\n\tpublic async query(\n\t\toptions?: {\n\t\t\tid?: string;\n\t\t\tidMode?: \"id\" | \"alias\" | \"both\";\n\t\t\tidExact?: boolean;\n\t\t\tincludesResourceTypes?: string[];\n\t\t},\n\t\tconditions?: IComparator[],\n\t\torderBy?: keyof Pick<IAuditableItemGraphVertex, \"dateCreated\" | \"dateModified\">,\n\t\torderByDirection?: SortDirection,\n\t\tproperties?: (keyof IAuditableItemGraphVertex)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<IAuditableItemGraphVertexList> {\n\t\ttry {\n\t\t\tconst propertiesToReturn: (keyof IAuditableItemGraphVertex)[] = properties ?? [\n\t\t\t\t\"id\",\n\t\t\t\t\"dateCreated\",\n\t\t\t\t\"dateModified\",\n\t\t\t\t\"aliases\",\n\t\t\t\t\"annotationObject\"\n\t\t\t];\n\t\t\tconst combinedConditions = conditions ?? [];\n\t\t\tconst orderProperty = orderBy ?? \"dateCreated\";\n\t\t\tconst orderDirection = orderByDirection ?? SortDirection.Descending;\n\t\t\tconst idExact = options?.idExact ?? false;\n\n\t\t\tconst idOrAlias = options?.id;\n\t\t\tif (Is.stringValue(idOrAlias)) {\n\t\t\t\tconst idMode = options?.idMode ?? \"both\";\n\t\t\t\tif (idMode === \"id\" || idMode === \"both\") {\n\t\t\t\t\tcombinedConditions.push({\n\t\t\t\t\t\tproperty: \"id\",\n\t\t\t\t\t\tcomparison: idExact ? ComparisonOperator.Equals : ComparisonOperator.Includes,\n\t\t\t\t\t\tvalue: idOrAlias\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (idMode === \"alias\" || idMode === \"both\") {\n\t\t\t\t\tcombinedConditions.push({\n\t\t\t\t\t\tproperty: \"aliasIndex\",\n\t\t\t\t\t\tcomparison: ComparisonOperator.Includes,\n\t\t\t\t\t\tvalue: idExact ? `||${idOrAlias.toLowerCase()}||` : idOrAlias.toLowerCase()\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (Is.arrayValue(options?.includesResourceTypes)) {\n\t\t\t\tfor (const resourceType of options.includesResourceTypes) {\n\t\t\t\t\tcombinedConditions.push({\n\t\t\t\t\t\tproperty: \"resourceTypeIndex\",\n\t\t\t\t\t\tcomparison: ComparisonOperator.Includes,\n\t\t\t\t\t\tvalue: `||${resourceType.toLowerCase()}||`\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!propertiesToReturn.includes(\"id\")) {\n\t\t\t\tpropertiesToReturn.unshift(\"id\");\n\t\t\t}\n\n\t\t\tconst results = await this._vertexStorage.query(\n\t\t\t\tcombinedConditions.length > 0\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tconditions: combinedConditions,\n\t\t\t\t\t\t\tlogicalOperator: LogicalOperator.Or\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tproperty: orderProperty,\n\t\t\t\t\t\tsortDirection: orderDirection\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tpropertiesToReturn as (keyof AuditableItemGraphVertex)[],\n\t\t\t\tcursor,\n\t\t\t\tlimit\n\t\t\t);\n\n\t\t\tconst models: IAuditableItemGraphVertex[] = results.entities.map(e =>\n\t\t\t\tthis.vertexEntityToJsonLd(e as AuditableItemGraphVertex)\n\t\t\t);\n\n\t\t\tconst vertexList: IAuditableItemGraphVertexList = {\n\t\t\t\t\"@context\": [\n\t\t\t\t\tSchemaOrgContexts.Context,\n\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\tAuditableItemGraphContexts.ContextCommon\n\t\t\t\t],\n\t\t\t\ttype: [SchemaOrgTypes.ItemList, AuditableItemGraphTypes.VertexList],\n\t\t\t\t[SchemaOrgTypes.ItemListElement]: models,\n\t\t\t\t[SchemaOrgTypes.NextItem]: results.cursor\n\t\t\t};\n\n\t\t\tconst result = await JsonLdProcessor.compact(vertexList, vertexList[\"@context\"]);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\t\"queryingFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Map the vertex entity to JSON-LD.\n\t * @param vertexEntity The vertex entity.\n\t * @returns The model.\n\t * @internal\n\t */\n\tprivate vertexEntityToJsonLd(vertexEntity: AuditableItemGraphVertex): IAuditableItemGraphVertex {\n\t\tconst model: IAuditableItemGraphVertex = {\n\t\t\t\"@context\": [\n\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\tSchemaOrgContexts.Context\n\t\t\t],\n\t\t\ttype: AuditableItemGraphTypes.Vertex,\n\t\t\tid: new Urn(AuditableItemGraphService.NAMESPACE, vertexEntity.id).toString(),\n\t\t\tdateCreated: vertexEntity.dateCreated,\n\t\t\tdateModified: vertexEntity.dateModified,\n\t\t\torganizationIdentity: vertexEntity.organizationIdentity,\n\t\t\tannotationObject: vertexEntity.annotationObject\n\t\t};\n\n\t\tif (Is.arrayValue(vertexEntity.aliases)) {\n\t\t\tmodel.aliases ??= [];\n\t\t\tfor (const aliasEntity of vertexEntity.aliases) {\n\t\t\t\tconst aliasModel: IAuditableItemGraphAlias = {\n\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t],\n\t\t\t\t\ttype: AuditableItemGraphTypes.Alias,\n\t\t\t\t\tid: aliasEntity.id,\n\t\t\t\t\taliasFormat: aliasEntity.aliasFormat,\n\t\t\t\t\tdateCreated: aliasEntity.dateCreated,\n\t\t\t\t\tdateModified: aliasEntity.dateModified,\n\t\t\t\t\tdateDeleted: aliasEntity.dateDeleted,\n\t\t\t\t\tannotationObject: aliasEntity.annotationObject\n\t\t\t\t};\n\t\t\t\tmodel.aliases.push(aliasModel);\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(vertexEntity.resources)) {\n\t\t\tmodel.resources ??= [];\n\t\t\tfor (const resourceEntity of vertexEntity.resources) {\n\t\t\t\tconst resourceModel: IAuditableItemGraphResource = {\n\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t],\n\t\t\t\t\ttype: AuditableItemGraphTypes.Resource,\n\t\t\t\t\tid: resourceEntity.id,\n\t\t\t\t\tdateCreated: resourceEntity.dateCreated,\n\t\t\t\t\tdateModified: resourceEntity.dateModified,\n\t\t\t\t\tdateDeleted: resourceEntity.dateDeleted,\n\t\t\t\t\tresourceObject: resourceEntity.resourceObject\n\t\t\t\t};\n\t\t\t\tmodel.resources.push(resourceModel);\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(vertexEntity.edges)) {\n\t\t\tmodel.edges ??= [];\n\t\t\tfor (const edgeEntity of vertexEntity.edges) {\n\t\t\t\tconst edgeModel: IAuditableItemGraphEdge = {\n\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t],\n\t\t\t\t\ttype: AuditableItemGraphTypes.Edge,\n\t\t\t\t\tid: this.fullEdgeId(vertexEntity.id, edgeEntity.id),\n\t\t\t\t\ttargetId: edgeEntity.targetId,\n\t\t\t\t\tdateCreated: edgeEntity.dateCreated,\n\t\t\t\t\tdateModified: edgeEntity.dateModified,\n\t\t\t\t\tdateDeleted: edgeEntity.dateDeleted,\n\t\t\t\t\tedgeRelationships: edgeEntity.edgeRelationships,\n\t\t\t\t\tannotationObject: edgeEntity.annotationObject\n\t\t\t\t};\n\t\t\t\tmodel.edges.push(edgeModel);\n\t\t\t}\n\t\t}\n\n\t\treturn model;\n\t}\n\n\t/**\n\t * Map the changeset entity to a JSON-LD.\n\t * @param vertexId The id of the vertex the changeset belongs to.\n\t * @param changesetEntity The changeset entity.\n\t * @returns The model.\n\t * @internal\n\t */\n\tprivate changesetEntityToJsonLd(\n\t\tvertexId: string,\n\t\tchangesetEntity: AuditableItemGraphChangeset\n\t): IAuditableItemGraphChangeset {\n\t\tconst model: IAuditableItemGraphChangeset = {\n\t\t\t\"@context\": [\n\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\tSchemaOrgContexts.Context\n\t\t\t],\n\t\t\ttype: AuditableItemGraphTypes.Changeset,\n\t\t\tid: new Urn(AuditableItemGraphService.NAMESPACE, [\n\t\t\t\tvertexId,\n\t\t\t\tAuditableItemGraphService.NAMESPACE_CHANGESET,\n\t\t\t\tchangesetEntity.id\n\t\t\t]).toString(),\n\t\t\tdateCreated: changesetEntity.dateCreated,\n\t\t\tuserIdentity: changesetEntity.userIdentity,\n\t\t\tpatches: changesetEntity.patches.map(p => ({\n\t\t\t\t\"@context\": [\n\t\t\t\t\tAuditableItemGraphContexts.Context,\n\t\t\t\t\tAuditableItemGraphContexts.ContextCommon,\n\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t],\n\t\t\t\ttype: AuditableItemGraphTypes.PatchOperation,\n\t\t\t\tpatchOperation: p.op,\n\t\t\t\tpatchPath: p.path,\n\t\t\t\tpatchFrom: p.from,\n\t\t\t\tpatchValue: p.value\n\t\t\t})),\n\t\t\tproofId: changesetEntity.proofId\n\t\t};\n\n\t\treturn model;\n\t}\n\n\t/**\n\t * Update the aliases of a vertex model.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param aliases The aliases to update.\n\t * @internal\n\t */\n\tprivate async updateAliasList(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\taliases?: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[]\n\t): Promise<void> {\n\t\tconst active = vertex.aliases?.filter(a => Is.empty(a.dateDeleted)) ?? [];\n\n\t\t// The active aliases that are not in the update list should be marked as deleted.\n\t\tif (Is.arrayValue(active)) {\n\t\t\tfor (const alias of active) {\n\t\t\t\tif (!aliases?.find(a => a.id === alias.id)) {\n\t\t\t\t\talias.dateDeleted = context.now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(aliases)) {\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tawait this.updateAlias(context, vertex, alias);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update an alias in the vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param alias The alias.\n\t * @internal\n\t */\n\tprivate async updateAlias(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\talias: {\n\t\t\tid: string;\n\t\t\taliasFormat?: string;\n\t\t\tunique?: boolean;\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}\n\t): Promise<void> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(alias), alias);\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(alias.id), alias.id);\n\n\t\tif (alias.unique ?? false) {\n\t\t\tconst existingVertices = await this.findMatchingVertices(context, vertex.id, alias.id);\n\t\t\tif (existingVertices) {\n\t\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"aliasNotUnique\", {\n\t\t\t\t\taliasId: alias.id\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (Is.object(alias.annotationObject)) {\n\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\tawait JsonLdHelper.validate(alias.annotationObject, validationFailures);\n\t\t\tValidation.asValidationError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\tnameof(alias.annotationObject),\n\t\t\t\tvalidationFailures\n\t\t\t);\n\t\t}\n\n\t\t// Try to find an existing alias with the same id.\n\t\tconst existing = vertex.aliases?.find(a => a.id === alias.id);\n\n\t\tif (Is.empty(existing) || !Is.empty(existing?.dateDeleted)) {\n\t\t\t// Did not find a matching item, or found one which is deleted.\n\t\t\tvertex.aliases ??= [];\n\n\t\t\tconst model: AuditableItemGraphAlias = {\n\t\t\t\tid: alias.id,\n\t\t\t\taliasFormat: alias.aliasFormat,\n\t\t\t\tdateCreated: context.now,\n\t\t\t\tannotationObject: alias.annotationObject\n\t\t\t};\n\n\t\t\tvertex.aliases.push(model);\n\t\t} else if (\n\t\t\texisting.aliasFormat !== alias.aliasFormat ||\n\t\t\t!ObjectHelper.equal(existing.annotationObject, alias.annotationObject, false)\n\t\t) {\n\t\t\t// Existing alias found, update the annotationObject.\n\t\t\texisting.dateModified = context.now;\n\t\t\texisting.aliasFormat = alias.aliasFormat;\n\t\t\texisting.annotationObject = alias.annotationObject;\n\t\t}\n\t}\n\n\t/**\n\t * Update the resources of a vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param resources The resources to update.\n\t * @internal\n\t */\n\tprivate async updateResourceList(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\tresources?: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}[]\n\t): Promise<void> {\n\t\tif (Is.arrayValue(resources)) {\n\t\t\tfor (let i = 0; i < resources.length; i++) {\n\t\t\t\tconst id = this.getResourceId(resources[i]);\n\t\t\t\tif (Is.empty(id)) {\n\t\t\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"resourceIdMissing\", {\n\t\t\t\t\t\tindex: i\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst active = vertex.resources?.filter(r => Is.empty(r.dateDeleted)) ?? [];\n\n\t\t// The active resources that are not in the update list should be marked as deleted.\n\t\tif (Is.arrayValue(active)) {\n\t\t\tfor (const resource of active) {\n\t\t\t\tif (!resources?.find(a => this.getResourceId(a) === this.getResourceId(resource))) {\n\t\t\t\t\tresource.dateDeleted = context.now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(resources)) {\n\t\t\tfor (const resource of resources) {\n\t\t\t\tawait this.updateResource(context, vertex, resource);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Add a resource to the vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param resource The resource.\n\t * @internal\n\t */\n\tprivate async updateResource(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\tresource: {\n\t\t\tid?: string;\n\t\t\tresourceObject?: IJsonLdNodeObject;\n\t\t}\n\t): Promise<void> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(resource), resource);\n\n\t\tif (Is.object(resource.resourceObject)) {\n\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\tawait JsonLdHelper.validate(resource.resourceObject, validationFailures);\n\t\t\tValidation.asValidationError(\n\t\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\t\tnameof(resource.resourceObject),\n\t\t\t\tvalidationFailures\n\t\t\t);\n\t\t}\n\n\t\t// Try to find an existing resource with the same id.\n\t\tconst existing = vertex.resources?.find(\n\t\t\tr => this.getResourceId(r) === this.getResourceId(resource)\n\t\t);\n\n\t\tif (Is.empty(existing) || !Is.empty(existing?.dateDeleted)) {\n\t\t\t// Did not find a matching item, or found one which is deleted.\n\t\t\tvertex.resources ??= [];\n\n\t\t\tconst model: AuditableItemGraphResource = {\n\t\t\t\tid: resource.id,\n\t\t\t\tdateCreated: context.now,\n\t\t\t\tresourceObject: resource.resourceObject\n\t\t\t};\n\n\t\t\tvertex.resources.push(model);\n\t\t} else if (!ObjectHelper.equal(existing.resourceObject, resource.resourceObject, false)) {\n\t\t\t// Existing resource found, update the resourceObject.\n\t\t\texisting.dateModified = context.now;\n\t\t\texisting.resourceObject = resource.resourceObject;\n\t\t}\n\t}\n\n\t/**\n\t * Update the edges of a vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param edges The edges to update.\n\t * @internal\n\t */\n\tprivate async updateEdgeList(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\tedges?: {\n\t\t\tid?: string;\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}[]\n\t): Promise<void> {\n\t\tconst active = vertex.edges?.filter(e => Is.empty(e.dateDeleted)) ?? [];\n\n\t\t// The active edges that are not in the update list should be marked as deleted.\n\t\tif (Is.arrayValue(active)) {\n\t\t\tfor (const edge of active) {\n\t\t\t\tif (!edges?.find(e => Is.stringValue(e.id) && this.reduceEdgeId(e.id) === edge.id)) {\n\t\t\t\t\tedge.dateDeleted = context.now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(edges)) {\n\t\t\tfor (const edge of edges) {\n\t\t\t\tawait this.updateEdge(context, vertex, edge);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Add an edge to the vertex.\n\t * @param context The context for the operation.\n\t * @param vertex The vertex.\n\t * @param edge The edge.\n\t * @internal\n\t */\n\tprivate async updateEdge(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertex: AuditableItemGraphVertex,\n\t\tedge: {\n\t\t\tid?: string;\n\t\t\ttargetId: string;\n\t\t\tedgeRelationships: string[];\n\t\t\tannotationObject?: IJsonLdNodeObject;\n\t\t}\n\t): Promise<void> {\n\t\tGuards.object(AuditableItemGraphService.CLASS_NAME, nameof(edge), edge);\n\t\tGuards.stringValue(AuditableItemGraphService.CLASS_NAME, nameof(edge.targetId), edge.targetId);\n\t\tGuards.arrayValue(\n\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\tnameof(edge.edgeRelationships),\n\t\t\tedge.edgeRelationships\n\t\t);\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tif (edge.targetId === vertex.id) {\n\t\t\tvalidationFailures.push({\n\t\t\t\tproperty: \"id\",\n\t\t\t\treason: `validation.${StringHelper.camelCase(AuditableItemGraphService.CLASS_NAME)}.edgeIdSameAsVertexId`,\n\t\t\t\tproperties: {\n\t\t\t\t\ttargetId: edge.targetId\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (Is.object(edge.annotationObject)) {\n\t\t\tawait JsonLdHelper.validate(edge.annotationObject, validationFailures);\n\t\t}\n\t\tValidation.asValidationError(\n\t\t\tAuditableItemGraphService.CLASS_NAME,\n\t\t\tnameof(edge.annotationObject),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tlet findId = Is.stringValue(edge.id) ? this.reduceEdgeId(edge.id) : undefined;\n\t\tif (Is.empty(findId)) {\n\t\t\tfindId = Converter.bytesToHex(RandomHelper.generate(32), false);\n\t\t}\n\n\t\t// Try to find an existing edge with the same id.\n\t\tconst existing = vertex.edges?.find(r => r.id === findId);\n\n\t\tif (Is.empty(existing) || !Is.empty(existing?.dateDeleted)) {\n\t\t\t// Did not find a matching item, or found one which is deleted.\n\t\t\tvertex.edges ??= [];\n\n\t\t\tconst model: AuditableItemGraphEdge = {\n\t\t\t\tid: findId,\n\t\t\t\ttargetId: edge.targetId,\n\t\t\t\tdateCreated: context.now,\n\t\t\t\tannotationObject: edge.annotationObject,\n\t\t\t\tedgeRelationships: edge.edgeRelationships\n\t\t\t};\n\n\t\t\tvertex.edges.push(model);\n\t\t} else if (\n\t\t\texisting.targetId !== edge.targetId ||\n\t\t\t!ArrayHelper.matches(existing.edgeRelationships, edge.edgeRelationships) ||\n\t\t\t!ObjectHelper.equal(existing.annotationObject, edge.annotationObject, false)\n\t\t) {\n\t\t\t// Existing edge found, update the properties.\n\t\t\texisting.targetId = edge.targetId;\n\t\t\texisting.dateModified = context.now;\n\t\t\texisting.edgeRelationships = edge.edgeRelationships;\n\t\t\texisting.annotationObject = edge.annotationObject;\n\t\t}\n\t}\n\n\t/**\n\t * Add a changeset to the vertex and generate the associated verifications.\n\t * @param context The context for the operation.\n\t * @param original The original vertex.\n\t * @param updated The updated vertex.\n\t * @param isNew Whether this is a new item.\n\t * @returns True if there were changes.\n\t * @internal\n\t */\n\tprivate async addChangeset(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\toriginal: AuditableItemGraphVertex,\n\t\tupdated: AuditableItemGraphVertex,\n\t\tisNew: boolean\n\t): Promise<IPatchOperation[]> {\n\t\tconst patches = JsonHelper.diff(original, updated);\n\n\t\t// If there is a diff set or this is the first time the item is created.\n\t\tif (patches.length > 0 || isNew) {\n\t\t\tconst changesetEntity: AuditableItemGraphChangeset = {\n\t\t\t\tid: Converter.bytesToHex(RandomHelper.generate(32), false),\n\t\t\t\tvertexId: updated.id,\n\t\t\t\tdateCreated: context.now,\n\t\t\t\tuserIdentity: context.contextIds?.[ContextIdKeys.User],\n\t\t\t\tpatches\n\t\t\t};\n\n\t\t\t// Create the JSON-LD object we want to use for the proof\n\t\t\t// this is a subset of fixed properties from the changeset object.\n\t\t\tconst reducedChangesetJsonLd = this.changesetEntityToJsonLd(\n\t\t\t\toriginal.id,\n\t\t\t\tObjectHelper.pick(\n\t\t\t\t\tchangesetEntity,\n\t\t\t\t\tAuditableItemGraphService._PROOF_KEYS_CHANGESET\n\t\t\t\t) as AuditableItemGraphChangeset\n\t\t\t);\n\n\t\t\t// Create the proof for the changeset object\n\t\t\tchangesetEntity.proofId = await this._immutableProofComponent.create(\n\t\t\t\treducedChangesetJsonLd as unknown as IJsonLdNodeObject\n\t\t\t);\n\n\t\t\t// Link the verifiable storage id to the changeset\n\t\t\tawait this._changesetStorage.set(changesetEntity);\n\n\t\t\treturn patches;\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Verify the changesets of a vertex.\n\t * @param vertex The vertex to verify.\n\t * @param verifySignatureDepth How many signatures to verify.\n\t * @param contextIds The context ids to perform the operation with.\n\t * @internal\n\t */\n\tprivate async verifyChangesets(\n\t\tvertex: IAuditableItemGraphVertex,\n\t\tverifySignatureDepth: VerifyDepth,\n\t\tpartitionKey?: string\n\t): Promise<{\n\t\tverified: boolean;\n\t\tchangesets: IAuditableItemGraphChangeset[];\n\t}> {\n\t\tconst changesets: IAuditableItemGraphChangeset[] = [];\n\n\t\tlet changesetsResult;\n\t\tlet verified = true;\n\n\t\tconst vertexId = Urn.fromValidString(vertex.id);\n\n\t\tdo {\n\t\t\tchangesetsResult = await this._changesetStorage.query(\n\t\t\t\t{\n\t\t\t\t\tproperty: \"vertexId\",\n\t\t\t\t\tvalue: vertexId.namespaceSpecific(),\n\t\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t\t},\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tproperty: \"dateCreated\",\n\t\t\t\t\t\tsortDirection: SortDirection.Ascending\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tundefined,\n\t\t\t\tchangesetsResult?.cursor\n\t\t\t);\n\n\t\t\tconst storedChangesets = changesetsResult.entities as AuditableItemGraphChangeset[];\n\t\t\tif (Is.arrayValue(storedChangesets)) {\n\t\t\t\tfor (let i = 0; i < storedChangesets.length; i++) {\n\t\t\t\t\tconst storedChangeset = storedChangesets[i];\n\n\t\t\t\t\tconst storedChangesetJsonLd = this.changesetEntityToJsonLd(\n\t\t\t\t\t\tvertexId.namespaceSpecific(),\n\t\t\t\t\t\tstoredChangeset\n\t\t\t\t\t);\n\t\t\t\t\tchangesets.push(storedChangesetJsonLd);\n\n\t\t\t\t\t// If we are verifying all signatures\n\t\t\t\t\t// or this is the last changeset (cursor is empty)\n\t\t\t\t\t// and the changeset has a proofId, then verify the proof.\n\t\t\t\t\tif (\n\t\t\t\t\t\tverifySignatureDepth === VerifyDepth.All ||\n\t\t\t\t\t\t(verifySignatureDepth === VerifyDepth.Current &&\n\t\t\t\t\t\t\t!Is.stringValue(changesetsResult.cursor) &&\n\t\t\t\t\t\t\ti === storedChangesets.length - 1)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (!Is.stringValue(storedChangeset.proofId)) {\n\t\t\t\t\t\t\tverified = false;\n\t\t\t\t\t\t\tstoredChangesetJsonLd.verification = {\n\t\t\t\t\t\t\t\t\"@context\": ImmutableProofContexts.Context,\n\t\t\t\t\t\t\t\ttype: ImmutableProofTypes.ImmutableProofVerification,\n\t\t\t\t\t\t\t\tverified: false,\n\t\t\t\t\t\t\t\tfailure: ImmutableProofFailure.ProofMissing\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Verify the proof for the changeset object\n\t\t\t\t\t\t\tstoredChangesetJsonLd.verification = await this._immutableProofComponent.verify(\n\t\t\t\t\t\t\t\tstoredChangeset.proofId\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (!storedChangesetJsonLd.verification.verified) {\n\t\t\t\t\t\t\t\tverified = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} while (Is.stringValue(changesetsResult.cursor));\n\n\t\treturn {\n\t\t\tverified,\n\t\t\tchangesets\n\t\t};\n\t}\n\n\t/**\n\t * Get the resource id from a resource object.\n\t * @param resource The resource.\n\t * @param resource.id The id of the resource.\n\t * @param resource.resourceObject The resource object.\n\t * @returns The resource id if it can find one.\n\t */\n\tprivate getResourceId(resource: {\n\t\tid?: string;\n\t\tresourceObject?: IJsonLdNodeObject;\n\t}): string | undefined {\n\t\treturn (\n\t\t\tresource.id ??\n\t\t\tObjectHelper.extractProperty<string>(resource.resourceObject, [\"id\", \"@id\"], false)\n\t\t);\n\t}\n\n\t/**\n\t * Build the indexes for the vertex.\n\t * @param vertex The vertex to build the indexes for.\n\t * @returns The indexes.\n\t * @internal\n\t */\n\tprivate buildIndexes(vertex: AuditableItemGraphVertex): {\n\t\taliasIndex?: string;\n\t\tresourceTypeIndex?: string;\n\t} {\n\t\tconst aliasIndex = vertex.aliases\n\t\t\t?.filter(a => Is.empty(a.dateDeleted))\n\t\t\t.map(a => a.id)\n\t\t\t.join(\"||\")\n\t\t\t.toLowerCase();\n\n\t\tconst resourceTypes: string[] = [];\n\t\tif (Is.arrayValue(vertex.resources)) {\n\t\t\tfor (const resource of vertex.resources) {\n\t\t\t\tconst resourceType = ObjectHelper.extractProperty<string>(\n\t\t\t\t\tresource.resourceObject,\n\t\t\t\t\t[\"@type\", \"type\"],\n\t\t\t\t\tfalse\n\t\t\t\t);\n\n\t\t\t\tif (Is.stringValue(resourceType) && !resourceTypes.includes(resourceType)) {\n\t\t\t\t\tresourceTypes.push(resourceType);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst resourceTypeIndex = resourceTypes.join(\"||\").toLowerCase();\n\n\t\treturn {\n\t\t\taliasIndex: Is.stringValue(aliasIndex) ? `||${aliasIndex}||` : undefined,\n\t\t\tresourceTypeIndex: Is.stringValue(resourceTypeIndex) ? `||${resourceTypeIndex}||` : undefined\n\t\t};\n\t}\n\n\t/**\n\t * Find vertices with matching aliases.\n\t * @param context The context for the operation.\n\t * @param vertexId The id of the vertex to exclude from the search.\n\t * @param aliasId The alias id to try and find.\n\t * @returns True if any other vertices have matching aliases.\n\t * @internal\n\t */\n\tprivate async findMatchingVertices(\n\t\tcontext: IAuditableItemGraphServiceContext,\n\t\tvertexId: string,\n\t\taliasId: string\n\t): Promise<boolean> {\n\t\tconst results = await this._vertexStorage.query({\n\t\t\tconditions: [\n\t\t\t\t{\n\t\t\t\t\tproperty: \"aliasIndex\",\n\t\t\t\t\tcomparison: ComparisonOperator.Includes,\n\t\t\t\t\tvalue: `||${aliasId.toLowerCase()}||`\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: \"id\",\n\t\t\t\t\tvalue: vertexId,\n\t\t\t\t\tcomparison: ComparisonOperator.NotEquals\n\t\t\t\t}\n\t\t\t],\n\t\t\tlogicalOperator: LogicalOperator.And\n\t\t});\n\n\t\treturn results.entities.length > 0;\n\t}\n\n\t/**\n\t * Reduce the edge ID from a URN.\n\t * @param urn The URN to reduce.\n\t * @returns The edge ID.\n\t * @throws GeneralError if the URN is not valid or not an edge URN.\n\t * @internal\n\t */\n\tprivate reduceEdgeId(urn: string): string {\n\t\tconst urnParsed = Urn.fromValidString(urn);\n\t\tif (urnParsed.namespaceIdentifier() !== AuditableItemGraphService.NAMESPACE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: AuditableItemGraphService.NAMESPACE,\n\t\t\t\tid: urn\n\t\t\t});\n\t\t}\n\t\tif (urnParsed.namespaceSpecificParts().length !== 3) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"invalidEdgeId\", {\n\t\t\t\tedgeId: urn\n\t\t\t});\n\t\t}\n\t\tif (urnParsed.namespaceSpecificParts()[1] !== AuditableItemGraphService.NAMESPACE_EDGE) {\n\t\t\tthrow new GeneralError(AuditableItemGraphService.CLASS_NAME, \"invalidEdgeId\", {\n\t\t\t\tedgeId: urn\n\t\t\t});\n\t\t}\n\t\treturn urnParsed.namespaceSpecificParts()[2];\n\t}\n\n\t/**\n\t * Create a full edge ID URN from a vertex ID and edge ID.\n\t * @param vertexId The vertex id the edge belongs to.\n\t * @param edgeId The edge id.\n\t * @returns The full edge ID URN.\n\t * @internal\n\t */\n\tprivate fullEdgeId(vertexId: string, edgeId: string): string {\n\t\treturn new Urn(AuditableItemGraphService.NAMESPACE, [\n\t\t\tvertexId,\n\t\t\tAuditableItemGraphService.NAMESPACE_EDGE,\n\t\t\tedgeId\n\t\t]).toString();\n\t}\n}\n"]}
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @twin.org/auditable-item-graph-service - Changelog
2
2
 
3
+ ## [0.0.3-next.4](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-service-v0.0.3-next.3...auditable-item-graph-service-v0.0.3-next.4) (2026-01-22)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * context usage ([9c8f64d](https://github.com/twinfoundation/auditable-item-graph/commit/9c8f64d342e9fb40d3514b87fd547a824ce50676))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/auditable-item-graph-models bumped from 0.0.3-next.3 to 0.0.3-next.4
16
+
3
17
  ## [0.0.3-next.3](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-service-v0.0.3-next.2...auditable-item-graph-service-v0.0.3-next.3) (2026-01-21)
4
18
 
5
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/auditable-item-graph-service",
3
- "version": "0.0.3-next.3",
3
+ "version": "0.0.3-next.4",
4
4
  "description": "Auditable Item Graph contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/api-models": "next",
18
- "@twin.org/auditable-item-graph-models": "0.0.3-next.3",
18
+ "@twin.org/auditable-item-graph-models": "0.0.3-next.4",
19
19
  "@twin.org/context": "next",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/crypto": "next",