@event-driven-io/emmett-mongodb 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,240 +1,244 @@
1
- import { Event, ReadEvent, ProjectionDefinition, ProjectionHandler, CanHandle, ThenThrows, ReadEventMetadataWithoutGlobalPosition, EventStore, ProjectionRegistration, DefaultEventStoreOptions, Closeable } from '@event-driven-io/emmett';
2
- import { UpdateFilter, Collection, Document, MongoClient, Filter, MongoClientOptions } from 'mongodb';
1
+ import { CanHandle, Closeable, DefaultEventStoreOptions, Event, EventStore, ProjectionDefinition, ProjectionHandler, ProjectionRegistration, ReadEvent, ReadEventMetadataWithoutGlobalPosition, ThenThrows } from "@event-driven-io/emmett";
2
+ import { Collection, Document, Filter, MongoClient, MongoClientOptions, UpdateFilter } from "mongodb";
3
3
 
4
+ //#region src/eventStore/projections/mongoDBInlineProjection.d.ts
4
5
  declare const MongoDBDefaultInlineProjectionName = "_default";
5
6
  type MongoDBProjectionInlineHandlerContext<EventType extends Event = Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata> = {
6
- document: MongoDBReadModel | null;
7
- streamId: string;
8
- updates: UpdateFilter<EventStream<EventType, EventMetaDataType>>;
9
- collection: Collection<EventStream<EventType, EventMetaDataType>>;
7
+ document: MongoDBReadModel | null;
8
+ streamId: string;
9
+ updates: UpdateFilter<EventStream<EventType, EventMetaDataType>>;
10
+ collection: Collection<EventStream<EventType, EventMetaDataType>>;
10
11
  };
11
12
  type MongoDBInlineProjectionHandler<EventType extends Event = Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata> = ProjectionHandler<EventType, EventMetaDataType, MongoDBProjectionInlineHandlerContext>;
12
13
  type MongoDBInlineProjectionDefinition<EventType extends Event = Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata> = ProjectionDefinition<EventType, EventMetaDataType, MongoDBProjectionInlineHandlerContext> & {
13
- name: string;
14
+ name: string;
14
15
  };
15
16
  type InlineProjectionHandlerOptions<EventType extends Event = Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata> = {
16
- readModels: Record<string, MongoDBReadModel>;
17
- events: Array<ReadEvent<EventType, EventMetaDataType>>;
18
- projections: MongoDBInlineProjectionDefinition<EventType, EventMetaDataType>[];
19
- streamId: string;
20
- collection: Collection<EventStream>;
21
- updates: UpdateFilter<EventStream<Event>>;
22
- client: {};
17
+ readModels: Record<string, MongoDBReadModel>;
18
+ events: Array<ReadEvent<EventType, EventMetaDataType>>;
19
+ projections: MongoDBInlineProjectionDefinition<EventType, EventMetaDataType>[];
20
+ streamId: string;
21
+ collection: Collection<EventStream>;
22
+ updates: UpdateFilter<EventStream<Event>>;
23
+ client: {};
23
24
  };
24
25
  declare const handleInlineProjections: <EventType extends Event = Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata>(options: InlineProjectionHandlerOptions<EventType, EventMetaDataType>) => Promise<void>;
25
26
  type MongoDBWithNotNullDocumentEvolve<Doc extends Document, EventType extends Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata> = ((document: Doc, event: ReadEvent<EventType, EventMetaDataType>) => Doc | null) | ((document: Doc, event: ReadEvent<EventType>) => Promise<Doc | null>);
26
27
  type MongoDBWithNullableDocumentEvolve<Doc extends Document, EventType extends Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata> = ((document: Doc | null, event: ReadEvent<EventType, EventMetaDataType>) => Doc | null) | ((document: Doc | null, event: ReadEvent<EventType>) => Promise<Doc | null>);
27
28
  type MongoDBInlineProjectionOptions<Doc extends Document, EventType extends Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata> = {
28
- name?: string;
29
- schemaVersion?: number;
30
- canHandle: CanHandle<EventType>;
29
+ name?: string;
30
+ schemaVersion?: number;
31
+ canHandle: CanHandle<EventType>;
31
32
  } & ({
32
- evolve: MongoDBWithNullableDocumentEvolve<Doc, EventType, EventMetaDataType>;
33
+ evolve: MongoDBWithNullableDocumentEvolve<Doc, EventType, EventMetaDataType>;
33
34
  } | {
34
- evolve: MongoDBWithNotNullDocumentEvolve<Doc, EventType, EventMetaDataType>;
35
- initialState: () => Doc;
35
+ evolve: MongoDBWithNotNullDocumentEvolve<Doc, EventType, EventMetaDataType>;
36
+ initialState: () => Doc;
36
37
  });
