@twin.org/document-management-service 0.0.2-next.4 → 0.0.3-next.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentManagementService.js","sourceRoot":"","sources":["../../src/documentManagementService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACN,0BAA0B,EAC1B,uBAAuB,EAMvB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,EAAE,EACF,aAAa,EACb,YAAY,EACZ,GAAG,EACH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAA0B,MAAM,wBAAwB,CAAC;AAEjF,OAAO,EACN,gBAAgB,EAChB,aAAa,EAKb,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACrC;;OAEG;IACI,MAAM,CAAU,UAAU,+BAA+C;IAEhF;;;OAGG;IACc,4BAA4B,CAA+B;IAE5E;;;OAGG;IACc,qBAAqB,CAAwB;IAE9D;;;OAGG;IACc,qBAAqB,CAAwB;IAE9D;;;OAGG;IACc,wBAAwB,CAA2B;IAEpE;;;OAGG;IACH,YAAY,OAAsD;QACjE,IAAI,CAAC,4BAA4B,GAAG,gBAAgB,CAAC,GAAG,CACvD,OAAO,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AW;gBAC5B,gBAAgB,CAAC,iBAAiB;gBAClC,iBAAiB,CAAC,WAAW;aAC7B;YACD,IAAI,EAAE,aAAa,CAAC,mBAAmB;YACvC,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,YAAY,EAAE,QAAQ,CAAC,YAAY;YACnC,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;YAC3C,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;SAC3B,CAAC;QACF,OAAO,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;OAMG;IACK,gBAAgB,CAAC,UAAkB,EAAE,QAAgB;QAC5D,MAAM,cAAc,GAAG,SAAS,CAAC,gBAAgB,CAChD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAChD,CAAC;QACF,OAAO,YAAY,cAAc,IAAI,QAAQ,EAAE,CAAC;IACjD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAttestationComponent } from \"@twin.org/attestation-models\";\nimport { AttestationContexts } from \"@twin.org/attestation-models\";\nimport {\n\tAuditableItemGraphContexts,\n\tAuditableItemGraphTypes,\n\ttype IAuditableItemGraphVertexList,\n\ttype IAuditableItemGraphAlias,\n\ttype IAuditableItemGraphComponent,\n\ttype IAuditableItemGraphEdge,\n\ttype IAuditableItemGraphVertex\n} from \"@twin.org/auditable-item-graph-models\";\nimport type { IBlobStorageComponent } from \"@twin.org/blob-storage-models\";\nimport { BlobStorageContexts } from \"@twin.org/blob-storage-models\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tBaseError,\n\tCoerce,\n\tComponentFactory,\n\tConverter,\n\tGeneralError,\n\tGuards,\n\tIs,\n\tNotFoundError,\n\tObjectHelper,\n\tUrn\n} from \"@twin.org/core\";\nimport { Sha256 } from \"@twin.org/crypto\";\nimport { JsonLdProcessor, type IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { IDataProcessingComponent } from \"@twin.org/data-processing-models\";\nimport {\n\tDocumentContexts,\n\tDocumentTypes,\n\ttype IDocument,\n\ttype IDocumentAttestation,\n\ttype IDocumentList,\n\ttype IDocumentManagementComponent\n} from \"@twin.org/document-management-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tSchemaOrgContexts,\n\tSchemaOrgDataTypes,\n\tSchemaOrgTypes\n} from \"@twin.org/standards-schema-org\";\nimport { UneceDocumentCodes } from \"@twin.org/standards-unece\";\nimport type { IDocumentManagementServiceConstructorOptions } from \"./models/IDocumentManagementStorageServiceConstructorOptions.js\";\n\n/**\n * Service for performing document management operations.\n */\nexport class DocumentManagementService implements IDocumentManagementComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DocumentManagementService>();\n\n\t/**\n\t * The component for the auditable item graph.\n\t * @internal\n\t */\n\tprivate readonly _auditableItemGraphComponent: IAuditableItemGraphComponent;\n\n\t/**\n\t * The connector for the blob component.\n\t * @internal\n\t */\n\tprivate readonly _blobStorageComponent: IBlobStorageComponent;\n\n\t/**\n\t * The connector for the attestation.\n\t * @internal\n\t */\n\tprivate readonly _attestationComponent: IAttestationComponent;\n\n\t/**\n\t * The connector for the data processing.\n\t * @internal\n\t */\n\tprivate readonly _dataProcessingComponent: IDataProcessingComponent;\n\n\t/**\n\t * Create a new instance of DocumentManagementService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: IDocumentManagementServiceConstructorOptions) {\n\t\tthis._auditableItemGraphComponent = ComponentFactory.get<IAuditableItemGraphComponent>(\n\t\t\toptions?.auditableItemGraphComponentType ?? \"auditable-item-graph\"\n\t\t);\n\t\tthis._blobStorageComponent = ComponentFactory.get<IBlobStorageComponent>(\n\t\t\toptions?.blobStorageComponentType ?? \"blob-storage\"\n\t\t);\n\t\tthis._attestationComponent = ComponentFactory.get<IAttestationComponent>(\n\t\t\toptions?.attestationComponentType ?? \"attestation\"\n\t\t);\n\t\tthis._dataProcessingComponent = ComponentFactory.get<IDataProcessingComponent>(\n\t\t\toptions?.dataProcessingComponentType ?? \"data-processing\"\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 DocumentManagementService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Store a document as an auditable item graph vertex and add its content to blob storage.\n\t * If the document id already exists and the blob data is different a new revision will be created.\n\t * For any other changes the current revision will be updated.\n\t * @param documentId The document id to create.\n\t * @param documentIdFormat The format of the document identifier.\n\t * @param documentCode The code for the document type.\n\t * @param blob The data to create the document with.\n\t * @param annotationObject Additional information to associate with the document.\n\t * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to.\n\t * @param options Additional options for the set operation.\n\t * @param options.createAttestation Flag to create an attestation for the document, defaults to false.\n\t * @param options.addAlias Flag to add the document id as an alias to the aig vertex, defaults to true.\n\t * @param options.aliasAnnotationObject Annotation object for the alias.\n\t * @returns The auditable item graph vertex created for the document including its revision.\n\t */\n\tpublic async create(\n\t\tdocumentId: string,\n\t\tdocumentIdFormat: string | undefined,\n\t\tdocumentCode: UneceDocumentCodes,\n\t\tblob: Uint8Array,\n\t\tannotationObject?: IJsonLdNodeObject,\n\t\tauditableItemGraphEdges?: {\n\t\t\ttargetId: string;\n\t\t\taddAlias?: boolean;\n\t\t\taliasAnnotationObject?: IJsonLdNodeObject;\n\t\t}[],\n\t\toptions?: {\n\t\t\tcreateAttestation?: boolean;\n\t\t\taddAlias?: boolean;\n\t\t\taliasAnnotationObject?: IJsonLdNodeObject;\n\t\t}\n\t): Promise<string> {\n\t\tGuards.stringValue(DocumentManagementService.CLASS_NAME, nameof(documentId), documentId);\n\t\tGuards.arrayOneOf(\n\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\tnameof(documentCode),\n\t\t\tdocumentCode,\n\t\t\tObject.values(UneceDocumentCodes)\n\t\t);\n\t\tGuards.uint8Array(DocumentManagementService.CLASS_NAME, nameof(blob), blob);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\n\t\ttry {\n\t\t\t// Get the connected vertices first, if one fails we abort the create\n\t\t\tconst connectedVertices: { [id: string]: IAuditableItemGraphVertex } = {};\n\t\t\tif (Is.arrayValue(auditableItemGraphEdges)) {\n\t\t\t\tfor (const edge of auditableItemGraphEdges) {\n\t\t\t\t\tconnectedVertices[edge.targetId] = await this._auditableItemGraphComponent.get(\n\t\t\t\t\t\tedge.targetId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst documentVertex: Omit<IAuditableItemGraphVertex, \"@context\" | \"id\" | \"type\"> = {};\n\n\t\t\tif (options?.addAlias ?? true) {\n\t\t\t\tdocumentVertex.aliases ??= [];\n\t\t\t\tdocumentVertex.aliases.push({\n\t\t\t\t\t\"@context\": AuditableItemGraphContexts.ContextRoot,\n\t\t\t\t\ttype: AuditableItemGraphTypes.Alias,\n\t\t\t\t\tid: documentId,\n\t\t\t\t\taliasFormat: documentIdFormat,\n\t\t\t\t\tannotationObject: options?.aliasAnnotationObject\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Add the blob to blob storage\n\t\t\tconst blobStorageId = await this._blobStorageComponent.create(Converter.bytesToBase64(blob));\n\n\t\t\tconst currentRevision: IDocument & IJsonLdNodeObject = {\n\t\t\t\t\"@context\": [\n\t\t\t\t\tDocumentContexts.ContextRoot,\n\t\t\t\t\tDocumentContexts.ContextRootCommon,\n\t\t\t\t\tSchemaOrgContexts.ContextRoot\n\t\t\t\t],\n\t\t\t\ttype: DocumentTypes.Document,\n\t\t\t\tid: this.createDocumentId(documentId, 0),\n\t\t\t\tdocumentId,\n\t\t\t\tdocumentIdFormat,\n\t\t\t\tdocumentCode,\n\t\t\t\tdocumentRevision: 0,\n\t\t\t\tannotationObject,\n\t\t\t\tblobHash: this.generateBlobHash(blob),\n\t\t\t\tblobStorageId,\n\t\t\t\tdateCreated: new Date(Date.now()).toISOString(),\n\t\t\t\torganizationIdentity: contextIds?.[ContextIdKeys.Organization],\n\t\t\t\tuserIdentity: contextIds?.[ContextIdKeys.User]\n\t\t\t};\n\n\t\t\tif (options?.createAttestation ?? false) {\n\t\t\t\tcurrentRevision.attestationId = await this.createAttestation(currentRevision);\n\t\t\t}\n\n\t\t\t// Add the new revision in to the vertex\n\t\t\tdocumentVertex.resources ??= [];\n\t\t\tdocumentVertex.resources.push({\n\t\t\t\t\"@context\": AuditableItemGraphContexts.ContextRoot,\n\t\t\t\ttype: AuditableItemGraphTypes.Resource,\n\t\t\t\tresourceObject: currentRevision\n\t\t\t});\n\n\t\t\t// Add the edges from the document to the items\n\t\t\tthis.updateEdges(documentVertex, auditableItemGraphEdges);\n\n\t\t\t// And create the vertex\n\t\t\tconst vertexId = await this._auditableItemGraphComponent.create(documentVertex);\n\n\t\t\t// Now add the edges to the connected vertices\n\t\t\tawait this.updateConnectedEdges(\n\t\t\t\tconnectedVertices,\n\t\t\t\tvertexId,\n\t\t\t\t[],\n\t\t\t\tauditableItemGraphEdges,\n\t\t\t\tdocumentId,\n\t\t\t\tdocumentIdFormat\n\t\t\t);\n\n\t\t\treturn vertexId;\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorName(error, nameof<NotFoundError>())) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tDocumentManagementService.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 * Update a document as an auditable item graph vertex and add its content to blob storage.\n\t * If the blob data is different a new revision will be created.\n\t * For any other changes the current revision will be updated.\n\t * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.\n\t * @param blob The data to update the document with.\n\t * @param annotationObject Additional information to associate with the document.\n\t * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to, if undefined retains current connections.\n\t * @returns Nothing.\n\t */\n\tpublic async update(\n\t\tauditableItemGraphDocumentId: string,\n\t\tblob?: Uint8Array,\n\t\tannotationObject?: IJsonLdNodeObject,\n\t\tauditableItemGraphEdges?: {\n\t\t\ttargetId: string;\n\t\t\taddAlias?: boolean;\n\t\t\taliasAnnotationObject?: IJsonLdNodeObject;\n\t\t}[]\n\t): Promise<void> {\n\t\tUrn.guard(\n\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\tnameof(auditableItemGraphDocumentId),\n\t\t\tauditableItemGraphDocumentId\n\t\t);\n\n\t\ttry {\n\t\t\tconst documentVertex = await this._auditableItemGraphComponent.get(\n\t\t\t\tauditableItemGraphDocumentId,\n\t\t\t\t{ includeDeleted: true }\n\t\t\t);\n\n\t\t\tif (Is.empty(documentVertex.resources)) {\n\t\t\t\tthrow new NotFoundError(DocumentManagementService.CLASS_NAME, \"documentRevisionNone\");\n\t\t\t}\n\n\t\t\tconst documents = await this.getDocumentsFromVertex(documentVertex);\n\t\t\tconst latestRevision: IDocument | undefined = documents.itemListElement[0];\n\n\t\t\tdocumentVertex.resources = documentVertex.resources.filter(r => Is.empty(r.dateDeleted));\n\n\t\t\tif (Is.empty(latestRevision)) {\n\t\t\t\tthrow new NotFoundError(DocumentManagementService.CLASS_NAME, \"documentRevisionNone\");\n\t\t\t}\n\n\t\t\t// If auditableItemGraphEdges is undefined we are not updating the edges\n\t\t\t// an empty array can be passed to remove all edges\n\t\t\tconst connectedVertices: { [targetId: string]: IAuditableItemGraphVertex } = {};\n\t\t\tif (Is.array(auditableItemGraphEdges)) {\n\t\t\t\t// Get the updated connected vertices first, if one fails we abort the update\n\t\t\t\tfor (const edge of auditableItemGraphEdges) {\n\t\t\t\t\tconnectedVertices[edge.targetId] = await this._auditableItemGraphComponent.get(\n\t\t\t\t\t\tedge.targetId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Also get the current edges in case some need disconnecting\n\t\t\t\tif (Is.arrayValue(documents.edges)) {\n\t\t\t\t\tfor (const edgeId of documents.edges) {\n\t\t\t\t\t\t// If we haven't retrieved the edge then it must be one that needs removing\n\t\t\t\t\t\tif (Is.empty(connectedVertices[edgeId])) {\n\t\t\t\t\t\t\tconnectedVertices[edgeId] = await this._auditableItemGraphComponent.get(edgeId);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet updatedVertex = false;\n\n\t\t\t// If the blob is set and its hash has changed then we create a new revision\n\t\t\tif (Is.uint8Array(blob)) {\n\t\t\t\tconst newBlobHash = this.generateBlobHash(blob);\n\n\t\t\t\tif (latestRevision.blobHash !== newBlobHash) {\n\t\t\t\t\t// Add the blob to blob storage\n\t\t\t\t\tconst blobStorageId = await this._blobStorageComponent.create(\n\t\t\t\t\t\tConverter.bytesToBase64(blob)\n\t\t\t\t\t);\n\n\t\t\t\t\tconst newRevision = ObjectHelper.clone(latestRevision);\n\n\t\t\t\t\tnewRevision.documentRevision++;\n\t\t\t\t\tnewRevision.id = this.createDocumentId(\n\t\t\t\t\t\tnewRevision.documentId,\n\t\t\t\t\t\tnewRevision.documentRevision\n\t\t\t\t\t);\n\t\t\t\t\tnewRevision.blobHash = newBlobHash;\n\t\t\t\t\tnewRevision.blobStorageId = blobStorageId;\n\t\t\t\t\tnewRevision.annotationObject = annotationObject;\n\n\t\t\t\t\tif (Is.stringValue(latestRevision.attestationId)) {\n\t\t\t\t\t\tnewRevision.attestationId = await this.createAttestation(newRevision);\n\t\t\t\t\t}\n\n\t\t\t\t\tdocumentVertex.resources.push({\n\t\t\t\t\t\t\"@context\": AuditableItemGraphContexts.ContextRoot,\n\t\t\t\t\t\ttype: AuditableItemGraphTypes.Resource,\n\t\t\t\t\t\tresourceObject: newRevision as unknown as IJsonLdNodeObject\n\t\t\t\t\t});\n\n\t\t\t\t\tupdatedVertex = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If the blob wasn't updated but the annotation object has then update the current revision\n\t\t\t// instead of creating a new one\n\t\t\tif (\n\t\t\t\t!updatedVertex &&\n\t\t\t\t!ObjectHelper.equal(latestRevision.annotationObject, annotationObject)\n\t\t\t) {\n\t\t\t\tupdatedVertex = true;\n\t\t\t\tlatestRevision.annotationObject = annotationObject;\n\t\t\t\tlatestRevision.dateModified = new Date(Date.now()).toISOString();\n\t\t\t}\n\n\t\t\tconst existingEdgeIds = documentVertex.edges?.map(e => e.targetId) ?? [];\n\n\t\t\t// Update the edges from the document to the items\n\t\t\tconst edgesUpdated = this.updateEdges(documentVertex, auditableItemGraphEdges);\n\t\t\tif (edgesUpdated) {\n\t\t\t\tupdatedVertex = true;\n\t\t\t}\n\n\t\t\tif (updatedVertex) {\n\t\t\t\tawait this._auditableItemGraphComponent.update(documentVertex);\n\t\t\t}\n\n\t\t\tif (edgesUpdated) {\n\t\t\t\tawait this.updateConnectedEdges(\n\t\t\t\t\tconnectedVertices,\n\t\t\t\t\tauditableItemGraphDocumentId,\n\t\t\t\t\texistingEdgeIds,\n\t\t\t\t\tauditableItemGraphEdges,\n\t\t\t\t\tlatestRevision.documentId,\n\t\t\t\t\tlatestRevision.documentIdFormat\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorName(error, nameof<NotFoundError>())) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\t\t\"updateFailed\",\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 document using it's auditable item graph vertex id and optional revision.\n\t * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.\n\t * @param options Additional options for the get operation.\n\t * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.\n\t * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.\n\t * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.\n\t * @param options.includeRemoved Flag to include deleted documents, defaults to false.\n\t * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.\n\t * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.\n\t * @param cursor The cursor to get the next chunk of revisions.\n\t * @param limit Limit the number of items to return, defaults to 1 so only most recent is returned.\n\t * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.\n\t */\n\tpublic async get(\n\t\tauditableItemGraphDocumentId: string,\n\t\toptions?: {\n\t\t\tincludeBlobStorageMetadata?: boolean;\n\t\t\tincludeBlobStorageData?: boolean;\n\t\t\tincludeAttestation?: boolean;\n\t\t\tincludeRemoved?: boolean;\n\t\t\textractRuleGroupId?: string;\n\t\t\textractMimeType?: string;\n\t\t},\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<IDocumentList> {\n\t\tUrn.guard(\n\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\tnameof(auditableItemGraphDocumentId),\n\t\t\tauditableItemGraphDocumentId\n\t\t);\n\n\t\ttry {\n\t\t\tconst documentVertex = await this._auditableItemGraphComponent.get(\n\t\t\t\tauditableItemGraphDocumentId,\n\t\t\t\t{ includeDeleted: options?.includeRemoved }\n\t\t\t);\n\n\t\t\t// Populate the document and revisions with the options set\n\t\t\tconst documents = await this.getDocumentsFromVertex(documentVertex, options, cursor, limit);\n\n\t\t\tconst result = await JsonLdProcessor.compact(documents, documents[\"@context\"]);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorName(error, nameof<NotFoundError>())) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(DocumentManagementService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get a document revision using it's auditable item graph vertex id.\n\t * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.\n\t * @param revision The revision id for the document.\n\t * @param options Additional options for the get operation.\n\t * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.\n\t * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.\n\t * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.\n\t * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.\n\t * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.\n\t * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.\n\t */\n\tpublic async getRevision(\n\t\tauditableItemGraphDocumentId: string,\n\t\trevision: number,\n\t\toptions?: {\n\t\t\tincludeBlobStorageMetadata?: boolean;\n\t\t\tincludeBlobStorageData?: boolean;\n\t\t\tincludeAttestation?: boolean;\n\t\t\textractRuleGroupId?: string;\n\t\t\textractMimeType?: string;\n\t\t}\n\t): Promise<IDocument> {\n\t\tUrn.guard(\n\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\tnameof(auditableItemGraphDocumentId),\n\t\t\tauditableItemGraphDocumentId\n\t\t);\n\t\tGuards.integer(DocumentManagementService.CLASS_NAME, nameof(revision), revision);\n\n\t\ttry {\n\t\t\tconst documentVertex = await this._auditableItemGraphComponent.get(\n\t\t\t\tauditableItemGraphDocumentId,\n\t\t\t\t{ includeDeleted: true }\n\t\t\t);\n\n\t\t\tif (Is.empty(documentVertex.resources)) {\n\t\t\t\tthrow new NotFoundError(DocumentManagementService.CLASS_NAME, \"documentRevisionNone\");\n\t\t\t}\n\n\t\t\tdocumentVertex.resources = documentVertex.resources.filter(\n\t\t\t\td => d.resourceObject?.documentRevision === revision\n\t\t\t);\n\n\t\t\tif (documentVertex.resources.length === 0) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\t\t\t\"documentRevisionNotFound\",\n\t\t\t\t\trevision.toString()\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Populate the document and revisions with the options set\n\t\t\tconst docList = await this.getDocumentsFromVertex(documentVertex, options);\n\n\t\t\tconst result = await JsonLdProcessor.compact(\n\t\t\t\tdocList.itemListElement[0],\n\t\t\t\tdocList.itemListElement[0][\"@context\"]\n\t\t\t);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorName(error, nameof<NotFoundError>())) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\t\t\"getRevisionFailed\",\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 an auditable item graph vertex using it's id.\n\t * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.\n\t * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.\n\t * @param revision The revision of the document to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async removeRevision(\n\t\tauditableItemGraphDocumentId: string,\n\t\trevision: number\n\t): Promise<void> {\n\t\tUrn.guard(\n\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\tnameof(auditableItemGraphDocumentId),\n\t\t\tauditableItemGraphDocumentId\n\t\t);\n\t\tGuards.number(DocumentManagementService.CLASS_NAME, nameof(revision), revision);\n\n\t\ttry {\n\t\t\tconst documentVertex = await this._auditableItemGraphComponent.get(\n\t\t\t\tauditableItemGraphDocumentId\n\t\t\t);\n\n\t\t\tif (Is.empty(documentVertex.resources)) {\n\t\t\t\tthrow new NotFoundError(DocumentManagementService.CLASS_NAME, \"documentRevisionNone\");\n\t\t\t}\n\n\t\t\tconst docRevisionIndex = documentVertex.resources.findIndex(\n\t\t\t\td => d.resourceObject?.documentRevision === revision\n\t\t\t);\n\n\t\t\tif (docRevisionIndex === -1) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\t\t\t\"documentRevisionNotFound\",\n\t\t\t\t\trevision.toString()\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tdocumentVertex.resources.splice(docRevisionIndex, 1);\n\n\t\t\tawait this._auditableItemGraphComponent.update(documentVertex);\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorName(error, nameof<NotFoundError>())) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tDocumentManagementService.CLASS_NAME,\n\t\t\t\t\"removeRevisionFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Find all the document with a specific id.\n\t * @param documentId The document id to find in the graph.\n\t * @param cursor The cursor to get the next chunk of documents.\n\t * @param limit The limit to get the next chunk of documents.\n\t * @returns The graph vertices that contain documents referencing the specified document id.\n\t */\n\tpublic async query(\n\t\tdocumentId: string,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<IAuditableItemGraphVertexList> {\n\t\tGuards.stringValue(DocumentManagementService.CLASS_NAME, nameof(documentId), documentId);\n\n\t\ttry {\n\t\t\tconst result = await this._auditableItemGraphComponent.query(\n\t\t\t\t{\n\t\t\t\t\tid: documentId,\n\t\t\t\t\tidMode: \"both\",\n\t\t\t\t\tresourceTypes: [DocumentTypes.Document]\n\t\t\t\t},\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\t[\"id\", \"dateCreated\", \"dateModified\", \"aliases\", \"annotationObject\", \"resources\", \"edges\"],\n\t\t\t\tcursor,\n\t\t\t\tlimit\n\t\t\t);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorName(error, nameof<NotFoundError>())) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(DocumentManagementService.CLASS_NAME, \"queryFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update the edges of the document vertex.\n\t * @param documentVertex The document vertex to update.\n\t * @param auditableItemGraphEdges The list of edges to use.\n\t * @returns True if the edges were updated.\n\t * @internal\n\t */\n\tprivate updateEdges(\n\t\tdocumentVertex: Omit<IAuditableItemGraphVertex, \"@context\" | \"id\" | \"type\">,\n\t\tauditableItemGraphEdges:\n\t\t\t| { targetId: string; addAlias?: boolean; aliasAnnotationObject?: IJsonLdNodeObject }[]\n\t\t\t| undefined\n\t): boolean {\n\t\tlet changed = false;\n\n\t\tconst existingEdgeIds = documentVertex.edges?.map(e => e.targetId) ?? [];\n\n\t\tif (Is.array(auditableItemGraphEdges)) {\n\t\t\tfor (const aigEdge of auditableItemGraphEdges) {\n\t\t\t\tconst existingIndex = existingEdgeIds.indexOf(aigEdge.targetId);\n\t\t\t\tif (existingIndex !== -1) {\n\t\t\t\t\t// If the edge already exists then we don't need to add it again\n\t\t\t\t\t// We just need to remove it from the list of existing ids\n\t\t\t\t\t// any remaining after this loop will be need to be removed\n\t\t\t\t\texistingEdgeIds.splice(existingIndex, 1);\n\t\t\t\t} else {\n\t\t\t\t\tconst vertexEdge: IAuditableItemGraphEdge = {\n\t\t\t\t\t\t\"@context\": AuditableItemGraphContexts.ContextRoot,\n\t\t\t\t\t\ttype: AuditableItemGraphTypes.Edge,\n\t\t\t\t\t\ttargetId: aigEdge.targetId,\n\t\t\t\t\t\tedgeRelationships: [\"document\"]\n\t\t\t\t\t};\n\n\t\t\t\t\tdocumentVertex.edges ??= [];\n\t\t\t\t\tdocumentVertex.edges?.push(vertexEdge);\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Anything left in the existingEdgeIds array means they need to be removed\n\t\t\tif (existingEdgeIds.length > 0 && Is.array(documentVertex.edges)) {\n\t\t\t\tfor (const existingEdgeId of existingEdgeIds) {\n\t\t\t\t\tconst existingIndex = documentVertex.edges.findIndex(e => e.targetId === existingEdgeId);\n\t\t\t\t\tif (existingIndex !== -1) {\n\t\t\t\t\t\tdocumentVertex.edges.splice(existingIndex, 1);\n\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn changed;\n\t}\n\n\t/**\n\t * Update the edges.\n\t * @param connectedVertices The connected vertices for the edges.\n\t * @param auditableItemGraphDocumentId The document id to use.\n\t * @param documentVertex The document vertex to update.\n\t * @param auditableItemGraphEdges The list of edges to use.\n\t * @param documentId The document identifier.\n\t * @param documentIdFormat The format of the document identifier.\n\t * @internal\n\t */\n\tprivate async updateConnectedEdges(\n\t\tconnectedVertices: { [id: string]: IAuditableItemGraphVertex },\n\t\tauditableItemGraphDocumentId: string,\n\t\texistingEdgeIds: string[],\n\t\tauditableItemGraphEdges:\n\t\t\t| { targetId: string; addAlias?: boolean; aliasAnnotationObject?: IJsonLdNodeObject }[]\n\t\t\t| undefined,\n\t\tdocumentId: string,\n\t\tdocumentIdFormat: string | undefined\n\t): Promise<void> {\n\t\tif (Is.array(auditableItemGraphEdges)) {\n\t\t\tfor (const aigEdge of auditableItemGraphEdges) {\n\t\t\t\tconst connected = connectedVertices[aigEdge.targetId];\n\n\t\t\t\tif (!Is.empty(connected)) {\n\t\t\t\t\tlet updatedConnected = false;\n\n\t\t\t\t\tconst existingIndex = existingEdgeIds.indexOf(aigEdge.targetId);\n\t\t\t\t\tif (existingIndex !== -1) {\n\t\t\t\t\t\t// If the edge already exists we remove it from the list of existing ids\n\t\t\t\t\t\t// any remaining after this loop will be need to be disconnected\n\t\t\t\t\t\texistingEdgeIds.splice(existingIndex, 1);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add the edge with the document vertex id if it doesn't already exist\n\t\t\t\t\tconst hasEdge = connected.edges?.some(e => e.targetId === auditableItemGraphDocumentId);\n\t\t\t\t\tif (!hasEdge) {\n\t\t\t\t\t\tconst vertexEdge: IAuditableItemGraphEdge = {\n\t\t\t\t\t\t\t\"@context\": AuditableItemGraphContexts.ContextRoot,\n\t\t\t\t\t\t\ttype: AuditableItemGraphTypes.Edge,\n\t\t\t\t\t\t\ttargetId: auditableItemGraphDocumentId,\n\t\t\t\t\t\t\tedgeRelationships: [\"document\"]\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconnected.edges ??= [];\n\t\t\t\t\t\tconnected.edges?.push(vertexEdge);\n\t\t\t\t\t\tupdatedConnected = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add alias with the document id if option flag is set and it doesn't already exist\n\t\t\t\t\tif (aigEdge.addAlias) {\n\t\t\t\t\t\tconst alias = connected.aliases?.find(a => a.id === documentId);\n\t\t\t\t\t\tif (Is.empty(alias)) {\n\t\t\t\t\t\t\t// No existing alias, so create one\n\t\t\t\t\t\t\tconst vertexAlias: IAuditableItemGraphAlias = {\n\t\t\t\t\t\t\t\t\"@context\": AuditableItemGraphContexts.ContextRoot,\n\t\t\t\t\t\t\t\ttype: AuditableItemGraphTypes.Alias,\n\t\t\t\t\t\t\t\tid: documentId,\n\t\t\t\t\t\t\t\taliasFormat: documentIdFormat,\n\t\t\t\t\t\t\t\tannotationObject: aigEdge.aliasAnnotationObject\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tconnected.aliases ??= [];\n\t\t\t\t\t\t\tconnected.aliases?.push(vertexAlias);\n\t\t\t\t\t\t\tupdatedConnected = true;\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t!ObjectHelper.equal(alias.annotationObject, aigEdge.aliasAnnotationObject) ||\n\t\t\t\t\t\t\tdocumentIdFormat !== alias.aliasFormat\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// The alias already exists, but the format or annotation object has changed\n\t\t\t\t\t\t\talias.annotationObject = aigEdge.aliasAnnotationObject;\n\t\t\t\t\t\t\talias.aliasFormat = documentIdFormat;\n\t\t\t\t\t\t\tupdatedConnected = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (updatedConnected) {\n\t\t\t\t\t\tawait this._auditableItemGraphComponent.update(connected);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Anything left in the existingEdgeIds array means they need to be removed\n\t\tif (existingEdgeIds.length > 0) {\n\t\t\tfor (const existingEdgeId of existingEdgeIds) {\n\t\t\t\tconst connected = connectedVertices[existingEdgeId];\n\n\t\t\t\tif (!Is.empty(connected)) {\n\t\t\t\t\tlet updatedConnected = false;\n\n\t\t\t\t\t// Remove the edge from the connected vertex\n\t\t\t\t\tif (Is.arrayValue(connected.edges)) {\n\t\t\t\t\t\tconst existingIndex = connected.edges.findIndex(\n\t\t\t\t\t\t\te => e.targetId === auditableItemGraphDocumentId\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (existingIndex !== -1) {\n\t\t\t\t\t\t\tconnected.edges.splice(existingIndex, 1);\n\t\t\t\t\t\t\tupdatedConnected = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove the alias from the connected vertex\n\t\t\t\t\tif (Is.arrayValue(connected.aliases)) {\n\t\t\t\t\t\tconst existingIndex = connected.aliases.findIndex(e => e.id === documentId);\n\t\t\t\t\t\tif (existingIndex !== -1) {\n\t\t\t\t\t\t\tconnected.aliases.splice(existingIndex, 1);\n\t\t\t\t\t\t\tupdatedConnected = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (updatedConnected) {\n\t\t\t\t\t\tawait this._auditableItemGraphComponent.update(connected);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Generate a hash for the blob data.\n\t * @param blob The blob data to hash.\n\t * @returns The hash.\n\t * @internal\n\t */\n\tprivate generateBlobHash(blob: Uint8Array): string {\n\t\treturn `sha256:${Converter.bytesToBase64(Sha256.sum256(blob))}`;\n\t}\n\n\t/**\n\t * Get the documents from the auditable item graph vertex.\n\t * @param documentVertex The vertex containing the documents.\n\t * @param options Additional options for the get operation.\n\t * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.\n\t * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.\n\t * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.\n\t * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.\n\t * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.\n\t * @param cursor The cursor to get the next chunk of revisions.\n\t * @param limit Limit the number of items to return, defaults to 1 so only most recent is returned.\n\t * @returns The finalised list of documents.\n\t * @internal\n\t */\n\tprivate async getDocumentsFromVertex(\n\t\tdocumentVertex: IAuditableItemGraphVertex,\n\t\toptions?: {\n\t\t\tincludeBlobStorageMetadata?: boolean;\n\t\t\tincludeBlobStorageData?: boolean;\n\t\t\tincludeAttestation?: boolean;\n\t\t\textractRuleGroupId?: string;\n\t\t\textractMimeType?: string;\n\t\t},\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<IDocumentList> {\n\t\tconst docList: IDocumentList = {\n\t\t\t\"@context\": [\n\t\t\t\tSchemaOrgContexts.ContextRoot,\n\t\t\t\tDocumentContexts.ContextRoot,\n\t\t\t\tDocumentContexts.ContextRootCommon\n\t\t\t],\n\t\t\ttype: SchemaOrgTypes.ItemList,\n\t\t\t[SchemaOrgTypes.ItemListElement]: []\n\t\t};\n\n\t\tif (Is.arrayValue(documentVertex.resources)) {\n\t\t\t// Sort by newest revision first\n\t\t\tdocumentVertex.resources.sort(\n\t\t\t\t(a, b) =>\n\t\t\t\t\t(Coerce.number(b.resourceObject?.documentRevision) ?? 0) -\n\t\t\t\t\t(Coerce.number(a.resourceObject?.documentRevision) ?? 0)\n\t\t\t);\n\n\t\t\tconst startIndex = Coerce.integer(cursor) ?? 0;\n\t\t\tconst endIndex = Math.min(startIndex + (limit ?? 1), documentVertex.resources.length);\n\t\t\tconst slicedResources = documentVertex.resources.slice(startIndex, endIndex);\n\t\t\tdocList[SchemaOrgTypes.NextItem] =\n\t\t\t\tdocumentVertex.resources.length > endIndex ? (endIndex + 1).toString() : undefined;\n\n\t\t\tconst includeBlobStorageMetadata = options?.includeBlobStorageMetadata ?? false;\n\t\t\tconst includeBlobStorageData = options?.includeBlobStorageData ?? false;\n\t\t\tconst includeAttestation = options?.includeAttestation ?? false;\n\t\t\tconst extractData = Is.stringValue(options?.extractRuleGroupId);\n\n\t\t\tfor (let i = 0; i < slicedResources.length; i++) {\n\t\t\t\tconst document = slicedResources[i].resourceObject as unknown as IDocument;\n\t\t\t\tif (Is.object(document)) {\n\t\t\t\t\tdocument.dateDeleted = slicedResources[i].dateDeleted;\n\n\t\t\t\t\tdocList[SchemaOrgTypes.ItemListElement].push(document);\n\n\t\t\t\t\tconst blobRequired = includeBlobStorageMetadata || includeBlobStorageData;\n\t\t\t\t\tif (blobRequired || extractData) {\n\t\t\t\t\t\tconst blobEntry = await this._blobStorageComponent.get(document.blobStorageId, {\n\t\t\t\t\t\t\tincludeContent: includeBlobStorageData || extractData\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (blobRequired) {\n\t\t\t\t\t\t\tdocument.blobStorageEntry = blobEntry;\n\n\t\t\t\t\t\t\tif (!docList[\"@context\"].includes(BlobStorageContexts.ContextRoot)) {\n\t\t\t\t\t\t\t\tdocList[\"@context\"].push(BlobStorageContexts.ContextRoot);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (Is.stringValue(options?.extractRuleGroupId) && Is.stringValue(blobEntry.blob)) {\n\t\t\t\t\t\t\tconst binaryBlob = Converter.base64ToBytes(blobEntry.blob);\n\t\t\t\t\t\t\tdocument.extractedData = await this._dataProcessingComponent.extract(\n\t\t\t\t\t\t\t\toptions.extractRuleGroupId,\n\t\t\t\t\t\t\t\tbinaryBlob,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\toptions?.extractMimeType\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If we have the blob data due to extraction but we weren't asked for it\n\t\t\t\t\t\t// then we remove it from the document\n\t\t\t\t\t\tif (!blobRequired) {\n\t\t\t\t\t\t\tdelete document.blobStorageEntry;\n\t\t\t\t\t\t} else if (!includeBlobStorageData) {\n\t\t\t\t\t\t\tdelete document.blobStorageEntry?.blob;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (includeAttestation && Is.stringValue(document.attestationId)) {\n\t\t\t\t\t\tconst attestationInformation = await this._attestationComponent.get(\n\t\t\t\t\t\t\tdocument.attestationId\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdocument.attestationInformation = attestationInformation;\n\t\t\t\t\t\tif (!docList[\"@context\"].includes(AttestationContexts.ContextRoot)) {\n\t\t\t\t\t\t\tdocList[\"@context\"].push(AttestationContexts.ContextRoot);\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}\n\n\t\tif (Is.arrayValue(documentVertex.edges)) {\n\t\t\tdocList.edges ??= [];\n\n\t\t\tfor (const edge of documentVertex.edges) {\n\t\t\t\tif (Is.object(edge)) {\n\t\t\t\t\tdocList.edges.push(edge.targetId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn docList;\n\t}\n\n\t/**\n\t * Create an attestation for the document.\n\t * @param document The document to create the attestation for.\n\t * @returns The attestation identifier.\n\t */\n\tprivate async createAttestation(document: IDocument): Promise<string> {\n\t\tconst documentAttestation: IDocumentAttestation & IJsonLdNodeObject = {\n\t\t\t\"@context\": [\n\t\t\t\tDocumentContexts.ContextRoot,\n\t\t\t\tDocumentContexts.ContextRootCommon,\n\t\t\t\tSchemaOrgContexts.ContextRoot\n\t\t\t],\n\t\t\ttype: DocumentTypes.DocumentAttestation,\n\t\t\tid: document.id,\n\t\t\tdocumentId: document.documentId,\n\t\t\tdocumentCode: document.documentCode,\n\t\t\tdocumentRevision: document.documentRevision,\n\t\t\tdateCreated: document.dateCreated,\n\t\t\tblobHash: document.blobHash\n\t\t};\n\t\treturn this._attestationComponent.create(documentAttestation);\n\t}\n\n\t/**\n\t * Create a document id from the document id and revision.\n\t * @param documentId The document id to create.\n\t * @param revision The revision of the document.\n\t * @returns The document id.\n\t * @internal\n\t */\n\tprivate createDocumentId(documentId: string, revision: number): string {\n\t\tconst documentIdHash = Converter.bytesToBase64Url(\n\t\t\tSha256.sum256(Converter.utf8ToBytes(documentId))\n\t\t);\n\t\treturn `document:${documentIdHash}:${revision}`;\n\t}\n}\n"]}
@@ -0,0 +1,8 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./documentManagementRoutes.js";
4
+ export * from "./documentManagementService.js";
5
+ export * from "./models/IDocumentManagementServiceConfig.js";
6
+ export * from "./models/IDocumentManagementStorageServiceConstructorOptions.js";
7
+ export * from "./restEntryPoints.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,iEAAiE,CAAC;AAChF,cAAc,sBAAsB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./documentManagementRoutes.js\";\nexport * from \"./documentManagementService.js\";\nexport * from \"./models/IDocumentManagementServiceConfig.js\";\nexport * from \"./models/IDocumentManagementStorageServiceConstructorOptions.js\";\nexport * from \"./restEntryPoints.js\";\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IDocumentManagementServiceConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IDocumentManagementServiceConfig.js","sourceRoot":"","sources":["../../../src/models/IDocumentManagementServiceConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for the document management service.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IDocumentManagementServiceConfig {}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IDocumentManagementStorageServiceConstructorOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IDocumentManagementStorageServiceConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IDocumentManagementStorageServiceConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IDocumentManagementServiceConfig } from \"./IDocumentManagementServiceConfig.js\";\n\n/**\n * Options for the document management Service constructor.\n */\nexport interface IDocumentManagementServiceConstructorOptions {\n\t/**\n\t * The type of the auditable item graph component.\n\t * @default auditable-item-graph\n\t */\n\tauditableItemGraphComponentType?: string;\n\n\t/**\n\t * The type of the blob storage component.\n\t * @default blob-storage\n\t */\n\tblobStorageComponentType?: string;\n\n\t/**\n\t * The type of the attestation component.\n\t * @default attestation\n\t */\n\tattestationComponentType?: string;\n\n\t/**\n\t * The type of the data processing component.\n\t * @default data-processing\n\t */\n\tdataProcessingComponentType?: string;\n\n\t/**\n\t * The configuration for the service.\n\t */\n\tconfig?: IDocumentManagementServiceConfig;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { generateRestRoutesDocumentManagement, tagsDocumentManagement } from "./documentManagementRoutes.js";
2
+ export const restEntryPoints = [
3
+ {
4
+ name: "document-management",
5
+ defaultBaseRoute: "document-management",
6
+ tags: tagsDocumentManagement,
7
+ generateRoutes: generateRestRoutesDocumentManagement
8
+ }
9
+ ];
10
+ //# sourceMappingURL=restEntryPoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,oCAAoC,EACpC,sBAAsB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD;QACC,IAAI,EAAE,qBAAqB;QAC3B,gBAAgB,EAAE,qBAAqB;QACvC,IAAI,EAAE,sBAAsB;QAC5B,cAAc,EAAE,oCAAoC;KACpD;CACD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteEntryPoint } from \"@twin.org/api-models\";\nimport {\n\tgenerateRestRoutesDocumentManagement,\n\ttagsDocumentManagement\n} from \"./documentManagementRoutes.js\";\n\nexport const restEntryPoints: IRestRouteEntryPoint[] = [\n\t{\n\t\tname: \"document-management\",\n\t\tdefaultBaseRoute: \"document-management\",\n\t\ttags: tagsDocumentManagement,\n\t\tgenerateRoutes: generateRestRoutesDocumentManagement\n\t}\n];\n"]}
@@ -2,7 +2,7 @@ import { type IAuditableItemGraphVertexList } from "@twin.org/auditable-item-gra
2
2
  import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
3
  import { type IDocument, type IDocumentList, type IDocumentManagementComponent } from "@twin.org/document-management-models";
4
4
  import { UneceDocumentCodes } from "@twin.org/standards-unece";
5
- import type { IDocumentManagementServiceConstructorOptions } from "./models/IDocumentManagementStorageServiceConstructorOptions";
5
+ import type { IDocumentManagementServiceConstructorOptions } from "./models/IDocumentManagementStorageServiceConstructorOptions.js";
6
6
  /**
7
7
  * Service for performing document management operations.
8
8
  */
@@ -16,6 +16,11 @@ export declare class DocumentManagementService implements IDocumentManagementCom
16
16
  * @param options The options for the service.
17
17
  */
18
18
  constructor(options?: IDocumentManagementServiceConstructorOptions);
19
+ /**
20
+ * Returns the class name of the component.
21
+ * @returns The class name of the component.
22
+ */
23
+ className(): string;
19
24
  /**
20
25
  * Store a document as an auditable item graph vertex and add its content to blob storage.
21
26
  * If the document id already exists and the blob data is different a new revision will be created.
@@ -30,8 +35,6 @@ export declare class DocumentManagementService implements IDocumentManagementCom
30
35
  * @param options.createAttestation Flag to create an attestation for the document, defaults to false.
31
36
  * @param options.addAlias Flag to add the document id as an alias to the aig vertex, defaults to true.
32
37
  * @param options.aliasAnnotationObject Annotation object for the alias.
33
- * @param userIdentity The identity to perform the auditable item graph operation with.
34
- * @param nodeIdentity The node identity to use for vault operations.
35
38
  * @returns The auditable item graph vertex created for the document including its revision.
36
39
  */
37
40
  create(documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, auditableItemGraphEdges?: {
@@ -42,7 +45,7 @@ export declare class DocumentManagementService implements IDocumentManagementCom
42
45
  createAttestation?: boolean;
43
46
  addAlias?: boolean;
44
47
  aliasAnnotationObject?: IJsonLdNodeObject;
45
- }, userIdentity?: string, nodeIdentity?: string): Promise<string>;
48
+ }): Promise<string>;
46
49
  /**
47
50
  * Update a document as an auditable item graph vertex and add its content to blob storage.
48
51
  * If the blob data is different a new revision will be created.
@@ -51,15 +54,13 @@ export declare class DocumentManagementService implements IDocumentManagementCom
51
54
  * @param blob The data to update the document with.
52
55
  * @param annotationObject Additional information to associate with the document.
53
56
  * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to, if undefined retains current connections.
54
- * @param userIdentity The identity to perform the auditable item graph operation with.
55
- * @param nodeIdentity The node identity to use for vault operations.
56
57
  * @returns Nothing.
57
58
  */
