@twin.org/auditable-item-stream-rest-client 0.0.1-next.8 → 0.0.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.
@@ -24,18 +24,19 @@ class AuditableItemStreamClient extends apiCore.BaseRestClient {
24
24
  }
25
25
  /**
26
26
  * Create a new stream.
27
- * @param streamObject The object for the stream as JSON-LD.
28
- * @param entries Entries to store in the stream.
27
+ * @param stream The stream to create.
28
+ * @param stream.annotationObject The object for the stream as JSON-LD.
29
+ * @param stream.entries Entries to store in the stream.
29
30
  * @param options Options for creating the stream.
30
31
  * @param options.immutableInterval After how many entries do we add immutable checks, defaults to service configured value.
31
- * A value of 0 will disable immutable checks, 1 will be every item, or any other integer for an interval.
32
+ * A value of 0 will disable integrity checks, 1 will be every item, or any other integer for an interval.
32
33
  * @returns The id of the new stream item.
33
34
  */
34
- async create(streamObject, entries, options) {
35
+ async create(stream, options) {
36
+ core.Guards.object(this.CLASS_NAME, "stream", stream);
35
37
  const response = await this.fetch("/", "POST", {
36
38
  body: {
37
- streamObject,
38
- entries,
39
+ ...stream,
39
40
  immutableInterval: options?.immutableInterval
40
41
  }
41
42
  });
@@ -62,28 +63,44 @@ class AuditableItemStreamClient extends apiCore.BaseRestClient {
62
63
  id
63
64
  },
64
65
  query: {
65
- includeEntries: options?.includeEntries,
66
- includeDeleted: options?.includeDeleted,
67
- verifyStream: options?.verifyStream,
68
- verifyEntries: options?.verifyEntries
66
+ includeEntries: core.Coerce.string(options?.includeEntries),
67
+ includeDeleted: core.Coerce.string(options?.includeDeleted),
68
+ verifyStream: core.Coerce.string(options?.verifyStream),
69
+ verifyEntries: core.Coerce.string(options?.verifyEntries)
69
70
  }
70
71
  });
71
72
  return response.body;
72
73
  }
73
74
  /**
74
75
  * Update a stream.
75
- * @param id The id of the stream to update.
76
- * @param streamObject The object for the stream as JSON-LD.
76
+ * @param stream The stream to update.
77
+ * @param stream.id The id of the stream to update.
78
+ * @param stream.annotationObject The object for the stream as JSON-LD.
77
79
  * @returns Nothing.
78
80
  */
79
- async update(id, streamObject) {
80
- core.Guards.stringValue(this.CLASS_NAME, "id", id);
81
+ async update(stream) {
82
+ core.Guards.object(this.CLASS_NAME, "stream", stream);
83
+ core.Guards.stringValue(this.CLASS_NAME, "stream.id", stream.id);
84
+ const { id, annotationObject } = stream;
81
85
  await this.fetch("/:id", "PUT", {
82
86
  pathParams: {
83
87
  id
84
88
  },
85
89
  body: {
86
- streamObject
90
+ annotationObject
91
+ }
92
+ });
93
+ }
94
+ /**
95
+ * Delete the stream.
96
+ * @param id The id of the stream to remove.
97
+ * @returns Nothing.
98
+ */
99
+ async remove(id) {
100
+ core.Guards.stringValue(this.CLASS_NAME, "id", id);
101
+ await this.fetch("/:id", "DELETE", {
102
+ pathParams: {
103
+ id
87
104
  }
88
105
  });
89
106
  }
@@ -103,12 +120,12 @@ class AuditableItemStreamClient extends apiCore.BaseRestClient {
103
120
  [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
104
121
  },
105
122
  query: {
106
- conditions: apiModels.HttpParameterHelper.conditionsToString(conditions),
123
+ conditions: apiModels.HttpParameterHelper.objectToString(conditions),
107
124
  orderBy,
108
125
  orderByDirection,
109
126
  properties: apiModels.HttpParameterHelper.arrayToString(properties),
110
127
  cursor,
111
- pageSize
128
+ pageSize: core.Coerce.string(pageSize)
112
129
  }
113
130
  });
114
131
  return response.body;
@@ -148,7 +165,7 @@ class AuditableItemStreamClient extends apiCore.BaseRestClient {
148
165
  [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
149
166
  },
150
167
  query: {
151
- verifyEntry: options?.verifyEntry
168
+ verifyEntry: core.Coerce.string(options?.verifyEntry)
152
169
  },
153
170
  pathParams: {
154
171
  id,
@@ -199,9 +216,9 @@ class AuditableItemStreamClient extends apiCore.BaseRestClient {
199
216
  });
200
217
  }
201
218
  /**
202
- * Delete from the stream.
203
- * @param id The id of the stream to update.
204
- * @param entryId The id of the entry to delete.
219
+ * Remove from the stream.
220
+ * @param id The id of the stream to remove from.
221
+ * @param entryId The id of the entry to remove.
205
222
  * @returns Nothing.
206
223
  */
