@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.
- package/README.md +2 -2
- package/dist/es/auditableItemStreamRoutes.js +471 -130
- package/dist/es/auditableItemStreamRoutes.js.map +1 -1
- package/dist/es/auditableItemStreamService.js +330 -138
- package/dist/es/auditableItemStreamService.js.map +1 -1
- package/dist/es/entities/auditableItemStream.js +20 -6
- package/dist/es/entities/auditableItemStream.js.map +1 -1
- package/dist/es/models/IAuditableItemStreamServiceConstructorOptions.js.map +1 -1
- package/dist/es/models/IAuditableItemStreamServiceContext.js.map +1 -1
- package/dist/types/auditableItemStreamRoutes.d.ts +33 -1
- package/dist/types/auditableItemStreamService.d.ts +44 -37
- package/dist/types/entities/auditableItemStream.d.ts +12 -3
- package/dist/types/models/IAuditableItemStreamServiceConstructorOptions.d.ts +4 -0
- package/dist/types/models/IAuditableItemStreamServiceContext.d.ts +4 -0
- package/docs/changelog.md +355 -77
- package/docs/examples.md +211 -1
- package/docs/open-api/spec.json +839 -177
- package/docs/reference/classes/AuditableItemStream.md +32 -16
- package/docs/reference/classes/AuditableItemStreamEntry.md +13 -13
- package/docs/reference/classes/AuditableItemStreamService.md +107 -84
- package/docs/reference/functions/auditableItemStreamClose.md +31 -0
- package/docs/reference/functions/auditableItemStreamListEntriesNoStream.md +31 -0
- package/docs/reference/functions/auditableItemStreamListEntryObjectsNoStream.md +31 -0
- package/docs/reference/functions/auditableItemStreamRemoveProof.md +31 -0
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IAuditableItemStreamServiceConfig.md +2 -2
- package/docs/reference/interfaces/IAuditableItemStreamServiceConstructorOptions.md +18 -10
- package/locales/en.json +6 -1
- package/package.json +6 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IAuditableItemStream, type IAuditableItemStreamComponent, type IAuditableItemStreamEntry, type IAuditableItemStreamEntryList, type IAuditableItemStreamEntryObjectList, type IAuditableItemStreamList } from "@twin.org/auditable-item-stream-models";
|
|
1
|
+
import { type IAuditableItemStream, type IAuditableItemStreamBase, type IAuditableItemStreamComponent, type IAuditableItemStreamEntry, type IAuditableItemStreamEntryList, type IAuditableItemStreamEntryObjectList, type IAuditableItemStreamList } from "@twin.org/auditable-item-stream-models";
|
|
2
2
|
import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
3
3
|
import { SortDirection, type IComparator } from "@twin.org/entity";
|
|
4
4
|
import type { IAuditableItemStreamServiceConstructorOptions } from "./models/IAuditableItemStreamServiceConstructorOptions.js";
|
|
@@ -20,27 +20,33 @@ export declare class AuditableItemStreamService implements IAuditableItemStreamC
|
|
|
20
20
|
* @returns The class name of the component.
|
|
21
21
|
*/
|
|
22
22
|
className(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Register all AIS metrics with the telemetry component.
|
|
25
|
+
*/
|
|
26
|
+
start(): Promise<void>;
|
|
23
27
|
/**
|
|
24
28
|
* Create a new stream.
|
|
25
29
|
* @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.
|
|
28
|
-
* @param options Options for creating the stream.
|
|
29
|
-
* @param options.immutableInterval After how many entries do we add immutable checks, defaults to service configured value.
|
|
30
|
-
* A value of 0 will disable integrity checks, 1 will be every item, or any other integer for an interval.
|
|
31
30
|
* @returns The id of the new stream item.
|
|
32
31
|
*/
|
|
33
|
-
create(stream:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
create(stream: IAuditableItemStreamBase): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Close a stream.
|
|
35
|
+
* @param id The id of the stream to close.
|
|
36
|
+
* @returns Nothing.
|
|
37
|
+
*/
|
|
38
|
+
close(id: string): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Update a stream.
|
|
41
|
+
* @param stream The stream to update, does not update entries.
|
|
42
|
+
* @returns Nothing.
|
|
43
|
+
*/
|
|
44
|
+
update(stream: Pick<IAuditableItemStream, "@context" | "type" | "id" | "annotationObject">): Promise<void>;
|
|
41
45
|
/**
|
|
42
46
|
* Get a stream header without the entries.
|
|
43
47
|
* @param id The id of the stream to get.
|
|
48
|
+
* @param cursor Cursor to use for next chunk of entries.
|
|
49
|
+
* @param limit Limit the number of entries to return, only applicable if includeEntries is true.
|
|
44
50
|
* @param options Additional options for the get operation.
|
|
45
51
|
* @param options.includeEntries Whether to include the entries, defaults to false.
|
|
46
52
|
* @param options.includeDeleted Whether to include deleted entries, defaults to false.
|
|
@@ -49,23 +55,15 @@ export declare class AuditableItemStreamService implements IAuditableItemStreamC
|
|
|
49
55
|
* @returns The stream and entries if found.
|
|
50
56
|
* @throws NotFoundError if the stream is not found
|
|
51
57
|
*/
|
|
52
|
-
get(id: string, options?: {
|
|
58
|
+
get(id: string, cursor?: string, limit?: number, options?: {
|
|
53
59
|
includeEntries?: boolean;
|
|
54
60
|
includeDeleted?: boolean;
|
|
55
61
|
verifyStream?: boolean;
|
|
56
62
|
verifyEntries?: boolean;
|
|
57
|
-
}): Promise<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* @param stream.id The id of the stream to update.
|
|
62
|
-
* @param stream.annotationObject The object for the stream as JSON-LD.
|
|
63
|
-
* @returns Nothing.
|
|
64
|
-
*/
|
|
65
|
-
update(stream: {
|
|
66
|
-
id: string;
|
|
67
|
-
annotationObject?: IJsonLdNodeObject;
|
|
68
|
-
}): Promise<void>;
|
|
63
|
+
}): Promise<{
|
|
64
|
+
stream: IAuditableItemStream;
|
|
65
|
+
cursor?: string;
|
|
66
|
+
}>;
|
|
69
67
|
/**
|
|
70
68
|
* Delete the stream.
|
|
71
69
|
* @param id The id of the stream to remove.
|
|
@@ -82,7 +80,10 @@ export declare class AuditableItemStreamService implements IAuditableItemStreamC
|
|
|
82
80
|
* @param limit Limit the number of entities to return.
|
|
83
81
|
* @returns The entities, which can be partial if a limited keys list was provided.
|
|
84
82
|
*/
|
|
85
|
-
query(conditions?: IComparator[], orderBy?: keyof Pick<IAuditableItemStream, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, properties?: (keyof IAuditableItemStream)[], cursor?: string, limit?: number): Promise<
|
|
83
|
+
query(conditions?: IComparator[], orderBy?: keyof Pick<IAuditableItemStream, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, properties?: (keyof IAuditableItemStream)[], cursor?: string, limit?: number): Promise<{
|
|
84
|
+
entries: IAuditableItemStreamList;
|
|
85
|
+
cursor?: string;
|
|
86
|
+
}>;
|
|
86
87
|
/**
|
|
87
88
|
* Create an entry in the stream.
|
|
88
89
|
* @param streamId The id of the stream to update.
|
|
@@ -127,7 +128,7 @@ export declare class AuditableItemStreamService implements IAuditableItemStreamC
|
|
|
127
128
|
removeEntry(streamId: string, entryId: string): Promise<void>;
|
|
128
129
|
/**
|
|
129
130
|
* Get the entries for the stream.
|
|
130
|
-
* @param streamId The id of the stream to get.
|
|
131
|
+
* @param streamId The id of the stream to get, if undefined returns all matching entries.
|
|
131
132
|
* @param options Additional options for the get operation.
|
|
132
133
|
* @param options.conditions The conditions to filter the stream.
|
|
133
134
|
* @param options.includeDeleted Whether to include deleted entries, defaults to false.
|
|
@@ -138,17 +139,20 @@ export declare class AuditableItemStreamService implements IAuditableItemStreamC
|
|
|
138
139
|
* @returns The stream and entries if found.
|
|
139
140
|
* @throws NotFoundError if the stream is not found.
|
|
140
141
|
*/
|
|
141
|
-
getEntries(streamId
|
|
142
|
+
getEntries(streamId?: string, options?: {
|
|
142
143
|
conditions?: IComparator[];
|
|
143
144
|
includeDeleted?: boolean;
|
|
144
145
|
verifyEntries?: boolean;
|
|
145
146
|
limit?: number;
|
|
146
147
|
cursor?: string;
|
|
147
148
|
order?: SortDirection;
|
|
148
|
-
}): Promise<
|
|
149
|
+
}): Promise<{
|
|
150
|
+
entries: IAuditableItemStreamEntryList;
|
|
151
|
+
cursor?: string;
|
|
152
|
+
}>;
|
|
149
153
|
/**
|
|
150
154
|
* Get the entry objects for the stream.
|
|
151
|
-
* @param streamId The id of the stream to get.
|
|
155
|
+
* @param streamId The id of the stream to get, if undefined returns all matching entries.
|
|
152
156
|
* @param options Additional options for the get operation.
|
|
153
157
|
* @param options.conditions The conditions to filter the stream.
|
|
154
158
|
* @param options.includeDeleted Whether to include deleted entries, defaults to false.
|
|
@@ -158,18 +162,21 @@ export declare class AuditableItemStreamService implements IAuditableItemStreamC
|
|
|
158
162
|
* @returns The stream and entries if found.
|
|
159
163
|
* @throws NotFoundError if the stream is not found.
|
|
160
164
|
*/
|
|
161
|
-
getEntryObjects(streamId
|
|
165
|
+
getEntryObjects(streamId?: string, options?: {
|
|
162
166
|
conditions?: IComparator[];
|
|
163
167
|
includeDeleted?: boolean;
|
|
164
168
|
limit?: number;
|
|
165
169
|
cursor?: string;
|
|
166
170
|
order?: SortDirection;
|
|
167
|
-
}): Promise<
|
|
171
|
+
}): Promise<{
|
|
172
|
+
entries: IAuditableItemStreamEntryObjectList;
|
|
173
|
+
cursor?: string;
|
|
174
|
+
}>;
|
|
168
175
|
/**
|
|
169
|
-
* Remove the
|
|
170
|
-
* @param streamId The id of the stream to remove the
|
|
176
|
+
* Remove the proof for the stream and entries.
|
|
177
|
+
* @param streamId The id of the stream to remove the proof from.
|
|
171
178
|
* @returns Nothing.
|
|
172
179
|
* @throws NotFoundError if the vertex is not found.
|
|
173
180
|
*/
|
|
174
|
-
|
|
181
|
+
removeProof(streamId: string): Promise<void>;
|
|
175
182
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuditableItemStreamModes } from "@twin.org/auditable-item-stream-models";
|
|
1
2
|
import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
3
|
/**
|
|
3
4
|
* Class describing the auditable item stream.
|
|
@@ -18,7 +19,7 @@ export declare class AuditableItemStream {
|
|
|
18
19
|
/**
|
|
19
20
|
* The identity of the organization which controls the stream.
|
|
20
21
|
*/
|
|
21
|
-
organizationIdentity
|
|
22
|
+
organizationIdentity: string;
|
|
22
23
|
/**
|
|
23
24
|
* The identity of the user which created the stream.
|
|
24
25
|
*/
|
|
@@ -28,13 +29,21 @@ export declare class AuditableItemStream {
|
|
|
28
29
|
*/
|
|
29
30
|
annotationObject?: IJsonLdNodeObject;
|
|
30
31
|
/**
|
|
31
|
-
* The
|
|
32
|
+
* The number of items in the stream.
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
numberOfItems: number;
|
|
34
35
|
/**
|
|
35
36
|
* After how many entries do we add immutable checks.
|
|
36
37
|
*/
|
|
37
38
|
immutableInterval: number;
|
|
39
|
+
/**
|
|
40
|
+
* Is the stream closed for entry updates.
|
|
41
|
+
*/
|
|
42
|
+
closed?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The operation mode for the stream.
|
|
45
|
+
*/
|
|
46
|
+
mode?: AuditableItemStreamModes;
|
|
38
47
|
/**
|
|
39
48
|
* The immutable proof id.
|
|
40
49
|
*/
|
|
@@ -22,6 +22,10 @@ export interface IAuditableItemStreamServiceConstructorOptions {
|
|
|
22
22
|
* The event bus component type, defaults to no event bus.
|
|
23
23
|
*/
|
|
24
24
|
eventBusComponentType?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The component type for the optional telemetry component used for event metrics.
|
|
27
|
+
*/
|
|
28
|
+
telemetryComponentType?: string;
|
|
25
29
|
/**
|
|
26
30
|
* The configuration for the connector.
|
|
27
31
|
*/
|