@event-driven-io/emmett-postgresql 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/index.cjs +1723 -1305
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +199 -198
- package/dist/index.d.ts +199 -198
- package/dist/index.js +2086 -1668
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { SQLExecutor,
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { SQLExecutor, Dumbo, QueryResultRow, SQL, RunSQLMigrationsResult, SQLMigration, DatabaseTransaction, AnyConnection, MigrationStyle } from '@event-driven-io/dumbo';
|
|
2
|
+
import * as _event_driven_io_emmett from '@event-driven-io/emmett';
|
|
3
|
+
import { ProcessorCheckpoint, Message, BatchRecordedMessageHandlerWithoutContext, ReadEventMetadataWithGlobalPosition, EmmettError, ProjectionHandlingType, ProjectionRegistration, ProjectionDefinition, AnyReadEventMetadata, DefaultRecord, Event, ReadEvent, CanHandle, EventStoreReadSchemaOptions, JSONSerializationOptions, TruncateProjection, ThenThrows, RecordedMessage, AppendToStreamOptions, RecordedMessageMetadata, RecordedMessageMetadataWithGlobalPosition, ReadStreamOptions, ReadStreamResult, StreamExistsResult, ProjectionHandler, ProjectionInitOptions, EventStore, EventStoreSessionFactory, AppendToStreamResultWithGlobalPosition, AnyMessage, Checkpointer, ReactorOptions, MessageProcessor, AnyEvent, AnyCommand, AnyRecordedMessageMetadata, WorkflowProcessorContext, WorkflowProcessorOptions, ProjectorOptions, BatchRecordedMessageHandlerWithContext, SingleRecordedMessageHandlerWithContext, MessageConsumerOptions, MessageConsumer } from '@event-driven-io/emmett';
|
|
4
|
+
import { PgPoolOptions, PgTransaction, PgPool, PgClient, PgDriverType, PgPoolClientConnection, PgClientConnection } from '@event-driven-io/dumbo/pg';
|
|
4
5
|
import pg from 'pg';
|
|
5
|
-
import {
|
|
6
|
+
import { PongoDocument, PongoDBCollectionOptions, PongoClient, WithId, PongoFilter } from '@event-driven-io/pongo';
|
|
6
7
|
|
|
7
8
|
declare const DefaultPostgreSQLEventStoreProcessorBatchSize = 100;
|
|
8
9
|
declare const DefaultPostgreSQLEventStoreProcessorPullingFrequencyInMs = 50;
|
|
@@ -22,7 +23,7 @@ type PostgreSQLEventStoreMessageBatchPullerOptions<MessageType extends Message =
|
|
|
22
23
|
signal: AbortSignal;
|
|
23
24
|
};
|
|
24
25
|
type PostgreSQLEventStoreMessageBatchPullerStartFrom = {
|
|
25
|
-
lastCheckpoint:
|
|
26
|
+
lastCheckpoint: ProcessorCheckpoint;
|
|
26
27
|
} | 'BEGINNING' | 'END';
|
|
27
28
|
type PostgreSQLEventStoreMessageBatchPullerStartOptions = {
|
|
28
29
|
startFrom: PostgreSQLEventStoreMessageBatchPullerStartFrom;
|
|
@@ -74,7 +75,7 @@ type PostgreSQLProcessorLockOptions = {
|
|
|
74
75
|
};
|
|
75
76
|
lockKey?: string | bigint;
|
|
76
77
|
lockTimeoutSeconds?: number;
|
|
77
|
-
|
|
78
|
+
lockAcquisitionPolicy?: LockAcquisitionPolicy;
|
|
78
79
|
};
|
|
79
80
|
type PostgreSQLProcessorLockContext = {
|
|
80
81
|
execute: SQLExecutor;
|
|
@@ -147,6 +148,123 @@ declare const readProjectionInfo: (execute: SQLExecutor, { name, partition, vers
|
|
|
147
148
|
version: number;
|
|
148
149
|
}) => Promise<ReadProjectionInfoResult | null>;
|
|
149
150
|
|
|
151
|
+
type PongoProjectionHandlerContext = PostgreSQLProjectionHandlerContext & {
|
|
152
|
+
pongo: PongoClient;
|
|
153
|
+
};
|
|
154
|
+
type PongoWithNotNullDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = ((document: Document, event: ReadEvent<EventType, EventMetaDataType>) => Document | null) | ((document: Document, event: ReadEvent<EventType>) => Promise<Document | null>);
|
|
155
|
+
type PongoWithNullableDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = ((document: Document | null, event: ReadEvent<EventType, EventMetaDataType>) => Document | null) | ((document: Document | null, event: ReadEvent<EventType>) => Promise<Document | null>);
|
|
156
|
+
type PongoDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType> | PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
157
|
+
type PongoProjectionOptions<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
158
|
+
name: string;
|
|
159
|
+
kind?: string;
|
|
160
|
+
version?: number;
|
|
161
|
+
handle: (events: ReadEvent<EventType, PostgresReadEventMetadata>[], context: PongoProjectionHandlerContext) => Promise<void>;
|
|
162
|
+
canHandle: CanHandle<EventType>;
|
|
163
|
+
truncate?: TruncateProjection<PongoProjectionHandlerContext>;
|
|
164
|
+
init?: (context: PongoProjectionHandlerContext) => void | Promise<void>;
|
|
165
|
+
eventsOptions?: {
|
|
166
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
167
|
+
};
|
|
168
|
+
} & JSONSerializationOptions;
|
|
169
|
+
declare const pongoProjection: <EventType extends Event, EventPayloadType extends Event = EventType>({ name, kind, version, truncate, handle, canHandle, eventsOptions, }: PongoProjectionOptions<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
170
|
+
type PongoMultiStreamProjectionOptions<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType, DocumentPayload extends PongoDocument = Document> = {
|
|
171
|
+
kind?: string;
|
|
172
|
+
canHandle: CanHandle<EventType>;
|
|
173
|
+
version?: number;
|
|
174
|
+
collectionName: string;
|
|
175
|
+
collectionOptions?: PongoDBCollectionOptions<Document, DocumentPayload>;
|
|
176
|
+
eventsOptions?: {
|
|
177
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
178
|
+
};
|
|
179
|
+
getDocumentId: (event: ReadEvent<EventType>) => string;
|
|
180
|
+
} & ({
|
|
181
|
+
evolve: PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
182
|
+
} | {
|
|
183
|
+
evolve: PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
184
|
+
initialState: () => Document;
|
|
185
|
+
}) & JSONSerializationOptions;
|
|
186
|
+
declare const pongoMultiStreamProjection: <Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType>(options: PongoMultiStreamProjectionOptions<Document, EventType, EventMetaDataType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
187
|
+
type PongoSingleStreamProjectionOptions<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType, DocumentPayload extends PongoDocument = Document> = {
|
|
188
|
+
canHandle: CanHandle<EventType>;
|
|
189
|
+
getDocumentId?: (event: ReadEvent<EventType>) => string;
|
|
190
|
+
version?: number;
|
|
191
|
+
collectionName: string;
|
|
192
|
+
collectionOptions?: PongoDBCollectionOptions<Document, DocumentPayload>;
|
|
193
|
+
eventsOptions?: {
|
|
194
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
195
|
+
};
|
|
196
|
+
} & ({
|
|
197
|
+
evolve: PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
198
|
+
} | {
|
|
199
|
+
evolve: PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
200
|
+
initialState: () => Document;
|
|
201
|
+
}) & JSONSerializationOptions;
|
|
202
|
+
declare const pongoSingleStreamProjection: <Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType>(options: PongoSingleStreamProjectionOptions<Document, EventType, EventMetaDataType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
203
|
+
|
|
204
|
+
type PongoAssertOptions = {
|
|
205
|
+
inCollection: string;
|
|
206
|
+
inDatabase?: string;
|
|
207
|
+
};
|
|
208
|
+
type FilterOrId<Doc extends PongoDocument | WithId<PongoDocument>> = {
|
|
209
|
+
withId: string;
|
|
210
|
+
} | {
|
|
211
|
+
matchingFilter: PongoFilter<Doc>;
|
|
212
|
+
};
|
|
213
|
+
declare const documentExists: <Doc extends PongoDocument | WithId<PongoDocument>>(document: Doc, options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
214
|
+
declare const documentsAreTheSame: <Doc extends PongoDocument | WithId<PongoDocument>>(documents: Doc[], options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
215
|
+
declare const documentsMatchingHaveCount: <Doc extends PongoDocument | WithId<PongoDocument>>(expectedCount: number, options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
216
|
+
declare const documentMatchingExists: <Doc extends PongoDocument | WithId<PongoDocument>>(options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
217
|
+
declare const documentDoesNotExist: <Doc extends PongoDocument | WithId<PongoDocument>>(options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
218
|
+
declare const expectPongoDocuments: {
|
|
219
|
+
fromCollection: <Doc extends PongoDocument | WithId<PongoDocument>>(collectionName: string) => {
|
|
220
|
+
withId: (id: string) => {
|
|
221
|
+
toBeEqual: (document: Doc) => PostgreSQLProjectionAssert;
|
|
222
|
+
toExist: () => PostgreSQLProjectionAssert;
|
|
223
|
+
notToExist: () => PostgreSQLProjectionAssert;
|
|
224
|
+
};
|
|
225
|
+
matching: <Doc_1 extends PongoDocument | WithId<PongoDocument>>(filter: PongoFilter<Doc_1>) => {
|
|
226
|
+
toBeTheSame: (documents: Doc_1[]) => PostgreSQLProjectionAssert;
|
|
227
|
+
toHaveCount: (expectedCount: number) => PostgreSQLProjectionAssert;
|
|
228
|
+
toExist: () => PostgreSQLProjectionAssert;
|
|
229
|
+
notToExist: () => PostgreSQLProjectionAssert;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
type PostgreSQLProjectionSpecEvent<EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = EventType & {
|
|
235
|
+
metadata?: Partial<EventMetaDataType>;
|
|
236
|
+
};
|
|
237
|
+
type PostgreSQLProjectionSpecWhenOptions = {
|
|
238
|
+
numberOfTimes: number;
|
|
239
|
+
};
|
|
240
|
+
type PostgreSQLProjectionAssert = (options: {
|
|
241
|
+
pool: Dumbo;
|
|
242
|
+
connectionString: string;
|
|
243
|
+
}) => Promise<void | boolean>;
|
|
244
|
+
type PostgreSQLProjectionSpecOptions<EventType extends Event> = {
|
|
245
|
+
projection: PostgreSQLProjectionDefinition<EventType>;
|
|
246
|
+
} & PgPoolOptions;
|
|
247
|
+
type PostgreSQLProjectionSpec<EventType extends Event> = (givenEvents: PostgreSQLProjectionSpecEvent<EventType>[]) => {
|
|
248
|
+
when: (events: PostgreSQLProjectionSpecEvent<EventType>[], options?: PostgreSQLProjectionSpecWhenOptions) => {
|
|
249
|
+
then: (assert: PostgreSQLProjectionAssert, message?: string) => Promise<void>;
|
|
250
|
+
thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
declare const PostgreSQLProjectionSpec: {
|
|
254
|
+
for: <EventType extends Event>(options: PostgreSQLProjectionSpecOptions<EventType>) => PostgreSQLProjectionSpec<EventType>;
|
|
255
|
+
};
|
|
256
|
+
declare const eventInStream: <EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata>(streamName: string, event: PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>) => PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>;
|
|
257
|
+
declare const eventsInStream: <EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata>(streamName: string, events: PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[]) => PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[];
|
|
258
|
+
declare const newEventsInStream: <EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = _event_driven_io_emmett.RecordedMessageMetadataWithGlobalPosition>(streamName: string, events: PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[]) => PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[];
|
|
259
|
+
declare const assertSQLQueryResultMatches: <T extends QueryResultRow>(sql: SQL, rows: T[]) => PostgreSQLProjectionAssert;
|
|
260
|
+
declare const expectSQL: {
|
|
261
|
+
query: (sql: SQL) => {
|
|
262
|
+
resultRows: {
|
|
263
|
+
toBeTheSame: <T extends QueryResultRow>(rows: T[]) => PostgreSQLProjectionAssert;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
150
268
|
declare const emmettPrefix = "emt";
|
|
151
269
|
declare const globalTag = "global";
|
|
152
270
|
declare const defaultTag = "emt:default";
|
|
@@ -308,7 +426,7 @@ declare const readMessagesBatch: <MessageType extends Message, RecordedMessageMe
|
|
|
308
426
|
}) => Promise<ReadMessagesBatchResult<MessageType, RecordedMessageMetadataType>>;
|
|
309
427
|
|
|
310
428
|
type ReadProcessorCheckpointResult = {
|
|
311
|
-
lastProcessedCheckpoint:
|
|
429
|
+
lastProcessedCheckpoint: ProcessorCheckpoint | null;
|
|
312
430
|
};
|
|
313
431
|
declare const readProcessorCheckpoint: (execute: SQLExecutor, options: {
|
|
314
432
|
processorId: string;
|
|
@@ -316,7 +434,7 @@ declare const readProcessorCheckpoint: (execute: SQLExecutor, options: {
|
|
|
316
434
|
version?: number;
|
|
317
435
|
}) => Promise<ReadProcessorCheckpointResult>;
|
|
318
436
|
|
|
319
|
-
declare const readStream: <EventType extends Event, EventPayloadType extends Event = EventType>(execute: SQLExecutor, streamId: string, options?: ReadStreamOptions<
|
|
437
|
+
declare const readStream: <EventType extends Event, EventPayloadType extends Event = EventType>(execute: SQLExecutor, streamId: string, options?: ReadStreamOptions<EventType, EventPayloadType> & {
|
|
320
438
|
partition?: string;
|
|
321
439
|
}) => Promise<ReadStreamResult<EventType, ReadEventMetadataWithGlobalPosition>>;
|
|
322
440
|
|
|
@@ -330,21 +448,21 @@ type CallStoreProcessorCheckpointParams = {
|
|
|
330
448
|
processorInstanceId: string;
|
|
331
449
|
};
|
|
332
450
|
declare const callStoreProcessorCheckpoint: (params: CallStoreProcessorCheckpointParams) => SQL;
|
|
333
|
-
type
|
|
451
|
+
type StoreProcessorCheckpointResult = {
|
|
334
452
|
success: true;
|
|
335
|
-
newCheckpoint:
|
|
453
|
+
newCheckpoint: ProcessorCheckpoint | null;
|
|
336
454
|
} | {
|
|
337
455
|
success: false;
|
|
338
456
|
reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
|
|
339
457
|
};
|
|
340
|
-
declare const storeProcessorCheckpoint:
|
|
458
|
+
declare const storeProcessorCheckpoint: (execute: SQLExecutor, options: {
|
|
341
459
|
processorId: string;
|
|
342
460
|
version: number | undefined;
|
|
343
|
-
newCheckpoint:
|
|
344
|
-
lastProcessedCheckpoint:
|
|
461
|
+
newCheckpoint: ProcessorCheckpoint | null;
|
|
462
|
+
lastProcessedCheckpoint: ProcessorCheckpoint | null;
|
|
345
463
|
partition?: string;
|
|
346
464
|
processorInstanceId?: string;
|
|
347
|
-
}) => Promise<
|
|
465
|
+
}) => Promise<StoreProcessorCheckpointResult>;
|
|
348
466
|
|
|
349
467
|
type PostgresStreamExistsOptions = {
|
|
350
468
|
partition: string;
|
|
@@ -370,14 +488,59 @@ declare const eventStoreSchemaMigrations: SQLMigration[];
|
|
|
370
488
|
type CreateEventStoreSchemaOptions = {
|
|
371
489
|
dryRun?: boolean | undefined;
|
|
372
490
|
ignoreMigrationHashMismatch?: boolean | undefined;
|
|
373
|
-
|
|
491
|
+
migrationTimeoutMs?: number | undefined;
|
|
492
|
+
} & JSONSerializationOptions;
|
|
374
493
|
type EventStoreSchemaMigrationOptions = {
|
|
375
494
|
migrationOptions?: CreateEventStoreSchemaOptions;
|
|
376
495
|
};
|
|
377
496
|
declare const createEventStoreSchema: (connectionString: string, pool: PgPool, hooks?: PostgresEventStoreOptions["hooks"], options?: CreateEventStoreSchemaOptions) => Promise<RunSQLMigrationsResult>;
|
|
378
497
|
|
|
498
|
+
type PostgreSQLProjectionHandlerContext = {
|
|
499
|
+
execute: SQLExecutor;
|
|
500
|
+
connection: {
|
|
501
|
+
connectionString: string;
|
|
502
|
+
client: PgClient;
|
|
503
|
+
transaction: PgTransaction;
|
|
504
|
+
pool: Dumbo;
|
|
505
|
+
};
|
|
506
|
+
} & EventStoreSchemaMigrationOptions;
|
|
507
|
+
declare const transactionToPostgreSQLProjectionHandlerContext: (connectionString: string, pool: Dumbo, transaction: PgTransaction | DatabaseTransaction<AnyConnection>) => Promise<PostgreSQLProjectionHandlerContext>;
|
|
508
|
+
type PostgreSQLProjectionHandler<EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = ProjectionHandler<EventType, EventMetaDataType, PostgreSQLProjectionHandlerContext>;
|
|
509
|
+
type PostgreSQLProjectionDefinition<EventType extends Event = Event, EventPayloadType extends Event = EventType> = ProjectionDefinition<EventType, PostgresReadEventMetadata, PostgreSQLProjectionHandlerContext, EventPayloadType>;
|
|
510
|
+
type PostgreSQLProjectionHandlerOptions<EventType extends Event = Event> = {
|
|
511
|
+
events: ReadEvent<EventType, PostgresReadEventMetadata>[];
|
|
512
|
+
projections: PostgreSQLProjectionDefinition<EventType>[];
|
|
513
|
+
partition?: string;
|
|
514
|
+
} & PostgreSQLProjectionHandlerContext;
|
|
515
|
+
declare const handleProjections: <EventType extends Event = Event>(options: PostgreSQLProjectionHandlerOptions<EventType>) => Promise<void>;
|
|
516
|
+
declare const postgreSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(definition: PostgreSQLProjectionDefinition<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
517
|
+
type PostgreSQLRawBatchSQLProjection<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
518
|
+
name: string;
|
|
519
|
+
kind?: string;
|
|
520
|
+
version?: number;
|
|
521
|
+
evolve: (events: EventType[], context: PostgreSQLProjectionHandlerContext) => Promise<SQL[]> | SQL[];
|
|
522
|
+
canHandle: CanHandle<EventType>;
|
|
523
|
+
init?: (context: ProjectionInitOptions<PostgreSQLProjectionHandlerContext>) => void | Promise<void> | SQL | Promise<SQL> | Promise<SQL[]> | SQL[];
|
|
524
|
+
eventsOptions?: {
|
|
525
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
526
|
+
};
|
|
527
|
+
} & JSONSerializationOptions;
|
|
528
|
+
declare const postgreSQLRawBatchSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(options: PostgreSQLRawBatchSQLProjection<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
529
|
+
type PostgreSQLRawSQLProjection<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
530
|
+
name: string;
|
|
531
|
+
kind?: string;
|
|
532
|
+
version?: number;
|
|
533
|
+
evolve: (events: EventType, context: PostgreSQLProjectionHandlerContext) => Promise<SQL[]> | SQL[] | Promise<SQL> | SQL;
|
|
534
|
+
canHandle: CanHandle<EventType>;
|
|
535
|
+
init?: (context: ProjectionInitOptions<PostgreSQLProjectionHandlerContext>) => void | Promise<void> | SQL | Promise<SQL> | Promise<SQL[]> | SQL[];
|
|
536
|
+
eventsOptions?: {
|
|
537
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
538
|
+
};
|
|
539
|
+
} & JSONSerializationOptions;
|
|
540
|
+
declare const postgreSQLRawSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(options: PostgreSQLRawSQLProjection<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
541
|
+
|
|
379
542
|
interface PostgresEventStore extends EventStore<PostgresReadEventMetadata>, EventStoreSessionFactory<PostgresEventStore> {
|
|
380
|
-
appendToStream<EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, events: EventType[], options?: AppendToStreamOptions<
|
|
543
|
+
appendToStream<EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, events: EventType[], options?: AppendToStreamOptions<EventType, EventPayloadType>): Promise<AppendToStreamResultWithGlobalPosition>;
|
|
381
544
|
consumer<ConsumerEventType extends Event = Event>(options?: PostgreSQLEventStoreConsumerConfig<ConsumerEventType>): PostgreSQLEventStoreConsumer<ConsumerEventType>;
|
|
382
545
|
close(): Promise<void>;
|
|
383
546
|
streamExists(streamName: string, options?: PostgresStreamExistsOptions): Promise<StreamExistsResult>;
|
|
@@ -462,172 +625,11 @@ type PostgresEventStoreOptions = {
|
|
|
462
625
|
*/
|
|
463
626
|
onAfterSchemaCreated?: (context: PostgreSQLProjectionHandlerContext) => Promise<void> | void;
|
|
464
627
|
};
|
|
465
|
-
};
|
|
628
|
+
} & JSONSerializationOptions;
|
|
466
629
|
declare const defaultPostgreSQLOptions: PostgresEventStoreOptions;
|
|
467
630
|
declare const PostgreSQLEventStoreDefaultStreamVersion = 0n;
|
|
468
631
|
declare const getPostgreSQLEventStore: (connectionString: string, options?: PostgresEventStoreOptions) => PostgresEventStore;
|
|
469
632
|
|
|
470
|
-
type PongoProjectionHandlerContext = PostgreSQLProjectionHandlerContext & {
|
|
471
|
-
pongo: PongoClient;
|
|
472
|
-
};
|
|
473
|
-
type PongoWithNotNullDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = ((document: Document, event: ReadEvent<EventType, EventMetaDataType>) => Document | null) | ((document: Document, event: ReadEvent<EventType>) => Promise<Document | null>);
|
|
474
|
-
type PongoWithNullableDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = ((document: Document | null, event: ReadEvent<EventType, EventMetaDataType>) => Document | null) | ((document: Document | null, event: ReadEvent<EventType>) => Promise<Document | null>);
|
|
475
|
-
type PongoDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType> | PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
476
|
-
type PongoProjectionOptions<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
477
|
-
name: string;
|
|
478
|
-
kind?: string;
|
|
479
|
-
version?: number;
|
|
480
|
-
handle: (events: ReadEvent<EventType, PostgresReadEventMetadata>[], context: PongoProjectionHandlerContext) => Promise<void>;
|
|
481
|
-
canHandle: CanHandle<EventType>;
|
|
482
|
-
truncate?: TruncateProjection<PongoProjectionHandlerContext>;
|
|
483
|
-
init?: (context: PongoProjectionHandlerContext) => void | Promise<void>;
|
|
484
|
-
eventsOptions?: {
|
|
485
|
-
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
486
|
-
};
|
|
487
|
-
};
|
|
488
|
-
declare const pongoProjection: <EventType extends Event, EventPayloadType extends Event = EventType>({ name, kind, version, truncate, handle, canHandle, eventsOptions, }: PongoProjectionOptions<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
489
|
-
type PongoMultiStreamProjectionOptions<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType, DocumentPayload extends PongoDocument = Document> = {
|
|
490
|
-
kind?: string;
|
|
491
|
-
canHandle: CanHandle<EventType>;
|
|
492
|
-
version?: number;
|
|
493
|
-
collectionName: string;
|
|
494
|
-
collectionOptions?: PongoDBCollectionOptions<Document, DocumentPayload>;
|
|
495
|
-
eventsOptions?: {
|
|
496
|
-
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
497
|
-
};
|
|
498
|
-
getDocumentId: (event: ReadEvent<EventType>) => string;
|
|
499
|
-
} & ({
|
|
500
|
-
evolve: PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
501
|
-
} | {
|
|
502
|
-
evolve: PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
503
|
-
initialState: () => Document;
|
|
504
|
-
});
|
|
505
|
-
declare const pongoMultiStreamProjection: <Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType>(options: PongoMultiStreamProjectionOptions<Document, EventType, EventMetaDataType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
506
|
-
type PongoSingleStreamProjectionOptions<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType, DocumentPayload extends PongoDocument = Document> = {
|
|
507
|
-
canHandle: CanHandle<EventType>;
|
|
508
|
-
getDocumentId?: (event: ReadEvent<EventType>) => string;
|
|
509
|
-
version?: number;
|
|
510
|
-
collectionName: string;
|
|
511
|
-
collectionOptions?: PongoDBCollectionOptions<Document, DocumentPayload>;
|
|
512
|
-
eventsOptions?: {
|
|
513
|
-
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
514
|
-
};
|
|
515
|
-
} & ({
|
|
516
|
-
evolve: PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
517
|
-
} | {
|
|
518
|
-
evolve: PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
519
|
-
initialState: () => Document;
|
|
520
|
-
});
|
|
521
|
-
declare const pongoSingleStreamProjection: <Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType>(options: PongoSingleStreamProjectionOptions<Document, EventType, EventMetaDataType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
522
|
-
|
|
523
|
-
type PongoAssertOptions = {
|
|
524
|
-
inCollection: string;
|
|
525
|
-
inDatabase?: string;
|
|
526
|
-
};
|
|
527
|
-
type FilterOrId<Doc extends PongoDocument | WithId<PongoDocument>> = {
|
|
528
|
-
withId: string;
|
|
529
|
-
} | {
|
|
530
|
-
matchingFilter: PongoFilter<Doc>;
|
|
531
|
-
};
|
|
532
|
-
declare const documentExists: <Doc extends PongoDocument | WithId<PongoDocument>>(document: Doc, options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
533
|
-
declare const documentsAreTheSame: <Doc extends PongoDocument | WithId<PongoDocument>>(documents: Doc[], options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
534
|
-
declare const documentsMatchingHaveCount: <Doc extends PongoDocument | WithId<PongoDocument>>(expectedCount: number, options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
535
|
-
declare const documentMatchingExists: <Doc extends PongoDocument | WithId<PongoDocument>>(options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
536
|
-
declare const documentDoesNotExist: <Doc extends PongoDocument | WithId<PongoDocument>>(options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
537
|
-
declare const expectPongoDocuments: {
|
|
538
|
-
fromCollection: <Doc extends PongoDocument | WithId<PongoDocument>>(collectionName: string) => {
|
|
539
|
-
withId: (id: string) => {
|
|
540
|
-
toBeEqual: (document: Doc) => PostgreSQLProjectionAssert;
|
|
541
|
-
toExist: () => PostgreSQLProjectionAssert;
|
|
542
|
-
notToExist: () => PostgreSQLProjectionAssert;
|
|
543
|
-
};
|
|
544
|
-
matching: <Doc_1 extends PongoDocument | WithId<PongoDocument>>(filter: PongoFilter<Doc_1>) => {
|
|
545
|
-
toBeTheSame: (documents: Doc_1[]) => PostgreSQLProjectionAssert;
|
|
546
|
-
toHaveCount: (expectedCount: number) => PostgreSQLProjectionAssert;
|
|
547
|
-
toExist: () => PostgreSQLProjectionAssert;
|
|
548
|
-
notToExist: () => PostgreSQLProjectionAssert;
|
|
549
|
-
};
|
|
550
|
-
};
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
type PostgreSQLProjectionSpecEvent<EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = EventType & {
|
|
554
|
-
metadata?: Partial<EventMetaDataType>;
|
|
555
|
-
};
|
|
556
|
-
type PostgreSQLProjectionSpecWhenOptions = {
|
|
557
|
-
numberOfTimes: number;
|
|
558
|
-
};
|
|
559
|
-
type PostgreSQLProjectionAssert = (options: {
|
|
560
|
-
pool: Dumbo;
|
|
561
|
-
connectionString: string;
|
|
562
|
-
}) => Promise<void | boolean>;
|
|
563
|
-
type PostgreSQLProjectionSpecOptions<EventType extends Event> = {
|
|
564
|
-
projection: PostgreSQLProjectionDefinition<EventType>;
|
|
565
|
-
} & PgPoolOptions;
|
|
566
|
-
type PostgreSQLProjectionSpec<EventType extends Event> = (givenEvents: PostgreSQLProjectionSpecEvent<EventType>[]) => {
|
|
567
|
-
when: (events: PostgreSQLProjectionSpecEvent<EventType>[], options?: PostgreSQLProjectionSpecWhenOptions) => {
|
|
568
|
-
then: (assert: PostgreSQLProjectionAssert, message?: string) => Promise<void>;
|
|
569
|
-
thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
|
|
570
|
-
};
|
|
571
|
-
};
|
|
572
|
-
declare const PostgreSQLProjectionSpec: {
|
|
573
|
-
for: <EventType extends Event>(options: PostgreSQLProjectionSpecOptions<EventType>) => PostgreSQLProjectionSpec<EventType>;
|
|
574
|
-
};
|
|
575
|
-
declare const eventInStream: <EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata>(streamName: string, event: PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>) => PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>;
|
|
576
|
-
declare const eventsInStream: <EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata>(streamName: string, events: PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[]) => PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[];
|
|
577
|
-
declare const newEventsInStream: <EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata>(streamName: string, events: PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[]) => PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[];
|
|
578
|
-
declare const assertSQLQueryResultMatches: <T extends QueryResultRow>(sql: SQL, rows: T[]) => PostgreSQLProjectionAssert;
|
|
579
|
-
declare const expectSQL: {
|
|
580
|
-
query: (sql: SQL) => {
|
|
581
|
-
resultRows: {
|
|
582
|
-
toBeTheSame: <T extends QueryResultRow>(rows: T[]) => PostgreSQLProjectionAssert;
|
|
583
|
-
};
|
|
584
|
-
};
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
type PostgreSQLProjectionHandlerContext = {
|
|
588
|
-
execute: SQLExecutor;
|
|
589
|
-
connection: {
|
|
590
|
-
connectionString: string;
|
|
591
|
-
client: PgClient;
|
|
592
|
-
transaction: PgTransaction;
|
|
593
|
-
pool: Dumbo;
|
|
594
|
-
};
|
|
595
|
-
} & EventStoreSchemaMigrationOptions;
|
|
596
|
-
declare const transactionToPostgreSQLProjectionHandlerContext: (connectionString: string, pool: Dumbo, transaction: PgTransaction | DatabaseTransaction<AnyConnection>) => Promise<PostgreSQLProjectionHandlerContext>;
|
|
597
|
-
type PostgreSQLProjectionHandler<EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = ProjectionHandler<EventType, EventMetaDataType, PostgreSQLProjectionHandlerContext>;
|
|
598
|
-
type PostgreSQLProjectionDefinition<EventType extends Event = Event, EventPayloadType extends Event = EventType> = ProjectionDefinition<EventType, PostgresReadEventMetadata, PostgreSQLProjectionHandlerContext, EventPayloadType>;
|
|
599
|
-
type PostgreSQLProjectionHandlerOptions<EventType extends Event = Event> = {
|
|
600
|
-
events: ReadEvent<EventType, PostgresReadEventMetadata>[];
|
|
601
|
-
projections: PostgreSQLProjectionDefinition<EventType>[];
|
|
602
|
-
partition?: string;
|
|
603
|
-
} & PostgreSQLProjectionHandlerContext;
|
|
604
|
-
declare const handleProjections: <EventType extends Event = Event>(options: PostgreSQLProjectionHandlerOptions<EventType>) => Promise<void>;
|
|
605
|
-
declare const postgreSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(definition: PostgreSQLProjectionDefinition<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
606
|
-
type PostgreSQLRawBatchSQLProjection<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
607
|
-
name: string;
|
|
608
|
-
kind?: string;
|
|
609
|
-
version?: number;
|
|
610
|
-
evolve: (events: EventType[], context: PostgreSQLProjectionHandlerContext) => Promise<SQL[]> | SQL[];
|
|
611
|
-
canHandle: CanHandle<EventType>;
|
|
612
|
-
init?: (context: ProjectionInitOptions<PostgreSQLProjectionHandlerContext>) => void | Promise<void> | SQL | Promise<SQL> | Promise<SQL[]> | SQL[];
|
|
613
|
-
eventsOptions?: {
|
|
614
|
-
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
615
|
-
};
|
|
616
|
-
};
|
|
617
|
-
declare const postgreSQLRawBatchSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(options: PostgreSQLRawBatchSQLProjection<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
618
|
-
type PostgreSQLRawSQLProjection<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
619
|
-
name: string;
|
|
620
|
-
kind?: string;
|
|
621
|
-
version?: number;
|
|
622
|
-
evolve: (events: EventType, context: PostgreSQLProjectionHandlerContext) => Promise<SQL[]> | SQL[] | Promise<SQL> | SQL;
|
|
623
|
-
canHandle: CanHandle<EventType>;
|
|
624
|
-
init?: (context: ProjectionInitOptions<PostgreSQLProjectionHandlerContext>) => void | Promise<void> | SQL | Promise<SQL> | Promise<SQL[]> | SQL[];
|
|
625
|
-
eventsOptions?: {
|
|
626
|
-
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
627
|
-
};
|
|
628
|
-
};
|
|
629
|
-
declare const postgreSQLRawSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(options: PostgreSQLRawSQLProjection<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
630
|
-
|
|
631
633
|
type PostgreSQLProcessorHandlerContext = {
|
|
632
634
|
partition: string;
|
|
633
635
|
execute: SQLExecutor;
|
|
@@ -636,6 +638,7 @@ type PostgreSQLProcessorHandlerContext = {
|
|
|
636
638
|
client: PgClient;
|
|
637
639
|
transaction: PgTransaction;
|
|
638
640
|
pool: Dumbo;
|
|
641
|
+
messageStore: PostgresEventStore;
|
|
639
642
|
};
|
|
640
643
|
} & EventStoreSchemaMigrationOptions;
|
|
641
644
|
type PostgreSQLProcessor<MessageType extends Message = AnyMessage> = MessageProcessor<MessageType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext>;
|
|
@@ -690,27 +693,21 @@ type PostgreSQLCheckpointer<MessageType extends AnyMessage = AnyMessage> = Check
|
|
|
690
693
|
declare const postgreSQLCheckpointer: <MessageType extends Message = Message>() => PostgreSQLCheckpointer<MessageType>;
|
|
691
694
|
type PostgreSQLConnectionOptions = {
|
|
692
695
|
connectionOptions?: PostgreSQLProcessorConnectionOptions;
|
|
693
|
-
};
|
|
696
|
+
} & JSONSerializationOptions;
|
|
694
697
|
type PostgreSQLProcessorOptionsBase = PostgreSQLConnectionOptions & {
|
|
695
|
-
|
|
696
|
-
|
|
698
|
+
lock?: {
|
|
699
|
+
acquisitionPolicy?: LockAcquisitionPolicy;
|
|
700
|
+
timeoutSeconds?: number;
|
|
701
|
+
};
|
|
697
702
|
partition?: string;
|
|
698
703
|
};
|
|
699
|
-
type PostgreSQLReactorOptions<MessageType extends Message = Message> = ReactorOptions<MessageType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext> & PostgreSQLProcessorOptionsBase;
|
|
700
|
-
type PostgreSQLProjectorOptions<EventType extends AnyEvent = AnyEvent> = ProjectorOptions<EventType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext> & PostgreSQLProcessorOptionsBase & EventStoreSchemaMigrationOptions;
|
|
701
|
-
type
|
|
702
|
-
declare const postgreSQLProjector: <EventType extends Event = Event>(options: PostgreSQLProjectorOptions<EventType>) => PostgreSQLProcessor<EventType>;
|
|
703
|
-
declare const
|
|
704
|
-
declare const
|
|
704
|
+
type PostgreSQLReactorOptions<MessageType extends Message = Message, MessagePayloadType extends AnyMessage = MessageType> = ReactorOptions<MessageType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext, MessagePayloadType> & PostgreSQLProcessorOptionsBase;
|
|
705
|
+
type PostgreSQLProjectorOptions<EventType extends AnyEvent = AnyEvent, EventPayloadType extends Event = EventType> = ProjectorOptions<EventType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext, EventPayloadType> & PostgreSQLProcessorOptionsBase & EventStoreSchemaMigrationOptions;
|
|
706
|
+
type PostgreSQLWorkflowProcessorOptions<Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, MetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends WorkflowProcessorContext = WorkflowProcessorContext, StoredMessage extends AnyEvent | AnyCommand = Output> = WorkflowProcessorOptions<Input, State, Output, MetaDataType, HandlerContext, StoredMessage> & PostgreSQLProcessorOptionsBase;
|
|
707
|
+
declare const postgreSQLProjector: <EventType extends Event = Event, EventPayloadType extends Event = EventType>(options: PostgreSQLProjectorOptions<EventType, EventPayloadType>) => PostgreSQLProcessor<EventType>;
|
|
708
|
+
declare const postgreSQLWorkflowProcessor: <Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, MetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends PostgreSQLProcessorHandlerContext & WorkflowProcessorContext = PostgreSQLProcessorHandlerContext & WorkflowProcessorContext, StoredMessage extends AnyEvent | AnyCommand = Output>(options: PostgreSQLWorkflowProcessorOptions<Input, State, Output, MetaDataType, HandlerContext, StoredMessage>) => PostgreSQLProcessor<Input | Output>;
|
|
709
|
+
declare const postgreSQLReactor: <MessageType extends Message = Message, MessagePayloadType extends AnyMessage = MessageType>(options: PostgreSQLReactorOptions<MessageType, MessagePayloadType>) => PostgreSQLProcessor<MessageType>;
|
|
705
710
|
|
|
706
|
-
type PostgreSQLConsumerContext = {
|
|
707
|
-
execute: SQLExecutor;
|
|
708
|
-
connection: {
|
|
709
|
-
connectionString: string;
|
|
710
|
-
pool: Dumbo;
|
|
711
|
-
};
|
|
712
|
-
};
|
|
713
|
-
type ExtendableContext = Partial<PostgreSQLConsumerContext> & DefaultRecord;
|
|
714
711
|
type PostgreSQLEventStoreConsumerConfig<ConsumerMessageType extends Message = any> = MessageConsumerOptions<ConsumerMessageType> & {
|
|
715
712
|
stopWhen?: {
|
|
716
713
|
noMessagesLeft?: boolean;
|
|
@@ -719,22 +716,26 @@ type PostgreSQLEventStoreConsumerConfig<ConsumerMessageType extends Message = an
|
|
|
719
716
|
batchSize?: number;
|
|
720
717
|
pullingFrequencyInMs?: number;
|
|
721
718
|
};
|
|
722
|
-
};
|
|
719
|
+
} & JSONSerializationOptions;
|
|
723
720
|
type PostgreSQLEventStoreConsumerOptions<ConsumerMessageType extends Message = Message> = PostgreSQLEventStoreConsumerConfig<ConsumerMessageType> & {
|
|
724
721
|
connectionString: string;
|
|
725
722
|
pool?: Dumbo;
|
|
726
723
|
};
|
|
727
724
|
type PostgreSQLEventStoreConsumer<ConsumerMessageType extends AnyMessage = any> = MessageConsumer<ConsumerMessageType> & Readonly<{
|
|
728
725
|
reactor: <MessageType extends AnyMessage = ConsumerMessageType>(options: PostgreSQLReactorOptions<MessageType>) => PostgreSQLProcessor<MessageType>;
|
|
726
|
+
workflowProcessor: <Input extends AnyEvent | AnyCommand, State, Output extends AnyEvent | AnyCommand, MetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends PostgreSQLProcessorHandlerContext & WorkflowProcessorContext = PostgreSQLProcessorHandlerContext & WorkflowProcessorContext, StoredMessage extends AnyEvent | AnyCommand = Output>(options: PostgreSQLWorkflowProcessorOptions<Input, State, Output, MetaDataType, HandlerContext, StoredMessage>) => PostgreSQLProcessor<Input | Output>;
|
|
729
727
|
}> & (AnyEvent extends ConsumerMessageType ? Readonly<{
|
|
730
728
|
projector: <EventType extends AnyEvent = ConsumerMessageType & AnyEvent>(options: PostgreSQLProjectorOptions<EventType>) => PostgreSQLProcessor<EventType>;
|
|
731
729
|
}> : object);
|
|
732
730
|
declare const postgreSQLEventStoreConsumer: <ConsumerMessageType extends Message = AnyMessage>(options: PostgreSQLEventStoreConsumerOptions<ConsumerMessageType>) => PostgreSQLEventStoreConsumer<ConsumerMessageType>;
|
|
733
731
|
|
|
734
732
|
declare const rebuildPostgreSQLProjections: <EventType extends AnyEvent = AnyEvent>(options: Omit<PostgreSQLEventStoreConsumerOptions<EventType>, "stopWhen" | "processors"> & {
|
|
735
|
-
|
|
733
|
+
lock?: {
|
|
734
|
+
acquisitionPolicy?: LockAcquisitionPolicy;
|
|
735
|
+
timeoutSeconds?: number;
|
|
736
|
+
};
|
|
736
737
|
} & ({
|
|
737
738
|
projections: (ProjectorOptions<EventType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext> | PostgreSQLProjectionDefinition<EventType>)[];
|
|
738
739
|
} | ProjectorOptions<EventType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext>)) => PostgreSQLEventStoreConsumer<EventType>;
|
|
739
740
|
|
|
740
|
-
export { type AppendToStreamBeforeCommitHook, type CreateEventStoreSchemaOptions, DefaultPostgreSQLEventStoreProcessorBatchSize, DefaultPostgreSQLEventStoreProcessorPullingFrequencyInMs, DefaultPostgreSQLProcessorLockPolicy, type EventStoreSchemaMigrationOptions, type
|
|
741
|
+
export { type AppendToStreamBeforeCommitHook, type CreateEventStoreSchemaOptions, DefaultPostgreSQLEventStoreProcessorBatchSize, DefaultPostgreSQLEventStoreProcessorPullingFrequencyInMs, DefaultPostgreSQLProcessorLockPolicy, type EventStoreSchemaMigrationOptions, type LockAcquisitionPolicy, type PongoAssertOptions, type PongoDocumentEvolve, type PongoMultiStreamProjectionOptions, type PongoProjectionHandlerContext, type PongoProjectionOptions, type PongoSingleStreamProjectionOptions, type PongoWithNotNullDocumentEvolve, type PongoWithNullableDocumentEvolve, type PostgreSQLCheckpointer, type PostgreSQLEventStoreConsumer, type PostgreSQLEventStoreConsumerConfig, type PostgreSQLEventStoreConsumerOptions, PostgreSQLEventStoreDefaultStreamVersion, type PostgreSQLEventStoreMessageBatchPuller, type PostgreSQLEventStoreMessageBatchPullerOptions, type PostgreSQLEventStoreMessageBatchPullerStartFrom, type PostgreSQLEventStoreMessageBatchPullerStartOptions, type PostgreSQLEventStoreMessagesBatchHandlerResult, type PostgreSQLProcessor, type PostgreSQLProcessorConnectionOptions, type PostgreSQLProcessorEachBatchHandler, type PostgreSQLProcessorEachMessageHandler, type PostgreSQLProcessorHandlerContext, type PostgreSQLProcessorLock, type PostgreSQLProcessorLockContext, type PostgreSQLProcessorLockOptions, type PostgreSQLProcessorStartFrom, type PostgreSQLProjectionAssert, type PostgreSQLProjectionDefinition, type PostgreSQLProjectionHandler, type PostgreSQLProjectionHandlerContext, type PostgreSQLProjectionHandlerOptions, type PostgreSQLProjectionLock, type PostgreSQLProjectionLockContext, type PostgreSQLProjectionLockOptions, PostgreSQLProjectionSpec, type PostgreSQLProjectionSpecEvent, type PostgreSQLProjectionSpecOptions, type PostgreSQLProjectionSpecWhenOptions, type PostgreSQLProjectorOptions, type PostgreSQLRawBatchSQLProjection, type PostgreSQLRawSQLProjection, type PostgreSQLReactorOptions, type PostgreSQLWorkflowProcessorOptions, type PostgresEventStore, type PostgresEventStoreConnectionOptions, type PostgresEventStoreOptions, type PostgresReadEvent, type PostgresReadEventMetadata, type PostgresStreamExistsOptions, type ReadLastMessageGlobalPositionResult, type ReadMessagesBatchOptions, type ReadMessagesBatchResult, type ReadProcessorCheckpointResult, type ReadProjectionInfoResult, type StoreProcessorCheckpointResult, activateProjection, activateProjectionSQL, addDefaultPartitionSQL, addModuleForAllTenantsSQL, addModuleSQL, addPartitionSQL, addTablePartitions, addTenantForAllModulesSQL, addTenantSQL, appendToStream, appendToStreamSQL, assertSQLQueryResultMatches, callActivateProjection, callAppendToStream, callDeactivateProjection, callRegisterProjection, callReleaseProcessorLock, callStoreProcessorCheckpoint, callTryAcquireProcessorLock, callTryAcquireProjectionLock, cleanupLegacySubscriptionTables, createEventStoreSchema, deactivateProjection, deactivateProjectionSQL, defaultPostgreSQLOptions, defaultTag, documentDoesNotExist, documentExists, documentMatchingExists, documentsAreTheSame, documentsMatchingHaveCount, emmettPrefix, eventInStream, eventStoreSchemaMigrations, eventsInStream, expectPongoDocuments, expectSQL, getPostgreSQLEventStore, globalNames, globalTag, handleProjections, messagesTable, messagesTableSQL, newEventsInStream, pongoMultiStreamProjection, pongoProjection, pongoSingleStreamProjection, postgreSQLCheckpointer, postgreSQLEventStoreConsumer, postgreSQLEventStoreMessageBatchPuller, postgreSQLProcessorLock, postgreSQLProjection, postgreSQLProjectionLock, postgreSQLProjector, postgreSQLRawBatchSQLProjection, postgreSQLRawSQLProjection, postgreSQLReactor, postgreSQLWorkflowProcessor, processorsTable, processorsTableSQL, projectionsTable, projectionsTableSQL, readLastMessageGlobalPosition, readMessagesBatch, readProcessorCheckpoint, readProjectionInfo, readStream, rebuildPostgreSQLProjections, registerProjection, registerProjectionSQL, releaseProcessorLockSQL, sanitizeNameSQL, schemaMigration, schemaSQL, storeProcessorCheckpoint, storeSubscriptionCheckpointSQL, streamExists, streamsTable, streamsTableSQL, toProcessorLockKey, toProjectionLockKey, transactionToPostgreSQLProjectionHandlerContext, tryAcquireProcessorLockSQL, tryAcquireProjectionLockSQL, unknownTag, zipPostgreSQLEventStoreMessageBatchPullerStartFrom };
|