@twin.org/document-management-models 0.0.1-next.9 → 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.
@@ -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,6 +1,9 @@
1
+ export * from "./dataTypes/documentManagementDataTypes";
1
2
  export * from "./models/api/IDocumentManagementCreateRequest";
2
3
  export * from "./models/api/IDocumentManagementGetRequest";
3
4
  export * from "./models/api/IDocumentManagementGetResponse";
5
+ export * from "./models/api/IDocumentManagementGetRevisionRequest";
6
+ export * from "./models/api/IDocumentManagementGetRevisionResponse";
4
7
  export * from "./models/api/IDocumentManagementQueryRequest";
5
8
  export * from "./models/api/IDocumentManagementQueryResponse";
6
9
  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
  */
@@ -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,11 +18,11 @@ 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[];
25
26
  /**
26
27
  * The ids of the other vertices which are connected to the document.
27
28
  */
@@ -29,5 +30,5 @@ export interface IDocumentList {
29
30
  /**
30
31
  * The cursor to get the next chunk of documents.
31
32
  */
32
- cursor?: string;
33
+ [SchemaOrgTypes.NextItem]?: string;
33
34
  }
@@ -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.
@@ -26,27 +26,35 @@ export interface IDocumentManagementGetRequest {
26
26
  * Include the blob storage metadata in the response.
27
27
  * @default false
28
28
  */
29
- includeBlobStorageMetadata?: boolean;
29
+ includeBlobStorageMetadata?: boolean | string;
30
30
  /**
31
31
  * Include the blob storage data in the response.
32
32
  * @default false
33
33
  */
34
- includeBlobStorageData?: boolean;
34
+ includeBlobStorageData?: boolean | string;
35
35
  /**
36
36
  * Include the attestation information in the response.
37
37
  * @default false
38
38
  */
39
- includeAttestation?: boolean;
39
+ includeAttestation?: boolean | string;
40
40
  /**
41
41
  * Include deleted documents in the response.
42
42
  * @default false
43
43
  */
44
- includeRemoved?: boolean;
44
+ includeRemoved?: boolean | string;
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
48
56
  */
49
- pageSize?: string;
57
+ pageSize?: number | string;
50
58
  /**
51
59
  * The cursor to get the next chunk of revisions.
52
60
  */
@@ -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 | string;
34
+ /**
35
+ * Include the blob storage data in the response.
36
+ * @default false
37
+ */
38
+ includeBlobStorageData?: boolean | string;
39
+ /**
40
+ * Include the attestation information in the response.
41
+ * @default false
42
+ */
43
+ includeAttestation?: boolean | string;
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
+ }
@@ -24,6 +24,6 @@ export interface IDocumentManagementQueryRequest {
24
24
  /**
25
25
  * The number of documents to return.
26
26
  */
27
- pageSize?: string;
27
+ pageSize?: number | string;
28
28
  };
29
29
  }
@@ -10,10 +10,6 @@ export declare const DocumentTypes: {
10
10
  * Represents a document attestation.
11
11
  */
12
12
  readonly DocumentAttestation: "DocumentAttestation";
13
- /**
14
- * Represents a document list.
15
- */
16
- readonly DocumentList: "DocumentList";
17
13
  };
