Public API

This page lists symbols available from package-root imports in 6.1.0. It intentionally excludes implementation files that are not re-exported by a package's src/index.ts; importing those files by deep path is unsupported by each package's export map.

@event-nest/core

Aggregate model and decorators

ExportKindPurpose
AggregateRootAbstract classHolds ID, version, and uncommitted events; provides append(), commit(), and reconstitute().
AggregateRootConfigDecoratorConfigures durable aggregate name and optional snapshot revision.
AggregateRootConfigParametersInterface{ name: string; snapshotRevision?: number }.
getAggregateRootNameFunctionReads aggregate-name metadata from a class.
getAggregateRootSnapshotRevisionFunctionReads optional snapshot-revision metadata from a class.
AggregateRootNameDecoratorDeprecated name-only configuration; planned removal in 7.x.
ApplyEventDecoratorAssociates an aggregate method with an event class for replay.
SnapshotAware<Snapshot>InterfaceRequires applySnapshot() and synchronous or asynchronous toSnapshot().
isAggregateInstanceSnapshotAwareType guardChecks for callable snapshot methods.
isAggregateClassSnapshotAwareFunctionChecks for numeric snapshot-revision metadata on an instance's class.
assertIsSnapshotAwareAggregateRootAssertionValidates name, methods, and class revision or throws.

See the decorator reference .

Domain events and subscriptions

ExportKindPurpose
DomainEventDecoratorRegisters an event's canonical persisted name and aliases.
DomainEventOptionsTypeOptional { aliases?: string[] }.
DomainEventEmitterClassDiscovers providers and dispatches persisted events. Usually adapter-managed.
DomainEventSubscriptionDecoratorRegisters a provider for event classes, optionally synchronously.
getEventIdFunctionReads the emitter's generated subscription ID for an event constructor.
getEventsFromDomainEventSubscriptionFunctionReads subscribed classes from an instance's metadata.
getSubscriptionAsyncTypeFunctionReads subscription async mode, defaulting to true.
isDomainEventSubscriptionFunctionChecks metadata and the presence of onDomainEvent.
OnDomainEvent<T>InterfaceHandler contract for subscription providers.
PublishedDomainEvent<T>InterfacePayload plus aggregate ID, occurrence time, persisted event ID, and aggregate version.
CoreModuleOptionsInterfaceShared concurrentSubscriptions?: boolean adapter option.

The helper functions are public because the barrel exports their source module, but normal applications need only the two decorators and OnDomainEvent/PublishedDomainEvent types.

Event store and persisted records

ExportKindPurpose
EVENT_STORESymbolNest injection token for the configured event store.
EventStoreInterfaceaddPublisher, version/event/snapshot reads, save, purgeAggregate, and ID generation used by the persistence pipeline.
AbstractEventStoreAbstract classStorage-independent publish pipeline for custom adapters.
AggregateRepository<T>ClassSnapshot-aware load and publisher-connected save helper.
AggregateRootFactory<T>Type(id, events, snapshot?, aggregateRootVersion?) => T.
AggregateRootClass<T>TypeConstructor/prototype representation that permits private aggregate constructors.
AggregateRootSnapshot<T>TypeInfers the aggregate's snapshot payload type.
SnapshotAwareAggregateRoot<T>Branded typeInternal-validation result used by snapshot store contracts.
StoredEventClassPersisted event representation and payload reconstruction helper.
StoredAggregateRootClassPersisted aggregate ID/version representation.

EventStore.findAggregateRootVersion() returns -1 when no aggregate/version is stored. findByAggregateRootId() returns []; findByAggregateRootIds() returns only keys that have events. findWithSnapshot() returns all events when no snapshot exists and includes aggregateRootVersion in built-in adapters. purgeAggregate() permanently removes snapshots, events, and aggregate state and treats a missing ID as a no-op at the interface level.

Snapshot stores and strategies

