@twin.org/auditable-item-graph-service 0.0.3-next.8 → 0.9.0-next.2

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 (47) hide show
  1. package/README.md +3 -1
  2. package/dist/es/auditableItemGraphRoutes.js +309 -8
  3. package/dist/es/auditableItemGraphRoutes.js.map +1 -1
  4. package/dist/es/auditableItemGraphService.js +576 -95
  5. package/dist/es/auditableItemGraphService.js.map +1 -1
  6. package/dist/es/entities/auditableItemGraphAlias.js +8 -0
  7. package/dist/es/entities/auditableItemGraphAlias.js.map +1 -1
  8. package/dist/es/entities/auditableItemGraphChangeset.js +8 -0
  9. package/dist/es/entities/auditableItemGraphChangeset.js.map +1 -1
  10. package/dist/es/entities/auditableItemGraphVertex.js +9 -1
  11. package/dist/es/entities/auditableItemGraphVertex.js.map +1 -1
  12. package/dist/es/models/IAuditableItemGraphServiceConfig.js.map +1 -1
  13. package/dist/es/models/IAuditableItemGraphServiceConstructorOptions.js.map +1 -1
  14. package/dist/es/models/IAuditableItemGraphServiceContext.js +2 -0
  15. package/dist/es/models/IAuditableItemGraphServiceContext.js.map +1 -1
  16. package/dist/es/restEntryPoints.js +3 -0
  17. package/dist/es/restEntryPoints.js.map +1 -1
  18. package/dist/types/auditableItemGraphRoutes.d.ts +34 -2
  19. package/dist/types/auditableItemGraphService.d.ts +50 -71
  20. package/dist/types/entities/auditableItemGraphAlias.d.ts +4 -0
  21. package/dist/types/entities/auditableItemGraphChangeset.d.ts +4 -0
  22. package/dist/types/entities/auditableItemGraphVertex.d.ts +5 -1
  23. package/dist/types/models/IAuditableItemGraphServiceConfig.d.ts +4 -0
  24. package/dist/types/models/IAuditableItemGraphServiceConstructorOptions.d.ts +4 -0
  25. package/dist/types/models/IAuditableItemGraphServiceContext.d.ts +6 -3
  26. package/dist/types/restEntryPoints.d.ts +3 -0
  27. package/docs/changelog.md +437 -84
  28. package/docs/examples.md +241 -1
  29. package/docs/open-api/spec.json +845 -268
  30. package/docs/reference/classes/AuditableItemGraphAlias.md +18 -10
  31. package/docs/reference/classes/AuditableItemGraphChangeset.md +16 -8
  32. package/docs/reference/classes/AuditableItemGraphEdge.md +10 -10
  33. package/docs/reference/classes/AuditableItemGraphPatch.md +6 -6
  34. package/docs/reference/classes/AuditableItemGraphResource.md +9 -9
  35. package/docs/reference/classes/AuditableItemGraphService.md +135 -57
  36. package/docs/reference/classes/AuditableItemGraphVertex.md +26 -18
  37. package/docs/reference/functions/auditableItemGraphRemoveProof.md +31 -0
  38. package/docs/reference/functions/auditableItemGraphUpdate.md +1 -1
  39. package/docs/reference/functions/auditableItemGraphUpdatePartial.md +31 -0
  40. package/docs/reference/functions/auditableItemGraphVersionGet.md +31 -0
  41. package/docs/reference/functions/auditableItemGraphVersionList.md +31 -0
  42. package/docs/reference/index.md +4 -0
  43. package/docs/reference/interfaces/IAuditableItemGraphServiceConfig.md +8 -0
  44. package/docs/reference/interfaces/IAuditableItemGraphServiceConstructorOptions.md +18 -10
  45. package/docs/reference/variables/restEntryPoints.md +2 -0
  46. package/locales/en.json +6 -2
  47. package/package.json +6 -6
@@ -14,7 +14,7 @@ Class describing the auditable item graph alias.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id
17
+ ### id {#id}
18
18
 
