@twin.org/auditable-item-graph-service 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 (39) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/dist/cjs/index.cjs +1606 -0
  4. package/dist/esm/index.mjs +1596 -0
  5. package/dist/types/auditableItemGraphRoutes.d.ts +45 -0
  6. package/dist/types/auditableItemGraphService.d.ts +123 -0
  7. package/dist/types/entities/auditableItemGraphAlias.d.ts +30 -0
  8. package/dist/types/entities/auditableItemGraphChangeset.d.ts +30 -0
  9. package/dist/types/entities/auditableItemGraphEdge.d.ts +30 -0
  10. package/dist/types/entities/auditableItemGraphPatch.d.ts +21 -0
  11. package/dist/types/entities/auditableItemGraphResource.d.ts +26 -0
  12. package/dist/types/entities/auditableItemGraphVertex.d.ts +45 -0
  13. package/dist/types/index.d.ts +11 -0
  14. package/dist/types/models/IAuditableItemGraphServiceConfig.d.ts +5 -0
  15. package/dist/types/models/IAuditableItemGraphServiceContext.d.ts +17 -0
  16. package/dist/types/restEntryPoints.d.ts +2 -0
  17. package/dist/types/schema.d.ts +4 -0
  18. package/docs/changelog.md +5 -0
  19. package/docs/examples.md +1 -0
  20. package/docs/open-api/spec.json +1032 -0
  21. package/docs/reference/classes/AuditableItemGraphAlias.md +61 -0
  22. package/docs/reference/classes/AuditableItemGraphChangeset.md +61 -0
  23. package/docs/reference/classes/AuditableItemGraphEdge.md +61 -0
  24. package/docs/reference/classes/AuditableItemGraphPatch.md +45 -0
  25. package/docs/reference/classes/AuditableItemGraphResource.md +53 -0
  26. package/docs/reference/classes/AuditableItemGraphService.md +289 -0
  27. package/docs/reference/classes/AuditableItemGraphVertex.md +85 -0
  28. package/docs/reference/functions/auditableItemGraphCreate.md +25 -0
  29. package/docs/reference/functions/auditableItemGraphGet.md +25 -0
  30. package/docs/reference/functions/auditableItemGraphList.md +25 -0
  31. package/docs/reference/functions/auditableItemGraphUpdate.md +25 -0
  32. package/docs/reference/functions/generateRestRoutesAuditableItemGraph.md +21 -0
  33. package/docs/reference/functions/initSchema.md +9 -0
  34. package/docs/reference/index.md +29 -0
  35. package/docs/reference/interfaces/IAuditableItemGraphServiceConfig.md +3 -0
  36. package/docs/reference/variables/restEntryPoints.md +3 -0
  37. package/docs/reference/variables/tagsAuditableItemGraph.md +5 -0
  38. package/locales/en.json +19 -0
  39. package/package.json +51 -0
