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

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.
@@ -1,6 +1,8 @@
1
1
  export * from "./models/api/IDocumentManagementCreateRequest";
2
2
  export * from "./models/api/IDocumentManagementGetRequest";
3
3
  export * from "./models/api/IDocumentManagementGetResponse";
4
+ export * from "./models/api/IDocumentManagementGetRevisionRequest";
5
+ export * from "./models/api/IDocumentManagementGetRevisionResponse";
4
6
  export * from "./models/api/IDocumentManagementQueryRequest";
5
7
  export * from "./models/api/IDocumentManagementQueryResponse";
6
8
  export * from "./models/api/IDocumentManagementRemoveRequest";
@@ -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
  */
@@ -2,6 +2,7 @@ import type { IAuditableItemGraphVertexList } from "@twin.org/auditable-item-gra
2
2
  import type { IComponent } from "@twin.org/core";
3
3
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
4
4
  import type { UneceDocumentCodes } from "@twin.org/standards-unece";
5
+ import type { IDocument } from "./IDocument";
5
6
  import type { IDocumentList } from "./IDocumentList";
6
7
  /**
7
8
  * Interface describing an document management contract.
@@ -59,6 +60,8 @@ export interface IDocumentManagementComponent extends IComponent {
59
60
  * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
60
61
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
61
62
  * @param options.includeRemoved Flag to include deleted documents, defaults to false.
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.
62
65
  * @param cursor The cursor to get the next chunk of revisions.
63
66
  * @param pageSize Page size of items to return, defaults to 1 so only most recent is returned.
64
67
  * @param userIdentity The identity to perform the auditable item graph operation with.
@@ -70,7 +73,30 @@ export interface IDocumentManagementComponent extends IComponent {
70
73
  includeBlobStorageData?: boolean;
71
74
  includeAttestation?: boolean;
72
75
  includeRemoved?: boolean;
76
+ extractRuleGroupId?: string;
77
+ extractMimeType?: string;
73
78
  }, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
79
+ /**
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>;
74
100
  /**
75
101
  * Remove an auditable item graph vertex using it's id.
76
102
  * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
@@ -42,6 +42,14 @@ export interface IDocumentManagementGetRequest {
42
42
  * @default false
43
43
  */
44
44
  includeRemoved?: boolean;