58
59
  update(auditableItemGraphDocumentId: string, blob?: Uint8Array, annotationObject?: IJsonLdNodeObject, auditableItemGraphEdges?: {
59
60
  targetId: string;
60
61
  addAlias?: boolean;
61
62
  aliasAnnotationObject?: IJsonLdNodeObject;
62
- }[], userIdentity?: string, nodeIdentity?: string): Promise<void>;
63
+ }[]): Promise<void>;
63
64
  /**
64
65
  * Get a document using it's auditable item graph vertex id and optional revision.
65
66
  * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
@@ -72,8 +73,6 @@ export declare class DocumentManagementService implements IDocumentManagementCom
72
73
  * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
73
74
  * @param cursor The cursor to get the next chunk of revisions.
74
75
  * @param limit Limit the number of items to return, defaults to 1 so only most recent is returned.
75
- * @param userIdentity The identity to perform the auditable item graph operation with.
76
- * @param nodeIdentity The node identity to use for vault operations.
77
76
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
78
77
  */
79
78
  get(auditableItemGraphDocumentId: string, options?: {
@@ -83,7 +82,7 @@ export declare class DocumentManagementService implements IDocumentManagementCom
83
82
  includeRemoved?: boolean;
84
83
  extractRuleGroupId?: string;
85
84
  extractMimeType?: string;
86
- }, cursor?: string, limit?: number, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
85
+ }, cursor?: string, limit?: number): Promise<IDocumentList>;
87
86
  /**
88
87
  * Get a document revision using it's auditable item graph vertex id.
89
88
  * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
@@ -94,8 +93,6 @@ export declare class DocumentManagementService implements IDocumentManagementCom
94
93
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
95
94
  * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
96
95
  * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
97
- * @param userIdentity The identity to perform the auditable item graph operation with.
98
- * @param nodeIdentity The node identity to use for vault operations.
99
96
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
100
97
  */
