@twin.org/document-management-models 0.0.1-next.8 → 0.0.1

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.
Files changed (36) hide show
  1. package/dist/cjs/index.cjs +152 -4
  2. package/dist/esm/index.mjs +152 -5
  3. package/dist/types/dataTypes/documentManagementDataTypes.d.ts +9 -0
  4. package/dist/types/index.d.ts +5 -1
  5. package/dist/types/models/IDocument.d.ts +4 -8
  6. package/dist/types/models/IDocumentList.d.ts +9 -4
  7. package/dist/types/models/IDocumentManagementComponent.d.ts +70 -35
  8. package/dist/types/models/api/{IDocumentManagementSetRequest.d.ts → IDocumentManagementCreateRequest.d.ts} +14 -15
  9. package/dist/types/models/api/IDocumentManagementGetRequest.d.ts +17 -13
  10. package/dist/types/models/api/IDocumentManagementGetResponse.d.ts +2 -2
  11. package/dist/types/models/api/IDocumentManagementGetRevisionRequest.d.ts +53 -0
  12. package/dist/types/models/api/IDocumentManagementGetRevisionResponse.d.ts +17 -0
  13. package/dist/types/models/api/IDocumentManagementQueryRequest.d.ts +7 -22
  14. package/dist/types/models/api/IDocumentManagementQueryResponse.d.ts +2 -2
  15. package/dist/types/models/api/IDocumentManagementRemoveRequest.d.ts +5 -15
  16. package/dist/types/models/api/IDocumentManagementUpdateRequest.d.ts +36 -0
  17. package/dist/types/models/documentTypes.d.ts +0 -4
  18. package/docs/changelog.md +103 -0
  19. package/docs/reference/classes/DocumentManagementDataTypes.md +25 -0
  20. package/docs/reference/index.md +8 -1
  21. package/docs/reference/interfaces/IDocument.md +8 -16
  22. package/docs/reference/interfaces/IDocumentList.md +14 -6
  23. package/docs/reference/interfaces/IDocumentManagementComponent.md +165 -57
  24. package/docs/reference/interfaces/{IDocumentManagementSetRequest.md → IDocumentManagementCreateRequest.md} +13 -21
  25. package/docs/reference/interfaces/IDocumentManagementGetRequest.md +24 -18
  26. package/docs/reference/interfaces/IDocumentManagementGetResponse.md +1 -1
  27. package/docs/reference/interfaces/IDocumentManagementGetRevisionRequest.md +91 -0
  28. package/docs/reference/interfaces/IDocumentManagementGetRevisionResponse.md +23 -0
  29. package/docs/reference/interfaces/IDocumentManagementQueryRequest.md +11 -43
  30. package/docs/reference/interfaces/IDocumentManagementQueryResponse.md +1 -1
  31. package/docs/reference/interfaces/IDocumentManagementRemoveRequest.md +7 -27
  32. package/docs/reference/interfaces/IDocumentManagementUpdateRequest.md +43 -0
  33. package/docs/reference/type-aliases/DocumentContexts.md +1 -1
  34. package/docs/reference/type-aliases/DocumentTypes.md +1 -1
  35. package/docs/reference/variables/DocumentTypes.md +0 -6
  36. package/package.json +10 -8
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var dataCore = require('@twin.org/data-core');
4
+
3
5
  // Copyright 2024 IOTA Stiftung.
4
6
  // SPDX-License-Identifier: Apache-2.0.
5
7
  /**
@@ -31,12 +33,158 @@ const DocumentTypes = {
31
33
  /**
32
34
  * Represents a document attestation.
33
35
  */
