@event-driven-io/emmett-sqlite 0.43.0-apha.2 → 0.43.0-beta.10
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/cloudflare.cjs +21 -0
- package/dist/cloudflare.cjs.map +1 -0
- package/dist/cloudflare.d.cts +16 -0
- package/dist/cloudflare.d.ts +16 -0
- package/dist/cloudflare.js +21 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/index.cjs +1747 -686
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -177
- package/dist/index.d.ts +105 -177
- package/dist/index.js +1772 -711
- package/dist/index.js.map +1 -1
- package/dist/sqlite3.cjs +18 -0
- package/dist/sqlite3.cjs.map +1 -0
- package/dist/sqlite3.d.cts +15 -0
- package/dist/sqlite3.d.ts +15 -0
- package/dist/sqlite3.js +18 -0
- package/dist/sqlite3.js.map +1 -0
- package/dist/sqliteProjection-BrbKryzB.d.cts +150 -0
- package/dist/sqliteProjection-BrbKryzB.d.ts +150 -0
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,84 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _event_driven_io_emmett from '@event-driven-io/emmett';
|
|
2
|
+
import { Event, AppendToStreamOptions, BeforeEventStoreCommitHandler, JSONSerializer, Message, RecordedMessageMetadata, RecordedMessage, RecordedMessageMetadataWithGlobalPosition, ProcessorCheckpoint, ReadStreamOptions, ReadStreamResult, ReadEventMetadataWithGlobalPosition, ReadEvent, CanHandle, EventStoreReadSchemaOptions, JSONSerializationOptions, TruncateProjection, ThenThrows } from '@event-driven-io/emmett';
|
|
3
|
+
import { PongoDocument, PongoDBCollectionOptions, PongoClient, WithId, PongoFilter } from '@event-driven-io/pongo';
|
|
4
|
+
import { a as SQLiteEventStore, b as SQLiteReadEventMetadata, c as SQLiteProjectionHandlerContext, d as SQLiteProjectionDefinition, A as AnyEventStoreDriver, I as InferOptionsFromEventStoreDriver } from './sqliteProjection-BrbKryzB.cjs';
|
|
5
|
+
export { C as CreateEventStoreSchemaOptions, e as EventHandler, f as EventStoreSchemaMigrationOptions, g as SQLiteEventStoreDefaultStreamVersion, S as SQLiteEventStoreOptions, h as SQLiteProjectionHandler, i as SQLiteProjectionHandlerOptions, j as SQLiteRawBatchSQLProjection, k as SQLiteRawSQLProjection, l as SQLiteReadEvent, m as SQLiteStreamExistsOptions, n as createEventStoreSchema, o as getSQLiteEventStore, p as handleProjections, q as messagesTableSQL, r as processorsTableSQL, s as projectionsTableSQL, t as schemaSQL, u as sqliteProjection, v as sqliteRawBatchSQLProjection, w as sqliteRawSQLProjection, x as streamExists, y as streamsTableSQL } from './sqliteProjection-BrbKryzB.cjs';
|
|
6
|
+
import { SQL, SQLExecutor, Dumbo, QueryResultRow } from '@event-driven-io/dumbo';
|
|
2
7
|
import { AnySQLiteConnection } from '@event-driven-io/dumbo/sqlite';
|
|
3
|
-
import { Event, ReadEvent, ReadEventMetadataWithGlobalPosition, EmmettError, AppendToStreamOptions, BeforeEventStoreCommitHandler, ReadEventMetadata, ReadStreamOptions, BigIntStreamPosition, ReadStreamResult, StreamExistsResult, EventStore, AppendToStreamResultWithGlobalPosition, ProjectionRegistration, ProjectionHandler, ProjectionDefinition, CanHandle, ProjectionInitOptions, ThenThrows } from '@event-driven-io/emmett';
|
|
4
|
-
|
|
5
|
-
type SQLiteEventStoreMessageBatchPullerStartFrom = {
|
|
6
|
-
globalPosition: bigint;
|
|
7
|
-
} | 'BEGINNING' | 'END';
|
|
8
|
-
|
|
9
|
-
type SQLiteProcessorEventsBatch<EventType extends Event = Event> = {
|
|
10
|
-
messages: ReadEvent<EventType, ReadEventMetadataWithGlobalPosition>[];
|
|
11
|
-
};
|
|
12
|
-
type SQLiteProcessorHandlerContext = {
|
|
13
|
-
connection: AnySQLiteConnection;
|
|
14
|
-
};
|
|
15
|
-
type SQLiteProcessor<EventType extends Event = Event> = {
|
|
16
|
-
id: string;
|
|
17
|
-
start: (connection: AnySQLiteConnection) => Promise<SQLiteEventStoreMessageBatchPullerStartFrom | undefined>;
|
|
18
|
-
isActive: boolean;
|
|
19
|
-
handle: (messagesBatch: SQLiteProcessorEventsBatch<EventType>, context: {
|
|
20
|
-
connection?: AnySQLiteConnection;
|
|
21
|
-
}) => Promise<SQLiteProcessorMessageHandlerResult>;
|
|
22
|
-
};
|
|
23
|
-
declare const SQLiteProcessor: {
|
|
24
|
-
result: {
|
|
25
|
-
skip: (options?: {
|
|
26
|
-
reason?: string;
|
|
27
|
-
}) => SQLiteProcessorMessageHandlerResult;
|
|
28
|
-
stop: (options?: {
|
|
29
|
-
reason?: string;
|
|
30
|
-
error?: EmmettError;
|
|
31
|
-
}) => SQLiteProcessorMessageHandlerResult;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
type SQLiteProcessorMessageHandlerResult = void | {
|
|
35
|
-
type: 'SKIP';
|
|
36
|
-
reason?: string;
|
|
37
|
-
} | {
|
|
38
|
-
type: 'STOP';
|
|
39
|
-
reason?: string;
|
|
40
|
-
error?: EmmettError;
|
|
41
|
-
};
|
|
42
|
-
type SQLiteProcessorEachMessageHandler<EventType extends Event = Event> = (event: ReadEvent<EventType, ReadEventMetadataWithGlobalPosition>, context: SQLiteProcessorHandlerContext) => Promise<SQLiteProcessorMessageHandlerResult> | SQLiteProcessorMessageHandlerResult;
|
|
43
|
-
type SQLiteProcessorStartFrom = SQLiteEventStoreMessageBatchPullerStartFrom | 'CURRENT';
|
|
44
|
-
type SQLiteProcessorConnectionOptions = {
|
|
45
|
-
fileName: string;
|
|
46
|
-
connection?: AnySQLiteConnection;
|
|
47
|
-
};
|
|
48
|
-
type GenericSQLiteProcessorOptions<EventType extends Event = Event> = {
|
|
49
|
-
processorId: string;
|
|
50
|
-
version?: number;
|
|
51
|
-
partition?: string;
|
|
52
|
-
startFrom?: SQLiteProcessorStartFrom;
|
|
53
|
-
stopAfter?: (message: ReadEvent<EventType, ReadEventMetadataWithGlobalPosition>) => boolean;
|
|
54
|
-
eachMessage: SQLiteProcessorEachMessageHandler<EventType>;
|
|
55
|
-
connectionOptions?: SQLiteProcessorConnectionOptions;
|
|
56
|
-
};
|
|
57
|
-
type SQLiteProjectionProcessorOptions<EventType extends Event = Event> = {
|
|
58
|
-
processorId?: string;
|
|
59
|
-
version?: number;
|
|
60
|
-
projection: SQLiteProjectionDefinition<EventType>;
|
|
61
|
-
partition?: string;
|
|
62
|
-
startFrom?: SQLiteProcessorStartFrom;
|
|
63
|
-
stopAfter?: (message: ReadEvent<EventType, ReadEventMetadataWithGlobalPosition>) => boolean;
|
|
64
|
-
};
|
|
65
|
-
type SQLiteProcessorOptions<EventType extends Event = Event> = GenericSQLiteProcessorOptions<EventType> | SQLiteProjectionProcessorOptions<EventType>;
|
|
66
|
-
|
|
67
|
-
type SQLiteEventStoreConsumerConfig<ConsumerEventType extends Event = Event> = {
|
|
68
|
-
processors?: SQLiteProcessor<ConsumerEventType>[];
|
|
69
|
-
pulling?: {
|
|
70
|
-
batchSize?: number;
|
|
71
|
-
pullingFrequencyInMs?: number;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
type SQLiteEventStoreConsumer<ConsumerEventType extends Event = Event> = Readonly<{
|
|
75
|
-
isRunning: boolean;
|
|
76
|
-
processors: SQLiteProcessor<ConsumerEventType>[];
|
|
77
|
-
processor: <EventType extends ConsumerEventType = ConsumerEventType>(options: SQLiteProcessorOptions<EventType>) => SQLiteProcessor<EventType>;
|
|
78
|
-
start: () => Promise<void>;
|
|
79
|
-
stop: () => Promise<void>;
|
|
80
|
-
close: () => Promise<void>;
|
|
81
|
-
}>;
|
|
82
8
|
|
|
83
9
|
type AppendEventResult = {
|
|
84
10
|
success: true;
|
|
@@ -108,7 +34,7 @@ declare const readLastMessageGlobalPosition: (execute: SQLExecutor, options?: {
|
|
|
108
34
|
partition?: string;
|
|
109
35
|
}) => Promise<ReadLastMessageGlobalPositionResult>;
|
|
110
36
|
|
|
111
|
-
type ReadMessagesBatchOptions = {
|
|
37
|
+
type ReadMessagesBatchOptions = ({
|
|
112
38
|
after: bigint;
|
|
113
39
|
batchSize: number;
|
|
114
40
|
} | {
|
|
@@ -120,31 +46,33 @@ type ReadMessagesBatchOptions = {
|
|
|
120
46
|
} | {
|
|
121
47
|
from: bigint;
|
|
122
48
|
to: bigint;
|
|
49
|
+
}) & {
|
|
50
|
+
partition?: string;
|
|
51
|
+
serializer: JSONSerializer;
|
|
123
52
|
};
|
|
124
|
-
type ReadMessagesBatchResult<
|
|
53
|
+
type ReadMessagesBatchResult<MessageType extends Message, MessageMetadataType extends RecordedMessageMetadata = RecordedMessageMetadata> = {
|
|
125
54
|
currentGlobalPosition: bigint;
|
|
126
|
-
messages:
|
|
127
|
-
|
|
55
|
+
messages: RecordedMessage<MessageType, MessageMetadataType>[];
|
|
56
|
+
areMessagesLeft: boolean;
|
|
128
57
|
};
|
|
129
|
-
declare const readMessagesBatch: <MessageType extends
|
|
130
|
-
partition?: string;
|
|
131
|
-
}) => Promise<ReadMessagesBatchResult<MessageType, ReadEventMetadataType>>;
|
|
58
|
+
declare const readMessagesBatch: <MessageType extends Message, RecordedMessageMetadataType extends RecordedMessageMetadataWithGlobalPosition = RecordedMessageMetadataWithGlobalPosition>(execute: SQLExecutor, options: ReadMessagesBatchOptions) => Promise<ReadMessagesBatchResult<MessageType, RecordedMessageMetadataType>>;
|
|
132
59
|
|
|
133
60
|
type ReadProcessorCheckpointResult = {
|
|
134
|
-
|
|
61
|
+
lastProcessedCheckpoint: ProcessorCheckpoint | null;
|
|
135
62
|
};
|
|
136
63
|
declare const readProcessorCheckpoint: (execute: SQLExecutor, options: {
|
|
137
64
|
processorId: string;
|
|
138
65
|
partition?: string;
|
|
139
66
|
}) => Promise<ReadProcessorCheckpointResult>;
|
|
140
67
|
|
|
141
|
-
declare const readStream: <EventType extends Event, EventPayloadType extends Event = EventType>(execute: SQLExecutor, streamId: string, options
|
|
68
|
+
declare const readStream: <EventType extends Event, EventPayloadType extends Event = EventType>(execute: SQLExecutor, streamId: string, options: ReadStreamOptions<EventType, EventPayloadType> & {
|
|
142
69
|
partition?: string;
|
|
70
|
+
serializer: JSONSerializer;
|
|
143
71
|
}) => Promise<ReadStreamResult<EventType, ReadEventMetadataWithGlobalPosition>>;
|
|
144
72
|
|
|
145
|
-
type
|
|
73
|
+
type StoreProcessorCheckpointResult = {
|
|
146
74
|
success: true;
|
|
147
|
-
|
|
75
|
+
newCheckpoint: ProcessorCheckpoint | null;
|
|
148
76
|
} | {
|
|
149
77
|
success: false;
|
|
150
78
|
reason: 'IGNORED' | 'MISMATCH';
|
|
@@ -152,22 +80,11 @@ type StoreLastProcessedProcessorPositionResult<Position extends bigint | null =
|
|
|
152
80
|
declare function storeProcessorCheckpoint(execute: SQLExecutor, options: {
|
|
153
81
|
processorId: string;
|
|
154
82
|
version: number | undefined;
|
|
155
|
-
|
|
156
|
-
|
|
83
|
+
newCheckpoint: ProcessorCheckpoint | null;
|
|
84
|
+
lastProcessedCheckpoint: ProcessorCheckpoint | null;
|
|
157
85
|
partition?: string;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
type SQLiteStreamExistsOptions = {
|
|
161
|
-
partition: string;
|
|
162
|
-
};
|
|
163
|
-
declare const streamExists: (execute: SQLExecutor, streamId: string, options?: SQLiteStreamExistsOptions) => Promise<StreamExistsResult>;
|
|
164
|
-
|
|
165
|
-
declare const streamsTableSQL: SQL;
|
|
166
|
-
declare const messagesTableSQL: SQL;
|
|
167
|
-
declare const processorsTableSQL: SQL;
|
|
168
|
-
declare const projectionsTableSQL: SQL;
|
|
169
|
-
declare const schemaSQL: SQL[];
|
|
170
|
-
declare const createEventStoreSchema: (pool: AnySQLiteConnection, hooks?: SQLiteEventStoreOptions["hooks"]) => Promise<void>;
|
|
86
|
+
processorInstanceId?: string;
|
|
87
|
+
}): Promise<StoreProcessorCheckpointResult>;
|
|
171
88
|
|
|
172
89
|
declare const emmettPrefix = "emt";
|
|
173
90
|
declare const globalTag = "global";
|
|
@@ -205,77 +122,88 @@ declare const projectionsTable: {
|
|
|
205
122
|
name: string;
|
|
206
123
|
};
|
|
207
124
|
|
|
208
|
-
type
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
125
|
+
type PongoProjectionHandlerContext = SQLiteProjectionHandlerContext & {
|
|
126
|
+
pongo: PongoClient;
|
|
127
|
+
};
|
|
128
|
+
type PongoWithNotNullDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata> = ((document: Document, event: ReadEvent<EventType, EventMetaDataType>) => Document | null) | ((document: Document, event: ReadEvent<EventType>) => Promise<Document | null>);
|
|
129
|
+
type PongoWithNullableDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata> = ((document: Document | null, event: ReadEvent<EventType, EventMetaDataType>) => Document | null) | ((document: Document | null, event: ReadEvent<EventType>) => Promise<Document | null>);
|
|
130
|
+
type PongoDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata> = PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType> | PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
131
|
+
type PongoProjectionOptions<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
132
|
+
name: string;
|
|
133
|
+
kind?: string;
|
|
134
|
+
version?: number;
|
|
135
|
+
handle: (events: ReadEvent<EventType, SQLiteReadEventMetadata>[], context: PongoProjectionHandlerContext) => Promise<void>;
|
|
136
|
+
canHandle: CanHandle<EventType>;
|
|
137
|
+
truncate?: TruncateProjection<PongoProjectionHandlerContext>;
|
|
138
|
+
init?: (context: PongoProjectionHandlerContext) => void | Promise<void>;
|
|
139
|
+
eventsOptions?: {
|
|
140
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
219
141
|
};
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
type
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
142
|
+
} & JSONSerializationOptions;
|
|
143
|
+
declare const pongoProjection: <EventType extends Event, EventPayloadType extends Event = EventType>({ name, kind, version, truncate, handle, canHandle, eventsOptions, }: PongoProjectionOptions<EventType, EventPayloadType>) => SQLiteProjectionDefinition<EventType, EventPayloadType>;
|
|
144
|
+
type PongoMultiStreamProjectionOptions<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata, EventPayloadType extends Event = EventType, DocumentPayload extends PongoDocument = Document> = {
|
|
145
|
+
kind?: string;
|
|
146
|
+
canHandle: CanHandle<EventType>;
|
|
147
|
+
version?: number;
|
|
148
|
+
collectionName: string;
|
|
149
|
+
collectionOptions?: PongoDBCollectionOptions<Document, DocumentPayload>;
|
|
150
|
+
eventsOptions?: {
|
|
151
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
228
152
|
};
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
*/
|
|
246
|
-
onAfterSchemaCreated?: () => Promise<void> | void;
|
|
153
|
+
getDocumentId: (event: ReadEvent<EventType>) => string;
|
|
154
|
+
} & ({
|
|
155
|
+
evolve: PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
156
|
+
} | {
|
|
157
|
+
evolve: PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
158
|
+
initialState: () => Document;
|
|
159
|
+
}) & JSONSerializationOptions;
|
|
160
|
+
declare const pongoMultiStreamProjection: <Document extends PongoDocument, EventType extends Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata, EventPayloadType extends Event = EventType>(options: PongoMultiStreamProjectionOptions<Document, EventType, EventMetaDataType, EventPayloadType>) => SQLiteProjectionDefinition<EventType, EventPayloadType>;
|
|
161
|
+
type PongoSingleStreamProjectionOptions<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata, EventPayloadType extends Event = EventType, DocumentPayload extends PongoDocument = Document> = {
|
|
162
|
+
canHandle: CanHandle<EventType>;
|
|
163
|
+
getDocumentId?: (event: ReadEvent<EventType>) => string;
|
|
164
|
+
version?: number;
|
|
165
|
+
collectionName: string;
|
|
166
|
+
collectionOptions?: PongoDBCollectionOptions<Document, DocumentPayload>;
|
|
167
|
+
eventsOptions?: {
|
|
168
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
247
169
|
};
|
|
248
|
-
} & {
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
170
|
+
} & ({
|
|
171
|
+
evolve: PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
172
|
+
} | {
|
|
173
|
+
evolve: PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
174
|
+
initialState: () => Document;
|
|
175
|
+
}) & JSONSerializationOptions;
|
|
176
|
+
declare const pongoSingleStreamProjection: <Document extends PongoDocument, EventType extends Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata, EventPayloadType extends Event = EventType>(options: PongoSingleStreamProjectionOptions<Document, EventType, EventMetaDataType, EventPayloadType>) => SQLiteProjectionDefinition<EventType, EventPayloadType>;
|
|
252
177
|
|
|
253
|
-
type
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
type SQLiteProjectionHandler<EventType extends Event = Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata> = ProjectionHandler<EventType, EventMetaDataType, SQLiteProjectionHandlerContext>;
|
|
257
|
-
type SQLiteProjectionDefinition<EventType extends Event = Event> = ProjectionDefinition<EventType, SQLiteReadEventMetadata, SQLiteProjectionHandlerContext>;
|
|
258
|
-
type SQLiteProjectionHandlerOptions<EventType extends Event = Event> = {
|
|
259
|
-
events: ReadEvent<EventType, SQLiteReadEventMetadata>[];
|
|
260
|
-
projections: SQLiteProjectionDefinition<EventType>[];
|
|
261
|
-
connection: AnySQLiteConnection;
|
|
262
|
-
};
|
|
263
|
-
declare const handleProjections: <EventType extends Event = Event>(options: SQLiteProjectionHandlerOptions<EventType>) => Promise<void>;
|
|
264
|
-
declare const sqliteProjection: <EventType extends Event>(definition: SQLiteProjectionDefinition<EventType>) => SQLiteProjectionDefinition<EventType>;
|
|
265
|
-
type SQLiteRawBatchSQLProjection<EventType extends Event> = {
|
|
266
|
-
evolve: (events: EventType[], context: SQLiteProjectionHandlerContext) => Promise<SQL[]> | SQL[];
|
|
267
|
-
canHandle: CanHandle<EventType>;
|
|
268
|
-
initSQL?: SQL | SQL[];
|
|
269
|
-
init?: (context: ProjectionInitOptions<SQLiteProjectionHandlerContext>) => void | Promise<void>;
|
|
178
|
+
type PongoAssertOptions = {
|
|
179
|
+
inCollection: string;
|
|
180
|
+
inDatabase?: string;
|
|
270
181
|
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
182
|
+
type FilterOrId<Doc extends PongoDocument | WithId<PongoDocument>> = {
|
|
183
|
+
withId: string;
|
|
184
|
+
} | {
|
|
185
|
+
matchingFilter: PongoFilter<Doc>;
|
|
186
|
+
};
|
|
187
|
+
declare const documentExists: <Doc extends PongoDocument | WithId<PongoDocument>>(document: Doc, options: PongoAssertOptions & FilterOrId<Doc>) => SQLiteProjectionAssert;
|
|
188
|
+
declare const documentsAreTheSame: <Doc extends PongoDocument | WithId<PongoDocument>>(documents: Doc[], options: PongoAssertOptions & FilterOrId<Doc>) => SQLiteProjectionAssert;
|
|
189
|
+
declare const documentsMatchingHaveCount: <Doc extends PongoDocument | WithId<PongoDocument>>(expectedCount: number, options: PongoAssertOptions & FilterOrId<Doc>) => SQLiteProjectionAssert;
|
|
190
|
+
declare const documentMatchingExists: <Doc extends PongoDocument | WithId<PongoDocument>>(options: PongoAssertOptions & FilterOrId<Doc>) => SQLiteProjectionAssert;
|
|
191
|
+
declare const documentDoesNotExist: <Doc extends PongoDocument | WithId<PongoDocument>>(options: PongoAssertOptions & FilterOrId<Doc>) => SQLiteProjectionAssert;
|
|
192
|
+
declare const expectPongoDocuments: {
|
|
193
|
+
fromCollection: <Doc extends PongoDocument | WithId<PongoDocument>>(collectionName: string) => {
|
|
194
|
+
withId: (id: string) => {
|
|
195
|
+
toBeEqual: (document: Doc) => SQLiteProjectionAssert;
|
|
196
|
+
toExist: () => SQLiteProjectionAssert;
|
|
197
|
+
notToExist: () => SQLiteProjectionAssert;
|
|
198
|
+
};
|
|
199
|
+
matching: <Doc_1 extends PongoDocument | WithId<PongoDocument>>(filter: PongoFilter<Doc_1>) => {
|
|
200
|
+
toBeTheSame: (documents: Doc_1[]) => SQLiteProjectionAssert;
|
|
201
|
+
toHaveCount: (expectedCount: number) => SQLiteProjectionAssert;
|
|
202
|
+
toExist: () => SQLiteProjectionAssert;
|
|
203
|
+
notToExist: () => SQLiteProjectionAssert;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
277
206
|
};
|
|
278
|
-
declare const sqliteRawSQLProjection: <EventType extends Event>(options: SQLiteRawSQLProjection<EventType>) => SQLiteProjectionDefinition<EventType>;
|
|
279
207
|
|
|
280
208
|
type SQLiteProjectionSpecEvent<EventType extends Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata> = EventType & {
|
|
281
209
|
metadata?: Partial<EventMetaDataType>;
|
|
@@ -286,11 +214,11 @@ type SQLiteProjectionSpecWhenOptions = {
|
|
|
286
214
|
type SQLiteProjectionAssert = (options: {
|
|
287
215
|
connection: AnySQLiteConnection;
|
|
288
216
|
}) => Promise<void | boolean>;
|
|
289
|
-
type SQLiteProjectionSpecOptions<EventType extends Event,
|
|
217
|
+
type SQLiteProjectionSpecOptions<EventType extends Event, Driver extends AnyEventStoreDriver = AnyEventStoreDriver> = {
|
|
290
218
|
projection: SQLiteProjectionDefinition<EventType>;
|
|
291
|
-
driver:
|
|
219
|
+
driver: Driver;
|
|
292
220
|
pool?: Dumbo;
|
|
293
|
-
} &
|
|
221
|
+
} & InferOptionsFromEventStoreDriver<Driver> & JSONSerializationOptions;
|
|
294
222
|
type SQLiteProjectionSpec<EventType extends Event> = (givenEvents: SQLiteProjectionSpecEvent<EventType>[]) => {
|
|
295
223
|
when: (events: SQLiteProjectionSpecEvent<EventType>[], options?: SQLiteProjectionSpecWhenOptions) => {
|
|
296
224
|
then: (assert: SQLiteProjectionAssert, message?: string) => Promise<void>;
|
|
@@ -298,11 +226,11 @@ type SQLiteProjectionSpec<EventType extends Event> = (givenEvents: SQLiteProject
|
|
|
298
226
|
};
|
|
299
227
|
};
|
|
300
228
|
declare const SQLiteProjectionSpec: {
|
|
301
|
-
for: <EventType extends Event,
|
|
229
|
+
for: <EventType extends Event, Driver extends AnyEventStoreDriver = AnyEventStoreDriver>(options: SQLiteProjectionSpecOptions<EventType, Driver>) => SQLiteProjectionSpec<EventType>;
|
|
302
230
|
};
|
|
303
231
|
declare const eventInStream: <EventType extends Event = Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata>(streamName: string, event: SQLiteProjectionSpecEvent<EventType, EventMetaDataType>) => SQLiteProjectionSpecEvent<EventType, EventMetaDataType>;
|
|
304
232
|
declare const eventsInStream: <EventType extends Event = Event, EventMetaDataType extends SQLiteReadEventMetadata = SQLiteReadEventMetadata>(streamName: string, events: SQLiteProjectionSpecEvent<EventType, EventMetaDataType>[]) => SQLiteProjectionSpecEvent<EventType, EventMetaDataType>[];
|
|
305
|
-
declare const newEventsInStream: <EventType extends Event = Event, EventMetaDataType extends SQLiteReadEventMetadata =
|
|
233
|
+
declare const newEventsInStream: <EventType extends Event = Event, EventMetaDataType extends SQLiteReadEventMetadata = _event_driven_io_emmett.RecordedMessageMetadataWithGlobalPosition>(streamName: string, events: SQLiteProjectionSpecEvent<EventType, EventMetaDataType>[]) => SQLiteProjectionSpecEvent<EventType, EventMetaDataType>[];
|
|
306
234
|
declare const assertSQLQueryResultMatches: <T extends QueryResultRow>(sql: SQL, rows: T[]) => SQLiteProjectionAssert;
|
|
307
235
|
declare const expectSQL: {
|
|
308
236
|
query: (sql: SQL) => {
|
|
@@ -312,4 +240,4 @@ declare const expectSQL: {
|
|
|
312
240
|
};
|
|
313
241
|
};
|
|
314
242
|
|
|
315
|
-
export { type AppendEventResult, type
|
|
243
|
+
export { type AppendEventResult, type PongoAssertOptions, type PongoDocumentEvolve, type PongoMultiStreamProjectionOptions, type PongoProjectionHandlerContext, type PongoProjectionOptions, type PongoSingleStreamProjectionOptions, type PongoWithNotNullDocumentEvolve, type PongoWithNullableDocumentEvolve, type ReadLastMessageGlobalPositionResult, type ReadMessagesBatchOptions, type ReadMessagesBatchResult, type ReadProcessorCheckpointResult, SQLiteEventStore, type SQLiteProjectionAssert, SQLiteProjectionDefinition, SQLiteProjectionHandlerContext, SQLiteProjectionSpec, type SQLiteProjectionSpecEvent, type SQLiteProjectionSpecOptions, type SQLiteProjectionSpecWhenOptions, SQLiteReadEventMetadata, type StoreProcessorCheckpointResult, appendToStream, assertSQLQueryResultMatches, defaultTag, documentDoesNotExist, documentExists, documentMatchingExists, documentsAreTheSame, documentsMatchingHaveCount, emmettPrefix, eventInStream, eventsInStream, expectPongoDocuments, expectSQL, globalNames, globalTag, messagesTable, migration_0_42_0_FromSubscriptionsToProcessors, migration_0_42_0_SQLs, newEventsInStream, pongoMultiStreamProjection, pongoProjection, pongoSingleStreamProjection, processorsTable, projectionsTable, readLastMessageGlobalPosition, readMessagesBatch, readProcessorCheckpoint, readStream, schema_0_41_0, schema_0_42_0, storeProcessorCheckpoint, streamsTable, unknownTag };
|