@twin.org/auditable-item-stream-service 0.0.3-next.2 → 0.0.3-next.21

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 (29) hide show
  1. package/README.md +2 -2
  2. package/dist/es/auditableItemStreamRoutes.js +471 -130
  3. package/dist/es/auditableItemStreamRoutes.js.map +1 -1
  4. package/dist/es/auditableItemStreamService.js +330 -138
  5. package/dist/es/auditableItemStreamService.js.map +1 -1
  6. package/dist/es/entities/auditableItemStream.js +20 -6
  7. package/dist/es/entities/auditableItemStream.js.map +1 -1
  8. package/dist/es/models/IAuditableItemStreamServiceConstructorOptions.js.map +1 -1
  9. package/dist/es/models/IAuditableItemStreamServiceContext.js.map +1 -1
  10. package/dist/types/auditableItemStreamRoutes.d.ts +33 -1
  11. package/dist/types/auditableItemStreamService.d.ts +44 -37
  12. package/dist/types/entities/auditableItemStream.d.ts +12 -3
  13. package/dist/types/models/IAuditableItemStreamServiceConstructorOptions.d.ts +4 -0
  14. package/dist/types/models/IAuditableItemStreamServiceContext.d.ts +4 -0
  15. package/docs/changelog.md +355 -77
  16. package/docs/examples.md +211 -1
  17. package/docs/open-api/spec.json +839 -177
  18. package/docs/reference/classes/AuditableItemStream.md +32 -16
  19. package/docs/reference/classes/AuditableItemStreamEntry.md +13 -13
  20. package/docs/reference/classes/AuditableItemStreamService.md +107 -84
  21. package/docs/reference/functions/auditableItemStreamClose.md +31 -0
  22. package/docs/reference/functions/auditableItemStreamListEntriesNoStream.md +31 -0
  23. package/docs/reference/functions/auditableItemStreamListEntryObjectsNoStream.md +31 -0
  24. package/docs/reference/functions/auditableItemStreamRemoveProof.md +31 -0
  25. package/docs/reference/index.md +4 -0
  26. package/docs/reference/interfaces/IAuditableItemStreamServiceConfig.md +2 -2
  27. package/docs/reference/interfaces/IAuditableItemStreamServiceConstructorOptions.md +18 -10
  28. package/locales/en.json +6 -1
  29. package/package.json +6 -5
@@ -14,7 +14,7 @@ Class describing the auditable item stream.
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 stream.
22
22
 
23
23
  ***
24
24
 
25
- ### dateCreated
25
+ ### dateCreated {#datecreated}
26
26
 
27
27
  > **dateCreated**: `string`
28
28
 
@@ -30,47 +30,47 @@ The date/time of when the stream 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 stream was modified.
38
38
 
39
39
  ***
40
40
 
41
- ### organizationIdentity?
41
+ ### organizationIdentity {#organizationidentity}
42
42
 
43
- > `optional` **organizationIdentity**: `string`
43
+ > **organizationIdentity**: `string`
44
44
 
45
45
  The identity of the organization which controls the stream.
46
46
 
47
47
  ***
48
48
 
49
- ### userIdentity?
49
+ ### userIdentity? {#useridentity}
50
50
 
51
- > `optional` **userIdentity**: `string`
51
+ > `optional` **userIdentity?**: `string`
52
52
 
53
53
  The identity of the user which created the stream.
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 stream as JSON-LD.
62
62
 
63
63
  ***
64
64
 
65
- ### indexCounter
65
+ ### numberOfItems {#numberofitems}
66
66
 
67
- > **indexCounter**: `number`
67
+ > **numberOfItems**: `number`
68
68
 
69
- The counter for the entry index.
69
+ The number of items in the stream.
70
70
 
71
71
  ***
72
72
 
73
- ### immutableInterval
73
+ ### immutableInterval {#immutableinterval}
74
74
 
75
75
  > **immutableInterval**: `number`
76
76
 
@@ -78,8 +78,24 @@ After how many entries do we add immutable checks.
78
78
 
79
79
  ***
