@twin.org/document-management-service 0.0.1-next.7 → 0.0.1-next.9

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`?, `options`?, `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,6 +88,12 @@ The data to create the document.
94
88
 
95
89
  Additional information to associate with the document.
96
90
 
91
+ ##### auditableItemGraphEdges?
92
+
93
+ `object`[]
94
+
95
+ The auditable item graph vertices to connect the document to.
96
+
97
97
  ##### options?
98
98
 
99
99
  Additional options for the set operation.
@@ -104,17 +104,17 @@ Additional options for the set operation.
104
104
 
105
105
  Flag to create an attestation for the document, defaults to false.
106
106
 
107
- ###### includeIdAsAlias?
107
+ ###### addAlias?
108
108
 
109
109
  `boolean`
110
110
 
111
- Include the document id as an alias to the aig vertex, defaults to false.
111
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
112
112
 
113
113
  ###### aliasAnnotationObject?
114
114
 
115
115
  `IJsonLdNodeObject`
116
116
 
117
- Additional information to associate with the alias.
117
+ Annotation object for the alias.
118
118
 
119
119
  ##### userIdentity?
120
120
 
@@ -132,33 +132,85 @@ The node identity to use for vault operations.
132
132
 
133
133
  `Promise`\<`string`\>
134
134
 
135
- 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.
136
136
 
137
137
  #### Implementation of
138
138
 
139
- `IDocumentManagementComponent.set`
139
+ `IDocumentManagementComponent.create`
140
140
 
141
141
  ***
142
142
 
143
- ### get()
143
+ ### update()
144
144
 