101
98
  getRevision(auditableItemGraphDocumentId: string, revision: number, options?: {
@@ -104,32 +101,26 @@ export declare class DocumentManagementService implements IDocumentManagementCom
104
101
  includeAttestation?: boolean;
105
102
  extractRuleGroupId?: string;
106
103
  extractMimeType?: string;
107
- }, userIdentity?: string, nodeIdentity?: string): Promise<IDocument>;
104
+ }): Promise<IDocument>;
108
105
  /**
109
106
  * Remove an auditable item graph vertex using it's id.
110
107
  * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
111
108
  * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
112
109
  * @param revision The revision of the document to remove.
113
- * @param userIdentity The identity to perform the auditable item graph operation with.
114
- * @param nodeIdentity The node identity to use for vault operations.
115
110
  * @returns Nothing.
116
111
  */
117
- removeRevision(auditableItemGraphDocumentId: string, revision: number, userIdentity?: string, nodeIdentity?: string): Promise<void>;
112
+ removeRevision(auditableItemGraphDocumentId: string, revision: number): Promise<void>;
118
113
  /**
119
114
  * Find all the document with a specific id.
120
115
  * @param documentId The document id to find in the graph.
121
116
  * @param cursor The cursor to get the next chunk of documents.
122
117
  * @param limit The limit to get the next chunk of documents.
123
- * @param userIdentity The identity to perform the auditable item graph operation with.
124
- * @param nodeIdentity The node identity to use for vault operations.
125
118
  * @returns The graph vertices that contain documents referencing the specified document id.
126
119
  */