207
224
  async removeEntry(id, entryId) {
@@ -237,10 +254,10 @@ class AuditableItemStreamClient extends apiCore.BaseRestClient {
237
254
  id
238
255
  },
239
256
  query: {
240
- conditions: apiModels.HttpParameterHelper.conditionsToString(options?.conditions),
241
- includeDeleted: options?.includeDeleted,
242
- verifyEntries: options?.verifyEntries,
243
- pageSize: options?.pageSize,
257
+ conditions: apiModels.HttpParameterHelper.objectToString(options?.conditions),
258
+ includeDeleted: core.Coerce.string(options?.includeDeleted),
259
+ verifyEntries: core.Coerce.string(options?.verifyEntries),
260
+ pageSize: core.Coerce.string(options?.pageSize),
244
261
  cursor: options?.cursor,
245
262
  order: options?.order
246
263
  }
@@ -269,25 +286,25 @@ class AuditableItemStreamClient extends apiCore.BaseRestClient {
269
286
  id
270
287
  },
271
288
  query: {
272
- conditions: apiModels.HttpParameterHelper.conditionsToString(options?.conditions),
273
- includeDeleted: options?.includeDeleted,
274
- pageSize: options?.pageSize,
275
- cursor: options?.cursor,
289
+ conditions: apiModels.HttpParameterHelper.objectToString(options?.conditions),
290
+ includeDeleted: core.Coerce.string(options?.includeDeleted),
291
+ pageSize: core.Coerce.string(options?.pageSize),
292
+ cursor: core.Coerce.string(options?.cursor),
276
293
  order: options?.order
277
294
  }
278
295
  });
279
296
  return response.body;
280
297
  }
281
298
  /**
282
- * Remove the immutable storage for the stream and entries.
299
+ * Remove the verifiable storage for the stream and entries.
283
300
  * @param id The id of the stream to remove the storage from.
284
301
  * @param nodeIdentity The node identity to use for vault operations.
285
302
  * @returns Nothing.
286
303
  * @throws NotFoundError if the vertex is not found.
287
304
  * @internal
288
305
  */
289
- async removeImmutable(id, nodeIdentity) {
290
- throw new core.NotSupportedError(this.CLASS_NAME, "removeImmutable");
306
+ async removeVerifiable(id, nodeIdentity) {
307
+ throw new core.NotSupportedError(this.CLASS_NAME, "removeVerifiable");
291
308
  }
292
309
  }
293
310
 
@@ -1,6 +1,6 @@
1
1
  import { BaseRestClient } from '@twin.org/api-core';
2
2
  import { HttpParameterHelper } from '@twin.org/api-models';
3
- import { Guards, NotSupportedError } from '@twin.org/core';
3
+ import { Guards, Coerce, NotSupportedError } from '@twin.org/core';
4
4
  import { HeaderTypes, MimeTypes } from '@twin.org/web';
5
5
 
6
6
  // Copyright 2024 IOTA Stiftung.
@@ -22,18 +22,19 @@ class AuditableItemStreamClient extends BaseRestClient {
22
22
  }
23
23
  /**
24
24
  * Create a new stream.
25
- * @param streamObject The object for the stream as JSON-LD.
26
- * @param entries Entries to store in the stream.
25
+ * @param stream The stream to create.
26
+ * @param stream.annotationObject The object for the stream as JSON-LD.
27
+ * @param stream.entries Entries to store in the stream.
27
28
  * @param options Options for creating the stream.
28
29
  * @param options.immutableInterval After how many entries do we add immutable checks, defaults to service configured value.
29
- * A value of 0 will disable immutable checks, 1 will be every item, or any other integer for an interval.
30
+ * A value of 0 will disable integrity checks, 1 will be every item, or any other integer for an interval.
30
31
  * @returns The id of the new stream item.
31
32
  */
32
- async create(streamObject, entries, options) {
33
+ async create(stream, options) {
34
+ Guards.object(this.CLASS_NAME, "stream", stream);
33
35
  const response = await this.fetch("/", "POST", {
34
36
  body: {
35
- streamObject,
36
- entries,
37
+ ...stream,
37
38
  immutableInterval: options?.immutableInterval
38
39
  }
39
40
  });
@@ -60,28 +61,44 @@ class AuditableItemStreamClient extends BaseRestClient {
60
61
  id
61
62
  },
62
63
  query: {
63
- includeEntries: options?.includeEntries,
64
- includeDeleted: options?.includeDeleted,
65
- verifyStream: options?.verifyStream,
66
- verifyEntries: options?.verifyEntries
64
+ includeEntries: Coerce.string(options?.includeEntries),
65
+ includeDeleted: Coerce.string(options?.includeDeleted),
66
+ verifyStream: Coerce.string(options?.verifyStream),
67
+ verifyEntries: Coerce.string(options?.verifyEntries)
67
68
  }
68
69
  });
69
70
  return response.body;
70
71
  }
71
72
  /**
72
73
  * Update a stream.
73
- * @param id The id of the stream to update.
74
- * @param streamObject The object for the stream as JSON-LD.
74
+ * @param stream The stream to update.
75
+ * @param stream.id The id of the stream to update.
76
+ * @param stream.annotationObject The object for the stream as JSON-LD.
75
77
  * @returns Nothing.
76
78
  */
