@event-driven-io/emmett 0.43.0-beta.16 → 0.43.0-beta.18
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 +1 -1
- package/dist/index.cjs +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -36
- package/dist/index.d.ts +39 -36
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -47,6 +47,39 @@ type DefaultCommandMetadata = {
|
|
|
47
47
|
now: Date;
|
|
48
48
|
};
|
|
49
49
|
//#endregion
|
|
50
|
+
//#region src/processors/checkpoints.d.ts
|
|
51
|
+
type ProcessorCheckpoint = Brand<string, 'ProcessorCheckpoint'>;
|
|
52
|
+
declare const ProcessorCheckpoint: (checkpoint: string) => ProcessorCheckpoint;
|
|
53
|
+
declare const bigIntProcessorCheckpoint: (value: bigint) => ProcessorCheckpoint;
|
|
54
|
+
declare const parseBigIntProcessorCheckpoint: (value: ProcessorCheckpoint) => bigint;
|
|
55
|
+
type GetCheckpoint<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata> = (message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
|
|
56
|
+
declare const getCheckpoint: <MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata>(message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
|
|
57
|
+
type Checkpointer<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
|
|
58
|
+
read: ReadProcessorCheckpoint<HandlerContext>;
|
|
59
|
+
store: StoreProcessorCheckpoint<MessageType, MessageMetadataType, HandlerContext>;
|
|
60
|
+
};
|
|
61
|
+
type ReadProcessorCheckpoint<HandlerContext extends DefaultRecord = DefaultRecord> = (options: {
|
|
62
|
+
processorId: string;
|
|
63
|
+
partition?: string;
|
|
64
|
+
}, context: HandlerContext) => Promise<ReadProcessorCheckpointResult>;
|
|
65
|
+
type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord | undefined = undefined> = (options: {
|
|
66
|
+
message: RecordedMessage<MessageType, MessageMetadataType>;
|
|
67
|
+
processorId: string;
|
|
68
|
+
version: number | undefined;
|
|
69
|
+
lastCheckpoint: ProcessorCheckpoint | null;
|
|
70
|
+
partition?: string;
|
|
71
|
+
}, context: HandlerContext) => Promise<StoreProcessorCheckpointResult>;
|
|
72
|
+
type StoreProcessorCheckpointResult = {
|
|
73
|
+
success: true;
|
|
74
|
+
newCheckpoint: ProcessorCheckpoint | null;
|
|
75
|
+
} | {
|
|
76
|
+
success: false;
|
|
77
|
+
reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
|
|
78
|
+
};
|
|
79
|
+
type ReadProcessorCheckpointResult = {
|
|
80
|
+
lastCheckpoint: ProcessorCheckpoint | null;
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
50
83
|
//#region src/database/types.d.ts
|
|
51
84
|
/** TypeScript Omit (Exclude to be specific) does not work for objects with an "any" indexed type, and breaks discriminated unions @public */
|
|
52
85
|
declare type EnhancedOmit<TRecordOrUnion, KeyUnion> = string extends keyof TRecordOrUnion ? TRecordOrUnion : TRecordOrUnion extends any ? Pick<TRecordOrUnion, Exclude<keyof TRecordOrUnion, KeyUnion>> : never;
|
|
@@ -272,8 +305,6 @@ declare const projections: {
|
|
|
272
305
|
type CurrentMessageProcessorPosition = {
|
|
273
306
|
lastCheckpoint: ProcessorCheckpoint;
|
|
274
307
|
} | 'BEGINNING' | 'END';
|
|
275
|
-
type GetCheckpoint<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata> = (message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
|
|
276
|
-
declare const getCheckpoint: <MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata>(message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
|
|
277
308
|
declare const wasMessageHandled: <MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata>(message: RecordedMessage<MessageType, MessageMetadataType>, checkpoint: ProcessorCheckpoint | null) => boolean;
|
|
278
309
|
type MessageProcessorStartFrom = CurrentMessageProcessorPosition | 'CURRENT';
|
|
279
310
|
type MessageProcessorType = 'projector' | 'reactor';
|
|
@@ -304,10 +335,6 @@ declare const MessageProcessor: {
|
|
|
304
335
|
};
|
|
305
336
|
};
|
|
306
337
|
type MessageProcessingScope<HandlerContext extends DefaultRecord | undefined = undefined> = <Result = SingleMessageHandlerResult>(handler: (context: HandlerContext) => Result | Promise<Result>, partialContext: Partial<HandlerContext>) => Result | Promise<Result>;
|
|
307
|
-
type Checkpointer<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
|
|
308
|
-
read: ReadProcessorCheckpoint<HandlerContext>;
|
|
309
|
-
store: StoreProcessorCheckpoint<MessageType, MessageMetadataType, HandlerContext>;
|
|
310
|
-
};
|
|
311
338
|
type ProcessorHooks<HandlerContext extends DefaultRecord = DefaultRecord> = {
|
|
312
339
|
onInit?: OnReactorInitHook<HandlerContext>;
|
|
313
340
|
onStart?: OnReactorStartHook<HandlerContext>;
|
|
@@ -352,30 +379,6 @@ type ProjectorOptions<EventType extends AnyEvent = AnyEvent, MessageMetadataType
|
|
|
352
379
|
projection: ProjectionDefinition<EventType, MessageMetadataType, HandlerContext, EventPayloadType>;
|
|
353
380
|
};
|
|
354
381
|
declare const defaultProcessingMessageProcessingScope: <HandlerContext = never, Result = SingleMessageHandlerResult>(handler: (context: HandlerContext) => Result | Promise<Result>, partialContext: Partial<HandlerContext>) => Result | Promise<Result>;
|
|
355
|
-
type ProcessorCheckpoint = Brand<string, 'ProcessorCheckpoint'>;
|
|
356
|
-
declare const bigIntProcessorCheckpoint: (value: bigint) => ProcessorCheckpoint;
|
|
357
|
-
declare const parseBigIntProcessorCheckpoint: (value: ProcessorCheckpoint) => bigint;
|
|
358
|
-
type ReadProcessorCheckpointResult = {
|
|
359
|
-
lastCheckpoint: ProcessorCheckpoint | null;
|
|
360
|
-
};
|
|
361
|
-
type ReadProcessorCheckpoint<HandlerContext extends DefaultRecord = DefaultRecord> = (options: {
|
|
362
|
-
processorId: string;
|
|
363
|
-
partition?: string;
|
|
364
|
-
}, context: HandlerContext) => Promise<ReadProcessorCheckpointResult>;
|
|
365
|
-
type StoreProcessorCheckpointResult = {
|
|
366
|
-
success: true;
|
|
367
|
-
newCheckpoint: ProcessorCheckpoint | null;
|
|
368
|
-
} | {
|
|
369
|
-
success: false;
|
|
370
|
-
reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
|
|
371
|
-
};
|
|
372
|
-
type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord | undefined = undefined> = (options: {
|
|
373
|
-
message: RecordedMessage<MessageType, MessageMetadataType>;
|
|
374
|
-
processorId: string;
|
|
375
|
-
version: number | undefined;
|
|
376
|
-
lastCheckpoint: ProcessorCheckpoint | null;
|
|
377
|
-
partition?: string;
|
|
378
|
-
}, context: HandlerContext) => Promise<StoreProcessorCheckpointResult>;
|
|
379
382
|
declare const defaultProcessorVersion = 1;
|
|
380
383
|
declare const defaultProcessorPartition = "emt:default";
|
|
381
384
|
declare const getProcessorInstanceId: (processorId: string) => string;
|
|
@@ -447,7 +450,7 @@ type RecordedMessageMetadataWithoutGlobalPosition = RecordedMessageMetadata<unde
|
|
|
447
450
|
//#endregion
|
|
448
451
|
//#region src/typing/event.d.ts
|
|
449
452
|
type StreamPosition = bigint;
|
|
450
|
-
type GlobalPosition =
|
|
453
|
+
type GlobalPosition = string;
|
|
451
454
|
type Event<EventType extends string = string, EventData extends DefaultRecord = DefaultRecord, EventMetaData extends DefaultRecord | undefined = undefined> = Readonly<EventMetaData extends undefined ? {
|
|
452
455
|
type: EventType;
|
|
453
456
|
data: EventData;
|
|
@@ -612,7 +615,7 @@ type AggregateStreamResult<State> = {
|
|
|
612
615
|
};
|
|
613
616
|
type AggregateStreamResultWithGlobalPosition<State> = (AggregateStreamResult<State> & {
|
|
614
617
|
streamExists: true;
|
|
615
|
-
lastEventGlobalPosition:
|
|
618
|
+
lastEventGlobalPosition: ProcessorCheckpoint;
|
|
616
619
|
}) | (AggregateStreamResult<State> & {
|
|
617
620
|
streamExists: false;
|
|
618
621
|
});
|
|
@@ -630,7 +633,7 @@ type AppendToStreamResult = {
|
|
|
630
633
|
createdNewStream: boolean;
|
|
631
634
|
};
|
|
632
635
|
type AppendToStreamResultWithGlobalPosition = AppendToStreamResult & {
|
|
633
|
-
lastEventGlobalPosition:
|
|
636
|
+
lastEventGlobalPosition: ProcessorCheckpoint;
|
|
634
637
|
};
|
|
635
638
|
type AppendStreamResultOfEventStore<Store extends EventStore> = Store['appendToStream'] extends ((...args: any[]) => Promise<infer R>) ? R : never;
|
|
636
639
|
type StreamExistsResult = boolean;
|
|
@@ -709,12 +712,12 @@ declare const forwardToMessageBus: <Store extends EventStore, HandlerContext ext
|
|
|
709
712
|
//#region src/eventStore/events/index.d.ts
|
|
710
713
|
declare const GlobalStreamCaughtUpType = "__emt:GlobalStreamCaughtUp";
|
|
711
714
|
type GlobalStreamCaughtUp = Event<'__emt:GlobalStreamCaughtUp', {
|
|
712
|
-
globalPosition:
|
|
715
|
+
globalPosition: GlobalPosition;
|
|
713
716
|
}, {
|
|
714
|
-
globalPosition:
|
|
717
|
+
globalPosition: GlobalPosition;
|
|
715
718
|
}>;
|
|
716
719
|
declare const isGlobalStreamCaughtUp: (event: Event) => event is GlobalStreamCaughtUp;
|
|
717
|
-
declare const caughtUpEventFrom: (position:
|
|
720
|
+
declare const caughtUpEventFrom: (position: string) => (event: ReadEvent<Event, ReadEventMetadataWithGlobalPosition>) => event is ReadEvent<GlobalStreamCaughtUp, ReadEventMetadataWithGlobalPosition>;
|
|
718
721
|
declare const globalStreamCaughtUp: (data: EventDataOf<GlobalStreamCaughtUp>) => GlobalStreamCaughtUp;
|
|
719
722
|
declare const isSubscriptionEvent: (event: Event) => event is GlobalSubscriptionEvent;
|
|
720
723
|
declare const isNotInternalEvent: (event: Event) => boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,39 @@ type DefaultCommandMetadata = {
|
|
|
47
47
|
now: Date;
|
|
48
48
|
};
|
|
49
49
|
//#endregion
|
|
50
|
+
//#region src/processors/checkpoints.d.ts
|
|
51
|
+
type ProcessorCheckpoint = Brand<string, 'ProcessorCheckpoint'>;
|
|
52
|
+
declare const ProcessorCheckpoint: (checkpoint: string) => ProcessorCheckpoint;
|
|
53
|
+
declare const bigIntProcessorCheckpoint: (value: bigint) => ProcessorCheckpoint;
|
|
54
|
+
declare const parseBigIntProcessorCheckpoint: (value: ProcessorCheckpoint) => bigint;
|
|
55
|
+
type GetCheckpoint<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata> = (message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
|
|
56
|
+
declare const getCheckpoint: <MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata>(message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
|
|
57
|
+
type Checkpointer<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
|
|
58
|
+
read: ReadProcessorCheckpoint<HandlerContext>;
|
|
59
|
+
store: StoreProcessorCheckpoint<MessageType, MessageMetadataType, HandlerContext>;
|
|
60
|
+
};
|
|
61
|
+
type ReadProcessorCheckpoint<HandlerContext extends DefaultRecord = DefaultRecord> = (options: {
|
|
62
|
+
processorId: string;
|
|
63
|
+
partition?: string;
|
|
64
|
+
}, context: HandlerContext) => Promise<ReadProcessorCheckpointResult>;
|
|
65
|
+
type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord | undefined = undefined> = (options: {
|
|
66
|
+
message: RecordedMessage<MessageType, MessageMetadataType>;
|
|
67
|
+
processorId: string;
|
|
68
|
+
version: number | undefined;
|
|
69
|
+
lastCheckpoint: ProcessorCheckpoint | null;
|
|
70
|
+
partition?: string;
|
|
71
|
+
}, context: HandlerContext) => Promise<StoreProcessorCheckpointResult>;
|
|
72
|
+
type StoreProcessorCheckpointResult = {
|
|
73
|
+
success: true;
|
|
74
|
+
newCheckpoint: ProcessorCheckpoint | null;
|
|
75
|
+
} | {
|
|
76
|
+
success: false;
|
|
77
|
+
reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
|
|
78
|
+
};
|
|
79
|
+
type ReadProcessorCheckpointResult = {
|
|
80
|
+
lastCheckpoint: ProcessorCheckpoint | null;
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
50
83
|
//#region src/database/types.d.ts
|
|
51
84
|
/** TypeScript Omit (Exclude to be specific) does not work for objects with an "any" indexed type, and breaks discriminated unions @public */
|
|
52
85
|
declare type EnhancedOmit<TRecordOrUnion, KeyUnion> = string extends keyof TRecordOrUnion ? TRecordOrUnion : TRecordOrUnion extends any ? Pick<TRecordOrUnion, Exclude<keyof TRecordOrUnion, KeyUnion>> : never;
|
|
@@ -272,8 +305,6 @@ declare const projections: {
|
|
|
272
305
|
type CurrentMessageProcessorPosition = {
|
|
273
306
|
lastCheckpoint: ProcessorCheckpoint;
|
|
274
307
|
} | 'BEGINNING' | 'END';
|
|
275
|
-
type GetCheckpoint<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata> = (message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
|
|
276
|
-
declare const getCheckpoint: <MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata>(message: RecordedMessage<MessageType, MessageMetadataType>) => ProcessorCheckpoint | null;
|
|
277
308
|
declare const wasMessageHandled: <MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata>(message: RecordedMessage<MessageType, MessageMetadataType>, checkpoint: ProcessorCheckpoint | null) => boolean;
|
|
278
309
|
type MessageProcessorStartFrom = CurrentMessageProcessorPosition | 'CURRENT';
|
|
279
310
|
type MessageProcessorType = 'projector' | 'reactor';
|
|
@@ -304,10 +335,6 @@ declare const MessageProcessor: {
|
|
|
304
335
|
};
|
|
305
336
|
};
|
|
306
337
|
type MessageProcessingScope<HandlerContext extends DefaultRecord | undefined = undefined> = <Result = SingleMessageHandlerResult>(handler: (context: HandlerContext) => Result | Promise<Result>, partialContext: Partial<HandlerContext>) => Result | Promise<Result>;
|
|
307
|
-
type Checkpointer<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
|
|
308
|
-
read: ReadProcessorCheckpoint<HandlerContext>;
|
|
309
|
-
store: StoreProcessorCheckpoint<MessageType, MessageMetadataType, HandlerContext>;
|
|
310
|
-
};
|
|
311
338
|
type ProcessorHooks<HandlerContext extends DefaultRecord = DefaultRecord> = {
|
|
312
339
|
onInit?: OnReactorInitHook<HandlerContext>;
|
|
313
340
|
onStart?: OnReactorStartHook<HandlerContext>;
|
|
@@ -352,30 +379,6 @@ type ProjectorOptions<EventType extends AnyEvent = AnyEvent, MessageMetadataType
|
|
|
352
379
|
projection: ProjectionDefinition<EventType, MessageMetadataType, HandlerContext, EventPayloadType>;
|
|
353
380
|
};
|
|
354
381
|
declare const defaultProcessingMessageProcessingScope: <HandlerContext = never, Result = SingleMessageHandlerResult>(handler: (context: HandlerContext) => Result | Promise<Result>, partialContext: Partial<HandlerContext>) => Result | Promise<Result>;
|
|
355
|
-
type ProcessorCheckpoint = Brand<string, 'ProcessorCheckpoint'>;
|
|
356
|
-
declare const bigIntProcessorCheckpoint: (value: bigint) => ProcessorCheckpoint;
|
|
357
|
-
declare const parseBigIntProcessorCheckpoint: (value: ProcessorCheckpoint) => bigint;
|
|
358
|
-
type ReadProcessorCheckpointResult = {
|
|
359
|
-
lastCheckpoint: ProcessorCheckpoint | null;
|
|
360
|
-
};
|
|
361
|
-
type ReadProcessorCheckpoint<HandlerContext extends DefaultRecord = DefaultRecord> = (options: {
|
|
362
|
-
processorId: string;
|
|
363
|
-
partition?: string;
|
|
364
|
-
}, context: HandlerContext) => Promise<ReadProcessorCheckpointResult>;
|
|
365
|
-
type StoreProcessorCheckpointResult = {
|
|
366
|
-
success: true;
|
|
367
|
-
newCheckpoint: ProcessorCheckpoint | null;
|
|
368
|
-
} | {
|
|
369
|
-
success: false;
|
|
370
|
-
reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
|
|
371
|
-
};
|
|
372
|
-
type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord | undefined = undefined> = (options: {
|
|
373
|
-
message: RecordedMessage<MessageType, MessageMetadataType>;
|
|
374
|
-
processorId: string;
|
|
375
|
-
version: number | undefined;
|
|
376
|
-
lastCheckpoint: ProcessorCheckpoint | null;
|
|
377
|
-
partition?: string;
|
|
378
|
-
}, context: HandlerContext) => Promise<StoreProcessorCheckpointResult>;
|
|
379
382
|
declare const defaultProcessorVersion = 1;
|
|
380
383
|
declare const defaultProcessorPartition = "emt:default";
|
|
381
384
|
declare const getProcessorInstanceId: (processorId: string) => string;
|
|
@@ -447,7 +450,7 @@ type RecordedMessageMetadataWithoutGlobalPosition = RecordedMessageMetadata<unde
|
|
|
447
450
|
//#endregion
|
|
448
451
|
//#region src/typing/event.d.ts
|
|
449
452
|
type StreamPosition = bigint;
|
|
450
|
-
type GlobalPosition =
|
|
453
|
+
type GlobalPosition = string;
|
|
451
454
|
type Event<EventType extends string = string, EventData extends DefaultRecord = DefaultRecord, EventMetaData extends DefaultRecord | undefined = undefined> = Readonly<EventMetaData extends undefined ? {
|
|
452
455
|
type: EventType;
|
|
453
456
|
data: EventData;
|
|
@@ -612,7 +615,7 @@ type AggregateStreamResult<State> = {
|
|
|
612
615
|
};
|
|
613
616
|
type AggregateStreamResultWithGlobalPosition<State> = (AggregateStreamResult<State> & {
|
|
614
617
|
streamExists: true;
|
|
615
|
-
lastEventGlobalPosition:
|
|
618
|
+
lastEventGlobalPosition: ProcessorCheckpoint;
|
|
616
619
|
}) | (AggregateStreamResult<State> & {
|
|
617
620
|
streamExists: false;
|
|
618
621
|
});
|
|
@@ -630,7 +633,7 @@ type AppendToStreamResult = {
|
|
|
630
633
|
createdNewStream: boolean;
|
|
631
634
|
};
|
|
632
635
|
type AppendToStreamResultWithGlobalPosition = AppendToStreamResult & {
|
|
633
|
-
lastEventGlobalPosition:
|
|
636
|
+
lastEventGlobalPosition: ProcessorCheckpoint;
|
|
634
637
|
};
|
|
635
638
|
type AppendStreamResultOfEventStore<Store extends EventStore> = Store['appendToStream'] extends ((...args: any[]) => Promise<infer R>) ? R : never;
|
|
636
639
|
type StreamExistsResult = boolean;
|
|
@@ -709,12 +712,12 @@ declare const forwardToMessageBus: <Store extends EventStore, HandlerContext ext
|
|
|
709
712
|
//#region src/eventStore/events/index.d.ts
|
|
710
713
|
declare const GlobalStreamCaughtUpType = "__emt:GlobalStreamCaughtUp";
|
|
711
714
|
type GlobalStreamCaughtUp = Event<'__emt:GlobalStreamCaughtUp', {
|
|
712
|
-
globalPosition:
|
|
715
|
+
globalPosition: GlobalPosition;
|
|
713
716
|
}, {
|
|
714
|
-
globalPosition:
|
|
717
|
+
globalPosition: GlobalPosition;
|
|
715
718
|
}>;
|
|
716
719
|
declare const isGlobalStreamCaughtUp: (event: Event) => event is GlobalStreamCaughtUp;
|
|
717
|
-
declare const caughtUpEventFrom: (position:
|
|
720
|
+
declare const caughtUpEventFrom: (position: string) => (event: ReadEvent<Event, ReadEventMetadataWithGlobalPosition>) => event is ReadEvent<GlobalStreamCaughtUp, ReadEventMetadataWithGlobalPosition>;
|
|
718
721
|
declare const globalStreamCaughtUp: (data: EventDataOf<GlobalStreamCaughtUp>) => GlobalStreamCaughtUp;
|
|
719
722
|
declare const isSubscriptionEvent: (event: Event) => event is GlobalSubscriptionEvent;
|
|
720
723
|
declare const isNotInternalEvent: (event: Event) => boolean;
|
package/dist/index.js
CHANGED
|
@@ -977,10 +977,16 @@ const getInMemoryDatabase = () => {
|
|
|
977
977
|
};
|
|
978
978
|
|
|
979
979
|
//#endregion
|
|
980
|
-
//#region src/processors/
|
|
980
|
+
//#region src/processors/checkpoints.ts
|
|
981
|
+
const ProcessorCheckpoint = (checkpoint) => checkpoint;
|
|
982
|
+
const bigIntProcessorCheckpoint = (value) => bigInt.toNormalizedString(value);
|
|
983
|
+
const parseBigIntProcessorCheckpoint = (value) => BigInt(value);
|
|
981
984
|
const getCheckpoint = (message) => {
|
|
982
985
|
return message.metadata.checkpoint;
|
|
983
986
|
};
|
|
987
|
+
|
|
988
|
+
//#endregion
|
|
989
|
+
//#region src/processors/processors.ts
|
|
984
990
|
const wasMessageHandled = (message, checkpoint) => {
|
|
985
991
|
const messageCheckpoint = getCheckpoint(message);
|
|
986
992
|
return messageCheckpoint !== null && messageCheckpoint !== void 0 && checkpoint !== null && checkpoint !== void 0 && messageCheckpoint <= checkpoint;
|
|
@@ -1000,8 +1006,6 @@ const MessageProcessor = { result: {
|
|
|
1000
1006
|
})
|
|
1001
1007
|
} };
|
|
1002
1008
|
const defaultProcessingMessageProcessingScope = (handler, partialContext) => handler(partialContext);
|
|
1003
|
-
const bigIntProcessorCheckpoint = (value) => bigInt.toNormalizedString(value);
|
|
1004
|
-
const parseBigIntProcessorCheckpoint = (value) => BigInt(value);
|
|
1005
1009
|
const defaultProcessorVersion = 1;
|
|
1006
1010
|
const defaultProcessorPartition = defaultTag;
|
|
1007
1011
|
const getProcessorInstanceId = (processorId) => `${processorId}:${v7()}`;
|
|
@@ -1655,7 +1659,7 @@ const InMemoryProjectionSpec = { for: (options) => {
|
|
|
1655
1659
|
for (const event of [...givenEvents, ...Array.from({ length: numberOfTimes }).flatMap(() => events)]) {
|
|
1656
1660
|
const metadata = {
|
|
1657
1661
|
checkpoint: bigIntProcessorCheckpoint(++globalPosition),
|
|
1658
|
-
globalPosition,
|
|
1662
|
+
globalPosition: bigIntProcessorCheckpoint(globalPosition),
|
|
1659
1663
|
streamPosition: globalPosition,
|
|
1660
1664
|
streamName: event.metadata?.streamName ?? `test-${v4()}`,
|
|
1661
1665
|
messageId: v4()
|
|
@@ -1849,7 +1853,7 @@ const getInMemoryEventStore = (eventStoreOptions) => {
|
|
|
1849
1853
|
streamName,
|
|
1850
1854
|
messageId: v4(),
|
|
1851
1855
|
streamPosition: BigInt(currentEvents.length + index + 1),
|
|
1852
|
-
globalPosition,
|
|
1856
|
+
globalPosition: bigIntProcessorCheckpoint(globalPosition),
|
|
1853
1857
|
checkpoint: bigIntProcessorCheckpoint(globalPosition)
|
|
1854
1858
|
};
|
|
1855
1859
|
return {
|
|
@@ -2509,5 +2513,5 @@ const workflowProcessor = (options) => {
|
|
|
2509
2513
|
};
|
|
2510
2514
|
|
|
2511
2515
|
//#endregion
|
|
2512
|
-
export { AssertionError, CommandHandler, CommandHandlerStreamVersionConflictRetryOptions, ConcurrencyError, ConcurrencyInMemoryDatabaseError, DATABASE_REQUIRED_ERROR_MESSAGE, DeciderCommandHandler, DeciderSpecification, EmmettError, ExpectedVersionConflictError, GlobalStreamCaughtUpType, IllegalStateError, InMemoryEventStoreDefaultStreamVersion, InMemoryProjectionSpec, InProcessLock, JSONCodec, JSONReplacer, JSONReplacers, JSONReviver, JSONRevivers, JSONSerializer, MessageProcessor, MessageProcessorType, NO_CONCURRENCY_CHECK, NoRetries, NotFoundError, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, TaskProcessor, ValidationError, ValidationErrors, Workflow, WorkflowHandler, WorkflowHandlerStreamVersionConflictRetryOptions, WorkflowSpecification, WrapEventStore, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUndefined, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, bigInt, bigIntProcessorCheckpoint, canCreateEventStoreSession, caughtUpEventFrom, command, composeJSONReplacers, composeJSONRevivers, deepEquals, defaultProcessingMessageProcessingScope, defaultProcessorPartition, defaultProcessorVersion, defaultTag, delay, documentExists, downcastRecordedMessage, downcastRecordedMessages, emmettPrefix, event, eventInStream, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, getProcessorInstanceId, getProjectorId, getWorkflowId, globalStreamCaughtUp, globalTag, guardBoundedAccess, guardExclusiveAccess, guardInitializedOnce, handleInMemoryProjections, hashText, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isErrorConstructor, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isPluginConfig, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, jsonSerializer, matchesExpectedVersion, merge, message, newEventsInStream, nulloSessionFactory, onShutdown, parseBigIntProcessorCheckpoint, parseDateFromUtcYYYYMMDD, projection, projections, projector, reactor, reduceAsync, sum, toNormalizedString, tryPublishMessagesAfterCommit, unknownTag, upcastRecordedMessage, upcastRecordedMessages, verifyThat, wasMessageHandled, workflowOutputHandler, workflowProcessor, workflowStreamName };
|
|
2516
|
+
export { AssertionError, CommandHandler, CommandHandlerStreamVersionConflictRetryOptions, ConcurrencyError, ConcurrencyInMemoryDatabaseError, DATABASE_REQUIRED_ERROR_MESSAGE, DeciderCommandHandler, DeciderSpecification, EmmettError, ExpectedVersionConflictError, GlobalStreamCaughtUpType, IllegalStateError, InMemoryEventStoreDefaultStreamVersion, InMemoryProjectionSpec, InProcessLock, JSONCodec, JSONReplacer, JSONReplacers, JSONReviver, JSONRevivers, JSONSerializer, MessageProcessor, MessageProcessorType, NO_CONCURRENCY_CHECK, NoRetries, NotFoundError, ProcessorCheckpoint, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, TaskProcessor, ValidationError, ValidationErrors, Workflow, WorkflowHandler, WorkflowHandlerStreamVersionConflictRetryOptions, WorkflowSpecification, WrapEventStore, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUndefined, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, bigInt, bigIntProcessorCheckpoint, canCreateEventStoreSession, caughtUpEventFrom, command, composeJSONReplacers, composeJSONRevivers, deepEquals, defaultProcessingMessageProcessingScope, defaultProcessorPartition, defaultProcessorVersion, defaultTag, delay, documentExists, downcastRecordedMessage, downcastRecordedMessages, emmettPrefix, event, eventInStream, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, getProcessorInstanceId, getProjectorId, getWorkflowId, globalStreamCaughtUp, globalTag, guardBoundedAccess, guardExclusiveAccess, guardInitializedOnce, handleInMemoryProjections, hashText, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isErrorConstructor, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isPluginConfig, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, jsonSerializer, matchesExpectedVersion, merge, message, newEventsInStream, nulloSessionFactory, onShutdown, parseBigIntProcessorCheckpoint, parseDateFromUtcYYYYMMDD, projection, projections, projector, reactor, reduceAsync, sum, toNormalizedString, tryPublishMessagesAfterCommit, unknownTag, upcastRecordedMessage, upcastRecordedMessages, verifyThat, wasMessageHandled, workflowOutputHandler, workflowProcessor, workflowStreamName };
|
|
2513
2517
|
//# sourceMappingURL=index.js.map
|