145
- > **get**(`auditableItemGraphId`, `identifier`, `options`?, `revisionCursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`IDocument`\>
145
+ > **update**(`auditableItemGraphDocumentId`, `blob?`, `annotationObject?`, `auditableItemGraphEdges?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
146
146
 
147
- 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.
148
150
 
149
151
  #### Parameters
150
152
 
151
- ##### auditableItemGraphId
153
+ ##### auditableItemGraphDocumentId
152
154
 
153
155
  `string`
154
156
 
155
- The auditable item graph vertex id to get the document from.
157
+ The auditable item graph vertex id which contains the document.
156
158
 
157
- ##### identifier
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?
172
+
173
+ `object`[]
174
+
175
+ The auditable item graph vertices to connect the document to, if undefined retains current connections.
176
+
177
+ ##### userIdentity?
158
178
 
159
179
  `string`
160
180
 
161
- 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.
162
214
 
163
215
  ##### options?
164
216
 
@@ -188,17 +240,17 @@ Flag to include the attestation information for the document, defaults to false.
188
240
 
189
241
  Flag to include deleted documents, defaults to false.
190
242
 
191
- ###### maxRevisionCount?
243
+ ##### cursor?
192
244
 
193
- `number`
245
+ `string`
194
246
 
195
- Max number of revisions to return, defaults to 0.
247
+ The cursor to get the next chunk of revisions.
196
248
 
197
- ##### revisionCursor?
249
+ ##### pageSize?
198
250
 
199
- `string`
251
+ `number`
200
252
 
201
- The cursor to get the next chunk of revisions.
253
+ Page size of items to return, defaults to 1 so only most recent is returned.
202
254
 
203
255
  ##### userIdentity?
204
256
 
@@ -214,7 +266,7 @@ The node identity to use for vault operations.
214
266
 
215
267
  #### Returns
216
268
 
217
- `Promise`\<`IDocument`\>
269
+ `Promise`\<`IDocumentList`\>
218
270
 
219
271
  The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
220
272
 
@@ -224,36 +276,26 @@ The documents and revisions if requested, ordered by revision descending, cursor
224
276
 
225
277
  ***
226
278
 
227
- ### remove()
279
+ ### removeRevision()
228
280
 
229
- > **remove**(`auditableItemGraphId`, `identifier`, `options`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
281
+ > **removeRevision**(`auditableItemGraphDocumentId`, `revision`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
230
282
 
231
- Remove a specific document from an auditable item graph vertex.
232
- The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
283
+ Remove an auditable item graph vertex using it's id.
284
+ The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
233
285
 
234
286
  #### Parameters
235
287
 
236
- ##### auditableItemGraphId
288
+ ##### auditableItemGraphDocumentId
237
289
 
238
290
  `string`
239
291
 
240
- The auditable item graph vertex id to remove the document from.
241
-
242
- ##### identifier
292
+ The auditable item graph vertex id which contains the document.
243
293
 
244
- `string`
245
-
246
- The identifier of the document to remove.
294
+ ##### revision
247
295
 
248
- ##### options?
249
-
250
- Additional options for the remove operation.
251
-
252
- ###### removeAllRevisions?
253
-
254
- `boolean`
296
+ `number`
255
297
 
256
- Flag to remove all revisions of the document, defaults to false.
298
+ The revision of the document to remove.
257
299
 
258
300
  ##### userIdentity?
259
301
 
@@ -275,45 +317,23 @@ Nothing.
275
317
 
276
318
  #### Implementation of
277
319
 
278
- `IDocumentManagementComponent.remove`
320
+ `IDocumentManagementComponent.removeRevision`
279
321
 
280
322
  ***
281
323
 
282
324
  ### query()
283
325
 
284
- > **query**(`auditableItemGraphId`, `documentCodes`?, `options`?, `cursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`IDocumentList`\>
326
+ > **query**(`documentId`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IAuditableItemGraphVertexList`\>
285
327
 
286
- Query an auditable item graph vertex for documents.
328
+ Find all the document with a specific id.
287
329
 
288
330
  #### Parameters
289
331
 
290
- ##### auditableItemGraphId
332
+ ##### documentId
291
333
 
292
334
  `string`
293
335
 
294
- The auditable item graph vertex to get the documents from.
295
-
296
- ##### documentCodes?
297
-
298
- `string`[]
299
-
300
- The document codes to query for, if undefined gets all document codes.
301
-
302
- ##### options?
303
-
304
- Additional options for the query operation.
305
-
306
- ###### includeMostRecentRevisions?
307
-
308
- `boolean`
309
-
310
- Include the most recent 5 revisions, use the individual get to retrieve more.
311
-
312
- ###### includeRemoved?
313
-
314
- `boolean`
315
-
316
- Flag to include deleted documents, defaults to false.
336
+ The document id to find in the graph.
317
337
 
318
338
  ##### cursor?
319
339
 
@@ -321,6 +341,12 @@ Flag to include deleted documents, defaults to false.
321
341
 
322
342
  The cursor to get the next chunk of documents.
323
343
 
344
+ ##### pageSize?
345
+
346
+ `number`
347
+
348
+ The page size to get the next chunk of documents.
349
+
324
350
  ##### userIdentity?
325
351
 
326
352
  `string`
@@ -335,9 +361,9 @@ The node identity to use for vault operations.
335
361
 
336
362
  #### Returns
337
363
 
338
- `Promise`\<`IDocumentList`\>
364
+ `Promise`\<`IAuditableItemGraphVertexList`\>
339
365
 
340
- The most recent revisions of each document, cursor is set if there are more documents.
366
+ The graph vertices that contain documents referencing the specified document id.
341
367
 
342
368
  #### Implementation of
343
369
 
@@ -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: 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,8 @@
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
+ - [documentManagementUpdate](functions/documentManagementUpdate.md)
22
23
  - [documentManagementRemove](functions/documentManagementRemove.md)
23
24
  - [documentManagementQuery](functions/documentManagementQuery.md)
package/locales/en.json CHANGED
@@ -1,13 +1,13 @@
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
+ "removeRevision": "Failed to remove document revision",
7
8
  "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}\"",
9
+ "documentRevisionNone": "There are no revisions in the document",
10
+ "documentRevisionNotFound": "There is no revision number \"{revision}\" in the document",
11
11
  "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the Document Management component \"{namespace}\""
12
12
  }
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/document-management-service",
3
- "version": "0.0.1-next.7",
3
+ "version": "0.0.1-next.9",
4
4
  "description": "Document management contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
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.7",
24
+ "@twin.org/document-management-models": "0.0.1-next.9",
25
25
  "@twin.org/entity": "next",
26
26
  "@twin.org/entity-storage-models": "next",
27
27
  "@twin.org/nameof": "next",