77
- async update(id, streamObject) {
78
- Guards.stringValue(this.CLASS_NAME, "id", id);
79
+ async update(stream) {
80
+ Guards.object(this.CLASS_NAME, "stream", stream);
81
+ Guards.stringValue(this.CLASS_NAME, "stream.id", stream.id);
82
+ const { id, annotationObject } = stream;
79
83
  await this.fetch("/:id", "PUT", {
80
84
  pathParams: {
81
85
  id
82
86
  },
83
87
  body: {
84
- streamObject
88
+ annotationObject
89
+ }
90
+ });
91
+ }
92
+ /**
93
+ * Delete the stream.
94
+ * @param id The id of the stream to remove.
95
+ * @returns Nothing.
96
+ */
97
+ async remove(id) {
98
+ Guards.stringValue(this.CLASS_NAME, "id", id);
99
+ await this.fetch("/:id", "DELETE", {
100
+ pathParams: {
101
+ id
85
102
  }
86
103
  });
87
104
  }
@@ -101,12 +118,12 @@ class AuditableItemStreamClient extends BaseRestClient {
101
118
  [HeaderTypes.Accept]: MimeTypes.JsonLd
102
119
  },
103
120
  query: {
104
- conditions: HttpParameterHelper.conditionsToString(conditions),
121
+ conditions: HttpParameterHelper.objectToString(conditions),
105
122
  orderBy,
106
123
  orderByDirection,
107
124
  properties: HttpParameterHelper.arrayToString(properties),
108
125
  cursor,
109
- pageSize
126
+ pageSize: Coerce.string(pageSize)
110
127
  }
111
128
  });
112
129
  return response.body;
@@ -146,7 +163,7 @@ class AuditableItemStreamClient extends BaseRestClient {
146
163
  [HeaderTypes.Accept]: MimeTypes.JsonLd
147
164
  },
148
165
  query: {
149
- verifyEntry: options?.verifyEntry
166
+ verifyEntry: Coerce.string(options?.verifyEntry)
150
167
  },
151
168
  pathParams: {
152
169
  id,
@@ -197,9 +214,9 @@ class AuditableItemStreamClient extends BaseRestClient {
197
214
  });
198
215
  }
199
216
  /**
200
- * Delete from the stream.
201
- * @param id The id of the stream to update.
202
- * @param entryId The id of the entry to delete.
217
+ * Remove from the stream.
218
+ * @param id The id of the stream to remove from.
219
+ * @param entryId The id of the entry to remove.
203
220
  * @returns Nothing.
204
221
  */
205
222
  async removeEntry(id, entryId) {
@@ -235,10 +252,10 @@ class AuditableItemStreamClient extends BaseRestClient {
235
252
  id
236
253
  },
237
254
  query: {
238
- conditions: HttpParameterHelper.conditionsToString(options?.conditions),
239
- includeDeleted: options?.includeDeleted,
240
- verifyEntries: options?.verifyEntries,
241
- pageSize: options?.pageSize,
255
+ conditions: HttpParameterHelper.objectToString(options?.conditions),
256
+ includeDeleted: Coerce.string(options?.includeDeleted),
257
+ verifyEntries: Coerce.string(options?.verifyEntries),
258
+ pageSize: Coerce.string(options?.pageSize),
242
259
  cursor: options?.cursor,
243
260
  order: options?.order
244
261
  }
@@ -267,25 +284,25 @@ class AuditableItemStreamClient extends BaseRestClient {
267
284
  id
268
285
  },
269
286
  query: {
270
- conditions: HttpParameterHelper.conditionsToString(options?.conditions),
271
- includeDeleted: options?.includeDeleted,
272
- pageSize: options?.pageSize,
273
- cursor: options?.cursor,
287
+ conditions: HttpParameterHelper.objectToString(options?.conditions),
288
+ includeDeleted: Coerce.string(options?.includeDeleted),
289
+ pageSize: Coerce.string(options?.pageSize),
290
+ cursor: Coerce.string(options?.cursor),
274
291
  order: options?.order
275
292
  }
276
293
  });
277
294
  return response.body;
278
295
  }
279
296
  /**
280
- * Remove the immutable storage for the stream and entries.
297
+ * Remove the verifiable storage for the stream and entries.
281
298
  * @param id The id of the stream to remove the storage from.
282
299
  * @param nodeIdentity The node identity to use for vault operations.
283
300
  * @returns Nothing.
284
301
  * @throws NotFoundError if the vertex is not found.
285
302
  * @internal
286
303
  */
287
- async removeImmutable(id, nodeIdentity) {
288
- throw new NotSupportedError(this.CLASS_NAME, "removeImmutable");
304
+ async removeVerifiable(id, nodeIdentity) {
305
+ throw new NotSupportedError(this.CLASS_NAME, "removeVerifiable");
289
306
  }
290
307
  }
291
308
 
@@ -18,16 +18,20 @@ export declare class AuditableItemStreamClient extends BaseRestClient implements
18
18
  constructor(config: IBaseRestClientConfig);
19
19
  /**
20
20
  * Create a new stream.
21
- * @param streamObject The object for the stream as JSON-LD.
22
- * @param entries Entries to store in the stream.
21
+ * @param stream The stream to create.
22
+ * @param stream.annotationObject The object for the stream as JSON-LD.
23
+ * @param stream.entries Entries to store in the stream.
23
24
  * @param options Options for creating the stream.
24
25
  * @param options.immutableInterval After how many entries do we add immutable checks, defaults to service configured value.
25
- * A value of 0 will disable immutable checks, 1 will be every item, or any other integer for an interval.
26
+ * A value of 0 will disable integrity checks, 1 will be every item, or any other integer for an interval.
26
27
  * @returns The id of the new stream item.
27
28
  */