45
+ /**
46
+ * If provided will extract data from the document using the specified rule group id.
47
+ */
48
+ extractRuleGroupId?: string;
49
+ /**
50
+ * By default extraction will auto detect the mime type of the document, this can be used to override the detection.
51
+ */
52
+ extractMimeType?: string;
45
53
  /**
46
54
  * Page size of items to return, defaults to 1 so only most recent is returned.
47
55
  * @default 1
@@ -0,0 +1,53 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ /**
3
+ * Request to get a document revision from an auditable item graph vertex.
4
+ */
5
+ export interface IDocumentManagementGetRevisionRequest {
6
+ /**
7
+ * The headers which can be used to determine the response data type.
8
+ */
9
+ headers?: {
10
+ [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
11
+ };
12
+ /**
13
+ * The path parameters.
14
+ */
15
+ pathParams: {
16
+ /**
17
+ * The full id of the document to get.
18
+ */
19
+ auditableItemGraphDocumentId: string;
20
+ /**
21
+ * The revision of the document to get.
22
+ */
23
+ revision: string;
24
+ };
25
+ /**
26
+ * The query parameters.
27
+ */
28
+ query?: {
29
+ /**
30
+ * Include the blob storage metadata in the response.
31
+ * @default false
32
+ */
33
+ includeBlobStorageMetadata?: boolean;
34
+ /**
35
+ * Include the blob storage data in the response.
36
+ * @default false
37
+ */
38
+ includeBlobStorageData?: boolean;
39
+ /**
40
+ * Include the attestation information in the response.
41
+ * @default false
42
+ */
43
+ includeAttestation?: boolean;
44
+ /**
45
+ * If provided will extract data from the document using the specified rule group id.
46
+ */
47
+ extractRuleGroupId?: string;
48
+ /**
49
+ * By default extraction will auto detect the mime type of the document, this can be used to override the detection.
50
+ */
51
+ extractMimeType?: string;
52
+ };
53
+ }
@@ -0,0 +1,17 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ import type { IDocument } from "../IDocument";
3
+ /**
4
+ * Response to get a document revision from an auditable item graph vertex.
5
+ */
6
+ export interface IDocumentManagementGetRevisionResponse {
7
+ /**
8
+ * The headers which can be used to determine the response data type.
9
+ */
10
+ headers?: {
11
+ [HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
12
+ };
13
+ /**
14
+ * The body parameters.
15
+ */
16
+ body: IDocument;
17
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @twin.org/document-management-models - Changelog
2
2
 
3
+ ## [0.0.1-next.12](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.11...document-management-models-v0.0.1-next.12) (2025-04-30)
4
+
5
+
6
+ ### Features
7
+
8
+ * get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
9
+
10
+ ## [0.0.1-next.11](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.10...document-management-models-v0.0.1-next.11) (2025-04-28)
11
+
12
+
13
+ ### Features
14
+
15
+ * document get can perform extraction ([#6](https://github.com/twinfoundation/document-management/issues/6)) ([5ce6d37](https://github.com/twinfoundation/document-management/commit/5ce6d37432ad271ca5783f422846f4be98ec2215))
16
+
3
17
  ## [0.0.1-next.10](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.9...document-management-models-v0.0.1-next.10) (2025-04-25)
4
18
 
5
19
 
@@ -9,6 +9,8 @@
9
9
  - [IDocumentManagementCreateRequest](interfaces/IDocumentManagementCreateRequest.md)
10
10
  - [IDocumentManagementGetRequest](interfaces/IDocumentManagementGetRequest.md)
11
11
  - [IDocumentManagementGetResponse](interfaces/IDocumentManagementGetResponse.md)
12
+ - [IDocumentManagementGetRevisionRequest](interfaces/IDocumentManagementGetRevisionRequest.md)
13
+ - [IDocumentManagementGetRevisionResponse](interfaces/IDocumentManagementGetRevisionResponse.md)
12
14
  - [IDocumentManagementQueryRequest](interfaces/IDocumentManagementQueryRequest.md)
13
15
  - [IDocumentManagementQueryResponse](interfaces/IDocumentManagementQueryResponse.md)
14
16
  - [IDocumentManagementRemoveRequest](interfaces/IDocumentManagementRemoveRequest.md)
@@ -92,6 +92,14 @@ The additional JSON-LD for blob storage if it was requested.
92
92
 
93
93
  ***
94
94
 
95
+ ### extractedData?
96
+
97
+ > `optional` **extractedData**: `unknown`
98
+
99
+ The data extracted from the document using data extraction services.
100
+
101
+ ***
102
+
95
103
  ### attestationId?
96
104
 
97
105
  > `optional` **attestationId**: `string`
@@ -192,6 +192,18 @@ Flag to include the attestation information for the document, defaults to false.
192
192
 
193
193
  Flag to include deleted documents, defaults to false.
194
194
 
195
+ ###### extractRuleGroupId?
196
+
197
+ `string`
198
+
199
+ If provided will extract data from the document using the specified rule group id.
200
+
201
+ ###### extractMimeType?
202
+
203
+ `string`
204
+
205
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
206
+
195
207
  ##### cursor?
196
208
 
197
209
  `string`
@@ -224,6 +236,80 @@ The documents and revisions if requested, ordered by revision descending, cursor
224
236
 
225
237
  ***
226
238
 
239
+ ### getRevision()
240
+
241
+ > **getRevision**(`auditableItemGraphDocumentId`, `revision`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<[`IDocument`](IDocument.md)\>
242
+
243
+ Get a document revision using it's auditable item graph vertex id.
244
+
245
+ #### Parameters
246
+
247
+ ##### auditableItemGraphDocumentId
248
+
249
+ `string`
250
+
251
+ The auditable item graph vertex id which contains the document.
252
+
253
+ ##### revision
254
+
255
+ `number`
256
+
257
+ The revision id of the document to get.
258
+
259
+ ##### options?
260
+
261
+ Additional options for the get operation.
262
+
263
+ ###### includeBlobStorageMetadata?
264
+
265
+ `boolean`
266
+
267
+ Flag to include the blob storage metadata for the document, defaults to false.
268
+
269
+ ###### includeBlobStorageData?
270
+
271
+ `boolean`
272
+
273
+ Flag to include the blob storage data for the document, defaults to false.
274
+
275
+ ###### includeAttestation?
276
+
277
+ `boolean`
278
+
279
+ Flag to include the attestation information for the document, defaults to false.
280
+
281
+ ###### extractRuleGroupId?
282
+
283
+ `string`
284
+
285
+ If provided will extract data from the document using the specified rule group id.
286
+
287
+ ###### extractMimeType?
288
+
289
+ `string`
290
+
291
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
292
+
293
+ ##### userIdentity?
294
+
295
+ `string`
296
+
297
+ The identity to perform the auditable item graph operation with.
298
+
299
+ ##### nodeIdentity?
300
+
301
+ `string`
302
+
303
+ The node identity to use for vault operations.
304
+
305
+ #### Returns
306
+
307
+ `Promise`\<[`IDocument`](IDocument.md)\>
308
+
309
+ The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
310
+
311
+ ***
312
+
227
313
  ### removeRevision()
228
314
 
229
315
  > **removeRevision**(`auditableItemGraphDocumentId`, `revision`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
@@ -84,6 +84,18 @@ Include deleted documents in the response.
84
84
  false
85
85
  ```
86
86
 
87
+ #### extractRuleGroupId?
88
+
89
+ > `optional` **extractRuleGroupId**: `string`
90
+
91
+ If provided will extract data from the document using the specified rule group id.
92
+
93
+ #### extractMimeType?
94
+
95
+ > `optional` **extractMimeType**: `string`
96
+
97
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
98
+
87
99
  #### pageSize?
88
100
 
89
101
  > `optional` **pageSize**: `string`
@@ -0,0 +1,91 @@
1
+ # Interface: IDocumentManagementGetRevisionRequest
2
+
3
+ Request to get a document revision from an auditable item graph vertex.
4
+
5
+ ## Properties
6
+
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### accept
14
+
15
+ > **accept**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
19
+ ### pathParams
20
+
21
+ > **pathParams**: `object`
22
+
23
+ The path parameters.
24
+
25
+ #### auditableItemGraphDocumentId
26
+
27
+ > **auditableItemGraphDocumentId**: `string`
28
+
29
+ The full id of the document to get.
30
+
31
+ #### revision
32
+
33
+ > **revision**: `string`
34
+
35
+ The revision of the document to get.
36
+
37
+ ***
38
+
39
+ ### query?
40
+
41
+ > `optional` **query**: `object`
42
+
43
+ The query parameters.
44
+
45
+ #### includeBlobStorageMetadata?
46
+
47
+ > `optional` **includeBlobStorageMetadata**: `boolean`
48
+
49
+ Include the blob storage metadata in the response.
50
+
51
+ ##### Default
52
+
53
+ ```ts
54
+ false
55
+ ```
56
+
57
+ #### includeBlobStorageData?
58
+
59
+ > `optional` **includeBlobStorageData**: `boolean`
60
+
61
+ Include the blob storage data in the response.
62
+
63
+ ##### Default
64
+
65
+ ```ts
66
+ false
67
+ ```
68
+
69
+ #### includeAttestation?
70
+
71
+ > `optional` **includeAttestation**: `boolean`
72
+
73
+ Include the attestation information in the response.
74
+
75
+ ##### Default
76
+
77
+ ```ts
78
+ false
79
+ ```
80
+
81
+ #### extractRuleGroupId?
82
+
83
+ > `optional` **extractRuleGroupId**: `string`
84
+
85
+ If provided will extract data from the document using the specified rule group id.
86
+
87
+ #### extractMimeType?
88
+
89
+ > `optional` **extractMimeType**: `string`
90
+
91
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
@@ -0,0 +1,23 @@
1
+ # Interface: IDocumentManagementGetRevisionResponse
2
+
3
+ Response to get a document revision from an auditable item graph vertex.
4
+
5
+ ## Properties
6
+
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### content-type
14
+
15
+ > **content-type**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
19
+ ### body
20
+
21
+ > **body**: [`IDocument`](IDocument.md)
22
+
23
+ The body parameters.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/document-management-models",
3
- "version": "0.0.1-next.10",
3
+ "version": "0.0.1-next.12",
4
4
  "description": "Models which define the structure of the document management connectors and services",
5
5
  "repository": {
6
6
  "type": "git",