@event-driven-io/emmett 0.43.0-beta.13 → 0.43.0-beta.14

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/index.d.cts CHANGED
@@ -1,67 +1,65 @@
1
- import { a as EmmettError, C as ConcurrencyError, e as ErrorConstructor } from './index-D13Bsibj.cjs';
2
- export { f as ConcurrencyInMemoryDatabaseError, g as EmmettCliCommand, d as EmmettCliPlugin, h as EmmettCliPluginRegistration, c as EmmettPlugin, i as EmmettPluginConfig, j as EmmettPluginRegistration, b as EmmettPluginType, E as EmmettPluginsConfig, I as IllegalStateError, N as NotFoundError, V as ValidationError, k as isErrorConstructor, l as isPluginConfig } from './index-D13Bsibj.cjs';
3
- import retry from 'async-retry';
1
+ import { _ as isPluginConfig, a as IllegalStateError, c as isErrorConstructor, d as EmmettCliPlugin, f as EmmettCliPluginRegistration, g as EmmettPluginType, h as EmmettPluginRegistration, i as ErrorConstructor, l as EmmettPluginsConfig, m as EmmettPluginConfig, n as ConcurrencyInMemoryDatabaseError, o as NotFoundError, p as EmmettPlugin, r as EmmettError, s as ValidationError, t as ConcurrencyError, u as EmmettCliCommand } from "./index-BXN5muYb.cjs";
2
+ import retry from "async-retry";
4
3
 
4
+ //#region src/typing/deepReadonly.d.ts
5
5
  type Primitive = undefined | null | boolean | string | number | bigint | symbol | Function;
6
6
  type ImmutableTypes = Date | RegExp;
7
7
  type DeepReadonly<T> = T extends Primitive | ImmutableTypes ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer M> ? ReadonlySet<DeepReadonly<M>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends object ? DeepReadonlyObject<T> : Readonly<T>;
8
- type DeepReadonlyObject<T> = {
9
- readonly [P in keyof T]: DeepReadonly<T[P]>;
10
- };
8
+ type DeepReadonlyObject<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> };
11
9
  type Mutable<T> = T extends Primitive ? T : T extends ReadonlyArray<infer U> ? MutableArray<U> : T extends ReadonlyMap<infer K, infer V> ? MutableMap<K, V> : T extends ReadonlySet<infer M> ? MutableSet<M> : T extends Function ? T : T extends object ? MutableObject<T> : unknown;
12
10
  type MutableArray<T> = Array<Mutable<T>>;
13
11
  type MutableMap<K, V> = Map<Mutable<K>, Mutable<V>>;
14
12
  type MutableSet<T> = Set<Mutable<T>>;
15
- type MutableObject<T> = {
16
- -readonly [P in keyof T]: Mutable<T[P]>;
17
- };
18
-
13
+ type MutableObject<T> = { -readonly [P in keyof T]: Mutable<T[P]> };
14
+ //#endregion
15
+ //#region src/typing/command.d.ts
19
16
  type Command<CommandType extends string = string, CommandData extends DefaultRecord = DefaultRecord, CommandMetaData extends DefaultRecord | undefined = undefined> = Readonly<CommandMetaData extends undefined ? {
20
- type: CommandType;
21
- data: Readonly<CommandData>;
22
- metadata?: DefaultCommandMetadata | undefined;
17
+ type: CommandType;
18
+ data: Readonly<CommandData>;
19
+ metadata?: DefaultCommandMetadata | undefined;
23
20
  } : {
24
- type: CommandType;
25
- data: CommandData;
26
- metadata: CommandMetaData;
21
+ type: CommandType;
22
+ data: CommandData;
23
+ metadata: CommandMetaData;
27
24
  }> & {
28
- readonly kind?: 'Command';
25
+ readonly kind?: 'Command';
29
26
  };
30
27
  type AnyCommand = Command<any, any, any>;
31
28
  type CommandTypeOf<T extends Command> = T['type'];
32
29
  type CommandDataOf<T extends Command> = T['data'];
33
30
  type CommandMetaDataOf<T extends Command> = T extends {
34
- metadata: infer M;
31
+ metadata: infer M;
35
32
  } ? M : undefined;
36
33
  type CreateCommandType<CommandType extends string, CommandData extends DefaultRecord, CommandMetaData extends DefaultRecord | undefined = undefined> = Readonly<CommandMetaData extends undefined ? {
37
- type: CommandType;
38
- data: CommandData;
39
- metadata?: DefaultCommandMetadata | undefined;
34
+ type: CommandType;
35
+ data: CommandData;
36
+ metadata?: DefaultCommandMetadata | undefined;
40
37
  } : {
41
- type: CommandType;
42
- data: CommandData;
43
- metadata: CommandMetaData;
38
+ type: CommandType;
39
+ data: CommandData;
40
+ metadata: CommandMetaData;
44
41
  }> & {
45
- readonly kind?: 'Command';
42
+ readonly kind?: 'Command';
46
43
  };
47
44
  declare const command: <CommandType extends Command<string, any, any>>(...args: CommandMetaDataOf<CommandType> extends undefined ? [type: CommandTypeOf<CommandType>, data: CommandDataOf<CommandType>, metadata?: DefaultCommandMetadata | undefined] : [type: CommandTypeOf<CommandType>, data: CommandDataOf<CommandType>, metadata: CommandMetaDataOf<CommandType>]) => CommandType;
48
45
  type DefaultCommandMetadata = {
49
- now: Date;
46
+ now: Date;
50
47
  };
51
-
48
+ //#endregion
49
+ //#region src/database/types.d.ts
52
50
  /** TypeScript Omit (Exclude to be specific) does not work for objects with an "any" indexed type, and breaks discriminated unions @public */
53
51
  declare type EnhancedOmit<TRecordOrUnion, KeyUnion> = string extends keyof TRecordOrUnion ? TRecordOrUnion : TRecordOrUnion extends any ? Pick<TRecordOrUnion, Exclude<keyof TRecordOrUnion, KeyUnion>> : never;
54
52
  declare type WithId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
55
- _id: string;
53
+ _id: string;
56
54
  };
57
55
  type WithoutId<T> = Omit<T, '_id'>;
58
56
  declare type WithVersion<TSchema> = EnhancedOmit<TSchema, '_version'> & {
59
- _version: bigint;
57
+ _version: bigint;
60
58
  };
61
59
  type WithoutVersion<T> = Omit<T, '_version'>;
62
60
  type WithIdAndVersion<TSchema> = EnhancedOmit<TSchema, '_version' | '_id'> & {
63
- _id: string;
64
- _version: bigint;
61
+ _id: string;
62
+ _version: bigint;
65
63
  };
66
64
  type Document = Record<string, unknown>;
67
65
  type DocumentHandler<T extends Document> = (document: T | null) => T | null;
@@ -69,204 +67,209 @@ type ExpectedDocumentVersionGeneral = 'DOCUMENT_EXISTS' | 'DOCUMENT_DOES_NOT_EXI
69
67
  type ExpectedDocumentVersion = bigint | ExpectedDocumentVersionGeneral;
70
68
  type ExpectedDocumentVersionValue = bigint;
71
69
  type DatabaseHandleOptions = {
72
- expectedVersion?: ExpectedDocumentVersion;
70
+ expectedVersion?: ExpectedDocumentVersion;
73
71
  };
74
72
  type OperationResult = {
75
- acknowledged: boolean;
76
- successful: boolean;
77
- assertSuccessful: (errorMessage?: string) => void;
73
+ acknowledged: boolean;
74
+ successful: boolean;
75
+ assertSuccessful: (errorMessage?: string) => void;
78
76
  };
79
77
  interface InsertOneResult extends OperationResult {
80
- insertedId: string | null;
81
- nextExpectedVersion: bigint;
78
+ insertedId: string | null;
79
+ nextExpectedVersion: bigint;
82
80
  }
83
81
  interface InsertManyResult extends OperationResult {
84
- insertedIds: string[];
85
- insertedCount: number;
82
+ insertedIds: string[];
83
+ insertedCount: number;
86
84
  }
87
85
  interface UpdateResult extends OperationResult {
88
- matchedCount: number;
89
- modifiedCount: number;
90
- nextExpectedVersion: bigint;
86
+ matchedCount: number;
87
+ modifiedCount: number;
88
+ nextExpectedVersion: bigint;
91
89
  }
92
90
  interface UpdateManyResult extends OperationResult {
93
- matchedCount: number;
94
- modifiedCount: number;
91
+ matchedCount: number;
92
+ modifiedCount: number;
95
93
  }
96
94
  interface DeleteResult extends OperationResult {
97
- matchedCount: number;
98
- deletedCount: number;
95
+ matchedCount: number;
96
+ deletedCount: number;
99
97
  }
100
98
  interface DeleteManyResult extends OperationResult {
101
- deletedCount: number;
99
+ deletedCount: number;
102
100
  }
103
101
  type DatabaseHandleResult<T> = (InsertOneResult & {
104
- document: WithIdAndVersion<T>;
102
+ document: WithIdAndVersion<T>;
105
103
  }) | (UpdateResult & {
106
- document: WithIdAndVersion<T>;
104
+ document: WithIdAndVersion<T>;
107
105
  }) | (DeleteResult & {
108
- document: null;
106
+ document: null;
109
107
  }) | (OperationResult & {
110
- document: null;
108
+ document: null;
111
109
  });
112
110
  type DatabaseHandleOptionErrors = {
113
- throwOnOperationFailures?: boolean;
111
+ throwOnOperationFailures?: boolean;
114
112
  } | undefined;
115
113
  declare type OptionalId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
116
- _id?: string;
114
+ _id?: string;
117
115
  };
118
116
  declare type OptionalVersion<TSchema> = EnhancedOmit<TSchema, '_version'> & {
119
- _version?: bigint;
117
+ _version?: bigint;
120
118
  };
121
119
  declare type OptionalUnlessRequiredId<TSchema> = TSchema extends {
122
- _id: string;
120
+ _id: string;
123
121
  } ? TSchema : OptionalId<TSchema>;
124
122
  declare type OptionalUnlessRequiredVersion<TSchema> = TSchema extends {
125
- _version: bigint;
123
+ _version: bigint;
126
124
  } ? TSchema : OptionalVersion<TSchema>;
127
125
  declare type OptionalUnlessRequiredIdAndVersion<TSchema> = OptionalUnlessRequiredId<TSchema> & OptionalUnlessRequiredVersion<TSchema>;
128
126
  type InsertOneOptions = {
129
- expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
127
+ expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
130
128
  };
131
129
  type InsertManyOptions = {
132
- expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
130
+ expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
133
131
  };
134
132
  type UpdateOneOptions = {
135
- expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
133
+ expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
136
134
  };
137
135
  type UpdateManyOptions = {
138
- expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
136
+ expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
139
137
  };
140
138
  type ReplaceOneOptions = {
141
- expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
139
+ expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
142
140
  };
143
141
  type DeleteOneOptions = {
144
- expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
142
+ expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
145
143
  };
146
144
  type DeleteManyOptions = {
147
- expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
145
+ expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
148
146
  };
149
147
  type FullId<Collection extends string, Id extends string> = `${Collection}-${Id}`;
150
-
148
+ //#endregion
149
+ //#region src/database/inMemoryDatabase.d.ts
151
150
  interface InMemoryDocumentsCollection<T extends Document> {
152
- handle: (id: string, handle: DocumentHandler<T>, options?: DatabaseHandleOptions) => Promise<DatabaseHandleResult<T>>;
153
- findOne: (predicate?: Predicate<T>) => Promise<T | null>;
154
- find: (predicate?: Predicate<T>) => Promise<T[]>;
155
- insertOne: (document: OptionalUnlessRequiredIdAndVersion<T>) => Promise<InsertOneResult>;
156
- deleteOne: (predicate?: Predicate<T>) => Promise<DeleteResult>;
157
- replaceOne: (predicate: Predicate<T>, document: WithoutId<T>, options?: ReplaceOneOptions) => Promise<UpdateResult>;
151
+ handle: (id: string, handle: DocumentHandler<T>, options?: DatabaseHandleOptions) => Promise<DatabaseHandleResult<T>>;
152
+ findOne: (predicate?: Predicate<T>) => Promise<T | null>;
153
+ find: (predicate?: Predicate<T>) => Promise<T[]>;
154
+ insertOne: (document: OptionalUnlessRequiredIdAndVersion<T>) => Promise<InsertOneResult>;
155
+ deleteOne: (predicate?: Predicate<T>) => Promise<DeleteResult>;
156
+ replaceOne: (predicate: Predicate<T>, document: WithoutId<T>, options?: ReplaceOneOptions) => Promise<UpdateResult>;
158
157
  }
159
158
  interface InMemoryDatabase {
160
- collection: <T extends Document>(name: string) => InMemoryDocumentsCollection<T>;
159
+ collection: <T extends Document>(name: string) => InMemoryDocumentsCollection<T>;
161
160
  }
162
161
  type Predicate<T> = (item: T) => boolean;
163
162
  declare const getInMemoryDatabase: () => InMemoryDatabase;
164
-
163
+ //#endregion
164
+ //#region src/serialization/json/serializer.d.ts
165
165
  interface Serializer<Payload, SerializeOptions extends Record<string, unknown> = Record<string, unknown>, DeserializeOptions extends Record<string, unknown> = SerializeOptions> {
166
- serialize<T>(object: T, options?: SerializeOptions): Payload;
167
- deserialize<T>(payload: Payload, options?: DeserializeOptions): T;
166
+ serialize<T>(object: T, options?: SerializeOptions): Payload;
167
+ deserialize<T>(payload: Payload, options?: DeserializeOptions): T;
168
168
  }
169
169
  interface SerializationCodec<T, Payload, SerializeOptions extends Record<string, unknown> = Record<string, unknown>, DeserializeOptions extends Record<string, unknown> = SerializeOptions> {
170
- encode(object: T, options?: SerializeOptions): Payload;
171
- decode(payload: Payload, options?: DeserializeOptions): T;
170
+ encode(object: T, options?: SerializeOptions): Payload;
171
+ decode(payload: Payload, options?: DeserializeOptions): T;
172
+ }
173
+ //#endregion
174
+ //#region src/serialization/json/jsonSerializer.d.ts
175
+ interface JSONSerializer<SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> extends Serializer<string, SerializeOptions, DeserializeOptions> {
176
+ serialize<T>(object: T, options?: SerializeOptions): string;
177
+ deserialize<T>(payload: string, options?: DeserializeOptions): T;
172
178
  }
173
-
174
179
  type JSONSerializerOptions = {
175
- parseDates?: boolean;
176
- parseBigInts?: boolean;
177
- failOnBigIntSerialization?: boolean;
178
- useDefaultDateSerialization?: boolean;
180
+ parseDates?: boolean;
181
+ parseBigInts?: boolean;
182
+ failOnBigIntSerialization?: boolean;
183
+ useDefaultDateSerialization?: boolean;
179
184
  };
180
185
  type JSONSerializeOptions = {
181
- replacer?: JSONReplacer;
186
+ replacer?: JSONReplacer;
182
187
  } & JSONSerializerOptions;
183
188
  type JSONDeserializeOptions = {
184
- reviver?: JSONReviver;
189
+ reviver?: JSONReviver;
185
190
  } & JSONSerializerOptions;
191
+ interface JSONCodec<T, SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> extends SerializationCodec<T, string, SerializeOptions, DeserializeOptions> {
192
+ encode(object: T, options?: SerializeOptions): string;
193
+ decode(payload: string, options?: DeserializeOptions): T;
194
+ }
186
195
  type JSONCodecSerializationOptions<SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> = {
187
- serializer?: JSONSerializer<SerializeOptions, DeserializeOptions>;
188
- serializerOptions?: never;
196
+ serializer?: JSONSerializer<SerializeOptions, DeserializeOptions>;
197
+ serializerOptions?: never;
189
198
  } | {
190
- serializer?: never;
191
- serializerOptions?: JSONSerializerOptions;
199
+ serializer?: never;
200
+ serializerOptions?: JSONSerializerOptions;
192
201
  };
193
202
  type JSONSerializationOptions<SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> = {
194
- serialization?: {
195
- serializer?: JSONSerializer<SerializeOptions, DeserializeOptions>;
196
- options?: JSONSerializeOptions | JSONDeserializeOptions;
197
- } | undefined;
203
+ serialization?: {
204
+ serializer?: JSONSerializer<SerializeOptions, DeserializeOptions>;
205
+ options?: JSONSerializeOptions | JSONDeserializeOptions;
206
+ } | undefined;
198
207
  };
199
208
  type JSONCodecOptions<T, Payload = T, SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> = JSONCodecSerializationOptions<SerializeOptions, DeserializeOptions> & {
200
- upcast?: (document: Payload) => T;
201
- downcast?: (document: T) => Payload;
209
+ upcast?: (document: Payload) => T;
210
+ downcast?: (document: T) => Payload;
202
211
  };
212
+ type JSONReplacer = (this: any, key: string, value: any) => any;
213
+ type JSONReviver = (this: any, key: string, value: any, context: JSONReviverContext) => any;
203
214
  type JSONReviverContext = {
204
- source: string;
215
+ source: string;
205
216
  };
206
217
  declare const composeJSONReplacers: (...replacers: (JSONReplacer | undefined)[]) => JSONReplacer | undefined;
