@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
@@ -8,22 +8,16 @@ Interface describing an document management contract.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### set()
11
+ ### create()
12
12
 
13
- > **set**(`auditableItemGraphId`, `documentId`, `documentIdFormat`, `documentCode`, `blob`, `annotationObject`?, `options`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
13
+ > **create**(`documentId`, `documentIdFormat`, `documentCode`, `blob`, `annotationObject?`, `auditableItemGraphEdges?`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`string`\>
14
14
 
15
- Store a document in an auditable item graph vertex and add its content to blob storage.
15
+ Create a document as an auditable item graph vertex and add its content to blob storage.
16
16
  If the document id already exists and the blob data is different a new revision will be created.
17
17
  For any other changes the current revision will be updated.
18
18
 
19
19
  #### Parameters
20
20
 
21
- ##### auditableItemGraphId
22
-
23
- `string`
24
-
25
- The auditable item graph vertex id to create the document on.
26
-
27
21
  ##### documentId
28
22
 
29
23
  `string`
@@ -54,6 +48,12 @@ The data to create the document with.
54
48
 
55
49
  Additional information to associate with the document.
56
50
 
51
+ ##### auditableItemGraphEdges?
52
+
53
+ `object`[]
54
+
55
+ The auditable item graph vertices to connect the document to.
56
+
57
57
  ##### options?
58
58
 
59
59
  Additional options for the set operation.
@@ -64,17 +64,17 @@ Additional options for the set operation.
64
64
 
65
65
  Flag to create an attestation for the document, defaults to false.
66
66
 
67
- ###### includeIdAsAlias?
67
+ ###### addAlias?
68
68
 
69
69
  `boolean`
70
70
 
71
- Include the document id as an alias to the aig vertex, defaults to false.
71
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
72
72
 
73
73
  ###### aliasAnnotationObject?
74
74
 
75
75
  `IJsonLdNodeObject`
76
76
 
77
- Additional information to associate with the alias.
77
+ Annotation object for the alias.
78
78
 
79
79
  ##### userIdentity?
80
80
 
@@ -92,29 +92,77 @@ The node identity to use for vault operations.
92
92
 
93
93
  `Promise`\<`string`\>
94
94
 
95
- The identifier for the document which includes the auditable item graph identifier.
95
+ The auditable item graph vertex created for the document including its revision.
96
96
 
97
97
  ***
98
98
 
99
- ### get()
99
+ ### update()
100
100
 
101
- > **get**(`auditableItemGraphId`, `identifier`, `options`?, `revisionCursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IDocument`](IDocument.md)\>
101
+ > **update**(`auditableItemGraphDocumentId`, `blob?`, `annotationObject?`, `auditableItemGraphEdges?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
102
102
 
103
- Get a specific document from an auditable item graph vertex.
103
+ Update a document as an auditable item graph vertex and add its content to blob storage.
104
+ If the blob data is different a new revision will be created.
105
+ For any other changes the current revision will be updated.
104
106
 
105
107
  #### Parameters
106
108
 
107
- ##### auditableItemGraphId
109
+ ##### auditableItemGraphDocumentId
110
+
111
+ `string`
112
+
113
+ The auditable item graph vertex id which contains the document.
114
+
115
+ ##### blob?
116
+
117
+ `Uint8Array`\<`ArrayBufferLike`\>
118
+
119
+ The data to update the document with.
120
+
121
+ ##### annotationObject?
122
+
123
+ `IJsonLdNodeObject`
124
+
125
+ Additional information to associate with the document.
126
+
127
+ ##### auditableItemGraphEdges?
128
+
129
+ `object`[]
130
+
131
+ The auditable item graph vertices to connect the document to, if undefined retains current connections.
132
+
133
+ ##### userIdentity?
134
+
135
+ `string`
136
+
137
+ The identity to perform the auditable item graph operation with.
138
+
139
+ ##### nodeIdentity?
108
140
 
109
141
  `string`
110
142
 
111
- The auditable item graph vertex id to get the document from.
143
+ The node identity to use for vault operations.
144
+
145
+ #### Returns
146
+
147
+ `Promise`\<`void`\>
148
+
149
+ Nothing.
150
+
151
+ ***
152
+
153
+ ### get()
154
+
155
+ > **get**(`auditableItemGraphDocumentId`, `options?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<[`IDocumentList`](IDocumentList.md)\>
156
+
157
+ Get a document using it's auditable item graph vertex id and optional revision.
158
+
159
+ #### Parameters
112
160
 
113
- ##### identifier
161
+ ##### auditableItemGraphDocumentId
114
162
 
115
163
  `string`
116
164
 
117
- The identifier of the document to get.
165
+ The auditable item graph vertex id which contains the document.
118
166
 
119
167
  ##### options?
120
168
 
@@ -144,18 +192,30 @@ Flag to include the attestation information for the document, defaults to false.
144
192
 
145
193
  Flag to include deleted documents, defaults to false.
146
194
 
147
- ###### maxRevisionCount?
195
+ ###### extractRuleGroupId?
148
196
 
149
- `number`
197
+ `string`
198
+
199
+ If provided will extract data from the document using the specified rule group id.
200
+
201
+ ###### extractMimeType?
150
202
 
151
- Max number of revisions to return, defaults to 0.
203
+ `string`
204
+
205
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
152
206
 
153
- ##### revisionCursor?
207
+ ##### cursor?
154
208
 
155
209
  `string`
156
210
 
157
211
  The cursor to get the next chunk of revisions.
158
212
 
213
+ ##### pageSize?
214
+
215
+ `number`
216
+
217
+ Page size of items to return, defaults to 1 so only most recent is returned.
218
+
159
219
  ##### userIdentity?
160
220
 
161
221
  `string`
@@ -170,42 +230,65 @@ The node identity to use for vault operations.
170
230
 
171
231
  #### Returns
172
232
 
173
- `Promise`\<[`IDocument`](IDocument.md)\>
233
+ `Promise`\<[`IDocumentList`](IDocumentList.md)\>
174
234
 
175
235
  The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
176
236
 
177
237
  ***
178
238
 
179
- ### remove()
239
+ ### getRevision()
180
240
 
181
- > **remove**(`auditableItemGraphId`, `identifier`, `options`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
241
+ > **getRevision**(`auditableItemGraphDocumentId`, `revision`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<[`IDocument`](IDocument.md)\>
182
242
 
183
- Remove a specific document from an auditable item graph vertex.
184
- The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
243
+ Get a document revision using it's auditable item graph vertex id.
185
244
 
186
245
  #### Parameters
187
246
 
188
- ##### auditableItemGraphId
247
+ ##### auditableItemGraphDocumentId
189
248
 
190
249
  `string`
191
250
 
192
- The auditable item graph vertex id to remove the document from.
251
+ The auditable item graph vertex id which contains the document.
193
252
 
194
- ##### identifier
253
+ ##### revision
195
254
 
196
- `string`
255
+ `number`
197
256
 
198
- The identifier of the document to remove.
257
+ The revision id of the document to get.
199
258
 
200
259
  ##### options?
201
260
 
202
- Additional options for the remove operation.
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.
203
274
 
204
- ###### removeAllRevisions?
275
+ ###### includeAttestation?
205
276
 
206
277
  `boolean`
207
278
 
208
- Flag to remove all revisions of the document, defaults to false.
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.
209
292
 
210
293
  ##### userIdentity?
211
294
 
@@ -221,47 +304,66 @@ The node identity to use for vault operations.
221
304
 
222
305
  #### Returns
223
306
 
224
- `Promise`\<`void`\>
307
+ `Promise`\<[`IDocument`](IDocument.md)\>
225
308
 
226
- Nothing.
309
+ The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
227
310
 
228
311
  ***
229
312
 
230
- ### query()
313
+ ### removeRevision()
231
314
 
232
- > **query**(`auditableItemGraphId`, `documentCodes`?, `options`?, `cursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IDocumentList`](IDocumentList.md)\>
315
+ > **removeRevision**(`auditableItemGraphDocumentId`, `revision`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
233
316
 
234
- Query an auditable item graph vertex for documents.
317
+ Remove an auditable item graph vertex using it's id.
318
+ The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
235
319
 
236
320
  #### Parameters
237
321
 
238
- ##### auditableItemGraphId
322
+ ##### auditableItemGraphDocumentId
239
323
 
240
324
  `string`
241
325
 
242
- The auditable item graph vertex to get the documents from.
326
+ The auditable item graph vertex id which contains the document.
243
327
 
244
- ##### documentCodes?
328
+ ##### revision
245
329
 
246
- `string`[]
330
+ `number`
247
331
 
248
- The document codes to query for, if undefined gets all document codes.
332
+ The revision of the document to remove.
249
333
 
250
- ##### options?
334
+ ##### userIdentity?
251
335
 
252
- Additional options for the query operation.
336
+ `string`
253
337
 
254
- ###### includeMostRecentRevisions?
338
+ The identity to perform the auditable item graph operation with.
255
339
 
256
- `boolean`
340
+ ##### nodeIdentity?
257
341
 
258
- Include the most recent 5 revisions, use the individual get to retrieve more.
342
+ `string`
259
343
 
260
- ###### includeRemoved?
344
+ The node identity to use for vault operations.
261
345
 
262
- `boolean`
346
+ #### Returns
263
347
 
264
- Flag to include deleted documents, defaults to false.
348
+ `Promise`\<`void`\>
349
+
350
+ Nothing.
351
+
352
+ ***
353
+
354
+ ### query()
355
+
356
+ > **query**(`documentId`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IAuditableItemGraphVertexList`\>
357
+
358
+ Find all the document with a specific id.
359
+
360
+ #### Parameters
361
+
362
+ ##### documentId
363
+
364
+ `string`
365
+
366
+ The document id to find in the graph.
265
367
 
266
368
  ##### cursor?
267
369
 
@@ -269,6 +371,12 @@ Flag to include deleted documents, defaults to false.
269
371
 
270
372
  The cursor to get the next chunk of documents.
271
373
 
374
+ ##### pageSize?
375
+
376
+ `number`
377
+
378
+ The page size to get the next chunk of documents.
379
+
272
380
  ##### userIdentity?
273
381
 
274
382
  `string`
@@ -283,6 +391,6 @@ The node identity to use for vault operations.
283
391
 
284
392
  #### Returns
285
393
 
286
- `Promise`\<[`IDocumentList`](IDocumentList.md)\>
394
+ `Promise`\<`IAuditableItemGraphVertexList`\>
287
395
 
288
- The most recent revisions of each document, cursor is set if there are more documents.
396
+ The graph vertices that contain documents referencing the specified document id.
@@ -1,23 +1,9 @@
1
- # Interface: IDocumentManagementSetRequest
1
+ # Interface: IDocumentManagementCreateRequest
2
2
 
3
- Request to set a document in an auditable item graph vertex.
3
+ Request to create a document as an auditable item graph vertex.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### pathParams
8
-
9
- > **pathParams**: `object`
10
-
11
- The path parameters.
12
-
13
- #### auditableItemGraphId
14
-
15
- > **auditableItemGraphId**: `string`
16
-
17
- The id of the auditable item graph vertex to store the document on.
18
-
19
- ***
20
-
21
7
  ### body
22
8
 
23
9
  > **body**: `object`
@@ -54,20 +40,26 @@ The data to create the document with, in base64.
54
40
 
55
41
  Additional information to associate with the document.
56
42
 
43
+ #### auditableItemGraphEdges?
44
+
45
+ > `optional` **auditableItemGraphEdges**: `object`[]
46
+
47
+ The auditable item graph vertices to connect the document to.
48
+
57
49
  #### createAttestation?
58
50
 
59
51
  > `optional` **createAttestation**: `boolean`
60
52
 
61
- Flag to create an attestation for the document, defaults to false
53
+ Flag to create an attestation for the document, defaults to false.
62
54
 
63
- #### includeIdAsAlias?
55
+ #### addAlias?
64
56
 
65
- > `optional` **includeIdAsAlias**: `boolean`
57
+ > `optional` **addAlias**: `boolean`
66
58
 
67
- Include the document id as an alias to the aig vertex, defaults to false.
59
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
68
60
 
69
61
  #### aliasAnnotationObject?
70
62
 
71
63
  > `optional` **aliasAnnotationObject**: `IJsonLdNodeObject`
72
64
 
73
- Additional information to associate with the alias.
65
+ Annotation object for the alias.
@@ -22,15 +22,9 @@ The headers which can be used to determine the response data type.
22
22
 
23
23
  The path parameters.
24
24
 
25
- #### auditableItemGraphId
25
+ #### auditableItemGraphDocumentId
26
26
 
27
- > **auditableItemGraphId**: `string`
28
-
29
- The id of the auditable item graph vertex to store the document on.
30
-
31
- #### documentId
32
-
33
- > **documentId**: `string`
27
+ > **auditableItemGraphDocumentId**: `string`
34
28
 
35
29
  The full id of the document to get.
36
30
 
@@ -44,7 +38,7 @@ The query parameters.
44
38
 
45
39
  #### includeBlobStorageMetadata?
46
40
 
47
- > `optional` **includeBlobStorageMetadata**: `boolean`
41
+ > `optional` **includeBlobStorageMetadata**: `string` \| `boolean`
48
42
 
49
43
  Include the blob storage metadata in the response.
50
44
 
@@ -56,7 +50,7 @@ false
56
50
 
57
51
  #### includeBlobStorageData?
58
52
 
59
- > `optional` **includeBlobStorageData**: `boolean`
53
+ > `optional` **includeBlobStorageData**: `string` \| `boolean`
60
54
 
61
55
  Include the blob storage data in the response.
62
56
 
@@ -68,7 +62,7 @@ false
68
62
 
69
63
  #### includeAttestation?
70
64
 
71
- > `optional` **includeAttestation**: `boolean`
65
+ > `optional` **includeAttestation**: `string` \| `boolean`
72
66
 
73
67
  Include the attestation information in the response.
74
68
 
@@ -80,7 +74,7 @@ false
80
74
 
81
75
  #### includeRemoved?
82
76
 
83
- > `optional` **includeRemoved**: `boolean`
77
+ > `optional` **includeRemoved**: `string` \| `boolean`
84
78
 
85
79
  Include deleted documents in the response.
86
80
 
@@ -90,20 +84,32 @@ Include deleted documents in the response.
90
84
  false
91
85
  ```
92
86
 
93
- #### maxRevisionCount?
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
+
99
+ #### pageSize?
94
100
 
95
- > `optional` **maxRevisionCount**: `number`
101
+ > `optional` **pageSize**: `string` \| `number`
96
102
 
97
- Max number of revisions to return.
103
+ Page size of items to return, defaults to 1 so only most recent is returned.
98
104
 
99
105
  ##### Default
100
106
 
101
107
  ```ts
102
- 0
108
+ 1
103
109
  ```
104
110
 
105
- #### revisionCursor?
111
+ #### cursor?
106
112
 
107
- > `optional` **revisionCursor**: `string`
113
+ > `optional` **cursor**: `string`
108
114
 
109
115
  The cursor to get the next chunk of revisions.
@@ -18,6 +18,6 @@ The headers which can be used to determine the response data type.
18
18
 
19
19
  ### body
20
20
 
21
- > **body**: [`IDocument`](IDocument.md)
21
+ > **body**: [`IDocumentList`](IDocumentList.md)
22
22
 
23
23
  The body parameters.
@@ -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.