@3sixty/document-management-service 0.0.0-stage → 0.20.0-next.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 (38) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -2
  3. package/dist/es/documentManagementRoutes.js +609 -0
  4. package/dist/es/documentManagementRoutes.js.map +1 -0
  5. package/dist/es/documentManagementService.js +967 -0
  6. package/dist/es/documentManagementService.js.map +1 -0
  7. package/dist/es/index.js +8 -0
  8. package/dist/es/index.js.map +1 -0
  9. package/dist/es/models/IDocumentManagementServiceConfig.js +4 -0
  10. package/dist/es/models/IDocumentManagementServiceConfig.js.map +1 -0
  11. package/dist/es/models/IDocumentManagementStorageServiceConstructorOptions.js +2 -0
  12. package/dist/es/models/IDocumentManagementStorageServiceConstructorOptions.js.map +1 -0
  13. package/dist/es/restEntryPoints.js +13 -0
  14. package/dist/es/restEntryPoints.js.map +1 -0
  15. package/dist/types/documentManagementRoutes.d.ts +62 -0
  16. package/dist/types/documentManagementService.d.ts +147 -0
  17. package/dist/types/index.d.ts +5 -0
  18. package/dist/types/models/IDocumentManagementServiceConfig.d.ts +9 -0
  19. package/dist/types/models/IDocumentManagementStorageServiceConstructorOptions.d.ts +34 -0
  20. package/dist/types/restEntryPoints.d.ts +5 -0
  21. package/docs/changelog.md +17 -0
  22. package/docs/examples.md +121 -0
  23. package/docs/open-api/spec.json +1387 -0
  24. package/docs/reference/classes/DocumentManagementService.md +464 -0
  25. package/docs/reference/functions/documentManagementCreate.md +37 -0
  26. package/docs/reference/functions/documentManagementGet.md +31 -0
  27. package/docs/reference/functions/documentManagementGetRevision.md +31 -0
  28. package/docs/reference/functions/documentManagementQuery.md +31 -0
  29. package/docs/reference/functions/documentManagementRemove.md +31 -0
  30. package/docs/reference/functions/documentManagementUpdatePartial.md +31 -0
  31. package/docs/reference/functions/generateRestRoutesDocumentManagement.md +25 -0
  32. package/docs/reference/index.md +25 -0
  33. package/docs/reference/interfaces/IDocumentManagementServiceConfig.md +11 -0
  34. package/docs/reference/interfaces/IDocumentManagementServiceConstructorOptions.md +75 -0
  35. package/docs/reference/variables/restEntryPoints.md +5 -0
  36. package/docs/reference/variables/tagsDocumentManagement.md +5 -0
  37. package/locales/en.json +22 -0
  38. package/package.json +68 -5
