@event-driven-io/emmett 0.42.0-beta.1 → 0.42.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -75,6 +75,7 @@ type WithGlobalPosition<GlobalPosition> = Readonly<{
75
75
  globalPosition: GlobalPosition;
76
76
  }>;
77
77
  type RecordedMessageMetadata<GlobalPosition = undefined, StreamPosition = BigIntStreamPosition> = CommonRecordedMessageMetadata<StreamPosition> & (GlobalPosition extends undefined ? {} : WithGlobalPosition<GlobalPosition>);
78
+ type AnyRecordedMessage = Message<any, any, any>;
78
79
  type AnyRecordedMessageMetadata = RecordedMessageMetadata<any, any>;
79
80
  type RecordedMessageMetadataWithGlobalPosition<GlobalPosition = BigIntGlobalPosition> = RecordedMessageMetadata<GlobalPosition>;
80
81
  type RecordedMessageMetadataWithoutGlobalPosition<StreamPosition = BigIntStreamPosition> = RecordedMessageMetadata<undefined, StreamPosition>;
@@ -212,6 +213,10 @@ type Flavour<K, T> = K & {
212
213
  type DefaultRecord = Record<string, unknown>;
213
214
  type AnyRecord = Record<string, any>;
214
215
  type NonNullable$1<T> = T extends null | undefined ? never : T;
216
+ declare const emmettPrefix = "emt";
217
+ declare const globalTag = "global";
218
+ declare const defaultTag = "emt:default";
219
+ declare const unknownTag = "emt:unknown";
215
220
 
216
221
  type ExpectedStreamVersion<VersionType = BigIntStreamPosition> = ExpectedStreamVersionWithValue<VersionType> | ExpectedStreamVersionGeneral;
217
222
  type ExpectedStreamVersionWithValue<VersionType = BigIntStreamPosition> = Flavour<VersionType, 'StreamVersion'>;
@@ -230,6 +235,7 @@ interface EventStore<ReadEventMetadataType extends AnyReadEventMetadata = AnyRea
230
235
  aggregateStream<State, EventType extends Event>(streamName: string, options: AggregateStreamOptions<State, EventType, ReadEventMetadataType>): Promise<AggregateStreamResult<State, StreamPositionTypeOfReadEventMetadata<ReadEventMetadataType>>>;
231
236
  readStream<EventType extends Event>(streamName: string, options?: ReadStreamOptions<StreamPositionTypeOfReadEventMetadata<ReadEventMetadataType>>): Promise<ReadStreamResult<EventType, ReadEventMetadataType>>;
232
237
  appendToStream<EventType extends Event>(streamName: string, events: EventType[], options?: AppendToStreamOptions<StreamPositionTypeOfReadEventMetadata<ReadEventMetadataType>>): Promise<AppendToStreamResult<StreamPositionTypeOfReadEventMetadata<ReadEventMetadataType>>>;
238
+ streamExists(streamName: string): Promise<StreamExistsResult>;
233
239
  }
234
240
  type EventStoreReadEventMetadata<Store extends EventStore> = Store extends EventStore<infer T> ? T extends CommonReadEventMetadata<infer SP> ? T extends WithGlobalPosition<infer GP> ? ReadEventMetadata<GP, SP> & T : ReadEventMetadata<undefined, SP> & T : never : never;
235
241
  type GlobalPositionTypeOfEventStore<Store extends EventStore> = GlobalPositionTypeOfReadEventMetadata<EventStoreReadEventMetadata<Store>>;
@@ -289,6 +295,7 @@ type AppendToStreamResultWithGlobalPosition<StreamVersion = BigIntStreamPosition
289
295
  lastEventGlobalPosition: GlobalPosition;
290
296
  };
291
297
  type AppendStreamResultOfEventStore<Store extends EventStore> = Store['appendToStream'] extends (...args: any[]) => Promise<infer R> ? R : never;