37
38
  declare const mongoDBInlineProjection: <Doc extends Document, EventType extends Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata>(options: MongoDBInlineProjectionOptions<Doc, EventType, EventMetaDataType>) => MongoDBInlineProjectionDefinition;
38
-
39
+ //#endregion
40
+ //#region src/eventStore/projections/mongoDBInlineProjectionSpec.d.ts
39
41
  type MongoDBInlineProjectionSpecGivenEvents<StreamNameType extends StreamName, EventType extends Event> = {
40
- streamName: StreamNameType;
41
- events: EventType[];
42
+ streamName: StreamNameType;
43
+ events: EventType[];
44
+ };
45
+ type MongoDBInlineProjectionSpec<StreamNameType extends StreamName, EventType extends Event> = (givenStream: MongoDBInlineProjectionSpecGivenEvents<StreamNameType, EventType>) => {
46
+ when: (events: EventType[]) => {
47
+ then: (assert: MongoDBInlineProjectionAssert, message?: string) => Promise<void>;
48
+ thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
49
+ };
42
50
  };
43
51
  type MongoDBInlineProjectionAssertOptions<StreamNameType extends StreamName = StreamName> = {
44
- streamName: StreamNameType;
45
- eventStore: MongoDBEventStore;
52
+ streamName: StreamNameType;
53
+ eventStore: MongoDBEventStore;
46
54
  };
47
55
  type MongoDBInlineProjectionAssert<StreamNameType extends StreamName = StreamName> = (options: MongoDBInlineProjectionAssertOptions<StreamNameType>) => Promise<void | boolean>;
48
56
  type MongoDBInlineProjectionSpecOptions = {
49
- projection: MongoDBInlineProjectionDefinition;
57
+ projection: MongoDBInlineProjectionDefinition;
50
58
  } & MongoDBEventStoreConnectionOptions;
51
- type MongoDBInlineProjectionSpec<StreamNameType extends StreamName, EventType extends Event> = (givenStream: MongoDBInlineProjectionSpecGivenEvents<StreamNameType, EventType>) => {
52
- when: (events: EventType[]) => {
53
- then: (assert: MongoDBInlineProjectionAssert, message?: string) => Promise<void>;
54
- thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
55
- };
56
- };
57
59
  declare const MongoDBInlineProjectionSpec: {
58
- for: <StreamNameType extends StreamName, EventType extends Event>(options: MongoDBInlineProjectionSpecOptions) => MongoDBInlineProjectionSpec<StreamNameType, EventType>;
60
+ for: <StreamNameType extends StreamName, EventType extends Event>(options: MongoDBInlineProjectionSpecOptions) => MongoDBInlineProjectionSpec<StreamNameType, EventType>;
59
61
  };
60
62
  declare const eventInStream: <StreamNameType extends StreamName, EventType extends Event>(streamName: StreamNameType, event: EventType) => MongoDBInlineProjectionSpecGivenEvents<StreamNameType, EventType>;
61
63
  declare const eventsInStream: <StreamNameType extends StreamName, EventType extends Event>(streamName: StreamNameType, events: EventType[]) => MongoDBInlineProjectionSpecGivenEvents<StreamNameType, EventType>;
