@3sixty/auditable-item-graph-rest-client 0.0.0-stage → 0.20.0-next.1
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.
- package/LICENSE +201 -0
- package/README.md +26 -2
- package/dist/es/auditableItemGraphRestClient.js +267 -0
- package/dist/es/auditableItemGraphRestClient.js.map +1 -0
- package/dist/es/index.js +4 -0
- package/dist/es/index.js.map +1 -0
- package/dist/types/auditableItemGraphRestClient.d.ts +143 -0
- package/dist/types/index.d.ts +1 -0
- package/docs/changelog.md +16 -0
- package/docs/examples.md +119 -0
- package/docs/reference/classes/AuditableItemGraphRestClient.md +468 -0
- package/docs/reference/index.md +5 -0
- package/locales/en.json +1 -0
- package/package.json +54 -5
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# Class: AuditableItemGraphRestClient
|
|
2
|
+
|
|
3
|
+
Client for performing auditable item graph through to REST endpoints.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `BaseRestClient`
|
|
8
|
+
|
|
9
|
+
## Implements
|
|
10
|
+
|
|
11
|
+
- `IAuditableItemGraphComponent`
|
|
12
|
+
|
|
13
|
+
## Constructors
|
|
14
|
+
|
|
15
|
+
### Constructor
|
|
16
|
+
|
|
17
|
+
> **new AuditableItemGraphRestClient**(`config`): `AuditableItemGraphRestClient`
|
|
18
|
+
|
|
19
|
+
Create a new instance of AuditableItemGraphRestClient.
|
|
20
|
+
|
|
21
|
+
#### Parameters
|
|
22
|
+
|
|
23
|
+
##### config
|
|
24
|
+
|
|
25
|
+
`IBaseRestClientConfig`
|
|
26
|
+
|
|
27
|
+
The configuration for the client.
|
|
28
|
+
|
|
29
|
+
#### Returns
|
|
30
|
+
|
|
31
|
+
`AuditableItemGraphRestClient`
|
|
32
|
+
|
|
33
|
+
#### Overrides
|
|
34
|
+
|
|
35
|
+
`BaseRestClient.constructor`
|
|
36
|
+
|
|
37
|
+
## Properties
|
|
38
|
+
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
|
+
|
|
41
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
|
+
|
|
43
|
+
Runtime name for the class.
|
|
44
|
+
|
|
45
|
+
## Methods
|
|
46
|
+
|
|
47
|
+
### className() {#classname}
|
|
48
|
+
|
|
49
|
+
> **className**(): `string`
|
|
50
|
+
|
|
51
|
+
Returns the class name of the component.
|
|
52
|
+
|
|
53
|
+
#### Returns
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
The class name of the component.
|
|
58
|
+
|
|
59
|
+
#### Implementation of
|
|
60
|
+
|
|
61
|
+
`IAuditableItemGraphComponent.className`
|
|
62
|
+
|
|
63
|
+
***
|
|
64
|
+
|
|
65
|
+
### create() {#create}
|
|
66
|
+
|
|
67
|
+
> **create**(`vertex`): `Promise`\<`string`\>
|
|
68
|
+
|
|
69
|
+
Create a new graph vertex.
|
|
70
|
+
|
|
71
|
+
#### Parameters
|
|
72
|
+
|
|
73
|
+
##### vertex
|
|
74
|
+
|
|
75
|
+
`Omit`\<`IAuditableItemGraphVertex`, `"id"`\>
|
|
76
|
+
|
|
77
|
+
The vertex to create.
|
|
78
|
+
|
|
79
|
+
#### Returns
|
|
80
|
+
|
|
81
|
+
`Promise`\<`string`\>
|
|
82
|
+
|
|
83
|
+
The id of the new graph item.
|
|
84
|
+
|
|
85
|
+
#### Implementation of
|
|
86
|
+
|
|
87
|
+
`IAuditableItemGraphComponent.create`
|
|
88
|
+
|
|
89
|
+
***
|
|
90
|
+
|
|
91
|
+
### get() {#get}
|
|
92
|
+
|
|
93
|
+
> **get**(`id`, `options?`): `Promise`\<`IAuditableItemGraphVertex`\>
|
|
94
|
+
|
|
95
|
+
Get a graph vertex.
|
|
96
|
+
|
|
97
|
+
#### Parameters
|
|
98
|
+
|
|
99
|
+
##### id
|
|
100
|
+
|
|
101
|
+
`string`
|
|
102
|
+
|
|
103
|
+
The id of the vertex to get.
|
|
104
|
+
|
|
105
|
+
##### options?
|
|
106
|
+
|
|
107
|
+
Additional options for the get operation.
|
|
108
|
+
|
|
109
|
+
###### includeDeleted?
|
|
110
|
+
|
|
111
|
+
`boolean`
|
|
112
|
+
|
|
113
|
+
Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
114
|
+
|
|
115
|
+
###### verifySignatureDepth?
|
|
116
|
+
|
|
117
|
+
`VerifyDepth`
|
|
118
|
+
|
|
119
|
+
How many signatures to verify, defaults to "none".
|
|
120
|
+
|
|
121
|
+
#### Returns
|
|
122
|
+
|
|
123
|
+
`Promise`\<`IAuditableItemGraphVertex`\>
|
|
124
|
+
|
|
125
|
+
The vertex if found.
|
|
126
|
+
|
|
127
|
+
#### Throws
|
|
128
|
+
|
|
129
|
+
NotFoundError if the vertex is not found.
|
|
130
|
+
|
|
131
|
+
#### Implementation of
|
|
132
|
+
|
|
133
|
+
`IAuditableItemGraphComponent.get`
|
|
134
|
+
|
|
135
|
+
***
|
|
136
|
+
|
|
137
|
+
### getChangesets() {#getchangesets}
|
|
138
|
+
|
|
139
|
+
> **getChangesets**(`id`, `cursor?`, `limit?`, `options?`): `Promise`\<\{ `changesets`: `IAuditableItemGraphChangesetList`; `cursor?`: `string`; \}\>
|
|
140
|
+
|
|
141
|
+
Get a graph vertex changeset list.
|
|
142
|
+
|
|
143
|
+
#### Parameters
|
|
144
|
+
|
|
145
|
+
##### id
|
|
146
|
+
|
|
147
|
+
`string`
|
|
148
|
+
|
|
149
|
+
The id of the vertex to get.
|
|
150
|
+
|
|
151
|
+
##### cursor?
|
|
152
|
+
|
|
153
|
+
`string`
|
|
154
|
+
|
|
155
|
+
The optional cursor to get next chunk.
|
|
156
|
+
|
|
157
|
+
##### limit?
|
|
158
|
+
|
|
159
|
+
`number`
|
|
160
|
+
|
|
161
|
+
Limit the number of entities to return.
|
|
162
|
+
|
|
163
|
+
##### options?
|
|
164
|
+
|
|
165
|
+
Additional options for the get operation.
|
|
166
|
+
|
|
167
|
+
###### verifySignatureDepth?
|
|
168
|
+
|
|
169
|
+
`VerifyDepth`
|
|
170
|
+
|
|
171
|
+
How many signatures to verify, defaults to "none".
|
|
172
|
+
|
|
173
|
+
#### Returns
|
|
174
|
+
|
|
175
|
+
`Promise`\<\{ `changesets`: `IAuditableItemGraphChangesetList`; `cursor?`: `string`; \}\>
|
|
176
|
+
|
|
177
|
+
The changesets if found.
|
|
178
|
+
|
|
179
|
+
#### Implementation of
|
|
180
|
+
|
|
181
|
+
`IAuditableItemGraphComponent.getChangesets`
|
|
182
|
+
|
|
183
|
+
***
|
|
184
|
+
|
|
185
|
+
### getChangeset() {#getchangeset}
|
|
186
|
+
|
|
187
|
+
> **getChangeset**(`id`, `options?`): `Promise`\<`IAuditableItemGraphChangeset`\>
|
|
188
|
+
|
|
189
|
+
Get a graph vertex changeset.
|
|
190
|
+
|
|
191
|
+
#### Parameters
|
|
192
|
+
|
|
193
|
+
##### id
|
|
194
|
+
|
|
195
|
+
`string`
|
|
196
|
+
|
|
197
|
+
The id of the vertex to get.
|
|
198
|
+
|
|
199
|
+
##### options?
|
|
200
|
+
|
|
201
|
+
Additional options for the get operation.
|
|
202
|
+
|
|
203
|
+
###### verifySignatureDepth?
|
|
204
|
+
|
|
205
|
+
`VerifyDepth`
|
|
206
|
+
|
|
207
|
+
How many signatures to verify, defaults to "none".
|
|
208
|
+
|
|
209
|
+
#### Returns
|
|
210
|
+
|
|
211
|
+
`Promise`\<`IAuditableItemGraphChangeset`\>
|
|
212
|
+
|
|
213
|
+
The changeset if found.
|
|
214
|
+
|
|
215
|
+
#### Throws
|
|
216
|
+
|
|
217
|
+
NotFoundError if the vertex or changeset is not found.
|
|
218
|
+
|
|
219
|
+
#### Implementation of
|
|
220
|
+
|
|
221
|
+
`IAuditableItemGraphComponent.getChangeset`
|
|
222
|
+
|
|
223
|
+
***
|
|
224
|
+
|
|
225
|
+
### getVersion() {#getversion}
|
|
226
|
+
|
|
227
|
+
> **getVersion**(`id`, `version`): `Promise`\<`IAuditableItemGraphVertex`\>
|
|
228
|
+
|
|
229
|
+
Get a graph vertex at a specific version.
|
|
230
|
+
|
|
231
|
+
#### Parameters
|
|
232
|
+
|
|
233
|
+
##### id
|
|
234
|
+
|
|
235
|
+
`string`
|
|
236
|
+
|
|
237
|
+
The id of the vertex.
|
|
238
|
+
|
|
239
|
+
##### version
|
|
240
|
+
|
|
241
|
+
`number`
|
|
242
|
+
|
|
243
|
+
The version number to retrieve.
|
|
244
|
+
|
|
245
|
+
#### Returns
|
|
246
|
+
|
|
247
|
+
`Promise`\<`IAuditableItemGraphVertex`\>
|
|
248
|
+
|
|
249
|
+
The vertex reconstructed at that version.
|
|
250
|
+
|
|
251
|
+
#### Throws
|
|
252
|
+
|
|
253
|
+
NotFoundError if the vertex or version is not found.
|
|
254
|
+
|
|
255
|
+
#### Implementation of
|
|
256
|
+
|
|
257
|
+
`IAuditableItemGraphComponent.getVersion`
|
|
258
|
+
|
|
259
|
+
***
|
|
260
|
+
|
|
261
|
+
### getVersions() {#getversions}
|
|
262
|
+
|
|
263
|
+
> **getVersions**(`id`, `options?`): `Promise`\<`IAuditableItemGraphVertexVersionList`\>
|
|
264
|
+
|
|
265
|
+
Get all versions of a graph vertex.
|
|
266
|
+
|
|
267
|
+
#### Parameters
|
|
268
|
+
|
|
269
|
+
##### id
|
|
270
|
+
|
|
271
|
+
`string`
|
|
272
|
+
|
|
273
|
+
The id of the vertex.
|
|
274
|
+
|
|
275
|
+
##### options?
|
|
276
|
+
|
|
277
|
+
Additional options for the operation.
|
|
278
|
+
|
|
279
|
+
###### after?
|
|
280
|
+
|
|
281
|
+
`string`
|
|
282
|
+
|
|
283
|
+
Only return versions created after this ISO 8601 timestamp (exclusive).
|
|
284
|
+
|
|
285
|
+
###### before?
|
|
286
|
+
|
|
287
|
+
`string`
|
|
288
|
+
|
|
289
|
+
Only return versions created before this ISO 8601 timestamp (exclusive).
|
|
290
|
+
|
|
291
|
+
#### Returns
|
|
292
|
+
|
|
293
|
+
`Promise`\<`IAuditableItemGraphVertexVersionList`\>
|
|
294
|
+
|
|
295
|
+
The list of vertex versions.
|
|
296
|
+
|
|
297
|
+
#### Throws
|
|
298
|
+
|
|
299
|
+
NotFoundError if the vertex is not found.
|
|
300
|
+
|
|
301
|
+
#### Implementation of
|
|
302
|
+
|
|
303
|
+
`IAuditableItemGraphComponent.getVersions`
|
|
304
|
+
|
|
305
|
+
***
|
|
306
|
+
|
|
307
|
+
### update() {#update}
|
|
308
|
+
|
|
309
|
+
> **update**(`vertex`): `Promise`\<`void`\>
|
|
310
|
+
|
|
311
|
+
Update a graph vertex (PUT - full replacement of vertex state).
|
|
312
|
+
The server serializes concurrent updates for the same vertex via `Mutex` on the vertex id;
|
|
313
|
+
requests load-balanced across replicas can still race.
|
|
314
|
+
|
|
315
|
+
#### Parameters
|
|
316
|
+
|
|
317
|
+
##### vertex
|
|
318
|
+
|
|
319
|
+
`IAuditableItemGraphVertex`
|
|
320
|
+
|
|
321
|
+
The vertex to update.
|
|
322
|
+
|
|
323
|
+
#### Returns
|
|
324
|
+
|
|
325
|
+
`Promise`\<`void`\>
|
|
326
|
+
|
|
327
|
+
A promise that resolves when the vertex has been updated.
|
|
328
|
+
|
|
329
|
+
#### Implementation of
|
|
330
|
+
|
|
331
|
+
`IAuditableItemGraphComponent.update`
|
|
332
|
+
|
|
333
|
+
***
|
|
334
|
+
|
|
335
|
+
### updatePartial() {#updatepartial}
|
|
336
|
+
|
|
337
|
+
> **updatePartial**(`partial`): `Promise`\<`void`\>
|
|
338
|
+
|
|
339
|
+
Partially update a graph vertex (PATCH - optional scalars; list fields use `{ add, remove }`).
|
|
340
|
+
|
|
341
|
+
#### Parameters
|
|
342
|
+
|
|
343
|
+
##### partial
|
|
344
|
+
|
|
345
|
+
`IAuditableItemGraphPartialVertex`
|
|
346
|
+
|
|
347
|
+
The partial vertex update (must include `id`).
|
|
348
|
+
|
|
349
|
+
#### Returns
|
|
350
|
+
|
|
351
|
+
`Promise`\<`void`\>
|
|
352
|
+
|
|
353
|
+
A promise that resolves when the partial update has been applied.
|
|
354
|
+
|
|
355
|
+
#### Implementation of
|
|
356
|
+
|
|
357
|
+
`IAuditableItemGraphComponent.updatePartial`
|
|
358
|
+
|
|
359
|
+
***
|
|
360
|
+
|
|
361
|
+
### removeProof() {#removeproof}
|
|
362
|
+
|
|
363
|
+
> **removeProof**(`id`): `Promise`\<`void`\>
|
|
364
|
+
|
|
365
|
+
Remove the notarization proof from all changesets of a graph vertex.
|
|
366
|
+
|
|
367
|
+
#### Parameters
|
|
368
|
+
|
|
369
|
+
##### id
|
|
370
|
+
|
|
371
|
+
`string`
|
|
372
|
+
|
|
373
|
+
The id of the vertex.
|
|
374
|
+
|
|
375
|
+
#### Returns
|
|
376
|
+
|
|
377
|
+
`Promise`\<`void`\>
|
|
378
|
+
|
|
379
|
+
A promise that resolves when the proof has been removed.
|
|
380
|
+
|
|
381
|
+
#### Implementation of
|
|
382
|
+
|
|
383
|
+
`IAuditableItemGraphComponent.removeProof`
|
|
384
|
+
|
|
385
|
+
***
|
|
386
|
+
|
|
387
|
+
### query() {#query}
|
|
388
|
+
|
|
389
|
+
> **query**(`options?`, `conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuditableItemGraphVertexList`; `cursor?`: `string`; \}\>
|
|
390
|
+
|
|
391
|
+
Query the graph for vertices.
|
|
392
|
+
|
|
393
|
+
#### Parameters
|
|
394
|
+
|
|
395
|
+
##### options?
|
|
396
|
+
|
|
397
|
+
The query options.
|
|
398
|
+
|
|
399
|
+
###### id?
|
|
400
|
+
|
|
401
|
+
`string`
|
|
402
|
+
|
|
403
|
+
The optional id to look for.
|
|
404
|
+
|
|
405
|
+
###### idMode?
|
|
406
|
+
|
|
407
|
+
`"id"` \| `"alias"` \| `"both"`
|
|
408
|
+
|
|
409
|
+
Look in id, alias or both, defaults to both.
|
|
410
|
+
|
|
411
|
+
###### idExact?
|
|
412
|
+
|
|
413
|
+
`boolean`
|
|
414
|
+
|
|
415
|
+
Find only exact matches, default to false meaning partial matching.
|
|
416
|
+
|
|
417
|
+
###### resourceTypes?
|
|
418
|
+
|
|
419
|
+
`string`[]
|
|
420
|
+
|
|
421
|
+
Include vertices with specific resource types.
|
|
422
|
+
|
|
423
|
+
##### conditions?
|
|
424
|
+
|
|
425
|
+
`EntityCondition`\<`IAuditableItemGraphVertex`\>
|
|
426
|
+
|
|
427
|
+
Conditions to use in the query.
|
|
428
|
+
|
|
429
|
+
##### orderBy?
|
|
430
|
+
|
|
431
|
+
`"dateCreated"` \| `"dateModified"`
|
|
432
|
+
|
|
433
|
+
The order for the results, defaults to created.
|
|
434
|
+
|
|
435
|
+
##### orderByDirection?
|
|
436
|
+
|
|
437
|
+
`SortDirection`
|
|
438
|
+
|
|
439
|
+
The direction for the order, defaults to descending.
|
|
440
|
+
|
|
441
|
+
##### properties?
|
|
442
|
+
|
|
443
|
+
(keyof `IAuditableItemGraphVertex`)[]
|
|
444
|
+
|
|
445
|
+
The properties to return, if not provided defaults to id, created, aliases and object.
|
|
446
|
+
|
|
447
|
+
##### cursor?
|
|
448
|
+
|
|
449
|
+
`string`
|
|
450
|
+
|
|
451
|
+
The cursor to request the next chunk of entities.
|
|
452
|
+
|
|
453
|
+
##### limit?
|
|
454
|
+
|
|
455
|
+
`number`
|
|
456
|
+
|
|
457
|
+
The maximum number of entities to return, a page can contain fewer so follow
|
|
458
|
+
the cursor until it is absent to read them all.
|
|
459
|
+
|
|
460
|
+
#### Returns
|
|
461
|
+
|
|
462
|
+
`Promise`\<\{ `entries`: `IAuditableItemGraphVertexList`; `cursor?`: `string`; \}\>
|
|
463
|
+
|
|
464
|
+
The entities, which can be partial if a limited keys list was provided.
|
|
465
|
+
|
|
466
|
+
#### Implementation of
|
|
467
|
+
|
|
468
|
+
`IAuditableItemGraphComponent.query`
|
package/locales/en.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@3sixty/auditable-item-graph-rest-client",
|
|
3
|
+
"version": "0.20.0-next.1",
|
|
4
|
+
"description": "Provides a client for interacting with auditable graph endpoints over HTTP.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/3sixtyglobal/auditable-item-graph.git",
|
|
8
|
+
"directory": "packages/auditable-item-graph-rest-client"
|
|
9
|
+
},
|
|
10
|
+
"author": "martyn.janes@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@3sixty/api-core": "next",
|
|
18
|
+
"@3sixty/api-models": "next",
|
|
19
|
+
"@3sixty/auditable-item-graph-models": "0.20.0-next.1",
|
|
20
|
+
"@3sixty/core": "next",
|
|
21
|
+
"@3sixty/data-json-ld": "next",
|
|
22
|
+
"@3sixty/entity": "next",
|
|
23
|
+
"@3sixty/immutable-proof-models": "next",
|
|
24
|
+
"@3sixty/nameof": "next",
|
|
25
|
+
"@3sixty/web": "next"
|
|
26
|
+
},
|
|
27
|
+
"main": "./dist/es/index.js",
|
|
28
|
+
"types": "./dist/types/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/types/index.d.ts",
|
|
32
|
+
"import": "./dist/es/index.js",
|
|
33
|
+
"default": "./dist/es/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./locales/*.json": "./locales/*.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/es",
|
|
39
|
+
"dist/types",
|
|
40
|
+
"locales",
|
|
41
|
+
"docs"
|
|
42
|
+
],
|
|
43
|
+
"keywords": [
|
|
44
|
+
"twin",
|
|
45
|
+
"trade",
|
|
46
|
+
"iota",
|
|
47
|
+
"framework",
|
|
48
|
+
"blockchain",
|
|
49
|
+
"auditable-item-graph"
|
|
50
|
+
],
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "git+https://github.com/3sixtyglobal/auditable-item-graph/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://3sixty.global"
|
|
55
|
+
}
|