34
- DocumentAttestation: "DocumentAttestation",
36
+ DocumentAttestation: "DocumentAttestation"
37
+ };
38
+
39
+ var $schema = "https://json-schema.org/draft/2020-12/schema";
40
+ var $id = "https://schema.twindev.org/documents/Document";
41
+ var description = "Interface describing a document.";
42
+ var type = "object";
43
+ var properties = {
44
+ "@context": {
45
+ type: "array",
46
+ minItems: 3,
47
+ items: {
48
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
49
+ },
50
+ description: "JSON-LD Context.",
51
+ prefixItems: [
52
+ {
53
+ type: "string",
54
+ "const": "https://schema.twindev.org/documents/"
55
+ },
56
+ {
57
+ type: "string",
58
+ "const": "https://schema.twindev.org/common/"
59
+ },
60
+ {
61
+ type: "string",
62
+ "const": "https://schema.org"
63
+ }
64
+ ]
65
+ },
66
+ type: {
67
+ type: "string",
68
+ "const": "Document",
69
+ description: "JSON-LD Type."
70
+ },
71
+ id: {
72
+ type: "string",
73
+ description: "The full id of the document."
74
+ },
75
+ documentId: {
76
+ type: "string",
77
+ description: "The id of the document."
78
+ },
79
+ documentIdFormat: {
80
+ type: "string",
81
+ description: "The format of the document id."
82
+ },
83
+ documentCode: {
84
+ $ref: "https://vocabulary.uncefact.org/DocumentCodeList",
85
+ description: "The code for the document type."
86
+ },
87
+ documentRevision: {
88
+ type: "number",
89
+ description: "The revision of the document as a 0 based index."
90
+ },
91
+ annotationObject: {
92
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
93
+ description: "Additional annotation information for the document."
94
+ },
95
+ blobStorageId: {
96
+ type: "string",
97
+ description: "The blob storage id for the document."
98
+ },
99
+ blobHash: {
100
+ type: "string",
101
+ description: "The hash of the blob data."
102
+ },
103
+ blobStorageEntry: {
104
+ $ref: "https://schema.twindev.org/blob-storage/BlobStorageEntry",
105
+ description: "The additional JSON-LD for blob storage if it was requested."
106
+ },
107
+ extractedData: {
108
+ description: "The data extracted from the document using data extraction services."
109
+ },
110
+ attestationId: {
111
+ type: "string",
112
+ description: "The attestation for the document if one was created."
113
+ },
114
+ attestationInformation: {
115
+ $ref: "https://schema.twindev.org/attestation/AttestationInformation",
116
+ description: "The additional JSON-LD for attestation storage if it was requested."
117
+ },
118
+ dateCreated: {
119
+ type: "string",
120
+ description: "The date/time of when the document was created."
121
+ },
122
+ dateModified: {
123
+ type: "string",
124
+ description: "The date/time of when the document was modified."
125
+ },
126
+ dateDeleted: {
127
+ type: "string",
128
+ description: "The date/time of when the document was deleted, as we never actually remove items."
129
+ },
130
+ nodeIdentity: {
131
+ type: "string",
132
+ description: "The node which added the document to the graph."
133
+ },
134
+ userIdentity: {
135
+ type: "string",
136
+ description: "The user who added the document to the graph."
137
+ }
138
+ };
139
+ var required = [
140
+ "@context",
141
+ "type",
142
+ "id",
143
+ "documentId",
144
+ "documentCode",
145
+ "documentRevision",
146
+ "blobStorageId",
147
+ "blobHash",
148
+ "dateCreated",
149
+ "nodeIdentity",
150
+ "userIdentity"
151
+ ];
152
+ var additionalProperties = false;
153
+ var DocumentSchema = {
154
+ $schema: $schema,
155
+ $id: $id,
156
+ description: description,
157
+ type: type,
158
+ properties: properties,
159
+ required: required,
160
+ additionalProperties: additionalProperties
161
+ };
162
+
163
+ // Copyright 2024 IOTA Stiftung.
164
+ // SPDX-License-Identifier: Apache-2.0.
165
+ /**
166
+ * Handle all the data types for document management.
167
+ */
168
+ class DocumentManagementDataTypes {
35
169
  /**
36
- * Represents a document list.
170
+ * Register all the data types.
37
171
  */
38
- DocumentList: "DocumentList"
39
- };
172
+ static registerTypes() {
173
+ dataCore.DataTypeHandlerFactory.register(`${DocumentContexts.ContextRoot}${DocumentTypes.Document}`, () => ({
174
+ context: DocumentContexts.ContextRoot,
175
+ type: DocumentTypes.Document,
176
+ defaultValue: {},
177
+ jsonSchema: async () => DocumentSchema
178
+ }));
179
+ dataCore.DataTypeHandlerFactory.register(`${DocumentContexts.ContextRoot}${DocumentTypes.DocumentAttestation}`, () => ({
180
+ context: DocumentContexts.ContextRoot,
181
+ type: DocumentTypes.DocumentAttestation,
182
+ defaultValue: {},
183
+ jsonSchema: async () => DocumentSchema
184
+ }));
185
+ }
186
+ }
40
187
 