@@ -0,0 +1,464 @@
1
+ # Class: DocumentManagementService
2
+
3
+ Service for performing document management operations.
4
+
5
+ ## Implements
6
+
7
+ - `IDocumentManagementComponent`
8
+ - `IHealthProviderComponent`
9
+
10
+ ## Constructors
11
+
12
+ ### Constructor
13
+
14
+ > **new DocumentManagementService**(`options?`): `DocumentManagementService`
15
+
16
+ Create a new instance of DocumentManagementService.
17
+
18
+ #### Parameters
19
+
20
+ ##### options?
21
+
22
+ [`IDocumentManagementServiceConstructorOptions`](../interfaces/IDocumentManagementServiceConstructorOptions.md)
23
+
24
+ The options for the service.
25
+
26
+ #### Returns
27
+
28
+ `DocumentManagementService`
29
+
30
+ ## Properties
31
+
32
+ ### CLASS\_NAME {#class_name}
33
+
34
+ > `readonly` `static` **CLASS\_NAME**: `string`
35
+
36
+ Runtime name for the class.
37
+
38
+ ## Methods
39
+
40
+ ### className() {#classname}
41
+
42
+ > **className**(): `string`
43
+
44
+ Returns the class name of the component.
45
+
46
+ #### Returns
47
+
48
+ `string`
49
+
50
+ The class name of the component.
51
+
52
+ #### Implementation of
53
+
54
+ `IDocumentManagementComponent.className`
55
+
56
+ ***
57
+
58
+ ### healthApplication() {#healthapplication}
59
+
60
+ > **healthApplication**(`callback`): `Promise`\<`IHealth`[] \| `undefined`\>
61
+
62
+ Runs a blob lifecycle (create, get, remove) against the blob storage component to verify
63
+ the service is operational.
64
+
65
+ #### Parameters
66
+
67
+ ##### callback
68
+
69
+ `HealthApplicationCallback`
70
+
71
+ The callback to invoke when a deferred health result is ready.
72
+
73
+ #### Returns
74
+
75
+ `Promise`\<`IHealth`[] \| `undefined`\>
76
+
77
+ The health status of the service.
78
+
79
+ #### Implementation of
80
+
81
+ `IHealthProviderComponent.healthApplication`
82
+
83
+ ***
84
+
85
+ ### start() {#start}
86
+
87
+ > **start**(): `Promise`\<`void`\>
88
+
89
+ Register all document management metrics with the telemetry component.
90
+
91
+ #### Returns
92
+
93
+ `Promise`\<`void`\>
94
+
95
+ A promise that resolves when metrics have been registered.
96
+
97
+ #### Implementation of
98
+
99
+ `IDocumentManagementComponent.start`
100
+
101
+ ***
102
+
103
+ ### create() {#create}
104
+
105
+ > **create**(`document`, `blob`, `auditableItemGraphEdges?`, `options?`): `Promise`\<`string`\>
106
+
107
+ Store a document as an auditable item graph vertex and add its content to blob storage.
108
+ If the document id already exists and the blob data is different a new revision will be created.
109
+ For any other changes the current revision will be updated.
110
+
111
+ #### Parameters
112
+
113
+ ##### document
114
+
115
+ `IDocumentBase`
116
+
117
+ The document base properties.
118
+
119
+ ##### blob
120
+
121
+ `string` \| `Uint8Array`\<`ArrayBufferLike`\>
122
+
123
+ The data to create the document with as bytes, or an existing blob storage entry id.
124
+
125
+ ##### auditableItemGraphEdges?
126
+
127
+ `IDocumentManagementEdgeEntry`[]
128
+
129
+ The auditable item graph vertices to connect the document to.
130
+
131
+ ##### options?
132
+
133
+ Additional options for the set operation.
134
+
135
+ ###### includeAttestation?
136
+
137
+ `boolean`
138
+
139
+ Flag to include an attestation for the document, defaults to false.
140
+
141
+ ###### includeAlias?
142
+
143
+ `boolean`
144
+
145
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
146
+
147
+ ###### aliasAnnotationObject?
148
+
149
+ `IJsonLdNodeObject`
150
+
151
+ Annotation object for the alias.
152
+
153
+ #### Returns
154
+
155
+ `Promise`\<`string`\>
156
+
157
+ The auditable item graph vertex created for the document including its revision.
158
+
159
+ #### Implementation of
160
+
161
+ `IDocumentManagementComponent.create`
162
+
163
+ ***
164
+
165
+ ### updatePartial() {#updatepartial}
166
+
167
+ > **updatePartial**(`auditableItemGraphDocumentId`, `document?`, `blob?`, `auditableItemGraphEdges?`, `options?`): `Promise`\<`void`\>
168
+
169
+ Update a document as an auditable item graph vertex and add its content to blob storage.
170
+ If the blob data is different a new revision will be created.
171
+ For any other changes the current revision will be updated.
172
+
173
+ #### Parameters
174
+
175
+ ##### auditableItemGraphDocumentId
176
+
177
+ `string`
178
+
179
+ The auditable item graph vertex id which contains the document.
180
+
181
+ ##### document?
182
+
183
+ `Partial`\<`Pick`\<`IDocumentBase`, `"annotationObject"` \| `"documentIdFormat"` \| `"documentCode"`\>\>
184
+
185
+ The document base properties to update. Only annotationObject is applied; other fields are ignored.
186
+
187
+ ##### blob?
188
+
189
+ `string` \| `Uint8Array`\<`ArrayBufferLike`\>
190
+
191
+ The data to update the document with as bytes, or an existing blob storage entry id.
192
+
193
+ ##### auditableItemGraphEdges?
194
+
195
+ Explicit edge delta to apply. If undefined, existing connections
196
+ are retained unchanged. Use `add` to create new connections and `remove` to disconnect existing
197
+ ones by their target vertex id. To update alias metadata on an already-connected vertex, include
198
+ it in `add` with the updated `aliasAnnotationObject` - AIG's alias patch is an upsert, so the
199
+ alias is updated in place without creating a duplicate back-edge.
200
+
201
+ ###### add?
202
+
203
+ `IDocumentManagementEdgeEntry`[]
204
+
205
+ Connections to add; each creates a back-edge on the connected vertex.
206
+
207
+ ###### remove?
208
+
209
+ `string`[]
210
+
211
+ Target vertex IDs to disconnect; their back-edges are removed.
212
+
213
+ ##### options?
214
+
215
+ Additional options for the update operation.
216
+
217
+ ###### includeAttestation?
218
+
219
+ `boolean`
220
+
221
+ Set to true to include an attestation for the document, or false to remove the existing attestation. Omit (undefined) to leave attestation state unchanged.
222
+
223
+ ###### includeAlias?
224
+
225
+ `boolean`
226
+
227
+ Set to true to add the document id as an alias on the aig vertex, or false to remove it. Omit to leave alias state unchanged.
228
+
229
+ ###### aliasAnnotationObject?
230
+
231
+ `IJsonLdNodeObject`
232
+
233
+ Annotation object for the alias when adding.
234
+
235
+ #### Returns
236
+
237
+ `Promise`\<`void`\>
238
+
239
+ A promise that resolves when the document has been updated.
240
+
241
+ #### Implementation of
242
+
243
+ `IDocumentManagementComponent.updatePartial`
244
+
245
+ ***
246
+
247
+ ### get() {#get}
248
+
249
+ > **get**(`auditableItemGraphDocumentId`, `options?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IDocumentList`; `cursor?`: `string`; \}\>
250
+
251
+ Get a document using it's auditable item graph vertex id and optional revision.
252
+
253
+ #### Parameters
254
+
255
+ ##### auditableItemGraphDocumentId
256
+
257
+ `string`
258
+
259
+ The auditable item graph vertex id which contains the document.
260
+
261
+ ##### options?
262
+
263
+ Additional options for the get operation.
264
+
265
+ ###### includeBlobStorageMetadata?
266
+
267
+ `boolean`
268
+
269
+ Flag to include the blob storage metadata for the document, defaults to false.
270
+
271
+ ###### includeBlobStorageData?
272
+
273
+ `boolean`
274
+
275
+ Flag to include the blob storage data for the document, defaults to false.
276
+
277
+ ###### includeAttestation?
278
+
279
+ `boolean`
280
+
281
+ Flag to include the attestation information for the document, defaults to false.
282
+
283
+ ###### includeRemoved?
284
+
285
+ `boolean`
286
+
287
+ Flag to include deleted documents, defaults to false.
288
+
289
+ ###### includeDeletedEdges?
290
+
291
+ `boolean`
292
+
293
+ Flag to include soft-deleted edges in the response, defaults to false.
294
+
295
+ ###### extractRuleGroupId?
296
+
297
+ `string`
298
+
299
+ If provided will extract data from the document using the specified rule group id.
300
+
301
+ ###### extractMimeType?
302
+
303
+ `string`
304
+
305
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
306
+
307
+ ##### cursor?
308
+
309
+ `string`
310
+
311
+ The cursor to get the next chunk of revisions.
312
+
313
+ ##### limit?
314
+
315
+ `number`
316
+
317
+ Limit the number of items to return, defaults to 1 so only most recent is returned.
318
+
319
+ #### Returns
320
+
321
+ `Promise`\<\{ `entries`: `IDocumentList`; `cursor?`: `string`; \}\>
322
+
323
+ The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
324
+
325
+ #### Implementation of
326
+
327
+ `IDocumentManagementComponent.get`
328
+
329
+ ***
330
+
331
+ ### getRevision() {#getrevision}
332
+
333
+ > **getRevision**(`auditableItemGraphDocumentId`, `revision`, `options?`): `Promise`\<`IDocumentHydrated`\>
334
+
335
+ Get a document revision using it's auditable item graph vertex id.
336
+
337
+ #### Parameters
338
+
339
+ ##### auditableItemGraphDocumentId
340
+
341
+ `string`
342
+
343
+ The auditable item graph vertex id which contains the document.
344
+
345
+ ##### revision
346
+
347
+ `number`
348
+
349
+ The revision id for the document.
350
+
351
+ ##### options?
352
+
353
+ Additional options for the get operation.
354
+
355
+ ###### includeBlobStorageMetadata?
356
+
357
+ `boolean`
358
+
359
+ Flag to include the blob storage metadata for the document, defaults to false.
360
+
361
+ ###### includeBlobStorageData?
362
+
363
+ `boolean`
364
+
365
+ Flag to include the blob storage data for the document, defaults to false.
366
+
367
+ ###### includeAttestation?
368
+
369
+ `boolean`
370
+
371
+ Flag to include the attestation information for the document, defaults to false.
372
+
373
+ ###### extractRuleGroupId?
374
+
375
+ `string`
376
+
377
+ If provided will extract data from the document using the specified rule group id.
378
+
379
+ ###### extractMimeType?
380
+
381
+ `string`
382
+
383
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
384
+
385
+ #### Returns
386
+
387
+ `Promise`\<`IDocumentHydrated`\>
388
+
389
+ The document for the specified revision.
390
+
391
+ #### Implementation of
392
+
393
+ `IDocumentManagementComponent.getRevision`
394
+
395
+ ***
396
+
397
+ ### removeRevision() {#removerevision}
398
+
399
+ > **removeRevision**(`auditableItemGraphDocumentId`, `revision`): `Promise`\<`void`\>
400
+
401
+ Remove an auditable item graph vertex using it's id.
402
+ The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
403
+
404
+ #### Parameters
405
+
406
+ ##### auditableItemGraphDocumentId
407
+
408
+ `string`
409
+
410
+ The auditable item graph vertex id which contains the document.
411
+
412
+ ##### revision
413
+
414
+ `number`
415
+
416
+ The revision of the document to remove.
417
+
418
+ #### Returns
419
+
420
+ `Promise`\<`void`\>
421
+
422
+ A promise that resolves when the revision has been removed.
423
+
424
+ #### Implementation of
425
+
426
+ `IDocumentManagementComponent.removeRevision`
427
+
428
+ ***
429
+
430
+ ### query() {#query}
431
+
432
+ > **query**(`documentId`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuditableItemGraphVertexList`; `cursor?`: `string`; \}\>
433
+
434
+ Find all the document with a specific id.
435
+
436
+ #### Parameters
437
+
438
+ ##### documentId
439
+
440
+ `string`
441
+
442
+ The document id to find in the graph.
443
+
444
+ ##### cursor?
445
+
446
+ `string`
447
+
448
+ The cursor to get the next chunk of documents.
449
+
450
+ ##### limit?
451
+
452
+ `number`
453
+
454
+ The limit to get the next chunk of documents.
455
+
456
+ #### Returns
457
+
458
+ `Promise`\<\{ `entries`: `IAuditableItemGraphVertexList`; `cursor?`: `string`; \}\>
459
+
460
+ The graph vertices that contain documents referencing the specified document id.
461
+
462
+ #### Implementation of
463
+
464
+ `IDocumentManagementComponent.query`
@@ -0,0 +1,37 @@
1
+ # Function: documentManagementCreate()
2
+
3
+ > **documentManagementCreate**(`httpRequestContext`, `componentName`, `request`, `baseRouteName`): `Promise`\<`ICreatedResponse`\>
4
+
5
+ Create a document as an 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
+ `IDocumentManagementCreateRequest`
24
+
25
+ The request.
26
+
27
+ ### baseRouteName
28
+
29
+ `string`
30
+
31
+ The base route name for constructing URLs.
32
+
33
+ ## Returns
34
+
35
+ `Promise`\<`ICreatedResponse`\>
36
+
37
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: documentManagementGet()
2
+
3
+ > **documentManagementGet**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IDocumentManagementGetResponse`\>
4
+
5
+ Get 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
+ `IDocumentManagementGetRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IDocumentManagementGetResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -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: documentManagementQuery()
2
+
3
+ > **documentManagementQuery**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IDocumentManagementQueryResponse`\>
4
+
5
+ Query the documents from an 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
+ `IDocumentManagementQueryRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IDocumentManagementQueryResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: documentManagementRemove()
2
+
3
+ > **documentManagementRemove**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Remove 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
+ `IDocumentManagementRemoveRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: documentManagementUpdatePartial()
2
+
3
+ > **documentManagementUpdatePartial**(`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
+ `IDocumentManagementUpdatePartialRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: generateRestRoutesDocumentManagement()
2
+
3
+ > **generateRestRoutesDocumentManagement**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
4
+
5
+ The REST routes for document management.
6
+
7
+ ## Parameters
8
+
9
+ ### baseRouteName
10
+
11
+ `string`
12
+
13
+ Prefix to prepend to the paths.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes stored in the ComponentFactory.
20
+
21
+ ## Returns
22
+
23
+ `IRestRoute`\<`any`, `any`\>[]
24
+
25
+ The generated routes.
@@ -0,0 +1,25 @@
1
+ # @3sixty/document-management-service
2
+
3
+ ## Classes
4
+
5
+ - [DocumentManagementService](classes/DocumentManagementService.md)
6
+
7
+ ## Interfaces
8
+
9
+ - [IDocumentManagementServiceConfig](interfaces/IDocumentManagementServiceConfig.md)
10
+ - [IDocumentManagementServiceConstructorOptions](interfaces/IDocumentManagementServiceConstructorOptions.md)
11
+
12
+ ## Variables
13
+
14
+ - [tagsDocumentManagement](variables/tagsDocumentManagement.md)
15
+ - [restEntryPoints](variables/restEntryPoints.md)
16
+
17
+ ## Functions
18
+
19
+ - [generateRestRoutesDocumentManagement](functions/generateRestRoutesDocumentManagement.md)
20
+ - [documentManagementCreate](functions/documentManagementCreate.md)
21
+ - [documentManagementGet](functions/documentManagementGet.md)
22
+ - [documentManagementGetRevision](functions/documentManagementGetRevision.md)
23
+ - [documentManagementUpdatePartial](functions/documentManagementUpdatePartial.md)
24
+ - [documentManagementRemove](functions/documentManagementRemove.md)
25
+ - [documentManagementQuery](functions/documentManagementQuery.md)