@event-driven-io/emmett-esdb 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 +420 -0
- package/dist/index.cjs +403 -1378
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -41
- package/dist/index.d.ts +52 -41
- package/dist/index.js +384 -1370
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,78 +1,89 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AnyEvent, AnyMessage, AppendToStreamOptions, AppendToStreamResultWithGlobalPosition, AsyncAwaiter, AsyncRetryOptions, BatchRecordedMessageHandlerWithoutContext, EmmettError, Event, EventStore, InMemoryProcessor, InMemoryProjectorOptions, InMemoryReactorOptions, Message, MessageConsumer, MessageConsumerOptions, ProcessorCheckpoint, ReadEvent, ReadEventMetadataWithGlobalPosition, RecordedMessage } from "@event-driven-io/emmett";
|
|
2
|
+
import { EventStoreDBClient, ResolvedEvent, SubscribeToAllOptions, SubscribeToStreamOptions } from "@eventstore/db-client";
|
|
3
3
|
|
|
4
|
+
//#region src/eventStore/consumers/eventStoreDBEventStoreConsumer.d.ts
|
|
4
5
|
type EventStoreDBEventStoreConsumerConfig<ConsumerMessageType extends Message = any> = MessageConsumerOptions<ConsumerMessageType> & {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
from?: EventStoreDBEventStoreConsumerType;
|
|
7
|
+
pulling?: {
|
|
8
|
+
batchSize?: number;
|
|
9
|
+
};
|
|
10
|
+
resilience?: {
|
|
11
|
+
resubscribeOptions?: AsyncRetryOptions;
|
|
12
|
+
};
|
|
12
13
|
};
|
|
13
14
|
type EventStoreDBEventStoreConsumerOptions<ConsumerEventType extends Message = Message> = EventStoreDBEventStoreConsumerConfig<ConsumerEventType> & ({
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
connectionString: string;
|
|
16
|
+
client?: never;
|
|
16
17
|
} | {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
client: EventStoreDBClient;
|
|
19
|
+
connectionString?: never;
|
|
19
20
|
});
|
|
20
21
|
type $all = '$all';
|
|
21
22
|
declare const $all = "$all";
|
|
22
23
|
type EventStoreDBEventStoreConsumerType = {
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
stream: $all;
|
|
25
|
+
options?: Exclude<SubscribeToAllOptions, 'fromPosition'>;
|
|
25
26
|
} | {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
stream: string;
|
|
28
|
+
options?: Exclude<SubscribeToStreamOptions, 'fromRevision'>;
|
|
28
29
|
};
|
|
29
30
|
type EventStoreDBEventStoreConsumer<ConsumerMessageType extends AnyMessage = any> = MessageConsumer<ConsumerMessageType> & Readonly<{
|
|
30
|
-
|
|
31
|
+
reactor: <MessageType extends AnyMessage = ConsumerMessageType>(options: InMemoryReactorOptions<MessageType>) => InMemoryProcessor<MessageType>;
|
|
31
32
|
}> & (AnyEvent extends ConsumerMessageType ? Readonly<{
|
|
32
|
-
|
|
33
|
+
projector: <EventType extends AnyEvent = ConsumerMessageType & AnyEvent>(options: InMemoryProjectorOptions<EventType>) => InMemoryProcessor<EventType>;
|
|
33
34
|
}> : object);
|
|
34
35
|
declare const eventStoreDBEventStoreConsumer: <ConsumerMessageType extends Message = AnyMessage>(options: EventStoreDBEventStoreConsumerOptions<ConsumerMessageType>) => EventStoreDBEventStoreConsumer<ConsumerMessageType>;
|
|
35
|
-
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/eventStore/eventstoreDBEventStore.d.ts
|
|
36
38
|
declare const EventStoreDBEventStoreDefaultStreamVersion = -1n;
|
|
37
39
|
type EventStoreDBReadEventMetadata = ReadEventMetadataWithGlobalPosition;
|
|
38
40
|
type EventStoreDBReadEvent<EventType extends Event = Event> = ReadEvent<EventType, EventStoreDBReadEventMetadata>;
|
|
39
41
|
interface EventStoreDBEventStore extends EventStore<EventStoreDBReadEventMetadata> {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
appendToStream<EventType extends Event, EventPayloadType extends Event = EventType>(streamName: string, events: EventType[], options?: AppendToStreamOptions<EventType, EventPayloadType>): Promise<AppendToStreamResultWithGlobalPosition>;
|
|
43
|
+
consumer<ConsumerEventType extends Event = Event>(options?: EventStoreDBEventStoreConsumerConfig<ConsumerEventType>): EventStoreDBEventStoreConsumer<ConsumerEventType>;
|
|
42
44
|
}
|
|
43
45
|
declare const getEventStoreDBEventStore: (eventStore: EventStoreDBClient) => EventStoreDBEventStore;
|
|
44
46
|
declare const mapFromESDBEvent: <MessageType extends AnyMessage = AnyMessage>(resolvedEvent: ResolvedEvent<MessageType>, from?: EventStoreDBEventStoreConsumerType) => RecordedMessage<MessageType, EventStoreDBReadEventMetadata>;
|
|
45
|
-
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/eventStore/consumers/subscriptions/index.d.ts
|
|
46
49
|
declare const DefaultEventStoreDBEventStoreProcessorBatchSize = 100;
|
|
47
50
|
declare const DefaultEventStoreDBEventStoreProcessorPullingFrequencyInMs = 50;
|
|
48
51
|
type EventStoreDBEventStoreMessagesBatchHandlerResult = void | {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
type: 'STOP';
|
|
53
|
+
reason?: string;
|
|
54
|
+
error?: EmmettError;
|
|
52
55
|
};
|
|
53
56
|
type EventStoreDBSubscriptionOptions<MessageType extends Message = Message> = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
from?: EventStoreDBEventStoreConsumerType;
|
|
58
|
+
client: EventStoreDBClient;
|
|
59
|
+
batchSize: number;
|
|
60
|
+
eachBatch: BatchRecordedMessageHandlerWithoutContext<MessageType, EventStoreDBReadEventMetadata>;
|
|
61
|
+
resilience?: {
|
|
62
|
+
resubscribeOptions?: AsyncRetryOptions;
|
|
63
|
+
};
|
|
61
64
|
};
|
|
62
65
|
type EventStoreDBSubscriptionStartFrom = {
|
|
63
|
-
|
|
66
|
+
lastCheckpoint: ProcessorCheckpoint;
|
|
64
67
|
} | 'BEGINNING' | 'END';
|
|
65
68
|
type EventStoreDBSubscriptionStartOptions = {
|
|
66
|
-
|
|
69
|
+
startFrom: EventStoreDBSubscriptionStartFrom;
|
|
70
|
+
started?: AsyncAwaiter<void>;
|
|
67
71
|
};
|
|
68
72
|
type EventStoreDBSubscription = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
isRunning: boolean;
|
|
74
|
+
start(options: EventStoreDBSubscriptionStartOptions): Promise<void>;
|
|
75
|
+
stop(): Promise<void>;
|
|
72
76
|
};
|
|
73
77
|
declare const isDatabaseUnavailableError: (error: unknown) => boolean;
|
|
74
78
|
declare const EventStoreDBResubscribeDefaultOptions: AsyncRetryOptions;
|
|
75
|
-
declare const eventStoreDBSubscription: <MessageType extends AnyMessage = AnyMessage>({
|
|
79
|
+
declare const eventStoreDBSubscription: <MessageType extends AnyMessage = AnyMessage>({
|
|
80
|
+
client,
|
|
81
|
+
from,
|
|
82
|
+
batchSize,
|
|
83
|
+
eachBatch,
|
|
84
|
+
resilience
|
|
85
|
+
}: EventStoreDBSubscriptionOptions<MessageType>) => EventStoreDBSubscription;
|
|
76
86
|
declare const zipEventStoreDBEventStoreMessageBatchPullerStartFrom: (options: (EventStoreDBSubscriptionStartFrom | undefined)[]) => EventStoreDBSubscriptionStartFrom;
|
|
77
|
-
|
|
78
|
-
export { $all, DefaultEventStoreDBEventStoreProcessorBatchSize, DefaultEventStoreDBEventStoreProcessorPullingFrequencyInMs,
|
|
87
|
+
//#endregion
|
|
88
|
+
export { $all, DefaultEventStoreDBEventStoreProcessorBatchSize, DefaultEventStoreDBEventStoreProcessorPullingFrequencyInMs, EventStoreDBEventStore, EventStoreDBEventStoreConsumer, EventStoreDBEventStoreConsumerConfig, EventStoreDBEventStoreConsumerOptions, EventStoreDBEventStoreConsumerType, EventStoreDBEventStoreDefaultStreamVersion, EventStoreDBEventStoreMessagesBatchHandlerResult, EventStoreDBReadEvent, EventStoreDBReadEventMetadata, EventStoreDBResubscribeDefaultOptions, EventStoreDBSubscription, EventStoreDBSubscriptionOptions, EventStoreDBSubscriptionStartFrom, EventStoreDBSubscriptionStartOptions, eventStoreDBEventStoreConsumer, eventStoreDBSubscription, getEventStoreDBEventStore, isDatabaseUnavailableError, mapFromESDBEvent, zipEventStoreDBEventStoreMessageBatchPullerStartFrom };
|
|
89
|
+
//# sourceMappingURL=index.d.ts.map
|