28
- create(streamObject?: IJsonLdNodeObject, entries?: {
29
- entryObject: IJsonLdNodeObject;
30
- }[], options?: {
29
+ create(stream: {
30
+ annotationObject?: IJsonLdNodeObject;
31
+ entries?: {
32
+ entryObject: IJsonLdNodeObject;
33
+ }[];
34
+ }, options?: {
31
35
  immutableInterval?: number;
32
36
  }): Promise<string>;
33
37
  /**
@@ -49,11 +53,21 @@ export declare class AuditableItemStreamClient extends BaseRestClient implements
49
53
  }): Promise<IAuditableItemStream>;
50
54
  /**
51
55
  * Update a stream.
52
- * @param id The id of the stream to update.
53
- * @param streamObject The object for the stream as JSON-LD.
56
+ * @param stream The stream to update.
57
+ * @param stream.id The id of the stream to update.
58
+ * @param stream.annotationObject The object for the stream as JSON-LD.
54
59
  * @returns Nothing.
55
60
  */
56
- update(id: string, streamObject?: IJsonLdNodeObject): Promise<void>;
61
+ update(stream: {
62
+ id: string;
63
+ annotationObject?: IJsonLdNodeObject;
64
+ }): Promise<void>;
65
+ /**
66
+ * Delete the stream.
67
+ * @param id The id of the stream to remove.
68
+ * @returns Nothing.
69
+ */
70
+ remove(id: string): Promise<void>;
57
71
  /**
58
72
  * Query all the streams, will not return entries.
59
73
  * @param conditions Conditions to use in the query.
@@ -101,9 +115,9 @@ export declare class AuditableItemStreamClient extends BaseRestClient implements
101
115
  */
102
116
  updateEntry(id: string, entryId: string, entryObject: IJsonLdNodeObject): Promise<void>;
103
117
  /**
104
- * Delete from the stream.
105
- * @param id The id of the stream to update.
106
- * @param entryId The id of the entry to delete.
118
+ * Remove from the stream.
119
+ * @param id The id of the stream to remove from.
120
+ * @param entryId The id of the entry to remove.
107
121
  * @returns Nothing.
108
122
  */
109
123
  removeEntry(id: string, entryId: string): Promise<void>;
package/docs/changelog.md CHANGED
@@ -1,5 +1,194 @@
1
1
  # @twin.org/auditable-item-stream-rest-client - Changelog
2
2
 
3
- ## v0.0.1-next.8
3
+ ## 0.0.1 (2025-07-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * release to production ([94d5757](https://github.com/twinfoundation/auditable-item-stream/commit/94d5757ff28b5462564f4ded56c8a3db781f2901))
9
+ * update dependencies ([9ff038b](https://github.com/twinfoundation/auditable-item-stream/commit/9ff038b7e76e9fb586be4f2321231f04258ef794))
10
+ * use shared store mechanism ([#7](https://github.com/twinfoundation/auditable-item-stream/issues/7)) ([2aca4b8](https://github.com/twinfoundation/auditable-item-stream/commit/2aca4b85b0102f91c90619f02b116541786cf539))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * query params force coercion ([fcdd52c](https://github.com/twinfoundation/auditable-item-stream/commit/fcdd52cf8262a3bc19f6e7e9e6ef145890a9c8aa))
16
+
17
+
18
+ ### Dependencies
19
+
20
+ * The following workspace dependencies were updated
21
+ * dependencies
22
+ * @twin.org/auditable-item-stream-models bumped from ^0.0.0 to ^0.0.1
23
+
24
+ ## [0.0.1-next.37](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.36...auditable-item-stream-rest-client-v0.0.1-next.37) (2025-06-20)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * query params force coercion ([fcdd52c](https://github.com/twinfoundation/auditable-item-stream/commit/fcdd52cf8262a3bc19f6e7e9e6ef145890a9c8aa))
30
+
31
+
32
+ ### Dependencies
33
+
34
+ * The following workspace dependencies were updated
35
+ * dependencies
36
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.36 to 0.0.1-next.37
37
+
38
+ ## [0.0.1-next.36](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.35...auditable-item-stream-rest-client-v0.0.1-next.36) (2025-06-18)
39
+
40
+
41
+ ### Miscellaneous Chores
42
+
43
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
44
+
45
+
46
+ ### Dependencies
47
+
48
+ * The following workspace dependencies were updated
49
+ * dependencies
50
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.35 to 0.0.1-next.36
51
+
52
+ ## [0.0.1-next.35](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.34...auditable-item-stream-rest-client-v0.0.1-next.35) (2025-06-12)
53
+
54
+
55
+ ### Features
56
+
57
+ * update dependencies ([9ff038b](https://github.com/twinfoundation/auditable-item-stream/commit/9ff038b7e76e9fb586be4f2321231f04258ef794))
58
+
59
+
60
+ ### Dependencies
61
+
62
+ * The following workspace dependencies were updated
63
+ * dependencies
64
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.34 to 0.0.1-next.35
65
+
66
+ ## [0.0.1-next.34](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.33...auditable-item-stream-rest-client-v0.0.1-next.34) (2025-06-03)
67
+
68
+
69
+ ### Miscellaneous Chores
70
+
71
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
72
+
73
+
74
+ ### Dependencies
75
+
76
+ * The following workspace dependencies were updated
77
+ * dependencies
78
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.33 to 0.0.1-next.34
79
+
80
+ ## [0.0.1-next.33](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.32...auditable-item-stream-rest-client-v0.0.1-next.33) (2025-05-28)
81
+
82
+
83
+ ### Miscellaneous Chores
84
+
85
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
86
+
87
+
88
+ ### Dependencies
89
+
90
+ * The following workspace dependencies were updated
91
+ * dependencies
92
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.32 to 0.0.1-next.33
93
+
94
+ ## [0.0.1-next.32](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.31...auditable-item-stream-rest-client-v0.0.1-next.32) (2025-05-08)
95
+
96
+
97
+ ### Miscellaneous Chores
98
+
99
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
100
+
101
+
102
+ ### Dependencies
103
+
104
+ * The following workspace dependencies were updated
105
+ * dependencies
106
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.31 to 0.0.1-next.32
107
+
108
+ ## [0.0.1-next.31](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.30...auditable-item-stream-rest-client-v0.0.1-next.31) (2025-04-25)
109
+
110
+
111
+ ### Miscellaneous Chores
112
+
113
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
114
+
115
+
116
+ ### Dependencies
117
+
118
+ * The following workspace dependencies were updated
119
+ * dependencies
120
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.30 to 0.0.1-next.31
121
+
122
+ ## [0.0.1-next.30](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.29...auditable-item-stream-rest-client-v0.0.1-next.30) (2025-04-25)
123
+
124
+
125
+ ### Miscellaneous Chores
126
+
127
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
128
+
129
+
130
+ ### Dependencies
131
+
132
+ * The following workspace dependencies were updated
133
+ * dependencies
134
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.29 to 0.0.1-next.30
135
+
136
+ ## [0.0.1-next.29](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.28...auditable-item-stream-rest-client-v0.0.1-next.29) (2025-04-25)
137
+
138
+
139
+ ### Miscellaneous Chores
140
+
141
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
142
+
143
+
144
+ ### Dependencies
145
+
146
+ * The following workspace dependencies were updated
147
+ * dependencies
148
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.28 to 0.0.1-next.29
149
+
150
+ ## [0.0.1-next.28](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.27...auditable-item-stream-rest-client-v0.0.1-next.28) (2025-04-17)
151
+
152
+
153
+ ### Features
154
+
155
+ * use shared store mechanism ([#7](https://github.com/twinfoundation/auditable-item-stream/issues/7)) ([2aca4b8](https://github.com/twinfoundation/auditable-item-stream/commit/2aca4b85b0102f91c90619f02b116541786cf539))
156
+
157
+
158
+ ### Dependencies
159
+
160
+ * The following workspace dependencies were updated
161
+ * dependencies
162
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.27 to 0.0.1-next.28
163
+
164
+ ## [0.0.1-next.27](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.26...auditable-item-stream-rest-client-v0.0.1-next.27) (2025-04-11)
165
+
166
+
167
+ ### Miscellaneous Chores
168
+
169
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
170
+
171
+
172
+ ### Dependencies
173
+
174
+ * The following workspace dependencies were updated
175
+ * dependencies
176
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.26 to 0.0.1-next.27
177
+
178
+ ## [0.0.1-next.26](https://github.com/twinfoundation/auditable-item-stream/compare/auditable-item-stream-rest-client-v0.0.1-next.25...auditable-item-stream-rest-client-v0.0.1-next.26) (2025-03-28)
179
+
180
+
181
+ ### Miscellaneous Chores
182
+
183
+ * **auditable-item-stream-rest-client:** Synchronize repo versions
184
+
185
+
186
+ ### Dependencies
187
+
188
+ * The following workspace dependencies were updated
189
+ * dependencies
190
+ * @twin.org/auditable-item-stream-models bumped from 0.0.1-next.25 to 0.0.1-next.26
191
+
192
+ ## v0.0.1-next.25
4
193
 
5
194
  - Initial Release
@@ -12,21 +12,23 @@ Client for performing auditable item stream through to REST endpoints.
12
12
 
13
13
  ## Constructors
14
14
 
15
- ### new AuditableItemStreamClient()
15
+ ### Constructor
16
16
 
17
- > **new AuditableItemStreamClient**(`config`): [`AuditableItemStreamClient`](AuditableItemStreamClient.md)
17
+ > **new AuditableItemStreamClient**(`config`): `AuditableItemStreamClient`
18
18
 
19
19
  Create a new instance of AuditableItemStreamClient.
20
20
 
21
21
  #### Parameters
22
22
 
23
- **config**: `IBaseRestClientConfig`
23
+ ##### config
24
+
25
+ `IBaseRestClientConfig`
24
26
 
25
27
  The configuration for the client.
26
28
 
27
29
  #### Returns
28
30
 
29
- [`AuditableItemStreamClient`](AuditableItemStreamClient.md)
31
+ `AuditableItemStreamClient`
30
32
 
31
33
  #### Overrides
32
34
 
@@ -48,28 +50,38 @@ Runtime name for the class.
48
50
 
49
51
  ### create()
50
52
 
51
- > **create**(`streamObject`?, `entries`?, `options`?): `Promise`\<`string`\>
53
+ > **create**(`stream`, `options?`): `Promise`\<`string`\>
52
54
 
53
55
  Create a new stream.
54
56
 
55
57
  #### Parameters
56
58
 
57
- **streamObject?**: `IJsonLdNodeObject`
59
+ ##### stream
60
+
61
+ The stream to create.
62
+
63
+ ###### annotationObject?
64
+
65
+ `IJsonLdNodeObject`
58
66
 
59
67
  The object for the stream as JSON-LD.
60
68
 
61
- **entries?**: `object`[]
69
+ ###### entries?
70
+
71
+ `object`[]
62
72
 
63
73
  Entries to store in the stream.
64
74
 
65
- **options?**
75
+ ##### options?
66
76
 
67
77
  Options for creating the stream.
68
78
 
69
- **options.immutableInterval?**: `number`
79
+ ###### immutableInterval?
80
+
81
+ `number`
70
82
 
71
83
  After how many entries do we add immutable checks, defaults to service configured value.
72
- A value of 0 will disable immutable checks, 1 will be every item, or any other integer for an interval.
84
+ A value of 0 will disable integrity checks, 1 will be every item, or any other integer for an interval.
73
85
 
74
86
  #### Returns
75
87
 
@@ -85,33 +97,43 @@ The id of the new stream item.
85
97
 
86
98
  ### get()
87
99
 
88
- > **get**(`id`, `options`?): `Promise`\<`IAuditableItemStream`\>
100
+ > **get**(`id`, `options?`): `Promise`\<`IAuditableItemStream`\>
89
101
 
90
102
  Get a stream header without the entries.
91
103
 
92
104
  #### Parameters
93
105
 
94
- **id**: `string`
106
+ ##### id
107
+
108
+ `string`
95
109
 
96
110
  The id of the stream to get.
97
111
 
98
- **options?**
112
+ ##### options?
99
113
 
100
114
  Additional options for the get operation.
101
115
 
102
- **options.includeEntries?**: `boolean`
116
+ ###### includeEntries?
117
+
118
+ `boolean`
103
119
 
104
120
  Whether to include the entries, defaults to false.
105
121
 
106
- **options.includeDeleted?**: `boolean`
122
+ ###### includeDeleted?
123
+
124
+ `boolean`
107
125
 
108
126
  Whether to include deleted entries, defaults to false.
109
127
 
110
- **options.verifyStream?**: `boolean`
128
+ ###### verifyStream?
129
+
130
+ `boolean`
111
131
 
112
132
  Should the stream be verified, defaults to false.
113
133
 
114
- **options.verifyEntries?**: `boolean`
134
+ ###### verifyEntries?
135
+
136
+ `boolean`
115
137
 
116
138
  Should the entries be verified, defaults to false.
117
139
 
@@ -133,17 +155,25 @@ NotFoundError if the stream is not found
133
155
 
134
156
  ### update()
135
157
 
136
- > **update**(`id`, `streamObject`?): `Promise`\<`void`\>
158
+ > **update**(`stream`): `Promise`\<`void`\>
137
159
 
138
160
  Update a stream.
139
161
 
140
162
  #### Parameters
141
163
 
142
- **id**: `string`
164
+ ##### stream
165
+
166
+ The stream to update.
167
+
168
+ ###### id
169
+
170
+ `string`
143
171
 
144
172
  The id of the stream to update.
145
173
 
146
- **streamObject?**: `IJsonLdNodeObject`
174
+ ###### annotationObject?
175
+
176
+ `IJsonLdNodeObject`
147
177
 
148
178
  The object for the stream as JSON-LD.
149
179
 
@@ -159,35 +189,73 @@ Nothing.
159
189
 
160
190
  ***
161
191
 
192
+ ### remove()
193
+
194
+ > **remove**(`id`): `Promise`\<`void`\>
195
+
196
+ Delete the stream.
197
+
198
+ #### Parameters
199
+
200
+ ##### id
201
+
202
+ `string`
203
+
204
+ The id of the stream to remove.
205
+
206
+ #### Returns
207
+
208
+ `Promise`\<`void`\>
209
+
210
+ Nothing.
211
+
212
+ #### Implementation of
213
+
214
+ `IAuditableItemStreamComponent.remove`
215
+
216
+ ***
217
+
162
218
  ### query()
163
219
 
164
- > **query**(`conditions`?, `orderBy`?, `orderByDirection`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`IAuditableItemStreamList`\>
220
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<`IAuditableItemStreamList`\>
165
221
 
166
222
  Query all the streams, will not return entries.
167
223
 
168
224
  #### Parameters
169
225
 
170
- **conditions?**: `IComparator`[]
226
+ ##### conditions?
227
+
228
+ `IComparator`[]
171
229
 
172
230
  Conditions to use in the query.
173
231
 
174
- **orderBy?**: `"dateCreated"` \| `"dateModified"`
232
+ ##### orderBy?
175
233
 
176
234
  The order for the results, defaults to created.
177
235
 
178
- **orderByDirection?**: `SortDirection`
236
+ `"dateCreated"` | `"dateModified"`
237
+
238
+ ##### orderByDirection?
239
+
240
+ `SortDirection`
179
241
 
180
242
  The direction for the order, defaults to descending.
181
243
 
182
- **properties?**: keyof `IAuditableItemStream`[]
244
+ ##### properties?
245
+
246
+ keyof `IAuditableItemStream`[]
183
247
 
184
248
  The properties to return, if not provided defaults to id, created and object.
185
249
 
186
- **cursor?**: `string`
250
+ ##### cursor?
251
+
252
+ `string`
187
253
 
188
254
  The cursor to request the next page of entities.
189
255
 
190
- **pageSize?**: `number`
256
+ ##### pageSize?
257
+
258
+ `number`
191
259
 
192
260
  The maximum number of entities in a page.
193
261
 
@@ -211,11 +279,15 @@ Create an entry in the stream.
211
279
 
212
280
  #### Parameters
213
281
 
214
- **id**: `string`
282
+ ##### id
283
+
284
+ `string`
215
285
 
216
286
  The id of the stream to update.
217
287
 
218
- **entryObject**: `IJsonLdNodeObject`
288
+ ##### entryObject
289
+
290
+ `IJsonLdNodeObject`
219
291
 
220
292
  The object for the stream as JSON-LD.
221
293
 
@@ -233,25 +305,31 @@ The id of the created entry, if not provided.
233
305
 
234
306
  ### getEntry()
235
307
 
236
- > **getEntry**(`id`, `entryId`, `options`?): `Promise`\<`IAuditableItemStreamEntry`\>
308
+ > **getEntry**(`id`, `entryId`, `options?`): `Promise`\<`IAuditableItemStreamEntry`\>
237
309
 
238
310
  Get the entry from the stream.
239
311
 
240
312
  #### Parameters
241
313
 
242
- **id**: `string`
314
+ ##### id
315
+
316
+ `string`
243
317
 
244
318
  The id of the stream to get.
245
319
 
246
- **entryId**: `string`
320
+ ##### entryId
321
+
322
+ `string`
247
323
 
248
324
  The id of the stream entry to get.
249
325
 
250
- **options?**
326
+ ##### options?
251
327
 
252
328
  Additional options for the get operation.
253
329
 
254
- **options.verifyEntry?**: `boolean`
330
+ ###### verifyEntry?
331
+
332
+ `boolean`
255
333
 
256
334
  Should the entry be verified, defaults to false.
257
335
 
@@ -279,11 +357,15 @@ Get the entry object from the stream.
279
357
 
280
358
  #### Parameters
281
359
 
282
- **id**: `string`
360
+ ##### id
361
+
362
+ `string`
283
363
 
284
364
  The id of the stream to get.
285
365
 
286
- **entryId**: `string`
366
+ ##### entryId
367
+
368
+ `string`
287
369
 
288
370
  The id of the stream entry to get.
289
371
 
@@ -311,15 +393,21 @@ Update an entry in the stream.
311
393
 
312
394
  #### Parameters
313
395
 
314
- **id**: `string`
396
+ ##### id
397
+
398
+ `string`
315
399
 
316
400
  The id of the stream to update.
317
401
 
318
- **entryId**: `string`
402
+ ##### entryId
403
+
404
+ `string`
319
405
 
320
406
  The id of the entry to update.
321
407
 
322
- **entryObject**: `IJsonLdNodeObject`
408
+ ##### entryObject
409
+
410
+ `IJsonLdNodeObject`
323
411
 
324
412
  The object for the entry as JSON-LD.
325
413
 
@@ -339,17 +427,21 @@ Nothing.
339
427
 
340
428
  > **removeEntry**(`id`, `entryId`): `Promise`\<`void`\>
341
429
 
342
- Delete from the stream.
430
+ Remove from the stream.
343
431
 
344
432
  #### Parameters
345
433
 
346
- **id**: `string`
434
+ ##### id
347
435
 
348
- The id of the stream to update.
436
+ `string`
437
+
438
+ The id of the stream to remove from.
349
439
 
350
- **entryId**: `string`
440
+ ##### entryId
351
441
 
352
- The id of the entry to delete.
442
+ `string`
443
+
444
+ The id of the entry to remove.
353
445
 
354
446
  #### Returns
355
447
 
@@ -365,41 +457,55 @@ Nothing.
365
457
 
366
458
  ### getEntries()
367
459
 
368
- > **getEntries**(`id`, `options`?): `Promise`\<`IAuditableItemStreamEntryList`\>
460
+ > **getEntries**(`id`, `options?`): `Promise`\<`IAuditableItemStreamEntryList`\>
369
461
 
370
462
  Get the entries for the stream.
371
463
 
372
464
  #### Parameters
373
465
 
374
- **id**: `string`
466
+ ##### id
467
+
468
+ `string`
375
469
 
376
470
  The id of the stream to get.
377
471
 
378
- **options?**
472
+ ##### options?
379
473
 
380
474
  Additional options for the get operation.
381
475
 
382
- **options.conditions?**: `IComparator`[]
476
+ ###### conditions?
477
+
478
+ `IComparator`[]
383
479
 
384
480
  The conditions to filter the stream.
385
481
 
386
- **options.includeDeleted?**: `boolean`
482
+ ###### includeDeleted?
483
+
484
+ `boolean`
387
485
 
388
486
  Whether to include deleted entries, defaults to false.
389
487
 
390
- **options.verifyEntries?**: `boolean`
488
+ ###### verifyEntries?
489
+
490
+ `boolean`
391
491
 
392
492
  Should the entries be verified, defaults to false.
393
493
 
394
- **options.pageSize?**: `number`
494
+ ###### pageSize?
495
+
496
+ `number`
395
497
 
396
498
  How many entries to return.
397
499
 
398
- **options.cursor?**: `string`
500
+ ###### cursor?
501
+
502
+ `string`
399
503
 
400
504
  Cursor to use for next chunk of data.
401
505
 
402
- **options.order?**: `SortDirection`
506
+ ###### order?
507
+
508
+ `SortDirection`
403
509
 
404
510
  Retrieve the entries in ascending/descending time order, defaults to Ascending.
405
511
 
@@ -421,37 +527,49 @@ NotFoundError if the stream is not found.
421
527
 
422
528
  ### getEntryObjects()
423
529
 
424
- > **getEntryObjects**(`id`, `options`?): `Promise`\<`IAuditableItemStreamEntryObjectList`\>
530
+ > **getEntryObjects**(`id`, `options?`): `Promise`\<`IAuditableItemStreamEntryObjectList`\>
425
531
 
426
532
  Get the entry objects for the stream.
427
533
 
428
534
  #### Parameters
429
535
 
430
- **id**: `string`
536
+ ##### id
537
+
538
+ `string`
431
539
 
432
540
  The id of the stream to get.
433
541
 
434
- **options?**
542
+ ##### options?
435
543
 
436
544
  Additional options for the get operation.
437
545
 
438
- **options.conditions?**: `IComparator`[]
546
+ ###### conditions?
547
+
548
+ `IComparator`[]
439
549
 
440
550
  The conditions to filter the stream.
441
551
 
442
- **options.includeDeleted?**: `boolean`
552
+ ###### includeDeleted?
553
+
554
+ `boolean`
443
555
 
444
556
  Whether to include deleted entries, defaults to false.
445
557
 
446
- **options.pageSize?**: `number`
558
+ ###### pageSize?
559
+
560
+ `number`
447
561
 
448
562
  How many entries to return.
449
563
 
450
- **options.cursor?**: `string`
564
+ ###### cursor?
565
+
566
+ `string`
451
567
 
452
568
  Cursor to use for next chunk of data.
453
569
 
454
- **options.order?**: `SortDirection`
570
+ ###### order?
571
+
572
+ `SortDirection`
455
573
 
456
574
  Retrieve the entries in ascending/descending time order, defaults to Ascending.
457
575
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/auditable-item-stream-rest-client",
3
- "version": "0.0.1-next.8",
3
+ "version": "0.0.1",
4
4
  "description": "Auditable Item Stream contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,26 +13,56 @@
13
13
  "engines": {
14
14
  "node": ">=20.0.0"
15
15
  },
16
+ "scripts": {
17
+ "clean": "rimraf dist coverage docs/reference",
18
+ "build": "tsc",
19
+ "dev": "nodemon --watch src --ext ts --exec \"npm run build && npm run bundle:esm\"",
20
+ "test": "vitest --run --config ./vitest.config.ts --no-cache",
21
+ "coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
22
+ "bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
23
+ "bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
24
+ "bundle": "npm run bundle:esm && npm run bundle:cjs",
25
+ "docs:clean": "rimraf docs/reference",
26
+ "docs:generate": "typedoc",
27
+ "docs": "npm run docs:clean && npm run docs:generate",
28
+ "dist": "npm run clean && npm run build && npm run test && npm run bundle && npm run docs",
29
+ "dist:no-test": "npm run clean && npm run build && npm run bundle && npm run docs",
30
+ "prepare": "ts-patch install -s"
31
+ },
16
32
  "dependencies": {
17
- "@twin.org/api-core": "next",
18
- "@twin.org/api-models": "next",
19
- "@twin.org/auditable-item-stream-models": "0.0.1-next.8",
20
- "@twin.org/core": "next",
21
- "@twin.org/data-json-ld": "next",
22
- "@twin.org/entity": "next",
23
- "@twin.org/nameof": "next",
24
- "@twin.org/web": "next"
33
+ "@twin.org/api-core": "^0.0.2-next.1",
34
+ "@twin.org/api-models": "^0.0.2-next.1",
35
+ "@twin.org/auditable-item-stream-models": "^0.0.1",
36
+ "@twin.org/core": "^0.0.1",
37
+ "@twin.org/data-json-ld": "^0.0.1",
38
+ "@twin.org/entity": "^0.0.1",
39
+ "@twin.org/nameof": "^0.0.1",
40
+ "@twin.org/web": "^0.0.1"
41
+ },
42
+ "devDependencies": {
43
+ "@twin.org/nameof-transformer": "^0.0.1",
44
+ "@twin.org/nameof-vitest-plugin": "^0.0.1",
45
+ "@vitest/coverage-v8": "3.2.3",
46
+ "copyfiles": "2.4.1",
47
+ "nodemon": "3.1.10",
48
+ "rimraf": "6.0.1",
49
+ "rollup": "4.43.0",
50
+ "ts-patch": "3.3.0",
51
+ "typedoc": "0.28.5",
52
+ "typedoc-plugin-markdown": "4.6.4",
53
+ "typescript": "5.8.3",
54
+ "vitest": "3.2.3"
25
55
  },
26
56
  "main": "./dist/cjs/index.cjs",
27
57
  "module": "./dist/esm/index.mjs",
28
58
  "types": "./dist/types/index.d.ts",
29
59
  "exports": {
30
60
  ".": {
61
+ "types": "./dist/types/index.d.ts",
31
62
  "require": "./dist/cjs/index.cjs",
32
- "import": "./dist/esm/index.mjs",
33
- "types": "./dist/types/index.d.ts"
63
+ "import": "./dist/esm/index.mjs"
34
64
  },
35
- "./locales": "./locales"
65
+ "./locales/*.json": "./locales/*.json"
36
66
  },
37
67
  "files": [
38
68
  "dist/cjs",