@twin.org/document-management-models 0.0.1-next.1 → 0.0.1-next.10

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 (34) hide show
  1. package/dist/cjs/index.cjs +17 -3
  2. package/dist/esm/index.mjs +17 -4
  3. package/dist/types/index.d.ts +5 -2
  4. package/dist/types/models/IDocument.d.ts +10 -9
  5. package/dist/types/models/IDocumentAttestation.d.ts +41 -0
  6. package/dist/types/models/IDocumentList.d.ts +9 -4
  7. package/dist/types/models/IDocumentManagementComponent.d.ts +50 -34
  8. package/dist/types/models/api/{IDocumentManagementSetRequest.d.ts → IDocumentManagementCreateRequest.d.ts} +19 -12
  9. package/dist/types/models/api/IDocumentManagementGetRequest.d.ts +5 -9
  10. package/dist/types/models/api/IDocumentManagementGetResponse.d.ts +2 -2
  11. package/dist/types/models/api/IDocumentManagementQueryRequest.d.ts +7 -22
  12. package/dist/types/models/api/IDocumentManagementQueryResponse.d.ts +2 -2
  13. package/dist/types/models/api/IDocumentManagementRemoveRequest.d.ts +5 -15
  14. package/dist/types/models/api/IDocumentManagementUpdateRequest.d.ts +36 -0
  15. package/dist/types/models/documentContexts.d.ts +17 -0
  16. package/dist/types/models/{documentDataTypes.d.ts → documentTypes.d.ts} +4 -8
  17. package/docs/changelog.md +22 -1
  18. package/docs/reference/index.md +5 -1
  19. package/docs/reference/interfaces/IDocument.md +6 -6
  20. package/docs/reference/interfaces/IDocumentAttestation.md +59 -0
  21. package/docs/reference/interfaces/IDocumentList.md +9 -1
  22. package/docs/reference/interfaces/IDocumentManagementComponent.md +110 -72
  23. package/docs/reference/interfaces/{IDocumentManagementSetRequest.md → IDocumentManagementCreateRequest.md} +21 -17
  24. package/docs/reference/interfaces/IDocumentManagementGetRequest.md +8 -14
  25. package/docs/reference/interfaces/IDocumentManagementGetResponse.md +1 -1
  26. package/docs/reference/interfaces/IDocumentManagementQueryRequest.md +11 -43
  27. package/docs/reference/interfaces/IDocumentManagementQueryResponse.md +1 -1
  28. package/docs/reference/interfaces/IDocumentManagementRemoveRequest.md +7 -27
  29. package/docs/reference/interfaces/IDocumentManagementUpdateRequest.md +43 -0
  30. package/docs/reference/type-aliases/DocumentContexts.md +5 -0
  31. package/docs/reference/type-aliases/DocumentTypes.md +1 -1
  32. package/docs/reference/variables/DocumentContexts.md +19 -0
  33. package/docs/reference/variables/DocumentTypes.md +6 -12
  34. package/package.json +2 -1
@@ -3,19 +3,23 @@
3
3
  ## Interfaces
4
4
 
5
5
  - [IDocument](interfaces/IDocument.md)
6
+ - [IDocumentAttestation](interfaces/IDocumentAttestation.md)
6
7
  - [IDocumentList](interfaces/IDocumentList.md)
7
8
  - [IDocumentManagementComponent](interfaces/IDocumentManagementComponent.md)
9
+ - [IDocumentManagementCreateRequest](interfaces/IDocumentManagementCreateRequest.md)
8
10
  - [IDocumentManagementGetRequest](interfaces/IDocumentManagementGetRequest.md)
9
11
  - [IDocumentManagementGetResponse](interfaces/IDocumentManagementGetResponse.md)
10
12
  - [IDocumentManagementQueryRequest](interfaces/IDocumentManagementQueryRequest.md)
11
13
  - [IDocumentManagementQueryResponse](interfaces/IDocumentManagementQueryResponse.md)
12
14
  - [IDocumentManagementRemoveRequest](interfaces/IDocumentManagementRemoveRequest.md)
13
- - [IDocumentManagementSetRequest](interfaces/IDocumentManagementSetRequest.md)
15
+ - [IDocumentManagementUpdateRequest](interfaces/IDocumentManagementUpdateRequest.md)
14
16
 
15
17
  ## Type Aliases
16
18
 
19
+ - [DocumentContexts](type-aliases/DocumentContexts.md)
17
20
  - [DocumentTypes](type-aliases/DocumentTypes.md)
18
21
 
19
22
  ## Variables
20
23
 
24
+ - [DocumentContexts](variables/DocumentContexts.md)
21
25
  - [DocumentTypes](variables/DocumentTypes.md)
