@twin.org/document-management-service 0.0.1-next.2 → 0.0.1-next.20

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.
@@ -8,9 +8,9 @@ Service for performing document management operations.
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new DocumentManagementService()
11
+ ### Constructor
12
12
 
13
- > **new DocumentManagementService**(`options`?): [`DocumentManagementService`](DocumentManagementService.md)
13
+ > **new DocumentManagementService**(`options?`): `DocumentManagementService`
14
14
 
15
15
  Create a new instance of DocumentManagementService.
16
16
 
@@ -24,7 +24,7 @@ The options for the service.
24
24
 
25
25
  #### Returns
26
26
 
27
- [`DocumentManagementService`](DocumentManagementService.md)
27
+ `DocumentManagementService`
28
28
 
29
29
  ## Properties
30
30
 
@@ -48,22 +48,16 @@ Runtime name for the class.
48
48
 
49
49
  ## Methods
50
50
 
51
- ### set()
51
+ ### create()
52
52
 
53
- > **set**(`auditableItemGraphId`, `documentId`, `documentIdFormat`, `documentCode`, `blob`, `annotationObject`?, `createAttestation`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
53
+ > **create**(`documentId`, `documentIdFormat`, `documentCode`, `blob`, `annotationObject?`, `auditableItemGraphEdges?`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`string`\>
54
54
 
55
- Store a document in an auditable item graph vertex and add its content to blob storage.
55
+ Store a document as an auditable item graph vertex and add its content to blob storage.
56
56
  If the document id already exists and the blob data is different a new revision will be created.
57
57
  For any other changes the current revision will be updated.
58
58
 
59
59
  #### Parameters
60
60
 
61
- ##### auditableItemGraphId
62
-
63
- `string`
64
-
65
- The auditable item graph vertex id to create the document on.
66
-
67
61
  ##### documentId
68
62
 
69
63
  `string`
@@ -86,7 +80,7 @@ The code for the document type.
86
80
 
87
81
  `Uint8Array`
88
82
 
89
- The data to create the document.
83
+ The data to create the document with.
90
84
 
91
85
  ##### annotationObject?
92
86
 
@@ -94,12 +88,34 @@ The data to create the document.
94
88
 
95
89
  Additional information to associate with the document.
96
90
 
97
- ##### createAttestation?
91
+ ##### auditableItemGraphEdges?
92
+
93
+ `object`[]
94
+
95
+ The auditable item graph vertices to connect the document to.
96
+
97
+ ##### options?
98
+
99
+ Additional options for the set operation.
100
+
101
+ ###### createAttestation?
98
102
 
99
103
  `boolean`
100
104
 
101
105
  Flag to create an attestation for the document, defaults to false.
102
106
 
107
+ ###### addAlias?
108
+
109
+ `boolean`
110
+
111
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
112
+
113
+ ###### aliasAnnotationObject?
114
+
115
+ `IJsonLdNodeObject`
116
+
117
+ Annotation object for the alias.
118
+
103
119
  ##### userIdentity?
104
120
 
105
121
  `string`
@@ -116,33 +132,85 @@ The node identity to use for vault operations.
116
132
 
117
133
  `Promise`\<`string`\>
118
134
 
119
- The identifier for the document which includes the auditable item graph identifier.
135
+ The auditable item graph vertex created for the document including its revision.
120
136
 
121
137
  #### Implementation of
122
138
 
123
- `IDocumentManagementComponent.set`
139
+ `IDocumentManagementComponent.create`
124
140
 
125
141
  ***
126
142
 
127
- ### get()
143
+ ### update()
128
144
 
129
- > **get**(`auditableItemGraphId`, `identifier`, `options`?, `revisionCursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`IDocument`\>
145
+ > **update**(`auditableItemGraphDocumentId`, `blob?`, `annotationObject?`, `auditableItemGraphEdges?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
130
146
 
131
- Get a specific document from an auditable item graph vertex.
147
+ Update a document as an auditable item graph vertex and add its content to blob storage.
148
+ If the blob data is different a new revision will be created.
149
+ For any other changes the current revision will be updated.
132
150
 
133
151
  #### Parameters
134
152
 
135
- ##### auditableItemGraphId
153
+ ##### auditableItemGraphDocumentId
136
154
 
137
155
  `string`
138
156
 
139
- The auditable item graph vertex id to get the document from.
157
+ The auditable item graph vertex id which contains the document.
158
+
159
+ ##### blob?
160
+
161
+ `Uint8Array`\<`ArrayBufferLike`\>
162
+
163
+ The data to update the document with.
164
+
165
+ ##### annotationObject?
166
+
167
+ `IJsonLdNodeObject`
168
+
169
+ Additional information to associate with the document.
170
+
171
+ ##### auditableItemGraphEdges?
140
172
 
141
- ##### identifier
173
+ `object`[]
174
+
175
+ The auditable item graph vertices to connect the document to, if undefined retains current connections.
176
+
177
+ ##### userIdentity?
142
178
 
143
179
  `string`
144
180
 
145
- The identifier of the document to get.
181
+ The identity to perform the auditable item graph operation with.
182
+
183
+ ##### nodeIdentity?
184
+
185
+ `string`
186
+
187
+ The node identity to use for vault operations.
188
+
189
+ #### Returns
190
+
191
+ `Promise`\<`void`\>
192
+
193
+ Nothing.
194
+
195
+ #### Implementation of
196
+
197
+ `IDocumentManagementComponent.update`
198
+
199
+ ***
200
+
201
+ ### get()
202
+
203
+ > **get**(`auditableItemGraphDocumentId`, `options?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IDocumentList`\>
204
+
205
+ Get a document using it's auditable item graph vertex id and optional revision.
206
+
207
+ #### Parameters
208
+
209
+ ##### auditableItemGraphDocumentId
210
+
211
+ `string`
212
+
213
+ The auditable item graph vertex id which contains the document.
146
214
 
147
215
  ##### options?
148
216
 
@@ -172,18 +240,30 @@ Flag to include the attestation information for the document, defaults to false.
172
240
 
173
241
  Flag to include deleted documents, defaults to false.
174
242
 
175
- ###### maxRevisionCount?
243
+ ###### extractRuleGroupId?
176
244
 
177
- `number`
245
+ `string`
178
246
 
179
- Max number of revisions to return, defaults to 0.
247
+ If provided will extract data from the document using the specified rule group id.
180
248
 
181
- ##### revisionCursor?
249
+ ###### extractMimeType?
250
+
251
+ `string`
252
+
253
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
254
+
255
+ ##### cursor?
182
256
 
183
257
  `string`
184
258
 
185
259
  The cursor to get the next chunk of revisions.
186
260
 
261
+ ##### pageSize?
262
+
263
+ `number`
264
+
265
+ Page size of items to return, defaults to 1 so only most recent is returned.
266
+
187
267
  ##### userIdentity?
188
268
 
189
269
  `string`
@@ -198,7 +278,7 @@ The node identity to use for vault operations.
198
278
 
199
279
  #### Returns
200
280
 
201
- `Promise`\<`IDocument`\>
281
+ `Promise`\<`IDocumentList`\>
202
282
 
203
283
  The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
204
284
 
@@ -208,36 +288,59 @@ The documents and revisions if requested, ordered by revision descending, cursor
208
288
 
209
289
  ***
210
290
 
211
- ### remove()
291
+ ### getRevision()
212
292
 
213
- > **remove**(`auditableItemGraphId`, `identifier`, `options`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
293
+ > **getRevision**(`auditableItemGraphDocumentId`, `revision`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IDocument`\>
214
294
 
215
- Remove a specific document from an auditable item graph vertex.
216
- The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
295
+ Get a document revision using it's auditable item graph vertex id.
217
296
 
218
297
  #### Parameters
219
298
 
220
- ##### auditableItemGraphId
299
+ ##### auditableItemGraphDocumentId
221
300
 
222
301
  `string`
223
302
 
224
- The auditable item graph vertex id to remove the document from.
303
+ The auditable item graph vertex id which contains the document.
225
304
 
226
- ##### identifier
305
+ ##### revision
227
306
 
228
- `string`
307
+ `number`
229
308
 
230
- The identifier of the document to remove.
309
+ The revision id for the document.
231
310
 
232
311
  ##### options?
233
312
 
234
- Additional options for the remove operation.
313
+ Additional options for the get operation.
314
+
315
+ ###### includeBlobStorageMetadata?
316
+
317
+ `boolean`
235
318
 
236
- ###### removeAllRevisions?
319
+ Flag to include the blob storage metadata for the document, defaults to false.
320
+
321
+ ###### includeBlobStorageData?
237
322
 
238
323
  `boolean`
239
324
 
240
- Flag to remove all revisions of the document, defaults to false.
325
+ Flag to include the blob storage data for the document, defaults to false.
326
+
327
+ ###### includeAttestation?
328
+
329
+ `boolean`
330
+
331
+ Flag to include the attestation information for the document, defaults to false.
332
+
333
+ ###### extractRuleGroupId?
334
+
335
+ `string`
336
+
337
+ If provided will extract data from the document using the specified rule group id.
338
+
339
+ ###### extractMimeType?
340
+
341
+ `string`
342
+
343
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
241
344
 
242
345
  ##### userIdentity?
243
346
 
@@ -253,51 +356,74 @@ The node identity to use for vault operations.
253
356
 
254
357
  #### Returns
255
358
 
256
- `Promise`\<`void`\>
359
+ `Promise`\<`IDocument`\>
257
360
 
258
- Nothing.
361
+ The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
259
362
 
260
363
  #### Implementation of
261
364
 
262
- `IDocumentManagementComponent.remove`
365
+ `IDocumentManagementComponent.getRevision`
263
366
 
264
367
  ***
265
368
 
266
- ### query()
369
+ ### removeRevision()
267
370
 
268
- > **query**(`auditableItemGraphId`, `documentCodes`?, `options`?, `cursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`IDocumentList`\>
371
+ > **removeRevision**(`auditableItemGraphDocumentId`, `revision`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
269
372
 
270
- Query an auditable item graph vertex for documents.
373
+ Remove an auditable item graph vertex using it's id.
374
+ The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
271
375
 
272
376
  #### Parameters
273
377
 
274
- ##### auditableItemGraphId
378
+ ##### auditableItemGraphDocumentId
275
379
 
276
380
  `string`
277
381
 
278
- The auditable item graph vertex to get the documents from.
382
+ The auditable item graph vertex id which contains the document.
279
383
 
280
- ##### documentCodes?
384
+ ##### revision
281
385
 
282
- `string`[]
386
+ `number`
283
387
 
284
- The document codes to query for, if undefined gets all document codes.
388
+ The revision of the document to remove.
285
389
 
286
- ##### options?
390
+ ##### userIdentity?
287
391
 
288
- Additional options for the query operation.
392
+ `string`
289
393
 
290
- ###### includeMostRecentRevisions?
394
+ The identity to perform the auditable item graph operation with.
291
395
 
292
- `boolean`
396
+ ##### nodeIdentity?
293
397
 
294
- Include the most recent 5 revisions, use the individual get to retrieve more.
398
+ `string`
295
399
 
296
- ###### includeRemoved?
400
+ The node identity to use for vault operations.
297
401
 
298
- `boolean`
402
+ #### Returns
299
403
 
300
- Flag to include deleted documents, defaults to false.
404
+ `Promise`\<`void`\>
405
+
406
+ Nothing.
407
+
408
+ #### Implementation of
409
+
410
+ `IDocumentManagementComponent.removeRevision`
411
+
412
+ ***
413
+
414
+ ### query()
415
+
416
+ > **query**(`documentId`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IAuditableItemGraphVertexList`\>
417
+
418
+ Find all the document with a specific id.
419
+
420
+ #### Parameters
421
+
422
+ ##### documentId
423
+
424
+ `string`
425
+
426
+ The document id to find in the graph.
301
427
 
302
428
  ##### cursor?
303
429
 
@@ -305,6 +431,12 @@ Flag to include deleted documents, defaults to false.
305
431
 
306
432
  The cursor to get the next chunk of documents.
307
433
 
434
+ ##### pageSize?
435
+
436
+ `number`
437
+
438
+ The page size to get the next chunk of documents.
439
+
308
440
  ##### userIdentity?
309
441
 
310
442
  `string`
@@ -319,9 +451,9 @@ The node identity to use for vault operations.
319
451
 
320
452
  #### Returns
321
453
 
322
- `Promise`\<`IDocumentList`\>
454
+ `Promise`\<`IAuditableItemGraphVertexList`\>
323
455
 
324
- The most recent revisions of each document, cursor is set if there are more documents.
456
+ The graph vertices that contain documents referencing the specified document id.
325
457
 
326
458
  #### Implementation of
327
459
 
@@ -1,8 +1,8 @@
1
- # Function: documentManagementSet()
1
+ # Function: documentManagementCreate()
2
2
 
3
- > **documentManagementSet**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
3
+ > **documentManagementCreate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
4
4
 
5
- Set a document in to an auditable item graph vertex.
5
+ Create a document as an auditable item graph vertex.
6
6
 
7
7
  ## Parameters
8
8
 
@@ -20,7 +20,7 @@ The name of the component to use in the routes.
20
20
 
21
21
  ### request
22
22
 
23
- `IDocumentManagementSetRequest`
23
+ `IDocumentManagementCreateRequest`
24
24
 
25
25
  The request.
26
26
 
@@ -0,0 +1,31 @@
1
+ # Function: documentManagementGetRevision()
2
+
3
+ > **documentManagementGetRevision**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IDocumentManagementGetRevisionResponse`\>
4
+
5
+ Get the document revision from the auditable item graph vertex.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IDocumentManagementGetRevisionRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IDocumentManagementGetRevisionResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: documentManagementUpdate()
2
+
3
+ > **documentManagementUpdate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Update the document from the auditable item graph vertex.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IDocumentManagementUpdateRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -17,7 +17,9 @@
17
17
  ## Functions
18
18
 
19
19
  - [generateRestRoutesDocumentManagement](functions/generateRestRoutesDocumentManagement.md)
20
- - [documentManagementSet](functions/documentManagementSet.md)
20
+ - [documentManagementCreate](functions/documentManagementCreate.md)
21
21
  - [documentManagementGet](functions/documentManagementGet.md)
22
+ - [documentManagementGetRevision](functions/documentManagementGetRevision.md)
23
+ - [documentManagementUpdate](functions/documentManagementUpdate.md)
22
24
  - [documentManagementRemove](functions/documentManagementRemove.md)
23
25
  - [documentManagementQuery](functions/documentManagementQuery.md)
@@ -46,6 +46,20 @@ attestation
46
46
 
47
47
  ***
48
48
 
49
+ ### dataProcessingComponentType?
50
+
51
+ > `optional` **dataProcessingComponentType**: `string`
52
+
53
+ The type of the data processing component.
54
+
55
+ #### Default
56
+
57
+ ```ts
58
+ data-processing
59
+ ```
60
+
61
+ ***
62
+
49
63
  ### config?
50
64
 
51
65
  > `optional` **config**: [`IDocumentManagementServiceConfig`](IDocumentManagementServiceConfig.md)
package/locales/en.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "error": {
3
3
  "documentManagementService": {
4
- "setFailed": "Failed to set document",
4
+ "createFailed": "Failed to create document",
5
+ "updateFailed": "Failed to update document",
5
6
  "getFailed": "Failed to get document",
6
- "removeFailed": "Failed to remove document",
7
+ "getRevisionFailed": "Failed to get document revision",
8
+ "removeRevision": "Failed to remove document revision",
7
9
  "queryFailed": "Failed to query document",
8
- "invalidDocumentId": "The document id not in the correct format, it is \"{identifier}\"",
9
- "invalidDocumentCode": "The document code does not follow the format unece:DocumentCodeList#1, it is \"{documentCode}\"",
10
- "documentRevisionNotFound": "The document revision was not found \"{identifier}\"",
10
+ "documentRevisionNone": "There are no revisions in the document",
11
+ "documentRevisionNotFound": "There is no revision number \"{notFoundId}\" in the document",
11
12
  "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the Document Management component \"{namespace}\""
12
13
  }
13
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/document-management-service",
3
- "version": "0.0.1-next.2",
3
+ "version": "0.0.1-next.20",
4
4
  "description": "Document management contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,8 @@
21
21
  "@twin.org/core": "next",
22
22
  "@twin.org/crypto": "next",
23
23
  "@twin.org/data-json-ld": "next",
24
- "@twin.org/document-management-models": "0.0.1-next.2",
24
+ "@twin.org/data-processing-models": "next",
25
+ "@twin.org/document-management-models": "0.0.1-next.20",
25
26
  "@twin.org/entity": "next",
26
27
  "@twin.org/entity-storage-models": "next",
27
28
  "@twin.org/nameof": "next",