80
80
 
81
- ### proofId?
81
+ ### closed? {#closed}
82
82
 
83
- > `optional` **proofId**: `string`
83
+ > `optional` **closed?**: `boolean`
84
+
85
+ Is the stream closed for entry updates.
86
+
87
+ ***
88
+
89
+ ### mode? {#mode}
90
+
91
+ > `optional` **mode?**: `AuditableItemStreamModes`
92
+
93
+ The operation mode for the stream.
94
+
95
+ ***
96
+
97
+ ### proofId? {#proofid}
98
+
99
+ > `optional` **proofId?**: `string`
84
100
 
85
101
  The immutable proof id.
@@ -14,7 +14,7 @@ Class describing the auditable item stream entry.
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 entry.
22
22
 
23
23
  ***
24
24
 
25
- ### streamId
25
+ ### streamId {#streamid}
26
26
 
27
27
  > **streamId**: `string`
28
28
 
@@ -30,7 +30,7 @@ The stream that the entry belongs to.
30
30
 
31
31
  ***
32
32
 
33
- ### dateCreated
33
+ ### dateCreated {#datecreated}
34
34
 
35
35
  > **dateCreated**: `string`
36
36
 
@@ -38,31 +38,31 @@ The date/time of when the entry 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 entry was 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 date/time of when the entry was deleted, as we never actually remove items.
54
54
 
55
55
  ***
56
56
 
57
- ### userIdentity?
57
+ ### userIdentity? {#useridentity}
58
58
 
59
- > `optional` **userIdentity**: `string`
59
+ > `optional` **userIdentity?**: `string`
60
60
 
61
61
  The identity of the user that added the entry.
62
62
 
63
63
  ***
64
64
 
65
- ### entryObject
65
+ ### entryObject {#entryobject}
66
66
 
67
67
  > **entryObject**: `IJsonLdNodeObject`
68
68
 
@@ -70,7 +70,7 @@ Object to associate with the entry as JSON-LD.
70
70
 
71
71
  ***
72
72
 
73
- ### index
73
+ ### index {#index}
74
74
 
75
75
  > **index**: `number`
76
76
 
@@ -78,8 +78,8 @@ The index of the entry in the stream.
78
78
 
79
79
  ***
80
80
 
81
- ### proofId?
81
+ ### proofId? {#proofid}
82
82
 
83
- > `optional` **proofId**: `string`
83
+ > `optional` **proofId?**: `string`
84
84
 
85
85
  The immutable proof id.
@@ -28,7 +28,7 @@ The dependencies for the auditable item stream 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
  ## Methods
38
38
 
39
- ### className()
39
+ ### className() {#classname}
40
40
 
41
41
  > **className**(): `string`
42
42
 
@@ -54,9 +54,25 @@ The class name of the component.
54
54
 
55
55
  ***
56
56
 
57
- ### create()
57
+ ### start() {#start}
58
58
 
59
- > **create**(`stream`, `options?`): `Promise`\<`string`\>
59
+ > **start**(): `Promise`\<`void`\>
60
+
61
+ Register all AIS metrics with the telemetry component.
62
+
63
+ #### Returns
64
+
65
+ `Promise`\<`void`\>
66
+
67
+ #### Implementation of
68
+
69
+ `IAuditableItemStreamComponent.start`
70
+
71
+ ***
72
+
73
+ ### create() {#create}
74
+
75
+ > **create**(`stream`): `Promise`\<`string`\>
60
76
 
61
77
  Create a new stream.
62
78
 
@@ -64,46 +80,77 @@ Create a new stream.
64
80
 
65
81
  ##### stream
66
82
 
83
+ `IAuditableItemStreamBase`
84
+
67
85
  The stream to create.
68
86
 
69
- ###### annotationObject?
87
+ #### Returns
70
88
 
71
- `IJsonLdNodeObject`
89
+ `Promise`\<`string`\>
72
90
 
73
- The object for the stream as JSON-LD.
91
+ The id of the new stream item.
74
92
 
75
- ###### entries?
93
+ #### Implementation of
76
94
 