62
64
  declare const expectInlineReadModel: {
65
+ toHave: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(expected: Partial<MongoDBReadModel<Doc>> | null) => MongoDBInlineProjectionAssert<StreamNameType>;
66
+ toDeepEquals: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(expected: MongoDBReadModel<Doc> | null) => MongoDBInlineProjectionAssert<StreamNameType>;
67
+ toMatch: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(match: (readModel: MongoDBReadModel<Doc> | null) => boolean) => MongoDBInlineProjectionAssert<StreamNameType>;
68
+ notToExist: <StreamNameType extends StreamName = `${string}:${string}`>() => MongoDBInlineProjectionAssert<StreamNameType>;
69
+ toExist: () => MongoDBInlineProjectionAssert;
70
+ withName: (name: string) => {
63
71
  toHave: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(expected: Partial<MongoDBReadModel<Doc>> | null) => MongoDBInlineProjectionAssert<StreamNameType>;
64
72
  toDeepEquals: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(expected: MongoDBReadModel<Doc> | null) => MongoDBInlineProjectionAssert<StreamNameType>;
65
73
  toMatch: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(match: (readModel: MongoDBReadModel<Doc> | null) => boolean) => MongoDBInlineProjectionAssert<StreamNameType>;
66
74
  notToExist: <StreamNameType extends StreamName = `${string}:${string}`>() => MongoDBInlineProjectionAssert<StreamNameType>;
67
75
  toExist: () => MongoDBInlineProjectionAssert;
68
- withName: (name: string) => {
69
- toHave: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(expected: Partial<MongoDBReadModel<Doc>> | null) => MongoDBInlineProjectionAssert<StreamNameType>;
70
- toDeepEquals: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(expected: MongoDBReadModel<Doc> | null) => MongoDBInlineProjectionAssert<StreamNameType>;
71
- toMatch: <Doc extends Document, StreamNameType extends StreamName = `${string}:${string}`>(match: (readModel: MongoDBReadModel<Doc> | null) => boolean) => MongoDBInlineProjectionAssert<StreamNameType>;
72
- notToExist: <StreamNameType extends StreamName = `${string}:${string}`>() => MongoDBInlineProjectionAssert<StreamNameType>;
73
- toExist: () => MongoDBInlineProjectionAssert;
74
- };
76
+ };
75
77
  };
76
-
78
+ //#endregion
79
+ //#region src/eventStore/storage/mongoDBEventStoreStorage.d.ts
77
80
  type MongoDBEventStoreCollectionPerStreamTypeStorageOptions = {
78
- /**
79
- * The recommended setting where each stream type will be kept
80
- * in a separate collection type using the format: `emt_${streamType}`.
81
- */
82
- type: 'COLLECTION_PER_STREAM_TYPE';
83
- databaseName?: string;
81
+ /**
82
+ * The recommended setting where each stream type will be kept
83
+ * in a separate collection type using the format: `emt_${streamType}`.
84
+ */
85
+ type: 'COLLECTION_PER_STREAM_TYPE';
86
+ databaseName?: string;
84
87
  };
85
88
  type MongoDBEventStoreSingleCollectionStorageOptions = {
86
- /**
87
- * All streams will be kept withing a single MongDB collection
88
- * It'll either use default collection name ("emt_streams")
89
- * or provided name through 'collection' param.
90
- */
91
- type: 'SINGLE_COLLECTION';
92
- collectionName?: string;
93
- databaseName?: string;
89
+ /**
90
+ * All streams will be kept withing a single MongDB collection
91
+ * It'll either use default collection name ("emt_streams")
92
+ * or provided name through 'collection' param.
93
+ */
94
+ type: 'SINGLE_COLLECTION';
95
+ collectionName?: string;
96
+ databaseName?: string;
94
97
  };
95
98
  type MongoDBEventStoreCollectionResolution = {
96
- databaseName?: string;
97
- collectionName: string;
99
+ databaseName?: string;
100
+ collectionName: string;
98
101
  };
99
102
  type MongoDBEventStoreCustomStorageOptions = {
100
- /**
101
- * This is advanced option, where you specify your own collection
102
- * resolution function. You can do that by specifying the `collectionFor` function.
103
- */
104
- type: 'CUSTOM';
105
- databaseName?: string;
106
- collectionFor: <T extends StreamType>(streamType: T) => string | MongoDBEventStoreCollectionResolution;
103
+ /**
104
+ * This is advanced option, where you specify your own collection
105
+ * resolution function. You can do that by specifying the `collectionFor` function.
106
+ */
107
+ type: 'CUSTOM';
108
+ databaseName?: string;
109
+ collectionFor: <T extends StreamType>(streamType: T) => string | MongoDBEventStoreCollectionResolution;
107
110
  };
108
111
  type MongoDBEventStoreStorageOptions = 'COLLECTION_PER_STREAM_TYPE' | 'SINGLE_COLLECTION' | MongoDBEventStoreSingleCollectionStorageOptions | MongoDBEventStoreCollectionPerStreamTypeStorageOptions | MongoDBEventStoreCustomStorageOptions;