19
19
  > **id**: `string`
20
20
 
@@ -22,15 +22,15 @@ The alternative alias for the vertex.
22
22
 
23
23
  ***
24
24
 
25
- ### aliasFormat?
25
+ ### aliasFormat? {#aliasformat}
26
26
 
27
- > `optional` **aliasFormat**: `string`
27
+ > `optional` **aliasFormat?**: `string`
28
28
 
29
29
  The format of the alias for the vertex.
30
30
 
31
31
  ***
32
32
 
33
- ### dateCreated
33
+ ### dateCreated {#datecreated}
34
34
 
35
35
  > **dateCreated**: `string`
36
36
 
@@ -38,24 +38,32 @@ The date/time of when the alias was created.
38
38
 
39
39
  ***
40
40
 
41
- ### dateModified?
41
+ ### dateModified? {#datemodified}
42
42
 
43
- > `optional` **dateModified**: `string`
43
+ > `optional` **dateModified?**: `string`
44
44
 
45
45
  The date/time of when the alias was last modified.
46
46
 
47
47
  ***
48
48
 
49
- ### dateDeleted?
49
+ ### dateDeleted? {#datedeleted}
50
50
 
51
- > `optional` **dateDeleted**: `string`
51
+ > `optional` **dateDeleted?**: `string`
52
52
 
53
53
  The timestamp of when the alias was deleted, as we never actually remove items.
54
54
 
55
55
  ***
56
56
 
57
- ### annotationObject?
57
+ ### annotationObject? {#annotationobject}
58
58
 
59
- > `optional` **annotationObject**: `IJsonLdNodeObject`
59
+ > `optional` **annotationObject?**: `IJsonLdNodeObject`
60
60
 
61
61
  Object to associate with the alias as JSON-LD.
62
+
63
+ ***
64
+
65
+ ### unique? {#unique}
66
+
67
+ > `optional` **unique?**: `boolean`
68
+
69
+ Whether the alias should be unique across the graph, meaning that no other vertex can have the same alias. Defaults to false.
@@ -14,7 +14,7 @@ Class describing a set of updates to the vertex.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id
17
+ ### id {#id}
18
18
 
19
19
  > **id**: `string`
20
20
 
@@ -22,7 +22,7 @@ The id of the changeset.
22
22
 
23
23
  ***
24
24
 
25
- ### vertexId
25
+ ### vertexId {#vertexid}
26
26
 
27
27
  > **vertexId**: `string`
28
28
 
@@ -30,7 +30,7 @@ The vertex the changeset belongs to.
30
30
 
31
31
  ***
32
32
 
33
- ### dateCreated
33
+ ### dateCreated {#datecreated}
34
34
 
35
35
  > **dateCreated**: `string`
36
36
 
@@ -38,15 +38,15 @@ The date/time of when the changeset was created.
38
38
 
39
39
  ***
40
40
 
41
- ### userIdentity?
41
+ ### userIdentity? {#useridentity}
42
42
 
43
- > `optional` **userIdentity**: `string`
43
+ > `optional` **userIdentity?**: `string`
44
44
 
45
45
  The identity of the user who made the changeset.
46
46
 
47
47
  ***
48
48
 
49
- ### patches
49
+ ### patches {#patches}
50
50
 
51
51
  > **patches**: [`AuditableItemGraphPatch`](AuditableItemGraphPatch.md)[]
52
52
 
@@ -54,8 +54,16 @@ The patches in the changeset.
54
54
 
55
55
  ***
56
56
 
57
- ### proofId?
57
+ ### proofId? {#proofid}
58
58
 
59
- > `optional` **proofId**: `string`
59
+ > `optional` **proofId?**: `string`
60
60
 
61
61
  The immutable proof id which contains the signature for this changeset.
62
+
63
+ ***
64
+
65
+ ### version? {#version}
66
+
67
+ > `optional` **version?**: `number`
68
+
69
+ The version number of the vertex after this changeset was applied.
@@ -14,7 +14,7 @@ Class describing the auditable item graph edge.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id
17
+ ### id {#id}
18
18
 
