@twin.org/document-management-models 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.
- package/dist/es/dataTypes/documentManagementDataTypes.js +29 -0
- package/dist/es/dataTypes/documentManagementDataTypes.js.map +1 -0
- package/dist/es/index.js +19 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IDocument.js +2 -0
- package/dist/es/models/IDocument.js.map +1 -0
- package/dist/es/models/IDocumentAttestation.js +2 -0
- package/dist/es/models/IDocumentAttestation.js.map +1 -0
- package/dist/es/models/IDocumentList.js +2 -0
- package/dist/es/models/IDocumentList.js.map +1 -0
- package/dist/es/models/IDocumentManagementComponent.js +2 -0
- package/dist/es/models/IDocumentManagementComponent.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementCreateRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementCreateRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementGetRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementGetRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementGetResponse.js +2 -0
- package/dist/es/models/api/IDocumentManagementGetResponse.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementGetRevisionRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementGetRevisionRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementGetRevisionResponse.js +2 -0
- package/dist/es/models/api/IDocumentManagementGetRevisionResponse.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementQueryRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementQueryRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementQueryResponse.js +2 -0
- package/dist/es/models/api/IDocumentManagementQueryResponse.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementRemoveRequest.js +4 -0
- package/dist/es/models/api/IDocumentManagementRemoveRequest.js.map +1 -0
- package/dist/es/models/api/IDocumentManagementUpdateRequest.js +2 -0
- package/dist/es/models/api/IDocumentManagementUpdateRequest.js.map +1 -0
- package/dist/es/models/documentContexts.js +17 -0
- package/dist/es/models/documentContexts.js.map +1 -0
- package/dist/es/models/documentTypes.js +17 -0
- package/dist/es/models/documentTypes.js.map +1 -0
- package/dist/es/schemas/Document.json +114 -0
- package/dist/types/index.d.ts +16 -16
- package/dist/types/models/IDocument.d.ts +5 -5
- package/dist/types/models/IDocumentAttestation.d.ts +2 -2
- package/dist/types/models/IDocumentList.d.ts +2 -2
- package/dist/types/models/IDocumentManagementComponent.d.ts +8 -20
- package/dist/types/models/api/IDocumentManagementGetRequest.d.ts +4 -4
- package/dist/types/models/api/IDocumentManagementGetResponse.d.ts +1 -1
- package/dist/types/models/api/IDocumentManagementGetRevisionRequest.d.ts +3 -3
- package/dist/types/models/api/IDocumentManagementGetRevisionResponse.d.ts +1 -1
- package/docs/changelog.md +31 -0
- package/docs/reference/interfaces/IDocument.md +5 -5
- package/docs/reference/interfaces/IDocumentManagementComponent.md +7 -87
- package/docs/reference/interfaces/IDocumentManagementCreateRequest.md +1 -1
- package/docs/reference/interfaces/IDocumentManagementGetRequest.md +4 -4
- package/docs/reference/interfaces/IDocumentManagementGetRevisionRequest.md +3 -3
- package/package.json +5 -7
- package/dist/cjs/index.cjs +0 -190
- package/dist/esm/index.mjs +0 -186
|
@@ -30,17 +30,17 @@ export interface IDocumentManagementGetRevisionRequest {
|
|
|
30
30
|
* Include the blob storage metadata in the response.
|
|
31
31
|
* @default false
|
|
32
32
|
*/
|
|
33
|
-
includeBlobStorageMetadata?:
|
|
33
|
+
includeBlobStorageMetadata?: string;
|
|
34
34
|
/**
|
|
35
35
|
* Include the blob storage data in the response.
|
|
36
36
|
* @default false
|
|
37
37
|
*/
|
|
38
|
-
includeBlobStorageData?:
|
|
38
|
+
includeBlobStorageData?: string;
|
|
39
39
|
/**
|
|
40
40
|
* Include the attestation information in the response.
|
|
41
41
|
* @default false
|
|
42
42
|
*/
|
|
43
|
-
includeAttestation?:
|
|
43
|
+
includeAttestation?: string;
|
|
44
44
|
/**
|
|
45
45
|
* If provided will extract data from the document using the specified rule group id.
|
|
46
46
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @twin.org/document-management-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.2](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.3-next.1...document-management-models-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
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.3-next.0...document-management-models-v0.0.3-next.1) (2025-11-12)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add context id features ([#24](https://github.com/twinfoundation/document-management/issues/24)) ([83f65f1](https://github.com/twinfoundation/document-management/commit/83f65f15e55f2293f5ca0d9d1e4679ba67c4ec8d))
|
|
16
|
+
* add validate-locales ([b6b6f9e](https://github.com/twinfoundation/document-management/commit/b6b6f9e9d66c17af3d030247ca168ac0b5844bdc))
|
|
17
|
+
* data type registration use fully qualified names ([18d27d0](https://github.com/twinfoundation/document-management/commit/18d27d0c21d0f652b7df4b409bb2d3c66cf22f84))
|
|
18
|
+
* document get can perform extraction ([#6](https://github.com/twinfoundation/document-management/issues/6)) ([5ce6d37](https://github.com/twinfoundation/document-management/commit/5ce6d37432ad271ca5783f422846f4be98ec2215))
|
|
19
|
+
* eslint migration to flat config ([98635aa](https://github.com/twinfoundation/document-management/commit/98635aa24ebafba265e989e461fe98104f683191))
|
|
20
|
+
* get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
|
|
21
|
+
* improve comments ([4d2f094](https://github.com/twinfoundation/document-management/commit/4d2f094b23e3320cb739917246c1ee5f6ad41c11))
|
|
22
|
+
* store document as a vertex ([#2](https://github.com/twinfoundation/document-management/issues/2)) ([7febedc](https://github.com/twinfoundation/document-management/commit/7febedc3fb31de9c19565d6326341046834f2c74))
|
|
23
|
+
* update dependencies ([f9d8641](https://github.com/twinfoundation/document-management/commit/f9d86417dba24027699225ec7473296e361dcb00))
|
|
24
|
+
* update framework core ([f991a59](https://github.com/twinfoundation/document-management/commit/f991a59d25ec228bcdd7a5b6bd55578985b55a84))
|
|
25
|
+
* update ts-to-schema generation ([01a5335](https://github.com/twinfoundation/document-management/commit/01a5335372f6a4764a74d56c446d669724a308aa))
|
|
26
|
+
* use standard list json ld types ([20ea04b](https://github.com/twinfoundation/document-management/commit/20ea04b05fd4bc4fcedce8f66958942c3c2fa303))
|
|
27
|
+
* use targetId in AIG for edges ([82dec81](https://github.com/twinfoundation/document-management/commit/82dec8190d8b523b350ef133bdcf648cab1023b0))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* query params force coercion ([d667d0f](https://github.com/twinfoundation/document-management/commit/d667d0f195accca2887a5ca732e9790063763996))
|
|
33
|
+
|
|
3
34
|
## [0.0.2-next.4](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.2-next.3...document-management-models-v0.0.2-next.4) (2025-10-09)
|
|
4
35
|
|
|
5
36
|
|
|
@@ -140,16 +140,16 @@ The date/time of when the document was deleted, as we never actually remove item
|
|
|
140
140
|
|
|
141
141
|
***
|
|
142
142
|
|
|
143
|
-
###
|
|
143
|
+
### organizationIdentity?
|
|
144
144
|
|
|
145
|
-
> **
|
|
145
|
+
> `optional` **organizationIdentity**: `string`
|
|
146
146
|
|
|
147
|
-
The
|
|
147
|
+
The organization which added the document to the graph.
|
|
148
148
|
|
|
149
149
|
***
|
|
150
150
|
|
|
151
|
-
### userIdentity
|
|
151
|
+
### userIdentity?
|
|
152
152
|
|
|
153
|
-
> **userIdentity**: `string`
|
|
153
|
+
> `optional` **userIdentity**: `string`
|
|
154
154
|
|
|
155
155
|
The user who added the document to the graph.
|
|
@@ -6,19 +6,11 @@ Interface describing an document management contract.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
-
## Indexable
|
|
10
|
-
|
|
11
|
-
\[`key`: `string`\]: `any`
|
|
12
|
-
|
|
13
|
-
All methods are optional, so we introduce an index signature to allow
|
|
14
|
-
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
-
the class has no properties in common with the type.
|
|
16
|
-
|
|
17
9
|
## Methods
|
|
18
10
|
|
|
19
11
|
### create()
|
|
20
12
|
|
|
21
|
-
> **create**(`documentId`, `documentIdFormat`, `documentCode`, `blob`, `annotationObject?`, `auditableItemGraphEdges?`, `options
|
|
13
|
+
> **create**(`documentId`, `documentIdFormat`, `documentCode`, `blob`, `annotationObject?`, `auditableItemGraphEdges?`, `options?`): `Promise`\<`string`\>
|
|
22
14
|
|
|
23
15
|
Create a document as an auditable item graph vertex and add its content to blob storage.
|
|
24
16
|
If the document id already exists and the blob data is different a new revision will be created.
|
|
@@ -36,7 +28,7 @@ The document id to create.
|
|
|
36
28
|
|
|
37
29
|
The format of the document identifier.
|
|
38
30
|
|
|
39
|
-
`
|
|
31
|
+
`string` | `undefined`
|
|
40
32
|
|
|
41
33
|
##### documentCode
|
|
42
34
|
|
|
@@ -84,18 +76,6 @@ Flag to add the document id as an alias to the aig vertex, defaults to true.
|
|
|
84
76
|
|
|
85
77
|
Annotation object for the alias.
|
|
86
78
|
|
|
87
|
-
##### userIdentity?
|
|
88
|
-
|
|
89
|
-
`string`
|
|
90
|
-
|
|
91
|
-
The identity to perform the auditable item graph operation with.
|
|
92
|
-
|
|
93
|
-
##### nodeIdentity?
|
|
94
|
-
|
|
95
|
-
`string`
|
|
96
|
-
|
|
97
|
-
The node identity to use for vault operations.
|
|
98
|
-
|
|
99
79
|
#### Returns
|
|
100
80
|
|
|
101
81
|
`Promise`\<`string`\>
|
|
@@ -106,7 +86,7 @@ The auditable item graph vertex created for the document including its revision.
|
|
|
106
86
|
|
|
107
87
|
### update()
|
|
108
88
|
|
|
109
|
-
> **update**(`auditableItemGraphDocumentId`, `blob?`, `annotationObject?`, `auditableItemGraphEdges
|
|
89
|
+
> **update**(`auditableItemGraphDocumentId`, `blob?`, `annotationObject?`, `auditableItemGraphEdges?`): `Promise`\<`void`\>
|
|
110
90
|
|
|
111
91
|
Update a document as an auditable item graph vertex and add its content to blob storage.
|
|
112
92
|
If the blob data is different a new revision will be created.
|
|
@@ -138,18 +118,6 @@ Additional information to associate with the document.
|
|
|
138
118
|
|
|
139
119
|
The auditable item graph vertices to connect the document to, if undefined retains current connections.
|
|
140
120
|
|
|
141
|
-
##### userIdentity?
|
|
142
|
-
|
|
143
|
-
`string`
|
|
144
|
-
|
|
145
|
-
The identity to perform the auditable item graph operation with.
|
|
146
|
-
|
|
147
|
-
##### nodeIdentity?
|
|
148
|
-
|
|
149
|
-
`string`
|
|
150
|
-
|
|
151
|
-
The node identity to use for vault operations.
|
|
152
|
-
|
|
153
121
|
#### Returns
|
|
154
122
|
|
|
155
123
|
`Promise`\<`void`\>
|
|
@@ -160,7 +128,7 @@ Nothing.
|
|
|
160
128
|
|
|
161
129
|
### get()
|
|
162
130
|
|
|
163
|
-
> **get**(`auditableItemGraphDocumentId`, `options?`, `cursor?`, `limit
|
|
131
|
+
> **get**(`auditableItemGraphDocumentId`, `options?`, `cursor?`, `limit?`): `Promise`\<[`IDocumentList`](IDocumentList.md)\>
|
|
164
132
|
|
|
165
133
|
Get a document using it's auditable item graph vertex id and optional revision.
|
|
166
134
|
|
|
@@ -224,18 +192,6 @@ The cursor to get the next chunk of revisions.
|
|
|
224
192
|
|
|
225
193
|
Limit the number of items to return, defaults to 1 so only most recent is returned.
|
|
226
194
|
|
|
227
|
-
##### userIdentity?
|
|
228
|
-
|
|
229
|
-
`string`
|
|
230
|
-
|
|
231
|
-
The identity to perform the auditable item graph operation with.
|
|
232
|
-
|
|
233
|
-
##### nodeIdentity?
|
|
234
|
-
|
|
235
|
-
`string`
|
|
236
|
-
|
|
237
|
-
The node identity to use for vault operations.
|
|
238
|
-
|
|
239
195
|
#### Returns
|
|
240
196
|
|
|
241
197
|
`Promise`\<[`IDocumentList`](IDocumentList.md)\>
|
|
@@ -246,7 +202,7 @@ The documents and revisions if requested, ordered by revision descending, cursor
|
|
|
246
202
|
|
|
247
203
|
### getRevision()
|
|
248
204
|
|
|
249
|
-
> **getRevision**(`auditableItemGraphDocumentId`, `revision`, `options
|
|
205
|
+
> **getRevision**(`auditableItemGraphDocumentId`, `revision`, `options?`): `Promise`\<[`IDocument`](IDocument.md)\>
|
|
250
206
|
|
|
251
207
|
Get a document revision using it's auditable item graph vertex id.
|
|
252
208
|
|
|
@@ -298,18 +254,6 @@ If provided will extract data from the document using the specified rule group i
|
|
|
298
254
|
|
|
299
255
|
By default extraction will auto detect the mime type of the document, this can be used to override the detection.
|
|
300
256
|
|
|
301
|
-
##### userIdentity?
|
|
302
|
-
|
|
303
|
-
`string`
|
|
304
|
-
|
|
305
|
-
The identity to perform the auditable item graph operation with.
|
|
306
|
-
|
|
307
|
-
##### nodeIdentity?
|
|
308
|
-
|
|
309
|
-
`string`
|
|
310
|
-
|
|
311
|
-
The node identity to use for vault operations.
|
|
312
|
-
|
|
313
257
|
#### Returns
|
|
314
258
|
|
|
315
259
|
`Promise`\<[`IDocument`](IDocument.md)\>
|
|
@@ -320,7 +264,7 @@ The documents and revisions if requested, ordered by revision descending, cursor
|
|
|
320
264
|
|
|
321
265
|
### removeRevision()
|
|
322
266
|
|
|
323
|
-
> **removeRevision**(`auditableItemGraphDocumentId`, `revision
|
|
267
|
+
> **removeRevision**(`auditableItemGraphDocumentId`, `revision`): `Promise`\<`void`\>
|
|
324
268
|
|
|
325
269
|
Remove an auditable item graph vertex using it's id.
|
|
326
270
|
The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
|
|
@@ -339,18 +283,6 @@ The auditable item graph vertex id which contains the document.
|
|
|
339
283
|
|
|
340
284
|
The revision of the document to remove.
|
|
341
285
|
|
|
342
|
-
##### userIdentity?
|
|
343
|
-
|
|
344
|
-
`string`
|
|
345
|
-
|
|
346
|
-
The identity to perform the auditable item graph operation with.
|
|
347
|
-
|
|
348
|
-
##### nodeIdentity?
|
|
349
|
-
|
|
350
|
-
`string`
|
|
351
|
-
|
|
352
|
-
The node identity to use for vault operations.
|
|
353
|
-
|
|
354
286
|
#### Returns
|
|
355
287
|
|
|
356
288
|
`Promise`\<`void`\>
|
|
@@ -361,7 +293,7 @@ Nothing.
|
|
|
361
293
|
|
|
362
294
|
### query()
|
|
363
295
|
|
|
364
|
-
> **query**(`documentId`, `cursor?`, `limit
|
|
296
|
+
> **query**(`documentId`, `cursor?`, `limit?`): `Promise`\<`IAuditableItemGraphVertexList`\>
|
|
365
297
|
|
|
366
298
|
Find all the document with a specific id.
|
|
367
299
|
|
|
@@ -385,18 +317,6 @@ The cursor to get the next chunk of documents.
|
|
|
385
317
|
|
|
386
318
|
The limit to get the next chunk of documents.
|
|
387
319
|
|
|
388
|
-
##### userIdentity?
|
|
389
|
-
|
|
390
|
-
`string`
|
|
391
|
-
|
|
392
|
-
The identity to perform the auditable item graph operation with.
|
|
393
|
-
|
|
394
|
-
##### nodeIdentity?
|
|
395
|
-
|
|
396
|
-
`string`
|
|
397
|
-
|
|
398
|
-
The node identity to use for vault operations.
|
|
399
|
-
|
|
400
320
|
#### Returns
|
|
401
321
|
|
|
402
322
|
`Promise`\<`IAuditableItemGraphVertexList`\>
|
|
@@ -38,7 +38,7 @@ The query parameters.
|
|
|
38
38
|
|
|
39
39
|
#### includeBlobStorageMetadata?
|
|
40
40
|
|
|
41
|
-
> `optional` **includeBlobStorageMetadata**: `string`
|
|
41
|
+
> `optional` **includeBlobStorageMetadata**: `string`
|
|
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**: `string`
|
|
53
|
+
> `optional` **includeBlobStorageData**: `string`
|
|
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**: `string`
|
|
65
|
+
> `optional` **includeAttestation**: `string`
|
|
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**: `string`
|
|
77
|
+
> `optional` **includeRemoved**: `string`
|
|
78
78
|
|
|
79
79
|
Include deleted documents in the response.
|
|
80
80
|
|
|
@@ -44,7 +44,7 @@ The query parameters.
|
|
|
44
44
|
|
|
45
45
|
#### includeBlobStorageMetadata?
|
|
46
46
|
|
|
47
|
-
> `optional` **includeBlobStorageMetadata**: `string`
|
|
47
|
+
> `optional` **includeBlobStorageMetadata**: `string`
|
|
48
48
|
|
|
49
49
|
Include the blob storage metadata in the response.
|
|
50
50
|
|
|
@@ -56,7 +56,7 @@ false
|
|
|
56
56
|
|
|
57
57
|
#### includeBlobStorageData?
|
|
58
58
|
|
|
59
|
-
> `optional` **includeBlobStorageData**: `string`
|
|
59
|
+
> `optional` **includeBlobStorageData**: `string`
|
|
60
60
|
|
|
61
61
|
Include the blob storage data in the response.
|
|
62
62
|
|
|
@@ -68,7 +68,7 @@ false
|
|
|
68
68
|
|
|
69
69
|
#### includeAttestation?
|
|
70
70
|
|
|
71
|
-
> `optional` **includeAttestation**: `string`
|
|
71
|
+
> `optional` **includeAttestation**: `string`
|
|
72
72
|
|
|
73
73
|
Include the attestation information in the response.
|
|
74
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/document-management-models",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.2",
|
|
4
4
|
"description": "Models which define the structure of the document management connectors and services",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,20 +24,18 @@
|
|
|
24
24
|
"@twin.org/standards-schema-org": "next",
|
|
25
25
|
"@twin.org/standards-unece": "next"
|
|
26
26
|
},
|
|
27
|
-
"main": "./dist/
|
|
28
|
-
"module": "./dist/esm/index.mjs",
|
|
27
|
+
"main": "./dist/es/index.js",
|
|
29
28
|
"types": "./dist/types/index.d.ts",
|
|
30
29
|
"exports": {
|
|
31
30
|
".": {
|
|
32
31
|
"types": "./dist/types/index.d.ts",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
32
|
+
"import": "./dist/es/index.js",
|
|
33
|
+
"default": "./dist/es/index.js"
|
|
35
34
|
},
|
|
36
35
|
"./locales/*.json": "./locales/*.json"
|
|
37
36
|
},
|
|
38
37
|
"files": [
|
|
39
|
-
"dist/
|
|
40
|
-
"dist/esm",
|
|
38
|
+
"dist/es",
|
|
41
39
|
"dist/types",
|
|
42
40
|
"locales",
|
|
43
41
|
"docs"
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var dataCore = require('@twin.org/data-core');
|
|
4
|
-
|
|
5
|
-
// Copyright 2024 IOTA Stiftung.
|
|
6
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
7
|
-
/**
|
|
8
|
-
* The contexts of document management objects.
|
|
9
|
-
*/
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
-
const DocumentContexts = {
|
|
12
|
-
/**
|
|
13
|
-
* The context root for the document types.
|
|
14
|
-
*/
|
|
15
|
-
ContextRoot: "https://schema.twindev.org/documents/",
|
|
16
|
-
/**
|
|
17
|
-
* The context root for the common types.
|
|
18
|
-
*/
|
|
19
|
-
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// Copyright 2024 IOTA Stiftung.
|
|
23
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
24
|
-
/**
|
|
25
|
-
* The types of document management objects.
|
|
26
|
-
*/
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
|
-
const DocumentTypes = {
|
|
29
|
-
/**
|
|
30
|
-
* Represents a document.
|
|
31
|
-
*/
|
|
32
|
-
Document: "Document",
|
|
33
|
-
/**
|
|
34
|
-
* Represents a document attestation.
|
|
35
|
-
*/
|
|
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 {
|
|
169
|
-
/**
|
|
170
|
-
* Register all the data types.
|
|
171
|
-
*/
|
|
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
|
-
}
|
|
187
|
-
|
|
188
|
-
exports.DocumentContexts = DocumentContexts;
|
|
189
|
-
exports.DocumentManagementDataTypes = DocumentManagementDataTypes;
|
|
190
|
-
exports.DocumentTypes = DocumentTypes;
|