77
- `object`[]
95
+ `IAuditableItemStreamComponent.create`
78
96
 
79
- Entries to store in the stream.
97
+ ***
80
98
 
81
- ##### options?
99
+ ### close() {#close}
82
100
 
83
- Options for creating the stream.
101
+ > **close**(`id`): `Promise`\<`void`\>
84
102
 
85
- ###### immutableInterval?
103
+ Close a stream.
86
104
 
87
- `number`
105
+ #### Parameters
106
+
107
+ ##### id
88
108
 
89
- After how many entries do we add immutable checks, defaults to service configured value.
90
- A value of 0 will disable integrity checks, 1 will be every item, or any other integer for an interval.
109
+ `string`
110
+
111
+ The id of the stream to close.
91
112
 
92
113
  #### Returns
93
114
 
94
- `Promise`\<`string`\>
115
+ `Promise`\<`void`\>
95
116
 
96
- The id of the new stream item.
117
+ Nothing.
97
118
 
98
119
  #### Implementation of
99
120
 
100
- `IAuditableItemStreamComponent.create`
121
+ `IAuditableItemStreamComponent.close`
122
+
123
+ ***
124
+
125
+ ### update() {#update}
126
+
127
+ > **update**(`stream`): `Promise`\<`void`\>
128
+
129
+ Update a stream.
130
+
131
+ #### Parameters
132
+
133
+ ##### stream
134
+
135
+ `Pick`\<`IAuditableItemStream`, `"@context"` \| `"type"` \| `"id"` \| `"annotationObject"`\>
136
+
137
+ The stream to update, does not update entries.
138
+
139
+ #### Returns
140
+
141
+ `Promise`\<`void`\>
142
+
143
+ Nothing.
144
+
145
+ #### Implementation of
146
+
147
+ `IAuditableItemStreamComponent.update`
101
148
 
102
149
  ***
103
150
 
104
- ### get()
151
+ ### get() {#get}
105
152
 
106
- > **get**(`id`, `options?`): `Promise`\<`IAuditableItemStream`\>
153
+ > **get**(`id`, `cursor?`, `limit?`, `options?`): `Promise`\<\{ `stream`: `IAuditableItemStream`; `cursor?`: `string`; \}\>
107
154
 
108
155
  Get a stream header without the entries.
109
156
 
@@ -115,6 +162,18 @@ Get a stream header without the entries.
115
162
 
116
163
  The id of the stream to get.
117
164
 
165
+ ##### cursor?
166
+
167
+ `string`
168
+
169
+ Cursor to use for next chunk of entries.
170
+
171
+ ##### limit?
172
+
173
+ `number`
174
+
175
+ Limit the number of entries to return, only applicable if includeEntries is true.
176
+
118
177
  ##### options?
119
178
 
120
179
  Additional options for the get operation.
@@ -145,7 +204,7 @@ Should the entries be verified, defaults to false.
145
204
 
146
205
  #### Returns
147
206
 
148
- `Promise`\<`IAuditableItemStream`\>
207
+ `Promise`\<\{ `stream`: `IAuditableItemStream`; `cursor?`: `string`; \}\>
149
208
 
150
209
  The stream and entries if found.
151
210
 
@@ -159,43 +218,7 @@ NotFoundError if the stream is not found
159
218
 
160
219
  ***
161
220
 
162
- ### update()
163
-
164
- > **update**(`stream`): `Promise`\<`void`\>
165
-
166
- Update a stream.
167
-
168
- #### Parameters
169
-
170
- ##### stream
171
-
172
- The stream to update.
173
-
174
- ###### id
175
-
176
- `string`
177
-
178
- The id of the stream to update.
179
-
180
- ###### annotationObject?
181
-
182
- `IJsonLdNodeObject`
183
-
184
- The object for the stream as JSON-LD.
185
-
186
- #### Returns
187
-
188
- `Promise`\<`void`\>
189
-
190
- Nothing.
191
-
192
- #### Implementation of
193
-
194
- `IAuditableItemStreamComponent.update`
195
-
196
- ***
197
-
198
- ### remove()
221
+ ### remove() {#remove}
199
222
 