109
112
  declare const DefaultMongoDBEventStoreStorageOptions = "COLLECTION_PER_STREAM_TYPE";
110
113
  type MongoDBEventStoreStorage = {
111
- collectionFor: <T extends StreamType, EventType extends Event = Event>(streamType: T) => Promise<Collection<EventStream<EventType>>>;
114
+ collectionFor: <T extends StreamType, EventType extends Event = Event>(streamType: T) => Promise<Collection<EventStream<EventType>>>;
112
115
  };
113
116
  declare const DefaultMongoDBEventStoreCollectionName = "emt:streams";
114
117
  declare const mongoDBEventStoreStorage: (options: {
115
- storage?: MongoDBEventStoreStorageOptions | undefined;
116
- getConnectedClient: () => Promise<MongoClient>;
118
+ storage?: MongoDBEventStoreStorageOptions | undefined;
119
+ getConnectedClient: () => Promise<MongoClient>;
117
120
  }) => MongoDBEventStoreStorage;
118
-
121
+ //#endregion
122
+ //#region src/eventStore/mongoDBEventStore.d.ts
119
123
  declare const MongoDBEventStoreDefaultStreamVersion = 0n;
120
124
  type StreamType = string;
121
125
  type StreamName<T extends StreamType = StreamType> = `${T}:${string}`;
122
126
  type StreamNameParts<T extends StreamType = StreamType> = {
123
- streamType: T;
124
- streamId: string;
127
+ streamType: T;
128
+ streamId: string;
125
129
  };
126
130
  type StreamCollectionName<T extends StreamType = StreamType> = `emt:${T}`;
127
131
  type StreamCollectionNameParts<T extends StreamType = StreamType> = {
128
- streamType: T;
132
+ streamType: T;
129
133
  };
130
134
  type MongoDBReadModelMetadata = {
131
- streamId: string;
132
- name: string;
133
- schemaVersion: number;
134
- streamPosition: bigint;
135
+ streamId: string;
136
+ name: string;
137
+ schemaVersion: number;
138
+ streamPosition: bigint;
135
139
  };
136
140
  type MongoDBReadModel<Doc extends Document = Document> = Doc & {
137
- _metadata: MongoDBReadModelMetadata;
141
+ _metadata: MongoDBReadModelMetadata;
138
142
  };
139
143
  interface EventStream<EventType extends Event = Event, EventMetaDataType extends MongoDBReadEventMetadata = MongoDBReadEventMetadata> {
140
- streamName: string;
141
- messages: Array<ReadEvent<EventType, EventMetaDataType>>;
142
- metadata: {
143
- streamId: string;
144
- streamType: StreamType;
145
- streamPosition: bigint;
146
- createdAt: Date;
147
- updatedAt: Date;
148
- };
149
- projections: Record<string, MongoDBReadModel>;
144
+ streamName: string;
145
+ messages: Array<ReadEvent<EventType, EventMetaDataType>>;
146
+ metadata: {
147
+ streamId: string;
148
+ streamType: StreamType;
149
+ streamPosition: bigint;
150
+ createdAt: Date;
151
+ updatedAt: Date;
152
+ };
153
+ projections: Record<string, MongoDBReadModel>;
150
154
  }
151
155
  type MongoDBReadEventMetadata = ReadEventMetadataWithoutGlobalPosition;
152
156
  type MongoDBReadEvent<EventType extends Event = Event> = ReadEvent<EventType, MongoDBReadEventMetadata>;
153
157
  type SingleProjectionQueryStreamFilter<T extends StreamType> = {
154
- projectionName?: string;
158
+ projectionName?: string;
155
159
  } & ({
156
- streamName: StreamName<T>;
160
+ streamName: StreamName<T>;
157
161
  } | {
158
- streamType: T;
159
- streamId?: string;
162
+ streamType: T;
163
+ streamId?: string;
160
164
  });
161
165
  type MultiProjectionQueryStreamFilter<T extends StreamType> = {
162
- projectionName?: string;
166
+ projectionName?: string;
163
167
  } & ({
164
- streamNames: StreamName<T>[];
168
+ streamNames: StreamName<T>[];
165
169
  } | {
166
- streamType: T;
167
- streamIds?: string[];
170
+ streamType: T;
171
+ streamIds?: string[];
168
172
  });