18
14
  /**
19
15
  * The types of document management objects.
package/docs/changelog.md CHANGED
@@ -1,5 +1,101 @@
1
1
  # @twin.org/document-management-models - Changelog
2
2
 
3
+ ## 0.0.1 (2025-07-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * release to production ([a009526](https://github.com/twinfoundation/document-management/commit/a009526032a0ee6e6b74f476a01fbe5f4c7fd4da))
9
+
10
+ ## [0.0.1-next.20](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.19...document-management-models-v0.0.1-next.20) (2025-06-20)
11
+
12
+
13
+ ### Features
14
+
15
+ * data type registration use fully qualified names ([18d27d0](https://github.com/twinfoundation/document-management/commit/18d27d0c21d0f652b7df4b409bb2d3c66cf22f84))
16
+ * document get can perform extraction ([#6](https://github.com/twinfoundation/document-management/issues/6)) ([5ce6d37](https://github.com/twinfoundation/document-management/commit/5ce6d37432ad271ca5783f422846f4be98ec2215))
17
+ * get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
18
+ * improve comments ([4d2f094](https://github.com/twinfoundation/document-management/commit/4d2f094b23e3320cb739917246c1ee5f6ad41c11))
19
+ * store document as a vertex ([#2](https://github.com/twinfoundation/document-management/issues/2)) ([7febedc](https://github.com/twinfoundation/document-management/commit/7febedc3fb31de9c19565d6326341046834f2c74))
20
+ * update dependencies ([f9d8641](https://github.com/twinfoundation/document-management/commit/f9d86417dba24027699225ec7473296e361dcb00))
21
+ * update ts-to-schema generation ([01a5335](https://github.com/twinfoundation/document-management/commit/01a5335372f6a4764a74d56c446d669724a308aa))
22
+ * use standard list json ld types ([20ea04b](https://github.com/twinfoundation/document-management/commit/20ea04b05fd4bc4fcedce8f66958942c3c2fa303))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * query params force coercion ([d667d0f](https://github.com/twinfoundation/document-management/commit/d667d0f195accca2887a5ca732e9790063763996))
28
+
29
+ ## [0.0.1-next.19](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.18...document-management-models-v0.0.1-next.19) (2025-06-20)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * query params force coercion ([d667d0f](https://github.com/twinfoundation/document-management/commit/d667d0f195accca2887a5ca732e9790063763996))
35
+
36
+ ## [0.0.1-next.18](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.17...document-management-models-v0.0.1-next.18) (2025-06-18)
37
+
38
+
39
+ ### Miscellaneous Chores
40
+
41
+ * **document-management-models:** Synchronize repo versions
42
+
43
+ ## [0.0.1-next.17](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.16...document-management-models-v0.0.1-next.17) (2025-06-12)
44
+
45
+
46
+ ### Features
47
+
48
+ * update dependencies ([f9d8641](https://github.com/twinfoundation/document-management/commit/f9d86417dba24027699225ec7473296e361dcb00))
49
+
50
+ ## [0.0.1-next.16](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.15...document-management-models-v0.0.1-next.16) (2025-06-03)
51
+
52
+
53
+ ### Features
54
+
55
+ * update ts-to-schema generation ([01a5335](https://github.com/twinfoundation/document-management/commit/01a5335372f6a4764a74d56c446d669724a308aa))
56
+
57
+ ## [0.0.1-next.15](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.14...document-management-models-v0.0.1-next.15) (2025-05-28)
58
+
59
+
60
+ ### Features
61
+
62
+ * data type registration use fully qualified names ([18d27d0](https://github.com/twinfoundation/document-management/commit/18d27d0c21d0f652b7df4b409bb2d3c66cf22f84))
63
+
64
+ ## [0.0.1-next.14](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.13...document-management-models-v0.0.1-next.14) (2025-05-08)
65
+
66
+
67
+ ### Features
68
+
69
+ * use standard list json ld types ([20ea04b](https://github.com/twinfoundation/document-management/commit/20ea04b05fd4bc4fcedce8f66958942c3c2fa303))
70
+
71
+ ## [0.0.1-next.13](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.12...document-management-models-v0.0.1-next.13) (2025-04-30)
72
+
73
+
74
+ ### Miscellaneous Chores
75
+
76
+ * **document-management-models:** Synchronize repo versions
77
+
78
+ ## [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)
79
+
80
+
81
+ ### Features
82
+
83
+ * get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
84
+
85
+ ## [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)
86
+
87
+
88
+ ### Features
89
+
90
+ * document get can perform extraction ([#6](https://github.com/twinfoundation/document-management/issues/6)) ([5ce6d37](https://github.com/twinfoundation/document-management/commit/5ce6d37432ad271ca5783f422846f4be98ec2215))
91
+
92
+ ## [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)
93
+
94
+
95
+ ### Miscellaneous Chores
96
+
97
+ * **document-management-models:** Synchronize repo versions
98
+
3
99
  ## [0.0.1-next.9](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.8...document-management-models-v0.0.1-next.9) (2025-04-17)
4
100
 
5
101
 
@@ -0,0 +1,25 @@
1
+ # Class: DocumentManagementDataTypes
2
+
3
+ Handle all the data types for document management.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new DocumentManagementDataTypes**(): `DocumentManagementDataTypes`
10
+
11
+ #### Returns
12
+
13
+ `DocumentManagementDataTypes`
14
+
15
+ ## Methods
16
+
17
+ ### registerTypes()
18
+
19
+ > `static` **registerTypes**(): `void`
20
+
21
+ Register all the data types.
22
+
23
+ #### Returns
24
+
25
+ `void`
@@ -1,5 +1,9 @@
1
1
  # @twin.org/document-management-models
2
2
 
3
+ ## Classes
4
+
5
+ - [DocumentManagementDataTypes](classes/DocumentManagementDataTypes.md)
6
+
3
7
  ## Interfaces
4
8
 
5
9
  - [IDocument](interfaces/IDocument.md)
@@ -9,6 +13,8 @@
9
13
  - [IDocumentManagementCreateRequest](interfaces/IDocumentManagementCreateRequest.md)
10
14
  - [IDocumentManagementGetRequest](interfaces/IDocumentManagementGetRequest.md)
11
15
  - [IDocumentManagementGetResponse](interfaces/IDocumentManagementGetResponse.md)
16
+ - [IDocumentManagementGetRevisionRequest](interfaces/IDocumentManagementGetRevisionRequest.md)
17
+ - [IDocumentManagementGetRevisionResponse](interfaces/IDocumentManagementGetRevisionResponse.md)
12
18
  - [IDocumentManagementQueryRequest](interfaces/IDocumentManagementQueryRequest.md)
13
19
  - [IDocumentManagementQueryResponse](interfaces/IDocumentManagementQueryResponse.md)
14
20
  - [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`
@@ -6,7 +6,7 @@ Interface describing a list of document entries.
6
6
 
7
7
  ### @context
8
8
 
9
- > **@context**: \[`"https://schema.twindev.org/documents/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
9
+ > **@context**: \[`"https://schema.org"`, `"https://schema.twindev.org/documents/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
10
10
 
11
11
  JSON-LD Context.
12
12
 
@@ -14,15 +14,15 @@ JSON-LD Context.
14
14
 
15
15
  ### type
16
16
 
17
- > **type**: `"DocumentList"`
17
+ > **type**: `"ItemList"`
18
18
 
19
19
  JSON-LD Type.
20
20
 
21
21
  ***
22
22
 
23
- ### documents
23
+ ### itemListElement
24
24
 
25
- > **documents**: [`IDocument`](IDocument.md)[]
25
+ > **itemListElement**: [`IDocument`](IDocument.md)[]
26
26
 
27
27
  The list of documents.
28
28
 
@@ -36,8 +36,8 @@ The ids of the other vertices which are connected to the document.
36
36
 
37
37
  ***
38
38
 
39
- ### cursor?
39
+ ### nextItem?
40
40
 
41
- > `optional` **cursor**: `string`
41
+ > `optional` **nextItem**: `string`
42
42
 
43
43
  The cursor to get the next chunk of documents.
@@ -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`\>
@@ -38,7 +38,7 @@ The query parameters.
38
38
 
39
39
  #### includeBlobStorageMetadata?
40
40
 
41
- > `optional` **includeBlobStorageMetadata**: `boolean`
41
+ > `optional` **includeBlobStorageMetadata**: `string` \| `boolean`
42
42
 
43
43
  Include the blob storage metadata in the response.
44
44
 
@@ -50,7 +50,7 @@ false
50
50
 
51
51
  #### includeBlobStorageData?
52
52
 
53
- > `optional` **includeBlobStorageData**: `boolean`
53
+ > `optional` **includeBlobStorageData**: `string` \| `boolean`
54
54
 
55
55
  Include the blob storage data in the response.
56
56
 
@@ -62,7 +62,7 @@ false
62
62
 
63
63
  #### includeAttestation?
64
64
 
65
- > `optional` **includeAttestation**: `boolean`
65
+ > `optional` **includeAttestation**: `string` \| `boolean`
66
66
 
67
67
  Include the attestation information in the response.
68
68
 
@@ -74,7 +74,7 @@ false
74
74
 
75
75
  #### includeRemoved?
76
76
 
77
- > `optional` **includeRemoved**: `boolean`
77
+ > `optional` **includeRemoved**: `string` \| `boolean`
78
78
 
79
79
  Include deleted documents in the response.
80
80
 
@@ -84,9 +84,21 @@ 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
- > `optional` **pageSize**: `string`
101
+ > `optional` **pageSize**: `string` \| `number`
90
102
 
91
103
  Page size of items to return, defaults to 1 so only most recent is returned.
92
104
 
@@ -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**: `string` \| `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**: `string` \| `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**: `string` \| `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.
@@ -36,6 +36,6 @@ The cursor to get the next chunk of documents.
36
36
 
37
37
  #### pageSize?
38
38
 
39
- > `optional` **pageSize**: `string`
39
+ > `optional` **pageSize**: `string` \| `number`
40
40
 
41
41
  The number of documents to return.
@@ -17,9 +17,3 @@ Represents a document.
17
17
  > `readonly` **DocumentAttestation**: `"DocumentAttestation"` = `"DocumentAttestation"`
18
18
 
19
19
  Represents a document attestation.
20
-
21
- ### DocumentList
22
-
23
- > `readonly` **DocumentList**: `"DocumentList"` = `"DocumentList"`
24
-
25
- Represents a document list.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/document-management-models",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.1",
4
4
  "description": "Models which define the structure of the document management connectors and services",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,14 +14,15 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/attestation-models": "next",
18
- "@twin.org/auditable-item-graph-models": "next",
19
- "@twin.org/blob-storage-models": "next",
20
- "@twin.org/core": "next",
21
- "@twin.org/data-json-ld": "next",
22
- "@twin.org/nameof": "next",
23
- "@twin.org/standards-schema-org": "next",
24
- "@twin.org/standards-unece": "next"
17
+ "@twin.org/attestation-models": "^0.0.1",
18
+ "@twin.org/auditable-item-graph-models": "^0.0.1",
19
+ "@twin.org/blob-storage-models": "^0.0.1",
20
+ "@twin.org/core": "^0.0.1",
21
+ "@twin.org/data-core": "^0.0.1",
22
+ "@twin.org/data-json-ld": "^0.0.1",
23
+ "@twin.org/nameof": "^0.0.1",
24
+ "@twin.org/standards-schema-org": "^0.0.1",
25
+ "@twin.org/standards-unece": "^0.0.1"
25
26
  },
26
27
  "main": "./dist/cjs/index.cjs",
27
28
  "module": "./dist/esm/index.mjs",