200
223
  > **remove**(`id`): `Promise`\<`void`\>
201
224
 
@@ -221,9 +244,9 @@ Nothing.
221
244
 
222
245
  ***
223
246
 
224
- ### query()
247
+ ### query() {#query}
225
248
 
226
- > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<`IAuditableItemStreamList`\>
249
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuditableItemStreamList`; `cursor?`: `string`; \}\>
227
250
 
228
251
  Query all the streams, will not return entries.
229
252
 
@@ -237,9 +260,9 @@ Conditions to use in the query.
237
260
 
238
261
  ##### orderBy?
239
262
 
240
- The order for the results, defaults to created.
263
+ `"dateCreated"` \| `"dateModified"`
241
264
 
242
- `"dateCreated"` | `"dateModified"`
265
+ The order for the results, defaults to created.
243
266
 
244
267
  ##### orderByDirection?
245
268
 
@@ -267,7 +290,7 @@ Limit the number of entities to return.
267
290
 
268
291
  #### Returns
269
292
 
270
- `Promise`\<`IAuditableItemStreamList`\>
293
+ `Promise`\<\{ `entries`: `IAuditableItemStreamList`; `cursor?`: `string`; \}\>
271
294
 
272
295
  The entities, which can be partial if a limited keys list was provided.
273
296
 
@@ -277,7 +300,7 @@ The entities, which can be partial if a limited keys list was provided.
277
300
 
278
301
  ***
279
302
 
280
- ### createEntry()
303
+ ### createEntry() {#createentry}
281
304
 
282
305
  > **createEntry**(`streamId`, `entryObject`): `Promise`\<`string`\>
283
306
 
@@ -309,7 +332,7 @@ The id of the created entry, if not provided.
309
332
 
310
333
  ***
311
334
 
312
- ### getEntry()
335
+ ### getEntry() {#getentry}
313
336
 
314
337
  > **getEntry**(`streamId`, `entryId`, `options?`): `Promise`\<`IAuditableItemStreamEntry`\>
315
338
 
@@ -355,7 +378,7 @@ NotFoundError if the stream is not found.
355
378
 
356
379
  ***
357
380
 
358
- ### getEntryObject()
381
+ ### getEntryObject() {#getentryobject}
359
382
 
360
383
  > **getEntryObject**(`streamId`, `entryId`): `Promise`\<`IJsonLdNodeObject`\>
361
384
 
@@ -391,7 +414,7 @@ NotFoundError if the stream is not found.
391
414
 
392
415
  ***
393
416
 
394
- ### updateEntry()
417
+ ### updateEntry() {#updateentry}
395
418
 
396
419
  > **updateEntry**(`streamId`, `entryId`, `entryObject`): `Promise`\<`void`\>
397
420
 
@@ -429,7 +452,7 @@ Nothing.
429
452
 
430
453
  ***
431
454
 
432
- ### removeEntry()
455
+ ### removeEntry() {#removeentry}
433
456
 
434
457
  > **removeEntry**(`streamId`, `entryId`): `Promise`\<`void`\>
435
458
 
@@ -461,19 +484,19 @@ Nothing.
461
484
 
462
485
  ***
463
486
 
464
- ### getEntries()
487
+ ### getEntries() {#getentries}
465
488
 
466
- > **getEntries**(`streamId`, `options?`): `Promise`\<`IAuditableItemStreamEntryList`\>
489
+ > **getEntries**(`streamId?`, `options?`): `Promise`\<\{ `entries`: `IAuditableItemStreamEntryList`; `cursor?`: `string`; \}\>
467
490
 
468
491
  Get the entries for the stream.
469
492
 
470
493
  #### Parameters
471
494
 
472
- ##### streamId
495
+ ##### streamId?
473
496
 
474
497
  `string`
475
498
 
476
- The id of the stream to get.
499
+ The id of the stream to get, if undefined returns all matching entries.
477
500
 
478
501
  ##### options?
479
502
 
@@ -517,7 +540,7 @@ Retrieve the entries in ascending/descending time order, defaults to Ascending.
517
540
 
518
541
  #### Returns
519
542
 
520
- `Promise`\<`IAuditableItemStreamEntryList`\>
543
+ `Promise`\<\{ `entries`: `IAuditableItemStreamEntryList`; `cursor?`: `string`; \}\>
521
544
 
522
545
  The stream and entries if found.
523
546
 
@@ -531,19 +554,19 @@ NotFoundError if the stream is not found.
531
554
 
532
555
  ***
533
556
 
534
- ### getEntryObjects()
557
+ ### getEntryObjects() {#getentryobjects}
535
558
 
536
- > **getEntryObjects**(`streamId`, `options?`): `Promise`\<`IAuditableItemStreamEntryObjectList`\>
559
+ > **getEntryObjects**(`streamId?`, `options?`): `Promise`\<\{ `entries`: `IAuditableItemStreamEntryObjectList`; `cursor?`: `string`; \}\>
537
560
 
538
561
  Get the entry objects for the stream.
539
562
 
540
563
  #### Parameters
541
564
 
542
- ##### streamId
565
+ ##### streamId?
543
566
 
544
567
  `string`
545
568
 
546
- The id of the stream to get.
569
+ The id of the stream to get, if undefined returns all matching entries.
547
570
 
548
571
  ##### options?
549
572
 
@@ -581,7 +604,7 @@ Retrieve the entries in ascending/descending time order, defaults to Ascending.
581
604
 
582
605
  #### Returns
583
606
 
584
- `Promise`\<`IAuditableItemStreamEntryObjectList`\>
607
+ `Promise`\<\{ `entries`: `IAuditableItemStreamEntryObjectList`; `cursor?`: `string`; \}\>
585
608
 
586
609
  The stream and entries if found.
587
610
 
@@ -595,11 +618,11 @@ NotFoundError if the stream is not found.
595
618
 
596
619
  ***
597
620
 
598
- ### removeVerifiable()
621
+ ### removeProof() {#removeproof}
599
622
 
600
- > **removeVerifiable**(`streamId`): `Promise`\<`void`\>
623
+ > **removeProof**(`streamId`): `Promise`\<`void`\>
601
624
 
602
- Remove the verifiable storage for the stream and entries.
625
+ Remove the proof for the stream and entries.
603
626
 
604
627
  #### Parameters
605
628
 
@@ -607,7 +630,7 @@ Remove the verifiable storage for the stream and entries.
607
630
 
608
631
  `string`
609
632
 
610
- The id of the stream to remove the storage from.
633
+ The id of the stream to remove the proof from.
611
634
 
612
635
  #### Returns
613
636
 
@@ -621,4 +644,4 @@ NotFoundError if the vertex is not found.
621
644
 
622
645
  #### Implementation of
623
646
 
624
- `IAuditableItemStreamComponent.removeVerifiable`
647
+ `IAuditableItemStreamComponent.removeProof`
@@ -0,0 +1,31 @@
1
+ # Function: auditableItemStreamClose()
2
+
3
+ > **auditableItemStreamClose**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Close the stream.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditableItemStreamCloseRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: auditableItemStreamListEntriesNoStream()
2
+
3
+ > **auditableItemStreamListEntriesNoStream**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAuditableItemStreamListEntriesResponse`\>
4
+
5
+ Query the stream.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditableItemStreamListEntriesNoStreamRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IAuditableItemStreamListEntriesResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: auditableItemStreamListEntryObjectsNoStream()
2
+
3
+ > **auditableItemStreamListEntryObjectsNoStream**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAuditableItemStreamListEntryObjectsResponse`\>
4
+
5
+ Query the stream objects.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditableItemStreamListEntryObjectsNoStreamRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IAuditableItemStreamListEntryObjectsResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: auditableItemStreamRemoveProof()
2
+
3
+ > **auditableItemStreamRemoveProof**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Remove the proof from a stream.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditableItemStreamRemoveProofRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.