207
218
  declare const composeJSONRevivers: (...revivers: (JSONReviver | undefined)[]) => JSONReviver | undefined;
208
- type JSONReplacer = (this: any, key: string, value: any) => any;
209
219
  declare const JSONReplacer: (opts?: JSONSerializeOptions) => JSONReplacer | undefined;
210
- type JSONReviver = (this: any, key: string, value: any, context: JSONReviverContext) => any;
211
220
  declare const JSONReviver: (opts?: JSONDeserializeOptions) => JSONReviver | undefined;
212
221
  declare const JSONReplacers: {
213
- bigInt: JSONReplacer;
214
- date: JSONReplacer;
222
+ bigInt: JSONReplacer;
223
+ date: JSONReplacer;
215
224
  };
216
225
  declare const JSONRevivers: {
217
- bigInt: JSONReviver;
218
- date: JSONReviver;
226
+ bigInt: JSONReviver;
227
+ date: JSONReviver;
219
228
  };
220
229
  declare const jsonSerializer: (options?: JSONSerializerOptions & JSONDeserializeOptions & JSONSerializeOptions) => JSONSerializer;
221
- interface JSONSerializer<SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> extends Serializer<string, SerializeOptions, DeserializeOptions> {
222
- serialize<T>(object: T, options?: SerializeOptions): string;
223
- deserialize<T>(payload: string, options?: DeserializeOptions): T;
224
- }
225
230
  declare const JSONSerializer: JSONSerializer & {
226
- from: <SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions>(options?: JSONSerializationOptions<SerializeOptions, DeserializeOptions>) => JSONSerializer<SerializeOptions, DeserializeOptions>;
231
+ from: <SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions>(options?: JSONSerializationOptions<SerializeOptions, DeserializeOptions>) => JSONSerializer<SerializeOptions, DeserializeOptions>;
227
232
  };
228
- interface JSONCodec<T, SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> extends SerializationCodec<T, string, SerializeOptions, DeserializeOptions> {
229
- encode(object: T, options?: SerializeOptions): string;
230
- decode(payload: string, options?: DeserializeOptions): T;
231
- }
232
233
  declare const JSONCodec: <T, Payload = T, SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions>(options: JSONCodecOptions<T, Payload, SerializeOptions, DeserializeOptions>) => JSONCodec<T, SerializeOptions, DeserializeOptions>;
233
-
234
+ //#endregion
235
+ //#region src/projections/index.d.ts
234
236
  type ProjectionHandlingType = 'inline' | 'async';
235
237
  type ProjectionHandler<EventType extends Event = AnyEvent, EventMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = BatchRecordedMessageHandlerWithContext<EventType, EventMetaDataType, ProjectionHandlerContext>;
236
238
  type TruncateProjection<ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = (context: ProjectionHandlerContext) => Promise<void>;
237
239
  type ProjectionInitOptions<ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = {
238
- version: number;
239
- status?: 'active' | 'inactive';
240
- registrationType: ProjectionHandlingType;
241
- context: ProjectionHandlerContext;
240
+ version: number;
241
+ status?: 'active' | 'inactive';
242
+ registrationType: ProjectionHandlingType;
243
+ context: ProjectionHandlerContext;
242
244
  };
243
245
  type ProjectionDefinition<EventType extends Event = AnyEvent, EventMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord, EventPayloadType extends Event = EventType> = {
244
- name?: string;
245
- version?: number;
246
- kind?: string;
247
- canHandle: CanHandle<EventType>;
248
- handle: ProjectionHandler<EventType, EventMetaDataType, ProjectionHandlerContext>;
249
- truncate?: TruncateProjection<ProjectionHandlerContext>;
250
- init?: (options: ProjectionInitOptions<ProjectionHandlerContext>) => void | Promise<void>;
251
- eventsOptions?: {
252
- schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
253
- };
246
+ name?: string;
247
+ version?: number;
248
+ kind?: string;
249
+ canHandle: CanHandle<EventType>;
250
+ handle: ProjectionHandler<EventType, EventMetaDataType, ProjectionHandlerContext>;
251
+ truncate?: TruncateProjection<ProjectionHandlerContext>;
252
+ init?: (options: ProjectionInitOptions<ProjectionHandlerContext>) => void | Promise<void>;
253
+ eventsOptions?: {
254
+ schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
255
+ };
254
256
  } & JSONSerializationOptions;
255
257
  type ProjectionRegistration<HandlingType extends ProjectionHandlingType, ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = {
256
- type: HandlingType;
257
- projection: ProjectionDefinition<AnyEvent, ReadEventMetadataType, ProjectionHandlerContext, AnyEvent>;
258
+ type: HandlingType;
259
+ projection: ProjectionDefinition<AnyEvent, ReadEventMetadataType, ProjectionHandlerContext, AnyEvent>;
258
260
  };
259
261
  declare const filterProjections: <ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord>(type: ProjectionHandlingType, projections: ProjectionRegistration<ProjectionHandlingType, ReadEventMetadataType, ProjectionHandlerContext>[]) => ProjectionDefinition<AnyEvent, ReadEventMetadataType, ProjectionHandlerContext, AnyEvent>[];
260
262
  declare const projection: <EventType extends Event = Event, EventMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord, EventPayloadType extends Event = EventType>(definition: ProjectionDefinition<EventType, EventMetaDataType, ProjectionHandlerContext, EventPayloadType>) => ProjectionDefinition<EventType, EventMetaDataType, ProjectionHandlerContext, EventPayloadType>;
261
263
  declare const inlineProjections: <ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord>(definitions: ProjectionDefinition<any, ReadEventMetadataType, ProjectionHandlerContext>[]) => ProjectionRegistration<"inline", ReadEventMetadataType, ProjectionHandlerContext>[];
262
264
  declare const asyncProjections: <ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord>(definitions: ProjectionDefinition<AnyEvent, ReadEventMetadataType, ProjectionHandlerContext>[]) => ProjectionRegistration<"inline", ReadEventMetadataType, ProjectionHandlerContext>[];
263
265
  declare const projections: {
264
- inline: <ReadEventMetadataType extends AnyReadEventMetadata = AnyRecordedMessageMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord>(definitions: ProjectionDefinition<any, ReadEventMetadataType, ProjectionHandlerContext>[]) => ProjectionRegistration<"inline", ReadEventMetadataType, ProjectionHandlerContext>[];
265
- async: <ReadEventMetadataType extends AnyReadEventMetadata = AnyRecordedMessageMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord>(definitions: ProjectionDefinition<AnyEvent, ReadEventMetadataType, ProjectionHandlerContext>[]) => ProjectionRegistration<"inline", ReadEventMetadataType, ProjectionHandlerContext>[];
266
+ inline: <ReadEventMetadataType extends AnyReadEventMetadata = AnyRecordedMessageMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord>(definitions: ProjectionDefinition<any, ReadEventMetadataType, ProjectionHandlerContext>[]) => ProjectionRegistration<"inline", ReadEventMetadataType, ProjectionHandlerContext>[];
267
+ async: <ReadEventMetadataType extends AnyReadEventMetadata = AnyRecordedMessageMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord>(definitions: ProjectionDefinition<AnyEvent, ReadEventMetadataType, ProjectionHandlerContext>[]) => ProjectionRegistration<"inline", ReadEventMetadataType, ProjectionHandlerContext>[];
266
268
  };
267
-
269
+ //#endregion
270
+ //#region src/processors/processors.d.ts
268
271
  type CurrentMessageProcessorPosition = {
269
- lastCheckpoint: ProcessorCheckpoint;
272
+ lastCheckpoint: ProcessorCheckpoint;
270
273
  } | 'BEGINNING' | 'END';
271
274
  type GetCheckpoint<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata> = (message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
272
275
  declare const getCheckpoint: <MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata>(message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
@@ -274,194 +277,197 @@ declare const wasMessageHandled: <MessageType extends AnyMessage = AnyMessage, M
274
277
  type MessageProcessorStartFrom = CurrentMessageProcessorPosition | 'CURRENT';
275
278
  type MessageProcessorType = 'projector' | 'reactor';
276
279
  declare const MessageProcessorType: {
277
- PROJECTOR: MessageProcessorType;
278
- REACTOR: MessageProcessorType;
280
+ PROJECTOR: MessageProcessorType;
281
+ REACTOR: MessageProcessorType;
279
282
  };
280
283
  type MessageProcessor<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord | undefined = undefined> = {
281
- id: string;
282
- instanceId: string;
283
- type: string;
284
- canHandle?: string[];
285
- init: (options: Partial<HandlerContext>) => Promise<void>;
286
- start: (options: Partial<HandlerContext>) => Promise<CurrentMessageProcessorPosition | undefined>;
287
- close: (closeOptions: Partial<HandlerContext>) => Promise<void>;
288
- isActive: boolean;
289
- handle: BatchRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, Partial<HandlerContext>>;
284
+ id: string;
285
+ instanceId: string;
286
+ type: string;
287
+ canHandle?: string[];
288
+ init: (options: Partial<HandlerContext>) => Promise<void>;
289
+ start: (options: Partial<HandlerContext>) => Promise<CurrentMessageProcessorPosition | undefined>;
290
+ close: (closeOptions: Partial<HandlerContext>) => Promise<void>;
291
+ isActive: boolean;
292
+ handle: BatchRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, Partial<HandlerContext>>;
290
293
  };
291
294
  declare const MessageProcessor: {
292
- result: {
293
- skip: (options?: {
294
- reason?: string;
295
- }) => SingleMessageHandlerResult;
296
- stop: (options?: {
297
- reason?: string;
298
- error?: EmmettError;
299
- }) => SingleMessageHandlerResult;
300
- };
295
+ result: {
296
+ skip: (options?: {
297
+ reason?: string;
298
+ }) => SingleMessageHandlerResult;
299
+ stop: (options?: {
300
+ reason?: string;
301
+ error?: EmmettError;
302
+ }) => SingleMessageHandlerResult;
303
+ };
301
304
  };
302
305
  type MessageProcessingScope<HandlerContext extends DefaultRecord | undefined = undefined> = <Result = SingleMessageHandlerResult>(handler: (context: HandlerContext) => Result | Promise<Result>, partialContext: Partial<HandlerContext>) => Result | Promise<Result>;
303
306
  type Checkpointer<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
304
- read: ReadProcessorCheckpoint<HandlerContext>;
305
- store: StoreProcessorCheckpoint<MessageType, MessageMetadataType, HandlerContext>;
307
+ read: ReadProcessorCheckpoint<HandlerContext>;
308
+ store: StoreProcessorCheckpoint<MessageType, MessageMetadataType, HandlerContext>;
306
309
  };
307
310
  type ProcessorHooks<HandlerContext extends DefaultRecord = DefaultRecord> = {
308
- onInit?: OnReactorInitHook<HandlerContext>;
309
- onStart?: OnReactorStartHook<HandlerContext>;
310
- onClose?: OnReactorCloseHook<HandlerContext>;
311
+ onInit?: OnReactorInitHook<HandlerContext>;
312
+ onStart?: OnReactorStartHook<HandlerContext>;
313
+ onClose?: OnReactorCloseHook<HandlerContext>;
311
314
  };
312
315
  type BaseMessageProcessorOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
313
- type?: string;
314
- processorId: string;
315
- processorInstanceId?: string;
316
- version?: number;
317
- partition?: string;
318
- startFrom?: MessageProcessorStartFrom;
319
- stopAfter?: (message: RecordedMessage<MessageType, MessageMetadataType>) => boolean;
320
- processingScope?: MessageProcessingScope<HandlerContext>;
321
- checkpoints?: Checkpointer<MessageType, MessageMetadataType, HandlerContext>;
322
- canHandle?: CanHandle<MessageType>;
323
- hooks?: ProcessorHooks<HandlerContext>;
316
+ type?: string;
317
+ processorId: string;
318
+ processorInstanceId?: string;
319
+ version?: number;
320
+ partition?: string;
321
+ startFrom?: MessageProcessorStartFrom;
322
+ stopAfter?: (message: RecordedMessage<MessageType, MessageMetadataType>) => boolean;
323
+ processingScope?: MessageProcessingScope<HandlerContext>;
324
+ checkpoints?: Checkpointer<MessageType, MessageMetadataType, HandlerContext>;
325
+ canHandle?: CanHandle<MessageType>;
326
+ hooks?: ProcessorHooks<HandlerContext>;
324
327
  } & JSONSerializationOptions;
325
328
  type HandlerOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
326
- eachMessage: SingleRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, HandlerContext>;
327
- eachBatch?: never;
329
+ eachMessage: SingleRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, HandlerContext>;
330
+ eachBatch?: never;
328
331
  } | {
329
- eachMessage?: never;
330
- eachBatch: BatchRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, HandlerContext>;
332
+ eachMessage?: never;
333
+ eachBatch: BatchRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, HandlerContext>;
331
334
  };
332
335
  type OnReactorInitHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
333
336
  type OnReactorStartHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
334
337
  type OnReactorCloseHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