19
19
  > **id**: `string`
20
20
 
@@ -22,7 +22,7 @@ The id of the edge.
22
22
 
23
23
  ***
24
24
 
25
- ### dateCreated
25
+ ### dateCreated {#datecreated}
26
26
 
27
27
  > **dateCreated**: `string`
28
28
 
@@ -30,23 +30,23 @@ The date/time of when the edge was created.
30
30
 
31
31
  ***
32
32
 
33
- ### dateModified?
33
+ ### dateModified? {#datemodified}
34
34
 
35
- > `optional` **dateModified**: `string`
35
+ > `optional` **dateModified?**: `string`
36
36
 
37
37
  The date/time of when the edge was last modified.
38
38
 
39
39
  ***
40
40
 
41
- ### dateDeleted?
41
+ ### dateDeleted? {#datedeleted}
42
42
 
43
- > `optional` **dateDeleted**: `string`
43
+ > `optional` **dateDeleted?**: `string`
44
44
 
45
45
  The timestamp of when the edge was deleted, as we never actually remove items.
46
46
 
47
47
  ***
48
48
 
49
- ### targetId
49
+ ### targetId {#targetid}
50
50
 
51
51
  > **targetId**: `string`
52
52
 
@@ -54,7 +54,7 @@ The target id of the edge.
54
54
 
55
55
  ***
56
56
 
57
- ### edgeRelationships
57
+ ### edgeRelationships {#edgerelationships}
58
58
 
59
59
  > **edgeRelationships**: `string`[]
60
60
 
@@ -62,8 +62,8 @@ The relationships between the two vertices.
62
62
 
63
63
  ***
64
64
 
65
- ### annotationObject?
65
+ ### annotationObject? {#annotationobject}
66
66
 
67
- > `optional` **annotationObject**: `IJsonLdNodeObject`
67
+ > `optional` **annotationObject?**: `IJsonLdNodeObject`
68
68
 
69
69
  Object to associate with the edge as JSON-LD.
@@ -14,7 +14,7 @@ Class describing the auditable item graph patches.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### op
17
+ ### op {#op}
18
18
 
19
19
  > **op**: `"add"` \| `"remove"` \| `"replace"` \| `"move"` \| `"copy"` \| `"test"`
20
20
 
@@ -22,7 +22,7 @@ The operation for the patch.
22
22
 
23
23
  ***
24
24
 
25
- ### path
25
+ ### path {#path}
26
26
 
27
27
  > **path**: `string`
28
28
 
@@ -30,16 +30,16 @@ The path for the patch.
30
30
 
31
31
  ***
32
32
 
33
- ### from?
33
+ ### from? {#from}
34
34
 
35
- > `optional` **from**: `string`
35
+ > `optional` **from?**: `string`
36
36
 
37
37
  The from for the patch.
38
38
 
39
39
  ***
40
40
 
41
- ### value?
41
+ ### value? {#value}
42
42
 
43
- > `optional` **value**: `unknown`
43
+ > `optional` **value?**: `unknown`
44
44
 
45
45
  The value for the patch.
@@ -14,15 +14,15 @@ Class describing the auditable item graph vertex resource.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id?
17
+ ### id? {#id}
18
18
 
19
- > `optional` **id**: `string`
19
+ > `optional` **id?**: `string`
20
20
 
21
21
  The id of the resource.
22
22
 
23
23
  ***
24
24
 
25
- ### dateCreated
25
+ ### dateCreated {#datecreated}
26
26
 
27
27
  > **dateCreated**: `string`
28
28
 
@@ -30,24 +30,24 @@ The date/time of when the resource was created.
30
30
 
31
31
  ***
32
32
 
33
- ### dateModified?
33
+ ### dateModified? {#datemodified}
34
34
 
35
- > `optional` **dateModified**: `string`
35
+ > `optional` **dateModified?**: `string`
36
36
 
37
37
  The date/time of when the resource was last modified.
38
38
 
39
39
  ***