@@ -0,0 +1,61 @@
1
+ # Class: AuditableItemGraphAlias
2
+
3
+ Class describing the auditable item graph alias.
4
+
5
+ ## Constructors
6
+
7
+ ### new AuditableItemGraphAlias()
8
+
9
+ > **new AuditableItemGraphAlias**(): [`AuditableItemGraphAlias`](AuditableItemGraphAlias.md)
10
+
11
+ #### Returns
12
+
13
+ [`AuditableItemGraphAlias`](AuditableItemGraphAlias.md)
14
+
15
+ ## Properties
16
+
17
+ ### id
18
+
19
+ > **id**: `string`
20
+
21
+ The alternative alias for the vertex.
22
+
23
+ ***
24
+
25
+ ### aliasFormat?
26
+
27
+ > `optional` **aliasFormat**: `string`
28
+
29
+ The format of the alias for the vertex.
30
+
31
+ ***
32
+
33
+ ### dateCreated
34
+
35
+ > **dateCreated**: `string`
36
+
37
+ The date/time of when the alias was created.
38
+
39
+ ***
40
+
41
+ ### dateModified?
42
+
43
+ > `optional` **dateModified**: `string`
44
+
45
+ The date/time of when the alias was last modified.
46
+
47
+ ***
48
+
49
+ ### dateDeleted?
50
+
51
+ > `optional` **dateDeleted**: `string`
52
+
53
+ The timestamp of when the alias was deleted, as we never actually remove items.
54
+
55
+ ***
56
+
57
+ ### aliasObject?
58
+
59
+ > `optional` **aliasObject**: `IJsonLdNodeObject`
60
+
61
+ Object to associate with the alias as JSON-LD.
@@ -0,0 +1,61 @@
1
+ # Class: AuditableItemGraphChangeset
2
+
3
+ Class describing a set of updates to the vertex.
4
+
5
+ ## Constructors
6
+
7
+ ### new AuditableItemGraphChangeset()
8
+
9
+ > **new AuditableItemGraphChangeset**(): [`AuditableItemGraphChangeset`](AuditableItemGraphChangeset.md)
10
+
11
+ #### Returns
12
+
13
+ [`AuditableItemGraphChangeset`](AuditableItemGraphChangeset.md)
14
+
15
+ ## Properties
16
+
17
+ ### id
18
+
19
+ > **id**: `string`
20
+
21
+ The id of the changeset.
22
+
23
+ ***
24
+
25
+ ### vertexId
26
+
27
+ > **vertexId**: `string`
28
+
29
+ The vertex the changeset belongs to.
30
+
31
+ ***
32
+
33
+ ### dateCreated
34
+
35
+ > **dateCreated**: `string`
36
+
37
+ The date/time of when the changeset was created.
38
+
39
+ ***
40
+
41
+ ### userIdentity
42
+
43
+ > **userIdentity**: `string`
44
+
45
+ The identity of the user who made the changeset.
46
+
47
+ ***
48
+
49
+ ### patches
50
+
51
+ > **patches**: [`AuditableItemGraphPatch`](AuditableItemGraphPatch.md)[]
52
+
53
+ The patches in the changeset.
54
+
55
+ ***
56
+
57
+ ### proofId
58
+
59
+ > **proofId**: `string`
60
+
61
+ The immutable proof id which contains the signature for this changeset.
@@ -0,0 +1,61 @@
1
+ # Class: AuditableItemGraphEdge
2
+
3
+ Class describing the auditable item graph edge.
4
+
5
+ ## Constructors
6
+
7
+ ### new AuditableItemGraphEdge()
8
+
9
+ > **new AuditableItemGraphEdge**(): [`AuditableItemGraphEdge`](AuditableItemGraphEdge.md)
10
+
11
+ #### Returns
12
+
13
+ [`AuditableItemGraphEdge`](AuditableItemGraphEdge.md)
14
+
15
+ ## Properties
16
+
17
+ ### id
18
+
19
+ > **id**: `string`
20
+
21
+ The id of the edge.
22
+
23
+ ***
24
+
25
+ ### dateCreated
26
+
27
+ > **dateCreated**: `string`
28
+
29
+ The date/time of when the edge was created.
30
+
31
+ ***
32
+
33
+ ### dateModified?
34
+
35
+ > `optional` **dateModified**: `string`
36
+
37
+ The date/time of when the edge was last modified.
38
+
39
+ ***
40
+
41
+ ### dateDeleted?
42
+
43
+ > `optional` **dateDeleted**: `string`
44
+
45
+ The timestamp of when the edge was deleted, as we never actually remove items.
46
+
47
+ ***
48
+
49
+ ### edgeRelationship
50
+
51
+ > **edgeRelationship**: `string`
52
+
53
+ The relationship between the two vertices.
54
+
55
+ ***
56
+
57
+ ### edgeObject?
58
+
59
+ > `optional` **edgeObject**: `IJsonLdNodeObject`
60
+
61
+ Object to associate with the edge as JSON-LD.
@@ -0,0 +1,45 @@
1
+ # Class: AuditableItemGraphPatch
2
+
3
+ Class describing the auditable item graph patches.
4
+
5
+ ## Constructors
6
+
7
+ ### new AuditableItemGraphPatch()
8
+
9
+ > **new AuditableItemGraphPatch**(): [`AuditableItemGraphPatch`](AuditableItemGraphPatch.md)
10
+
11
+ #### Returns
12
+
13
+ [`AuditableItemGraphPatch`](AuditableItemGraphPatch.md)
14
+
15
+ ## Properties
16
+
17
+ ### op
18
+
19
+ > **op**: `"replace"` \| `"add"` \| `"remove"` \| `"copy"` \| `"move"` \| `"test"`
20
+
21
+ The operation for the patch.
22
+
23
+ ***
24
+
25
+ ### path
26
+
27
+ > **path**: `string`
28
+
29
+ The path for the patch.
30
+
31
+ ***
32
+
33
+ ### from?
34
+
35
+ > `optional` **from**: `string`
36
+
37
+ The from for the patch.
38
+
39
+ ***
40
+
41
+ ### value?
42
+
43
+ > `optional` **value**: `unknown`
44
+
45
+ The value for the patch.
@@ -0,0 +1,53 @@
1
+ # Class: AuditableItemGraphResource
2
+
3
+ Class describing the auditable item graph vertex resource.
4
+
5
+ ## Constructors
6
+
7
+ ### new AuditableItemGraphResource()
8
+
9
+ > **new AuditableItemGraphResource**(): [`AuditableItemGraphResource`](AuditableItemGraphResource.md)
10
+
11
+ #### Returns
12
+
13
+ [`AuditableItemGraphResource`](AuditableItemGraphResource.md)
14
+
15
+ ## Properties
16
+
17
+ ### id
18
+
19
+ > **id**: `string`
20
+
21
+ The id of the resource.
22
+
23
+ ***
24
+
25
+ ### dateCreated
26
+
27
+ > **dateCreated**: `string`
28
+
29
+ The date/time of when the resource was created.
30
+
31
+ ***
32
+
33
+ ### dateModified?
34
+
35
+ > `optional` **dateModified**: `string`
36
+
37
+ The date/time of when the resource was last modified.
38
+
39
+ ***
40
+
41
+ ### dateDeleted?
42
+
43
+ > `optional` **dateDeleted**: `string`
44
+
45
+ The timestamp of when the resource was deleted, as we never actually remove items.
46
+
47
+ ***
48
+
49
+ ### resourceObject?
50
+
51
+ > `optional` **resourceObject**: `IJsonLdNodeObject`
52
+
53
+ Object to associate with the resource as JSON-LD.
@@ -0,0 +1,289 @@
1
+ # Class: AuditableItemGraphService
2
+
3
+ Class for performing auditable item graph operations.
4
+
5
+ ## Implements
6
+
7
+ - `IAuditableItemGraphComponent`
8
+
9
+ ## Constructors
10
+
11
+ ### new AuditableItemGraphService()
12
+
13
+ > **new AuditableItemGraphService**(`options`?): [`AuditableItemGraphService`](AuditableItemGraphService.md)
14
+
15
+ Create a new instance of AuditableItemGraphService.
16
+
17
+ #### Parameters
18
+
19
+ • **options?**
20
+
21
+ The dependencies for the auditable item graph connector.
22
+
23
+ • **options.immutableProofComponentType?**: `string`
24
+
25
+ The immutable proof component type, defaults to "immutable-proof".
26
+
27
+ • **options.vertexEntityStorageType?**: `string`
28
+
29
+ The entity storage for vertices, defaults to "auditable-item-graph-vertex".
30
+
31
+ • **options.changesetEntityStorageType?**: `string`
32
+
33
+ The entity storage for changesets, defaults to "auditable-item-graph-changeset".
34
+
35
+ • **options.config?**: [`IAuditableItemGraphServiceConfig`](../interfaces/IAuditableItemGraphServiceConfig.md)
36
+
37
+ The configuration for the connector.
38
+
39
+ #### Returns
40
+
41
+ [`AuditableItemGraphService`](AuditableItemGraphService.md)
42
+
43
+ ## Properties
44
+
45
+ ### NAMESPACE
46
+
47
+ > `readonly` `static` **NAMESPACE**: `string` = `"aig"`
48
+
49
+ The namespace for the service.
50
+
51
+ ***
52
+
53
+ ### NAMESPACE\_CHANGESET
54
+
55
+ > `readonly` `static` **NAMESPACE\_CHANGESET**: `string` = `"changeset"`
56
+
57
+ The namespace for the service changeset.
58
+
59
+ ***
60
+
61
+ ### CLASS\_NAME
62
+
63
+ > `readonly` **CLASS\_NAME**: `string`
64
+
65
+ Runtime name for the class.
66
+
67
+ #### Implementation of
68
+
69
+ `IAuditableItemGraphComponent.CLASS_NAME`
70
+
71
+ ## Methods
72
+
73
+ ### create()
74
+
75
+ > **create**(`vertexObject`?, `aliases`?, `resources`?, `edges`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
76
+
77
+ Create a new graph vertex.
78
+
79
+ #### Parameters
80
+
81
+ • **vertexObject?**: `IJsonLdNodeObject`
82
+
83
+ The object for the vertex as JSON-LD.
84
+
85
+ • **aliases?**: `object`[]
86
+
87
+ Alternative aliases that can be used to identify the vertex.
88
+
89
+ • **resources?**: `object`[]
90
+
91
+ The resources attached to the vertex.
92
+
93
+ • **edges?**: `object`[]
94
+
95
+ The edges connected to the vertex.
96
+
97
+ • **userIdentity?**: `string`
98
+
99
+ The identity to create the auditable item graph operation with.
100
+
101
+ • **nodeIdentity?**: `string`
102
+
103
+ The node identity to include in the auditable item graph.
104
+
105
+ #### Returns
106
+
107
+ `Promise`\<`string`\>
108
+
109
+ The id of the new graph item.
110
+
111
+ #### Implementation of
112
+
113
+ `IAuditableItemGraphComponent.create`
114
+
115
+ ***
116
+
117
+ ### get()
118
+
119
+ > **get**(`id`, `options`?): `Promise`\<`IAuditableItemGraphVertex`\>
120
+
121
+ Get a graph vertex.
122
+
123
+ #### Parameters
124
+
125
+ • **id**: `string`
126
+
127
+ The id of the vertex to get.
128
+
129
+ • **options?**
130
+
131
+ Additional options for the get operation.
132
+
133
+ • **options.includeDeleted?**: `boolean`
134
+
135
+ Whether to include deleted/updated aliases, resource, edges, defaults to false.
136
+
137
+ • **options.includeChangesets?**: `boolean`
138
+
139
+ Whether to include the changesets of the vertex, defaults to false.
140
+
141
+ • **options.verifySignatureDepth?**: `VerifyDepth`
142
+
143
+ How many signatures to verify, defaults to "none".
144
+
145
+ #### Returns
146
+
147
+ `Promise`\<`IAuditableItemGraphVertex`\>
148
+
149
+ The vertex if found.
150
+
151
+ #### Throws
152
+
153
+ NotFoundError if the vertex is not found.
154
+
155
+ #### Implementation of
156
+
157
+ `IAuditableItemGraphComponent.get`
158
+
159
+ ***
160
+
161
+ ### update()
162
+
163
+ > **update**(`id`, `vertexObject`?, `aliases`?, `resources`?, `edges`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
164
+
165
+ Update a graph vertex.
166
+
167
+ #### Parameters
168
+
169
+ • **id**: `string`
170
+
171
+ The id of the vertex to update.
172
+
173
+ • **vertexObject?**: `IJsonLdNodeObject`
174
+
175
+ The object for the vertex.
176
+
177
+ • **aliases?**: `object`[]
178
+
179
+ Alternative aliases that can be used to identify the vertex.
180
+
181
+ • **resources?**: `object`[]
182
+
183
+ The resources attached to the vertex.
184
+
185
+ • **edges?**: `object`[]
186
+
187
+ The edges connected to the vertex.
188
+
189
+ • **userIdentity?**: `string`
190
+
191
+ The identity to create the auditable item graph operation with.
192
+
193
+ • **nodeIdentity?**: `string`
194
+
195
+ The node identity to include in the auditable item graph.
196
+
197
+ #### Returns
198
+
199
+ `Promise`\<`void`\>
200
+
201
+ Nothing.
202
+
203
+ #### Implementation of
204
+
205
+ `IAuditableItemGraphComponent.update`
206
+
207
+ ***
208
+
209
+ ### removeImmutable()
210
+
211
+ > **removeImmutable**(`id`, `nodeIdentity`?): `Promise`\<`void`\>
212
+
213
+ Remove the immutable storage for an item.
214
+
215
+ #### Parameters
216
+
217
+ • **id**: `string`
218
+
219
+ The id of the vertex to get.
220
+
221
+ • **nodeIdentity?**: `string`
222
+
223
+ The node identity to use for vault operations.
224
+
225
+ #### Returns
226
+
227
+ `Promise`\<`void`\>
228
+
229
+ Nothing.
230
+
231
+ #### Throws
232
+
233
+ NotFoundError if the vertex is not found.
234
+
235
+ #### Implementation of
236
+
237
+ `IAuditableItemGraphComponent.removeImmutable`
238
+
239
+ ***
240
+
241
+ ### query()
242
+
243
+ > **query**(`options`?, `orderBy`?, `orderByDirection`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`IAuditableItemGraphVertexList`\>
244
+
245
+ Query the graph for vertices.
246
+
247
+ #### Parameters
248
+
249
+ • **options?**
250
+
251
+ The query options.
252
+
253
+ • **options.id?**: `string`
254
+
255
+ The optional id to look for.
256
+
257
+ • **options.idMode?**: `"both"` \| `"id"` \| `"alias"`
258
+
259
+ Look in id, alias or both, defaults to both.
260
+
261
+ • **orderBy?**: `"dateCreated"` \| `"dateModified"`
262
+
263
+ The order for the results, defaults to created.
264
+
265
+ • **orderByDirection?**: `SortDirection`
266
+
267
+ The direction for the order, defaults to desc.
268
+
269
+ • **properties?**: keyof `IAuditableItemGraphVertex`[]
270
+
271
+ The properties to return, if not provided defaults to id, created, aliases and object.
272
+
273
+ • **cursor?**: `string`
274
+
275
+ The cursor to request the next page of entities.
276
+
277
+ • **pageSize?**: `number`
278
+
279
+ The maximum number of entities in a page.
280
+
281
+ #### Returns
282
+
283
+ `Promise`\<`IAuditableItemGraphVertexList`\>
284
+
285
+ The entities, which can be partial if a limited keys list was provided.
286
+
287
+ #### Implementation of
288
+
289
+ `IAuditableItemGraphComponent.query`
@@ -0,0 +1,85 @@
1
+ # Class: AuditableItemGraphVertex
2
+
3
+ Class describing the auditable item graph vertex.
4
+
5
+ ## Constructors
6
+
7
+ ### new AuditableItemGraphVertex()
8
+
9
+ > **new AuditableItemGraphVertex**(): [`AuditableItemGraphVertex`](AuditableItemGraphVertex.md)
10
+
11
+ #### Returns
12
+
13
+ [`AuditableItemGraphVertex`](AuditableItemGraphVertex.md)
14
+
15
+ ## Properties
16
+
17
+ ### id
18
+
19
+ > **id**: `string`
20
+
21
+ The id of the vertex.
22
+
23
+ ***
24
+
25
+ ### nodeIdentity?
26
+
27
+ > `optional` **nodeIdentity**: `string`
28
+
29
+ The identity of the node which controls the vertex.
30
+
31
+ ***
32
+
33
+ ### dateCreated
34
+
35
+ > **dateCreated**: `string`
36
+
37
+ The date/time of when the vertex was created.
38
+
39
+ ***
40
+
41
+ ### dateModified?
42
+
43
+ > `optional` **dateModified**: `string`
44
+
45
+ The date/time of when the vertex was last modified.
46
+
47
+ ***
48
+
49
+ ### aliasIndex?
50
+
51
+ > `optional` **aliasIndex**: `string`
52
+
53
+ Combined alias index for the vertex used for querying.
54
+
55
+ ***
56
+
57
+ ### vertexObject?
58
+
59
+ > `optional` **vertexObject**: `IJsonLdNodeObject`
60
+
61
+ Object to associate with the vertex as JSON-LD.
62
+
63
+ ***
64
+
65
+ ### aliases?
66
+
67
+ > `optional` **aliases**: [`AuditableItemGraphAlias`](AuditableItemGraphAlias.md)[]
68
+
69
+ Alternative aliases that can be used to identify the vertex.
70
+
71
+ ***
72
+
73
+ ### resources?
74
+
75
+ > `optional` **resources**: [`AuditableItemGraphResource`](AuditableItemGraphResource.md)[]
76
+
77
+ The resources attached to the vertex.
78
+
79
+ ***
80
+
81
+ ### edges?
82
+
83
+ > `optional` **edges**: [`AuditableItemGraphEdge`](AuditableItemGraphEdge.md)[]
84
+
85
+ Edges connected to the vertex.
@@ -0,0 +1,25 @@
1
+ # Function: auditableItemGraphCreate()
2
+
3
+ > **auditableItemGraphCreate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
4
+
5
+ Create the graph vertex.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes.
16
+
17
+ • **request**: `IAuditableItemGraphCreateRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`ICreatedResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: auditableItemGraphGet()
2
+
3
+ > **auditableItemGraphGet**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAuditableItemGraphGetResponse`\>
4
+
5
+ Get the graph vertex.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes.
16
+
17
+ • **request**: `IAuditableItemGraphGetRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`IAuditableItemGraphGetResponse`\>
24
+
25
+ The response object with additional http response properties.