335
338
  type ReactorOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, MessagePayloadType extends AnyMessage = MessageType> = BaseMessageProcessorOptions<MessageType, MessageMetadataType, HandlerContext> & HandlerOptions<MessageType, MessageMetadataType, HandlerContext> & {
336
- messageOptions?: {
337
- schema?: {
338
- versioning?: {
339
- upcast?: (event: MessagePayloadType) => MessageType;
340
- };
341
- };
339
+ messageOptions?: {
340
+ schema?: {
341
+ versioning?: {
342
+ upcast?: (event: MessagePayloadType) => MessageType;
343
+ };
342
344
  };
345
+ };
343
346
  };
344
347
  type ProjectorOptions<EventType extends AnyEvent = AnyEvent, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, EventPayloadType extends Event = EventType> = Omit<BaseMessageProcessorOptions<EventType, MessageMetadataType, HandlerContext>, 'type' | 'processorId'> & {
345
- processorId?: string;
348
+ processorId?: string;
346
349
  } & {
347
- truncateOnStart?: boolean;
348
- projection: ProjectionDefinition<EventType, MessageMetadataType, HandlerContext, EventPayloadType>;
350
+ truncateOnStart?: boolean;
351
+ projection: ProjectionDefinition<EventType, MessageMetadataType, HandlerContext, EventPayloadType>;
349
352
  };
350
353
  declare const defaultProcessingMessageProcessingScope: <HandlerContext = never, Result = SingleMessageHandlerResult>(handler: (context: HandlerContext) => Result | Promise<Result>, partialContext: Partial<HandlerContext>) => Result | Promise<Result>;
351
354
  type ProcessorCheckpoint = Brand<string, 'ProcessorCheckpoint'>;
352
355
  declare const bigIntProcessorCheckpoint: (value: bigint) => ProcessorCheckpoint;
353
356
  declare const parseBigIntProcessorCheckpoint: (value: ProcessorCheckpoint) => bigint;
354
357
  type ReadProcessorCheckpointResult = {
355
- lastCheckpoint: ProcessorCheckpoint | null;
358
+ lastCheckpoint: ProcessorCheckpoint | null;
356
359
  };
357
360
  type ReadProcessorCheckpoint<HandlerContext extends DefaultRecord = DefaultRecord> = (options: {
358
- processorId: string;
359
- partition?: string;
361
+ processorId: string;
362
+ partition?: string;
360
363
  }, context: HandlerContext) => Promise<ReadProcessorCheckpointResult>;
361
364
  type StoreProcessorCheckpointResult = {
362
- success: true;
363
- newCheckpoint: ProcessorCheckpoint | null;
365
+ success: true;
366
+ newCheckpoint: ProcessorCheckpoint | null;
364
367
  } | {
365
- success: false;
366
- reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
368
+ success: false;
369
+ reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
367
370
  };
368
371
  type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord | undefined = undefined> = (options: {
369
- message: RecordedMessage<MessageType, MessageMetadataType>;
370
- processorId: string;
371
- version: number | undefined;
372
- lastCheckpoint: ProcessorCheckpoint | null;
373
- partition?: string;
372
+ message: RecordedMessage<MessageType, MessageMetadataType>;
373
+ processorId: string;
374
+ version: number | undefined;
375
+ lastCheckpoint: ProcessorCheckpoint | null;
376
+ partition?: string;
374
377
  }, context: HandlerContext) => Promise<StoreProcessorCheckpointResult>;
375
378
  declare const defaultProcessorVersion = 1;
376
379
  declare const defaultProcessorPartition = "emt:default";
377
380
  declare const getProcessorInstanceId: (processorId: string) => string;
378
381
  declare const getProjectorId: (options: {
379
- projectionName: string;
382
+ projectionName: string;
380
383
  }) => string;
381
384
  declare const reactor: <MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, MessagePayloadType extends Message = MessageType>(options: ReactorOptions<MessageType, MessageMetadataType, HandlerContext, MessagePayloadType>) => MessageProcessor<MessageType, MessageMetadataType, HandlerContext>;
382
385
  declare const projector: <EventType extends Event = Event, EventMetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends DefaultRecord = DefaultRecord, EventPayloadType extends Event = EventType>(options: ProjectorOptions<EventType, EventMetaDataType, HandlerContext, EventPayloadType>) => MessageProcessor<EventType, EventMetaDataType, HandlerContext>;
383
-
386
+ //#endregion
387
+ //#region src/processors/inMemoryProcessors.d.ts
384
388
  type InMemoryProcessorHandlerContext = {
385
- database: InMemoryDatabase;
389
+ database: InMemoryDatabase;
386
390
  };
387
391
  type InMemoryProcessor<MessageType extends AnyMessage = AnyMessage> = MessageProcessor<MessageType, ReadEventMetadataWithGlobalPosition, InMemoryProcessorHandlerContext> & {
388
- database: InMemoryDatabase;
392
+ database: InMemoryDatabase;
389
393
  };
390
394
  type InMemoryProcessorEachMessageHandler<MessageType extends AnyMessage = AnyMessage> = SingleRecordedMessageHandlerWithContext<MessageType, ReadEventMetadataWithGlobalPosition, InMemoryProcessorHandlerContext>;
391
395
  type InMemoryProcessorEachBatchHandler<MessageType extends AnyMessage = AnyMessage> = BatchRecordedMessageHandlerWithContext<MessageType, ReadEventMetadataWithGlobalPosition, InMemoryProcessorHandlerContext>;
392
396
  type InMemoryProcessorConnectionOptions = {
393
- database?: InMemoryDatabase;
397
+ database?: InMemoryDatabase;
394
398
  };
395
399
  type InMemoryCheckpointer<MessageType extends AnyMessage = AnyMessage> = Checkpointer<MessageType, ReadEventMetadataWithGlobalPosition, InMemoryProcessorHandlerContext>;
396
400
  declare const inMemoryCheckpointer: <MessageType extends AnyMessage = AnyMessage>() => InMemoryCheckpointer<MessageType>;
397
401
  type InMemoryConnectionOptions = {
398
- connectionOptions?: InMemoryProcessorConnectionOptions;
402
+ connectionOptions?: InMemoryProcessorConnectionOptions;
399
403
  };
400
404
  type InMemoryReactorOptions<MessageType extends AnyMessage = AnyMessage> = ReactorOptions<MessageType, ReadEventMetadataWithGlobalPosition, InMemoryProcessorHandlerContext> & InMemoryConnectionOptions;
401
405
  type InMemoryProjectorOptions<EventType extends AnyEvent = AnyEvent> = ProjectorOptions<EventType, ReadEventMetadataWithGlobalPosition, InMemoryProcessorHandlerContext> & InMemoryConnectionOptions;
402
406
  type InMemoryProcessorOptions<MessageType extends AnyMessage = AnyMessage> = InMemoryReactorOptions<MessageType> | InMemoryProjectorOptions<MessageType & AnyEvent>;
403
407
  declare const inMemoryProjector: <EventType extends AnyEvent = AnyEvent>(options: InMemoryProjectorOptions<EventType>) => InMemoryProcessor<EventType>;
404
408
  declare const inMemoryReactor: <MessageType extends AnyMessage = AnyMessage>(options: InMemoryReactorOptions<MessageType>) => InMemoryProcessor<MessageType>;
405
-
409
+ //#endregion
410
+ //#region src/typing/message.d.ts
406
411
  type Message<Type extends string = string, Data extends DefaultRecord = DefaultRecord, MetaData extends DefaultRecord | undefined = undefined> = Command<Type, Data, MetaData> | Event<Type, Data, MetaData>;
407
412
  type AnyMessage = AnyEvent | AnyCommand;
408
413
  type MessageKindOf<T extends Message> = T['kind'];
409
414
  type MessageTypeOf<T extends Message> = T['type'];
410
415
  type MessageDataOf<T extends Message> = T['data'];
411
416
  type MessageMetaDataOf<T extends Message> = T extends {
412
- metadata: infer M;
417
+ metadata: infer M;
413
418
  } ? M : undefined;
414
419
  type CanHandle<T extends Message> = MessageTypeOf<T>[];
415
420
  declare const message: <MessageType extends Message<string, any, any>>(...args: MessageMetaDataOf<MessageType> extends undefined ? [kind: MessageKindOf<MessageType>, type: MessageTypeOf<MessageType>, data: MessageDataOf<MessageType>] : [kind: MessageKindOf<MessageType>, type: MessageTypeOf<MessageType>, data: MessageDataOf<MessageType>, metadata: MessageMetaDataOf<MessageType>]) => MessageType;
416
421
  type CombinedMessageMetadata<MessageType extends Message = Message, MessageMetaDataType extends DefaultRecord = DefaultRecord> = MessageMetaDataOf<MessageType> extends undefined ? MessageMetaDataType : MessageMetaDataOf<MessageType> & MessageMetaDataType;
417
422
  type CombineMetadata<MessageType extends Message = Message, MessageMetaDataType extends DefaultRecord = DefaultRecord> = MessageType & {
418
- metadata: CombinedMessageMetadata<MessageType, MessageMetaDataType>;
423
+ metadata: CombinedMessageMetadata<MessageType, MessageMetaDataType>;
419
424
  };
420
425
  type RecordedMessage<MessageType extends Message = Message, MessageMetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata> = CombineMetadata<MessageType, MessageMetaDataType> & {
421
- kind: NonNullable<MessageKindOf<Message>>;
426
+ kind: NonNullable<MessageKindOf<Message>>;
422
427
  };
423
428
  type CommonRecordedMessageMetadata = Readonly<{
424
- messageId: string;
425
- streamPosition: StreamPosition;
426
- streamName: string;
427
- checkpoint?: ProcessorCheckpoint | null;
429
+ messageId: string;
430
+ streamPosition: StreamPosition;
431
+ streamName: string;
432
+ checkpoint?: ProcessorCheckpoint | null;
428
433
  }>;
429
434
  type WithGlobalPosition = Readonly<{
430
- globalPosition: GlobalPosition;
435
+ globalPosition: GlobalPosition;
431
436
  }>;
432
437
  type RecordedMessageMetadata<HasGlobalPosition = undefined> = CommonRecordedMessageMetadata & (HasGlobalPosition extends undefined ? {} : WithGlobalPosition);
433
438
  type AnyRecordedMessage = Message<any, any, any>;
434
439
  type AnyRecordedMessageMetadata = RecordedMessageMetadata<any>;
435
440
  type RecordedMessageMetadataWithGlobalPosition = RecordedMessageMetadata<true>;
436
441
  type RecordedMessageMetadataWithoutGlobalPosition = RecordedMessageMetadata<undefined>;
437
-
442
+ //#endregion
443
+ //#region src/typing/event.d.ts
438
444
  type StreamPosition = bigint;
439
445
  type GlobalPosition = bigint;
440
446
  type Event<EventType extends string = string, EventData extends DefaultRecord = DefaultRecord, EventMetaData extends DefaultRecord | undefined = undefined> = Readonly<EventMetaData extends undefined ? {
441
- type: EventType;
442
- data: EventData;
447
+ type: EventType;
448
+ data: EventData;
443
449
  } : {
444
- type: EventType;
445
- data: EventData;
446
- metadata: EventMetaData;
450
+ type: EventType;
451
+ data: EventData;
452
+ metadata: EventMetaData;
447
453
  }> & {
448
- readonly kind?: 'Event';
454
+ readonly kind?: 'Event';
449
455
  };
450
456
  type AnyEvent = Event<any, any, any>;
451
457
  type EventTypeOf<T extends Event> = T['type'];
452
458
  type EventDataOf<T extends Event> = T['data'];
453
459
  type EventMetaDataOf<T extends Event> = T extends {
454
- metadata: infer M;
460
+ metadata: infer M;
455
461
  } ? M : undefined;
456
462
  type CreateEventType<EventType extends string, EventData extends DefaultRecord, EventMetaData extends DefaultRecord | undefined = undefined> = Readonly<EventMetaData extends undefined ? {
457
- type: EventType;
458
- data: EventData;
463
+ type: EventType;
464
+ data: EventData;
459
465
  } : {
460
- type: EventType;
461
- data: EventData;
462
- metadata: EventMetaData;
466
+ type: EventType;
467
+ data: EventData;
468
+ metadata: EventMetaData;
463
469
  }> & {
464
- readonly kind?: 'Event';
470
+ readonly kind?: 'Event';
465
471
  };
466
472
  declare const event: <EventType extends Event<string, any, any>>(...args: EventMetaDataOf<EventType> extends undefined ? [type: EventTypeOf<EventType>, data: EventDataOf<EventType>] : [type: EventTypeOf<EventType>, data: EventDataOf<EventType>, metadata: EventMetaDataOf<EventType>]) => EventType;
467
473
  type CombinedReadEventMetadata<EventType extends Event = Event, EventMetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata> = CombinedMessageMetadata<EventType, EventMetaDataType>;
@@ -472,7 +478,8 @@ type ReadEventMetadata<HasGlobalPosition = undefined> = RecordedMessageMetadata<
472
478
  type AnyReadEventMetadata = AnyRecordedMessageMetadata;
473
479
  type ReadEventMetadataWithGlobalPosition = RecordedMessageMetadataWithGlobalPosition;
474
480
  type ReadEventMetadataWithoutGlobalPosition = RecordedMessageMetadataWithoutGlobalPosition;
475
-
481
+ //#endregion
482
+ //#region src/typing/messageHandling.d.ts
476
483
  type SingleRawMessageHandlerWithoutContext<MessageType extends Message = AnyMessage> = (message: MessageType) => Promise<SingleMessageHandlerResult> | SingleMessageHandlerResult;
477
484
  type SingleRecordedMessageHandlerWithoutContext<MessageType extends Message = AnyMessage, MessageMetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata> = (message: RecordedMessage<MessageType, MessageMetaDataType>) => Promise<SingleMessageHandlerResult> | SingleMessageHandlerResult;
478
485
  type SingleMessageHandlerWithoutContext<MessageType extends AnyMessage = AnyMessage, MessageMetaDataType extends AnyRecordedMessageMetadata = never> = SingleRawMessageHandlerWithoutContext<MessageType> | SingleRecordedMessageHandlerWithoutContext<MessageType, MessageMetaDataType>;
@@ -489,39 +496,41 @@ type BatchMessageHandlerWithContext<MessageType extends AnyMessage = AnyMessage,
489
496
  type BatchMessageHandler<MessageType extends Message = AnyMessage, MessageMetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends DefaultRecord | undefined = undefined> = HandlerContext extends DefaultRecord ? BatchMessageHandlerWithContext<MessageType, MessageMetaDataType, HandlerContext> : BatchMessageHandlerWithoutContext<MessageType, MessageMetaDataType>;
490
497
  type MessageHandler<MessageType extends Message = Message, MessageMetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends DefaultRecord | undefined = undefined> = (HandlerContext extends DefaultRecord ? SingleMessageHandler<MessageType, MessageMetaDataType, HandlerContext> : SingleMessageHandler<MessageType, MessageMetaDataType>) | (HandlerContext extends DefaultRecord ? BatchMessageHandler<MessageType, MessageMetaDataType, HandlerContext> : BatchMessageHandler<MessageType, MessageMetaDataType>);
491
498
  type SingleMessageHandlerResult = void | {
492
- type: 'ACK';
499
+ type: 'ACK';
493
500
  } | {
494
- type: 'SKIP';
495
- reason?: string;
501
+ type: 'SKIP';
502
+ reason?: string;
496
503
  } | {
497
- type: 'STOP';
498
- reason?: string;
499
- error?: EmmettError;
504
+ type: 'STOP';
505
+ reason?: string;
506
+ error?: EmmettError;
500
507
  };
501
508
  type BatchMessageHandlerResult = void | {
502
- type: 'ACK';
509
+ type: 'ACK';
503
510
  } | {
504
- type: 'SKIP';
505
- reason?: string;
506
- lastSuccessfulMessage: AnyRecordedMessage;
511
+ type: 'SKIP';
512
+ reason?: string;
513
+ lastSuccessfulMessage: AnyRecordedMessage;
507
514
  } | {
508
- type: 'STOP';
509
- reason?: string;
510
- error?: EmmettError;
511
- lastSuccessfulMessage?: AnyRecordedMessage;
515
+ type: 'STOP';
516
+ reason?: string;
517
+ error?: EmmettError;
518
+ lastSuccessfulMessage?: AnyRecordedMessage;
512
519
  };
513
-
520
+ //#endregion
521
+ //#region src/typing/decider.d.ts
514
522
  type Decider<State, CommandType extends Command, StreamEvent extends Event> = {
515
- decide: (command: CommandType, state: State) => StreamEvent | StreamEvent[];
516
- evolve: (currentState: State, event: StreamEvent) => State;
517
- initialState: () => State;
523
+ decide: (command: CommandType, state: State) => StreamEvent | StreamEvent[];
524
+ evolve: (currentState: State, event: StreamEvent) => State;
525
+ initialState: () => State;
518
526
  };
519
-
527
+ //#endregion
528
+ //#region src/typing/index.d.ts
520
529
  type Brand<K, T> = K & {
521
- readonly __brand: T;
530
+ readonly __brand: T;
522
531
  };
523
532
  type Flavour<K, T> = K & {
524
- readonly __brand?: T;
533
+ readonly __brand?: T;
525
534
  };
526
535
  type DefaultRecord = Record<string, unknown>;
527
536
  type AnyRecord = Record<string, any>;
@@ -530,7 +539,8 @@ declare const emmettPrefix = "emt";
530
539
  declare const globalTag = "global";
531
540
  declare const defaultTag = "emt:default";
532
541
  declare const unknownTag = "emt:unknown";
533
-
542
+ //#endregion
543
+ //#region src/eventStore/expectedVersion.d.ts
534
544
  type ExpectedStreamVersion = ExpectedStreamVersionWithValue | ExpectedStreamVersionGeneral;
535
545
  type ExpectedStreamVersionWithValue = Flavour<StreamPosition, 'StreamVersion'>;
536
546
  type ExpectedStreamVersionGeneral = Flavour<'STREAM_EXISTS' | 'STREAM_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK', 'StreamVersion'>;
@@ -540,156 +550,159 @@ declare const NO_CONCURRENCY_CHECK: ExpectedStreamVersionGeneral;
540
550
  declare const matchesExpectedVersion: (current: StreamPosition | undefined, expected: ExpectedStreamVersion, defaultVersion: StreamPosition) => boolean;
541
551
  declare const assertExpectedVersionMatchesCurrent: (current: StreamPosition, expected: ExpectedStreamVersion | undefined, defaultVersion: StreamPosition) => void;
542
552
  declare class ExpectedVersionConflictError extends ConcurrencyError {
543
- constructor(current: StreamPosition, expected: ExpectedStreamVersion);
553
+ constructor(current: StreamPosition, expected: ExpectedStreamVersion);
544
554
  }
545
555
  declare const isExpectedVersionConflictError: (error: unknown) => error is ExpectedVersionConflictError;
546
-
556
+ //#endregion
557
+ //#region src/eventStore/eventStore.d.ts
547
558
  interface EventStore<ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata> {
548
- aggregateStream<State, EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, options: AggregateStreamOptions<State, EventType, ReadEventMetadataType, EventPayloadType>): Promise<AggregateStreamResult<State>>;
549
- readStream<EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, options?: ReadStreamOptions<EventType, EventPayloadType>): Promise<ReadStreamResult<EventType, ReadEventMetadataType>>;
550
- appendToStream<EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, events: EventType[], options?: AppendToStreamOptions<EventType, EventPayloadType>): Promise<AppendToStreamResult>;
551
- streamExists(streamName: string): Promise<StreamExistsResult>;
559
+ aggregateStream<State, EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, options: AggregateStreamOptions<State, EventType, ReadEventMetadataType, EventPayloadType>): Promise<AggregateStreamResult<State>>;
560
+ readStream<EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, options?: ReadStreamOptions<EventType, EventPayloadType>): Promise<ReadStreamResult<EventType, ReadEventMetadataType>>;
561
+ appendToStream<EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, events: EventType[], options?: AppendToStreamOptions<EventType, EventPayloadType>): Promise<AppendToStreamResult>;
562
+ streamExists(streamName: string): Promise<StreamExistsResult>;
552
563
  }
553
564
  type EventStoreReadEventMetadata<Store extends EventStore> = Store extends EventStore<infer T> ? T extends CommonReadEventMetadata ? T extends WithGlobalPosition ? ReadEventMetadata<true> & T : ReadEventMetadata<undefined> & T : never : never;
554
565
  type EventStoreSession<EventStoreType extends EventStore> = {
555
- eventStore: EventStoreType;
556
- close: () => Promise<void>;
566
+ eventStore: EventStoreType;
567
+ close: () => Promise<void>;
557
568
  };
558
569
  interface EventStoreSessionFactory<EventStoreType extends EventStore> {
559
- withSession<T = unknown>(callback: (session: EventStoreSession<EventStoreType>) => Promise<T>): Promise<T>;
570
+ withSession<T = unknown>(callback: (session: EventStoreSession<EventStoreType>) => Promise<T>): Promise<T>;
560
571
  }
561
572
  declare const canCreateEventStoreSession: <Store extends EventStore>(eventStore: Store | EventStoreSessionFactory<Store>) => eventStore is EventStoreSessionFactory<Store>;
562
573
  declare const nulloSessionFactory: <EventStoreType extends EventStore>(eventStore: EventStoreType) => EventStoreSessionFactory<EventStoreType>;
563
574
  type EventStoreReadSchemaOptions<StreamEvent extends Event = Event, StoredEvent extends Event = StreamEvent> = {
564
- versioning?: {
565
- upcast?: (event: StoredEvent) => StreamEvent;
566
- };
575
+ versioning?: {
576
+ upcast?: (event: StoredEvent) => StreamEvent;
577
+ };
567
578
  };