40
40
 
41
- ### dateDeleted?
41
+ ### dateDeleted? {#datedeleted}
42
42
 
43
- > `optional` **dateDeleted**: `string`
43
+ > `optional` **dateDeleted?**: `string`
44
44
 
45
45
  The timestamp of when the resource was deleted, as we never actually remove items.
46
46
 
47
47
  ***
48
48
 
49
- ### resourceObject?
49
+ ### resourceObject? {#resourceobject}
50
50
 
51
- > `optional` **resourceObject**: `IJsonLdNodeObject`
51
+ > `optional` **resourceObject?**: `IJsonLdNodeObject`
52
52
 
53
53
  Object to associate with the resource as JSON-LD.
@@ -28,7 +28,7 @@ The dependencies for the auditable item graph connector.
28
28
 
29
29
  ## Properties
30
30
 
31
- ### CLASS\_NAME
31
+ ### CLASS\_NAME {#class_name}
32
32
 
33
33
  > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
@@ -36,7 +36,7 @@ Runtime name for the class.
36
36
 
37
37
  ***
38
38
 
39
- ### NAMESPACE\_CHANGESET
39
+ ### NAMESPACE\_CHANGESET {#namespace_changeset}
40
40
 
41
41
  > `readonly` `static` **NAMESPACE\_CHANGESET**: `string` = `"changeset"`
42
42
 
@@ -44,7 +44,7 @@ The namespace for the service changeset.
44
44
 
45
45
  ***
46
46
 
47
- ### NAMESPACE\_EDGE
47
+ ### NAMESPACE\_EDGE {#namespace_edge}
48
48
 
49
49
  > `readonly` `static` **NAMESPACE\_EDGE**: `string` = `"edge"`
50
50
 
@@ -52,7 +52,7 @@ The namespace for the service edge.
52
52
 
53
53
  ## Methods
54
54
 
55
- ### className()
55
+ ### className() {#classname}
56
56
 
57
57
  > **className**(): `string`
58
58
 
@@ -70,7 +70,25 @@ The class name of the component.
70
70
 
71
71
  ***
72
72
 
73
- ### create()
73
+ ### start() {#start}
74
+
75
+ > **start**(): `Promise`\<`void`\>
76
+
77
+ Register all AIG metrics with the telemetry component.
78
+
79
+ #### Returns
80
+
81
+ `Promise`\<`void`\>
82
+
83
+ A promise that resolves when all metrics have been registered.
84
+
85
+ #### Implementation of
86
+
87
+ `IAuditableItemGraphComponent.start`
88
+
89
+ ***
90
+
91
+ ### create() {#create}
74
92
 
75
93
  > **create**(`vertex`): `Promise`\<`string`\>
76
94
 
@@ -80,45 +98,77 @@ Create a new graph vertex.
80
98
 
81
99
  ##### vertex
82
100
 
101
+ `Omit`\<`IAuditableItemGraphVertex`, `"id"`\>
102
+
83
103
  The vertex to create.
84
104
 
85
- ###### annotationObject?
105
+ #### Returns
86
106
 
87
- `IJsonLdNodeObject`
107
+ `Promise`\<`string`\>
88
108
 
89
- The annotation object for the vertex as JSON-LD.
109
+ The id of the new graph item.
90
110
 
91
- ###### aliases?
111
+ #### Implementation of
92
112
 
93
- `object`[]
113
+ `IAuditableItemGraphComponent.create`
94
114
 
95
- Alternative aliases that can be used to identify the vertex.
115
+ ***
96
116
 
97
- ###### resources?
117
+ ### update() {#update}
118
+
119
+ > **update**(`vertex`): `Promise`\<`void`\>
98
120
 
99
- `object`[]
121
+ Update a graph vertex (PUT — full replacement of vertex state).
122
+ Concurrent updates for the same vertex are serialized via `Mutex` on the vertex id.
100
123
 
101
- The resources attached to the vertex.
124
+ #### Parameters
102
125
 
103
- ###### edges?
126
+ ##### vertex
104
127
 
