@twin.org/document-management-service 0.0.1-next.8 → 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.
@@ -21,41 +21,28 @@
21
21
  }
22
22
  ],
23
23
  "paths": {
24
- "/documents/{auditableItemGraphId}": {
24
+ "/documents": {
25
25
  "post": {
26
26
  "operationId": "DocumentManagementSet",
27
27
  "summary": "Store a document in an auditable item graph vertex and add its content to blob storage.",
28
28
  "tags": [
29
29
  "Document Management"
30
30
  ],
31
- "parameters": [
32
- {
33
- "name": "auditableItemGraphId",
34
- "description": "The id of the auditable item graph vertex to store the document on.",
35
- "in": "path",
36
- "required": true,
37
- "schema": {
38
- "type": "string"
39
- },
40
- "style": "simple",
41
- "example": "aig:123456"
42
- }
43
- ],
44
31
  "security": [
45
32
  {
46
33
  "jwtBearerAuthScheme": []
47
34
  }
48
35
  ],
49
36
  "requestBody": {
50
- "description": "Request to set a document in an auditable item graph vertex.",
37
+ "description": "Request to create a document as an auditable item graph vertex.",
51
38
  "required": true,
52
39
  "content": {
53
40
  "application/json": {
54
41
  "schema": {
55
- "$ref": "#/components/schemas/DocumentManagementSetRequest"
42
+ "$ref": "#/components/schemas/DocumentManagementCreateRequest"
56
43
  },
57
44
  "examples": {
58
- "DocumentManagementSetRequestExample": {
45
+ "DocumentManagementCreateRequestExample": {
59
46
  "value": {
60
47
  "documentId": "2721000",
61
48
  "documentIdFormat": "bol",
@@ -81,7 +68,7 @@
81
68
  "schema": {
82
69
  "type": "string"
83
70
  },
84
- "description": "e.g. documents:123456:705:2721000"
71
+ "description": "e.g. aig:123456"
85
72
  }
86
73
  }
87
74
  },
@@ -152,46 +139,27 @@
152
139
  ],
153
140
  "parameters": [
154
141
  {
155
- "name": "auditableItemGraphId",
156
- "description": "The id of the auditable item graph vertex which contains the documents.",
157
- "in": "path",
158
- "required": true,
159
- "schema": {
160
- "type": "string"
161
- },
162
- "style": "simple",
163
- "example": "aig:123456"
164
- },
165
- {
166
- "name": "documentCodes",
167
- "description": "List of comma separated document codes to filter the query.",
142
+ "name": "documentId",
143
+ "description": "The id of the document id we are trying to find.",
168
144
  "in": "query",
169
145
  "required": false,
170
146
  "schema": {
171
147
  "type": "string"
172
- }
173
- },
174
- {
175
- "name": "includeRemoved",
176
- "description": "Include deleted documents in the response.",
177
- "in": "query",
178
- "required": false,
179
- "schema": {
180
- "type": "boolean"
181
- }
148
+ },
149
+ "example": "2721000"
182
150
  },
183
151
  {
184
- "name": "includeMostRecentRevisions",
185
- "description": "Include the most recent 5 revisions, use the individual get to retrieve more.",
152
+ "name": "cursor",
153
+ "description": "The cursor to get the next chunk of documents.",
186
154
  "in": "query",
187
155
  "required": false,
188
156
  "schema": {
189
- "type": "boolean"
157
+ "type": "string"
190
158
  }
191
159
  },
192
160
  {
193
- "name": "cursor",
194
- "description": "The cursor to get the next chunk of documents.",
161
+ "name": "pageSize",
162
+ "description": "The number of documents to return.",
195
163
  "in": "query",
196
164
  "required": false,
197
165
  "schema": {
@@ -214,92 +182,117 @@
214
182
  }
215
183
  ],
216
184
  "responses": {
217
- "200": {
218
- "description": "Response to query the documents from an auditable item graph vertex.",
185
+ "400": {
186
+ "description": "The server cannot process the request, see the content for more details.",
219
187
  "content": {
220
188
  "application/json": {
221
189
  "schema": {
222
- "$ref": "#/components/schemas/DocumentList"
190
+ "$ref": "#/components/schemas/Error"
223
191
  },
224
192
  "examples": {
225
- "DocumentManagementQueryResponseExample": {
193
+ "exampleResponse": {
226
194
  "value": {
227
- "@context": [
228
- "https://schema.twindev.org/documents/",
229
- "https://schema.twindev.org/common/"
230
- ],
231
- "type": "DocumentList",
232
- "documents": [
233
- {
234
- "@context": [
235
- "https://schema.twindev.org/documents/",
236
- "https://schema.twindev.org/common/",
237
- "https://schema.org"
238
- ],
239
- "type": "Document",
240
- "id": "documents:705:2721000:rev-0",
241
- "documentId": "2721000",
242
- "documentIdFormat": "bol",
243
- "documentCode": "unece:DocumentCodeList#705",
244
- "documentRevision": 0,
245
- "blobStorageId": "blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
246
- "blobHash": "sha256:123456",
247
- "dateCreated": "2024-01-01T00:00:00Z",
248
- "annotationObject": {
249
- "@context": "https://schema.org",
250
- "@type": "DigitalDocument",
251
- "name": "myfile.pdf"
252
- },
253
- "nodeIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363",
254
- "userIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363"
255
- }
256
- ]
195
+ "name": "GeneralError",
196
+ "message": "component.error",
197
+ "properties": {
198
+ "foo": "bar"
199
+ }
257
200
  }
258
201
  }
259
202
  }
260
- },
261
- "application/ld+json": {
203
+ }
204
+ }
205
+ },
206
+ "401": {
207
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
208
+ "content": {
209
+ "application/json": {
262
210
  "schema": {
263
- "$ref": "#/components/schemas/DocumentList"
211
+ "$ref": "#/components/schemas/Error"
264
212
  },
265
213
  "examples": {
266
- "DocumentManagementListResponseJsonLdExample": {
214
+ "exampleResponse": {
267
215
  "value": {
268
- "@context": [
269
- "https://schema.twindev.org/documents/",
270
- "https://schema.twindev.org/common/"
271
- ],
272
- "type": "DocumentList",
273
- "documents": [
274
- {
275
- "@context": [
276
- "https://schema.twindev.org/documents/",
277
- "https://schema.twindev.org/common/",
278
- "https://schema.org"
279
- ],
280
- "type": "Document",
281
- "id": "documents:705:2721000:rev-0",
282
- "documentId": "2721000",
283
- "documentIdFormat": "bol",
284
- "documentCode": "unece:DocumentCodeList#705",
285
- "documentRevision": 0,
286
- "blobStorageId": "blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
287
- "blobHash": "sha256:123456",
288
- "dateCreated": "2024-01-01T00:00:00Z",
289
- "annotationObject": {
290
- "@context": "https://schema.org",
291
- "@type": "DigitalDocument",
292
- "name": "myfile.pdf"
293
- },
294
- "nodeIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363",
295
- "userIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363"
296
- }
297
- ]
216
+ "name": "UnauthorizedError",
217
+ "message": "component.error"
218
+ }
219
+ }
220
+ }
221
+ }
222
+ }
223
+ },
224
+ "500": {
225
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
226
+ "content": {
227
+ "application/json": {
228
+ "schema": {
229
+ "$ref": "#/components/schemas/Error"
230
+ },
231
+ "examples": {
232
+ "exampleResponse": {
233
+ "value": {
234
+ "name": "InternalServerError",
235
+ "message": "component.error"
236
+ }
237
+ }
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
243
+ }
244
+ },
245
+ "/documents/{auditableItemGraphDocumentId}": {
246
+ "put": {
247
+ "operationId": "DocumentManagementUpdate",
248
+ "summary": "Update a document in an auditable item graph vertex and add its content to blob storage.",
249
+ "tags": [
250
+ "Document Management"
251
+ ],
252
+ "parameters": [
253
+ {
254
+ "name": "auditableItemGraphDocumentId",
255
+ "description": "The full id of the document to get.",
256
+ "in": "path",
257
+ "required": true,
258
+ "schema": {
259
+ "type": "string"
260
+ },
261
+ "style": "simple",
262
+ "example": "aig:123456"
263
+ }
264
+ ],
265
+ "security": [
266
+ {
267
+ "jwtBearerAuthScheme": []
268
+ }
269
+ ],
270
+ "requestBody": {
271
+ "description": "Request to update a document as an auditable item graph vertex.",
272
+ "required": true,
273
+ "content": {
274
+ "application/json": {
275
+ "schema": {
276
+ "$ref": "#/components/schemas/DocumentManagementUpdateRequest"
277
+ },
278
+ "examples": {
279
+ "DocumentManagementUpdateRequestExample": {
280
+ "value": {
281
+ "blob": "SGVsbG8gV29ybGQ=",
282
+ "annotationObject": {
283
+ "@context": "https://schema.org",
284
+ "@type": "DigitalDocument",
285
+ "name": "myfile.pdf"
298
286
  }
299
287
  }
300
288
  }
301
289
  }
302
290
  }
291
+ }
292
+ },
293
+ "responses": {
294
+ "204": {
295
+ "description": "The rest request ended in success with no data."
303
296
  },
304
297
  "400": {
305
298
  "description": "The server cannot process the request, see the content for more details.",
@@ -359,9 +352,7 @@
359
352
  }
360
353
  }
361
354
  }
362
- }
363
- },
364
- "/documents/{auditableItemGraphId}/{documentId}": {
355
+ },
365
356
  "get": {
366
357
  "operationId": "DocumentManagementGet",
367
358
  "summary": "Get the data for a document from document management",
@@ -370,18 +361,7 @@
370
361
  ],
371
362
  "parameters": [
372
363
  {
373
- "name": "auditableItemGraphId",
374
- "description": "The id of the auditable item graph vertex to store the document on.",
375
- "in": "path",
376
- "required": true,
377
- "schema": {
378
- "type": "string"
379
- },
380
- "style": "simple",
381
- "example": "aig:1234"
382
- },
383
- {
384
- "name": "documentId",
364
+ "name": "auditableItemGraphDocumentId",
385
365
  "description": "The full id of the document to get.",
386
366
  "in": "path",
387
367
  "required": true,
@@ -389,7 +369,7 @@
389
369
  "type": "string"
390
370
  },
391
371
  "style": "simple",
392
- "example": "documents:123456:705:2721000"
372
+ "example": "aig:123456"
393
373
  },
394
374
  {
395
375
  "name": "includeBlobStorageMetadata",
@@ -428,16 +408,16 @@
428
408
  }
429
409
  },
430
410
  {
431
- "name": "maxRevisionCount",
432
- "description": "Max number of revisions to return.",
411
+ "name": "pageSize",
412
+ "description": "Page size of items to return, defaults to 1 so only most recent is returned.",
433
413
  "in": "query",
434
414
  "required": false,
435
415
  "schema": {
436
- "type": "number"
416
+ "type": "string"
437
417
  }
438
418
  },
439
419
  {
440
- "name": "revisionCursor",
420
+ "name": "cursor",
441
421
  "description": "The cursor to get the next chunk of revisions.",
442
422
  "in": "query",
443
423
  "required": false,
@@ -466,64 +446,82 @@
466
446
  "content": {
467
447
  "application/json": {
468
448
  "schema": {
469
- "$ref": "#/components/schemas/Document"
449
+ "$ref": "#/components/schemas/DocumentList"
470
450
  },
471
451
  "examples": {
472
452
  "DocumentManagementGetResponseExample": {
473
453
  "value": {
474
454
  "@context": [
475
455
  "https://schema.twindev.org/documents/",
476
- "https://schema.twindev.org/common/",
477
- "https://schema.org"
456
+ "https://schema.twindev.org/common/"
478
457
  ],
479
- "type": "Document",
480
- "id": "documents:705:2721000:rev-0",
481
- "documentId": "2721000",
482
- "documentIdFormat": "bol",
483
- "documentCode": "unece:DocumentCodeList#705",
484
- "documentRevision": 0,
485
- "blobStorageId": "blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
486
- "blobHash": "sha256:123456",
487
- "dateCreated": "2024-01-01T00:00:00Z",
488
- "annotationObject": {
489
- "@context": "https://schema.org",
490
- "@type": "DigitalDocument",
491
- "name": "myfile.pdf"
492
- },
493
- "nodeIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363",
494
- "userIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363"
458
+ "type": "DocumentList",
459
+ "documents": [
460
+ {
461
+ "@context": [
462
+ "https://schema.twindev.org/documents/",
463
+ "https://schema.twindev.org/common/",
464
+ "https://schema.org"
465
+ ],
466
+ "type": "Document",
467
+ "id": "2721000:0",
468
+ "documentId": "2721000",
469
+ "documentIdFormat": "bol",
470
+ "documentCode": "unece:DocumentCodeList#705",
471
+ "documentRevision": 0,
472
+ "blobStorageId": "blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
473
+ "blobHash": "sha256:123456",
474
+ "dateCreated": "2024-01-01T00:00:00Z",
475
+ "annotationObject": {
476
+ "@context": "https://schema.org",
477
+ "@type": "DigitalDocument",
478
+ "name": "myfile.pdf"
479
+ },
480
+ "nodeIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363",
481
+ "userIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363"
482
+ }
483
+ ]
495
484
  }
496
485
  }
497
486
  }
498
487
  },
499
488
  "application/ld+json": {
500
489
  "schema": {
501
- "$ref": "#/components/schemas/Document"
490
+ "$ref": "#/components/schemas/DocumentList"
502
491
  },
503
492
  "examples": {
504
493
  "DocumentManagementGetResponseExample": {
505
494
  "value": {
506
495
  "@context": [
507
496
  "https://schema.twindev.org/documents/",
508
- "https://schema.twindev.org/common/",
509
- "https://schema.org"
497
+ "https://schema.twindev.org/common/"
510
498
  ],
511
- "type": "Document",
512
- "id": "documents:705:2721000:rev-0",
513
- "documentId": "2721000",
514
- "documentIdFormat": "bol",
515
- "documentCode": "unece:DocumentCodeList#705",
516
- "documentRevision": 0,
517
- "blobStorageId": "blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
518
- "blobHash": "sha256:123456",
519
- "dateCreated": "2024-01-01T00:00:00Z",
520
- "annotationObject": {
521
- "@context": "https://schema.org",
522
- "@type": "DigitalDocument",
523
- "name": "myfile.pdf"
524
- },
525
- "nodeIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363",
526
- "userIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363"
499
+ "type": "DocumentList",
500
+ "documents": [
501
+ {
502
+ "@context": [
503
+ "https://schema.twindev.org/documents/",
504
+ "https://schema.twindev.org/common/",
505
+ "https://schema.org"
506
+ ],
507
+ "type": "Document",
508
+ "id": "2721000:0",
509
+ "documentId": "2721000",
510
+ "documentIdFormat": "bol",
511
+ "documentCode": "unece:DocumentCodeList#705",
512
+ "documentRevision": 0,
513
+ "blobStorageId": "blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
514
+ "blobHash": "sha256:123456",
515
+ "dateCreated": "2024-01-01T00:00:00Z",
516
+ "annotationObject": {
517
+ "@context": "https://schema.org",
518
+ "@type": "DigitalDocument",
519
+ "name": "myfile.pdf"
520
+ },
521
+ "nodeIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363",
522
+ "userIdentity": "did:entity-storage:0x6363636363636363636363636363636363636363636363636363636363636363"
523
+ }
524
+ ]
527
525
  }
528
526
  }
529
527
  }
@@ -609,7 +607,9 @@
609
607
  }
610
608
  }
611
609
  }
612
- },
610
+ }
611
+ },
612
+ "/documents/{auditableItemGraphDocumentId}/{revision}": {
613
613
  "delete": {
614
614
  "operationId": "DocumentManagementRemove",
615
615
  "summary": "Remove an document from an auditable item graph vertex",
@@ -618,8 +618,8 @@
618
618
  ],
619
619
  "parameters": [
620
620
  {
621
- "name": "auditableItemGraphId",
622
- "description": "The id of the auditable item graph vertex to remove the document from.",
621
+ "name": "auditableItemGraphDocumentId",
622
+ "description": "The id of the auditable item graph vertex to remove the revision from.",
623
623
  "in": "path",
624
624
  "required": true,
625
625
  "schema": {
@@ -629,24 +629,15 @@
629
629
  "example": "aig:1234"
630
630
  },
631
631
  {
632
- "name": "documentId",
633
- "description": "The full id of the document to remove.",
632
+ "name": "revision",
633
+ "description": "The revision of the document to remove.",
634
634
  "in": "path",
635
635
  "required": true,
636
636
  "schema": {
637
637
  "type": "string"
638
638
  },
639
639
  "style": "simple",
640
- "example": "documents:123456:705:2721000"
641
- },
642
- {
643
- "name": "removeAllRevisions",
644
- "description": "Flag to remove all revisions of the document.",
645
- "in": "query",
646
- "required": false,
647
- "schema": {
648
- "type": "boolean"
649
- }
640
+ "example": "1"
650
641
  }
651
642
  ],
652
643
  "security": [
@@ -980,17 +971,6 @@
980
971
  "userIdentity": {
981
972
  "type": "string",
982
973
  "description": "The user who added the document to the graph."
983
- },
984
- "revisions": {
985
- "type": "array",
986
- "items": {
987
- "$ref": "#/components/schemas/Document"
988
- },
989
- "description": "The previous revisions of the document."
990
- },
991
- "revisionCursor": {
992
- "type": "string",
993
- "description": "The cursor to get the next chunk of revisions."
994
974
  }
995
975
  },
996
976
  "required": [
@@ -1042,6 +1022,13 @@
1042
1022
  },
1043
1023
  "description": "The list of documents."
1044
1024
  },
1025
+ "edges": {
1026
+ "type": "array",
1027
+ "items": {
1028
+ "type": "string"
1029
+ },
1030
+ "description": "The ids of the other vertices which are connected to the document."
1031
+ },
1045
1032
  "cursor": {
1046
1033
  "type": "string",
1047
1034
  "description": "The cursor to get the next chunk of documents."
@@ -1055,7 +1042,7 @@
1055
1042
  "additionalProperties": false,
1056
1043
  "description": "Interface describing a list of document entries."
1057
1044
  },
1058
- "DocumentManagementSetRequest": {
1045
+ "DocumentManagementCreateRequest": {
1059
1046
  "type": "object",
1060
1047
  "properties": {
1061
1048
  "documentId": {
@@ -1076,13 +1063,35 @@
1076
1063
  "annotationObject": {
1077
1064
  "$ref": "#/components/schemas/JsonLdNodeObject"
1078
1065
  },
1066
+ "auditableItemGraphEdges": {
1067
+ "type": "array",
1068
+ "items": {
1069
+ "type": "object",
1070
+ "properties": {
1071
+ "id": {
1072
+ "type": "string"
1073
+ },
1074
+ "addAlias": {
1075
+ "type": "boolean"
1076
+ },
1077
+ "aliasAnnotationObject": {
1078
+ "$ref": "#/components/schemas/JsonLdNodeObject"
1079
+ }
1080
+ },
1081
+ "required": [
1082
+ "id"
1083
+ ],
1084
+ "additionalProperties": false
1085
+ },
1086
+ "description": "The auditable item graph vertices to connect the document to."
1087
+ },
1079
1088
  "createAttestation": {
1080
1089
  "type": "boolean",
1081
- "description": "Flag to create an attestation for the document, defaults to false"
1090
+ "description": "Flag to create an attestation for the document, defaults to false."
1082
1091
  },
1083
- "includeIdAsAlias": {
1092
+ "addAlias": {
1084
1093
  "type": "boolean",
1085
- "description": "Include the document id as an alias to the aig vertex, defaults to false."
1094
+ "description": "Flag to add the document id as an alias to the aig vertex, defaults to true."
1086
1095
  },
1087
1096
  "aliasAnnotationObject": {
1088
1097
  "$ref": "#/components/schemas/JsonLdNodeObject"
@@ -1096,6 +1105,42 @@
1096
1105
  "additionalProperties": false,
1097
1106
  "description": "The body parameters."
1098
1107
  },
1108
+ "DocumentManagementUpdateRequest": {
1109
+ "type": "object",
1110
+ "properties": {
1111
+ "blob": {
1112
+ "type": "string",
1113
+ "description": "The data to create the document with, in base64."
1114
+ },
1115
+ "annotationObject": {
1116
+ "$ref": "#/components/schemas/JsonLdNodeObject"
1117
+ },
1118
+ "auditableItemGraphEdges": {
1119
+ "type": "array",
1120
+ "items": {
1121
+ "type": "object",
1122
+ "properties": {
1123
+ "id": {
1124
+ "type": "string"
1125
+ },
1126
+ "addAlias": {
1127
+ "type": "boolean"
1128
+ },
1129
+ "aliasAnnotationObject": {
1130
+ "$ref": "#/components/schemas/JsonLdNodeObject"
1131
+ }
1132
+ },
1133
+ "required": [
1134
+ "id"
1135
+ ],
1136
+ "additionalProperties": false
1137
+ },
1138
+ "description": "The auditable item graph vertices to connect the document to."
1139
+ }
1140
+ },
1141
+ "additionalProperties": false,
1142
+ "description": "The body parameters."
1143
+ },
1099
1144
  "Error": {
1100
1145
  "type": "object",
1101
1146
  "properties": {