568
579
  type EventStoreAppendSchemaOptions<StreamEvent extends Event = Event, StoredEvent extends Event = StreamEvent> = {
569
- versioning?: {
570
- downcast?: (event: StreamEvent) => StoredEvent;
571
- };
580
+ versioning?: {
581
+ downcast?: (event: StreamEvent) => StoredEvent;
582
+ };
572
583
  };
573
584
  type EventStoreSchemaOptions<StreamEvent extends Event = Event, StoredEvent extends Event = StreamEvent> = EventStoreReadSchemaOptions<StreamEvent, StoredEvent> & EventStoreAppendSchemaOptions<StreamEvent, StoredEvent>;
574
585
  type ReadStreamOptions<EventType extends Event = Event, EventPayloadType extends Event = EventType> = {
575
- from?: StreamPosition;
576
- to?: StreamPosition;
577
- maxCount?: bigint;
578
- expectedStreamVersion?: ExpectedStreamVersion;
579
- schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
586
+ from?: StreamPosition;
587
+ to?: StreamPosition;
588
+ maxCount?: bigint;
589
+ expectedStreamVersion?: ExpectedStreamVersion;
590
+ schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
580
591
  } & JSONSerializationOptions;
581
592
  type ReadStreamResult<EventType extends Event, ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata> = {
582
- currentStreamVersion: StreamPosition;
583
- events: ReadEvent<EventType, ReadEventMetadataType>[];
584
- streamExists: boolean;
593
+ currentStreamVersion: StreamPosition;
594
+ events: ReadEvent<EventType, ReadEventMetadataType>[];
595
+ streamExists: boolean;
585
596
  };
586
597
  type Evolve<State, EventType extends Event, ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata> = ((currentState: State, event: EventType) => State) | ((currentState: State, event: ReadEvent<EventType, ReadEventMetadataType>) => State) | ((currentState: State, event: ReadEvent<EventType>) => State);
587
598
  type AggregateStreamOptions<State, EventType extends Event, ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, EventPayloadType extends Event = EventType> = {
588
- evolve: Evolve<State, EventType, ReadEventMetadataType>;
589
- initialState: () => State;
590
- read?: ReadStreamOptions<EventType, EventPayloadType>;
599
+ evolve: Evolve<State, EventType, ReadEventMetadataType>;
600
+ initialState: () => State;
601
+ read?: ReadStreamOptions<EventType, EventPayloadType>;
591
602
  };
592
603
  type AggregateStreamResult<State> = {
593
- currentStreamVersion: StreamPosition;
594
- state: State;
595
- streamExists: boolean;
604
+ currentStreamVersion: StreamPosition;
605
+ state: State;
606
+ streamExists: boolean;
596
607
  };
597
608
  type AggregateStreamResultWithGlobalPosition<State> = (AggregateStreamResult<State> & {
598
- streamExists: true;
599
- lastEventGlobalPosition: GlobalPosition;
609
+ streamExists: true;
610
+ lastEventGlobalPosition: GlobalPosition;
600
611
  }) | (AggregateStreamResult<State> & {
601
- streamExists: false;
612
+ streamExists: false;
602
613
  });
603
- type AggregateStreamResultOfEventStore<Store extends EventStore> = Store['aggregateStream'] extends (...args: any[]) => Promise<infer R> ? R : never;
614
+ type AggregateStreamResultOfEventStore<Store extends EventStore> = Store['aggregateStream'] extends ((...args: any[]) => Promise<infer R>) ? R : never;
604
615
  type AppendToStreamOptions<EventType extends Event = Event, EventPayloadType extends Event = EventType> = {
605
- expectedStreamVersion?: ExpectedStreamVersion;
606
- schema?: EventStoreAppendSchemaOptions<EventType, EventPayloadType> & JSONSerializationOptions;
616
+ expectedStreamVersion?: ExpectedStreamVersion;
617
+ schema?: EventStoreAppendSchemaOptions<EventType, EventPayloadType> & JSONSerializationOptions;
607
618
  };
608
619
  type AppendToStreamResult = {
609
- nextExpectedStreamVersion: StreamPosition;
610
- createdNewStream: boolean;
620
+ nextExpectedStreamVersion: StreamPosition;
621
+ createdNewStream: boolean;
611
622
  };
612
623
  type AppendToStreamResultWithGlobalPosition = AppendToStreamResult & {
613
- lastEventGlobalPosition: GlobalPosition;
624
+ lastEventGlobalPosition: GlobalPosition;
614
625
  };
615
- type AppendStreamResultOfEventStore<Store extends EventStore> = Store['appendToStream'] extends (...args: any[]) => Promise<infer R> ? R : never;
626
+ type AppendStreamResultOfEventStore<Store extends EventStore> = Store['appendToStream'] extends ((...args: any[]) => Promise<infer R>) ? R : never;
616
627
  type StreamExistsResult = boolean;
617
628
  type DefaultEventStoreOptions<Store extends EventStore, HandlerContext extends DefaultRecord | undefined = undefined> = {
629
+ /**
630
+ * Pluggable set of hooks informing about the event store internal behaviour.
631
+ */
632
+ hooks?: {
618
633
  /**
619
- * Pluggable set of hooks informing about the event store internal behaviour.
634
+ * This hook will be called **AFTER** events were stored in the event store.
635
+ * It's designed to handle scenarios where delivery and ordering guarantees do not matter much.
636
+ *
637
+ * **WARNINGS:**
638
+ *
639
+ * 1. It will be called **EXACTLY ONCE** if append succeded.
640
+ * 2. If the hook fails, its append **will still silently succeed**, and no error will be thrown.
641
+ * 3. Wen process crashes after events were committed, but before the hook was called, delivery won't be retried.
642
+ * That can lead to state inconsistencies.
643
+ * 4. In the case of high concurrent traffic, **race conditions may cause ordering issues**.
644
+ * For instance, where the second hook takes longer to process than the first one, ordering won't be guaranteed.
645
+ *
646
+ * @type {AfterEventStoreCommitHandler<Store, HandlerContext>}
620
647
  */
621
- hooks?: {
622
- /**
623
- * This hook will be called **AFTER** events were stored in the event store.
624
- * It's designed to handle scenarios where delivery and ordering guarantees do not matter much.
625
- *
626
- * **WARNINGS:**
627
- *
628
- * 1. It will be called **EXACTLY ONCE** if append succeded.
629
- * 2. If the hook fails, its append **will still silently succeed**, and no error will be thrown.
630
- * 3. Wen process crashes after events were committed, but before the hook was called, delivery won't be retried.
631
- * That can lead to state inconsistencies.
632
- * 4. In the case of high concurrent traffic, **race conditions may cause ordering issues**.
633
- * For instance, where the second hook takes longer to process than the first one, ordering won't be guaranteed.
634
- *
635
- * @type {AfterEventStoreCommitHandler<Store, HandlerContext>}
636
- */
637
- onAfterCommit?: AfterEventStoreCommitHandler<Store, HandlerContext>;
638
- };
648
+ onAfterCommit?: AfterEventStoreCommitHandler<Store, HandlerContext>;
649
+ };
639
650
  };
640
-
651
+ //#endregion
652
+ //#region src/eventStore/afterCommit/afterEventStoreCommitHandler.d.ts
641
653
  type AfterEventStoreCommitHandler<Store extends EventStore, HandlerContext extends DefaultRecord | undefined = undefined> = HandlerContext extends undefined ? BatchRecordedMessageHandlerWithoutContext<Event, EventStoreReadEventMetadata<Store>> : BatchRecordedMessageHandlerWithContext<Event, EventStoreReadEventMetadata<Store>, NonNullable<HandlerContext>>;
642
654
  type BeforeEventStoreCommitHandler<Store extends EventStore, HandlerContext extends DefaultRecord | undefined = undefined> = HandlerContext extends undefined ? BatchRecordedMessageHandlerWithoutContext<Event, EventStoreReadEventMetadata<Store>> : BatchRecordedMessageHandlerWithContext<Event, EventStoreReadEventMetadata<Store>, NonNullable<HandlerContext>>;
643
655
  type TryPublishMessagesAfterCommitOptions<Store extends EventStore, HandlerContext extends DefaultRecord | undefined = undefined> = {
644
- onAfterCommit?: AfterEventStoreCommitHandler<Store, HandlerContext>;
656
+ onAfterCommit?: AfterEventStoreCommitHandler<Store, HandlerContext>;
645
657
  };
646
658
  declare function tryPublishMessagesAfterCommit<Store extends EventStore>(messages: ReadEvent<Event, EventStoreReadEventMetadata<Store>>[], options: TryPublishMessagesAfterCommitOptions<Store, undefined> | undefined): Promise<boolean>;
647
659
  declare function tryPublishMessagesAfterCommit<Store extends EventStore, HandlerContext extends DefaultRecord | undefined = undefined>(messages: ReadEvent<Event, EventStoreReadEventMetadata<Store>>[], options: TryPublishMessagesAfterCommitOptions<Store, HandlerContext> | undefined, context: HandlerContext): Promise<boolean>;
648
-
660
+ //#endregion
661
+ //#region src/messageBus/index.d.ts
649
662
  interface CommandSender {
650
- send<CommandType extends Command = Command>(command: CommandType): Promise<void>;
663
+ send<CommandType extends Command = Command>(command: CommandType): Promise<void>;
651
664
  }
652
665
  interface EventsPublisher {
653
- publish<EventType extends Event = Event>(event: EventType): Promise<void>;
666
+ publish<EventType extends Event = Event>(event: EventType): Promise<void>;
654
667
  }
655
668
  type ScheduleOptions = {
656
- afterInMs: number;
669
+ afterInMs: number;
657
670
  } | {
658
- at: Date;
671
+ at: Date;
659
672
  };
660
673
  interface MessageScheduler<CommandOrEvent extends Command | Event> {
661
- schedule<MessageType extends CommandOrEvent>(message: MessageType, when?: ScheduleOptions): void;
662
- }
663
- interface CommandBus extends CommandSender, MessageScheduler<Command> {
664
- }
665
- interface EventBus extends EventsPublisher, MessageScheduler<Event> {
674
+ schedule<MessageType extends CommandOrEvent>(message: MessageType, when?: ScheduleOptions): void;
666
675
  }
676
+ interface CommandBus extends CommandSender, MessageScheduler<Command> {}
677
+ interface EventBus extends EventsPublisher, MessageScheduler<Event> {}
667
678
  interface MessageBus extends CommandBus, EventBus {
668
- schedule<MessageType extends Command | Event>(message: MessageType, when?: ScheduleOptions): void;
679
+ schedule<MessageType extends Command | Event>(message: MessageType, when?: ScheduleOptions): void;
669
680
  }
670
681
  interface CommandProcessor {
671
- handle<CommandType extends Command>(commandHandler: SingleMessageHandler<CommandType>, ...commandTypes: CommandTypeOf<CommandType>[]): void;
682
+ handle<CommandType extends Command>(commandHandler: SingleMessageHandler<CommandType>, ...commandTypes: CommandTypeOf<CommandType>[]): void;
672
683
  }
673
684
  interface EventSubscription {
674
- subscribe<EventType extends Event>(eventHandler: SingleMessageHandler<EventType>, ...eventTypes: EventTypeOf<EventType>[]): void;
685
+ subscribe<EventType extends Event>(eventHandler: SingleMessageHandler<EventType>, ...eventTypes: EventTypeOf<EventType>[]): void;
675
686
  }
676
687
  type ScheduledMessage = {
677
- message: Message;
678
- options?: ScheduleOptions;
688
+ message: Message;
689
+ options?: ScheduleOptions;
679
690
  };
680
691
  interface ScheduledMessageProcessor {
681
- dequeue(): ScheduledMessage[];
692
+ dequeue(): ScheduledMessage[];
682
693
  }
683
694
  type MessageSubscription = EventSubscription | CommandProcessor;
684
695
  declare const getInMemoryMessageBus: () => MessageBus & EventSubscription & CommandProcessor & ScheduledMessageProcessor;
685
-
696
+ //#endregion
697
+ //#region src/eventStore/afterCommit/forwardToMessageBus.d.ts
686
698
  declare const forwardToMessageBus: <Store extends EventStore, HandlerContext extends DefaultRecord | undefined = undefined>(eventPublisher: EventsPublisher) => AfterEventStoreCommitHandler<Store, HandlerContext>;
687
-
699
+ //#endregion
700
+ //#region src/eventStore/events/index.d.ts
688
701
  declare const GlobalStreamCaughtUpType = "__emt:GlobalStreamCaughtUp";
689
702
  type GlobalStreamCaughtUp = Event<'__emt:GlobalStreamCaughtUp', {
690
- globalPosition: bigint;
703
+ globalPosition: bigint;
691
704
  }, {
692
- globalPosition: bigint;
705
+ globalPosition: bigint;
693
706
  }>;
694
707
  declare const isGlobalStreamCaughtUp: (event: Event) => event is GlobalStreamCaughtUp;
695
708
  declare const caughtUpEventFrom: (position: bigint) => (event: ReadEvent<Event, ReadEventMetadataWithGlobalPosition>) => event is ReadEvent<GlobalStreamCaughtUp, ReadEventMetadataWithGlobalPosition>;
@@ -697,30 +710,32 @@ declare const globalStreamCaughtUp: (data: EventDataOf<GlobalStreamCaughtUp>) =>
697
710
  declare const isSubscriptionEvent: (event: Event) => event is GlobalSubscriptionEvent;
698
711
  declare const isNotInternalEvent: (event: Event) => boolean;
699
712
  type GlobalSubscriptionEvent = GlobalStreamCaughtUp;
700
-
713
+ //#endregion
714
+ //#region src/eventStore/inMemoryEventStore.d.ts
701
715
  declare const InMemoryEventStoreDefaultStreamVersion = 0n;
702
716
  type InMemoryEventStore = EventStore<ReadEventMetadataWithGlobalPosition> & {
703
- database: InMemoryDatabase;
717
+ database: InMemoryDatabase;
704
718
  };
705
719
  type InMemoryReadEventMetadata = ReadEventMetadataWithGlobalPosition;
706
720
  type InMemoryProjectionHandlerContext = {
707
- eventStore?: InMemoryEventStore;
708
- database?: InMemoryDatabase;
721
+ eventStore?: InMemoryEventStore;
722
+ database?: InMemoryDatabase;
709
723
  };
710
724
  type InMemoryEventStoreOptions = DefaultEventStoreOptions<InMemoryEventStore> & {
711
- projections?: ProjectionRegistration<'inline', InMemoryReadEventMetadata, InMemoryProjectionHandlerContext>[];
712
- database?: InMemoryDatabase;
725
+ projections?: ProjectionRegistration<'inline', InMemoryReadEventMetadata, InMemoryProjectionHandlerContext>[];
726
+ database?: InMemoryDatabase;
713
727
  };
714
728
  type InMemoryReadEvent<EventType extends Event = Event> = ReadEvent<EventType, ReadEventMetadataWithGlobalPosition>;
715
729
  declare const getInMemoryEventStore: (eventStoreOptions?: InMemoryEventStoreOptions) => InMemoryEventStore;
716
-
730
+ //#endregion
731
+ //#region src/eventStore/projections/inMemory/inMemoryProjection.d.ts
717
732
  declare const DATABASE_REQUIRED_ERROR_MESSAGE = "Database is required in context for InMemory projections";
718
733
  type InMemoryProjectionDefinition<EventType extends Event> = ProjectionDefinition<EventType, InMemoryReadEventMetadata, InMemoryProjectionHandlerContext>;
719
734
  type InMemoryProjectionHandlerOptions<EventType extends Event = Event> = {
720
- projections: InMemoryProjectionDefinition<EventType>[];
721
- events: ReadEvent<EventType, InMemoryReadEventMetadata>[];
722
- database: InMemoryDatabase;
723
- eventStore?: InMemoryProjectionHandlerContext['eventStore'];
735
+ projections: InMemoryProjectionDefinition<EventType>[];
736
+ events: ReadEvent<EventType, InMemoryReadEventMetadata>[];
737
+ database: InMemoryDatabase;
738
+ eventStore?: InMemoryProjectionHandlerContext['eventStore'];
724
739
  };
725
740
  /**
726
741
  * Handles projections for the InMemoryEventStore
@@ -731,30 +746,34 @@ type InMemoryWithNotNullDocumentEvolve<DocumentType extends Record<string, unkno
731
746
  type InMemoryWithNullableDocumentEvolve<DocumentType extends Record<string, unknown>, EventType extends Event> = (document: DocumentType | null, event: ReadEvent<EventType, InMemoryReadEventMetadata>) => DocumentType | null;
732
747
  type InMemoryDocumentEvolve<DocumentType extends Record<string, unknown>, EventType extends Event> = InMemoryWithNotNullDocumentEvolve<DocumentType, EventType> | InMemoryWithNullableDocumentEvolve<DocumentType, EventType>;
733
748
  type InMemoryProjectionOptions<EventType extends Event> = {
734
- handle: (events: ReadEvent<EventType, InMemoryReadEventMetadata>[], context: InMemoryProjectionHandlerContext & {
735
- database: InMemoryDatabase;
736
- }) => Promise<void>;
737
- canHandle: CanHandle<EventType>;
738
- truncate?: TruncateProjection<InMemoryProjectionHandlerContext & {
739
- database: InMemoryDatabase;
740
- }>;
749
+ handle: (events: ReadEvent<EventType, InMemoryReadEventMetadata>[], context: InMemoryProjectionHandlerContext & {
750
+ database: InMemoryDatabase;
751
+ }) => Promise<void>;
752
+ canHandle: CanHandle<EventType>;
753
+ truncate?: TruncateProjection<InMemoryProjectionHandlerContext & {
754
+ database: InMemoryDatabase;
755
+ }>;
741
756
  };
742
757
  /**
743
758
  * Creates an InMemory projection
744
759
  */