169
173
  type MultiProjectionQueryOptions = {
170
- skip?: number;
171
- limit?: number;
172
- sort?: [string, 1 | -1][] | Record<string, 1 | -1>;
174
+ skip?: number;
175
+ limit?: number;
176
+ sort?: [string, 1 | -1][] | Record<string, 1 | -1>;
173
177
  };
174
178
  /**
175
179
  * Helpers for querying inline projections on event streams.
176
180
  */
177
181
  type InlineProjectionQueries<T extends StreamType> = {
178
- /**
179
- * Helper for querying for a single projection. Similar to `collection.findOne`.
180
- * @param streamFilter - A filter object for stream level fields. If `streamType` is required if `streamName` is not provided. If `projectionName` is not provided, the default projection will be used (`MongoDBDefaultInlineProjectionName`).
181
- * @param projectionQuery - A MongoDB filter query based on the projection schema. Internally, this function will prepend each object key with the necessary projection name.
182
- */
183
- findOne: <Doc extends Document>(streamFilter: SingleProjectionQueryStreamFilter<T>, projectionQuery?: Filter<MongoDBReadModel<Doc>>) => Promise<MongoDBReadModel<Doc> | null>;
184
- /**
185
- * Helper for querying for multiple projections. Similar to `collection.find`.
186
- *
187
- * ***NOTE***: If `streamFilter.streamNames` is an empty array, this function will return an empty array. If `streamFilter.streamIds` is an empty array, the `streamIds` filter will not be used.
188
- *
189
- * @param streamFilter - A filter object for stream level fields. If `streamType` is required if `streamNames` is not provided. If `projectionName` is not provided, the default projection will be used (`MongoDBDefaultInlineProjectionName`).
190
- * @param projectionQuery - A MongoDB filter query based on the projection schema. Internally, this function will prepend each object key with the necessary projection name.
191
- * @param queryOptions - Additional query options like `skip`, `limit`, and `sort`. `sort`, similar to `projectionQuery`, will prepend each object key with the necessary projection name.
192
- */
193
- find: <Doc extends Document>(streamFilter: MultiProjectionQueryStreamFilter<T>, projectionQuery?: Filter<MongoDBReadModel<Doc>>, queryOptions?: MultiProjectionQueryOptions) => Promise<MongoDBReadModel<Doc>[]>;
194
- /**
195
- * Returns the total number of documents matching the provided filter options. Similar to `collection.countDocuments`.
196
- *
197
- * ***NOTE***: If `streamFilter.streamNames` is an empty array, this function will return `0`. If `streamFilter.streamIds` is an empty array, the `streamIds` filter will not be used.
198
- *
199
- * @param streamFilter - A filter object for stream level fields. If `streamType` is required if `streamNames` is not provided. If `projectionName` is not provided, the default projection will be used (`MongoDBDefaultInlineProjectionName`).
200
- * @param projectionQuery - A MongoDB filter query based on the projection schema. Internally, this function will prepend each object key with the necessary projection name.
201
- */
202
- count: <Doc extends Document>(streamFilter: MultiProjectionQueryStreamFilter<T>, projectionQuery?: Filter<MongoDBReadModel<Doc>>) => Promise<number>;
182
+ /**
183
+ * Helper for querying for a single projection. Similar to `collection.findOne`.
184
+ * @param streamFilter - A filter object for stream level fields. If `streamType` is required if `streamName` is not provided. If `projectionName` is not provided, the default projection will be used (`MongoDBDefaultInlineProjectionName`).
185
+ * @param projectionQuery - A MongoDB filter query based on the projection schema. Internally, this function will prepend each object key with the necessary projection name.
186
+ */
187
+ findOne: <Doc extends Document>(streamFilter: SingleProjectionQueryStreamFilter<T>, projectionQuery?: Filter<MongoDBReadModel<Doc>>) => Promise<MongoDBReadModel<Doc> | null>;
188
+ /**
189
+ * Helper for querying for multiple projections. Similar to `collection.find`.
190
+ *
191
+ * ***NOTE***: If `streamFilter.streamNames` is an empty array, this function will return an empty array. If `streamFilter.streamIds` is an empty array, the `streamIds` filter will not be used.
192
+ *
193
+ * @param streamFilter - A filter object for stream level fields. If `streamType` is required if `streamNames` is not provided. If `projectionName` is not provided, the default projection will be used (`MongoDBDefaultInlineProjectionName`).
194
+ * @param projectionQuery - A MongoDB filter query based on the projection schema. Internally, this function will prepend each object key with the necessary projection name.
195
+ * @param queryOptions - Additional query options like `skip`, `limit`, and `sort`. `sort`, similar to `projectionQuery`, will prepend each object key with the necessary projection name.
196
+ */
197
+ find: <Doc extends Document>(streamFilter: MultiProjectionQueryStreamFilter<T>, projectionQuery?: Filter<MongoDBReadModel<Doc>>, queryOptions?: MultiProjectionQueryOptions) => Promise<MongoDBReadModel<Doc>[]>;
198
+ /**
199
+ * Returns the total number of documents matching the provided filter options. Similar to `collection.countDocuments`.
200
+ *
201
+ * ***NOTE***: If `streamFilter.streamNames` is an empty array, this function will return `0`. If `streamFilter.streamIds` is an empty array, the `streamIds` filter will not be used.
202
+ *
203
+ * @param streamFilter - A filter object for stream level fields. If `streamType` is required if `streamNames` is not provided. If `projectionName` is not provided, the default projection will be used (`MongoDBDefaultInlineProjectionName`).
204
+ * @param projectionQuery - A MongoDB filter query based on the projection schema. Internally, this function will prepend each object key with the necessary projection name.
205
+ */
206
+ count: <Doc extends Document>(streamFilter: MultiProjectionQueryStreamFilter<T>, projectionQuery?: Filter<MongoDBReadModel<Doc>>) => Promise<number>;
203
207
  };