105
- `object`[]
128
+ `IAuditableItemGraphVertex`
106
129
 
107
- The edges connected to the vertex.
130
+ The vertex to update.
108
131
 
109
132
  #### Returns
110
133
 
111
- `Promise`\<`string`\>
134
+ `Promise`\<`void`\>
112
135
 
113
- The id of the new graph item.
136
+ A promise that resolves when the vertex has been updated.
114
137
 
115
138
  #### Implementation of
116
139
 
117
- `IAuditableItemGraphComponent.create`
140
+ `IAuditableItemGraphComponent.update`
118
141
 
119
142
  ***
120
143
 
121
- ### get()
144
+ ### updatePartial() {#updatepartial}
145
+
146
+ > **updatePartial**(`partial`): `Promise`\<`void`\>
147
+
148
+ Partially update a graph vertex (PATCH — explicit list patches; only defined properties applied).
149
+ Serialized with `update` via `Mutex` on the same vertex id within this instance.
150
+
151
+ #### Parameters
152
+
153
+ ##### partial
154
+
155
+ `IAuditableItemGraphPartialVertex`
156
+
157
+ The partial vertex update.
158
+
159
+ #### Returns
160
+
161
+ `Promise`\<`void`\>
162
+
163
+ A promise that resolves when the partial update has been applied.
164
+
165
+ #### Implementation of
166
+
167
+ `IAuditableItemGraphComponent.updatePartial`
168
+
169
+ ***
170
+
171
+ ### get() {#get}
122
172
 
123
173
  > **get**(`id`, `options?`): `Promise`\<`IAuditableItemGraphVertex`\>
124
174
 
@@ -164,7 +214,7 @@ NotFoundError if the vertex is not found.
164
214
 
165
215
  ***
166
216
 
167
- ### getChangesets()
217
+ ### getChangesets() {#getchangesets}
168
218
 
169
219
  > **getChangesets**(`id`, `cursor?`, `limit?`, `options?`): `Promise`\<\{ `changesets`: `IAuditableItemGraphChangesetList`; `cursor?`: `string`; \}\>
170
220
 
@@ -216,7 +266,7 @@ NotFoundError if the vertex is not found.
216
266
 
217
267
  ***
218
268
 
219
- ### getChangeset()
269
+ ### getChangeset() {#getchangeset}
220
270
 
221
271
  > **getChangeset**(`id`, `options?`): `Promise`\<`IAuditableItemGraphChangeset`\>
222
272
 
@@ -256,65 +306,93 @@ NotFoundError if the vertex is not found.
256
306
 
257
307
  ***
258
308
 
259
- ### update()
309
+ ### getVersion() {#getversion}
260
310
 
261
- > **update**(`vertex`): `Promise`\<`void`\>
311
+ > **getVersion**(`id`, `version`): `Promise`\<`IAuditableItemGraphVertex`\>
262
312
 
263
- Update a graph vertex.
313
+ Get a graph vertex at a specific version.
264
314
 
265
315
  #### Parameters
266
316
 
267
- ##### vertex
317
+ ##### id
268
318
 
269
- The vertex to update.
319
+ `string`
270
320
 
271
- ###### id
321
+ The id of the vertex.
272
322
 
273
- `string`
323
+ ##### version
324
+
325
+ `number`
274
326
 
275
- The id of the vertex to update.
327
+ The version number to retrieve.
276
328
 
277
- ###### annotationObject?
329
+ #### Returns
278
330
 
279
- `IJsonLdNodeObject`
331
+ `Promise`\<`IAuditableItemGraphVertex`\>
280
332
 
281
- The annotation object for the vertex as JSON-LD.
333
+ The vertex reconstructed at that version.
282
334
 
283
- ###### aliases?
335
+ #### Throws
284
336
 
285
- `object`[]
337
+ NotFoundError if the vertex or version is not found.
286
338
 
287
- Alternative aliases that can be used to identify the vertex.
339
+ #### Implementation of
288
340
 