745
- declare const inMemoryProjection: <EventType extends Event>({ truncate, handle, canHandle, }: InMemoryProjectionOptions<EventType>) => InMemoryProjectionDefinition<EventType>;
760
+ declare const inMemoryProjection: <EventType extends Event>({
761
+ truncate,
762
+ handle,
763
+ canHandle
764
+ }: InMemoryProjectionOptions<EventType>) => InMemoryProjectionDefinition<EventType>;
746
765
  /**
747
766
  * Creates a multi-stream projection for InMemoryDatabase
748
767
  */
749
768
  type InMemoryMultiStreamProjectionOptions<DocumentType extends Record<string, unknown>, EventType extends Event> = {
750
- canHandle: CanHandle<EventType>;
751
- collectionName: string;
752
- getDocumentId: (event: ReadEvent<EventType>) => string;
769
+ canHandle: CanHandle<EventType>;
770
+ collectionName: string;
771
+ getDocumentId: (event: ReadEvent<EventType>) => string;
753
772
  } & ({
754
- evolve: InMemoryWithNullableDocumentEvolve<DocumentType, EventType>;
773
+ evolve: InMemoryWithNullableDocumentEvolve<DocumentType, EventType>;
755
774
  } | {
756
- evolve: InMemoryWithNotNullDocumentEvolve<DocumentType, EventType>;
757
- initialState: () => DocumentType;
775
+ evolve: InMemoryWithNotNullDocumentEvolve<DocumentType, EventType>;
776
+ initialState: () => DocumentType;
758
777
  });
759
778
  /**
760
779
  * Creates a projection that handles events across multiple streams
@@ -764,22 +783,23 @@ declare const inMemoryMultiStreamProjection: <DocumentType extends Record<string
764
783
  * Creates a single-stream projection for InMemoryDatabase
765
784
  */
766
785
  type InMemorySingleStreamProjectionOptions<DocumentType extends Record<string, unknown>, EventType extends Event> = {
767
- canHandle: CanHandle<EventType>;
768
- getDocumentId?: (event: ReadEvent<EventType>) => string;
769
- collectionName: string;
786
+ canHandle: CanHandle<EventType>;
787
+ getDocumentId?: (event: ReadEvent<EventType>) => string;
788
+ collectionName: string;
770
789
  } & ({
771
- evolve: InMemoryWithNullableDocumentEvolve<DocumentType, EventType>;
790
+ evolve: InMemoryWithNullableDocumentEvolve<DocumentType, EventType>;
772
791
  } | {
773
- evolve: InMemoryWithNotNullDocumentEvolve<DocumentType, EventType>;
774
- initialState: () => DocumentType;
792
+ evolve: InMemoryWithNotNullDocumentEvolve<DocumentType, EventType>;
793
+ initialState: () => DocumentType;
775
794
  });
776
795
  /**
777
796
  * Creates a projection that handles events from a single stream
778
797
  */
779
798
  declare const inMemorySingleStreamProjection: <DocumentType extends Record<string, unknown>, EventType extends Event>(options: InMemorySingleStreamProjectionOptions<DocumentType, EventType>) => InMemoryProjectionDefinition<EventType>;
780
-
799
+ //#endregion
800
+ //#region src/testing/assertions.d.ts
781
801
  declare class AssertionError extends Error {
782
- constructor(message: string);
802
+ constructor(message: string);
783
803
  }
784
804
  declare const isSubset: (superObj: unknown, subObj: unknown) => boolean;
785
805
  declare const assertFails: (message?: string) => never;
@@ -791,7 +811,7 @@ declare const assertMatches: (actual: unknown, expected: unknown, message?: stri
791
811
  declare const assertDeepEqual: <T = unknown>(actual: T, expected: T, message?: string) => void;
792
812
  declare const assertNotDeepEqual: <T = unknown>(actual: T, expected: T, message?: string) => void;
793
813
  declare const assertThat: <T>(item: T) => {
794
- isEqualTo: (other: T) => void;
814
+ isEqualTo: (other: T) => void;
795
815
  };
796
816
  declare const assertDefined: (value: unknown, message?: string | Error) => asserts value;
797
817
  declare function assertFalse(condition: boolean, message?: string): asserts condition is false;
@@ -799,246 +819,261 @@ declare function assertTrue(condition: boolean, message?: string): asserts condi
799
819
  declare function assertOk<T>(obj: T | null | undefined, message?: string): asserts obj is T;
800
820
  declare function assertEqual<T>(expected: T | null | undefined, actual: T | null | undefined, message?: string): void;
801
821
  declare function assertNotEqual<T>(obj: T | null | undefined, other: T | null | undefined, message?: string): void;
802
- declare function assertIsNotNull<T extends object | bigint>(result: T | null): asserts result is T;
803
- declare function assertIsNull<T extends object>(result: T | null): asserts result is null;
822
+ declare function assertIsNotNull<T extends object | string | bigint | boolean | number>(result: T | null): asserts result is T;
823
+ declare function assertIsNull<T extends object | string | bigint | boolean | number>(result: T | null): asserts result is null;
804
824
  type Call = {
805
- arguments: unknown[];
806
- result: unknown;
807
- target: unknown;
808
- this: unknown;
825
+ arguments: unknown[];
826
+ result: unknown;
827
+ target: unknown;
828
+ this: unknown;
809
829
  };
810
830
  type ArgumentMatcher = (arg: unknown) => boolean;
811
831
  declare const argValue: <T>(value: T) => ArgumentMatcher;
812
832
  declare const argMatches: <T>(matches: (arg: T) => boolean) => ArgumentMatcher;
813
833
  type MockedFunction = Function & {
814
- mock?: {
815
- calls: Call[];
816
- };
834
+ mock?: {
835
+ calls: Call[];
836
+ };
817
837
  };
818
838
  declare function verifyThat(fn: MockedFunction): {
819
- calledTimes: (times: number) => void;
820
- notCalled: () => void;
821
- called: () => void;
822
- calledWith: (...args: unknown[]) => void;
823
- calledOnceWith: (...args: unknown[]) => void;
824
- calledWithArgumentMatching: (...matches: ArgumentMatcher[]) => void;
825
- notCalledWithArgumentMatching: (...matches: ArgumentMatcher[]) => void;
839
+ calledTimes: (times: number) => void;
840
+ notCalled: () => void;
841
+ called: () => void;
842
+ calledWith: (...args: unknown[]) => void;
843
+ calledOnceWith: (...args: unknown[]) => void;
844
+ calledWithArgumentMatching: (...matches: ArgumentMatcher[]) => void;
845
+ notCalledWithArgumentMatching: (...matches: ArgumentMatcher[]) => void;
826
846
  };
827
847
  declare const assertThatArray: <T>(array: T[]) => {
828
- isEmpty: () => void;
829
- isNotEmpty: () => void;
830
- hasSize: (length: number) => void;
831
- containsElements: (other: T[]) => void;
832
- containsElementsMatching: (other: T[]) => void;
833
- containsOnlyElementsMatching: (other: T[]) => void;
834
- containsExactlyInAnyOrder: (other: T[]) => void;
835
- containsExactlyInAnyOrderElementsOf: (other: T[]) => void;
836
- containsExactlyElementsOf: (other: T[]) => void;
837
- containsExactly: (elem: T) => void;
838
- contains: (elem: T) => void;
839
- containsOnlyOnceElementsOf: (other: T[]) => void;
840
- containsAnyOf: (other: T[]) => void;
841
- allMatch: (matches: (item: T) => boolean) => void;
842
- anyMatches: (matches: (item: T) => boolean) => void;
843
- allMatchAsync: (matches: (item: T) => Promise<boolean>) => Promise<void>;
844
- };
845
-
848
+ isEmpty: () => void;
849
+ isNotEmpty: () => void;
850
+ hasSize: (length: number) => void;
851
+ containsElements: (other: T[]) => void;
852
+ containsElementsMatching: (other: T[]) => void;
853
+ containsOnlyElementsMatching: (other: T[]) => void;
854
+ containsExactlyInAnyOrder: (other: T[]) => void;
855
+ containsExactlyInAnyOrderElementsOf: (other: T[]) => void;
856
+ containsExactlyElementsOf: (other: T[]) => void;
857
+ containsExactly: (elem: T) => void;
858
+ contains: (elem: T) => void;
859
+ containsOnlyOnceElementsOf: (other: T[]) => void;
860
+ containsAnyOf: (other: T[]) => void;
861
+ allMatch: (matches: (item: T) => boolean) => void;
862
+ anyMatches: (matches: (item: T) => boolean) => void;
863
+ allMatchAsync: (matches: (item: T) => Promise<boolean>) => Promise<void>;
864
+ };
865
+ //#endregion
866
+ //#region src/testing/deciderSpecification.d.ts
846
867
  type ErrorCheck<ErrorType> = (error: ErrorType) => boolean;
847
868
  type ThenThrows<ErrorType extends Error> = (() => void) | ((errorConstructor: ErrorConstructor<ErrorType>) => void) | ((errorCheck: ErrorCheck<ErrorType>) => void) | ((errorConstructor: ErrorConstructor<ErrorType>, errorCheck?: ErrorCheck<ErrorType>) => void);
848
- type AsyncDeciderSpecification<Command, Event> = (givenEvents: Event | Event[]) => {
849
- when: (command: Command) => {
850
- then: (expectedEvents: Event | Event[]) => Promise<void>;
851
- thenNothingHappened: () => Promise<void>;
852
- thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
853
- };
854
- };
855
869
  type DeciderSpecification<Command, Event> = (givenEvents: Event | Event[]) => {
856
- when: (command: Command) => {
857
- then: (expectedEvents: Event | Event[]) => void;
858
- thenNothingHappened: () => void;
859
- thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => void;
860
- };
870
+ when: (command: Command) => {
871
+ then: (expectedEvents: Event | Event[]) => void;
872
+ thenNothingHappened: () => void;
873
+ thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => void;
874
+ };
875
+ };
876
+ type AsyncDeciderSpecification<Command, Event> = (givenEvents: Event | Event[]) => {
877
+ when: (command: Command) => {
878
+ then: (expectedEvents: Event | Event[]) => Promise<void>;
879
+ thenNothingHappened: () => Promise<void>;
880
+ thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
881
+ };
861
882
  };
862
883
  declare const DeciderSpecification: {
863
- for: typeof deciderSpecificationFor;
884
+ for: typeof deciderSpecificationFor;
864
885
  };
865
886
  declare function deciderSpecificationFor<Command, Event, State>(decider: {
866
- decide: (command: Command, state: State) => Event | Event[];
867
- evolve: (state: State, event: Event) => State;
868
- initialState: () => State;
887
+ decide: (command: Command, state: State) => Event | Event[];
888
+ evolve: (state: State, event: Event) => State;
889
+ initialState: () => State;
869
890
  }): DeciderSpecification<Command, Event>;
870
891
  declare function deciderSpecificationFor<Command, Event, State>(decider: {
871
- decide: (command: Command, state: State) => Promise<Event | Event[]>;
872
- evolve: (state: State, event: Event) => State;
873
- initialState: () => State;
892
+ decide: (command: Command, state: State) => Promise<Event | Event[]>;
893
+ evolve: (state: State, event: Event) => State;
894
+ initialState: () => State;
874
895
  }): AsyncDeciderSpecification<Command, Event>;
875
-
896
+ //#endregion
897
+ //#region src/workflows/workflow.d.ts
898
+ type Workflow<Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, Name extends string = string> = {
899
+ name: Name;
900
+ decide: (command: Input, state: State) => WorkflowOutput<Output>;
901
+ evolve: (currentState: State, event: WorkflowEvent<Input | Output>) => State;
902
+ initialState: () => State;
903
+ };
876
904
  type WorkflowEvent<Output extends AnyEvent | AnyCommand> = Extract<Output, {
877
- kind?: 'Event';
905
+ kind?: 'Event';
878
906
  }>;
879
907
  type WorkflowCommand<Output extends AnyEvent | AnyCommand> = Extract<Output, {
880
- kind?: 'Command';
908
+ kind?: 'Command';
881
909
  }>;
882
910
  type WorkflowMessageAction = 'InitiatedBy' | 'Received' | 'Sent' | 'Published' | 'Scheduled';
883
911
  type WorkflowInputMessageMetadata = Readonly<{
884
- originalMessageId: string | undefined;
885
- input: true;
886
- action?: Extract<WorkflowMessageAction, 'InitiatedBy' | 'Received'>;
912
+ originalMessageId: string | undefined;
913
+ input: true;
914
+ action?: Extract<WorkflowMessageAction, 'InitiatedBy' | 'Received'>;
887
915
  }>;
888
916
  type WorkflowOutputMessageMetadata = Readonly<{
889
- action?: Extract<WorkflowMessageAction, 'Sent' | 'Published' | 'Scheduled'>;
917
+ action?: Extract<WorkflowMessageAction, 'Sent' | 'Published' | 'Scheduled'>;
890
918
  }>;
891
919
  type WorkflowOutput<Output extends AnyEvent | AnyCommand | EmmettError> = Output | Output[];
892
- type Workflow<Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, Name extends string = string> = {
893
- name: Name;
894
- decide: (command: Input, state: State) => WorkflowOutput<Output>;
895
- evolve: (currentState: State, event: WorkflowEvent<Input | Output>) => State;
896
- initialState: () => State;
897
- };
898
920
  declare const Workflow: <Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand>(workflow: Workflow<Input, State, Output>) => Workflow<Input, State, Output>;
899
-
921
+ //#endregion
922
+ //#region src/testing/workflowSpecification.d.ts
900
923
  type WorkflowSpecification<Input extends AnyEvent | AnyCommand, Output extends AnyEvent | AnyCommand> = (givenEvents: WorkflowEvent<Input | Output> | WorkflowEvent<Input | Output>[]) => {
901
- when: (input: Input) => {
902
- then: (expectedOutput: Output | Output[]) => void;
903
- thenNothingHappened: () => void;
904
- thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => void;
905
- };
924
+ when: (input: Input) => {
925
+ then: (expectedOutput: Output | Output[]) => void;
926
+ thenNothingHappened: () => void;
927
+ thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => void;
928
+ };
906
929
  };
907
930
  declare const WorkflowSpecification: {
908
- for: typeof workflowSpecificationFor;
931
+ for: typeof workflowSpecificationFor;
909
932
  };
910
933
  declare function workflowSpecificationFor<Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand>(workflow: Workflow<Input, State, Output>): WorkflowSpecification<Input, Output>;
911
-
912
- type TestEventStream<EventType extends Event = Event> = [
913
- string,
914
- EventType[]
915
- ];
934
+ //#endregion
935
+ //#region src/testing/wrapEventStore.d.ts
936
+ type TestEventStream<EventType extends Event = Event> = [string, EventType[]];
916
937
  type EventStoreWrapper<Store extends EventStore> = Store & {
917
- appendedEvents: Map<string, TestEventStream>;
918
- setup<EventType extends Event>(streamName: string, events: EventType[]): Promise<AppendToStreamResult>;
938
+ appendedEvents: Map<string, TestEventStream>;
939
+ setup<EventType extends Event>(streamName: string, events: EventType[]): Promise<AppendToStreamResult>;
919
940
  };
920
941
  declare const WrapEventStore: <Store extends EventStore>(eventStore: Store) => EventStoreWrapper<Store>;
921
-
942
+ //#endregion
943
+ //#region src/eventStore/projections/inMemory/inMemoryProjectionSpec.d.ts
922
944
  type DocumentWithId = Document & {
923
- _id?: string | number;
945
+ _id?: string | number;
924
946
  };
925
947
  type InMemoryProjectionSpecEvent<EventType extends Event, EventMetaDataType extends InMemoryReadEventMetadata = InMemoryReadEventMetadata> = EventType & {
926
- metadata?: Partial<EventMetaDataType>;
948
+ metadata?: Partial<EventMetaDataType>;
927
949
  };
928
950
  type InMemoryProjectionSpecWhenOptions = {
929
- numberOfTimes: number;
951
+ numberOfTimes: number;
952
+ };
953
+ type InMemoryProjectionSpec<EventType extends Event> = (givenEvents: InMemoryProjectionSpecEvent<EventType>[]) => {
954
+ when: (events: InMemoryProjectionSpecEvent<EventType>[], options?: InMemoryProjectionSpecWhenOptions) => {
955
+ then: (assert: InMemoryProjectionAssert, message?: string) => Promise<void>;
956
+ thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
957
+ };
930
958
  };
931
959
  type InMemoryProjectionAssert = (options: {
932
- database: InMemoryDatabase;
960
+ database: InMemoryDatabase;
933
961
  }) => Promise<void | boolean>;