204
208
  /**
205
209
  * Helpers for querying projections on event streams.
206
210
  */
207
211
  type ProjectionQueries<T extends StreamType> = {
208
- inline: InlineProjectionQueries<T>;
212
+ inline: InlineProjectionQueries<T>;
209
213
  };
210
214
  type MongoDBEventStoreClientOptions = {
211
- client: MongoClient;
212
- connectionString?: never;
213
- clientOptions?: never;
215
+ client: MongoClient;
216
+ connectionString?: never;
217
+ clientOptions?: never;
214
218
  };
215
219
  type MongoDBEventStoreConnectionStringOptions = {
216
- client?: never;
217
- connectionString: string;
218
- clientOptions?: MongoClientOptions;
220
+ client?: never;
221
+ connectionString: string;
222
+ clientOptions?: MongoClientOptions;
219
223
  };
220
224
  type MongoDBEventStoreConnectionOptions = MongoDBEventStoreClientOptions | MongoDBEventStoreConnectionStringOptions;
221
225
  type MongoDBEventStoreOptions = {
222
- projections?: ProjectionRegistration<'inline', MongoDBReadEventMetadata, MongoDBProjectionInlineHandlerContext>[];
223
- storage?: MongoDBEventStoreStorageOptions;
226
+ projections?: ProjectionRegistration<'inline', MongoDBReadEventMetadata, MongoDBProjectionInlineHandlerContext>[];
227
+ storage?: MongoDBEventStoreStorageOptions;
224
228
  } & MongoDBEventStoreConnectionOptions & DefaultEventStoreOptions<MongoDBEventStore>;
225
229
  type MongoDBEventStore = EventStore<MongoDBReadEventMetadata> & {
226
- projections: ProjectionQueries<StreamType>;
227
- collectionFor: <EventType extends Event>(streamType: StreamType) => Promise<Collection<EventStream<EventType>>>;
230
+ projections: ProjectionQueries<StreamType>;
231
+ collectionFor: <EventType extends Event>(streamType: StreamType) => Promise<Collection<EventStream<EventType>>>;
228
232
  };
229
233
  /**
230
234
  * Prepends `prefix` to all object keys that don't start with a '$'
231
235
  */
232
236
  declare function prependMongoFilterWithProjectionPrefix<T, Result = T>(obj: T, prefix: string): Result;
233
237
  declare function getMongoDBEventStore(options: MongoDBEventStoreOptions & {
234
- client: MongoClient;
238
+ client: MongoClient;
235
239
  }): MongoDBEventStore;
236
240
  declare function getMongoDBEventStore(options: MongoDBEventStoreOptions & {
237
- connectionString: string;
241
+ connectionString: string;
238
242
  }): MongoDBEventStore & Closeable;