@@ -132,16 +132,16 @@ The date/time of when the document was deleted, as we never actually remove item
132
132
 
133
133
  ***
134
134
 
135
- ### revisions?
135
+ ### nodeIdentity
136
136
 
137
- > `optional` **revisions**: [`IDocument`](IDocument.md)[]
137
+ > **nodeIdentity**: `string`
138
138
 
139
- The previous revisions of the document.
139
+ The node which added the document to the graph.
140
140
 
141
141
  ***
142
142
 
143
- ### revisionCursor?
143
+ ### userIdentity
144
144
 
145
- > `optional` **revisionCursor**: `string`
145
+ > **userIdentity**: `string`
146
146
 
147
- The cursor to get the next chunk of revisions.
147
+ The user who added the document to the graph.
@@ -0,0 +1,59 @@
1
+ # Interface: IDocumentAttestation
2
+
3
+ Interface describing a document attestation.
4
+
5
+ ## Properties
6
+
7
+ ### @context
8
+
9
+ > **@context**: \[`"https://schema.twindev.org/documents/"`, `"https://schema.twindev.org/common/"`, `"https://schema.org"`\]
10
+
11
+ JSON-LD Context.
12
+
13
+ ***
14
+
15
+ ### type
16
+
17
+ > **type**: `"DocumentAttestation"`
18
+
19
+ JSON-LD Type.
20
+
21
+ ***
22
+
23
+ ### documentId
24
+
25
+ > **documentId**: `string`
26
+
27
+ The id of the document.
28
+
29
+ ***
30
+
31
+ ### documentCode
32
+
33
+ > **documentCode**: `string`
34
+
35
+ The code for the document type.
36
+
37
+ ***
38
+
39
+ ### documentRevision
40
+
41
+ > **documentRevision**: `number`
42
+
43
+ The revision of the document as a 0 based index.
44
+
45
+ ***
46
+
47
+ ### dateCreated
48
+
49
+ > **dateCreated**: `string`
50
+
51
+ The date/time of when the document was created.
52
+
53
+ ***
54
+
55
+ ### blobHash
56
+
57
+ > **blobHash**: `string`
58
+
59
+ The hash of the document being attested.
@@ -1,6 +1,6 @@
1
1
  # Interface: IDocumentList
2
2
 
3
- Interface describing a document entry list.
3
+ Interface describing a list of document entries.
4
4
 
5
5
  ## Properties
6
6
 
@@ -28,6 +28,14 @@ The list of documents.
28
28
 
29
29
  ***
30
30
 
31
+ ### edges?
32
+
33
+ > `optional` **edges**: `string`[]
34
+
35
+ The ids of the other vertices which are connected to the document.
36
+
37
+ ***
38
+
31
39
  ### cursor?
32
40
 
33
41
  > `optional` **cursor**: `string`
@@ -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`?, `createAttestation`?, `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,12 +48,34 @@ The data to create the document with.
54
48
 
55
49
  Additional information to associate with the document.
56
50
 
57
- ##### createAttestation?
51
+ ##### auditableItemGraphEdges?
52
+
53
+ `object`[]
54
+
55
+ The auditable item graph vertices to connect the document to.
56
+
57
+ ##### options?
58
+
59
+ Additional options for the set operation.
60
+
61
+ ###### createAttestation?
58
62
 
59
63
  `boolean`
60
64
 
61
65
  Flag to create an attestation for the document, defaults to false.
62
66
 
67
+ ###### addAlias?
68
+
69
+ `boolean`
70
+
71
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
72
+
73
+ ###### aliasAnnotationObject?
74
+
75
+ `IJsonLdNodeObject`
76
+
77
+ Annotation object for the alias.
78
+
63
79
  ##### userIdentity?
64
80
 
65
81
  `string`
@@ -76,29 +92,77 @@ The node identity to use for vault operations.
76
92
 
77
93
  `Promise`\<`string`\>
78
94
 
79
- 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.
80
96
 
81
97
  ***
82
98
 
83
- ### get()
99
+ ### update()
84
100
 