934
962
  type InMemoryProjectionSpecOptions<EventType extends Event> = {
935
- projection: InMemoryProjectionDefinition<EventType>;
936
- };
937
- type InMemoryProjectionSpec<EventType extends Event> = (givenEvents: InMemoryProjectionSpecEvent<EventType>[]) => {
938
- when: (events: InMemoryProjectionSpecEvent<EventType>[], options?: InMemoryProjectionSpecWhenOptions) => {
939
- then: (assert: InMemoryProjectionAssert, message?: string) => Promise<void>;
940
- thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
941
- };
963
+ projection: InMemoryProjectionDefinition<EventType>;
942
964
  };
943
965
  declare const InMemoryProjectionSpec: {
944
- for: <EventType extends Event>(options: InMemoryProjectionSpecOptions<EventType>) => InMemoryProjectionSpec<EventType>;
966
+ for: <EventType extends Event>(options: InMemoryProjectionSpecOptions<EventType>) => InMemoryProjectionSpec<EventType>;
945
967
  };
946
968
  declare const eventInStream: <EventType extends Event = Event, EventMetaDataType extends InMemoryReadEventMetadata = InMemoryReadEventMetadata>(streamName: string, event: InMemoryProjectionSpecEvent<EventType, EventMetaDataType>) => InMemoryProjectionSpecEvent<EventType, EventMetaDataType>;
947
969
  declare const eventsInStream: <EventType extends Event = Event, EventMetaDataType extends InMemoryReadEventMetadata = InMemoryReadEventMetadata>(streamName: string, events: InMemoryProjectionSpecEvent<EventType, EventMetaDataType>[]) => InMemoryProjectionSpecEvent<EventType, EventMetaDataType>[];
948
970
  declare const newEventsInStream: <EventType extends Event = Event, EventMetaDataType extends InMemoryReadEventMetadata = RecordedMessageMetadataWithGlobalPosition>(streamName: string, events: InMemoryProjectionSpecEvent<EventType, EventMetaDataType>[]) => InMemoryProjectionSpecEvent<EventType, EventMetaDataType>[];
949
971
  declare function documentExists<T extends DocumentWithId>(expected: Partial<T>, options: {
950
- inCollection: string;
951
- withId: string | number;
972
+ inCollection: string;
973
+ withId: string | number;
952
974
  }): InMemoryProjectionAssert;
953
975
  declare const expectInMemoryDocuments: {
954
- fromCollection: <T extends DocumentWithId>(collectionName: string) => {
955
- withId: (id: string | number) => {
956
- toBeEqual: (expected: Partial<T>) => InMemoryProjectionAssert;
957
- };
976
+ fromCollection: <T extends DocumentWithId>(collectionName: string) => {
977
+ withId: (id: string | number) => {
978
+ toBeEqual: (expected: Partial<T>) => InMemoryProjectionAssert;
958
979
  };
980
+ };
959
981
  };
960
-
982
+ //#endregion
983
+ //#region src/eventStore/versioning/downcasting.d.ts
961
984
  type MessageDowncast<MessageType extends AnyMessage, MessagePayloadType extends AnyMessage = MessageType, RecordedMessageMetadataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata> = ((message: RecordedMessage<MessageType, RecordedMessageMetadataType>) => RecordedMessage<MessagePayloadType, RecordedMessageMetadataType>) | ((message: MessageType) => MessagePayloadType);
962
985
  declare const downcastRecordedMessage: <MessageType extends AnyMessage, MessagePayloadType extends AnyMessage = MessageType, RecordedMessageMetadataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata>(recordedMessage: RecordedMessage<MessageType, RecordedMessageMetadataType> | MessageType, options?: {
963
- downcast?: MessageDowncast<MessageType, MessagePayloadType, RecordedMessageMetadataType>;
986
+ downcast?: MessageDowncast<MessageType, MessagePayloadType, RecordedMessageMetadataType>;
964
987
  }) => RecordedMessage<MessagePayloadType, RecordedMessageMetadataType>;
965
988
  declare const downcastRecordedMessages: <MessageType extends AnyMessage, MessagePayloadType extends AnyMessage = MessageType, RecordedMessageMetadataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata>(recordedMessages: RecordedMessage<MessageType, RecordedMessageMetadataType>[] | MessageType[], options?: {
966
- downcast?: MessageDowncast<MessageType, MessagePayloadType, RecordedMessageMetadataType>;
989
+ downcast?: MessageDowncast<MessageType, MessagePayloadType, RecordedMessageMetadataType>;
967
990
  }) => RecordedMessage<MessagePayloadType, RecordedMessageMetadataType>[];
968
-
991
+ //#endregion
992
+ //#region src/eventStore/versioning/upcasting.d.ts
969
993
  type MessageUpcast<MessageType extends AnyMessage, MessagePayloadType extends AnyMessage = MessageType, RecordedMessageMetadataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata> = ((message: MessagePayloadType) => MessageType) | ((message: RecordedMessage<MessagePayloadType, RecordedMessageMetadataType>) => RecordedMessage<MessageType, RecordedMessageMetadataType>);
970
994
  declare const upcastRecordedMessage: <MessageType extends AnyMessage, MessagePayloadType extends AnyMessage = MessageType, RecordedMessageMetadataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata>(recordedMessage: RecordedMessage<MessagePayloadType, RecordedMessageMetadataType> | MessagePayloadType, options?: {
971
- upcast?: MessageUpcast<MessageType, MessagePayloadType, RecordedMessageMetadataType>;
995
+ upcast?: MessageUpcast<MessageType, MessagePayloadType, RecordedMessageMetadataType>;
972
996
  }) => RecordedMessage<MessageType, RecordedMessageMetadataType>;
973
997
  declare const upcastRecordedMessages: <MessageType extends AnyMessage, MessagePayloadType extends AnyMessage = MessageType, RecordedMessageMetadataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata>(recordedMessages: RecordedMessage<MessagePayloadType, RecordedMessageMetadataType>[] | MessagePayloadType[], options?: {
974
- upcast?: MessageUpcast<MessageType, MessagePayloadType, RecordedMessageMetadataType>;
998
+ upcast?: MessageUpcast<MessageType, MessagePayloadType, RecordedMessageMetadataType>;
975
999
  }) => RecordedMessage<MessageType, RecordedMessageMetadataType>[];
976
-
1000
+ //#endregion
1001
+ //#region src/utils/async/mapAsync.d.ts
977
1002
  declare function reduceAsync<T, R>(items: T[], fn: (accumulator: R, item: T, index: number) => Promise<R>, initial: R): Promise<R>;
978
-
1003
+ //#endregion
1004
+ //#region src/utils/closeable.d.ts
979
1005
  type Closeable = {
980
- /**
981
- * Gracefully cleans up managed resources
982
- *
983
- * @memberof Closeable
984
- */
985
- close: () => Promise<void>;
986
- };
987
-
1006
+ /**
1007
+ * Gracefully cleans up managed resources
1008
+ *
1009
+ * @memberof Closeable
1010
+ */
1011
+ close: () => Promise<void>;
1012
+ };
1013
+ //#endregion
1014
+ //#region src/utils/collections/merge.d.ts
988
1015
  declare const merge: <T>(array: T[], item: T, where: (current: T) => boolean, onExisting: (current: T) => T, onNotFound?: () => T | undefined) => T[];
989
-
1016
+ //#endregion
1017
+ //#region src/utils/collections/index.d.ts
990
1018
  declare const arrayUtils: {
991
- merge: <T>(array: T[], item: T, where: (current: T) => boolean, onExisting: (current: T) => T, onNotFound?: () => T | undefined) => T[];
992
- hasDuplicates: <ArrayItem, Mapped>(array: ArrayItem[], predicate: (value: ArrayItem, index: number, array: ArrayItem[]) => Mapped) => boolean;
993
- getDuplicates: <ArrayItem, Mapped>(array: ArrayItem[], predicate: (value: ArrayItem, index: number, array: ArrayItem[]) => Mapped) => ArrayItem[];
1019
+ merge: <T>(array: T[], item: T, where: (current: T) => boolean, onExisting: (current: T) => T, onNotFound?: () => T | undefined) => T[];
1020
+ hasDuplicates: <ArrayItem, Mapped>(array: ArrayItem[], predicate: (value: ArrayItem, index: number, array: ArrayItem[]) => Mapped) => boolean;
1021
+ getDuplicates: <ArrayItem, Mapped>(array: ArrayItem[], predicate: (value: ArrayItem, index: number, array: ArrayItem[]) => Mapped) => ArrayItem[];
994
1022
  };
995
-
1023
+ //#endregion
1024
+ //#region src/utils/deepEquals.d.ts
996
1025
  declare const deepEquals: <T>(left: T, right: T) => boolean;
997
1026
  type Equatable<T> = {
998
- equals: (right: T) => boolean;
1027
+ equals: (right: T) => boolean;
999
1028
  } & T;
1000
1029
  declare const isEquatable: <T>(left: T) => left is Equatable<T>;
1001
-
1030
+ //#endregion
1031
+ //#region src/utils/iterators.d.ts
1002
1032
  declare const sum: (iterator: Iterator<number, number, number> | Iterator<number>) => number;
1003
-
1033
+ //#endregion
1034
+ //#region src/utils/locking/index.d.ts
1004
1035
  type LockOptions = {
1005
- lockId: number;
1036
+ lockId: number;
1006
1037
  };
1007
1038
  type AcquireLockOptions = {
1008
- lockId: string;
1039
+ lockId: string;
1009
1040
  };
1010
1041
  type ReleaseLockOptions = {
1011
- lockId: string;
1042
+ lockId: string;
1012
1043
  };
1013
1044
  type Lock = {
1014
- acquire(options: AcquireLockOptions): Promise<void>;
1015
- tryAcquire(options: AcquireLockOptions): Promise<boolean>;
1016
- release(options: ReleaseLockOptions): Promise<boolean>;
1017
- withAcquire: <Result = unknown>(handle: () => Promise<Result>, options: AcquireLockOptions) => Promise<Result>;
1045
+ acquire(options: AcquireLockOptions): Promise<void>;
1046
+ tryAcquire(options: AcquireLockOptions): Promise<boolean>;
1047
+ release(options: ReleaseLockOptions): Promise<boolean>;
1048
+ withAcquire: <Result = unknown>(handle: () => Promise<Result>, options: AcquireLockOptions) => Promise<Result>;
1018
1049
  };
1019
1050
  declare const InProcessLock: () => Lock;
1020
-
1051
+ //#endregion
1052
+ //#region src/utils/numbers/bigint.d.ts
1021
1053
  declare const toNormalizedString: (value: bigint) => string;
1022
1054
  declare const bigInt: {
1023
- toNormalizedString: (value: bigint) => string;
1055
+ toNormalizedString: (value: bigint) => string;
1024
1056
  };
1025
-
1057
+ //#endregion
1058
+ //#region src/utils/promises.d.ts
1026
1059
  declare const delay: (ms: number) => Promise<void>;
1027
1060
  type AsyncAwaiter<T = void> = {
1028
- wait: Promise<T>;
1029
- resolve: (value: T | PromiseLike<T>) => void;
1030
- reject: (reason?: any) => void;
1031
- reset: () => void;
1061
+ wait: Promise<T>;
1062
+ resolve: (value: T | PromiseLike<T>) => void;
1063
+ reject: (reason?: any) => void;
1064
+ reset: () => void;
1032
1065
  };
1033
1066
  declare const asyncAwaiter: <T = void>() => AsyncAwaiter<T>;
1034
-
1067
+ //#endregion
1068
+ //#region src/utils/retry.d.ts
1035
1069
  type AsyncRetryOptions<T = unknown> = retry.Options & {
1036
- shouldRetryResult?: (result: T) => boolean;
1037
- shouldRetryError?: (error?: unknown) => boolean;
1070
+ shouldRetryResult?: (result: T) => boolean;
1071
+ shouldRetryError?: (error?: unknown) => boolean;
1038
1072
  };
1039
1073
  declare const NoRetries: AsyncRetryOptions;
1040
1074
  declare const asyncRetry: <T>(fn: () => Promise<T>, opts?: AsyncRetryOptions<T>) => Promise<T>;
1041
-
1075
+ //#endregion
1076
+ //#region src/utils/shutdown/gracefulShutdown.d.ts
1042
1077
  type ShutdownHandler = () => void | Promise<void>;
1043
1078
  /**
1044
1079
  * Registers handlers for OS signals to enable graceful shutdown.
@@ -1049,136 +1084,145 @@ type ShutdownHandler = () => void | Promise<void>;
1049
1084
  * @returns Cleanup function to unregister the handlers
1050
1085
  */
1051
1086
  declare const onShutdown: (handler: ShutdownHandler) => (() => void);
1052
-
1087
+ //#endregion
1088
+ //#region src/utils/strings/hashText.d.ts
1053
1089
  declare const hashText: (text: string) => Promise<bigint>;
1054
-
1090
+ //#endregion
1091
+ //#region src/commandHandling/handleCommand.d.ts
1055
1092
  declare const CommandHandlerStreamVersionConflictRetryOptions: AsyncRetryOptions;
1056
1093
  type CommandHandlerRetryOptions = AsyncRetryOptions | {
1057
- onVersionConflict: true | number | AsyncRetryOptions;
1094
+ onVersionConflict: true | number | AsyncRetryOptions;
1058
1095
  };
1059
1096
  type CommandHandlerResult<State, StreamEvent extends Event, Store extends EventStore> = AppendStreamResultOfEventStore<Store> & {
1060
- newState: State;
1061
- newEvents: StreamEvent[];
1097
+ newState: State;
1098
+ newEvents: StreamEvent[];
1062
1099
  };
