@rotorsoft/act 0.5.7 → 0.6.0
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/dist/.tsbuildinfo +1 -1
- package/dist/@types/act-builder.d.ts +3 -3
- package/dist/@types/act-builder.d.ts.map +1 -1
- package/dist/@types/act.d.ts +82 -20
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/InMemoryStore.d.ts +23 -11
- package/dist/@types/adapters/InMemoryStore.d.ts.map +1 -1
- package/dist/@types/event-sourcing.d.ts +1 -1
- package/dist/@types/event-sourcing.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +12 -1
- package/dist/@types/types/action.d.ts.map +1 -1
- package/dist/@types/types/errors.d.ts +10 -17
- package/dist/@types/types/errors.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +21 -11
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +57 -23
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/@types/types/registry.d.ts +8 -4
- package/dist/@types/types/registry.d.ts.map +1 -1
- package/dist/@types/types/schemas.d.ts +3 -14
- package/dist/@types/types/schemas.d.ts.map +1 -1
- package/dist/index.cjs +375 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +375 -172
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/@types/act.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Committed, Lease, Query, Registry, Schema, SchemaRegister, Schemas, Snapshot, State, Target } from "./types/index.js";
|
|
2
|
-
type SnapshotArgs = Snapshot<Schemas, Schema>;
|
|
1
|
+
import type { Committed, FetchOptions, Lease, Query, Registry, Schema, SchemaRegister, Schemas, Snapshot, State, Target } from "./types/index.js";
|
|
3
2
|
/**
|
|
4
3
|
* @category Orchestrator
|
|
5
4
|
* @see Store
|
|
@@ -17,7 +16,7 @@ type SnapshotArgs = Snapshot<Schemas, Schema>;
|
|
|
17
16
|
* await app.drain();
|
|
18
17
|
* ```
|
|
19
18
|
*
|
|
20
|
-
* - Register event listeners with `.on("committed", ...)` and `.on("
|
|
19
|
+
* - Register event listeners with `.on("committed", ...)` and `.on("acked", ...)` to react to lifecycle events.
|
|
21
20
|
* - Use `.query()` to analyze event streams for analytics or debugging.
|
|
22
21
|
*
|
|
23
22
|
* @template S SchemaRegister for state
|
|
@@ -26,26 +25,33 @@ type SnapshotArgs = Snapshot<Schemas, Schema>;
|
|
|
26
25
|
*/
|
|
27
26
|
export declare class Act<S extends SchemaRegister<A>, E extends Schemas, A extends Schemas> {
|
|
28
27
|
readonly registry: Registry<S, E, A>;
|
|
29
|
-
readonly drainLimit: number;
|
|
30
28
|
private _emitter;
|
|
29
|
+
private _drain_locked;
|
|
30
|
+
private _correlation_interval;
|
|
31
31
|
/**
|
|
32
32
|
* Emit a lifecycle event (internal use, but can be used for custom listeners).
|
|
33
33
|
*
|
|
34
|
-
* @param event The event name ("committed" or "
|
|
34
|
+
* @param event The event name ("committed", "acked", or "blocked")
|
|
35
35
|
* @param args The event payload
|
|
36
36
|
* @returns true if the event had listeners, false otherwise
|
|
37
37
|
*/
|
|
38
|
-
emit(event: "committed", args:
|
|
39
|
-
emit(event: "
|
|
38
|
+
emit(event: "committed", args: Snapshot<S, E>[]): boolean;
|
|
39
|
+
emit(event: "acked", args: Lease[]): boolean;
|
|
40
|
+
emit(event: "blocked", args: Array<Lease & {
|
|
41
|
+
error: string;
|
|
42
|
+
}>): boolean;
|
|
40
43
|
/**
|
|
41
|
-
* Register a listener for a lifecycle event ("committed" or "
|
|
44
|
+
* Register a listener for a lifecycle event ("committed", "acked", or "blocked").
|
|
42
45
|
*
|
|
43
46
|
* @param event The event name
|
|
44
47
|
* @param listener The callback function
|
|
45
48
|
* @returns this (for chaining)
|
|
46
49
|
*/
|
|
47
|
-
on(event: "committed", listener: (args:
|
|
48
|
-
on(event: "
|
|
50
|
+
on(event: "committed", listener: (args: Snapshot<S, E>[]) => void): this;
|
|
51
|
+
on(event: "acked", listener: (args: Lease[]) => void): this;
|
|
52
|
+
on(event: "blocked", listener: (args: Array<Lease & {
|
|
53
|
+
error: string;
|
|
54
|
+
}>) => void): this;
|
|
49
55
|
/**
|
|
50
56
|
* Remove a listener for a lifecycle event.
|
|
51
57
|
*
|
|
@@ -53,15 +59,17 @@ export declare class Act<S extends SchemaRegister<A>, E extends Schemas, A exten
|
|
|
53
59
|
* @param listener The callback function
|
|
54
60
|
* @returns this (for chaining)
|
|
55
61
|
*/
|
|
56
|
-
off(event: "committed", listener: (args:
|
|
57
|
-
off(event: "
|
|
62
|
+
off(event: "committed", listener: (args: Snapshot<S, E>[]) => void): this;
|
|
63
|
+
off(event: "acked", listener: (args: Lease[]) => void): this;
|
|
64
|
+
off(event: "blocked", listener: (args: Array<Lease & {
|
|
65
|
+
error: string;
|
|
66
|
+
}>) => void): this;
|
|
58
67
|
/**
|
|
59
68
|
* Create a new Act orchestrator.
|
|
60
69
|
*
|
|
61
70
|
* @param registry The registry of state, event, and action schemas
|
|
62
|
-
* @param drainLimit The maximum number of events to drain per cycle
|
|
63
71
|
*/
|
|
64
|
-
constructor(registry: Registry<S, E, A
|
|
72
|
+
constructor(registry: Registry<S, E, A>);
|
|
65
73
|
/**
|
|
66
74
|
* Executes an action (command) against a state machine, emitting and committing the resulting event(s).
|
|
67
75
|
*
|
|
@@ -76,7 +84,7 @@ export declare class Act<S extends SchemaRegister<A>, E extends Schemas, A exten
|
|
|
76
84
|
* @example
|
|
77
85
|
* await app.do("increment", { stream: "counter1", actor }, { by: 1 });
|
|
78
86
|
*/
|
|
79
|
-
do<K extends keyof A>(action: K, target: Target, payload: Readonly<A[K]>, reactingTo?: Committed<E, keyof E>, skipValidation?: boolean): Promise<Snapshot<S[K], E
|
|
87
|
+
do<K extends keyof A>(action: K, target: Target, payload: Readonly<A[K]>, reactingTo?: Committed<E, keyof E>, skipValidation?: boolean): Promise<Snapshot<S[K], E>[]>;
|
|
80
88
|
/**
|
|
81
89
|
* Loads the current state snapshot for a given state machine and stream.
|
|
82
90
|
*
|
|
@@ -107,16 +115,39 @@ export declare class Act<S extends SchemaRegister<A>, E extends Schemas, A exten
|
|
|
107
115
|
last?: Committed<E, keyof E>;
|
|
108
116
|
count: number;
|
|
109
117
|
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Query the event store for events matching a filter.
|
|
120
|
+
* Use this version with caution, as it return events in memory.
|
|
121
|
+
*
|
|
122
|
+
* @param query The query filter (e.g., by stream, event name, or time range)
|
|
123
|
+
* @returns The matching events
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* const { count } = await app.query({ stream: "counter1" }, (event) => console.log(event));
|
|
127
|
+
*/
|
|
128
|
+
query_array(query: Query): Promise<Committed<E, keyof E>[]>;
|
|
110
129
|
/**
|
|
111
130
|
* Handles leased reactions.
|
|
112
131
|
*
|
|
132
|
+
* This is called by the main `drain` loop after fetching new events.
|
|
133
|
+
* It handles reactions, supporting retries, blocking, and error handling.
|
|
134
|
+
*
|
|
113
135
|
* @internal
|
|
114
136
|
* @param lease The lease to handle
|
|
115
|
-
* @param
|
|
116
|
-
* @returns The lease
|
|
137
|
+
* @param payloads The reactions to handle
|
|
138
|
+
* @returns The lease with results
|
|
117
139
|
*/
|
|
118
140
|
private handle;
|
|
119
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Fetches new events from store according to the fetch options.
|
|
143
|
+
* @param options - Fetch options.
|
|
144
|
+
* @returns Fetched streams with next events to process.
|
|
145
|
+
*/
|
|
146
|
+
fetch({ streamLimit, eventLimit }: FetchOptions): Promise<{
|
|
147
|
+
stream: string;
|
|
148
|
+
source: string | undefined;
|
|
149
|
+
events: Committed<E, keyof E>[];
|
|
150
|
+
}[]>;
|
|
120
151
|
/**
|
|
121
152
|
* Drains and processes events from the store, triggering reactions and updating state.
|
|
122
153
|
*
|
|
@@ -127,7 +158,38 @@ export declare class Act<S extends SchemaRegister<A>, E extends Schemas, A exten
|
|
|
127
158
|
* @example
|
|
128
159
|
* await app.drain();
|
|
129
160
|
*/
|
|
130
|
-
drain(): Promise<
|
|
161
|
+
drain<E extends Schemas>({ streamLimit, eventLimit, leaseMillis, }?: FetchOptions): Promise<{
|
|
162
|
+
leased: Lease[];
|
|
163
|
+
acked: Lease[];
|
|
164
|
+
blocked: Array<Lease & {
|
|
165
|
+
error: string;
|
|
166
|
+
}>;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Correlates streams using reaction resolvers.
|
|
170
|
+
* @param query - The query filter (e.g., by stream, event name, or starting point).
|
|
171
|
+
* @returns The leases of newly correlated streams, and the last seen event ID.
|
|
172
|
+
*/
|
|
173
|
+
correlate(query?: Query): Promise<{
|
|
174
|
+
leased: Lease[];
|
|
175
|
+
last_id: number;
|
|
176
|
+
}>;
|
|
177
|
+
/**
|
|
178
|
+
* Starts correlation worker that identifies and registers new streams using reaction resolvers.
|
|
179
|
+
*
|
|
180
|
+
* Enables "dynamic reactions", allowing streams to be auto-discovered based on event content.
|
|
181
|
+
* - Uses a correlation sliding window over the event stream to identify new streams.
|
|
182
|
+
* - Once registered, these streams are picked up by the main `drain` loop.
|
|
183
|
+
* - Users should have full control over their correlation strategy.
|
|
184
|
+
* - The starting point keeps increasing with each new batch of events.
|
|
185
|
+
* - Users are responsible for storing the last seen event ID.
|
|
186
|
+
*
|
|
187
|
+
* @param query - The query filter (e.g., by stream, event name, or starting point).
|
|
188
|
+
* @param frequency - The frequency of correlation checks (in milliseconds).
|
|
189
|
+
* @param callback - Callback to report stats (new strems, last seen event ID, etc.).
|
|
190
|
+
* @returns true if the correlation worker started, false otherwise (already started).
|
|
191
|
+
*/
|
|
192
|
+
start_correlations(query?: Query, frequency?: number, callback?: (leased: Lease[]) => void): boolean;
|
|
193
|
+
stop_correlations(): void;
|
|
131
194
|
}
|
|
132
|
-
export {};
|
|
133
195
|
//# sourceMappingURL=act.d.ts.map
|
package/dist/@types/act.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/act.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/act.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EAET,YAAY,EACZ,KAAK,EACL,KAAK,EAGL,QAAQ,EACR,MAAM,EACN,cAAc,EACd,OAAO,EACP,QAAQ,EACR,KAAK,EACL,MAAM,EACP,MAAM,kBAAkB,CAAC;AAyC1B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,GAAG,CACd,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,EAC3B,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO;aA6DW,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IA3DvD,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,qBAAqB,CAAyC;IAEtE;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO;IACzD,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,OAAO;IAC5C,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO;IAKvE;;;;;;OAMG;IACH,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,IAAI,GAAG,IAAI;IACxE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,I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ClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,IAAI,GACnC,OAAO;IAkBV,iBAAiB;CAMlB"}
|
|
@@ -48,24 +48,36 @@ export declare class InMemoryStore implements Store {
|
|
|
48
48
|
*/
|
|
49
49
|
commit<E extends Schemas>(stream: string, msgs: Message<E, keyof E>[], meta: EventMeta, expectedVersion?: number): Promise<Committed<E, keyof E>[]>;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @param limit - Maximum number of streams to
|
|
53
|
-
* @returns
|
|
51
|
+
* Polls the store for unblocked streams needing processing, ordered by lease watermark ascending.
|
|
52
|
+
* @param limit - Maximum number of streams to poll.
|
|
53
|
+
* @returns The polled streams.
|
|
54
54
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
poll(limit: number): Promise<{
|
|
56
|
+
stream: string;
|
|
57
|
+
source: string | undefined;
|
|
58
|
+
at: number;
|
|
59
|
+
}[]>;
|
|
59
60
|
/**
|
|
60
61
|
* Lease streams for processing (e.g., for distributed consumers).
|
|
61
|
-
* @param leases - Lease requests.
|
|
62
|
+
* @param leases - Lease requests for streams, including end-of-lease watermark, lease holder, and source stream.
|
|
63
|
+
* @param leaseMilis - Lease duration in milliseconds.
|
|
62
64
|
* @returns Granted leases.
|
|
63
65
|
*/
|
|
64
|
-
lease(leases: Lease[]): Promise<Lease[]>;
|
|
66
|
+
lease(leases: Lease[], millis: number): Promise<Lease[]>;
|
|
65
67
|
/**
|
|
66
68
|
* Acknowledge completion of processing for leased streams.
|
|
67
|
-
* @param leases - Leases to acknowledge.
|
|
69
|
+
* @param leases - Leases to acknowledge, including last processed watermark and lease holder.
|
|
68
70
|
*/
|
|
69
|
-
ack(leases: Lease[]): Promise<
|
|
71
|
+
ack(leases: Lease[]): Promise<Lease[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Block a stream for processing after failing to process and reaching max retries with blocking enabled.
|
|
74
|
+
* @param leases - Leases to block, including lease holder and last error message.
|
|
75
|
+
* @returns Blocked leases.
|
|
76
|
+
*/
|
|
77
|
+
block(leases: Array<Lease & {
|
|
78
|
+
error: string;
|
|
79
|
+
}>): Promise<(Lease & {
|
|
80
|
+
error: string;
|
|
81
|
+
})[]>;
|
|
70
82
|
}
|
|
71
83
|
//# sourceMappingURL=InMemoryStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryStore.d.ts","sourceRoot":"","sources":["../../../src/adapters/InMemoryStore.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACP,KAAK,EACN,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"InMemoryStore.d.ts","sourceRoot":"","sources":["../../../src/adapters/InMemoryStore.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACP,KAAK,EACN,MAAM,mBAAmB,CAAC;AAmF3B;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,YAAW,KAAK;IAEzC,OAAO,CAAC,OAAO,CAA2C;IAE1D,OAAO,CAAC,QAAQ,CAA0C;IAE1D;;;OAGG;IACG,OAAO;IAKb;;;OAGG;IACG,IAAI;IAIV;;;OAGG;IACG,IAAI;IAMV;;;;;OAKG;IACG,KAAK,CAAC,CAAC,SAAS,OAAO,EAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,EAChD,KAAK,CAAC,EAAE,KAAK;IAgCf;;;;;;;;OAQG;IACG,MAAM,CAAC,CAAC,SAAS,OAAO,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,EAC3B,IAAI,EAAE,SAAS,EACf,eAAe,CAAC,EAAE,MAAM;IAiC1B;;;;OAIG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM;;;;;IASxB;;;;;OAKG;IACG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM;IAe3C;;;OAGG;IACG,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE;IAOzB;;;;OAIG;IACG,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;eAAT,MAAM;;CAMlD"}
|
|
@@ -58,5 +58,5 @@ export declare function load<S extends Schema, E extends Schemas, A extends Sche
|
|
|
58
58
|
* @example
|
|
59
59
|
* const snapshot = await action(Counter, "increment", { stream: "counter1", actor }, { by: 1 });
|
|
60
60
|
*/
|
|
61
|
-
export declare function action<S extends Schema, E extends Schemas, A extends Schemas, K extends keyof A>(me: State<S, E, A>, action: K, target: Target, payload: Readonly<A[K]>, reactingTo?: Committed<Schemas, keyof Schemas>, skipValidation?: boolean): Promise<Snapshot<S, E
|
|
61
|
+
export declare function action<S extends Schema, E extends Schemas, A extends Schemas, K extends keyof A>(me: State<S, E, A>, action: K, target: Target, payload: Readonly<A[K]>, reactingTo?: Committed<Schemas, keyof Schemas>, skipValidation?: boolean): Promise<Snapshot<S, E>[]>;
|
|
62
62
|
//# sourceMappingURL=event-sourcing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-sourcing.d.ts","sourceRoot":"","sources":["../../src/event-sourcing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,SAAS,EAGT,MAAM,EACN,OAAO,EACP,QAAQ,EACR,KAAK,EACL,MAAM,EACP,MAAM,kBAAkB,CAAC;AAG1B;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAsB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAC5D,QAA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BzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,MAAM,CAC1B,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,MAAM,CAAC,EAEjB,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACvB,UAAU,CAAC,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,EAC9C,cAAc,UAAQ,GACrB,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CA6F3B"}
|
|
@@ -28,6 +28,17 @@ export type EventMeta = z.infer<typeof EventMetaSchema>;
|
|
|
28
28
|
export type CommittedMeta = z.infer<typeof CommittedMetaSchema>;
|
|
29
29
|
/**
|
|
30
30
|
* Query options for event store queries.
|
|
31
|
+
*
|
|
32
|
+
* @property `stream?` - Filter by stream name
|
|
33
|
+
* @property `names?` - Filter by event names
|
|
34
|
+
* @property `before?` - Filter events before this id
|
|
35
|
+
* @property `after?` - Filter events after this id
|
|
36
|
+
* @property `limit?` - Limit the number of events to return
|
|
37
|
+
* @property `created_before?` - Filter events created before this date/time
|
|
38
|
+
* @property `created_after?` - Filter events created after this date/time
|
|
39
|
+
* @property `backward?` - Order descending when true
|
|
40
|
+
* @property `correlation?` - Filter by correlation
|
|
41
|
+
* @property `with_snaps?` - Include snapshots in the results, defaults to false
|
|
31
42
|
*/
|
|
32
43
|
export type Query = z.infer<typeof QuerySchema>;
|
|
33
44
|
/**
|
|
@@ -130,7 +141,7 @@ export type PatchHandlers<S extends Schema, E extends Schemas> = {
|
|
|
130
141
|
* @template A - Action schemas.
|
|
131
142
|
* @template K - Action name.
|
|
132
143
|
*/
|
|
133
|
-
export type ActionHandler<S extends Schema, E extends Schemas, A extends Schemas, K extends keyof A> = (action: Readonly<A[K]>,
|
|
144
|
+
export type ActionHandler<S extends Schema, E extends Schemas, A extends Schemas, K extends keyof A> = (action: Readonly<A[K]>, snapshot: Readonly<Snapshot<S, E>>, target: Target) => Emitted<E> | Emitted<E>[] | undefined;
|
|
134
145
|
/**
|
|
135
146
|
* Maps action names to their handlers.
|
|
136
147
|
* @template S - State schema.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/types/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,YAAY,EACb,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/types/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,YAAY,EAC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AC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,IAAI;KAC9D,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE;CAChC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,KAAK,CACf,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,IACf,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,EAAE,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC;CAC9C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Message, Schema, Schemas, Target } from "./action.js";
|
|
1
|
+
import type { Message, Schema, Schemas, Snapshot, Target } from "./action.js";
|
|
2
2
|
/**
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
* @module act/types
|
|
@@ -37,21 +37,13 @@ export declare class ValidationError extends Error {
|
|
|
37
37
|
* @example
|
|
38
38
|
* throw new InvariantError('balanceNonNegative', state, target, 'Balance must be >= 0');
|
|
39
39
|
*/
|
|
40
|
-
export declare class InvariantError extends Error {
|
|
41
|
-
readonly
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
}>;
|
|
50
|
-
expectedVersion?: number | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
description: string;
|
|
53
|
-
};
|
|
54
|
-
constructor(name: string, payload: Schema, target: Target, description: string);
|
|
40
|
+
export declare class InvariantError<S extends Schema, E extends Schemas, A extends Schemas, K extends keyof A> extends Error {
|
|
41
|
+
readonly action: K;
|
|
42
|
+
readonly payload: Readonly<A[K]>;
|
|
43
|
+
readonly target: Target;
|
|
44
|
+
readonly snapshot: Snapshot<S, E>;
|
|
45
|
+
readonly description: string;
|
|
46
|
+
constructor(action: K, payload: Readonly<A[K]>, target: Target, snapshot: Snapshot<S, E>, description: string);
|
|
55
47
|
}
|
|
56
48
|
/**
|
|
57
49
|
* Thrown when an optimistic concurrency check fails during event commit.
|
|
@@ -62,9 +54,10 @@ export declare class InvariantError extends Error {
|
|
|
62
54
|
* throw new ConcurrencyError(2, events, 1);
|
|
63
55
|
*/
|
|
64
56
|
export declare class ConcurrencyError extends Error {
|
|
57
|
+
readonly stream: string;
|
|
65
58
|
readonly lastVersion: number;
|
|
66
59
|
readonly events: Message<Schemas, keyof Schemas>[];
|
|
67
60
|
readonly expectedVersion: number;
|
|
68
|
-
constructor(lastVersion: number, events: Message<Schemas, keyof Schemas>[], expectedVersion: number);
|
|
61
|
+
constructor(stream: string, lastVersion: number, events: Message<Schemas, keyof Schemas>[], expectedVersion: number);
|
|
69
62
|
}
|
|
70
63
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/types/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"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,EACd,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,EACzC,eAAe,EAAE,MAAM;CAW1C"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Types and interfaces for event store ports and disposables in the Act Framework.
|
|
6
6
|
*/
|
|
7
7
|
import type { Committed, EventMeta, Message, Query, Schemas } from "./action.js";
|
|
8
|
-
import type {
|
|
8
|
+
import type { Lease, Poll } from "./reaction.js";
|
|
9
9
|
/**
|
|
10
10
|
* A function that disposes of a resource asynchronously.
|
|
11
11
|
* @returns Promise that resolves when disposal is complete.
|
|
@@ -44,26 +44,36 @@ export interface Store extends Disposable {
|
|
|
44
44
|
* Query events in the store, optionally filtered by query options.
|
|
45
45
|
* @param callback - Function to call for each event.
|
|
46
46
|
* @param query - Optional query options.
|
|
47
|
-
* @param withSnaps - Whether to include snapshot events.
|
|
48
47
|
* @returns The number of events processed.
|
|
49
48
|
*/
|
|
50
|
-
query: <E extends Schemas>(callback: (event: Committed<E, keyof E>) => void, query?: Query
|
|
49
|
+
query: <E extends Schemas>(callback: (event: Committed<E, keyof E>) => void, query?: Query) => Promise<number>;
|
|
51
50
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @param limit - Maximum number of streams to
|
|
54
|
-
* @returns
|
|
51
|
+
* Polls the store for unblocked streams needing processing, ordered by lease watermark ascending.
|
|
52
|
+
* @param limit - Maximum number of streams to poll.
|
|
53
|
+
* @returns The polled streams.
|
|
55
54
|
*/
|
|
56
|
-
|
|
55
|
+
poll: (limit: number) => Promise<Poll[]>;
|
|
57
56
|
/**
|
|
58
57
|
* Lease streams for processing (e.g., for distributed consumers).
|
|
59
|
-
* @param leases - Lease requests.
|
|
58
|
+
* @param leases - Lease requests for streams, including end-of-lease watermark, lease holder, and source stream.
|
|
59
|
+
* @param millis - Lease duration in milliseconds.
|
|
60
60
|
* @returns Granted leases.
|
|
61
61
|
*/
|
|
62
|
-
lease: (leases: Lease[]) => Promise<Lease[]>;
|
|
62
|
+
lease: (leases: Lease[], millis: number) => Promise<Lease[]>;
|
|
63
63
|
/**
|
|
64
64
|
* Acknowledge completion of processing for leased streams.
|
|
65
|
-
* @param leases - Leases to acknowledge.
|
|
65
|
+
* @param leases - Leases to acknowledge, including lease holder and last processed watermark.
|
|
66
66
|
*/
|
|
67
|
-
ack: (leases: Lease[]) => Promise<
|
|
67
|
+
ack: (leases: Lease[]) => Promise<Lease[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Block a stream for processing after failing to process and reaching max retries with blocking enabled.
|
|
70
|
+
* @param leases - Leases to block, including lease holder and last error message.
|
|
71
|
+
* @returns Blocked leases.
|
|
72
|
+
*/
|
|
73
|
+
block: (leases: Array<Lease & {
|
|
74
|
+
error: string;
|
|
75
|
+
}>) => Promise<Array<Lease & {
|
|
76
|
+
error: string;
|
|
77
|
+
}>>;
|
|
68
78
|
}
|
|
69
79
|
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../../src/types/ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,KAAK,EACL,OAAO,EACR,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../../src/types/ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,KAAK,EACL,OAAO,EACR,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,UA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AAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CAChD"}
|
|
@@ -15,28 +15,35 @@ import type { Committed, Schema, Schemas, Snapshot } from "./action.js";
|
|
|
15
15
|
*/
|
|
16
16
|
export type ReactionHandler<E extends Schemas, K extends keyof E> = (event: Committed<E, K>, stream: string) => Promise<Snapshot<E, Schema> | void>;
|
|
17
17
|
/**
|
|
18
|
-
* Resolves the stream for a reaction, either by
|
|
18
|
+
* Resolves the stream for a reaction, either by mapping the event or statically.
|
|
19
19
|
* @template E - Event schemas.
|
|
20
20
|
* @template K - Event name.
|
|
21
21
|
* @param event - The committed event.
|
|
22
|
-
* @returns The stream name
|
|
22
|
+
* @returns The target stream name and optionally the source stream (for fetch optimization).
|
|
23
23
|
*/
|
|
24
|
-
export type ReactionResolver<E extends Schemas, K extends keyof E> =
|
|
24
|
+
export type ReactionResolver<E extends Schemas, K extends keyof E> = {
|
|
25
|
+
target: string;
|
|
26
|
+
source?: string;
|
|
27
|
+
} | ((event: Committed<E, K>) => {
|
|
28
|
+
target: string;
|
|
29
|
+
source?: string;
|
|
30
|
+
} | undefined);
|
|
25
31
|
/**
|
|
26
32
|
* Options for reaction processing.
|
|
27
33
|
* @property blockOnError - Whether to block on error.
|
|
28
34
|
* @property maxRetries - Maximum number of retries.
|
|
29
|
-
* @property retryDelayMs - Delay between retries in ms.
|
|
30
35
|
*/
|
|
31
36
|
export type ReactionOptions = {
|
|
32
37
|
readonly blockOnError: boolean;
|
|
33
38
|
readonly maxRetries: number;
|
|
34
|
-
readonly retryDelayMs: number;
|
|
35
39
|
};
|
|
36
40
|
/**
|
|
37
|
-
* Defines a reaction to an event
|
|
41
|
+
* Defines a reaction to an event.
|
|
38
42
|
* @template E - Event schemas.
|
|
39
43
|
* @template K - Event name.
|
|
44
|
+
* @property handler - The reaction handler.
|
|
45
|
+
* @property resolver - The reaction resolver.
|
|
46
|
+
* @property options - The reaction options.
|
|
40
47
|
*/
|
|
41
48
|
export type Reaction<E extends Schemas, K extends keyof E = keyof E> = {
|
|
42
49
|
readonly handler: ReactionHandler<E, K>;
|
|
@@ -44,37 +51,64 @@ export type Reaction<E extends Schemas, K extends keyof E = keyof E> = {
|
|
|
44
51
|
readonly options: ReactionOptions;
|
|
45
52
|
};
|
|
46
53
|
/**
|
|
47
|
-
* Payload for a reaction
|
|
54
|
+
* Payload for a reaction.
|
|
48
55
|
* @template E - Event schemas.
|
|
56
|
+
* @property handler - The reaction handler.
|
|
57
|
+
* @property resolver - The reaction resolver.
|
|
58
|
+
* @property options - The reaction options.
|
|
59
|
+
* @property event - The committed event triggering the reaction.
|
|
60
|
+
* @property source - The source stream.
|
|
49
61
|
*/
|
|
50
62
|
export type ReactionPayload<E extends Schemas> = Reaction<E> & {
|
|
51
63
|
readonly event: Committed<E, keyof E>;
|
|
64
|
+
readonly source?: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Poll details for stream processing.
|
|
68
|
+
* @property stream - The target stream name.
|
|
69
|
+
* @property source - The source stream.
|
|
70
|
+
* @property at - The lease watermark.
|
|
71
|
+
*/
|
|
72
|
+
export type Poll = {
|
|
73
|
+
readonly stream: string;
|
|
74
|
+
readonly source?: string;
|
|
75
|
+
readonly at: number;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Options for fetching events from the store.
|
|
79
|
+
* @property streamLimit - Maximum number of streams to fetch.
|
|
80
|
+
* @property eventLimit - Maximum number of events to fetch per stream.
|
|
81
|
+
*/
|
|
82
|
+
export type FetchOptions = {
|
|
83
|
+
readonly streamLimit?: number;
|
|
84
|
+
readonly eventLimit?: number;
|
|
85
|
+
readonly leaseMillis?: number;
|
|
52
86
|
};
|
|
53
87
|
/**
|
|
54
88
|
* Result of fetching events from the store for processing.
|
|
55
89
|
* @template E - Event schemas.
|
|
56
|
-
* @property
|
|
57
|
-
* @property
|
|
90
|
+
* @property stream - The stream name
|
|
91
|
+
* @property source - The source stream(s) (name or RegExp), or undefined when sourcing from all streams.
|
|
92
|
+
* @property events - The list of next committed events to be processed by the stream.
|
|
58
93
|
*/
|
|
59
|
-
export type Fetch<E extends Schemas> = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
94
|
+
export type Fetch<E extends Schemas> = Array<{
|
|
95
|
+
readonly stream: string;
|
|
96
|
+
readonly source?: string;
|
|
97
|
+
readonly events: Committed<E, keyof E>[];
|
|
98
|
+
}>;
|
|
63
99
|
/**
|
|
64
100
|
* Lease information for stream processing.
|
|
65
|
-
* @property stream - The stream name.
|
|
101
|
+
* @property stream - The target stream name.
|
|
102
|
+
* @property source - The source stream.
|
|
66
103
|
* @property by - The lease holder.
|
|
67
|
-
* @property at - The lease
|
|
104
|
+
* @property at - The lease watermark.
|
|
68
105
|
* @property retry - Retry count.
|
|
69
|
-
* @property block - Whether the stream is blocked.
|
|
70
|
-
* @property error - Optional error info.
|
|
71
106
|
*/
|
|
72
107
|
export type Lease = {
|
|
73
|
-
stream: string;
|
|
74
|
-
|
|
75
|
-
at: number;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
error?: unknown;
|
|
108
|
+
readonly stream: string;
|
|
109
|
+
readonly source?: string;
|
|
110
|
+
readonly at: number;
|
|
111
|
+
readonly by: string;
|
|
112
|
+
readonly retry: number;
|
|
79
113
|
};
|
|
80
114
|
//# sourceMappingURL=reaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../src/types/reaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAClE,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACtB,MAAM,EAAE,M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GAOG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
|
@@ -7,15 +7,19 @@ import type { Reaction } from "./reaction.js";
|
|
|
7
7
|
* @category Types
|
|
8
8
|
* Types for event and action registries in the Act Framework.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* Reactions register
|
|
12
|
+
*/
|
|
13
|
+
export type ReactionsRegister<E extends Schemas, K extends keyof E> = {
|
|
14
|
+
schema: ZodType<E[K]>;
|
|
15
|
+
reactions: Map<string, Reaction<E, K>>;
|
|
16
|
+
};
|
|
10
17
|
/**
|
|
11
18
|
* Maps event names to their schema and registered reactions.
|
|
12
19
|
* @template E - Event schemas.
|
|
13
20
|
*/
|
|
14
21
|
export type EventRegister<E extends Schemas> = {
|
|
15
|
-
[K in keyof E]:
|
|
16
|
-
schema: ZodType<E[K]>;
|
|
17
|
-
reactions: Map<string, Reaction<E, K>>;
|
|
18
|
-
};
|
|
22
|
+
[K in keyof E]: ReactionsRegister<E, K>;
|
|
19
23
|
};
|
|
20
24
|
/**
|
|
21
25
|
* Maps action names to their schema definitions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/types/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;GAKG;AAE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AW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC5E;IACE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;CAC3B,GAAG,aAAa,GACjB,KAAK,CAAC"}
|
|
@@ -100,20 +100,8 @@ export type StateSchema = Readonly<{
|
|
|
100
100
|
}>;
|
|
101
101
|
/**
|
|
102
102
|
* Query options for event store queries.
|
|
103
|
-
*
|
|
104
|
-
* - `stream?`: Filter by stream name
|
|
105
|
-
* - `names?`: Filter by event names
|
|
106
|
-
* - `before?`: Filter events before this id
|
|
107
|
-
* - `after?`: Filter events after this id
|
|
108
|
-
* - `limit?`: Limit the number of events to return
|
|
109
|
-
* - `created_before?`: Filter events created before this date/time
|
|
110
|
-
* - `created_after?`: Filter events created after this date/time
|
|
111
|
-
* - `backward?`: Order descending when true
|
|
112
|
-
* - `correlation?`: Filter by correlation
|
|
113
|
-
* - `actor?`: Filter by actor id (mainly used to reduce process managers)
|
|
114
|
-
* - `loading?`: Flag when loading to optimize queries
|
|
115
103
|
*/
|
|
116
|
-
export declare const QuerySchema: z.ZodObject<{
|
|
104
|
+
export declare const QuerySchema: z.ZodReadonly<z.ZodObject<{
|
|
117
105
|
stream: z.ZodOptional<z.ZodString>;
|
|
118
106
|
names: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
119
107
|
before: z.ZodOptional<z.ZodNumber>;
|
|
@@ -123,5 +111,6 @@ export declare const QuerySchema: z.ZodObject<{
|
|
|
123
111
|
created_after: z.ZodOptional<z.ZodDate>;
|
|
124
112
|
backward: z.ZodOptional<z.ZodBoolean>;
|
|
125
113
|
correlation: z.ZodOptional<z.ZodString>;
|
|
126
|
-
|
|
114
|
+
with_snaps: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
127
116
|
//# sourceMappingURL=schemas.d.ts.map
|