41
188
  exports.DocumentContexts = DocumentContexts;
189
+ exports.DocumentManagementDataTypes = DocumentManagementDataTypes;
42
190
  exports.DocumentTypes = DocumentTypes;
@@ -1,3 +1,5 @@
1
+ import { DataTypeHandlerFactory } from '@twin.org/data-core';
2
+
1
3
  // Copyright 2024 IOTA Stiftung.
2
4
  // SPDX-License-Identifier: Apache-2.0.
3
5
  /**
@@ -29,11 +31,156 @@ const DocumentTypes = {
29
31
  /**
30
32
  * Represents a document attestation.
31
33
  */
32
- DocumentAttestation: "DocumentAttestation",
34
+ DocumentAttestation: "DocumentAttestation"
35
+ };
36
+
37
+ var $schema = "https://json-schema.org/draft/2020-12/schema";
38
+ var $id = "https://schema.twindev.org/documents/Document";
39
+ var description = "Interface describing a document.";
40
+ var type = "object";
41
+ var properties = {
42
+ "@context": {
43
+ type: "array",
44
+ minItems: 3,
45
+ items: {
46
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
47
+ },
48
+ description: "JSON-LD Context.",
49
+ prefixItems: [
50
+ {
51
+ type: "string",
52
+ "const": "https://schema.twindev.org/documents/"
53
+ },
54
+ {
55
+ type: "string",
56
+ "const": "https://schema.twindev.org/common/"
57
+ },
58
+ {
59
+ type: "string",
60
+ "const": "https://schema.org"
61
+ }
62
+ ]
63
+ },
64
+ type: {
65
+ type: "string",
66
+ "const": "Document",
67
+ description: "JSON-LD Type."
68
+ },
69
+ id: {
70
+ type: "string",
71
+ description: "The full id of the document."
72
+ },
73
+ documentId: {
74
+ type: "string",
75
+ description: "The id of the document."
76
+ },
77
+ documentIdFormat: {
78
+ type: "string",
79
+ description: "The format of the document id."
80
+ },
81
+ documentCode: {
82
+ $ref: "https://vocabulary.uncefact.org/DocumentCodeList",
83
+ description: "The code for the document type."
84
+ },
85
+ documentRevision: {
86
+ type: "number",
87
+ description: "The revision of the document as a 0 based index."
88
+ },
89
+ annotationObject: {
90
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
91
+ description: "Additional annotation information for the document."
92
+ },
93
+ blobStorageId: {
94
+ type: "string",
95
+ description: "The blob storage id for the document."
96
+ },
97
+ blobHash: {
98
+ type: "string",
99
+ description: "The hash of the blob data."
100
+ },
101
+ blobStorageEntry: {
102
+ $ref: "https://schema.twindev.org/blob-storage/BlobStorageEntry",
103
+ description: "The additional JSON-LD for blob storage if it was requested."
104
+ },
105
+ extractedData: {
106
+ description: "The data extracted from the document using data extraction services."
107
+ },
108
+ attestationId: {
109
+ type: "string",
110
+ description: "The attestation for the document if one was created."
111
+ },
112
+ attestationInformation: {
113
+ $ref: "https://schema.twindev.org/attestation/AttestationInformation",
114
+ description: "The additional JSON-LD for attestation storage if it was requested."
115
+ },
116
+ dateCreated: {
117
+ type: "string",
118
+ description: "The date/time of when the document was created."
119
+ },
120
+ dateModified: {
121
+ type: "string",
122
+ description: "The date/time of when the document was modified."
123
+ },
124
+ dateDeleted: {
125
+ type: "string",
126
+ description: "The date/time of when the document was deleted, as we never actually remove items."
127
+ },
128
+ nodeIdentity: {
129
+ type: "string",
130
+ description: "The node which added the document to the graph."
131
+ },
132
+ userIdentity: {
133
+ type: "string",
134
+ description: "The user who added the document to the graph."
135
+ }
136
+ };
137
+ var required = [
138
+ "@context",
139
+ "type",
140
+ "id",
141
+ "documentId",
142
+ "documentCode",
143
+ "documentRevision",
144
+ "blobStorageId",
145
+ "blobHash",
146
+ "dateCreated",
147
+ "nodeIdentity",
148
+ "userIdentity"
149
+ ];
150
+ var additionalProperties = false;
151
+ var DocumentSchema = {
152
+ $schema: $schema,
153
+ $id: $id,
154
+ description: description,
155
+ type: type,
156
+ properties: properties,
157
+ required: required,
158
+ additionalProperties: additionalProperties
159
+ };
160
+
161
+ // Copyright 2024 IOTA Stiftung.
162
+ // SPDX-License-Identifier: Apache-2.0.
163
+ /**
164
+ * Handle all the data types for document management.
165
+ */
166
+ class DocumentManagementDataTypes {
33
167
  /**
34
- * Represents a document list.
168
+ * Register all the data types.
35
169
  */
36
- DocumentList: "DocumentList"
37
- };
170
+ static registerTypes() {
171
+ DataTypeHandlerFactory.register(`${DocumentContexts.ContextRoot}${DocumentTypes.Document}`, () => ({
172
+ context: DocumentContexts.ContextRoot,
173
+ type: DocumentTypes.Document,
174
+ defaultValue: {},
175
+ jsonSchema: async () => DocumentSchema
176
+ }));
177
+ DataTypeHandlerFactory.register(`${DocumentContexts.ContextRoot}${DocumentTypes.DocumentAttestation}`, () => ({
178
+ context: DocumentContexts.ContextRoot,
179
+ type: DocumentTypes.DocumentAttestation,
180
+ defaultValue: {},
181
+ jsonSchema: async () => DocumentSchema
182
+ }));
183
+ }
184
+ }
38
185
 