298
+ type StreamExistsResult = boolean;
292
299
  type DefaultEventStoreOptions<Store extends EventStore, HandlerContext extends DefaultRecord | undefined = undefined> = {
293
300
  /**
294
301
  * Pluggable set of hooks informing about the event store internal behaviour.
@@ -489,12 +496,20 @@ declare const getInMemoryDatabase: () => InMemoryDatabase;
489
496
  type ProjectionHandlingType = 'inline' | 'async';
490
497
  type ProjectionHandler<EventType extends Event = AnyEvent, EventMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = BatchRecordedMessageHandlerWithContext<EventType, EventMetaDataType, ProjectionHandlerContext>;
491
498
  type TruncateProjection<ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = (context: ProjectionHandlerContext) => Promise<void>;
499
+ type ProjectionInitOptions<ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = {
500
+ version: number;
501
+ status?: 'active' | 'inactive';
502
+ registrationType: ProjectionHandlingType;
503
+ context: ProjectionHandlerContext;
504
+ };
492
505
  interface ProjectionDefinition<EventType extends Event = AnyEvent, EventMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord> {
493
506
  name?: string;
507
+ version?: number;
508
+ kind?: string;
494
509
  canHandle: CanHandle<EventType>;
495
510
  handle: ProjectionHandler<EventType, EventMetaDataType, ProjectionHandlerContext>;
496
511
  truncate?: TruncateProjection<ProjectionHandlerContext>;
497
- init?: (context: ProjectionHandlerContext) => void | Promise<void>;
512
+ init?: (options: ProjectionInitOptions<ProjectionHandlerContext>) => void | Promise<void>;
498
513
  }
499
514
  type ProjectionRegistration<HandlingType extends ProjectionHandlingType, ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = {
500
515
  type: HandlingType;
@@ -775,6 +790,11 @@ type Lock = {
775
790
  };
776
791
  declare const InProcessLock: () => Lock;
777
792
 
793
+ declare const toNormalizedString: (value: bigint) => string;
794
+ declare const bigInt: {
795
+ toNormalizedString: (value: bigint) => string;
796
+ };
797
+
778
798
  declare const delay: (ms: number) => Promise<void>;
779
799
  type AsyncAwaiter<T = void> = {
780
800
  wait: Promise<T>;
@@ -791,6 +811,8 @@ type AsyncRetryOptions<T = unknown> = retry.Options & {
791
811
  declare const NoRetries: AsyncRetryOptions;
792
812
  declare const asyncRetry: <T>(fn: () => Promise<T>, opts?: AsyncRetryOptions<T>) => Promise<T>;
793
813
 
814
+ declare const hashText: (text: string) => Promise<bigint>;
815
+
794
816
  declare const CommandHandlerStreamVersionConflictRetryOptions: AsyncRetryOptions;
795
817
  type CommandHandlerRetryOptions = AsyncRetryOptions | {
796
818
  onVersionConflict: true | number | AsyncRetryOptions;
@@ -830,9 +852,11 @@ declare const MessageProcessorType: {
830
852
  };
831
853
  type MessageProcessor<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord | undefined = undefined, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>> = {
832
854
  id: string;
855
+ instanceId: string;
833
856
  type: string;
857
+ init: (options: Partial<HandlerContext>) => Promise<void>;
834
858
  start: (options: Partial<HandlerContext>) => Promise<CurrentMessageProcessorPosition<CheckpointType> | undefined>;
835
- close: () => Promise<void>;
859
+ close: (closeOptions: Partial<HandlerContext>) => Promise<void>;
836
860
  isActive: boolean;
837
861
  handle: BatchRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, Partial<HandlerContext>>;
838
862
  };
@@ -852,9 +876,15 @@ type Checkpointer<MessageType extends AnyMessage = AnyMessage, MessageMetadataTy
852
876
  read: ReadProcessorCheckpoint<CheckpointType, HandlerContext>;
853
877
  store: StoreProcessorCheckpoint<MessageType, MessageMetadataType, CheckpointType, HandlerContext>;
854
878
  };
879
+ type ProcessorHooks<HandlerContext extends DefaultRecord = DefaultRecord> = {
880
+ onInit?: OnReactorInitHook<HandlerContext>;
881
+ onStart?: OnReactorStartHook<HandlerContext>;
882
+ onClose?: OnReactorCloseHook<HandlerContext>;
883
+ };
855
884
  type BaseMessageProcessorOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>> = {
856
885
  type?: string;
857
886
  processorId: string;
887
+ processorInstanceId?: string;
858
888
  version?: number;
859
889
  partition?: string;
860
890
  startFrom?: MessageProcessorStartFrom<CheckpointType>;
@@ -862,10 +892,7 @@ type BaseMessageProcessorOptions<MessageType extends AnyMessage = AnyMessage, Me
862
892
  processingScope?: MessageProcessingScope<HandlerContext>;
863
893
  checkpoints?: Checkpointer<MessageType, MessageMetadataType, HandlerContext, CheckpointType>;
864
894
  canHandle?: CanHandle<MessageType>;
865
- hooks?: {
866
- onStart?: OnReactorStartHook<HandlerContext>;
867
- onClose?: OnReactorCloseHook;
868
- };
895
+ hooks?: ProcessorHooks<HandlerContext>;
869
896
  };
870
897
  type HandlerOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
871
898
  eachMessage: SingleRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, HandlerContext>;
@@ -874,8 +901,9 @@ type HandlerOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadata
874
901
  eachMessage?: never;
875
902
  eachBatch: BatchRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, HandlerContext>;
876
903
  };
904
+ type OnReactorInitHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
877
905
  type OnReactorStartHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
878
- type OnReactorCloseHook = () => Promise<void>;
906
+ type OnReactorCloseHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
879
907
  type ReactorOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>> = BaseMessageProcessorOptions<MessageType, MessageMetadataType, HandlerContext, CheckpointType> & HandlerOptions<MessageType, MessageMetadataType, HandlerContext>;
880
908
  type ProjectorOptions<EventType extends AnyEvent = AnyEvent, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>> = Omit<BaseMessageProcessorOptions<EventType, MessageMetadataType, HandlerContext, CheckpointType>, 'type' | 'processorId'> & {
881
909
  processorId?: string;
@@ -896,7 +924,7 @@ type StoreProcessorCheckpointResult<CheckpointType = unknown> = {
896
924
  newCheckpoint: CheckpointType;
897
925
  } | {
898
926
  success: false;
899
- reason: 'IGNORED' | 'MISMATCH';
927
+ reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
900
928
  };
901
929
  type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, CheckpointType = unknown, HandlerContext extends DefaultRecord | undefined = undefined> = ((options: {
902
930
  message: RecordedMessage<MessageType, MessageMetadataType>;
@@ -911,6 +939,12 @@ type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageM
911
939
  lastCheckpoint: CheckpointType | null;
912
940
  partition?: string;
913
941
  }, context: HandlerContext) => Promise<StoreProcessorCheckpointResult<CheckpointType>>);
942
+ declare const defaultProcessorVersion = 1;
943
+ declare const defaultProcessorPartition = "emt:default";
944
+ declare const getProcessorInstanceId: (processorId: string) => string;
945
+ declare const getProjectorId: (options: {
946
+ projectionName: string;
947
+ }) => string;
914
948
  declare const reactor: <MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>>(options: ReactorOptions<MessageType, MessageMetadataType, HandlerContext, CheckpointType>) => MessageProcessor<MessageType, MessageMetadataType, HandlerContext, CheckpointType>;
915
949
  declare const projector: <EventType extends Event = Event, EventMetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<EventMetaDataType>>(options: ProjectorOptions<EventType, EventMetaDataType, HandlerContext, CheckpointType>) => MessageProcessor<EventType, EventMetaDataType, HandlerContext, CheckpointType>;
916
950
 
@@ -1017,4 +1051,4 @@ declare const assertNotEmptyString: (value: unknown) => string;
1017
1051
  declare const assertPositiveNumber: (value: unknown) => number;
1018
1052
  declare const assertUnsignedBigInt: (value: string) => bigint;
1019
1053
 
1020
- export { type AcquireLockOptions, type AfterEventStoreCommitHandler, type AggregateStreamOptions, type AggregateStreamResult, type AggregateStreamResultOfEventStore, type AggregateStreamResultWithGlobalPosition, type AnyCommand, type AnyEvent, type AnyMessage, type AnyReadEvent, type AnyReadEventMetadata, type AnyRecord, type AnyRecordedMessageMetadata, type AppendStreamResultOfEventStore, type AppendToStreamOptions, type AppendToStreamResult, type AppendToStreamResultWithGlobalPosition, type ArgumentMatcher, AssertionError, type AsyncAwaiter, type AsyncDeciderSpecification, type AsyncRetryOptions, type BaseMessageProcessorOptions, type BatchMessageHandler, type BatchMessageHandlerWithContext, type BatchMessageHandlerWithoutContext, type BatchRawMessageHandlerWithContext, type BatchRawMessageHandlerWithoutContext, type BatchRecordedMessageHandlerWithContext, type BatchRecordedMessageHandlerWithoutContext, type BeforeEventStoreCommitHandler, type BigIntGlobalPosition, type BigIntStreamPosition, type Brand, type CanHandle, type Checkpointer, type Closeable, type CombineMetadata, type CombinedMessageMetadata, type CombinedReadEventMetadata, type Command, type CommandBus, type CommandDataOf, CommandHandler, type CommandHandlerOptions, type CommandHandlerResult, type CommandHandlerRetryOptions, CommandHandlerStreamVersionConflictRetryOptions, type CommandMetaDataOf, type CommandProcessor, type CommandSender, type CommandTypeOf, type CommonReadEventMetadata, type CommonRecordedMessageMetadata, ConcurrencyError, type CreateCommandType, type CreateEventType, type CurrentMessageProcessorPosition, DATABASE_REQUIRED_ERROR_MESSAGE, type DatabaseHandleOptionErrors, type DatabaseHandleOptions, type DatabaseHandleResult, type Decider, DeciderCommandHandler, type DeciderCommandHandlerOptions, DeciderSpecification, type DeepReadonly, type DefaultCommandMetadata, type DefaultEventStoreOptions, type DefaultRecord, type DeleteManyOptions, type DeleteManyResult, type DeleteOneOptions, type DeleteResult, type Document, type DocumentHandler, EmmettError, type EnhancedOmit, type EnqueueTaskOptions, type Equatable, ErrorConstructor, type Event, type EventBus, type EventDataOf, type EventMetaDataOf, type EventStore, type EventStoreReadEventMetadata, type EventStoreSession, type EventStoreSessionFactory, type EventStoreWrapper, type EventSubscription, type EventTypeOf, type EventsPublisher, type ExpectedDocumentVersion, type ExpectedDocumentVersionGeneral, type ExpectedDocumentVersionValue, type ExpectedStreamVersion, type ExpectedStreamVersionGeneral, type ExpectedStreamVersionWithValue, ExpectedVersionConflictError, type Flavour, type FullId, type GetCheckpoint, type GlobalPositionTypeOfEventStore, type GlobalPositionTypeOfReadEventMetadata, type GlobalPositionTypeOfRecordedMessageMetadata, type GlobalStreamCaughtUp, GlobalStreamCaughtUpType, type GlobalSubscriptionEvent, type HandleOptions, type HandlerOptions, type InMemoryCheckpointer, type InMemoryDatabase, type InMemoryDocumentEvolve, type InMemoryDocumentsCollection, type InMemoryEventStore, InMemoryEventStoreDefaultStreamVersion, type InMemoryEventStoreOptions, type InMemoryMultiStreamProjectionOptions, type InMemoryProcessor, type InMemoryProcessorConnectionOptions, type InMemoryProcessorEachBatchHandler, type InMemoryProcessorEachMessageHandler, type InMemoryProcessorHandlerContext, type InMemoryProcessorOptions, type InMemoryProjectionAssert, type InMemoryProjectionDefinition, type InMemoryProjectionHandlerContext, type InMemoryProjectionHandlerOptions, type InMemoryProjectionOptions, InMemoryProjectionSpec, type InMemoryProjectionSpecEvent, type InMemoryProjectionSpecOptions, type InMemoryProjectionSpecWhenOptions, type InMemoryProjectorOptions, type InMemoryReactorOptions, type InMemoryReadEvent, type InMemoryReadEventMetadata, type InMemorySingleStreamProjectionOptions, type InMemoryWithNotNullDocumentEvolve, type InMemoryWithNullableDocumentEvolve, InProcessLock, type InsertManyOptions, type InsertManyResult, type InsertOneOptions, type InsertOneResult, JSONParser, type Lock, type LockOptions, type Mapper, type MapperArgs, type Message, type MessageBus, type MessageConsumer, type MessageConsumerOptions, type MessageDataOf, type MessageHandler, type MessageHandlerResult, type MessageKindOf, type MessageMetaDataOf, type MessageProcessingScope, MessageProcessor, type MessageProcessorStartFrom, MessageProcessorType, type MessageScheduler, type MessageSubscription, type MessageTypeOf, type MockedFunction, type Mutable, NO_CONCURRENCY_CHECK, NoRetries, type NonNullable$1 as NonNullable, type OnReactorCloseHook, type OnReactorStartHook, type OperationResult, type OptionalId, type OptionalUnlessRequiredId, type OptionalUnlessRequiredIdAndVersion, type OptionalUnlessRequiredVersion, type OptionalVersion, ParseError, type ParseOptions, type ProjectionDefinition, type ProjectionHandler, type ProjectionHandlingType, type ProjectionRegistration, type ProjectorOptions, type ReactorOptions, type ReadEvent, type ReadEventMetadata, type ReadEventMetadataWithGlobalPosition, type ReadEventMetadataWithoutGlobalPosition, type ReadProcessorCheckpoint, type ReadProcessorCheckpointResult, type ReadStreamOptions, type ReadStreamResult, type RecordedMessage, type RecordedMessageMetadata, type RecordedMessageMetadataWithGlobalPosition, type RecordedMessageMetadataWithoutGlobalPosition, type ReleaseLockOptions, type ReplaceOneOptions, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, type ScheduleOptions, type ScheduledMessage, type ScheduledMessageProcessor, type SingleMessageHandler, type SingleMessageHandlerWithContext, type SingleMessageHandlerWithoutContext, type SingleRawMessageHandlerWithContext, type SingleRawMessageHandlerWithoutContext, type SingleRecordedMessageHandlerWithContext, type SingleRecordedMessageHandlerWithoutContext, type StoreProcessorCheckpoint, type StoreProcessorCheckpointResult, type StreamPositionTypeOfEventStore, type StreamPositionTypeOfReadEventMetadata, type StreamPositionTypeOfRecordedMessageMetadata, type StringifyOptions, type Task, type TaskContext, TaskProcessor, type TaskProcessorOptions, type TaskQueue, type TaskQueueItem, type TestEventStream, type ThenThrows, type TruncateProjection, type UpdateManyOptions, type UpdateManyResult, type UpdateOneOptions, type UpdateResult, ValidationErrors, type WithGlobalPosition, type WithId, type WithIdAndVersion, type WithVersion, type WithoutId, type WithoutVersion, type Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowOutput, WrapEventStore, accept, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, canCreateEventStoreSession, caughtUpEventFrom, command, complete, deepEquals, defaultProcessingMessageProcessingScope, delay, documentExists, error, event, eventInStream, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, globalStreamCaughtUp, handleInMemoryProjections, ignore, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, matchesExpectedVersion, merge, message, newEventsInStream, nulloSessionFactory, parseDateFromUtcYYYYMMDD, projection, projections, projector, publish, reactor, reply, schedule, send, sum, tryPublishMessagesAfterCommit, verifyThat, wasMessageHandled };
1054
+ export { type AcquireLockOptions, type AfterEventStoreCommitHandler, type AggregateStreamOptions, type AggregateStreamResult, type AggregateStreamResultOfEventStore, type AggregateStreamResultWithGlobalPosition, type AnyCommand, type AnyEvent, type AnyMessage, type AnyReadEvent, type AnyReadEventMetadata, type AnyRecord, type AnyRecordedMessage, type AnyRecordedMessageMetadata, type AppendStreamResultOfEventStore, type AppendToStreamOptions, type AppendToStreamResult, type AppendToStreamResultWithGlobalPosition, type ArgumentMatcher, AssertionError, type AsyncAwaiter, type AsyncDeciderSpecification, type AsyncRetryOptions, type BaseMessageProcessorOptions, type BatchMessageHandler, type BatchMessageHandlerWithContext, type BatchMessageHandlerWithoutContext, type BatchRawMessageHandlerWithContext, type BatchRawMessageHandlerWithoutContext, type BatchRecordedMessageHandlerWithContext, type BatchRecordedMessageHandlerWithoutContext, type BeforeEventStoreCommitHandler, type BigIntGlobalPosition, type BigIntStreamPosition, type Brand, type CanHandle, type Checkpointer, type Closeable, type CombineMetadata, type CombinedMessageMetadata, type CombinedReadEventMetadata, type Command, type CommandBus, type CommandDataOf, CommandHandler, type CommandHandlerOptions, type CommandHandlerResult, type CommandHandlerRetryOptions, CommandHandlerStreamVersionConflictRetryOptions, type CommandMetaDataOf, type CommandProcessor, type CommandSender, type CommandTypeOf, type CommonReadEventMetadata, type CommonRecordedMessageMetadata, ConcurrencyError, type CreateCommandType, type CreateEventType, type CurrentMessageProcessorPosition, DATABASE_REQUIRED_ERROR_MESSAGE, type DatabaseHandleOptionErrors, type DatabaseHandleOptions, type DatabaseHandleResult, type Decider, DeciderCommandHandler, type DeciderCommandHandlerOptions, DeciderSpecification, type DeepReadonly, type DefaultCommandMetadata, type DefaultEventStoreOptions, type DefaultRecord, type DeleteManyOptions, type DeleteManyResult, type DeleteOneOptions, type DeleteResult, type Document, type DocumentHandler, EmmettError, type EnhancedOmit, type EnqueueTaskOptions, type Equatable, ErrorConstructor, type Event, type EventBus, type EventDataOf, type EventMetaDataOf, type EventStore, type EventStoreReadEventMetadata, type EventStoreSession, type EventStoreSessionFactory, type EventStoreWrapper, type EventSubscription, type EventTypeOf, type EventsPublisher, type ExpectedDocumentVersion, type ExpectedDocumentVersionGeneral, type ExpectedDocumentVersionValue, type ExpectedStreamVersion, type ExpectedStreamVersionGeneral, type ExpectedStreamVersionWithValue, ExpectedVersionConflictError, type Flavour, type FullId, type GetCheckpoint, type GlobalPositionTypeOfEventStore, type GlobalPositionTypeOfReadEventMetadata, type GlobalPositionTypeOfRecordedMessageMetadata, type GlobalStreamCaughtUp, GlobalStreamCaughtUpType, type GlobalSubscriptionEvent, type HandleOptions, type HandlerOptions, type InMemoryCheckpointer, type InMemoryDatabase, type InMemoryDocumentEvolve, type InMemoryDocumentsCollection, type InMemoryEventStore, InMemoryEventStoreDefaultStreamVersion, type InMemoryEventStoreOptions, type InMemoryMultiStreamProjectionOptions, type InMemoryProcessor, type InMemoryProcessorConnectionOptions, type InMemoryProcessorEachBatchHandler, type InMemoryProcessorEachMessageHandler, type InMemoryProcessorHandlerContext, type InMemoryProcessorOptions, type InMemoryProjectionAssert, type InMemoryProjectionDefinition, type InMemoryProjectionHandlerContext, type InMemoryProjectionHandlerOptions, type InMemoryProjectionOptions, InMemoryProjectionSpec, type InMemoryProjectionSpecEvent, type InMemoryProjectionSpecOptions, type InMemoryProjectionSpecWhenOptions, type InMemoryProjectorOptions, type InMemoryReactorOptions, type InMemoryReadEvent, type InMemoryReadEventMetadata, type InMemorySingleStreamProjectionOptions, type InMemoryWithNotNullDocumentEvolve, type InMemoryWithNullableDocumentEvolve, InProcessLock, type InsertManyOptions, type InsertManyResult, type InsertOneOptions, type InsertOneResult, JSONParser, type Lock, type LockOptions, type Mapper, type MapperArgs, type Message, type MessageBus, type MessageConsumer, type MessageConsumerOptions, type MessageDataOf, type MessageHandler, type MessageHandlerResult, type MessageKindOf, type MessageMetaDataOf, type MessageProcessingScope, MessageProcessor, type MessageProcessorStartFrom, MessageProcessorType, type MessageScheduler, type MessageSubscription, type MessageTypeOf, type MockedFunction, type Mutable, NO_CONCURRENCY_CHECK, NoRetries, type NonNullable$1 as NonNullable, type OnReactorCloseHook, type OnReactorInitHook, type OnReactorStartHook, type OperationResult, type OptionalId, type OptionalUnlessRequiredId, type OptionalUnlessRequiredIdAndVersion, type OptionalUnlessRequiredVersion, type OptionalVersion, ParseError, type ParseOptions, type ProcessorHooks, type ProjectionDefinition, type ProjectionHandler, type ProjectionHandlingType, type ProjectionInitOptions, type ProjectionRegistration, type ProjectorOptions, type ReactorOptions, type ReadEvent, type ReadEventMetadata, type ReadEventMetadataWithGlobalPosition, type ReadEventMetadataWithoutGlobalPosition, type ReadProcessorCheckpoint, type ReadProcessorCheckpointResult, type ReadStreamOptions, type ReadStreamResult, type RecordedMessage, type RecordedMessageMetadata, type RecordedMessageMetadataWithGlobalPosition, type RecordedMessageMetadataWithoutGlobalPosition, type ReleaseLockOptions, type ReplaceOneOptions, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, type ScheduleOptions, type ScheduledMessage, type ScheduledMessageProcessor, type SingleMessageHandler, type SingleMessageHandlerWithContext, type SingleMessageHandlerWithoutContext, type SingleRawMessageHandlerWithContext, type SingleRawMessageHandlerWithoutContext, type SingleRecordedMessageHandlerWithContext, type SingleRecordedMessageHandlerWithoutContext, type StoreProcessorCheckpoint, type StoreProcessorCheckpointResult, type StreamExistsResult, type StreamPositionTypeOfEventStore, type StreamPositionTypeOfReadEventMetadata, type StreamPositionTypeOfRecordedMessageMetadata, type StringifyOptions, type Task, type TaskContext, TaskProcessor, type TaskProcessorOptions, type TaskQueue, type TaskQueueItem, type TestEventStream, type ThenThrows, type TruncateProjection, type UpdateManyOptions, type UpdateManyResult, type UpdateOneOptions, type UpdateResult, ValidationErrors, type WithGlobalPosition, type WithId, type WithIdAndVersion, type WithVersion, type WithoutId, type WithoutVersion, type Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowOutput, WrapEventStore, accept, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, bigInt, canCreateEventStoreSession, caughtUpEventFrom, command, complete, deepEquals, defaultProcessingMessageProcessingScope, defaultProcessorPartition, defaultProcessorVersion, defaultTag, delay, documentExists, emmettPrefix, error, event, eventInStream, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, getProcessorInstanceId, getProjectorId, globalStreamCaughtUp, globalTag, handleInMemoryProjections, hashText, ignore, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, matchesExpectedVersion, merge, message, newEventsInStream, nulloSessionFactory, parseDateFromUtcYYYYMMDD, projection, projections, projector, publish, reactor, reply, schedule, send, sum, toNormalizedString, tryPublishMessagesAfterCommit, unknownTag, verifyThat, wasMessageHandled };
package/dist/index.d.ts CHANGED
@@ -75,6 +75,7 @@ type WithGlobalPosition<GlobalPosition> = Readonly<{
75
75
  globalPosition: GlobalPosition;
76
76
  }>;
77
77
  type RecordedMessageMetadata<GlobalPosition = undefined, StreamPosition = BigIntStreamPosition> = CommonRecordedMessageMetadata<StreamPosition> & (GlobalPosition extends undefined ? {} : WithGlobalPosition<GlobalPosition>);
78
+ type AnyRecordedMessage = Message<any, any, any>;
78
79
  type AnyRecordedMessageMetadata = RecordedMessageMetadata<any, any>;
79
80
  type RecordedMessageMetadataWithGlobalPosition<GlobalPosition = BigIntGlobalPosition> = RecordedMessageMetadata<GlobalPosition>;
80
81
  type RecordedMessageMetadataWithoutGlobalPosition<StreamPosition = BigIntStreamPosition> = RecordedMessageMetadata<undefined, StreamPosition>;
@@ -212,6 +213,10 @@ type Flavour<K, T> = K & {
212
213
  type DefaultRecord = Record<string, unknown>;
213
214
  type AnyRecord = Record<string, any>;
214
215
  type NonNullable$1<T> = T extends null | undefined ? never : T;
216
+ declare const emmettPrefix = "emt";
217
+ declare const globalTag = "global";
218
+ declare const defaultTag = "emt:default";
219
+ declare const unknownTag = "emt:unknown";
215
220
 
216
221
  type ExpectedStreamVersion<VersionType = BigIntStreamPosition> = ExpectedStreamVersionWithValue<VersionType> | ExpectedStreamVersionGeneral;
217
222
  type ExpectedStreamVersionWithValue<VersionType = BigIntStreamPosition> = Flavour<VersionType, 'StreamVersion'>;
@@ -230,6 +235,7 @@ interface EventStore<ReadEventMetadataType extends AnyReadEventMetadata = AnyRea
230
235
  aggregateStream<State, EventType extends Event>(streamName: string, options: AggregateStreamOptions<State, EventType, ReadEventMetadataType>): Promise<AggregateStreamResult<State, StreamPositionTypeOfReadEventMetadata<ReadEventMetadataType>>>;
231
236
  readStream<EventType extends Event>(streamName: string, options?: ReadStreamOptions<StreamPositionTypeOfReadEventMetadata<ReadEventMetadataType>>): Promise<ReadStreamResult<EventType, ReadEventMetadataType>>;
232
237
  appendToStream<EventType extends Event>(streamName: string, events: EventType[], options?: AppendToStreamOptions<StreamPositionTypeOfReadEventMetadata<ReadEventMetadataType>>): Promise<AppendToStreamResult<StreamPositionTypeOfReadEventMetadata<ReadEventMetadataType>>>;
238
+ streamExists(streamName: string): Promise<StreamExistsResult>;
233
239
  }
234
240
  type EventStoreReadEventMetadata<Store extends EventStore> = Store extends EventStore<infer T> ? T extends CommonReadEventMetadata<infer SP> ? T extends WithGlobalPosition<infer GP> ? ReadEventMetadata<GP, SP> & T : ReadEventMetadata<undefined, SP> & T : never : never;
235
241
  type GlobalPositionTypeOfEventStore<Store extends EventStore> = GlobalPositionTypeOfReadEventMetadata<EventStoreReadEventMetadata<Store>>;
@@ -289,6 +295,7 @@ type AppendToStreamResultWithGlobalPosition<StreamVersion = BigIntStreamPosition
289
295
  lastEventGlobalPosition: GlobalPosition;
290
296
  };
291
297
  type AppendStreamResultOfEventStore<Store extends EventStore> = Store['appendToStream'] extends (...args: any[]) => Promise<infer R> ? R : never;
298
+ type StreamExistsResult = boolean;
292
299
  type DefaultEventStoreOptions<Store extends EventStore, HandlerContext extends DefaultRecord | undefined = undefined> = {
293
300
  /**
294
301
  * Pluggable set of hooks informing about the event store internal behaviour.
@@ -489,12 +496,20 @@ declare const getInMemoryDatabase: () => InMemoryDatabase;
489
496
  type ProjectionHandlingType = 'inline' | 'async';
490
497
  type ProjectionHandler<EventType extends Event = AnyEvent, EventMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = BatchRecordedMessageHandlerWithContext<EventType, EventMetaDataType, ProjectionHandlerContext>;
491
498
  type TruncateProjection<ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = (context: ProjectionHandlerContext) => Promise<void>;
499
+ type ProjectionInitOptions<ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = {
500
+ version: number;
501
+ status?: 'active' | 'inactive';
502
+ registrationType: ProjectionHandlingType;
503
+ context: ProjectionHandlerContext;
504
+ };
492
505
  interface ProjectionDefinition<EventType extends Event = AnyEvent, EventMetaDataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord> {
493
506
  name?: string;
507
+ version?: number;
508
+ kind?: string;
494
509
  canHandle: CanHandle<EventType>;
495
510
  handle: ProjectionHandler<EventType, EventMetaDataType, ProjectionHandlerContext>;
496
511
  truncate?: TruncateProjection<ProjectionHandlerContext>;
497
- init?: (context: ProjectionHandlerContext) => void | Promise<void>;
512
+ init?: (options: ProjectionInitOptions<ProjectionHandlerContext>) => void | Promise<void>;
498
513
  }
499
514
  type ProjectionRegistration<HandlingType extends ProjectionHandlingType, ReadEventMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, ProjectionHandlerContext extends DefaultRecord = DefaultRecord> = {
500
515
  type: HandlingType;
@@ -775,6 +790,11 @@ type Lock = {
775
790
  };
776
791
  declare const InProcessLock: () => Lock;
777
792
 
793
+ declare const toNormalizedString: (value: bigint) => string;
794
+ declare const bigInt: {
795
+ toNormalizedString: (value: bigint) => string;
796
+ };
797
+
778
798
  declare const delay: (ms: number) => Promise<void>;
779
799
  type AsyncAwaiter<T = void> = {
780
800
  wait: Promise<T>;
@@ -791,6 +811,8 @@ type AsyncRetryOptions<T = unknown> = retry.Options & {
791
811
  declare const NoRetries: AsyncRetryOptions;
792
812
  declare const asyncRetry: <T>(fn: () => Promise<T>, opts?: AsyncRetryOptions<T>) => Promise<T>;
793
813
 
814
+ declare const hashText: (text: string) => Promise<bigint>;
815
+
794
816
  declare const CommandHandlerStreamVersionConflictRetryOptions: AsyncRetryOptions;
795
817
  type CommandHandlerRetryOptions = AsyncRetryOptions | {
796
818
  onVersionConflict: true | number | AsyncRetryOptions;
@@ -830,9 +852,11 @@ declare const MessageProcessorType: {
830
852
  };
831
853
  type MessageProcessor<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord | undefined = undefined, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>> = {
832
854
  id: string;
855
+ instanceId: string;
833
856
  type: string;
857
+ init: (options: Partial<HandlerContext>) => Promise<void>;
834
858
  start: (options: Partial<HandlerContext>) => Promise<CurrentMessageProcessorPosition<CheckpointType> | undefined>;
835
- close: () => Promise<void>;
859
+ close: (closeOptions: Partial<HandlerContext>) => Promise<void>;
836
860
  isActive: boolean;
837
861
  handle: BatchRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, Partial<HandlerContext>>;
838
862
  };
@@ -852,9 +876,15 @@ type Checkpointer<MessageType extends AnyMessage = AnyMessage, MessageMetadataTy
852
876
  read: ReadProcessorCheckpoint<CheckpointType, HandlerContext>;
853
877
  store: StoreProcessorCheckpoint<MessageType, MessageMetadataType, CheckpointType, HandlerContext>;
854
878
  };
879
+ type ProcessorHooks<HandlerContext extends DefaultRecord = DefaultRecord> = {
880
+ onInit?: OnReactorInitHook<HandlerContext>;
881
+ onStart?: OnReactorStartHook<HandlerContext>;
882
+ onClose?: OnReactorCloseHook<HandlerContext>;
883
+ };
855
884
  type BaseMessageProcessorOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>> = {
856
885
  type?: string;
857
886
  processorId: string;
887
+ processorInstanceId?: string;
858
888
  version?: number;
859
889
  partition?: string;
860
890
  startFrom?: MessageProcessorStartFrom<CheckpointType>;
@@ -862,10 +892,7 @@ type BaseMessageProcessorOptions<MessageType extends AnyMessage = AnyMessage, Me
862
892
  processingScope?: MessageProcessingScope<HandlerContext>;
863
893
  checkpoints?: Checkpointer<MessageType, MessageMetadataType, HandlerContext, CheckpointType>;
864
894
  canHandle?: CanHandle<MessageType>;
865
- hooks?: {
866
- onStart?: OnReactorStartHook<HandlerContext>;
867
- onClose?: OnReactorCloseHook;
868
- };
895
+ hooks?: ProcessorHooks<HandlerContext>;
869
896
  };
870
897
  type HandlerOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord> = {
871
898
  eachMessage: SingleRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, HandlerContext>;
@@ -874,8 +901,9 @@ type HandlerOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadata
874
901
  eachMessage?: never;
875
902
  eachBatch: BatchRecordedMessageHandlerWithContext<MessageType, MessageMetadataType, HandlerContext>;
876
903
  };
904
+ type OnReactorInitHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
877
905
  type OnReactorStartHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
878
- type OnReactorCloseHook = () => Promise<void>;
906
+ type OnReactorCloseHook<HandlerContext extends DefaultRecord = DefaultRecord> = (context: HandlerContext) => Promise<void>;
879
907
  type ReactorOptions<MessageType extends AnyMessage = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>> = BaseMessageProcessorOptions<MessageType, MessageMetadataType, HandlerContext, CheckpointType> & HandlerOptions<MessageType, MessageMetadataType, HandlerContext>;
880
908
  type ProjectorOptions<EventType extends AnyEvent = AnyEvent, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>> = Omit<BaseMessageProcessorOptions<EventType, MessageMetadataType, HandlerContext, CheckpointType>, 'type' | 'processorId'> & {
881
909
  processorId?: string;
@@ -896,7 +924,7 @@ type StoreProcessorCheckpointResult<CheckpointType = unknown> = {
896
924
  newCheckpoint: CheckpointType;
897
925
  } | {
898
926
  success: false;
899
- reason: 'IGNORED' | 'MISMATCH';
927
+ reason: 'IGNORED' | 'MISMATCH' | 'CURRENT_AHEAD';
900
928
  };
901
929
  type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, CheckpointType = unknown, HandlerContext extends DefaultRecord | undefined = undefined> = ((options: {
902
930
  message: RecordedMessage<MessageType, MessageMetadataType>;
@@ -911,6 +939,12 @@ type StoreProcessorCheckpoint<MessageType extends Message = AnyMessage, MessageM
911
939
  lastCheckpoint: CheckpointType | null;
912
940
  partition?: string;
913
941
  }, context: HandlerContext) => Promise<StoreProcessorCheckpointResult<CheckpointType>>);
942
+ declare const defaultProcessorVersion = 1;
943
+ declare const defaultProcessorPartition = "emt:default";
944
+ declare const getProcessorInstanceId: (processorId: string) => string;
945
+ declare const getProjectorId: (options: {
946
+ projectionName: string;
947
+ }) => string;
914
948
  declare const reactor: <MessageType extends Message = AnyMessage, MessageMetadataType extends AnyReadEventMetadata = AnyReadEventMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<MessageMetadataType>>(options: ReactorOptions<MessageType, MessageMetadataType, HandlerContext, CheckpointType>) => MessageProcessor<MessageType, MessageMetadataType, HandlerContext, CheckpointType>;
915
949
  declare const projector: <EventType extends Event = Event, EventMetaDataType extends AnyRecordedMessageMetadata = AnyRecordedMessageMetadata, HandlerContext extends DefaultRecord = DefaultRecord, CheckpointType = GlobalPositionTypeOfRecordedMessageMetadata<EventMetaDataType>>(options: ProjectorOptions<EventType, EventMetaDataType, HandlerContext, CheckpointType>) => MessageProcessor<EventType, EventMetaDataType, HandlerContext, CheckpointType>;
916
950
 
@@ -1017,4 +1051,4 @@ declare const assertNotEmptyString: (value: unknown) => string;
1017
1051
  declare const assertPositiveNumber: (value: unknown) => number;
1018
1052
  declare const assertUnsignedBigInt: (value: string) => bigint;
1019
1053
 
1020
- export { type AcquireLockOptions, type AfterEventStoreCommitHandler, type AggregateStreamOptions, type AggregateStreamResult, type AggregateStreamResultOfEventStore, type AggregateStreamResultWithGlobalPosition, type AnyCommand, type AnyEvent, type AnyMessage, type AnyReadEvent, type AnyReadEventMetadata, type AnyRecord, type AnyRecordedMessageMetadata, type AppendStreamResultOfEventStore, type AppendToStreamOptions, type AppendToStreamResult, type AppendToStreamResultWithGlobalPosition, type ArgumentMatcher, AssertionError, type AsyncAwaiter, type AsyncDeciderSpecification, type AsyncRetryOptions, type BaseMessageProcessorOptions, type BatchMessageHandler, type BatchMessageHandlerWithContext, type BatchMessageHandlerWithoutContext, type BatchRawMessageHandlerWithContext, type BatchRawMessageHandlerWithoutContext, type BatchRecordedMessageHandlerWithContext, type BatchRecordedMessageHandlerWithoutContext, type BeforeEventStoreCommitHandler, type BigIntGlobalPosition, type BigIntStreamPosition, type Brand, type CanHandle, type Checkpointer, type Closeable, type CombineMetadata, type CombinedMessageMetadata, type CombinedReadEventMetadata, type Command, type CommandBus, type CommandDataOf, CommandHandler, type CommandHandlerOptions, type CommandHandlerResult, type CommandHandlerRetryOptions, CommandHandlerStreamVersionConflictRetryOptions, type CommandMetaDataOf, type CommandProcessor, type CommandSender, type CommandTypeOf, type CommonReadEventMetadata, type CommonRecordedMessageMetadata, ConcurrencyError, type CreateCommandType, type CreateEventType, type CurrentMessageProcessorPosition, DATABASE_REQUIRED_ERROR_MESSAGE, type DatabaseHandleOptionErrors, type DatabaseHandleOptions, type DatabaseHandleResult, type Decider, DeciderCommandHandler, type DeciderCommandHandlerOptions, DeciderSpecification, type DeepReadonly, type DefaultCommandMetadata, type DefaultEventStoreOptions, type DefaultRecord, type DeleteManyOptions, type DeleteManyResult, type DeleteOneOptions, type DeleteResult, type Document, type DocumentHandler, EmmettError, type EnhancedOmit, type EnqueueTaskOptions, type Equatable, ErrorConstructor, type Event, type EventBus, type EventDataOf, type EventMetaDataOf, type EventStore, type EventStoreReadEventMetadata, type EventStoreSession, type EventStoreSessionFactory, type EventStoreWrapper, type EventSubscription, type EventTypeOf, type EventsPublisher, type ExpectedDocumentVersion, type ExpectedDocumentVersionGeneral, type ExpectedDocumentVersionValue, type ExpectedStreamVersion, type ExpectedStreamVersionGeneral, type ExpectedStreamVersionWithValue, ExpectedVersionConflictError, type Flavour, type FullId, type GetCheckpoint, type GlobalPositionTypeOfEventStore, type GlobalPositionTypeOfReadEventMetadata, type GlobalPositionTypeOfRecordedMessageMetadata, type GlobalStreamCaughtUp, GlobalStreamCaughtUpType, type GlobalSubscriptionEvent, type HandleOptions, type HandlerOptions, type InMemoryCheckpointer, type InMemoryDatabase, type InMemoryDocumentEvolve, type InMemoryDocumentsCollection, type InMemoryEventStore, InMemoryEventStoreDefaultStreamVersion, type InMemoryEventStoreOptions, type InMemoryMultiStreamProjectionOptions, type InMemoryProcessor, type InMemoryProcessorConnectionOptions, type InMemoryProcessorEachBatchHandler, type InMemoryProcessorEachMessageHandler, type InMemoryProcessorHandlerContext, type InMemoryProcessorOptions, type InMemoryProjectionAssert, type InMemoryProjectionDefinition, type InMemoryProjectionHandlerContext, type InMemoryProjectionHandlerOptions, type InMemoryProjectionOptions, InMemoryProjectionSpec, type InMemoryProjectionSpecEvent, type InMemoryProjectionSpecOptions, type InMemoryProjectionSpecWhenOptions, type InMemoryProjectorOptions, type InMemoryReactorOptions, type InMemoryReadEvent, type InMemoryReadEventMetadata, type InMemorySingleStreamProjectionOptions, type InMemoryWithNotNullDocumentEvolve, type InMemoryWithNullableDocumentEvolve, InProcessLock, type InsertManyOptions, type InsertManyResult, type InsertOneOptions, type InsertOneResult, JSONParser, type Lock, type LockOptions, type Mapper, type MapperArgs, type Message, type MessageBus, type MessageConsumer, type MessageConsumerOptions, type MessageDataOf, type MessageHandler, type MessageHandlerResult, type MessageKindOf, type MessageMetaDataOf, type MessageProcessingScope, MessageProcessor, type MessageProcessorStartFrom, MessageProcessorType, type MessageScheduler, type MessageSubscription, type MessageTypeOf, type MockedFunction, type Mutable, NO_CONCURRENCY_CHECK, NoRetries, type NonNullable$1 as NonNullable, type OnReactorCloseHook, type OnReactorStartHook, type OperationResult, type OptionalId, type OptionalUnlessRequiredId, type OptionalUnlessRequiredIdAndVersion, type OptionalUnlessRequiredVersion, type OptionalVersion, ParseError, type ParseOptions, type ProjectionDefinition, type ProjectionHandler, type ProjectionHandlingType, type ProjectionRegistration, type ProjectorOptions, type ReactorOptions, type ReadEvent, type ReadEventMetadata, type ReadEventMetadataWithGlobalPosition, type ReadEventMetadataWithoutGlobalPosition, type ReadProcessorCheckpoint, type ReadProcessorCheckpointResult, type ReadStreamOptions, type ReadStreamResult, type RecordedMessage, type RecordedMessageMetadata, type RecordedMessageMetadataWithGlobalPosition, type RecordedMessageMetadataWithoutGlobalPosition, type ReleaseLockOptions, type ReplaceOneOptions, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, type ScheduleOptions, type ScheduledMessage, type ScheduledMessageProcessor, type SingleMessageHandler, type SingleMessageHandlerWithContext, type SingleMessageHandlerWithoutContext, type SingleRawMessageHandlerWithContext, type SingleRawMessageHandlerWithoutContext, type SingleRecordedMessageHandlerWithContext, type SingleRecordedMessageHandlerWithoutContext, type StoreProcessorCheckpoint, type StoreProcessorCheckpointResult, type StreamPositionTypeOfEventStore, type StreamPositionTypeOfReadEventMetadata, type StreamPositionTypeOfRecordedMessageMetadata, type StringifyOptions, type Task, type TaskContext, TaskProcessor, type TaskProcessorOptions, type TaskQueue, type TaskQueueItem, type TestEventStream, type ThenThrows, type TruncateProjection, type UpdateManyOptions, type UpdateManyResult, type UpdateOneOptions, type UpdateResult, ValidationErrors, type WithGlobalPosition, type WithId, type WithIdAndVersion, type WithVersion, type WithoutId, type WithoutVersion, type Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowOutput, WrapEventStore, accept, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, canCreateEventStoreSession, caughtUpEventFrom, command, complete, deepEquals, defaultProcessingMessageProcessingScope, delay, documentExists, error, event, eventInStream, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, globalStreamCaughtUp, handleInMemoryProjections, ignore, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, matchesExpectedVersion, merge, message, newEventsInStream, nulloSessionFactory, parseDateFromUtcYYYYMMDD, projection, projections, projector, publish, reactor, reply, schedule, send, sum, tryPublishMessagesAfterCommit, verifyThat, wasMessageHandled };
1054
+ export { type AcquireLockOptions, type AfterEventStoreCommitHandler, type AggregateStreamOptions, type AggregateStreamResult, type AggregateStreamResultOfEventStore, type AggregateStreamResultWithGlobalPosition, type AnyCommand, type AnyEvent, type AnyMessage, type AnyReadEvent, type AnyReadEventMetadata, type AnyRecord, type AnyRecordedMessage, type AnyRecordedMessageMetadata, type AppendStreamResultOfEventStore, type AppendToStreamOptions, type AppendToStreamResult, type AppendToStreamResultWithGlobalPosition, type ArgumentMatcher, AssertionError, type AsyncAwaiter, type AsyncDeciderSpecification, type AsyncRetryOptions, type BaseMessageProcessorOptions, type BatchMessageHandler, type BatchMessageHandlerWithContext, type BatchMessageHandlerWithoutContext, type BatchRawMessageHandlerWithContext, type BatchRawMessageHandlerWithoutContext, type BatchRecordedMessageHandlerWithContext, type BatchRecordedMessageHandlerWithoutContext, type BeforeEventStoreCommitHandler, type BigIntGlobalPosition, type BigIntStreamPosition, type Brand, type CanHandle, type Checkpointer, type Closeable, type CombineMetadata, type CombinedMessageMetadata, type CombinedReadEventMetadata, type Command, type CommandBus, type CommandDataOf, CommandHandler, type CommandHandlerOptions, type CommandHandlerResult, type CommandHandlerRetryOptions, CommandHandlerStreamVersionConflictRetryOptions, type CommandMetaDataOf, type CommandProcessor, type CommandSender, type CommandTypeOf, type CommonReadEventMetadata, type CommonRecordedMessageMetadata, ConcurrencyError, type CreateCommandType, type CreateEventType, type CurrentMessageProcessorPosition, DATABASE_REQUIRED_ERROR_MESSAGE, type DatabaseHandleOptionErrors, type DatabaseHandleOptions, type DatabaseHandleResult, type Decider, DeciderCommandHandler, type DeciderCommandHandlerOptions, DeciderSpecification, type DeepReadonly, type DefaultCommandMetadata, type DefaultEventStoreOptions, type DefaultRecord, type DeleteManyOptions, type DeleteManyResult, type DeleteOneOptions, type DeleteResult, type Document, type DocumentHandler, EmmettError, type EnhancedOmit, type EnqueueTaskOptions, type Equatable, ErrorConstructor, type Event, type EventBus, type EventDataOf, type EventMetaDataOf, type EventStore, type EventStoreReadEventMetadata, type EventStoreSession, type EventStoreSessionFactory, type EventStoreWrapper, type EventSubscription, type EventTypeOf, type EventsPublisher, type ExpectedDocumentVersion, type ExpectedDocumentVersionGeneral, type ExpectedDocumentVersionValue, type ExpectedStreamVersion, type ExpectedStreamVersionGeneral, type ExpectedStreamVersionWithValue, ExpectedVersionConflictError, type Flavour, type FullId, type GetCheckpoint, type GlobalPositionTypeOfEventStore, type GlobalPositionTypeOfReadEventMetadata, type GlobalPositionTypeOfRecordedMessageMetadata, type GlobalStreamCaughtUp, GlobalStreamCaughtUpType, type GlobalSubscriptionEvent, type HandleOptions, type HandlerOptions, type InMemoryCheckpointer, type InMemoryDatabase, type InMemoryDocumentEvolve, type InMemoryDocumentsCollection, type InMemoryEventStore, InMemoryEventStoreDefaultStreamVersion, type InMemoryEventStoreOptions, type InMemoryMultiStreamProjectionOptions, type InMemoryProcessor, type InMemoryProcessorConnectionOptions, type InMemoryProcessorEachBatchHandler, type InMemoryProcessorEachMessageHandler, type InMemoryProcessorHandlerContext, type InMemoryProcessorOptions, type InMemoryProjectionAssert, type InMemoryProjectionDefinition, type InMemoryProjectionHandlerContext, type InMemoryProjectionHandlerOptions, type InMemoryProjectionOptions, InMemoryProjectionSpec, type InMemoryProjectionSpecEvent, type InMemoryProjectionSpecOptions, type InMemoryProjectionSpecWhenOptions, type InMemoryProjectorOptions, type InMemoryReactorOptions, type InMemoryReadEvent, type InMemoryReadEventMetadata, type InMemorySingleStreamProjectionOptions, type InMemoryWithNotNullDocumentEvolve, type InMemoryWithNullableDocumentEvolve, InProcessLock, type InsertManyOptions, type InsertManyResult, type InsertOneOptions, type InsertOneResult, JSONParser, type Lock, type LockOptions, type Mapper, type MapperArgs, type Message, type MessageBus, type MessageConsumer, type MessageConsumerOptions, type MessageDataOf, type MessageHandler, type MessageHandlerResult, type MessageKindOf, type MessageMetaDataOf, type MessageProcessingScope, MessageProcessor, type MessageProcessorStartFrom, MessageProcessorType, type MessageScheduler, type MessageSubscription, type MessageTypeOf, type MockedFunction, type Mutable, NO_CONCURRENCY_CHECK, NoRetries, type NonNullable$1 as NonNullable, type OnReactorCloseHook, type OnReactorInitHook, type OnReactorStartHook, type OperationResult, type OptionalId, type OptionalUnlessRequiredId, type OptionalUnlessRequiredIdAndVersion, type OptionalUnlessRequiredVersion, type OptionalVersion, ParseError, type ParseOptions, type ProcessorHooks, type ProjectionDefinition, type ProjectionHandler, type ProjectionHandlingType, type ProjectionInitOptions, type ProjectionRegistration, type ProjectorOptions, type ReactorOptions, type ReadEvent, type ReadEventMetadata, type ReadEventMetadataWithGlobalPosition, type ReadEventMetadataWithoutGlobalPosition, type ReadProcessorCheckpoint, type ReadProcessorCheckpointResult, type ReadStreamOptions, type ReadStreamResult, type RecordedMessage, type RecordedMessageMetadata, type RecordedMessageMetadataWithGlobalPosition, type RecordedMessageMetadataWithoutGlobalPosition, type ReleaseLockOptions, type ReplaceOneOptions, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, type ScheduleOptions, type ScheduledMessage, type ScheduledMessageProcessor, type SingleMessageHandler, type SingleMessageHandlerWithContext, type SingleMessageHandlerWithoutContext, type SingleRawMessageHandlerWithContext, type SingleRawMessageHandlerWithoutContext, type SingleRecordedMessageHandlerWithContext, type SingleRecordedMessageHandlerWithoutContext, type StoreProcessorCheckpoint, type StoreProcessorCheckpointResult, type StreamExistsResult, type StreamPositionTypeOfEventStore, type StreamPositionTypeOfReadEventMetadata, type StreamPositionTypeOfRecordedMessageMetadata, type StringifyOptions, type Task, type TaskContext, TaskProcessor, type TaskProcessorOptions, type TaskQueue, type TaskQueueItem, type TestEventStream, type ThenThrows, type TruncateProjection, type UpdateManyOptions, type UpdateManyResult, type UpdateOneOptions, type UpdateResult, ValidationErrors, type WithGlobalPosition, type WithId, type WithIdAndVersion, type WithVersion, type WithoutId, type WithoutVersion, type Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowOutput, WrapEventStore, accept, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, bigInt, canCreateEventStoreSession, caughtUpEventFrom, command, complete, deepEquals, defaultProcessingMessageProcessingScope, defaultProcessorPartition, defaultProcessorVersion, defaultTag, delay, documentExists, emmettPrefix, error, event, eventInStream, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, getProcessorInstanceId, getProjectorId, globalStreamCaughtUp, globalTag, handleInMemoryProjections, hashText, ignore, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, matchesExpectedVersion, merge, message, newEventsInStream, nulloSessionFactory, parseDateFromUtcYYYYMMDD, projection, projections, projector, publish, reactor, reply, schedule, send, sum, toNormalizedString, tryPublishMessagesAfterCommit, unknownTag, verifyThat, wasMessageHandled };