127
- query(documentId: string, cursor?: string, limit?: number, userIdentity?: string, nodeIdentity?: string): Promise<IAuditableItemGraphVertexList>;
120
+ query(documentId: string, cursor?: string, limit?: number): Promise<IAuditableItemGraphVertexList>;
128
121
  /**
129
122
  * Create an attestation for the document.
130
123
  * @param document The document to create the attestation for.
131
- * @param userIdentity The identity to perform the attestation operation with.
132
- * @param nodeIdentity The node identity to perform attestation operation with.
133
124
  * @returns The attestation identifier.
134
125
  */
135
126
  private createAttestation;
@@ -1,5 +1,5 @@
1
- export * from "./documentManagementRoutes";
2
- export * from "./documentManagementService";
3
- export * from "./models/IDocumentManagementServiceConfig";
4
- export * from "./models/IDocumentManagementStorageServiceConstructorOptions";
5
- export * from "./restEntryPoints";
1
+ export * from "./documentManagementRoutes.js";
2
+ export * from "./documentManagementService.js";
3
+ export * from "./models/IDocumentManagementServiceConfig.js";
4
+ export * from "./models/IDocumentManagementStorageServiceConstructorOptions.js";
5
+ export * from "./restEntryPoints.js";
@@ -1,4 +1,4 @@
1
- import type { IDocumentManagementServiceConfig } from "./IDocumentManagementServiceConfig";
1
+ import type { IDocumentManagementServiceConfig } from "./IDocumentManagementServiceConfig.js";
2
2
  /**
3
3
  * Options for the document management Service constructor.
4
4
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @twin.org/document-management-service - Changelog
2
2
 
3
+ ## [0.0.3-next.2](https://github.com/twinfoundation/document-management/compare/document-management-service-v0.0.3-next.1...document-management-service-v0.0.3-next.2) (2025-11-28)
4
+
5
+
6
+ ### Features
7
+
8
+ * update background task service ([5c380dc](https://github.com/twinfoundation/document-management/commit/5c380dca3114254201768f184f9486828501ff66))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/document-management-models bumped from 0.0.3-next.1 to 0.0.3-next.2
16
+
17
+ ## [0.0.3-next.1](https://github.com/twinfoundation/document-management/compare/document-management-service-v0.0.3-next.0...document-management-service-v0.0.3-next.1) (2025-11-12)
18
+
19
+
20
+ ### Features
21
+
22
+ * add context id features ([#24](https://github.com/twinfoundation/document-management/issues/24)) ([83f65f1](https://github.com/twinfoundation/document-management/commit/83f65f15e55f2293f5ca0d9d1e4679ba67c4ec8d))
23
+ * add external unece type reference ([e8311ae](https://github.com/twinfoundation/document-management/commit/e8311ae35f36d83783ce24dfdd3f38142d7f4abf))
24
+ * add validate-locales ([b6b6f9e](https://github.com/twinfoundation/document-management/commit/b6b6f9e9d66c17af3d030247ca168ac0b5844bdc))
25
+ * document get can perform extraction ([#6](https://github.com/twinfoundation/document-management/issues/6)) ([5ce6d37](https://github.com/twinfoundation/document-management/commit/5ce6d37432ad271ca5783f422846f4be98ec2215))
26
+ * eslint migration to flat config ([98635aa](https://github.com/twinfoundation/document-management/commit/98635aa24ebafba265e989e461fe98104f683191))
27
+ * get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
28
+ * populate dateDeleted from aig resource object ([ce91cf1](https://github.com/twinfoundation/document-management/commit/ce91cf1385c4370ec6924435349213abf776f3e5))
29
+ * remove unused namespace ([602259d](https://github.com/twinfoundation/document-management/commit/602259d6e9aeb8006dff45bebd94157e3f0a204b))
30
+ * store document as a vertex ([#2](https://github.com/twinfoundation/document-management/issues/2)) ([7febedc](https://github.com/twinfoundation/document-management/commit/7febedc3fb31de9c19565d6326341046834f2c74))
31
+ * update blob storage component ([63fe802](https://github.com/twinfoundation/document-management/commit/63fe8023bdae76631e324e6fee753c7e9243acfe))
32
+ * update dependencies ([b051009](https://github.com/twinfoundation/document-management/commit/b051009ae27a44c38a73ebdb0f05ebea1c8dae0e))
33
+ * update dependencies ([f9d8641](https://github.com/twinfoundation/document-management/commit/f9d86417dba24027699225ec7473296e361dcb00))
34
+ * update framework core ([f991a59](https://github.com/twinfoundation/document-management/commit/f991a59d25ec228bcdd7a5b6bd55578985b55a84))
35
+ * use standard list json ld types ([20ea04b](https://github.com/twinfoundation/document-management/commit/20ea04b05fd4bc4fcedce8f66958942c3c2fa303))
36
+ * use targetId in AIG for edges ([82dec81](https://github.com/twinfoundation/document-management/commit/82dec8190d8b523b350ef133bdcf648cab1023b0))
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * adding missing route for the document management ([#4](https://github.com/twinfoundation/document-management/issues/4)) ([fd3292e](https://github.com/twinfoundation/document-management/commit/fd3292ede5014847ae2f2bcadb174b6552486154))
42
+ * query params force coercion ([d667d0f](https://github.com/twinfoundation/document-management/commit/d667d0f195accca2887a5ca732e9790063763996))
43
+
44
+
45
+ ### Dependencies
46
+
47
+ * The following workspace dependencies were updated
48
+ * dependencies
49
+ * @twin.org/document-management-models bumped from 0.0.3-next.0 to 0.0.3-next.1
50
+
3
51
  ## [0.0.2-next.4](https://github.com/twinfoundation/document-management/compare/document-management-service-v0.0.2-next.3...document-management-service-v0.0.2-next.4) (2025-10-09)
4
52
 
5
53