39
- export { DocumentContexts, DocumentTypes };
186
+ export { DocumentContexts, DocumentManagementDataTypes, DocumentTypes };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Handle all the data types for document management.
3
+ */
4
+ export declare class DocumentManagementDataTypes {
5
+ /**
6
+ * Register all the data types.
7
+ */
8
+ static registerTypes(): void;
9
+ }
@@ -1,9 +1,13 @@
1
+ export * from "./dataTypes/documentManagementDataTypes";
2
+ export * from "./models/api/IDocumentManagementCreateRequest";
1
3
  export * from "./models/api/IDocumentManagementGetRequest";
2
4
  export * from "./models/api/IDocumentManagementGetResponse";
5
+ export * from "./models/api/IDocumentManagementGetRevisionRequest";
6
+ export * from "./models/api/IDocumentManagementGetRevisionResponse";
3
7
  export * from "./models/api/IDocumentManagementQueryRequest";
4
8
  export * from "./models/api/IDocumentManagementQueryResponse";
5
9
  export * from "./models/api/IDocumentManagementRemoveRequest";
6
- export * from "./models/api/IDocumentManagementSetRequest";
10
+ export * from "./models/api/IDocumentManagementUpdateRequest";
7
11
  export * from "./models/documentContexts";
8
12
  export * from "./models/documentTypes";
9
13
  export * from "./models/IDocument";