289
- ###### resources?
341
+ `IAuditableItemGraphComponent.getVersion`
290
342
 
291
- `object`[]
343
+ ***
292
344
 
293
- The resources attached to the vertex.
345
+ ### getVersions() {#getversions}
294
346
 
295
- ###### edges?
347
+ > **getVersions**(`id`, `options?`): `Promise`\<`IAuditableItemGraphVertexVersionList`\>
296
348
 
297
- `object`[]
349
+ Get all versions of a graph vertex.
298
350
 
299
- The edges connected to the vertex.
351
+ #### Parameters
352
+
353
+ ##### id
354
+
355
+ `string`
356
+
357
+ The id of the vertex.
358
+
359
+ ##### options?
360
+
361
+ Additional options for the operation.
362
+
363
+ ###### after?
364
+
365
+ `string`
366
+
367
+ Only return versions created after this ISO 8601 timestamp (exclusive).
368
+
369
+ ###### before?
370
+
371
+ `string`
372
+
373
+ Only return versions created before this ISO 8601 timestamp (exclusive).
300
374
 
301
375
  #### Returns
302
376
 
303
- `Promise`\<`void`\>
377
+ `Promise`\<`IAuditableItemGraphVertexVersionList`\>
378
+
379
+ The list of vertex versions.
380
+
381
+ #### Throws
304
382
 
305
- Nothing.
383
+ NotFoundError if the vertex is not found.
306
384
 
307
385
  #### Implementation of
308
386
 
309
- `IAuditableItemGraphComponent.update`
387
+ `IAuditableItemGraphComponent.getVersions`
310
388
 
311
389
  ***
312
390
 
313
- ### removeVerifiable()
391
+ ### removeProof() {#removeproof}
314
392
 
315
- > **removeVerifiable**(`id`): `Promise`\<`void`\>
393
+ > **removeProof**(`id`): `Promise`\<`void`\>
316
394
 
317
- Remove the verifiable storage for an item.
395
+ Remove the proof for an item.
318
396
 
319
397
  #### Parameters
320
398
 
@@ -322,13 +400,13 @@ Remove the verifiable storage for an item.
322
400
 
323
401
  `string`
324
402
 
325
- The id of the vertex to get.
403
+ The id of the vertex to remove the proof from.
326
404
 
327
405
  #### Returns
328
406
 
329
407
  `Promise`\<`void`\>
330
408
 
331
- Nothing.
409
+ A promise that resolves when the proof has been removed from all changesets.
332
410
 
333
411
  #### Throws
334
412
 
@@ -336,11 +414,11 @@ NotFoundError if the vertex is not found.
336
414
 
337
415
  #### Implementation of
338
416
 
339
- `IAuditableItemGraphComponent.removeVerifiable`
417
+ `IAuditableItemGraphComponent.removeProof`
340
418
 
341
419
  ***
342
420
 
343
- ### query()
421
+ ### query() {#query}
344
422
 
345
423
  > **query**(`options?`, `conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuditableItemGraphVertexList`; `cursor?`: `string`; \}\>
346
424
 
@@ -370,7 +448,7 @@ Look in id, alias or both, defaults to both.
370
448
 
371
449
  Find only exact matches, default to false meaning partial matching.
372
450
 
373
- ###### includesResourceTypes?
451
+ ###### resourceTypes?
374
452
 
375
453
  `string`[]
376
454
 
@@ -378,15 +456,15 @@ Include vertices with specific resource types.
378
456
 
379
457
  ##### conditions?
380
458
 
381
- `IComparator`[]
459
+ `EntityCondition`\<`IAuditableItemGraphVertex`\>
382
460
 
383
461
  Conditions to use in the query.
384
462
 
385
463
  ##### orderBy?
386
464
 
387
- The order for the results, defaults to created.
465
+ `"dateCreated"` \| `"dateModified"`
388
466
 
389
- `"dateCreated"` | `"dateModified"`
467
+ The order for the results, defaults to created.
390
468
 
391
469
  ##### orderByDirection?
392
470