85
- > **get**(`auditableItemGraphId`, `identifier`, `options`?, `revisionCursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IDocument`](IDocument.md)\>
101
+ > **update**(`auditableItemGraphDocumentId`, `blob?`, `annotationObject?`, `auditableItemGraphEdges?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
86
102
 
87
- 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.
88
106
 
89
107
  #### Parameters
90
108
 
91
- ##### auditableItemGraphId
109
+ ##### auditableItemGraphDocumentId
92
110
 
93
111
  `string`
94
112
 
95
- The auditable item graph vertex id to get the document from.
113
+ The auditable item graph vertex id which contains the document.
114
+
115
+ ##### blob?
116
+
117
+ `Uint8Array`\<`ArrayBufferLike`\>
96
118
 
97
- ##### identifier
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?
98
140
 
99
141
  `string`
100
142
 
101
- The identifier of the document to get.
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
160
+
161
+ ##### auditableItemGraphDocumentId
162
+
163
+ `string`
164
+
165
+ The auditable item graph vertex id which contains the document.
102
166
 
103
167
  ##### options?
104
168
 
@@ -128,17 +192,17 @@ Flag to include the attestation information for the document, defaults to false.
128
192
 
129
193
  Flag to include deleted documents, defaults to false.
130
194
 
131
- ###### maxRevisionCount?
195
+ ##### cursor?
132
196
 
133
- `number`
197
+ `string`
134
198
 
135
- Max number of revisions to return, defaults to 0.
199
+ The cursor to get the next chunk of revisions.
136
200
 
137
- ##### revisionCursor?
201
+ ##### pageSize?
138
202
 
139
- `string`
203
+ `number`
140
204
 
141
- The cursor to get the next chunk of revisions.
205
+ Page size of items to return, defaults to 1 so only most recent is returned.
142
206
 
143
207
  ##### userIdentity?
144
208
 
@@ -154,42 +218,32 @@ The node identity to use for vault operations.
154
218
 
155
219
  #### Returns
156
220
 
157
- `Promise`\<[`IDocument`](IDocument.md)\>
221
+ `Promise`\<[`IDocumentList`](IDocumentList.md)\>
158
222
 
159
223
  The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
160
224
 
161
225
  ***
162
226
 
163
- ### remove()
227
+ ### removeRevision()
164
228
 
165
- > **remove**(`auditableItemGraphId`, `identifier`, `options`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
229
+ > **removeRevision**(`auditableItemGraphDocumentId`, `revision`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
166
230
 
167
- Remove a specific document from an auditable item graph vertex.
168
- The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
231
+ Remove an auditable item graph vertex using it's id.
232
+ The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
169
233
 
170
234
  #### Parameters
171
235
 
172
- ##### auditableItemGraphId
173
-
174
- `string`
175
-
176
- The auditable item graph vertex id to remove the document from.
177
-
178
- ##### identifier
236
+ ##### auditableItemGraphDocumentId
179
237
 
180
238
  `string`
181
239
 
182
- The identifier of the document to remove.
183
-
184
- ##### options?
185
-
186
- Additional options for the remove operation.
240
+ The auditable item graph vertex id which contains the document.
187
241
 
188
- ###### removeAllRevisions?
242
+ ##### revision
189
243
 
190
- `boolean`
244
+ `number`
191
245
 
192
- Flag to remove all revisions of the document, defaults to false.
246
+ The revision of the document to remove.
193
247
 
194
248
  ##### userIdentity?
195
249
 
@@ -213,39 +267,17 @@ Nothing.
213
267
 
214
268
  ### query()
215
269
 
216
- > **query**(`auditableItemGraphId`, `documentCodes`?, `options`?, `cursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IDocumentList`](IDocumentList.md)\>
270
+ > **query**(`documentId`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IAuditableItemGraphVertexList`\>
217
271
 
218
- Query an auditable item graph vertex for documents.
272
+ Find all the document with a specific id.
219
273
 
220
274
  #### Parameters
221
275
 
222
- ##### auditableItemGraphId
276
+ ##### documentId
223
277
 
224
278
  `string`
225
279
 
226
- The auditable item graph vertex to get the documents from.
227
-
228
- ##### documentCodes?
229
-
230
- `string`[]
231
-
232
- The document codes to query for, if undefined gets all document codes.
233
-
234
- ##### options?
235
-
236
- Additional options for the query operation.
237
-
238
- ###### includeMostRecentRevisions?
239
-
240
- `boolean`
241
-
242
- Include the most recent 5 revisions, use the individual get to retrieve more.
243
-
244
- ###### includeRemoved?
245
-
246
- `boolean`
247
-
248
- Flag to include deleted documents, defaults to false.
280
+ The document id to find in the graph.
249
281
 
250
282
  ##### cursor?
251
283
 
@@ -253,6 +285,12 @@ Flag to include deleted documents, defaults to false.
253
285
 
254
286
  The cursor to get the next chunk of documents.
255
287
 
288
+ ##### pageSize?
289
+
290
+ `number`
291
+
292
+ The page size to get the next chunk of documents.
293
+
256
294
  ##### userIdentity?
257
295
 
258
296
  `string`
@@ -267,6 +305,6 @@ The node identity to use for vault operations.
267
305
 
268
306
  #### Returns
269
307
 
270
- `Promise`\<[`IDocumentList`](IDocumentList.md)\>
308
+ `Promise`\<`IAuditableItemGraphVertexList`\>
271
309
 
272
- The most recent revisions of each document, cursor is set if there are more documents.
310
+ 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,8 +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.
54
+
55
+ #### addAlias?
56
+
57
+ > `optional` **addAlias**: `boolean`
58
+
59
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
60
+
61
+ #### aliasAnnotationObject?
62
+
63
+ > `optional` **aliasAnnotationObject**: `IJsonLdNodeObject`
64
+
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
 
@@ -90,20 +84,20 @@ Include deleted documents in the response.
90
84
  false
91
85
  ```
92
86
 
93
- #### maxRevisionCount?
87
+ #### pageSize?
94
88
 
95
- > `optional` **maxRevisionCount**: `number`
89
+ > `optional` **pageSize**: `string`
96
90
 
97
- Max number of revisions to return.
91
+ Page size of items to return, defaults to 1 so only most recent is returned.
98
92
 
99
93
  ##### Default
100
94
 
101
95
  ```ts
102
- 0
96
+ 1
103
97
  ```
104
98
 
105
- #### revisionCursor?
99
+ #### cursor?
106
100
 
107
- > `optional` **revisionCursor**: `string`
101
+ > `optional` **cursor**: `string`
108
102
 
109
103
  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.
@@ -16,58 +16,26 @@ The headers which can be used to determine the response data type.
16
16
 
17
17
  ***
18
18
 
19
- ### pathParams
19
+ ### query
20
20
 
21
- > **pathParams**: `object`
22
-
23
- The path parameters.
24
-
25
- #### auditableItemGraphId
26
-
27
- > **auditableItemGraphId**: `string`
28
-
29
- The id of the auditable item graph vertex which contains the documents.
30
-
31
- ***
32
-
33
- ### query?
34
-
35
- > `optional` **query**: `object`
21
+ > **query**: `object`
36
22
 
37
23
  The query parameters.
38
24
 
39
- #### documentCodes?
40
-
41
- > `optional` **documentCodes**: `string`
42
-
43
- List of comma separated document codes to filter the query.
44
-
45
- #### includeRemoved?
25
+ #### documentId
46
26
 
47
- > `optional` **includeRemoved**: `boolean`
27
+ > **documentId**: `string`
48
28
 
49
- Include deleted documents in the response.
50
-
51
- ##### Default
52
-
53
- ```ts
54
- false
55
- ```
56
-
57
- #### includeMostRecentRevisions?
58
-
59
- > `optional` **includeMostRecentRevisions**: `boolean`
60
-
61
- Include the most recent 5 revisions, use the individual get to retrieve more.
62
-
63
- ##### Default
64
-
65
- ```ts
66
- false
67
- ```
29
+ The id of the document id we are trying to find.
68
30
 
69
31
  #### cursor?
70
32
 
71
33
  > `optional` **cursor**: `string`
72
34
 
73
35
  The cursor to get the next chunk of documents.
36
+
37
+ #### pageSize?
38
+
39
+ > `optional` **pageSize**: `string`
40
+
41
+ The number of documents to return.
@@ -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**: [`IDocumentList`](IDocumentList.md)
21
+ > **body**: `IAuditableItemGraphVertexList`
22
22
 
23
23
  The body parameters.
@@ -1,6 +1,6 @@
1
1
  # Interface: IDocumentManagementRemoveRequest
2
2
 
3
- Request to remove a document from an auditable item graph.
3
+ Request to remove a document revision from an auditable item graph.
4
4
 
5
5
  ## Properties
6
6
 
@@ -10,34 +10,14 @@ Request to remove a document from an auditable item graph.
10
10
 
11
11
  The path parameters.
12
12
 
13
- #### auditableItemGraphId
13
+ #### auditableItemGraphDocumentId
14
14
 
15
- > **auditableItemGraphId**: `string`
15
+ > **auditableItemGraphDocumentId**: `string`
16
16
 
17
- The id of the auditable item graph vertex to remove the document from.
17
+ The id of the auditable item graph vertex to remove the revision from.
18
18
 
19
- #### documentId
19
+ #### revision
20
20
 
21
- > **documentId**: `string`
21
+ > **revision**: `string`
22
22
 
23
- The full id of the document to remove.
24
-
25
- ***
26
-
27
- ### query?
28
-
29
- > `optional` **query**: `object`
30
-
31
- The query parameters.
32
-
33
- #### removeAllRevisions?
34
-
35
- > `optional` **removeAllRevisions**: `boolean`
36
-
37
- Flag to remove all revisions of the document.
38
-
39
- ##### Default
40
-
41
- ```ts
42
- false
43
- ```
23
+ The revision of the document to remove.