@@ -58,6 +58,10 @@ export interface IDocument {
58
58
  * The additional JSON-LD for blob storage if it was requested.
59
59
  */
60
60
  blobStorageEntry?: IBlobStorageEntry;
61
+ /**
62
+ * The data extracted from the document using data extraction services.
63
+ */
64
+ extractedData?: unknown;
61
65
  /**
62
66
  * The attestation for the document if one was created.
63
67
  */
@@ -86,12 +90,4 @@ export interface IDocument {
86
90
  * The user who added the document to the graph.
87
91
  */
88
92
  userIdentity: string;
89
- /**
90
- * The previous revisions of the document.
91
- */
92
- revisions?: IDocument[];
93
- /**
94
- * The cursor to get the next chunk of revisions.
95
- */
96
- revisionCursor?: string;
97
93
  }
@@ -1,6 +1,6 @@
1
1
  import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
2
+ import type { SchemaOrgContexts, SchemaOrgTypes } from "@twin.org/standards-schema-org";
2
3
  import type { DocumentContexts } from "./documentContexts";
3
- import type { DocumentTypes } from "./documentTypes";
4
4
  import type { IDocument } from "./IDocument";
5
5
  /**
6
6
  * Interface describing a list of document entries.
@@ -10,6 +10,7 @@ export interface IDocumentList {
10
10
  * JSON-LD Context.
11
11
  */
12
12
  "@context": [
13
+ typeof SchemaOrgContexts.ContextRoot,
13
14
  typeof DocumentContexts.ContextRoot,
14
15
  typeof DocumentContexts.ContextRootCommon,
15
16
  ...IJsonLdContextDefinitionElement[]
@@ -17,13 +18,17 @@ export interface IDocumentList {
17
18
  /**
18
19
  * JSON-LD Type.
19
20
  */
20
- type: typeof DocumentTypes.DocumentList;
21
+ type: typeof SchemaOrgTypes.ItemList;
21
22
  /**
22
23
  * The list of documents.
23
24
  */
24
- documents: IDocument[];
25
+ [SchemaOrgTypes.ItemListElement]: IDocument[];
26
+ /**
27
+ * The ids of the other vertices which are connected to the document.
28
+ */
29
+ edges?: string[];
25
30
  /**
26
31
  * The cursor to get the next chunk of documents.
27
32
  */
28
- cursor?: string;
33
+ [SchemaOrgTypes.NextItem]?: string;
29
34
  }
@@ -1,3 +1,4 @@
1
+ import type { IAuditableItemGraphVertexList } from "@twin.org/auditable-item-graph-models";
1
2
  import type { IComponent } from "@twin.org/core";
2
3
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
4
  import type { UneceDocumentCodes } from "@twin.org/standards-unece";
@@ -8,78 +9,112 @@ import type { IDocumentList } from "./IDocumentList";
8
9
  */
9
10
  export interface IDocumentManagementComponent extends IComponent {
10
11
  /**
11
- * Store a document in an auditable item graph vertex and add its content to blob storage.
12
+ * Create a document as an auditable item graph vertex and add its content to blob storage.
12
13
  * If the document id already exists and the blob data is different a new revision will be created.
13
14
  * For any other changes the current revision will be updated.
14
- * @param auditableItemGraphId The auditable item graph vertex id to create the document on.
15
15
  * @param documentId The document id to create.
16
16
  * @param documentIdFormat The format of the document identifier.
17
17
  * @param documentCode The code for the document type.
18
18
  * @param blob The data to create the document with.
19
19
  * @param annotationObject Additional information to associate with the document.
20
+ * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to.
20
21
  * @param options Additional options for the set operation.
21
22
  * @param options.createAttestation Flag to create an attestation for the document, defaults to false.
22
- * @param options.includeIdAsAlias Include the document id as an alias to the aig vertex, defaults to false.
23
- * @param options.aliasAnnotationObject Additional information to associate with the alias.
23
+ * @param options.addAlias Flag to add the document id as an alias to the aig vertex, defaults to true.
24
+ * @param options.aliasAnnotationObject Annotation object for the alias.
24
25
  * @param userIdentity The identity to perform the auditable item graph operation with.
25
26
  * @param nodeIdentity The node identity to use for vault operations.
26
- * @returns The identifier for the document which includes the auditable item graph identifier.
27
+ * @returns The auditable item graph vertex created for the document including its revision.
27
28
  */
28
- set(auditableItemGraphId: string, documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, options?: {
29
+ create(documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, auditableItemGraphEdges?: {
30
+ id: string;
31
+ addAlias?: boolean;
32
+ aliasAnnotationObject?: IJsonLdNodeObject;
33
+ }[], options?: {
29
34
  createAttestation?: boolean;
30
- includeIdAsAlias?: boolean;
35
+ addAlias?: boolean;
31
36
  aliasAnnotationObject?: IJsonLdNodeObject;
32
37
  }, userIdentity?: string, nodeIdentity?: string): Promise<string>;
33
38
  /**
34
- * Get a specific document from an auditable item graph vertex.
35
- * @param auditableItemGraphId The auditable item graph vertex id to get the document from.
36
- * @param identifier The identifier of the document to get.
39
+ * Update a document as an auditable item graph vertex and add its content to blob storage.
40
+ * If the blob data is different a new revision will be created.
41
+ * For any other changes the current revision will be updated.
42
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
43
+ * @param blob The data to update the document with.
44
+ * @param annotationObject Additional information to associate with the document.
45
+ * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to, if undefined retains current connections.
46
+ * @param userIdentity The identity to perform the auditable item graph operation with.
47
+ * @param nodeIdentity The node identity to use for vault operations.
48
+ * @returns Nothing.
49
+ */
50
+ update(auditableItemGraphDocumentId: string, blob?: Uint8Array, annotationObject?: IJsonLdNodeObject, auditableItemGraphEdges?: {
51
+ id: string;
52
+ addAlias?: boolean;
53
+ aliasAnnotationObject?: IJsonLdNodeObject;
54
+ }[], userIdentity?: string, nodeIdentity?: string): Promise<void>;
55
+ /**
56
+ * Get a document using it's auditable item graph vertex id and optional revision.
57
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
37
58
  * @param options Additional options for the get operation.
38
59
  * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
39
60
  * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
40
61
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
41
62
  * @param options.includeRemoved Flag to include deleted documents, defaults to false.
42
- * @param options.maxRevisionCount Max number of revisions to return, defaults to 0.
43
- * @param revisionCursor The cursor to get the next chunk of revisions.
63
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
64
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
65
+ * @param cursor The cursor to get the next chunk of revisions.
66
+ * @param pageSize Page size of items to return, defaults to 1 so only most recent is returned.
44
67
  * @param userIdentity The identity to perform the auditable item graph operation with.
45
68
  * @param nodeIdentity The node identity to use for vault operations.
46
69
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
47
70
  */
48
- get(auditableItemGraphId: string, identifier: string, options?: {
71
+ get(auditableItemGraphDocumentId: string, options?: {
49
72
  includeBlobStorageMetadata?: boolean;
50
73
  includeBlobStorageData?: boolean;
51
74
  includeAttestation?: boolean;
52
75
  includeRemoved?: boolean;
53
- maxRevisionCount?: number;
54
- }, revisionCursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocument>;
76
+ extractRuleGroupId?: string;
77
+ extractMimeType?: string;
78
+ }, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
55
79
  /**
56
- * Remove a specific document from an auditable item graph vertex.
57
- * The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
58
- * @param auditableItemGraphId The auditable item graph vertex id to remove the document from.
59
- * @param identifier The identifier of the document to remove.
60
- * @param options Additional options for the remove operation.
61
- * @param options.removeAllRevisions Flag to remove all revisions of the document, defaults to false.
80
+ * Get a document revision using it's auditable item graph vertex id.
81
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
82
+ * @param revision The revision id of the document to get.
83
+ * @param options Additional options for the get operation.
84
+ * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
85
+ * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
86
+ * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
87
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
88
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
89
+ * @param userIdentity The identity to perform the auditable item graph operation with.
90
+ * @param nodeIdentity The node identity to use for vault operations.
91
+ * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
92
+ */
93
+ getRevision(auditableItemGraphDocumentId: string, revision: number, options?: {
94
+ includeBlobStorageMetadata?: boolean;
95
+ includeBlobStorageData?: boolean;
96
+ includeAttestation?: boolean;
97
+ extractRuleGroupId?: string;
98
+ extractMimeType?: string;
99
+ }, userIdentity?: string, nodeIdentity?: string): Promise<IDocument>;
100
+ /**
101
+ * Remove an auditable item graph vertex using it's id.
102
+ * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
103
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
104
+ * @param revision The revision of the document to remove.
62
105
  * @param userIdentity The identity to perform the auditable item graph operation with.
63
106
  * @param nodeIdentity The node identity to use for vault operations.
64
107
  * @returns Nothing.
65
108
  */
66
- remove(auditableItemGraphId: string, identifier: string, options?: {
67
- removeAllRevisions?: boolean;
68
- }, userIdentity?: string, nodeIdentity?: string): Promise<void>;
109
+ removeRevision(auditableItemGraphDocumentId: string, revision: number, userIdentity?: string, nodeIdentity?: string): Promise<void>;
69
110
  /**
70
- * Query an auditable item graph vertex for documents.
71
- * @param auditableItemGraphId The auditable item graph vertex to get the documents from.
72
- * @param documentCodes The document codes to query for, if undefined gets all document codes.
73
- * @param options Additional options for the query operation.
74
- * @param options.includeMostRecentRevisions Include the most recent 5 revisions, use the individual get to retrieve more.
75
- * @param options.includeRemoved Flag to include deleted documents, defaults to false.
111
+ * Find all the document with a specific id.
112
+ * @param documentId The document id to find in the graph.
76
113
  * @param cursor The cursor to get the next chunk of documents.
114
+ * @param pageSize The page size to get the next chunk of documents.
77
115
  * @param userIdentity The identity to perform the auditable item graph operation with.
78
116
  * @param nodeIdentity The node identity to use for vault operations.
79
- * @returns The most recent revisions of each document, cursor is set if there are more documents.
117
+ * @returns The graph vertices that contain documents referencing the specified document id.
80
118
  */
81
- query(auditableItemGraphId: string, documentCodes?: UneceDocumentCodes[], options?: {
82
- includeMostRecentRevisions?: boolean;
83
- includeRemoved?: boolean;
84
- }, cursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
119
+ query(documentId: string, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IAuditableItemGraphVertexList>;
85
120
  }
@@ -1,18 +1,9 @@
1
1
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
2
  import type { UneceDocumentCodes } from "@twin.org/standards-unece";
3
3
  /**
4
- * Request to set a document in an auditable item graph vertex.
4
+ * Request to create a document as an auditable item graph vertex.
5
5
  */
6
- export interface IDocumentManagementSetRequest {
7
- /**
8
- * The path parameters.
9
- */
10
- pathParams: {
11
- /**
12
- * The id of the auditable item graph vertex to store the document on.
13
- */
14
- auditableItemGraphId: string;
15
- };
6
+ export interface IDocumentManagementCreateRequest {
16
7
  /**
17
8
  * The body parameters.
18
9
  */
@@ -38,15 +29,23 @@ export interface IDocumentManagementSetRequest {
38
29
  */
39
30
  annotationObject?: IJsonLdNodeObject;
40
31
  /**
41
- * Flag to create an attestation for the document, defaults to false
32
+ * The auditable item graph vertices to connect the document to.
33
+ */
34
+ auditableItemGraphEdges?: {
35
+ id: string;
36
+ addAlias?: boolean;
37
+ aliasAnnotationObject?: IJsonLdNodeObject;
38
+ }[];
39
+ /**
40
+ * Flag to create an attestation for the document, defaults to false.
42
41
  */
43
42
  createAttestation?: boolean;
44
43
  /**
45
- * Include the document id as an alias to the aig vertex, defaults to false.
44
+ * Flag to add the document id as an alias to the aig vertex, defaults to true.
46
45
  */
47
- includeIdAsAlias?: boolean;
46
+ addAlias?: boolean;
48
47
  /**
49
- * Additional information to associate with the alias.
48
+ * Annotation object for the alias.
50
49
  */
51
50
  aliasAnnotationObject?: IJsonLdNodeObject;
52
51
  };