ExportKindPurpose
SNAPSHOT_STORESymbolSnapshot-store injection token; adapter modules do not re-export the provider.
SnapshotStoreInterfaceSnapshot creation, lookup, deletion, persistence, internal ID generation, and policy evaluation.
AbstractSnapshotStoreAbstract classImplements policy checks and snapshot construction for custom stores.
NoOpSnapshotStoreClassStore used when adapter snapshot settings are absent.
StoredSnapshot<T>ClassSnapshot ID, aggregate ID/version, revision, and payload.
SnapshotStrategyAbstract classBase for synchronous or asynchronous snapshot policies.
NoSnapshotStrategyClassAlways returns false.
ForCountSnapshotStrategyClassSnapshots when a commit crosses a positive event-count block.
ForCountSnapshotStrategyConfigInterface{ count: number }; values below 1 throw.
ForEventsSnapshotStrategyClassMatches when an uncommitted payload is an instance of a configured event class.
ForEventsSnapshotStrategyConfigInterface{ eventClasses: Class<unknown>[] }.
ForAggregateRootsStrategyClassMatches configured aggregate names.
ForAggregateRootsStrategyConfigInterface{ aggregates: AggregateRootClass<unknown>[] }.
AllOfSnapshotStrategyClassAwaits all child strategies and requires every result; an empty list throws.
AnyOfSnapshotStrategyClassAwaits all child strategies and requires any result; an empty list throws.

ForCountSnapshotStrategy evaluates the aggregate's current version plus the whole uncommitted batch, so crossing one or more thresholds in one commit still creates one snapshot.

Public exceptions

AggregateClassNotSnapshotAwareException, AggregateInstanceNotSnapshotAwareException, EventConcurrencyException, EventNameConflictException, MissingAggregateRootNameException, SnapshotRevisionMismatchException, SubscriptionException, and UnknownEventException are public. See exceptions .

Utility exports

ExportKindPurpose
Class<T, Arguments>TypeConstructable class type used by event and strategy APIs.
hasAllValuesType guardNarrows an array after checking that no item is null or undefined.

@event-nest/mongodb

The MongoDB barrel exports only:

ExportKindPurpose
EventNestMongoDbModuleNest dynamic moduleGlobal/scoped, synchronous/asynchronous MongoDB registration.
MongodbModuleOptionsTypeMongoDB connection, collections, optional client settings, subscriptions, and paired snapshots.
MongoDbModuleAsyncOptionsInterfaceuseFactory plus optional inject.
MongoEventStoreClassMongoDB EventStore implementation; adds aggregate/events collection getters.

MongoSnapshotStore, provider tokens, and document types are not public barrel exports.

@event-nest/postgresql

ExportKindPurpose
EventNestPostgreSQLModuleNest dynamic moduleGlobal/scoped, synchronous/asynchronous PostgreSQL registration.
PostgreSQLModuleOptionsTypeConnection, schema/tables, pool, SSL, initialization, subscriptions, and paired snapshots.
PostgreSQLModuleAsyncOptionsInterfaceuseFactory plus optional inject.
ConnectionPoolOptionsInterfaceKnex/Tarn pool pass-through options.
SslOptionsInterfaceCA certificate and required rejectUnauthorized flag.
SchemaConfigurationClassConfigured and schema-qualified PostgreSQL table names.
PostgreSQLEventStoreClassPostgreSQL EventStore implementation; exposes schemaConfiguration.

The PostgreSQL snapshot store, table initializer, Knex token, and row types are not public barrel exports.

@event-nest/mssql

ExportKindPurpose
EventNestMSSQLModuleNest dynamic moduleGlobal/scoped, synchronous/asynchronous SQL Server registration.
MSSQLModuleOptionsTypeStructured connection, schema/tables, pool, initialization, subscriptions, and paired snapshots.
MSSQLModuleAsyncOptionsInterfaceuseFactory plus optional inject.
MSSQLConnectionOptionsInterfaceRequired credentials/server/database and optional Tedious connection settings.
ConnectionPoolOptionsInterfaceKnex/Tarn pool options; distinct from the same-named PostgreSQL export.
SchemaConfigurationClassValidated configured and schema-qualified SQL Server table names.
MSSQLEventStoreClassSQL Server EventStore implementation; exposes schemaConfiguration.

The SQL Server snapshot store, table initializer, Knex token, and row types are not public barrel exports.

Sources

Last update at: 2026/09/02 00:14