@event-driven-io/emmett-postgresql 0.43.0-beta.2 → 0.43.0-beta.21
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/README.md +437 -0
- package/dist/index.cjs +2921 -4720
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +568 -510
- package/dist/index.d.ts +568 -510
- package/dist/index.js +2518 -4402
- package/dist/index.js.map +1 -1
- package/package.json +20 -19
package/dist/index.d.cts
CHANGED
|
@@ -1,214 +1,269 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import * as _$_event_driven_io_dumbo0 from "@event-driven-io/dumbo";
|
|
2
|
+
import { AnyConnection, DatabaseTransaction, Dumbo, MigrationStyle, QueryResultRow, RunSQLMigrationsResult, SQL, SQLExecutor, SQLMigration } from "@event-driven-io/dumbo";
|
|
3
|
+
import * as _$_event_driven_io_emmett0 from "@event-driven-io/emmett";
|
|
4
|
+
import { AnyCommand, AnyEvent, AnyMessage, AnyReadEventMetadata, AnyRecordedMessageMetadata, AppendToStreamOptions, AppendToStreamResultWithGlobalPosition, AsyncAwaiter, BatchRecordedMessageHandlerWithContext, BatchRecordedMessageHandlerWithoutContext, CanHandle, Checkpointer, DefaultRecord, EmmettError, Event, EventStore, EventStoreReadSchemaOptions, EventStoreSessionFactory, JSONSerializationOptions, Message, MessageConsumer, MessageConsumerOptions, MessageHandlerContext, MessageProcessor, ProcessorCheckpoint, ProjectionDefinition, ProjectionHandler, ProjectionHandlerContext, ProjectionHandlingType, ProjectionInitOptions, ProjectionRegistration, ProjectorOptions, ReactorOptions, ReadEvent, ReadEventMetadataWithGlobalPosition, ReadStreamOptions, ReadStreamResult, RecordedMessage, RecordedMessageMetadata, RecordedMessageMetadataWithGlobalPosition, SingleRecordedMessageHandlerWithContext, StreamExistsResult, ThenThrows, TruncateProjection, WorkflowProcessorContext, WorkflowProcessorOptions } from "@event-driven-io/emmett";
|
|
5
|
+
import { PgClient, PgClientConnection, PgConnection, PgDriverType, PgPool, PgPoolClientConnection, PgPoolOptions, PgTransaction } from "@event-driven-io/dumbo/pg";
|
|
6
|
+
import pg from "pg";
|
|
7
|
+
import { PongoClient, PongoDBCollectionOptions, PongoDocument, PongoFilter, WithId } from "@event-driven-io/pongo";
|
|
7
8
|
|
|
9
|
+
//#region src/eventStore/consumers/messageBatchProcessing/index.d.ts
|
|
8
10
|
declare const DefaultPostgreSQLEventStoreProcessorBatchSize = 100;
|
|
9
11
|
declare const DefaultPostgreSQLEventStoreProcessorPullingFrequencyInMs = 50;
|
|
10
12
|
type PostgreSQLEventStoreMessagesBatchHandlerResult = void | {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
type: 'STOP';
|
|
14
|
+
reason?: string;
|
|
15
|
+
error?: EmmettError;
|
|
14
16
|
};
|
|
15
17
|
type PostgreSQLEventStoreMessageBatchPullerOptions<MessageType extends Message = Message> = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
executor: SQLExecutor;
|
|
19
|
+
pullingFrequencyInMs: number;
|
|
20
|
+
batchSize: number;
|
|
21
|
+
eachBatch: BatchRecordedMessageHandlerWithoutContext<MessageType, ReadEventMetadataWithGlobalPosition>;
|
|
22
|
+
stopWhen?: {
|
|
23
|
+
noMessagesLeft?: boolean;
|
|
24
|
+
};
|
|
25
|
+
signal: AbortSignal;
|
|
24
26
|
};
|
|
25
27
|
type PostgreSQLEventStoreMessageBatchPullerStartFrom = {
|
|
26
|
-
|
|
28
|
+
lastCheckpoint: ProcessorCheckpoint;
|
|
27
29
|
} | 'BEGINNING' | 'END';
|
|
28
30
|
type PostgreSQLEventStoreMessageBatchPullerStartOptions = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
startFrom: PostgreSQLEventStoreMessageBatchPullerStartFrom;
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
started?: AsyncAwaiter<void>;
|
|
31
34
|
};
|
|
32
35
|
type PostgreSQLEventStoreMessageBatchPuller = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
declare const postgreSQLEventStoreMessageBatchPuller: <MessageType extends Message = Message>({
|
|
36
|
+
isRunning: boolean;
|
|
37
|
+
start(options: PostgreSQLEventStoreMessageBatchPullerStartOptions): Promise<void>;
|
|
38
|
+
stop(): Promise<void>;
|
|
39
|
+
};
|
|
40
|
+
declare const postgreSQLEventStoreMessageBatchPuller: <MessageType extends Message = Message>({
|
|
41
|
+
executor,
|
|
42
|
+
batchSize,
|
|
43
|
+
eachBatch,
|
|
44
|
+
pullingFrequencyInMs,
|
|
45
|
+
stopWhen,
|
|
46
|
+
signal
|
|
47
|
+
}: PostgreSQLEventStoreMessageBatchPullerOptions<MessageType>) => PostgreSQLEventStoreMessageBatchPuller;
|
|
38
48
|
declare const zipPostgreSQLEventStoreMessageBatchPullerStartFrom: (options: (PostgreSQLEventStoreMessageBatchPullerStartFrom | undefined)[]) => PostgreSQLEventStoreMessageBatchPullerStartFrom;
|
|
39
|
-
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/eventStore/projections/locks/tryAcquireProcessorLock.d.ts
|
|
40
51
|
type TryAcquireProcessorLockOptions = {
|
|
41
|
-
|
|
52
|
+
processorId: string;
|
|
53
|
+
version: number;
|
|
54
|
+
partition: string;
|
|
55
|
+
processorInstanceId: string;
|
|
56
|
+
projection?: {
|
|
57
|
+
name: string;
|
|
58
|
+
handlingType: ProjectionHandlingType;
|
|
59
|
+
kind: string;
|
|
42
60
|
version: number;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
name: string;
|
|
47
|
-
handlingType: ProjectionHandlingType;
|
|
48
|
-
kind: string;
|
|
49
|
-
version: number;
|
|
50
|
-
};
|
|
51
|
-
lockKey: string | bigint;
|
|
52
|
-
lockTimeoutSeconds?: number;
|
|
61
|
+
};
|
|
62
|
+
lockKey: string | bigint;
|
|
63
|
+
lockTimeoutSeconds?: number;
|
|
53
64
|
};
|
|
54
65
|
type LockAcquisitionPolicy = {
|
|
55
|
-
|
|
66
|
+
type: 'fail';
|
|
56
67
|
} | {
|
|
57
|
-
|
|
68
|
+
type: 'skip';
|
|
58
69
|
} | {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
type: 'retry';
|
|
71
|
+
retries: number;
|
|
72
|
+
minTimeout?: number;
|
|
73
|
+
maxTimeout?: number;
|
|
63
74
|
};
|
|
64
|
-
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/eventStore/projections/locks/postgreSQLProcessorLock.d.ts
|
|
65
77
|
type PostgreSQLProcessorLockOptions = {
|
|
66
|
-
|
|
78
|
+
processorId: string;
|
|
79
|
+
version: number;
|
|
80
|
+
partition: string;
|
|
81
|
+
processorInstanceId: string;
|
|
82
|
+
projection?: {
|
|
83
|
+
name: string;
|
|
84
|
+
handlingType: ProjectionHandlingType;
|
|
85
|
+
kind: string;
|
|
67
86
|
version: number;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
handlingType: ProjectionHandlingType;
|
|
73
|
-
kind: string;
|
|
74
|
-
version: number;
|
|
75
|
-
};
|
|
76
|
-
lockKey?: string | bigint;
|
|
77
|
-
lockTimeoutSeconds?: number;
|
|
78
|
-
lockAcquisitionPolicy?: LockAcquisitionPolicy;
|
|
87
|
+
};
|
|
88
|
+
lockKey?: string | bigint;
|
|
89
|
+
lockTimeoutSeconds?: number;
|
|
90
|
+
lockAcquisitionPolicy?: LockAcquisitionPolicy;
|
|
79
91
|
};
|
|
80
92
|
type PostgreSQLProcessorLockContext = {
|
|
81
|
-
|
|
93
|
+
execute: SQLExecutor;
|
|
82
94
|
};
|
|
83
95
|
type PostgreSQLProcessorLock = {
|
|
84
|
-
|
|
85
|
-
|
|
96
|
+
tryAcquire: (options: PostgreSQLProcessorLockContext) => Promise<boolean>;
|
|
97
|
+
release: (options: PostgreSQLProcessorLockContext) => Promise<void>;
|
|
86
98
|
};
|
|
87
99
|
declare const DefaultPostgreSQLProcessorLockPolicy: LockAcquisitionPolicy;
|
|
88
100
|
declare const postgreSQLProcessorLock: (options: PostgreSQLProcessorLockOptions) => PostgreSQLProcessorLock;
|
|
89
|
-
declare const toProcessorLockKey: ({
|
|
90
|
-
|
|
101
|
+
declare const toProcessorLockKey: ({
|
|
102
|
+
projection,
|
|
103
|
+
processorId,
|
|
104
|
+
partition,
|
|
105
|
+
version
|
|
106
|
+
}: Pick<TryAcquireProcessorLockOptions, "projection" | "processorId" | "version" | "partition">) => string;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/eventStore/projections/locks/tryAcquireProjectionLock.d.ts
|
|
91
109
|
type TryAcquireProjectionLockOptions = {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
projectionName: string;
|
|
111
|
+
partition: string;
|
|
112
|
+
version: number;
|
|
113
|
+
lockKey: string | bigint;
|
|
96
114
|
};
|
|
97
|
-
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/eventStore/projections/locks/postgreSQLProjectionLock.d.ts
|
|
98
117
|
type PostgreSQLProjectionLockOptions = {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
118
|
+
projectionName: string;
|
|
119
|
+
partition: string;
|
|
120
|
+
version: number;
|
|
121
|
+
lockKey?: string | bigint;
|
|
103
122
|
};
|
|
104
123
|
type PostgreSQLProjectionLockContext = {
|
|
105
|
-
|
|
124
|
+
execute: SQLExecutor;
|
|
106
125
|
};
|
|
107
126
|
type PostgreSQLProjectionLock = {
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
tryAcquire: (options: PostgreSQLProjectionLockContext) => Promise<boolean>;
|
|
128
|
+
release: (options: PostgreSQLProjectionLockContext) => void;
|
|
110
129
|
};
|
|
111
130
|
declare const postgreSQLProjectionLock: (options: PostgreSQLProjectionLockOptions) => PostgreSQLProjectionLock;
|
|
112
|
-
declare const toProjectionLockKey: ({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
131
|
+
declare const toProjectionLockKey: ({
|
|
132
|
+
projectionName,
|
|
133
|
+
partition,
|
|
134
|
+
version
|
|
135
|
+
}: Pick<TryAcquireProjectionLockOptions, "projectionName" | "partition" | "version">) => string;
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/eventStore/projections/management/projectionManagement.d.ts
|
|
138
|
+
declare const registerProjection: <ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends ProjectionHandlerContext = ProjectionHandlerContext>(execute: SQLExecutor, options: {
|
|
139
|
+
partition: string;
|
|
140
|
+
status: "active" | "inactive";
|
|
141
|
+
registration: ProjectionRegistration<ProjectionHandlingType, ReadEventMetadataType, HandlerContext>;
|
|
118
142
|
}) => Promise<{
|
|
119
|
-
|
|
143
|
+
registered: boolean;
|
|
120
144
|
}>;
|
|
121
145
|
declare const activateProjection: (execute: SQLExecutor, options: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
146
|
+
name: string;
|
|
147
|
+
partition: string;
|
|
148
|
+
version: number;
|
|
125
149
|
}) => Promise<{
|
|
126
|
-
|
|
150
|
+
activated: boolean;
|
|
127
151
|
}>;
|
|
128
152
|
declare const deactivateProjection: (execute: SQLExecutor, options: {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
153
|
+
name: string;
|
|
154
|
+
partition: string;
|
|
155
|
+
version: number;
|
|
132
156
|
}) => Promise<{
|
|
133
|
-
|
|
157
|
+
deactivated: boolean;
|
|
134
158
|
}>;
|
|
135
159
|
type ProjectionRegistrationWithMandatoryData = ProjectionRegistration<ProjectionHandlingType> & {
|
|
136
|
-
|
|
160
|
+
projection: Required<Pick<ProjectionDefinition, 'kind' | 'version' | 'name'>>;
|
|
137
161
|
};
|
|
138
162
|
type ReadProjectionInfoResult = {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
145
|
-
declare const readProjectionInfo: (execute: SQLExecutor, {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
partition: string;
|
|
164
|
+
status: 'active' | 'inactive';
|
|
165
|
+
registration: ProjectionRegistrationWithMandatoryData;
|
|
166
|
+
createdAt: Date;
|
|
167
|
+
lastUpdated: Date;
|
|
168
|
+
};
|
|
169
|
+
declare const readProjectionInfo: (execute: SQLExecutor, {
|
|
170
|
+
name,
|
|
171
|
+
partition,
|
|
172
|
+
version
|
|
173
|
+
}: {
|
|
174
|
+
name: string;
|
|
175
|
+
partition: string;
|
|
176
|
+
version: number;
|
|
149
177
|
}) => Promise<ReadProjectionInfoResult | null>;
|
|
150
|
-
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/eventStore/projections/pongo/pongoProjections.d.ts
|
|
151
180
|
type PongoProjectionHandlerContext = PostgreSQLProjectionHandlerContext & {
|
|
152
|
-
|
|
181
|
+
pongo: PongoClient;
|
|
153
182
|
};
|
|
154
183
|
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
184
|
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
185
|
type PongoDocumentEvolve<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType> | PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
157
186
|
type PongoProjectionOptions<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
};
|
|
169
|
-
declare const pongoProjection: <EventType extends Event, EventPayloadType extends Event = EventType>({
|
|
187
|
+
name: string;
|
|
188
|
+
kind?: string;
|
|
189
|
+
version?: number;
|
|
190
|
+
handle: (events: ReadEvent<EventType, PostgresReadEventMetadata>[], context: PongoProjectionHandlerContext) => Promise<void>;
|
|
191
|
+
canHandle: CanHandle<EventType>;
|
|
192
|
+
truncate?: TruncateProjection<PongoProjectionHandlerContext>;
|
|
193
|
+
init?: (context: PongoProjectionHandlerContext) => void | Promise<void>;
|
|
194
|
+
eventsOptions?: {
|
|
195
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
196
|
+
};
|
|
197
|
+
} & JSONSerializationOptions;
|
|
198
|
+
declare const pongoProjection: <EventType extends Event, EventPayloadType extends Event = EventType>({
|
|
199
|
+
name,
|
|
200
|
+
kind,
|
|
201
|
+
version,
|
|
202
|
+
truncate,
|
|
203
|
+
handle,
|
|
204
|
+
canHandle,
|
|
205
|
+
eventsOptions
|
|
206
|
+
}: PongoProjectionOptions<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
170
207
|
type PongoMultiStreamProjectionOptions<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType, DocumentPayload extends PongoDocument = Document> = {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
getDocumentId: (event: ReadEvent<EventType>) => string;
|
|
208
|
+
kind?: string;
|
|
209
|
+
canHandle: CanHandle<EventType>;
|
|
210
|
+
version?: number;
|
|
211
|
+
collectionName: string;
|
|
212
|
+
collectionOptions?: PongoDBCollectionOptions<Document, DocumentPayload>;
|
|
213
|
+
eventsOptions?: {
|
|
214
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
215
|
+
};
|
|
180
216
|
} & ({
|
|
181
|
-
|
|
217
|
+
getDocumentId: (event: ReadEvent<EventType>) => string | null;
|
|
218
|
+
getDocumentIds?: never;
|
|
219
|
+
} | {
|
|
220
|
+
getDocumentId?: never;
|
|
221
|
+
getDocumentIds: (event: ReadEvent<EventType>) => string[];
|
|
222
|
+
}) & ({
|
|
223
|
+
evolve: PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
182
224
|
} | {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
});
|
|
225
|
+
evolve: PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
226
|
+
initialState: () => Document;
|
|
227
|
+
}) & JSONSerializationOptions;
|
|
186
228
|
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
229
|
type PongoSingleStreamProjectionOptions<Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType, DocumentPayload extends PongoDocument = Document> = {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
230
|
+
canHandle: CanHandle<EventType>;
|
|
231
|
+
version?: number;
|
|
232
|
+
collectionName: string;
|
|
233
|
+
collectionOptions?: PongoDBCollectionOptions<Document, DocumentPayload>;
|
|
234
|
+
eventsOptions?: {
|
|
235
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
236
|
+
};
|
|
196
237
|
} & ({
|
|
197
|
-
|
|
238
|
+
getDocumentId: (event: ReadEvent<EventType>) => string | null;
|
|
239
|
+
getDocumentIds?: never;
|
|
198
240
|
} | {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
241
|
+
getDocumentId?: never;
|
|
242
|
+
getDocumentIds: (event: ReadEvent<EventType>) => string[];
|
|
243
|
+
} | {
|
|
244
|
+
getDocumentId?: never;
|
|
245
|
+
getDocumentIds?: never;
|
|
246
|
+
}) & ({
|
|
247
|
+
evolve: PongoWithNullableDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
248
|
+
} | {
|
|
249
|
+
evolve: PongoWithNotNullDocumentEvolve<Document, EventType, EventMetaDataType>;
|
|
250
|
+
initialState: () => Document;
|
|
251
|
+
}) & JSONSerializationOptions;
|
|
252
|
+
declare const pongoSingleStreamProjection: <Document extends PongoDocument, EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata, EventPayloadType extends Event = EventType>({
|
|
253
|
+
getDocumentId,
|
|
254
|
+
getDocumentIds,
|
|
255
|
+
...options
|
|
256
|
+
}: PongoSingleStreamProjectionOptions<Document, EventType, EventMetaDataType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/eventStore/projections/pongo/pongoProjectionSpec.d.ts
|
|
204
259
|
type PongoAssertOptions = {
|
|
205
|
-
|
|
206
|
-
|
|
260
|
+
inCollection: string;
|
|
261
|
+
inDatabase?: string;
|
|
207
262
|
};
|
|
208
263
|
type FilterOrId<Doc extends PongoDocument | WithId<PongoDocument>> = {
|
|
209
|
-
|
|
264
|
+
withId: string;
|
|
210
265
|
} | {
|
|
211
|
-
|
|
266
|
+
matchingFilter: PongoFilter<Doc>;
|
|
212
267
|
};
|
|
213
268
|
declare const documentExists: <Doc extends PongoDocument | WithId<PongoDocument>>(document: Doc, options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
214
269
|
declare const documentsAreTheSame: <Doc extends PongoDocument | WithId<PongoDocument>>(documents: Doc[], options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
@@ -216,259 +271,258 @@ declare const documentsMatchingHaveCount: <Doc extends PongoDocument | WithId<Po
|
|
|
216
271
|
declare const documentMatchingExists: <Doc extends PongoDocument | WithId<PongoDocument>>(options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
217
272
|
declare const documentDoesNotExist: <Doc extends PongoDocument | WithId<PongoDocument>>(options: PongoAssertOptions & FilterOrId<Doc>) => PostgreSQLProjectionAssert;
|
|
218
273
|
declare const expectPongoDocuments: {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
};
|
|
274
|
+
fromCollection: <Doc extends PongoDocument | WithId<PongoDocument>>(collectionName: string) => {
|
|
275
|
+
withId: (id: string) => {
|
|
276
|
+
toBeEqual: (document: Doc) => PostgreSQLProjectionAssert;
|
|
277
|
+
toExist: () => PostgreSQLProjectionAssert;
|
|
278
|
+
notToExist: () => PostgreSQLProjectionAssert;
|
|
231
279
|
};
|
|
280
|
+
matching: <Doc_1 extends PongoDocument | WithId<PongoDocument>>(filter: PongoFilter<Doc_1>) => {
|
|
281
|
+
toBeTheSame: (documents: Doc_1[]) => PostgreSQLProjectionAssert;
|
|
282
|
+
toHaveCount: (expectedCount: number) => PostgreSQLProjectionAssert;
|
|
283
|
+
toExist: () => PostgreSQLProjectionAssert;
|
|
284
|
+
notToExist: () => PostgreSQLProjectionAssert;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
232
287
|
};
|
|
233
|
-
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/eventStore/projections/postgresProjectionSpec.d.ts
|
|
234
290
|
type PostgreSQLProjectionSpecEvent<EventType extends Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = EventType & {
|
|
235
|
-
|
|
291
|
+
metadata?: Partial<EventMetaDataType>;
|
|
236
292
|
};
|
|
237
293
|
type PostgreSQLProjectionSpecWhenOptions = {
|
|
238
|
-
|
|
294
|
+
numberOfTimes: number;
|
|
295
|
+
};
|
|
296
|
+
type PostgreSQLProjectionSpec<EventType extends Event> = (givenEvents: PostgreSQLProjectionSpecEvent<EventType>[]) => {
|
|
297
|
+
when: (events: PostgreSQLProjectionSpecEvent<EventType>[], options?: PostgreSQLProjectionSpecWhenOptions) => {
|
|
298
|
+
then: (assert: PostgreSQLProjectionAssert, message?: string) => Promise<void>;
|
|
299
|
+
thenThrows: <ErrorType extends Error = Error>(...args: Parameters<ThenThrows<ErrorType>>) => Promise<void>;
|
|
300
|
+
};
|
|
239
301
|
};
|
|
240
302
|
type PostgreSQLProjectionAssert = (options: {
|
|
241
|
-
|
|
242
|
-
|
|
303
|
+
pool: Dumbo;
|
|
304
|
+
connectionString: string;
|
|
243
305
|
}) => Promise<void | boolean>;
|
|
244
306
|
type PostgreSQLProjectionSpecOptions<EventType extends Event> = {
|
|
245
|
-
|
|
307
|
+
projection: PostgreSQLProjectionDefinition<EventType>;
|
|
246
308
|
} & 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
309
|
declare const PostgreSQLProjectionSpec: {
|
|
254
|
-
|
|
310
|
+
for: <EventType extends Event>(options: PostgreSQLProjectionSpecOptions<EventType>) => PostgreSQLProjectionSpec<EventType>;
|
|
255
311
|
};
|
|
256
312
|
declare const eventInStream: <EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata>(streamName: string, event: PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>) => PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>;
|
|
257
313
|
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 =
|
|
314
|
+
declare const newEventsInStream: <EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = _$_event_driven_io_emmett0.RecordedMessageMetadataWithGlobalPosition>(streamName: string, events: PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[]) => PostgreSQLProjectionSpecEvent<EventType, EventMetaDataType>[];
|
|
259
315
|
declare const assertSQLQueryResultMatches: <T extends QueryResultRow>(sql: SQL, rows: T[]) => PostgreSQLProjectionAssert;
|
|
260
316
|
declare const expectSQL: {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
declare const emmettPrefix = "emt";
|
|
269
|
-
declare const globalTag = "global";
|
|
270
|
-
declare const defaultTag = "emt:default";
|
|
271
|
-
declare const unknownTag = "emt:unknown";
|
|
272
|
-
declare const globalNames: {
|
|
273
|
-
module: string;
|
|
274
|
-
tenant: string;
|
|
275
|
-
};
|
|
276
|
-
declare const streamsTable: {
|
|
277
|
-
name: string;
|
|
278
|
-
columns: {
|
|
279
|
-
partition: {
|
|
280
|
-
name: string;
|
|
281
|
-
};
|
|
282
|
-
isArchived: {
|
|
283
|
-
name: string;
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
declare const messagesTable: {
|
|
288
|
-
name: string;
|
|
289
|
-
columns: {
|
|
290
|
-
partition: {
|
|
291
|
-
name: string;
|
|
292
|
-
};
|
|
293
|
-
isArchived: {
|
|
294
|
-
name: string;
|
|
295
|
-
};
|
|
317
|
+
query: (sql: SQL) => {
|
|
318
|
+
resultRows: {
|
|
319
|
+
toBeTheSame: <T extends QueryResultRow>(rows: T[]) => PostgreSQLProjectionAssert;
|
|
296
320
|
};
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region src/eventStore/schema/readMessagesBatch.d.ts
|
|
325
|
+
declare const PostgreSQLEventStoreCheckpoint: {
|
|
326
|
+
default: {
|
|
327
|
+
transactionId: bigint;
|
|
328
|
+
globalPosition: bigint;
|
|
329
|
+
};
|
|
330
|
+
parse: (checkPoint: ProcessorCheckpoint | undefined | null) => PostgreSQLEventStoreCheckpoint;
|
|
331
|
+
toProcessorCheckpoint: (checkPoint: PostgreSQLEventStoreCheckpoint) => ProcessorCheckpoint;
|
|
332
|
+
};
|
|
333
|
+
type PostgreSQLEventStoreCheckpoint = {
|
|
334
|
+
transactionId: bigint;
|
|
335
|
+
globalPosition: bigint;
|
|
297
336
|
};
|
|
298
|
-
|
|
299
|
-
|
|
337
|
+
type ReadMessagesBatchOptions = {
|
|
338
|
+
after: PostgreSQLEventStoreCheckpoint;
|
|
339
|
+
batchSize: number;
|
|
340
|
+
} | {
|
|
341
|
+
from: PostgreSQLEventStoreCheckpoint;
|
|
342
|
+
batchSize: number;
|
|
343
|
+
} | {
|
|
344
|
+
to: PostgreSQLEventStoreCheckpoint;
|
|
345
|
+
batchSize: number;
|
|
346
|
+
} | {
|
|
347
|
+
from: PostgreSQLEventStoreCheckpoint;
|
|
348
|
+
to: PostgreSQLEventStoreCheckpoint;
|
|
300
349
|
};
|
|
301
|
-
|
|
302
|
-
|
|
350
|
+
type ReadMessagesBatchResult<MessageType extends Message, MessageMetadataType extends RecordedMessageMetadata = RecordedMessageMetadata> = {
|
|
351
|
+
currentCheckpoint: PostgreSQLEventStoreCheckpoint;
|
|
352
|
+
messages: RecordedMessage<MessageType, MessageMetadataType>[];
|
|
353
|
+
areMessagesLeft: boolean;
|
|
303
354
|
};
|
|
304
|
-
|
|
355
|
+
declare const readMessagesBatch: <MessageType extends Message, RecordedMessageMetadataType extends RecordedMessageMetadataWithGlobalPosition = RecordedMessageMetadataWithGlobalPosition>(execute: SQLExecutor, options: ReadMessagesBatchOptions & {
|
|
356
|
+
partition?: string;
|
|
357
|
+
}) => Promise<ReadMessagesBatchResult<MessageType, RecordedMessageMetadataType>>;
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/eventStore/schema/appendToStream.d.ts
|
|
305
360
|
declare const appendToStreamSQL: SQL;
|
|
306
361
|
type CallAppendToStreamParams = {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
362
|
+
messageIds: string[];
|
|
363
|
+
messagesData: DefaultRecord[];
|
|
364
|
+
messagesMetadata: DefaultRecord[];
|
|
365
|
+
schemaVersions: string[];
|
|
366
|
+
messageTypes: string[];
|
|
367
|
+
messageKinds: string[];
|
|
368
|
+
streamId: string;
|
|
369
|
+
streamType: string;
|
|
370
|
+
expectedStreamPosition: bigint | null;
|
|
371
|
+
partition: string;
|
|
317
372
|
};
|
|
318
373
|
declare const callAppendToStream: (params: CallAppendToStreamParams) => SQL;
|
|
319
374
|
type AppendToStreamResult = {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
transactionId: string;
|
|
375
|
+
success: true;
|
|
376
|
+
nextStreamPosition: bigint;
|
|
377
|
+
checkpoints: PostgreSQLEventStoreCheckpoint[];
|
|
324
378
|
} | {
|
|
325
|
-
|
|
379
|
+
success: false;
|
|
326
380
|
};
|
|
327
381
|
type AppendToStreamBeforeCommitHook = (messages: RecordedMessage[], context: {
|
|
328
|
-
|
|
382
|
+
transaction: PgTransaction;
|
|
329
383
|
}) => Promise<void>;
|
|
330
|
-
declare const appendToStream: (
|
|
331
|
-
|
|
332
|
-
|
|
384
|
+
declare const appendToStream: (connection: PgConnection, streamName: string, streamType: string, messages: Message[], options?: AppendToStreamOptions & {
|
|
385
|
+
partition?: string;
|
|
386
|
+
beforeCommitHook?: AppendToStreamBeforeCommitHook;
|
|
333
387
|
}) => Promise<AppendToStreamResult>;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
388
|
+
type AppendToStreamSqlResult = {
|
|
389
|
+
success: boolean;
|
|
390
|
+
next_stream_position: string | null;
|
|
391
|
+
global_positions: string[] | null;
|
|
392
|
+
transaction_id: string | null | undefined;
|
|
393
|
+
};
|
|
394
|
+
declare const appentToStreamRaw: (execute: SQLExecutor, streamId: string, streamType: string, messages: RecordedMessage[], options?: {
|
|
395
|
+
expectedStreamVersion: bigint | null;
|
|
396
|
+
partition?: string;
|
|
397
|
+
}) => Promise<AppendToStreamSqlResult>;
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/eventStore/schema/migrations/index.d.ts
|
|
400
|
+
declare const currentPostgreSQLEventStoreSchemaVersion = "0.43.0";
|
|
401
|
+
declare const pastEventStoreSchemaMigrations: SQLMigration[];
|
|
402
|
+
declare const eventStoreSchemaMigrations: SQLMigration[];
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/eventStore/schema/processors/processorsLocks.d.ts
|
|
337
405
|
declare const tryAcquireProcessorLockSQL: SQL;
|
|
338
406
|
declare const releaseProcessorLockSQL: SQL;
|
|
339
407
|
type CallTryAcquireProcessorLockParams = {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
408
|
+
lockKey: string;
|
|
409
|
+
processorId: string;
|
|
410
|
+
version: number;
|
|
411
|
+
partition: string;
|
|
412
|
+
processorInstanceId: string;
|
|
413
|
+
projectionName: string | null;
|
|
414
|
+
projectionType: 'i' | 'a' | null;
|
|
415
|
+
projectionKind: string | null;
|
|
416
|
+
lockTimeoutSeconds: number;
|
|
349
417
|
};
|
|
350
418
|
declare const callTryAcquireProcessorLock: (params: CallTryAcquireProcessorLockParams) => SQL;
|
|
351
419
|
type CallReleaseProcessorLockParams = {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
420
|
+
lockKey: string;
|
|
421
|
+
processorId: string;
|
|
422
|
+
partition: string;
|
|
423
|
+
version: number;
|
|
424
|
+
processorInstanceId: string;
|
|
425
|
+
projectionName: string | null;
|
|
358
426
|
};
|
|
359
427
|
declare const callReleaseProcessorLock: (params: CallReleaseProcessorLockParams) => SQL;
|
|
360
|
-
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/eventStore/schema/projections/projectionsLocks.d.ts
|
|
361
430
|
declare const tryAcquireProjectionLockSQL: SQL;
|
|
362
431
|
type CallTryAcquireProjectionLockParams = {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
432
|
+
lockKey: string;
|
|
433
|
+
partition: string;
|
|
434
|
+
name: string;
|
|
435
|
+
version: number;
|
|
367
436
|
};
|
|
368
437
|
declare const callTryAcquireProjectionLock: (params: CallTryAcquireProjectionLockParams) => SQL;
|
|
369
|
-
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/eventStore/schema/projections/registerProjection.d.ts
|
|
370
440
|
declare const registerProjectionSQL: SQL;
|
|
371
441
|
declare const activateProjectionSQL: SQL;
|
|
372
442
|
declare const deactivateProjectionSQL: SQL;
|
|
373
443
|
type CallRegisterProjectionParams = {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
444
|
+
lockKey: string;
|
|
445
|
+
name: string;
|
|
446
|
+
partition: string;
|
|
447
|
+
version: number;
|
|
448
|
+
type: 'i' | 'a';
|
|
449
|
+
kind: string;
|
|
450
|
+
status: string;
|
|
451
|
+
definition: string;
|
|
382
452
|
};
|
|
383
453
|
declare const callRegisterProjection: (params: CallRegisterProjectionParams) => SQL;
|
|
384
454
|
type CallActivateProjectionParams = {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
455
|
+
lockKey: string;
|
|
456
|
+
name: string;
|
|
457
|
+
partition: string;
|
|
458
|
+
version: number;
|
|
389
459
|
};
|
|
390
460
|
declare const callActivateProjection: (params: CallActivateProjectionParams) => SQL;
|
|
391
461
|
type CallDeactivateProjectionParams = {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
462
|
+
lockKey: string;
|
|
463
|
+
name: string;
|
|
464
|
+
partition: string;
|
|
465
|
+
version: number;
|
|
396
466
|
};
|
|
397
467
|
declare const callDeactivateProjection: (params: CallDeactivateProjectionParams) => SQL;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
batchSize: number;
|
|
409
|
-
} | {
|
|
410
|
-
from: bigint;
|
|
411
|
-
batchSize: number;
|
|
412
|
-
} | {
|
|
413
|
-
to: bigint;
|
|
414
|
-
batchSize: number;
|
|
415
|
-
} | {
|
|
416
|
-
from: bigint;
|
|
417
|
-
to: bigint;
|
|
418
|
-
};
|
|
419
|
-
type ReadMessagesBatchResult<MessageType extends Message, MessageMetadataType extends RecordedMessageMetadata = RecordedMessageMetadata> = {
|
|
420
|
-
currentGlobalPosition: bigint;
|
|
421
|
-
messages: RecordedMessage<MessageType, MessageMetadataType>[];
|
|
422
|
-
areMessagesLeft: boolean;
|
|
423
|
-
};
|
|
424
|
-
declare const readMessagesBatch: <MessageType extends Message, RecordedMessageMetadataType extends RecordedMessageMetadataWithGlobalPosition = RecordedMessageMetadataWithGlobalPosition>(execute: SQLExecutor, options: ReadMessagesBatchOptions & {
|
|
425
|
-
partition?: string;
|
|
426
|
-
}) => Promise<ReadMessagesBatchResult<MessageType, RecordedMessageMetadataType>>;
|
|
427
|
-
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region src/eventStore/schema/readLastMessageCheckpoint.d.ts
|
|
470
|
+
type ReadLastMessageCheckpointResult = {
|
|
471
|
+
currentCheckpoint: PostgreSQLEventStoreCheckpoint | null;
|
|
472
|
+
};
|
|
473
|
+
declare const readLastMessageCheckpoint: (execute: SQLExecutor, options?: {
|
|
474
|
+
partition?: string;
|
|
475
|
+
}) => Promise<ReadLastMessageCheckpointResult>;
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/eventStore/schema/readProcessorCheckpoint.d.ts
|
|
428
478
|
type ReadProcessorCheckpointResult = {
|
|
429
|
-
|
|
479
|
+
lastProcessedCheckpoint: ProcessorCheckpoint | null;
|
|
430
480
|
};
|
|
431
481
|
declare const readProcessorCheckpoint: (execute: SQLExecutor, options: {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
482
|
+
processorId: string;
|
|
483
|
+
partition?: string;
|
|
484
|
+
version?: number;
|
|
435
485
|
}) => Promise<ReadProcessorCheckpointResult>;
|
|
436
|
-
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/eventStore/schema/readStream.d.ts
|
|
437
488
|
declare const readStream: <EventType extends Event, EventPayloadType extends Event = EventType>(execute: SQLExecutor, streamId: string, options?: ReadStreamOptions<EventType, EventPayloadType> & {
|
|
438
|
-
|
|
489
|
+
partition?: string;
|
|
439
490
|
}) => Promise<ReadStreamResult<EventType, ReadEventMetadataWithGlobalPosition>>;
|
|
440
|
-
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/eventStore/schema/storeProcessorCheckpoint.d.ts
|
|
441
493
|
declare const storeSubscriptionCheckpointSQL: SQL;
|
|
442
494
|
type CallStoreProcessorCheckpointParams = {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
495
|
+
processorId: string;
|
|
496
|
+
version: number;
|
|
497
|
+
position: string | null;
|
|
498
|
+
checkPosition: string | null;
|
|
499
|
+
partition: string;
|
|
500
|
+
processorInstanceId: string;
|
|
449
501
|
};
|
|
450
502
|
declare const callStoreProcessorCheckpoint: (params: CallStoreProcessorCheckpointParams) => SQL;
|
|
451
503
|
type StoreProcessorCheckpointResult = {
|
|
452
|
-
|
|
453
|
-
|
|
504
|
+
success: true;
|
|
505
|
+
newCheckpoint: ProcessorCheckpoint | null;
|
|
454
506
|
} | {
|
|
455
|
-
|
|
456
|
-
|
|
507
|
+
success: false;
|
|
508
|
+
reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
|
|
457
509
|
};
|
|
458
510
|
declare const storeProcessorCheckpoint: (execute: SQLExecutor, options: {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
511
|
+
processorId: string;
|
|
512
|
+
version: number | undefined;
|
|
513
|
+
newCheckpoint: ProcessorCheckpoint | null;
|
|
514
|
+
lastProcessedCheckpoint: ProcessorCheckpoint | null;
|
|
515
|
+
partition?: string;
|
|
516
|
+
processorInstanceId?: string;
|
|
465
517
|
}) => Promise<StoreProcessorCheckpointResult>;
|
|
466
|
-
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/eventStore/schema/streamExists.d.ts
|
|
467
520
|
type PostgresStreamExistsOptions = {
|
|
468
|
-
|
|
521
|
+
partition: string;
|
|
469
522
|
};
|
|
470
523
|
declare const streamExists: (execute: SQLExecutor, streamId: string, options?: PostgresStreamExistsOptions) => Promise<StreamExistsResult>;
|
|
471
|
-
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region src/eventStore/schema/tables.d.ts
|
|
472
526
|
declare const streamsTableSQL: SQL;
|
|
473
527
|
declare const messagesTableSQL: SQL;
|
|
474
528
|
declare const processorsTableSQL: SQL;
|
|
@@ -481,263 +535,267 @@ declare const addTenantSQL: SQL;
|
|
|
481
535
|
declare const addModuleForAllTenantsSQL: SQL;
|
|
482
536
|
declare const addTenantForAllModulesSQL: SQL;
|
|
483
537
|
declare const addDefaultPartitionSQL: SQL;
|
|
484
|
-
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/eventStore/schema/index.d.ts
|
|
485
540
|
declare const schemaSQL: SQL[];
|
|
486
|
-
declare const schemaMigration: SQLMigration;
|
|
487
|
-
declare const eventStoreSchemaMigrations: SQLMigration[];
|
|
541
|
+
declare const schemaMigration: _$_event_driven_io_dumbo0.SQLMigration;
|
|
488
542
|
type CreateEventStoreSchemaOptions = {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
};
|
|
543
|
+
dryRun?: boolean | undefined;
|
|
544
|
+
ignoreMigrationHashMismatch?: boolean | undefined;
|
|
545
|
+
migrationTimeoutMs?: number | undefined;
|
|
546
|
+
} & JSONSerializationOptions;
|
|
493
547
|
type EventStoreSchemaMigrationOptions = {
|
|
494
|
-
|
|
548
|
+
migrationOptions?: CreateEventStoreSchemaOptions;
|
|
495
549
|
};
|
|
496
550
|
declare const createEventStoreSchema: (connectionString: string, pool: PgPool, hooks?: PostgresEventStoreOptions["hooks"], options?: CreateEventStoreSchemaOptions) => Promise<RunSQLMigrationsResult>;
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/eventStore/projections/postgreSQLProjection.d.ts
|
|
553
|
+
type PostgreSQLProjectionHandlerContext = ProjectionHandlerContext<{
|
|
554
|
+
execute: SQLExecutor;
|
|
555
|
+
connection: {
|
|
556
|
+
connectionString: string;
|
|
557
|
+
client: PgClient;
|
|
558
|
+
transaction: PgTransaction;
|
|
559
|
+
pool: Dumbo;
|
|
560
|
+
};
|
|
561
|
+
} & EventStoreSchemaMigrationOptions>;
|
|
507
562
|
declare const transactionToPostgreSQLProjectionHandlerContext: (connectionString: string, pool: Dumbo, transaction: PgTransaction | DatabaseTransaction<AnyConnection>) => Promise<PostgreSQLProjectionHandlerContext>;
|
|
508
563
|
type PostgreSQLProjectionHandler<EventType extends Event = Event, EventMetaDataType extends PostgresReadEventMetadata = PostgresReadEventMetadata> = ProjectionHandler<EventType, EventMetaDataType, PostgreSQLProjectionHandlerContext>;
|
|
509
564
|
type PostgreSQLProjectionDefinition<EventType extends Event = Event, EventPayloadType extends Event = EventType> = ProjectionDefinition<EventType, PostgresReadEventMetadata, PostgreSQLProjectionHandlerContext, EventPayloadType>;
|
|
510
565
|
type PostgreSQLProjectionHandlerOptions<EventType extends Event = Event> = {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
566
|
+
events: ReadEvent<EventType, PostgresReadEventMetadata>[];
|
|
567
|
+
projections: PostgreSQLProjectionDefinition<EventType>[];
|
|
568
|
+
partition?: string;
|
|
514
569
|
} & PostgreSQLProjectionHandlerContext;
|
|
515
570
|
declare const handleProjections: <EventType extends Event = Event>(options: PostgreSQLProjectionHandlerOptions<EventType>) => Promise<void>;
|
|
516
571
|
declare const postgreSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(definition: PostgreSQLProjectionDefinition<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
517
572
|
type PostgreSQLRawBatchSQLProjection<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
};
|
|
573
|
+
name: string;
|
|
574
|
+
kind?: string;
|
|
575
|
+
version?: number;
|
|
576
|
+
evolve: (events: EventType[], context: PostgreSQLProjectionHandlerContext) => Promise<SQL[]> | SQL[];
|
|
577
|
+
canHandle: CanHandle<EventType>;
|
|
578
|
+
init?: (context: ProjectionInitOptions<PostgreSQLProjectionHandlerContext>) => void | Promise<void> | SQL | Promise<SQL> | Promise<SQL[]> | SQL[];
|
|
579
|
+
eventsOptions?: {
|
|
580
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
581
|
+
};
|
|
582
|
+
} & JSONSerializationOptions;
|
|
528
583
|
declare const postgreSQLRawBatchSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(options: PostgreSQLRawBatchSQLProjection<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
529
584
|
type PostgreSQLRawSQLProjection<EventType extends Event, EventPayloadType extends Event = EventType> = {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
};
|
|
585
|
+
name: string;
|
|
586
|
+
kind?: string;
|
|
587
|
+
version?: number;
|
|
588
|
+
evolve: (events: EventType, context: PostgreSQLProjectionHandlerContext) => Promise<SQL[]> | SQL[] | Promise<SQL> | SQL;
|
|
589
|
+
canHandle: CanHandle<EventType>;
|
|
590
|
+
init?: (context: ProjectionInitOptions<PostgreSQLProjectionHandlerContext>) => void | Promise<void> | SQL | Promise<SQL> | Promise<SQL[]> | SQL[];
|
|
591
|
+
eventsOptions?: {
|
|
592
|
+
schema?: EventStoreReadSchemaOptions<EventType, EventPayloadType>;
|
|
593
|
+
};
|
|
594
|
+
} & JSONSerializationOptions;
|
|
540
595
|
declare const postgreSQLRawSQLProjection: <EventType extends Event, EventPayloadType extends Event = EventType>(options: PostgreSQLRawSQLProjection<EventType, EventPayloadType>) => PostgreSQLProjectionDefinition<EventType, EventPayloadType>;
|
|
541
|
-
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region src/eventStore/postgreSQLEventStore.d.ts
|
|
542
598
|
interface PostgresEventStore extends EventStore<PostgresReadEventMetadata>, EventStoreSessionFactory<PostgresEventStore> {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
};
|
|
599
|
+
appendToStream<EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, events: EventType[], options?: AppendToStreamOptions<EventType, EventPayloadType>): Promise<AppendToStreamResultWithGlobalPosition>;
|
|
600
|
+
consumer<ConsumerEventType extends Event = Event>(options?: PostgreSQLEventStoreConsumerConfig<ConsumerEventType>): PostgreSQLEventStoreConsumer<ConsumerEventType>;
|
|
601
|
+
close(): Promise<void>;
|
|
602
|
+
streamExists(streamName: string, options?: PostgresStreamExistsOptions): Promise<StreamExistsResult>;
|
|
603
|
+
schema: {
|
|
604
|
+
sql(): string;
|
|
605
|
+
print(): void;
|
|
606
|
+
migrate(options?: CreateEventStoreSchemaOptions): Promise<RunSQLMigrationsResult>;
|
|
607
|
+
dangerous: {
|
|
608
|
+
truncate(options?: {
|
|
609
|
+
resetSequences?: boolean;
|
|
610
|
+
truncateProjections?: boolean;
|
|
611
|
+
}): Promise<void>;
|
|
557
612
|
};
|
|
613
|
+
};
|
|
558
614
|
}
|
|
559
615
|
type PostgresReadEventMetadata = ReadEventMetadataWithGlobalPosition;
|
|
560
616
|
type PostgresReadEvent<EventType extends Event = Event> = ReadEvent<EventType, PostgresReadEventMetadata>;
|
|
561
617
|
type PostgresEventStorePooledOptions = {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
618
|
+
connector?: PgDriverType;
|
|
619
|
+
connectionString?: string;
|
|
620
|
+
database?: string;
|
|
621
|
+
pooled: true;
|
|
622
|
+
pool: pg.Pool;
|
|
567
623
|
} | {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
624
|
+
connector?: PgDriverType;
|
|
625
|
+
connectionString?: string;
|
|
626
|
+
database?: string;
|
|
627
|
+
pool: pg.Pool;
|
|
572
628
|
} | {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
629
|
+
connector?: PgDriverType;
|
|
630
|
+
connectionString?: string;
|
|
631
|
+
database?: string;
|
|
632
|
+
pooled: true;
|
|
577
633
|
} | {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
634
|
+
connector?: PgDriverType;
|
|
635
|
+
connectionString?: string;
|
|
636
|
+
database?: string;
|
|
581
637
|
};
|
|
582
638
|
type PostgresEventStoreNotPooledOptions = {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
639
|
+
connector?: PgDriverType;
|
|
640
|
+
connectionString?: string;
|
|
641
|
+
database?: string;
|
|
642
|
+
pooled: false;
|
|
643
|
+
client: pg.Client;
|
|
588
644
|
} | {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
645
|
+
connector?: PgDriverType;
|
|
646
|
+
connectionString?: string;
|
|
647
|
+
database?: string;
|
|
648
|
+
client: pg.Client;
|
|
593
649
|
} | {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
650
|
+
connector?: PgDriverType;
|
|
651
|
+
connectionString?: string;
|
|
652
|
+
database?: string;
|
|
653
|
+
pooled: false;
|
|
598
654
|
} | {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
655
|
+
connector?: PgDriverType;
|
|
656
|
+
connectionString?: string;
|
|
657
|
+
database?: string;
|
|
658
|
+
connection: PgPoolClientConnection | PgClientConnection;
|
|
659
|
+
pooled?: false;
|
|
604
660
|
} | {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
661
|
+
connector?: PgDriverType;
|
|
662
|
+
connectionString?: string;
|
|
663
|
+
database?: string;
|
|
664
|
+
dumbo: PgPool;
|
|
665
|
+
pooled?: false;
|
|
610
666
|
};
|
|
611
667
|
type PostgresEventStoreConnectionOptions = PostgresEventStorePooledOptions | PostgresEventStoreNotPooledOptions;
|
|
612
668
|
type PostgresEventStoreOptions = {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
};
|
|
669
|
+
projections?: ProjectionRegistration<'inline', PostgresReadEventMetadata, PostgreSQLProjectionHandlerContext>[];
|
|
670
|
+
schema?: {
|
|
671
|
+
autoMigration?: MigrationStyle;
|
|
672
|
+
};
|
|
673
|
+
connectionOptions?: PostgresEventStoreConnectionOptions;
|
|
674
|
+
hooks?: {
|
|
675
|
+
/**
|
|
676
|
+
* This hook will be called **BEFORE** event store schema is created
|
|
677
|
+
*/
|
|
678
|
+
onBeforeSchemaCreated?: (context: PostgreSQLProjectionHandlerContext) => Promise<void> | void;
|
|
679
|
+
/**
|
|
680
|
+
* This hook will be called **AFTER** event store schema was created but before transaction commits
|
|
681
|
+
*/
|
|
682
|
+
onAfterSchemaCreated?: (context: PostgreSQLProjectionHandlerContext) => Promise<void> | void;
|
|
683
|
+
};
|
|
684
|
+
} & JSONSerializationOptions;
|
|
629
685
|
declare const defaultPostgreSQLOptions: PostgresEventStoreOptions;
|
|
630
686
|
declare const PostgreSQLEventStoreDefaultStreamVersion = 0n;
|
|
631
687
|
declare const getPostgreSQLEventStore: (connectionString: string, options?: PostgresEventStoreOptions) => PostgresEventStore;
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
688
|
+
//#endregion
|
|
689
|
+
//#region src/eventStore/consumers/postgreSQLProcessor.d.ts
|
|
690
|
+
type PostgreSQLProcessorHandlerContext = MessageHandlerContext<{
|
|
691
|
+
partition: string;
|
|
692
|
+
execute: SQLExecutor;
|
|
693
|
+
connection: {
|
|
694
|
+
connectionString: string;
|
|
695
|
+
client: PgClient;
|
|
696
|
+
transaction: PgTransaction;
|
|
697
|
+
pool: Dumbo;
|
|
698
|
+
messageStore: PostgresEventStore;
|
|
699
|
+
};
|
|
700
|
+
} & EventStoreSchemaMigrationOptions>;
|
|
644
701
|
type PostgreSQLProcessor<MessageType extends Message = AnyMessage> = MessageProcessor<MessageType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext>;
|
|
645
702
|
type PostgreSQLProcessorEachMessageHandler<MessageType extends Message = Message> = SingleRecordedMessageHandlerWithContext<MessageType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext>;
|
|
646
703
|
type PostgreSQLProcessorEachBatchHandler<MessageType extends Message = Message> = BatchRecordedMessageHandlerWithContext<MessageType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext>;
|
|
647
704
|
type PostgreSQLProcessorStartFrom = PostgreSQLEventStoreMessageBatchPullerStartFrom | 'CURRENT';
|
|
648
705
|
type PostgreSQLProcessorPooledOptions = {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
706
|
+
connector?: PgDriverType;
|
|
707
|
+
database?: string;
|
|
708
|
+
pooled: true;
|
|
709
|
+
pool: pg.Pool;
|
|
653
710
|
} | {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
711
|
+
connector?: PgDriverType;
|
|
712
|
+
database?: string;
|
|
713
|
+
pool: pg.Pool;
|
|
657
714
|
} | {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
715
|
+
connector?: PgDriverType;
|
|
716
|
+
database?: string;
|
|
717
|
+
pooled: true;
|
|
661
718
|
} | {
|
|
662
|
-
|
|
663
|
-
|
|
719
|
+
connector?: PgDriverType;
|
|
720
|
+
database?: string;
|
|
664
721
|
};
|
|
665
722
|
type PostgreSQLProcessorNotPooledOptions = {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
723
|
+
connector?: PgDriverType;
|
|
724
|
+
database?: string;
|
|
725
|
+
pooled: false;
|
|
726
|
+
client: pg.Client;
|
|
670
727
|
} | {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
728
|
+
connector?: PgDriverType;
|
|
729
|
+
database?: string;
|
|
730
|
+
client: pg.Client;
|
|
674
731
|
} | {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
732
|
+
connector?: PgDriverType;
|
|
733
|
+
database?: string;
|
|
734
|
+
pooled: false;
|
|
678
735
|
} | {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
736
|
+
connector?: PgDriverType;
|
|
737
|
+
database?: string;
|
|
738
|
+
connection: PgPoolClientConnection | PgClientConnection;
|
|
739
|
+
pooled?: false;
|
|
683
740
|
} | {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
741
|
+
connector?: PgDriverType;
|
|
742
|
+
database?: string;
|
|
743
|
+
dumbo: PgPool;
|
|
744
|
+
pooled?: false;
|
|
688
745
|
};
|
|
689
746
|
type PostgreSQLProcessorConnectionOptions = {
|
|
690
|
-
|
|
747
|
+
connectionString: string;
|
|
691
748
|
} & (PostgreSQLProcessorPooledOptions | PostgreSQLProcessorNotPooledOptions);
|
|
692
749
|
type PostgreSQLCheckpointer<MessageType extends AnyMessage = AnyMessage> = Checkpointer<MessageType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext>;
|
|
693
750
|
declare const postgreSQLCheckpointer: <MessageType extends Message = Message>() => PostgreSQLCheckpointer<MessageType>;
|
|
694
751
|
type PostgreSQLConnectionOptions = {
|
|
695
|
-
|
|
696
|
-
};
|
|
752
|
+
connectionOptions?: PostgreSQLProcessorConnectionOptions;
|
|
753
|
+
} & JSONSerializationOptions;
|
|
697
754
|
type PostgreSQLProcessorOptionsBase = PostgreSQLConnectionOptions & {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
755
|
+
lock?: {
|
|
756
|
+
acquisitionPolicy?: LockAcquisitionPolicy;
|
|
757
|
+
timeoutSeconds?: number;
|
|
758
|
+
};
|
|
759
|
+
partition?: string;
|
|
703
760
|
};
|
|
704
761
|
type PostgreSQLReactorOptions<MessageType extends Message = Message, MessagePayloadType extends AnyMessage = MessageType> = ReactorOptions<MessageType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext, MessagePayloadType> & PostgreSQLProcessorOptionsBase;
|
|
705
762
|
type PostgreSQLProjectorOptions<EventType extends AnyEvent = AnyEvent, EventPayloadType extends Event = EventType> = ProjectorOptions<EventType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext, EventPayloadType> & PostgreSQLProcessorOptionsBase & EventStoreSchemaMigrationOptions;
|
|
706
763
|
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
|
-
type PostgreSQLProcessorOptions<MessageType extends AnyMessage = AnyMessage, MessagePayloadType extends AnyMessage = MessageType> = PostgreSQLReactorOptions<MessageType, MessagePayloadType> | PostgreSQLProjectorOptions<MessageType & AnyEvent, MessagePayloadType & AnyEvent>;
|
|
708
764
|
declare const postgreSQLProjector: <EventType extends Event = Event, EventPayloadType extends Event = EventType>(options: PostgreSQLProjectorOptions<EventType, EventPayloadType>) => PostgreSQLProcessor<EventType>;
|
|
709
765
|
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>;
|
|
710
766
|
declare const postgreSQLReactor: <MessageType extends Message = Message, MessagePayloadType extends AnyMessage = MessageType>(options: PostgreSQLReactorOptions<MessageType, MessagePayloadType>) => PostgreSQLProcessor<MessageType>;
|
|
711
|
-
|
|
767
|
+
//#endregion
|
|
768
|
+
//#region src/eventStore/consumers/postgreSQLEventStoreConsumer.d.ts
|
|
712
769
|
type PostgreSQLEventStoreConsumerConfig<ConsumerMessageType extends Message = any> = MessageConsumerOptions<ConsumerMessageType> & {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
};
|
|
770
|
+
stopWhen?: {
|
|
771
|
+
noMessagesLeft?: boolean;
|
|
772
|
+
};
|
|
773
|
+
pulling?: {
|
|
774
|
+
batchSize?: number;
|
|
775
|
+
pullingFrequencyInMs?: number;
|
|
776
|
+
};
|
|
777
|
+
} & JSONSerializationOptions;
|
|
721
778
|
type PostgreSQLEventStoreConsumerOptions<ConsumerMessageType extends Message = Message> = PostgreSQLEventStoreConsumerConfig<ConsumerMessageType> & {
|
|
722
|
-
|
|
723
|
-
|
|
779
|
+
connectionString: string;
|
|
780
|
+
pool?: Dumbo;
|
|
724
781
|
};
|
|
725
782
|
type PostgreSQLEventStoreConsumer<ConsumerMessageType extends AnyMessage = any> = MessageConsumer<ConsumerMessageType> & Readonly<{
|
|
726
|
-
|
|
727
|
-
|
|
783
|
+
reactor: <MessageType extends AnyMessage = ConsumerMessageType>(options: PostgreSQLReactorOptions<MessageType>) => PostgreSQLProcessor<MessageType>;
|
|
784
|
+
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>;
|
|
728
785
|
}> & (AnyEvent extends ConsumerMessageType ? Readonly<{
|
|
729
|
-
|
|
786
|
+
projector: <EventType extends AnyEvent = ConsumerMessageType & AnyEvent>(options: PostgreSQLProjectorOptions<EventType>) => PostgreSQLProcessor<EventType>;
|
|
730
787
|
}> : object);
|
|
731
788
|
declare const postgreSQLEventStoreConsumer: <ConsumerMessageType extends Message = AnyMessage>(options: PostgreSQLEventStoreConsumerOptions<ConsumerMessageType>) => PostgreSQLEventStoreConsumer<ConsumerMessageType>;
|
|
732
|
-
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/eventStore/consumers/rebuildPostgreSQLProjections.d.ts
|
|
733
791
|
declare const rebuildPostgreSQLProjections: <EventType extends AnyEvent = AnyEvent>(options: Omit<PostgreSQLEventStoreConsumerOptions<EventType>, "stopWhen" | "processors"> & {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
};
|
|
792
|
+
lock?: {
|
|
793
|
+
acquisitionPolicy?: LockAcquisitionPolicy;
|
|
794
|
+
timeoutSeconds?: number;
|
|
795
|
+
};
|
|
739
796
|
} & ({
|
|
740
|
-
|
|
797
|
+
projections: (ProjectorOptions<EventType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext> | PostgreSQLProjectionDefinition<EventType>)[];
|
|
741
798
|
} | ProjectorOptions<EventType, ReadEventMetadataWithGlobalPosition, PostgreSQLProcessorHandlerContext>)) => PostgreSQLEventStoreConsumer<EventType>;
|
|
742
|
-
|
|
743
|
-
export {
|
|
799
|
+
//#endregion
|
|
800
|
+
export { AppendToStreamBeforeCommitHook, CreateEventStoreSchemaOptions, DefaultPostgreSQLEventStoreProcessorBatchSize, DefaultPostgreSQLEventStoreProcessorPullingFrequencyInMs, DefaultPostgreSQLProcessorLockPolicy, EventStoreSchemaMigrationOptions, type LockAcquisitionPolicy, PongoAssertOptions, PongoDocumentEvolve, PongoMultiStreamProjectionOptions, PongoProjectionHandlerContext, PongoProjectionOptions, PongoSingleStreamProjectionOptions, PongoWithNotNullDocumentEvolve, PongoWithNullableDocumentEvolve, PostgreSQLCheckpointer, PostgreSQLEventStoreCheckpoint, PostgreSQLEventStoreConsumer, PostgreSQLEventStoreConsumerConfig, PostgreSQLEventStoreConsumerOptions, PostgreSQLEventStoreDefaultStreamVersion, PostgreSQLEventStoreMessageBatchPuller, PostgreSQLEventStoreMessageBatchPullerOptions, PostgreSQLEventStoreMessageBatchPullerStartFrom, PostgreSQLEventStoreMessageBatchPullerStartOptions, PostgreSQLEventStoreMessagesBatchHandlerResult, PostgreSQLProcessor, PostgreSQLProcessorConnectionOptions, PostgreSQLProcessorEachBatchHandler, PostgreSQLProcessorEachMessageHandler, PostgreSQLProcessorHandlerContext, PostgreSQLProcessorLock, PostgreSQLProcessorLockContext, PostgreSQLProcessorLockOptions, PostgreSQLProcessorStartFrom, PostgreSQLProjectionAssert, PostgreSQLProjectionDefinition, PostgreSQLProjectionHandler, PostgreSQLProjectionHandlerContext, PostgreSQLProjectionHandlerOptions, PostgreSQLProjectionLock, PostgreSQLProjectionLockContext, PostgreSQLProjectionLockOptions, PostgreSQLProjectionSpec, PostgreSQLProjectionSpecEvent, PostgreSQLProjectionSpecOptions, PostgreSQLProjectionSpecWhenOptions, PostgreSQLProjectorOptions, PostgreSQLRawBatchSQLProjection, PostgreSQLRawSQLProjection, PostgreSQLReactorOptions, PostgreSQLWorkflowProcessorOptions, PostgresEventStore, PostgresEventStoreConnectionOptions, PostgresEventStoreOptions, PostgresReadEvent, PostgresReadEventMetadata, PostgresStreamExistsOptions, ReadLastMessageCheckpointResult, ReadMessagesBatchOptions, ReadMessagesBatchResult, ReadProcessorCheckpointResult, ReadProjectionInfoResult, StoreProcessorCheckpointResult, activateProjection, activateProjectionSQL, addDefaultPartitionSQL, addModuleForAllTenantsSQL, addModuleSQL, addPartitionSQL, addTablePartitions, addTenantForAllModulesSQL, addTenantSQL, appendToStream, appendToStreamSQL, appentToStreamRaw, assertSQLQueryResultMatches, callActivateProjection, callAppendToStream, callDeactivateProjection, callRegisterProjection, callReleaseProcessorLock, callStoreProcessorCheckpoint, callTryAcquireProcessorLock, callTryAcquireProjectionLock, createEventStoreSchema, currentPostgreSQLEventStoreSchemaVersion, deactivateProjection, deactivateProjectionSQL, defaultPostgreSQLOptions, documentDoesNotExist, documentExists, documentMatchingExists, documentsAreTheSame, documentsMatchingHaveCount, eventInStream, eventStoreSchemaMigrations, eventsInStream, expectPongoDocuments, expectSQL, getPostgreSQLEventStore, handleProjections, messagesTableSQL, newEventsInStream, pastEventStoreSchemaMigrations, pongoMultiStreamProjection, pongoProjection, pongoSingleStreamProjection, postgreSQLCheckpointer, postgreSQLEventStoreConsumer, postgreSQLEventStoreMessageBatchPuller, postgreSQLProcessorLock, postgreSQLProjection, postgreSQLProjectionLock, postgreSQLProjector, postgreSQLRawBatchSQLProjection, postgreSQLRawSQLProjection, postgreSQLReactor, postgreSQLWorkflowProcessor, processorsTableSQL, projectionsTableSQL, readLastMessageCheckpoint, readMessagesBatch, readProcessorCheckpoint, readProjectionInfo, readStream, rebuildPostgreSQLProjections, registerProjection, registerProjectionSQL, releaseProcessorLockSQL, sanitizeNameSQL, schemaMigration, schemaSQL, storeProcessorCheckpoint, storeSubscriptionCheckpointSQL, streamExists, streamsTableSQL, toProcessorLockKey, toProjectionLockKey, transactionToPostgreSQLProjectionHandlerContext, tryAcquireProcessorLockSQL, tryAcquireProjectionLockSQL, zipPostgreSQLEventStoreMessageBatchPullerStartFrom };
|
|
801
|
+
//# sourceMappingURL=index.d.cts.map
|