239
243
  /**
240
244
  * Accepts a `streamType` (the type/category of the event stream) and an `streamId`
@@ -256,5 +260,6 @@ declare function toStreamCollectionName<T extends StreamType>(streamType: T): St
256
260
  * Accepts a fully formatted `streamCollectionName` and returns the parsed `streamType`.
257
261
  */
258
262
  declare function fromStreamCollectionName<T extends StreamType>(streamCollectionName: StreamCollectionName<T>): StreamCollectionNameParts<T>;
259
-
260
- export { DefaultMongoDBEventStoreCollectionName, DefaultMongoDBEventStoreStorageOptions, type EventStream, type InlineProjectionHandlerOptions, MongoDBDefaultInlineProjectionName, type MongoDBEventStore, type MongoDBEventStoreClientOptions, type MongoDBEventStoreCollectionPerStreamTypeStorageOptions, type MongoDBEventStoreCollectionResolution, type MongoDBEventStoreConnectionOptions, type MongoDBEventStoreConnectionStringOptions, type MongoDBEventStoreCustomStorageOptions, MongoDBEventStoreDefaultStreamVersion, type MongoDBEventStoreOptions, type MongoDBEventStoreSingleCollectionStorageOptions, type MongoDBEventStoreStorage, type MongoDBEventStoreStorageOptions, type MongoDBInlineProjectionAssert, type MongoDBInlineProjectionAssertOptions, type MongoDBInlineProjectionDefinition, type MongoDBInlineProjectionHandler, type MongoDBInlineProjectionOptions, MongoDBInlineProjectionSpec, type MongoDBInlineProjectionSpecGivenEvents, type MongoDBInlineProjectionSpecOptions, type MongoDBProjectionInlineHandlerContext, type MongoDBReadEvent, type MongoDBReadEventMetadata, type MongoDBReadModel, type MongoDBReadModelMetadata, type MongoDBWithNotNullDocumentEvolve, type MongoDBWithNullableDocumentEvolve, type StreamCollectionName, type StreamCollectionNameParts, type StreamName, type StreamNameParts, type StreamType, eventInStream, eventsInStream, expectInlineReadModel, fromStreamCollectionName, fromStreamName, getMongoDBEventStore, handleInlineProjections, mongoDBEventStoreStorage, mongoDBInlineProjection, prependMongoFilterWithProjectionPrefix, toStreamCollectionName, toStreamName };
263
+ //#endregion
264
+ export { DefaultMongoDBEventStoreCollectionName, DefaultMongoDBEventStoreStorageOptions, EventStream, InlineProjectionHandlerOptions, MongoDBDefaultInlineProjectionName, MongoDBEventStore, MongoDBEventStoreClientOptions, MongoDBEventStoreCollectionPerStreamTypeStorageOptions, MongoDBEventStoreCollectionResolution, MongoDBEventStoreConnectionOptions, MongoDBEventStoreConnectionStringOptions, MongoDBEventStoreCustomStorageOptions, MongoDBEventStoreDefaultStreamVersion, MongoDBEventStoreOptions, MongoDBEventStoreSingleCollectionStorageOptions, MongoDBEventStoreStorage, MongoDBEventStoreStorageOptions, MongoDBInlineProjectionAssert, MongoDBInlineProjectionAssertOptions, MongoDBInlineProjectionDefinition, MongoDBInlineProjectionHandler, MongoDBInlineProjectionOptions, MongoDBInlineProjectionSpec, MongoDBInlineProjectionSpecGivenEvents, MongoDBInlineProjectionSpecOptions, MongoDBProjectionInlineHandlerContext, MongoDBReadEvent, MongoDBReadEventMetadata, MongoDBReadModel, MongoDBReadModelMetadata, MongoDBWithNotNullDocumentEvolve, MongoDBWithNullableDocumentEvolve, StreamCollectionName, StreamCollectionNameParts, StreamName, StreamNameParts, StreamType, eventInStream, eventsInStream, expectInlineReadModel, fromStreamCollectionName, fromStreamName, getMongoDBEventStore, handleInlineProjections, mongoDBEventStoreStorage, mongoDBInlineProjection, prependMongoFilterWithProjectionPrefix, toStreamCollectionName, toStreamName };
265
+ //# sourceMappingURL=index.d.cts.map