1063
1100
  type CommandHandlerOptions<State, StreamEvent extends Event, StoredEvent extends Event = StreamEvent> = {
1064
- evolve: (state: State, event: StreamEvent) => State;
1065
- initialState: () => State;
1066
- mapToStreamId?: (id: string) => string;
1067
- retry?: CommandHandlerRetryOptions;
1068
- schema?: {
1069
- versioning?: {
1070
- upcast?: (event: StoredEvent) => StreamEvent;
1071
- downcast?: (event: StreamEvent) => StoredEvent;
1072
- };
1101
+ evolve: (state: State, event: StreamEvent) => State;
1102
+ initialState: () => State;
1103
+ mapToStreamId?: (id: string) => string;
1104
+ retry?: CommandHandlerRetryOptions;
1105
+ schema?: {
1106
+ versioning?: {
1107
+ upcast?: (event: StoredEvent) => StreamEvent;
1108
+ downcast?: (event: StreamEvent) => StoredEvent;
1073
1109
  };
1110
+ };
1074
1111
  } & JSONSerializationOptions;
1075
1112
  type HandleOptions<Store extends EventStore> = Parameters<Store['appendToStream']>[2] & ({
1076
- expectedStreamVersion?: ExpectedStreamVersion;
1113
+ expectedStreamVersion?: ExpectedStreamVersion;
1077
1114
  } | {
1078
- retry?: CommandHandlerRetryOptions;
1115
+ retry?: CommandHandlerRetryOptions;
1079
1116
  });
1080
1117
  type CommandHandlerFunction<State, StreamEvent extends Event> = (state: State) => StreamEvent | StreamEvent[] | Promise<StreamEvent | StreamEvent[]>;
1081
1118
  declare const CommandHandler: <State, StreamEvent extends Event, EventPayloadType extends Event = StreamEvent>(options: CommandHandlerOptions<State, StreamEvent, EventPayloadType>) => <Store extends EventStore>(store: Store, id: string, handle: CommandHandlerFunction<State, StreamEvent> | CommandHandlerFunction<State, StreamEvent>[], handleOptions?: HandleOptions<Store>) => Promise<CommandHandlerResult<State, StreamEvent, Store>>;
1082
-
1119
+ //#endregion
1120
+ //#region src/commandHandling/handleCommandWithDecider.d.ts
1083
1121
  type DeciderCommandHandlerOptions<State, CommandType extends Command, StreamEvent extends Event> = CommandHandlerOptions<State, StreamEvent> & Decider<State, CommandType, StreamEvent>;
1084
1122
  declare const DeciderCommandHandler: <State, CommandType extends Command, StreamEvent extends Event>(options: DeciderCommandHandlerOptions<State, CommandType, StreamEvent>) => <Store extends EventStore>(eventStore: Store, id: string, commands: CommandType | CommandType[], handleOptions?: HandleOptions<Store>) => Promise<CommandHandlerResult<State, StreamEvent, Store>>;
1085
-
1123
+ //#endregion
1124
+ //#region src/consumers/consumers.d.ts
1086
1125
  type MessageConsumerOptions<ConsumerMessageType extends Message = any> = {
1087
- consumerId?: string;
1088
- processors?: Array<MessageProcessor<ConsumerMessageType, any, any>>;
1126
+ consumerId?: string;
1127
+ processors?: Array<MessageProcessor<ConsumerMessageType, any, any>>;
1089
1128
  };
1090
1129
  type MessageConsumer<ConsumerMessageType extends Message = any> = Readonly<{
1091
- consumerId: string;
1092
- isRunning: boolean;
1093
- processors: ReadonlyArray<MessageProcessor<ConsumerMessageType, any, any>>;
1094
- start: () => Promise<void>;
1095
- stop: () => Promise<void>;
1096
- close: () => Promise<void>;
1130
+ consumerId: string;
1131
+ isRunning: boolean;
1132
+ whenStarted: () => Promise<void>;
1133
+ processors: ReadonlyArray<MessageProcessor<ConsumerMessageType, any, any>>;
1134
+ start: () => Promise<void>;
1135
+ stop: () => Promise<void>;
1136
+ close: () => Promise<void>;
1097
1137
  }>;
1098
-
1138
+ //#endregion
1139
+ //#region src/taskProcessing/executionGuards.d.ts
1099
1140
  type ExclusiveAccessGuard = {
1100
- execute: <Result>(operation: () => Promise<Result>) => Promise<Result>;
1101
- waitForIdle: () => Promise<void>;
1102
- stop: (options?: {
1103
- force?: boolean;
1104
- }) => Promise<void>;
1141
+ execute: <Result>(operation: () => Promise<Result>) => Promise<Result>;
1142
+ waitForIdle: () => Promise<void>;
1143
+ stop: (options?: {
1144
+ force?: boolean;
1145
+ }) => Promise<void>;
1105
1146
  };
1106
1147
  declare const guardExclusiveAccess: (options?: {
1107
- maxQueueSize?: number;
1148
+ maxQueueSize?: number;
1108
1149
  }) => ExclusiveAccessGuard;
1109
1150
  type BoundedAccessGuard<Resource> = {
1110
- acquire: () => Promise<Resource>;
1111
- release: (resource: Resource) => void;
1112
- execute: <Result>(operation: (resource: Resource) => Promise<Result>) => Promise<Result>;
1113
- waitForIdle: () => Promise<void>;
1114
- stop: (options?: {
1115
- force?: boolean;
1116
- }) => Promise<void>;
1151
+ acquire: () => Promise<Resource>;
1152
+ release: (resource: Resource) => void;
1153
+ execute: <Result>(operation: (resource: Resource) => Promise<Result>) => Promise<Result>;
1154
+ waitForIdle: () => Promise<void>;
1155
+ stop: (options?: {
1156
+ force?: boolean;
1157
+ }) => Promise<void>;
1117
1158
  };
1118
1159
  declare const guardBoundedAccess: <Resource>(getResource: () => Resource | Promise<Resource>, options: {
1119
- maxResources: number;
1120
- maxQueueSize?: number;
1121
- reuseResources?: boolean;
1122
- closeResource?: (resource: Resource) => void | Promise<void>;
1160
+ maxResources: number;
1161
+ maxQueueSize?: number;
1162
+ reuseResources?: boolean;
1163
+ closeResource?: (resource: Resource) => void | Promise<void>;
1123
1164
  }) => BoundedAccessGuard<Resource>;
1124
1165
  type InitializedOnceGuard<T> = {
1125
- ensureInitialized: () => Promise<T>;
1126
- reset: () => void;
1127
- stop: (options?: {
1128
- force?: boolean;
1129
- }) => Promise<void>;
1166
+ ensureInitialized: () => Promise<T>;
1167
+ reset: () => void;
1168
+ stop: (options?: {
1169
+ force?: boolean;
1170
+ }) => Promise<void>;
1130
1171
  };
1131
1172
  declare const guardInitializedOnce: <T>(initialize: () => Promise<T>, options?: {
1132
- maxQueueSize?: number;
1133
- maxRetries?: number;
1173
+ maxQueueSize?: number;
1174
+ maxRetries?: number;
1134
1175
  }) => InitializedOnceGuard<T>;
1135
-
1176
+ //#endregion
1177
+ //#region src/taskProcessing/taskProcessor.d.ts
1136
1178
  type TaskQueue = TaskQueueItem[];
1137
1179
  type TaskQueueItem = {
1138
- task: () => Promise<void>;
1139
- options?: EnqueueTaskOptions | undefined;
1180
+ task: () => Promise<void>;
1181
+ options?: EnqueueTaskOptions | undefined;
1140
1182
  };
1141
1183
  type TaskProcessorOptions = {
1142
- maxActiveTasks: number;
1143
- maxQueueSize: number;
1144
- maxTaskIdleTime?: number;
1184
+ maxActiveTasks: number;
1185
+ maxQueueSize: number;
1186
+ maxTaskIdleTime?: number;
1145
1187
  };
1146
1188
  type Task<T> = (context: TaskContext) => Promise<T>;
1147
1189
  type TaskContext = {
1148
- ack: () => void;
1190
+ ack: () => void;
1149
1191
  };
1150
1192
  type EnqueueTaskOptions = {
1151
- taskGroupId?: string;
1193
+ taskGroupId?: string;
1152
1194
  };
1153
1195
  declare class TaskProcessor {
1154
- private queue;
1155
- private isProcessing;
1156
- private activeTasks;
1157
- private activeGroups;
1158
- private options;
1159
- private stopped;
1160
- constructor(options: TaskProcessorOptions);
1161
- enqueue<T>(task: Task<T>, options?: EnqueueTaskOptions): Promise<T>;
1162
- waitForEndOfProcessing(): Promise<void>;
1163
- stop(options?: {
1164
- force?: boolean;
1165
- }): Promise<void>;
1166
- private schedule;
1167
- private ensureProcessing;
1168
- private processQueue;
1169
- private executeItem;
1170
- private takeFirstAvailableItem;
1171
- private hasItemsToProcess;
1196
+ private queue;
1197
+ private isProcessing;
1198
+ private activeTasks;
1199
+ private activeGroups;
1200
+ private options;
1201
+ private stopped;
1202
+ constructor(options: TaskProcessorOptions);
1203
+ enqueue<T>(task: Task<T>, options?: EnqueueTaskOptions): Promise<T>;
1204
+ waitForEndOfProcessing(): Promise<void>;
1205
+ stop(options?: {
1206
+ force?: boolean;
1207
+ }): Promise<void>;
1208
+ private schedule;
1209
+ private ensureProcessing;
1210
+ private processQueue;
1211
+ private executeItem;
1212
+ private takeFirstAvailableItem;
1213
+ private hasItemsToProcess;
1172
1214
  }
1173
-
1215
+ //#endregion
1216
+ //#region src/validation/dates.d.ts
1174
1217
  declare const formatDateToUtcYYYYMMDD: (date: Date) => string;
1175
1218
  declare const isValidYYYYMMDD: (dateString: string) => boolean;
1176
1219
  declare const parseDateFromUtcYYYYMMDD: (dateString: string) => Date;
1177
-
1220
+ //#endregion
1221
+ //#region src/validation/index.d.ts
1178
1222
  declare const enum ValidationErrors {
1179
- NOT_A_NONEMPTY_STRING = "NOT_A_NONEMPTY_STRING",
1180
- NOT_A_POSITIVE_NUMBER = "NOT_A_POSITIVE_NUMBER",
1181
- NOT_AN_UNSIGNED_BIGINT = "NOT_AN_UNSIGNED_BIGINT"
1223
+ NOT_A_NONEMPTY_STRING = "NOT_A_NONEMPTY_STRING",
1224
+ NOT_A_POSITIVE_NUMBER = "NOT_A_POSITIVE_NUMBER",
1225
+ NOT_AN_UNSIGNED_BIGINT = "NOT_AN_UNSIGNED_BIGINT"
1182
1226
  }
1183
1227
  declare const isNumber: (val: unknown) => val is number;
1184
1228
  declare const isBigint: (val: any) => val is bigint;
@@ -1186,74 +1230,80 @@ declare const isString: (val: unknown) => val is string;
1186
1230
  declare const assertNotEmptyString: (value: unknown) => string;
1187
1231
  declare const assertPositiveNumber: (value: unknown) => number;
1188
1232
  declare const assertUnsignedBigInt: (value: string) => bigint;
1189
-
1233
+ //#endregion
1234
+ //#region src/workflows/workflowProcessor.d.ts
1190
1235
  type WorkflowOptions<Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, StoredMessage extends AnyEvent | AnyCommand = Output> = {
1191
- workflow: Workflow<Input, State, Output>;
1192
- getWorkflowId: (input: Input | RecordedMessage<Input, MessageMetadataType>) => string | null;
1193
- mapWorkflowId?: (workflowId: string) => string;
1194
- separateInputInboxFromProcessing?: boolean;
1195
- inputs: {
1196
- commands: CanHandle<WorkflowCommand<Input>>;
1197
- events: CanHandle<WorkflowEvent<Input>>;
1198
- };
1199
- outputs: {
1200
- commands: MessageTypeOf<WorkflowCommand<Output>>[];
1201
- events: MessageTypeOf<WorkflowEvent<Output>>[];
1202
- };
1203
- schema?: {
1204
- versioning?: {
1205
- upcast?: (event: StoredMessage) => Input;
1206
- downcast?: (event: Output) => StoredMessage;
1207
- };
1236
+ workflow: Workflow<Input, State, Output>;
1237
+ getWorkflowId: (input: Input | RecordedMessage<Input, MessageMetadataType>) => string | null;
1238
+ mapWorkflowId?: (workflowId: string) => string;
1239
+ separateInputInboxFromProcessing?: boolean;
1240
+ inputs: {
1241
+ commands: CanHandle<WorkflowCommand<Input>>;
1242
+ events: CanHandle<WorkflowEvent<Input>>;
1243
+ };
1244
+ outputs: {
1245
+ commands: MessageTypeOf<WorkflowCommand<Output>>[];
1246
+ events: MessageTypeOf<WorkflowEvent<Output>>[];
1247
+ };
1248
+ schema?: {
1249
+ versioning?: {
1250
+ upcast?: (event: StoredMessage) => Input;
1251
+ downcast?: (event: Output) => StoredMessage;
1208
1252
  };
1253
+ };
1209
1254
  };
1210
1255
  type WorkflowProcessorContext = {
1211
- connection: {
1212
- messageStore: EventStore;
1213
- };
1256
+ connection: {
1257
+ messageStore: EventStore;
1258
+ };
1214
1259
  };
1215
1260
  type WorkflowOutputHandlerResult<Input extends AnyEvent | AnyCommand> = Promise<Input | Input[] | EmmettError | [] | void> | Input | Input[] | EmmettError | [] | void;
1216
1261
  type SingleWorkflowOutputHandler<Input extends AnyEvent | AnyCommand, Output extends AnyEvent | AnyCommand, MessageMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends WorkflowProcessorContext = WorkflowProcessorContext> = (message: Output | RecordedMessage<Output, MessageMetaDataType>, context: HandlerContext) => WorkflowOutputHandlerResult<Input>;
1217
1262
  type BatchWorkflowOutputHandler<Input extends AnyEvent | AnyCommand, Output extends AnyEvent | AnyCommand, MessageMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends WorkflowProcessorContext = WorkflowProcessorContext> = (messages: RecordedMessage<Output, MessageMetaDataType>[], context: HandlerContext) => WorkflowOutputHandlerResult<Input>;
1218
1263
  type WorkflowOutputHandlerOptions<Input extends AnyEvent | AnyCommand, Output extends AnyEvent | AnyCommand, MessageMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends WorkflowProcessorContext = WorkflowProcessorContext> = {
1219
- eachMessage: SingleWorkflowOutputHandler<Input, Output, MessageMetaDataType, HandlerContext>;
1220
- eachBatch?: never;
1264
+ eachMessage: SingleWorkflowOutputHandler<Input, Output, MessageMetaDataType, HandlerContext>;
1265
+ eachBatch?: never;
1221
1266
  } | {
1222
- eachMessage?: never;
1223
- eachBatch: BatchWorkflowOutputHandler<Input, Output, MessageMetaDataType, HandlerContext>;
1267
+ eachMessage?: never;
1268
+ eachBatch: BatchWorkflowOutputHandler<Input, Output, MessageMetaDataType, HandlerContext>;
1224
1269
  };
1225
1270
  type WorkflowOutputHandlerDefinition<Input extends AnyEvent | AnyCommand, Output extends AnyEvent | AnyCommand, HandledOutput extends Output = Output, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends WorkflowProcessorContext = WorkflowProcessorContext> = {
1226
- canHandle: CanHandle<HandledOutput>;
1271
+ canHandle: CanHandle<HandledOutput>;
1227
1272
  } & WorkflowOutputHandlerOptions<Input, HandledOutput, MessageMetadataType, HandlerContext>;
1228
1273
  declare const workflowOutputHandler: <Input extends AnyEvent | AnyCommand, Output extends AnyEvent | AnyCommand, HandledOutput extends Output = Output, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends WorkflowProcessorContext = WorkflowProcessorContext>(handler: WorkflowOutputHandlerDefinition<Input, Output, HandledOutput, MessageMetadataType, HandlerContext>) => WorkflowOutputHandlerDefinition<Input, Output, HandledOutput, MessageMetadataType, HandlerContext>;
1229
1274
  type WorkflowProcessorOptions<Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends WorkflowProcessorContext = WorkflowProcessorContext, StoredMessage extends AnyEvent | AnyCommand = Output, HandledOutput extends Output = Output> = Omit<BaseMessageProcessorOptions<Input | Output, MessageMetadataType, HandlerContext>, 'type' | 'canHandle' | 'processorId'> & {
1230
- processorId?: string;
1275
+ processorId?: string;
1231
1276
  } & WorkflowOptions<Input, State, Output, MessageMetadataType, StoredMessage> & {
1232
- retry?: WorkflowHandlerRetryOptions;
1233
- outputHandler?: WorkflowOutputHandlerDefinition<Input, Output, HandledOutput, MessageMetadataType, HandlerContext>;
1277
+ retry?: WorkflowHandlerRetryOptions;
1278
+ outputHandler?: WorkflowOutputHandlerDefinition<Input, Output, HandledOutput, MessageMetadataType, HandlerContext>;
1234
1279
  };
1235
1280
  declare const getWorkflowId: (options: {
1236
- workflowName: string;
1281
+ workflowName: string;
1237
1282
  }) => string;
1238
1283
  declare const workflowProcessor: <Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, MetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends WorkflowProcessorContext = WorkflowProcessorContext, StoredMessage extends AnyEvent | AnyCommand = Output, HandledOutput extends Output = Output>(options: WorkflowProcessorOptions<Input, State, Output, MetaDataType, HandlerContext, StoredMessage, HandledOutput>) => MessageProcessor<Input, MetaDataType, HandlerContext>;
1239
-
1284
+ //#endregion
1285
+ //#region src/workflows/handleWorkflow.d.ts
1240
1286
  declare const WorkflowHandlerStreamVersionConflictRetryOptions: AsyncRetryOptions;
1241
1287
  type WorkflowHandlerRetryOptions = AsyncRetryOptions | {
1242
- onVersionConflict: true | number | AsyncRetryOptions;
1288
+ onVersionConflict: true | number | AsyncRetryOptions;
1243
1289
  };
1244
1290
  type WorkflowHandlerResult<Output extends AnyEvent | AnyCommand, Store extends EventStore> = AppendStreamResultOfEventStore<Store> & {
1245
- newMessages: Output[];
1291
+ newMessages: Output[];
1246
1292
  };
1247
1293
  type WorkflowHandleOptions<Store extends EventStore> = Parameters<Store['appendToStream']>[2] & {
1248
- expectedStreamVersion?: ExpectedStreamVersion;
1249
- retry?: WorkflowHandlerRetryOptions;
1250
- };
1251
- declare const workflowStreamName: ({ workflowName, workflowId, }: {
1252
- workflowName: string;
1253
- workflowId: string;
1294
+ expectedStreamVersion?: ExpectedStreamVersion;
1295
+ retry?: WorkflowHandlerRetryOptions;
1296
+ };
1297
+ declare const workflowStreamName: ({
1298
+ workflowName,
1299
+ workflowId
1300
+ }: {
1301
+ workflowName: string;
1302
+ workflowId: string;
1254
1303
  }) => string;
1255
1304
  declare const WorkflowHandler: <Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, StoredMessage extends AnyEvent | AnyCommand = Output>(options: WorkflowOptions<Input, State, Output, MessageMetadataType, StoredMessage> & {
1256
- retry?: WorkflowHandlerRetryOptions;
1305
+ retry?: WorkflowHandlerRetryOptions;
1257
1306
  }) => <Store extends EventStore>(store: Store, message: Input | RecordedMessage<Input, MessageMetadataType>, handleOptions?: WorkflowHandleOptions<Store>) => Promise<WorkflowHandlerResult<Output, Store>>;
1258
-
1259
- export { type AcquireLockOptions, type AfterEventStoreCommitHandler, type AggregateStreamOptions, type AggregateStreamResult, type AggregateStreamResultOfEventStore, type AggregateStreamResultWithGlobalPosition, type AnyCommand, type AnyEvent, type AnyMessage, type AnyReadEvent, type AnyReadEventMetadata, type AnyRecord, type AnyRecordedMessage, type AnyRecordedMessageMetadata, type AppendStreamResultOfEventStore, type AppendToStreamOptions, type AppendToStreamResult, type AppendToStreamResultWithGlobalPosition, type ArgumentMatcher, AssertionError, type AsyncAwaiter, type AsyncDeciderSpecification, type AsyncRetryOptions, type BaseMessageProcessorOptions, type BatchMessageHandler, type BatchMessageHandlerResult, type BatchMessageHandlerWithContext, type BatchMessageHandlerWithoutContext, type BatchRawMessageHandlerWithContext, type BatchRawMessageHandlerWithoutContext, type BatchRecordedMessageHandlerWithContext, type BatchRecordedMessageHandlerWithoutContext, type BatchWorkflowOutputHandler, type BeforeEventStoreCommitHandler, type BoundedAccessGuard, type Brand, type CanHandle, type Checkpointer, type Closeable, type CombineMetadata, type CombinedMessageMetadata, type CombinedReadEventMetadata, type Command, type CommandBus, type CommandDataOf, CommandHandler, type CommandHandlerOptions, type CommandHandlerResult, type CommandHandlerRetryOptions, CommandHandlerStreamVersionConflictRetryOptions, type CommandMetaDataOf, type CommandProcessor, type CommandSender, type CommandTypeOf, type CommonReadEventMetadata, type CommonRecordedMessageMetadata, ConcurrencyError, type CreateCommandType, type CreateEventType, type CurrentMessageProcessorPosition, DATABASE_REQUIRED_ERROR_MESSAGE, type DatabaseHandleOptionErrors, type DatabaseHandleOptions, type DatabaseHandleResult, type Decider, DeciderCommandHandler, type DeciderCommandHandlerOptions, DeciderSpecification, type DeepReadonly, type DefaultCommandMetadata, type DefaultEventStoreOptions, type DefaultRecord, type DeleteManyOptions, type DeleteManyResult, type DeleteOneOptions, type DeleteResult, type Document, type DocumentHandler, EmmettError, type EnhancedOmit, type EnqueueTaskOptions, type Equatable, ErrorConstructor, type Event, type EventBus, type EventDataOf, type EventMetaDataOf, type EventStore, type EventStoreAppendSchemaOptions, type EventStoreReadEventMetadata, type EventStoreReadSchemaOptions, type EventStoreSchemaOptions, type EventStoreSession, type EventStoreSessionFactory, type EventStoreWrapper, type EventSubscription, type EventTypeOf, type EventsPublisher, type ExclusiveAccessGuard, type ExpectedDocumentVersion, type ExpectedDocumentVersionGeneral, type ExpectedDocumentVersionValue, type ExpectedStreamVersion, type ExpectedStreamVersionGeneral, type ExpectedStreamVersionWithValue, ExpectedVersionConflictError, type Flavour, type FullId, type GetCheckpoint, type GlobalPosition, type GlobalStreamCaughtUp, GlobalStreamCaughtUpType, type GlobalSubscriptionEvent, type HandleOptions, type HandlerOptions, type InMemoryCheckpointer, type InMemoryDatabase, type InMemoryDocumentEvolve, type InMemoryDocumentsCollection, type InMemoryEventStore, InMemoryEventStoreDefaultStreamVersion, type InMemoryEventStoreOptions, type InMemoryMultiStreamProjectionOptions, type InMemoryProcessor, type InMemoryProcessorConnectionOptions, type InMemoryProcessorEachBatchHandler, type InMemoryProcessorEachMessageHandler, type InMemoryProcessorHandlerContext, type InMemoryProcessorOptions, type InMemoryProjectionAssert, type InMemoryProjectionDefinition, type InMemoryProjectionHandlerContext, type InMemoryProjectionHandlerOptions, type InMemoryProjectionOptions, InMemoryProjectionSpec, type InMemoryProjectionSpecEvent, type InMemoryProjectionSpecOptions, type InMemoryProjectionSpecWhenOptions, type InMemoryProjectorOptions, type InMemoryReactorOptions, type InMemoryReadEvent, type InMemoryReadEventMetadata, type InMemorySingleStreamProjectionOptions, type InMemoryWithNotNullDocumentEvolve, type InMemoryWithNullableDocumentEvolve, InProcessLock, type InitializedOnceGuard, type InsertManyOptions, type InsertManyResult, type InsertOneOptions, type InsertOneResult, JSONCodec, type JSONCodecOptions, type JSONDeserializeOptions, JSONReplacer, JSONReplacers, JSONReviver, type JSONReviverContext, JSONRevivers, type JSONSerializationOptions, type JSONSerializeOptions, JSONSerializer, type JSONSerializerOptions, type Lock, type LockOptions, type Message, type MessageBus, type MessageConsumer, type MessageConsumerOptions, type MessageDataOf, type MessageDowncast, type MessageHandler, type MessageKindOf, type MessageMetaDataOf, type MessageProcessingScope, MessageProcessor, type MessageProcessorStartFrom, MessageProcessorType, type MessageScheduler, type MessageSubscription, type MessageTypeOf, type MessageUpcast, type MockedFunction, type Mutable, NO_CONCURRENCY_CHECK, NoRetries, type NonNullable$1 as NonNullable, type OnReactorCloseHook, type OnReactorInitHook, type OnReactorStartHook, type OperationResult, type OptionalId, type OptionalUnlessRequiredId, type OptionalUnlessRequiredIdAndVersion, type OptionalUnlessRequiredVersion, type OptionalVersion, type ProcessorCheckpoint, type ProcessorHooks, type ProjectionDefinition, type ProjectionHandler, type ProjectionHandlingType, type ProjectionInitOptions, type ProjectionRegistration, type ProjectorOptions, type ReactorOptions, type ReadEvent, type ReadEventMetadata, type ReadEventMetadataWithGlobalPosition, type ReadEventMetadataWithoutGlobalPosition, type ReadProcessorCheckpoint, type ReadProcessorCheckpointResult, type ReadStreamOptions, type ReadStreamResult, type RecordedMessage, type RecordedMessageMetadata, type RecordedMessageMetadataWithGlobalPosition, type RecordedMessageMetadataWithoutGlobalPosition, type ReleaseLockOptions, type ReplaceOneOptions, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, type ScheduleOptions, type ScheduledMessage, type ScheduledMessageProcessor, type SerializationCodec, type Serializer, type ShutdownHandler, type SingleMessageHandler, type SingleMessageHandlerResult, type SingleMessageHandlerWithContext, type SingleMessageHandlerWithoutContext, type SingleRawMessageHandlerWithContext, type SingleRawMessageHandlerWithoutContext, type SingleRecordedMessageHandlerWithContext, type SingleRecordedMessageHandlerWithoutContext, type SingleWorkflowOutputHandler, type StoreProcessorCheckpoint, type StoreProcessorCheckpointResult, type StreamExistsResult, type StreamPosition, type Task, type TaskContext, TaskProcessor, type TaskProcessorOptions, type TaskQueue, type TaskQueueItem, type TestEventStream, type ThenThrows, type TruncateProjection, type UpdateManyOptions, type UpdateManyResult, type UpdateOneOptions, type UpdateResult, ValidationErrors, type WithGlobalPosition, type WithId, type WithIdAndVersion, type WithVersion, type WithoutId, type WithoutVersion, Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowHandleOptions, WorkflowHandler, type WorkflowHandlerResult, type WorkflowHandlerRetryOptions, WorkflowHandlerStreamVersionConflictRetryOptions, type WorkflowInputMessageMetadata, type WorkflowMessageAction, type WorkflowOptions, type WorkflowOutput, type WorkflowOutputHandlerDefinition, type WorkflowOutputHandlerOptions, type WorkflowOutputHandlerResult, type WorkflowOutputMessageMetadata, type WorkflowProcessorContext, type WorkflowProcessorOptions, WorkflowSpecification, WrapEventStore, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, bigInt, bigIntProcessorCheckpoint, canCreateEventStoreSession, caughtUpEventFrom, command, composeJSONReplacers, composeJSONRevivers, deepEquals, defaultProcessingMessageProcessingScope, defaultProcessorPartition, defaultProcessorVersion, defaultTag, delay, documentExists, downcastRecordedMessage, downcastRecordedMessages, emmettPrefix, event, eventInStream, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, getProcessorInstanceId, getProjectorId, getWorkflowId, globalStreamCaughtUp, globalTag, guardBoundedAccess, guardExclusiveAccess, guardInitializedOnce, handleInMemoryProjections, hashText, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, jsonSerializer, matchesExpectedVersion, merge, message, newEventsInStream, nulloSessionFactory, onShutdown, parseBigIntProcessorCheckpoint, parseDateFromUtcYYYYMMDD, projection, projections, projector, reactor, reduceAsync, sum, toNormalizedString, tryPublishMessagesAfterCommit, unknownTag, upcastRecordedMessage, upcastRecordedMessages, verifyThat, wasMessageHandled, workflowOutputHandler, workflowProcessor, workflowStreamName };
1307
+ //#endregion
1308
+ export { AcquireLockOptions, AfterEventStoreCommitHandler, AggregateStreamOptions, AggregateStreamResult, AggregateStreamResultOfEventStore, AggregateStreamResultWithGlobalPosition, AnyCommand, AnyEvent, AnyMessage, AnyReadEvent, AnyReadEventMetadata, AnyRecord, AnyRecordedMessage, AnyRecordedMessageMetadata, AppendStreamResultOfEventStore, AppendToStreamOptions, AppendToStreamResult, AppendToStreamResultWithGlobalPosition, ArgumentMatcher, AssertionError, AsyncAwaiter, AsyncDeciderSpecification, AsyncRetryOptions, BaseMessageProcessorOptions, BatchMessageHandler, BatchMessageHandlerResult, BatchMessageHandlerWithContext, BatchMessageHandlerWithoutContext, BatchRawMessageHandlerWithContext, BatchRawMessageHandlerWithoutContext, BatchRecordedMessageHandlerWithContext, BatchRecordedMessageHandlerWithoutContext, BatchWorkflowOutputHandler, BeforeEventStoreCommitHandler, BoundedAccessGuard, Brand, CanHandle, Checkpointer, Closeable, CombineMetadata, CombinedMessageMetadata, CombinedReadEventMetadata, Command, CommandBus, CommandDataOf, CommandHandler, CommandHandlerOptions, CommandHandlerResult, CommandHandlerRetryOptions, CommandHandlerStreamVersionConflictRetryOptions, CommandMetaDataOf, CommandProcessor, CommandSender, CommandTypeOf, CommonReadEventMetadata, CommonRecordedMessageMetadata, ConcurrencyError, ConcurrencyInMemoryDatabaseError, CreateCommandType, CreateEventType, CurrentMessageProcessorPosition, DATABASE_REQUIRED_ERROR_MESSAGE, DatabaseHandleOptionErrors, DatabaseHandleOptions, DatabaseHandleResult, Decider, DeciderCommandHandler, DeciderCommandHandlerOptions, DeciderSpecification, DeepReadonly, DefaultCommandMetadata, DefaultEventStoreOptions, DefaultRecord, DeleteManyOptions, DeleteManyResult, DeleteOneOptions, DeleteResult, Document, DocumentHandler, EmmettCliCommand, EmmettCliPlugin, EmmettCliPluginRegistration, EmmettError, EmmettPlugin, EmmettPluginConfig, EmmettPluginRegistration, EmmettPluginType, EmmettPluginsConfig, EnhancedOmit, EnqueueTaskOptions, Equatable, ErrorConstructor, Event, EventBus, EventDataOf, EventMetaDataOf, EventStore, EventStoreAppendSchemaOptions, EventStoreReadEventMetadata, EventStoreReadSchemaOptions, EventStoreSchemaOptions, EventStoreSession, EventStoreSessionFactory, EventStoreWrapper, EventSubscription, EventTypeOf, EventsPublisher, ExclusiveAccessGuard, ExpectedDocumentVersion, ExpectedDocumentVersionGeneral, ExpectedDocumentVersionValue, ExpectedStreamVersion, ExpectedStreamVersionGeneral, ExpectedStreamVersionWithValue, ExpectedVersionConflictError, Flavour, FullId, GetCheckpoint, GlobalPosition, GlobalStreamCaughtUp, GlobalStreamCaughtUpType, GlobalSubscriptionEvent, HandleOptions, HandlerOptions, IllegalStateError, InMemoryCheckpointer, InMemoryDatabase, InMemoryDocumentEvolve, InMemoryDocumentsCollection, InMemoryEventStore, InMemoryEventStoreDefaultStreamVersion, InMemoryEventStoreOptions, InMemoryMultiStreamProjectionOptions, InMemoryProcessor, InMemoryProcessorConnectionOptions, InMemoryProcessorEachBatchHandler, InMemoryProcessorEachMessageHandler, InMemoryProcessorHandlerContext, InMemoryProcessorOptions, InMemoryProjectionAssert, InMemoryProjectionDefinition, InMemoryProjectionHandlerContext, InMemoryProjectionHandlerOptions, InMemoryProjectionOptions, InMemoryProjectionSpec, InMemoryProjectionSpecEvent, InMemoryProjectionSpecOptions, InMemoryProjectionSpecWhenOptions, InMemoryProjectorOptions, InMemoryReactorOptions, InMemoryReadEvent, InMemoryReadEventMetadata, InMemorySingleStreamProjectionOptions, InMemoryWithNotNullDocumentEvolve, InMemoryWithNullableDocumentEvolve, InProcessLock, InitializedOnceGuard, InsertManyOptions, InsertManyResult, InsertOneOptions, InsertOneResult, JSONCodec, type JSONCodecOptions, type JSONDeserializeOptions, JSONReplacer, JSONReplacers, JSONReviver, JSONReviverContext, JSONRevivers, type JSONSerializationOptions, type JSONSerializeOptions, JSONSerializer, type JSONSerializerOptions, Lock, LockOptions, Message, MessageBus, MessageConsumer, MessageConsumerOptions, MessageDataOf, MessageDowncast, MessageHandler, MessageKindOf, MessageMetaDataOf, MessageProcessingScope, MessageProcessor, MessageProcessorStartFrom, MessageProcessorType, MessageScheduler, MessageSubscription, MessageTypeOf, MessageUpcast, MockedFunction, Mutable, NO_CONCURRENCY_CHECK, NoRetries, NonNullable$1 as NonNullable, NotFoundError, OnReactorCloseHook, OnReactorInitHook, OnReactorStartHook, OperationResult, OptionalId, OptionalUnlessRequiredId, OptionalUnlessRequiredIdAndVersion, OptionalUnlessRequiredVersion, OptionalVersion, ProcessorCheckpoint, ProcessorHooks, ProjectionDefinition, ProjectionHandler, ProjectionHandlingType, ProjectionInitOptions, ProjectionRegistration, ProjectorOptions, ReactorOptions, ReadEvent, ReadEventMetadata, ReadEventMetadataWithGlobalPosition, ReadEventMetadataWithoutGlobalPosition, ReadProcessorCheckpoint, ReadProcessorCheckpointResult, ReadStreamOptions, ReadStreamResult, RecordedMessage, RecordedMessageMetadata, RecordedMessageMetadataWithGlobalPosition, RecordedMessageMetadataWithoutGlobalPosition, ReleaseLockOptions, ReplaceOneOptions, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, ScheduleOptions, ScheduledMessage, ScheduledMessageProcessor, SerializationCodec, Serializer, ShutdownHandler, SingleMessageHandler, SingleMessageHandlerResult, SingleMessageHandlerWithContext, SingleMessageHandlerWithoutContext, SingleRawMessageHandlerWithContext, SingleRawMessageHandlerWithoutContext, SingleRecordedMessageHandlerWithContext, SingleRecordedMessageHandlerWithoutContext, SingleWorkflowOutputHandler, StoreProcessorCheckpoint, StoreProcessorCheckpointResult, StreamExistsResult, StreamPosition, Task, TaskContext, TaskProcessor, TaskProcessorOptions, TaskQueue, TaskQueueItem, TestEventStream, ThenThrows, TruncateProjection, UpdateManyOptions, UpdateManyResult, UpdateOneOptions, UpdateResult, ValidationError, ValidationErrors, WithGlobalPosition, WithId, WithIdAndVersion, WithVersion, WithoutId, WithoutVersion, Workflow, WorkflowCommand, WorkflowEvent, WorkflowHandleOptions, WorkflowHandler, WorkflowHandlerResult, WorkflowHandlerRetryOptions, WorkflowHandlerStreamVersionConflictRetryOptions, WorkflowInputMessageMetadata, WorkflowMessageAction, WorkflowOptions, WorkflowOutput, WorkflowOutputHandlerDefinition, WorkflowOutputHandlerOptions, WorkflowOutputHandlerResult, WorkflowOutputMessageMetadata, WorkflowProcessorContext, WorkflowProcessorOptions, WorkflowSpecification, WrapEventStore, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, bigInt, bigIntProcessorCheckpoint, canCreateEventStoreSession, caughtUpEventFrom, command, composeJSONReplacers, composeJSONRevivers, deepEquals, defaultProcessingMessageProcessingScope, defaultProcessorPartition, defaultProcessorVersion, defaultTag, delay, documentExists, downcastRecordedMessage, downcastRecordedMessages, emmettPrefix, event, eventInStream, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, getProcessorInstanceId, getProjectorId, getWorkflowId, globalStreamCaughtUp, globalTag, guardBoundedAccess, guardExclusiveAccess, guardInitializedOnce, handleInMemoryProjections, hashText, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isErrorConstructor, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isPluginConfig, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, jsonSerializer, matchesExpectedVersion, merge, message, newEventsInStream, nulloSessionFactory, onShutdown, parseBigIntProcessorCheckpoint, parseDateFromUtcYYYYMMDD, projection, projections, projector, reactor, reduceAsync, sum, toNormalizedString, tryPublishMessagesAfterCommit, unknownTag, upcastRecordedMessage, upcastRecordedMessages, verifyThat, wasMessageHandled, workflowOutputHandler, workflowProcessor, workflowStreamName };
1309
+ //# sourceMappingURL=index.d.cts.map