@shirudo/ddd-kit 3.0.0-rc.12 → 3.0.0-rc.13

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.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as PendingEventLimitExceededErrorOptions, A as IdempotencyInFlightErrorOptions, B as InvalidEventStreamPageErrorOptions, C as FoldReturnedNoStateError, Ct as UnreplayableAggregateError, D as IdempotencyClaimLostErrorOptions, Dt as isWiringErrorLike, E as IdempotencyClaimLostError, Et as isInfrastructureErrorLike, F as InMemoryCapacityExceededError, G as KitWiringError, H as InvalidVersionError, I as InMemoryCapacityExceededErrorOptions, J as MissingFoldError, K as MisattributedEventError, L as InfrastructureError, M as IdempotencyKeyReuseErrorOptions, N as IdempotencyReconciliationRequiredError, O as IdempotencyCompletionWithoutClaimError, P as IdempotencyReconciliationRequiredErrorOptions, Q as PendingEventLimitExceededError, R as InvalidCommandMessageError, S as EventStreamPageReason, St as UnregisteredHandlerErrorOptions, T as HostileStateKeyError, Tt as isDomainErrorLike, U as KitErrorCode, V as InvalidIntegrationMessageError, W as KitErrorOptions, X as PendingEventBatchMismatchError, Y as MissingHandlerError, Z as PendingEventBatchMismatchErrorOptions, _ as DuplicateHandlerRegistrationError, _t as UnenrolledChangesErrorOptions, a as AggregateNotFoundErrorOptions, at as ReentrantEventRecordingErrorOptions, b as ErrorMapperFailedErrorOptions, bt as UnprojectableEventError, c as ConcurrencyConflictErrorOptions, ct as ReplayTargetMismatchError, d as DirectStateMutationErrorOptions, dt as SnapshotCorruptedError, et as ProjectionGapError, f as DomainError, ft as SnapshotSchemaMismatchError, g as DuplicateEventIdErrorOptions, gt as UnenrolledChangesError, h as DuplicateEventIdError, ht as SnapshotVersionNotRestoredErrorOptions, i as AggregateNotFoundError, it as ReentrantEventRecordingError, j as IdempotencyKeyReuseError, k as IdempotencyInFlightError, l as ConcurrencyConflictReason, lt as ReplayTargetMismatchErrorOptions, m as DuplicateAggregateErrorOptions, mt as SnapshotVersionNotRestoredError, n as AggregateDeletedErrorOptions, nt as ProjectionOrderViolationError, o as CapabilityRegistryConflictError, ot as ReplayRejectedError, p as DuplicateAggregateError, pt as SnapshotSchemaMismatchErrorOptions, q as MissingEntityIdError, r as AggregateIdentityMismatchOptions, rt as ProjectionReceiptViolationError, s as ConcurrencyConflictError, st as ReplayRejectedErrorOptions, t as AggregateDeletedError, tt as ProjectionIdentityViolationError, u as DirectStateMutationError, ut as ReplayTargetMismatchReason, v as DuplicateHandlerRegistrationErrorOptions, vt as UnmanagedInstanceError, w as ForeignEventError, wt as UnreplayableAggregateErrorOptions, x as EventHarvestError, xt as UnregisteredHandlerError, y as ErrorMapperFailedError, yt as UnmintedEventError, z as InvalidEventStreamPageError } from "./chunks/kit-errors.js";
2
- import { $ as EventHandler, $t as Command, A as IdempotencyClaimHandle, At as CreateDomainEventFromFactsOptions, B as withIdempotentCommit, Bt as PendingDomainEvent, C as IdentityMap, Ct as ExecutionContext, D as ProjectionPosition, Dt as EventCommitCandidatePosition, E as ProjectionCheckpointStore, Et as EventCommitCandidate, F as IdempotencyStore, Ft as DomainEventFactory, G as CommitEnrollment, Gt as createDomainEventFactory, H as DeadlineStore, Ht as UncommittedDomainEventOf, I as IdempotentCommitRequest, It as DomainEventFactoryOptions, J as WithCommitWorkResult, Jt as defaultDomainEventFactory, K as CommitEnrollmentOptions, Kt as createDomainEventFromFacts, L as IdempotentCommitResult, Lt as DomainEventStamp, M as IdempotencyOperationErrorContext, Mt as CreateDomainEventStampOptions, N as IdempotencyReconciliation, Nt as CreateUncommittedDomainEventOptions, O as isPositionAfter, Ot as AnyDomainEvent, P as IdempotencyReconciliationDecision, Pt as DomainEvent, Q as EventBus, Qt as AggregateIdentity, R as IdempotentExecution, Rt as EventIdFactory, S as AggregateClass, St as OutboxWriter, T as ProjectionCheckpoint, Tt as CommittedDomainEvent, U as DueDeadline, Ut as copyMetadata, V as DeadLetterDeadline, Vt as UncommittedDomainEvent, W as AggregateCommitToken, Wt as createDomainEvent, X as TransactionScope, Xt as recordDomainEvent, Y as withCommit, Yt as mergeMetadata, Z as TransactionalOptions, Zt as ClockFactory, _ as capturePersistenceBaseline, _t as routeEventsToCommandOutbox, a as EventStoreAppendOptions, at as Version, b as persistenceProjectionDrifted, bt as Outbox, c as StreamReadResult, ct as Id, d as RepositoryTracking, dt as CommandMessageContent, en as CommandHandler, et as OnceOptions, f as UnitOfWorkIdentityMap, ft as CommandMessageRelationships, g as PersistenceModel, gt as DurableCommandMessage, h as PersistenceLifecycle, ht as CommandOutboxWriter, i as EventStore, in as JsonValue, it as ReplayableAggregate, j as IdempotencyLease, jt as CreateDomainEventOptions, k as IdempotencyClaim, kt as AnyUncommittedDomainEvent, l as AggregatePersistenceWrite, lt as IdGenerator, m as PersistenceChanges, mt as CommandOutboxMapper, n as ReplayableStreamPages, nn as JsonObject, nt as Aggregate, o as EventStreamReader, ot as sameVersion, p as PersistenceBaseline, pt as CommandOutboxCommitCandidate, q as WithCommitDeps, qt as createUncommittedDomainEvent, r as reconstituteAggregateFromStreamPages, rn as JsonPrimitive, rt as AggregateSnapshot, s as ReadStreamOptions, st as toVersion, t as SnapshotStore, tn as PublishedCommand, tt as PublishOptions, u as AggregateWriteIntent, ut as CommandCommitOriginCandidate, v as derivePersistenceChanges, vt as DeadLetterRecord, w as Projection, wt as CommitPosition, x as recapturePersistenceBaseline, xt as OutboxRecord, y as insertPersistenceBaseline, yt as DispatchTrackingOutbox, z as WithIdempotentCommitDeps, zt as EventMetadata } from "./chunks/snapshot-store.js";
1
+ import { $ as PendingEventLimitExceededErrorOptions, A as IdempotencyInFlightErrorOptions, B as InvalidEventStreamPageErrorOptions, C as FoldReturnedNoStateError, Ct as UnreplayableAggregateError, D as IdempotencyClaimLostErrorOptions, Dt as isWiringErrorLike, E as IdempotencyClaimLostError, Et as isInfrastructureErrorLike, F as InMemoryCapacityExceededError, G as KitWiringError, H as InvalidVersionError, I as InMemoryCapacityExceededErrorOptions, J as MissingFoldError, K as MisattributedEventError, L as InfrastructureError, M as IdempotencyKeyReuseErrorOptions, N as IdempotencyReconciliationRequiredError, O as IdempotencyCompletionWithoutClaimError, P as IdempotencyReconciliationRequiredErrorOptions, Q as PendingEventLimitExceededError, R as InvalidCommandMessageError, S as EventStreamPageReason, St as UnregisteredHandlerErrorOptions, T as HandBuiltEventError, Tt as isDomainErrorLike, U as KitErrorCode, V as InvalidIntegrationMessageError, W as KitErrorOptions, X as PendingEventBatchMismatchError, Y as MissingHandlerError, Z as PendingEventBatchMismatchErrorOptions, _ as DuplicateHandlerRegistrationError, _t as UnmanagedInstanceError, a as AggregateNotFoundErrorOptions, at as ReentrantEventRecordingError, b as ErrorMapperFailedErrorOptions, bt as UnregisteredChangesErrorOptions, c as ConcurrencyConflictErrorOptions, ct as ReplayRejectedErrorOptions, d as DirectStateMutationErrorOptions, dt as ReplayTargetMismatchReason, et as ProjectionGapError, f as DomainError, ft as SnapshotCorruptedError, g as DuplicateEventIdErrorOptions, gt as SnapshotVersionNotRestoredErrorOptions, h as DuplicateEventIdError, ht as SnapshotVersionNotRestoredError, i as AggregateNotFoundError, it as PrototypePollutionError, j as IdempotencyKeyReuseError, k as IdempotencyInFlightError, l as ConcurrencyConflictReason, lt as ReplayTargetMismatchError, m as DuplicateAggregateErrorOptions, mt as SnapshotSchemaMismatchErrorOptions, n as AggregateDeletedErrorOptions, nt as ProjectionOrderViolationError, o as CapabilityRegistryConflictError, ot as ReentrantEventRecordingErrorOptions, p as DuplicateAggregateError, pt as SnapshotSchemaMismatchError, q as MissingEntityIdError, r as AggregateIdentityMismatchOptions, rt as ProjectionReceiptViolationError, s as ConcurrencyConflictError, st as ReplayRejectedError, t as AggregateDeletedError, tt as ProjectionIdentityViolationError, u as DirectStateMutationError, ut as ReplayTargetMismatchErrorOptions, v as DuplicateHandlerRegistrationErrorOptions, vt as UnprojectableEventError, w as ForeignEventError, wt as UnreplayableAggregateErrorOptions, x as EventCollectionError, xt as UnregisteredHandlerError, y as ErrorMapperFailedError, yt as UnregisteredChangesError, z as InvalidEventStreamPageError } from "./chunks/kit-errors.js";
2
+ import { $ as Version, A as IdempotentCommitRequest, At as DomainEventFactoryOptions, B as CommitRegistrationOptions, Bt as createStampedDomainEvent, C as IdempotencyClaim, Ct as AnyUnstampedDomainEvent, D as IdempotencyReconciliation, Dt as CreateUnstampedDomainEventOptions, E as IdempotencyOperationErrorContext, Et as CreateStampedDomainEventOptions, F as DeadLetterDeadline, Ft as UnstampedDomainEvent, G as TransactionalOptions, Gt as Command, H as WithCommitWorkResult, Ht as mergeMetadata, I as DeadlineStore, It as UnstampedDomainEventOf, J as OnceOptions, Jt as JsonObject, K as EventBus, Kt as CommandHandler, L as DueDeadline, Lt as copyMetadata, M as IdempotentExecution, Mt as EventIdFactory, N as WithIdempotentCommitDeps, Nt as EventMetadata, O as IdempotencyReconciliationDecision, Ot as DomainEvent, P as withIdempotentCommit, Pt as PendingDomainEvent, Q as ReplayableAggregate, R as AggregateCommitToken, Rt as createDomainEvent, S as isPositionAfter, St as AnyDomainEvent, T as IdempotencyLease, Tt as CreateDomainEventStampOptions, U as withCommit, Ut as ClockFactory, V as WithCommitDeps, Vt as defaultDomainEventFactory, W as TransactionScope, Wt as AggregateIdentity, X as Aggregate, Xt as JsonValue, Y as PublishOptions, Yt as JsonPrimitive, Z as AggregateSnapshot, _ as IdentityMap, _t as ExecutionContext, a as EventStoreAppendOptions, at as CommandMessageContent, b as ProjectionCheckpointStore, bt as EventCommitCandidate, c as StreamReadResult, ct as CommandOutboxMapper, d as RepositoryTracking, dt as routeEventsToCommandOutbox, et as sameVersion, f as UnitOfWorkIdentityMap, ft as DeadLetterRecord, g as AggregateClass, gt as OutboxWriter, h as PersistenceModel, ht as OutboxRecord, i as EventStore, it as CommandCommitOriginCandidate, j as IdempotentCommitResult, jt as DomainEventStamp, k as IdempotencyStore, kt as DomainEventFactory, l as AggregatePersistenceWrite, lt as CommandOutboxWriter, m as PersistenceLifecycle, mt as Outbox, n as ReplayableStreamPages, nt as Id, o as EventStreamReader, ot as CommandMessageRelationships, p as PersistenceChanges, pt as DispatchTrackingOutbox, q as EventHandler, qt as PublishedCommand, r as reconstituteAggregateFromStreamPages, rt as IdGenerator, s as ReadStreamOptions, st as CommandOutboxCommitCandidate, t as SnapshotStore, tt as toVersion, u as AggregateWriteIntent, ut as DurableCommandMessage, v as Projection, vt as CommitPosition, w as IdempotencyClaimHandle, wt as CreateDomainEventOptions, x as ProjectionPosition, xt as EventCommitCandidatePosition, y as ProjectionCheckpoint, yt as CommittedDomainEvent, z as CommitRegistration, zt as createDomainEventFactory } from "./chunks/snapshot-store.js";
3
3
  import { Result } from "@shirudo/result";
4
4
  import { ValidationError } from "@shirudo/base-error";
5
5
  //#region src/application/cqrs/internal/bus-internals.d.ts
@@ -788,7 +788,7 @@ interface InMemoryIdempotencyStoreOptions {
788
788
  *
789
789
  * On its own, the store is the reference for the leased family: it cannot
790
790
  * see commits or rollbacks. Claims and staged outcomes carry bounded leases,
791
- * while every mutation compares the store-minted token. An expired pending
791
+ * while every mutation compares the store-issued token. An expired pending
792
792
  * claim may be replaced; an expired staged outcome cannot be guessed away and
793
793
  * instead returns `reconciliation-required`. Only an authoritative
794
794
  * `committed` / `not-committed` decision can settle it.
@@ -1532,10 +1532,10 @@ interface AggregateTrackingErrorOptions {
1532
1532
  * A `CommitError` is the **potentially transient** post-completion
1533
1533
  * failure (a commit-time serialization failure is the classic case), so
1534
1534
  * it is the one a retrying caller should consider re-running. The
1535
- * deterministic post-completion failure, a harvest-guard violation (an
1535
+ * deterministic post-completion failure, a collection-guard violation (an
1536
1536
  * event missing `aggregateId` / `aggregateType`, or an eventful persisted
1537
1537
  * aggregate that did not advance its version), is a programming bug and surfaces as
1538
- * {@link EventHarvestError} instead, which does NOT extend
1538
+ * {@link EventCollectionError} instead, which does NOT extend
1539
1539
  * `InfrastructureError`, so it stays out of retry paths by construction.
1540
1540
  */
1541
1541
  declare class CommitError extends InfrastructureError<"COMMIT_FAILED"> {
@@ -1563,15 +1563,15 @@ declare class RollbackError extends InfrastructureError<"ROLLBACK_FAILED"> {
1563
1563
  constructor(cause: unknown, rollbackCause: unknown);
1564
1564
  }
1565
1565
  //#endregion
1566
- //#region src/application/unit-of-work/record-pending-events.d.ts
1567
- /** Minimal shell role accepted by {@link recordPendingEvents}. */
1566
+ //#region src/application/unit-of-work/stamp-pending-events.d.ts
1567
+ /** Minimal shell role accepted by {@link stampPendingEvents}. */
1568
1568
  type DomainEventStampFactory = Pick<DomainEventFactory, "createStamp">;
1569
1569
  /** Per-decision stamp provider for metadata that depends on the event. */
1570
- type DomainEventStampProvider<TEvent extends AnyDomainEvent> = (event: UncommittedDomainEventOf<TEvent>, index: number) => DomainEventStamp;
1570
+ type DomainEventStampProvider<TEvent extends AnyDomainEvent> = (event: UnstampedDomainEventOf<TEvent>, index: number) => DomainEventStamp;
1571
1571
  /**
1572
- * Stamp options that every decision of one recording shares: a recording time
1572
+ * Stamp options that every decision of one stamping shares: a stamp time
1573
1573
  * and metadata such as the correlation id of the request. An `eventId` is per
1574
- * fact, so the factory mints it for each decision.
1574
+ * fact, so the factory creates it for each decision.
1575
1575
  */
1576
1576
  type SharedDomainEventStampOptions = Omit<CreateDomainEventStampOptions, "eventId">;
1577
1577
  /**
@@ -1582,17 +1582,17 @@ type SharedDomainEventStampOptions = Omit<CreateDomainEventStampOptions, "eventI
1582
1582
  * batch on to persistence and needs no second read of `pendingEvents`.
1583
1583
  *
1584
1584
  * Recording is atomic with respect to the aggregate's pending list: if stamp
1585
- * creation or validation fails, every decision remains unrecorded. A
1585
+ * creation or validation fails, every decision remains unstamped. A
1586
1586
  * successful second call returns the same event objects and does not read the
1587
1587
  * factory again, which keeps event identity stable across transaction retries.
1588
1588
  *
1589
1589
  * Pass a `DomainEventFactory` (only its `createStamp` role is required) for one
1590
- * uniform recording policy. Add `stampOptions` for metadata that every
1590
+ * uniform stamping policy. Add `stampOptions` for metadata that every
1591
1591
  * decision of the batch shares, such as the correlation id of the request.
1592
1592
  * Pass a callback instead when metadata depends on the concrete decision.
1593
1593
  */
1594
- declare function recordPendingEvents<TId extends Id<string>, TEvent extends AnyDomainEvent>(aggregate: Aggregate<TId, TEvent>, factory: DomainEventStampFactory, stampOptions?: SharedDomainEventStampOptions): ReadonlyArray<TEvent>;
1595
- declare function recordPendingEvents<TId extends Id<string>, TEvent extends AnyDomainEvent>(aggregate: Aggregate<TId, TEvent>, createStamp: DomainEventStampProvider<TEvent>): ReadonlyArray<TEvent>;
1594
+ declare function stampPendingEvents<TId extends Id<string>, TEvent extends AnyDomainEvent>(aggregate: Aggregate<TId, TEvent>, factory: DomainEventStampFactory, stampOptions?: SharedDomainEventStampOptions): ReadonlyArray<TEvent>;
1595
+ declare function stampPendingEvents<TId extends Id<string>, TEvent extends AnyDomainEvent>(aggregate: Aggregate<TId, TEvent>, createStamp: DomainEventStampProvider<TEvent>): ReadonlyArray<TEvent>;
1596
1596
  //#endregion
1597
1597
  //#region src/application/unit-of-work/unit-of-work.d.ts
1598
1598
  /**
@@ -1635,7 +1635,7 @@ interface RepositoryDefinitionOptions<TCtx, TRepositoryPort extends object, TAgg
1635
1635
  * reach; the static factories stay the only door.
1636
1636
  */
1637
1637
  readonly aggregate: AggregateClass<TAggregate>;
1638
- /** Adapter-owned projection, baseline, and change-set policy. */
1638
+ /** Adapter-owned capture, baseline, and change-set policy. */
1639
1639
  readonly persistence: PersistenceModel<TAggregate, TBaseline, TChangeSet>;
1640
1640
  /**
1641
1641
  * Creates the transaction-bound adapter for the port's non-lifecycle
@@ -1840,7 +1840,7 @@ interface UnitOfWorkDeps<Evt extends AnyDomainEvent, TCtx, TDefinitions extends
1840
1840
  * transaction and either persist completely or not at all.
1841
1841
  *
1842
1842
  * Built ON TOP of `withCommit` - the commit orchestration (event
1843
- * harvest into the outbox inside the transaction, internal acknowledgement
1843
+ * collection into the outbox inside the transaction, internal acknowledgement
1844
1844
  * after the commit, best-effort in-process publish last) is inherited,
1845
1845
  * not reimplemented. What this layer adds:
1846
1846
  *
@@ -1906,7 +1906,7 @@ declare class UnitOfWork<Evt extends AnyDomainEvent, TCtx, TDefinitions extends
1906
1906
  * Execute one unit of work: open the transaction, hand the callback
1907
1907
  * tx-bound repositories, commit on resolve, roll back on throw,
1908
1908
  * run the post-commit lifecycle (acknowledge, observe, publish) for every
1909
- * enrolled aggregate. Returns the callback's result.
1909
+ * registered aggregate. Returns the callback's result.
1910
1910
  */
1911
1911
  run<R>(work: (context: UnitOfWorkContext<RepositoriesOf<TDefinitions>>) => Promise<R>, options?: RunOptions): Promise<R>;
1912
1912
  private buildRepositories;
@@ -2156,7 +2156,7 @@ declare abstract class Entity<TState, TId extends Id<string>> implements IEntity
2156
2156
  * `TState` publicly would expose the aggregate's live object graph and
2157
2157
  * let nested mutation bypass behavior, validation, versioning, and
2158
2158
  * dirty tracking. Concrete entities should expose business-meaningful queries or
2159
- * detached immutable DTOs (`deepFreeze(detachState(this.state))` for a
2159
+ * immutable DTOs (`deepFreeze(copyPlainState(this.state))` for a
2160
2160
  * plain-data state). Snapshot projection belongs to the persistence
2161
2161
  * adapter, which captures the aggregate from outside through those
2162
2162
  * queries and DTOs rather than asking the entity to create its own
@@ -2189,7 +2189,7 @@ declare abstract class Entity<TState, TId extends Id<string>> implements IEntity
2189
2189
  * widens to the whole graph: NESTED objects are frozen in place too.
2190
2190
  *
2191
2191
  * @throws MissingEntityIdError when `id` is not a non-blank string.
2192
- * @throws HostileStateKeyError when a plain-object, null-prototype,
2192
+ * @throws PrototypePollutionError when a plain-object, null-prototype,
2193
2193
  * or array state carries an own `"__proto__"` data key; validate and
2194
2194
  * strip untrusted input at the boundary.
2195
2195
  */
@@ -2205,23 +2205,11 @@ declare abstract class Entity<TState, TId extends Id<string>> implements IEntity
2205
2205
  * ownership transfer and is frozen in place; see the constructor.
2206
2206
  *
2207
2207
  * @param newState - The new state
2208
- * @throws HostileStateKeyError when the state carries an own
2208
+ * @throws PrototypePollutionError when the state carries an own
2209
2209
  * `"__proto__"` data key; the previous state is kept.
2210
2210
  */
2211
2211
  protected setState(newState: TState): void;
2212
2212
  }
2213
- /**
2214
- * Shallow-freezes `value` when it's a non-null object or array, so that
2215
- * direct property writes throw in strict mode. Returns the value as-is for
2216
- * primitives. `Entity` picks this or {@link deepFreeze} per the
2217
- * `deepFreezeState` config, so state read through the `state` getter
2218
- * cannot be mutated from outside, without a deep clone on every read.
2219
- *
2220
- * Subclass code stores state through `setState`, which freezes by the
2221
- * configured mode. The export remains for consumers using it as a
2222
- * standalone utility.
2223
- */
2224
- declare function freezeShallow<T>(value: T): T;
2225
2213
  /**
2226
2214
  * Checks if two entities have the same ID.
2227
2215
  * Works with any object that has an 'id' property.
@@ -2303,7 +2291,7 @@ declare function removeEntityById<TId extends Id<string>, T extends Identifiable
2303
2291
  /**
2304
2292
  * Updates an entity with the given ID in the collection.
2305
2293
  * Returns a new array with the updated entity.
2306
- * Structural sharing for adapter-owned persistence projections: returns
2294
+ * Structural sharing for adapter-owned persistence captures: returns
2307
2295
  * the ORIGINAL array when nothing changed (no match, or the element kept
2308
2296
  * its reference), so a partial-write adapter can skip the untouched
2309
2297
  * collection; a new array only when an
@@ -2333,7 +2321,7 @@ declare function updateEntityById<TId extends Id<string>, T extends Identifiable
2333
2321
  /**
2334
2322
  * Replaces an entity with the given ID in the collection.
2335
2323
  * Returns a new array with the replaced entity.
2336
- * Structural sharing for adapter-owned persistence projections: returns
2324
+ * Structural sharing for adapter-owned persistence captures: returns
2337
2325
  * the ORIGINAL array when nothing changed (no match, or the element kept
2338
2326
  * its reference), so a partial-write adapter can skip the untouched
2339
2327
  * collection; a new array only when an
@@ -2400,8 +2388,8 @@ interface AggregateConfig<TState = unknown> extends EntityConfig<TState> {
2400
2388
  * tracking, the kit-internal post-commit acknowledgement capability,
2401
2389
  * the `markReconstituted` post-load marker, and the `createEvent` helper
2402
2390
  * that auto-injects `aggregateId` + `aggregateType` on every event the
2403
- * aggregate emits. The application shell records the pending decisions
2404
- * with `recordPendingEvents` before persistence.
2391
+ * aggregate emits. The application shell stamps the pending decisions
2392
+ * with `stampPendingEvents` before persistence.
2405
2393
  *
2406
2394
  * Consumers do NOT extend this class directly; extend
2407
2395
  * `StateStoredAggregate` for state-stored aggregates or
@@ -2459,22 +2447,22 @@ declare abstract class BaseAggregate<TState, TId extends Id<string>, TEvent exte
2459
2447
  private readonly _maxPendingEvents;
2460
2448
  protected constructor(id: TId, initialState: TState, config?: AggregateConfig<TState>);
2461
2449
  /**
2462
- * Stamps every uncommitted decision in the pending list with identity
2463
- * and time from `createStamp`, passes an already recorded event through,
2450
+ * Stamps every unstamped decision in the pending list with identity
2451
+ * and time from `createStamp`, passes an already stamped event through,
2464
2452
  * and replaces the list atomically. Three guards run before the
2465
- * assignment: an event that no kit constructor minted is rejected
2466
- * ({@link UnmintedEventError}); a stamp provider that recorded a new
2453
+ * assignment: an event that no kit constructor built is rejected
2454
+ * ({@link HandBuiltEventError}); a stamp provider that recorded a new
2467
2455
  * decision on this aggregate mid-map is rejected
2468
2456
  * ({@link ReentrantEventRecordingError}); and two decisions that
2469
2457
  * received one eventId are rejected ({@link DuplicateEventIdError}).
2470
- * When a guard fires, every decision stays unrecorded.
2458
+ * When a guard fires, every decision stays unstamped.
2471
2459
  */
2472
2460
  private recordPendingDecisions;
2473
2461
  private acknowledgePendingEvents;
2474
2462
  /**
2475
2463
  * Post-commit cleanup for the deleted disposition. The row is gone, so
2476
2464
  * there is no persisted version to advance: stamping the marker from the
2477
- * live instance would make a later legitimate re-enrollment of this
2465
+ * live instance would make a later legitimate re-registration of this
2478
2466
  * instance trip the unique-cursor guard for a row that does not exist.
2479
2467
  */
2480
2468
  private discardPendingEventsAfterDeletion;
@@ -2536,12 +2524,12 @@ declare abstract class BaseAggregate<TState, TId extends Id<string>, TEvent exte
2536
2524
  */
2537
2525
  protected markReconstituted(version: Version): void;
2538
2526
  /**
2539
- * Appends a domain event to the pending list. The event must be minted
2527
+ * Appends a domain event to the pending list. The event must be kit-built
2540
2528
  * by a kit constructor; a missing `aggregateId` or `aggregateType` is
2541
2529
  * stamped from this aggregate, and an aggregate identity that names another
2542
2530
  * aggregate throws {@link MisattributedEventError} before anything is
2543
2531
  * recorded. Each append is one fact. A decision appended twice becomes
2544
- * two facts with distinct ids. A recorded event that is already pending
2532
+ * two facts with distinct ids. A stamped event that is already pending
2545
2533
  * throws {@link DuplicateEventIdError}, and a list at `maxPendingEvents`
2546
2534
  * throws {@link PendingEventLimitExceededError}, before anything is
2547
2535
  * recorded. Prefer the higher-level `StateStoredAggregate.setState()`
@@ -2556,7 +2544,7 @@ declare abstract class BaseAggregate<TState, TId extends Id<string>, TEvent exte
2556
2544
  protected addDomainEvent(event: PendingDomainEvent<TEvent>): void;
2557
2545
  /**
2558
2546
  * One identity per fact, checked before the change becomes observable:
2559
- * a recorded event whose `eventId` is already pending, or appears twice
2547
+ * a stamped event whose `eventId` is already pending, or appears twice
2560
2548
  * in one batch, throws {@link DuplicateEventIdError}. A decision has no
2561
2549
  * `eventId` yet, so a stamp provider that reuses one is caught at
2562
2550
  * recording instead.
@@ -2571,7 +2559,7 @@ declare abstract class BaseAggregate<TState, TId extends Id<string>, TEvent exte
2571
2559
  protected assertPendingEventLimit(added: number): void;
2572
2560
  /**
2573
2561
  * Appends an event that the caller already passed through
2574
- * {@link stampNewEventIdentity}, {@link assertEventIdsNotPending} and
2562
+ * {@link attributeNewEvent}, {@link assertEventIdsNotPending} and
2575
2563
  * {@link assertPendingEventLimit}. `setState()` and `apply()` run the
2576
2564
  * three before the state moves and append afterwards, so each gate
2577
2565
  * runs once per event.
@@ -2588,35 +2576,34 @@ declare abstract class BaseAggregate<TState, TId extends Id<string>, TEvent exte
2588
2576
  * present-but-foreign `aggregateId` / `aggregateType` is a wiring bug and
2589
2577
  * throws {@link MisattributedEventError}; missing fields are filled in
2590
2578
  * from the aggregate, so a recorded event always carries its full
2591
- * aggregate identity and can never fail the harvest or the replay guard
2592
- * later. The mint gate
2593
- * runs first, so an unminted event fails before anything else. The
2579
+ * aggregate identity and can never fail the collection or the replay guard
2580
+ * later. The kit-built check
2581
+ * runs first, so a hand-built event fails before anything else. The
2594
2582
  * stamped copy is frozen like the original (payload and metadata are
2595
2583
  * shared, already deep-frozen by the constructors); a fully stamped
2596
2584
  * event is returned as is.
2597
2585
  */
2598
- protected stampNewEventIdentity<E extends PendingDomainEvent<TEvent>>(event: E): E;
2586
+ protected attributeNewEvent<E extends PendingDomainEvent<TEvent>>(event: E): E;
2599
2587
  /**
2600
- * Mint gate for every recording path: only an event that a kit
2601
- * constructor produced passes. The kit marks two shapes: a recorded
2602
- * event carries the recorded brand (`createDomainEvent`,
2603
- * `createDomainEventFromFacts`) and a decision carries the uncommitted
2604
- * brand (`createUncommittedDomainEvent`, the aggregate `createEvent`
2605
- * helper). Either brand implies deeply frozen with defensively copied
2588
+ * Kit-built check for every recording path: only an event that a kit
2589
+ * constructor produced passes. The kit marks two shapes: a stamped
2590
+ * event carries the stamped brand (`createDomainEvent`,
2591
+ * `createStampedDomainEvent`) and a decision carries the unstamped
2592
+ * brand (the aggregate `createEvent` helper). Either brand implies deeply frozen with defensively copied
2606
2593
  * payload and metadata, a guarantee no frozen-ness probe can establish
2607
2594
  * (a shallow-frozen literal with mutable nested data would fool it).
2608
2595
  * O(1): one brand check per shape.
2609
2596
  */
2610
- protected assertMintedEvent(event: PendingDomainEvent<TEvent>): void;
2597
+ protected assertKitBuiltEvent(event: PendingDomainEvent<TEvent>): void;
2611
2598
  /**
2612
2599
  * Creates the immutable business fact accepted by this aggregate without
2613
2600
  * reading a clock, generating an id, or attaching tracing metadata.
2614
2601
  *
2615
- * The application shell records pending events after the domain operation
2602
+ * The application shell stamps pending events after the domain operation
2616
2603
  * and before persistence. Payload schema version stays here, next to the
2617
- * concrete event producer, rather than in shell-owned recording data.
2604
+ * concrete event producer, rather than in shell-owned stamp data.
2618
2605
  */
2619
- protected createEvent<E extends TEvent>(type: E["type"], payload: E["payload"], options?: Omit<CreateUncommittedDomainEventOptions, "aggregateId" | "aggregateType">): UncommittedDomainEventOf<E>;
2606
+ protected createEvent<E extends TEvent>(type: E["type"], payload: E["payload"], options?: Omit<CreateUnstampedDomainEventOptions, "aggregateId" | "aggregateType">): UnstampedDomainEventOf<E>;
2620
2607
  }
2621
2608
  //#endregion
2622
2609
  //#region src/domain/aggregate/event-sourced-aggregate.d.ts
@@ -2699,7 +2686,7 @@ declare abstract class EventSourcedAggregate<TState, TId extends Id<string>, TEv
2699
2686
  * the read boundary (see the event-upcasting guide) so the folds
2700
2687
  * always receive the current event shape.
2701
2688
  */
2702
- protected validateEvent(_event: UncommittedDomainEventOf<TEvent>): void;
2689
+ protected validateEvent(_event: UnstampedDomainEventOf<TEvent>): void;
2703
2690
  /**
2704
2691
  * Always throws {@link DirectStateMutationError}. An event-sourced
2705
2692
  * aggregate changes state only through `apply()`, where the fact is
@@ -2760,7 +2747,7 @@ declare abstract class EventSourcedAggregate<TState, TId extends Id<string>, TEv
2760
2747
  * stream corruption) after the all-or-nothing rollback. History
2761
2748
  * events without the optional aggregate identity fields pass unchecked (the
2762
2749
  * fields are optional on the event shape); NEW events are covered
2763
- * by the stricter `stampNewEventIdentity` on the apply path.
2750
+ * by the stricter `attributeNewEvent` on the apply path.
2764
2751
  */
2765
2752
  private assertReplayedEventBelongsHere;
2766
2753
  private fold;
@@ -2801,16 +2788,16 @@ declare abstract class EventSourcedAggregate<TState, TId extends Id<string>, TEv
2801
2788
  * state as `null` or as a status field, never as `undefined`.
2802
2789
  *
2803
2790
  * A fold MUST derive state from `type` and `payload` only. The
2804
- * parameter is typed as the uncommitted shape because a live `apply()`
2805
- * folds the event BEFORE the shell records it: `eventId` and
2806
- * `occurredAt` do not exist yet. Replay folds recorded events
2791
+ * parameter is typed as the unstamped shape because a live `apply()`
2792
+ * folds the event BEFORE the shell stamps it: `eventId` and
2793
+ * `occurredAt` do not exist yet. Replay folds stamped events
2807
2794
  * through the same map, so those fields ARE present at runtime
2808
2795
  * there. A fold that reads them through an escape hatch (`as any`,
2809
2796
  * plain JavaScript) sees `undefined` live and a value on replay,
2810
2797
  * producing silently divergent state. When a time or identity changes a
2811
2798
  * business decision, pass it in the payload.
2812
2799
  */
2813
- protected abstract readonly folds: { [K in TEvent["type"]]: Fold<TState, UncommittedDomainEventOf<Extract<TEvent, {
2800
+ protected abstract readonly folds: { [K in TEvent["type"]]: Fold<TState, UnstampedDomainEventOf<Extract<TEvent, {
2814
2801
  type: K;
2815
2802
  }>>>; };
2816
2803
  }
@@ -2833,13 +2820,13 @@ declare function reconstituteAggregateFromHistory<TAggregate extends ReplayableA
2833
2820
  * The aggregate owns identity, valid domain state, behavior, its current
2834
2821
  * domain version, and pending domain events. It deliberately does not own a
2835
2822
  * database baseline or dirty-key bookkeeping. A repository adapter defines
2836
- * its own persistence projection; the application shell retains that opaque
2823
+ * its own persistence capture; the application shell retains that opaque
2837
2824
  * baseline and derives the adapter's change set at flush.
2838
2825
  */
2839
2826
  declare abstract class StateStoredAggregate<TState, TId extends Id<string>, TEvent extends AnyDomainEvent = never> extends BaseAggregate<TState, TId, TEvent> {
2840
2827
  /**
2841
2828
  * Replaces the state, advances the OCC version, and records the events
2842
- * of the change, in that order. State validation, the event mint gate,
2829
+ * of the change, in that order. State validation, the kit-built check,
2843
2830
  * the aggregate identity check of the event, the pending event-id check,
2844
2831
  * and the pending event limit check run before the change becomes
2845
2832
  * observable, so a rejected decision records nothing and moves nothing.
@@ -2982,230 +2969,6 @@ declare abstract class Specification<T> {
2982
2969
  */
2983
2970
  declare function specification<T>(name: string, predicate: (candidate: T) => boolean): Specification<T>;
2984
2971
  //#endregion
2985
- //#region src/domain/state-machine/contracts.d.ts
2986
- /** Base shape for every input accepted by a domain state machine. */
2987
- type DomainMachineInput = {
2988
- readonly type: string;
2989
- };
2990
- /** Recursively readonly view of data accepted by the domain state machine. */
2991
- type DomainMachineReadonly<TValue> = TValue extends bigint | boolean | null | number | string | symbol | undefined ? TValue : TValue extends ((...args: never[]) => unknown) ? TValue : TValue extends readonly unknown[] ? { readonly [TKey in keyof TValue]: DomainMachineReadonly<TValue[TKey]>; } : TValue extends object ? { readonly [TKey in keyof TValue]: DomainMachineReadonly<TValue[TKey]>; } : TValue;
2992
- /** Immutable state and context value suitable for persistence. */
2993
- type DomainMachineSnapshot<TState extends string, TContext> = {
2994
- readonly state: TState;
2995
- readonly context: DomainMachineReadonly<TContext>;
2996
- };
2997
- /** Optional context replacement and requested external work from a reducer. */
2998
- type DomainTransitionResult<TContext, TOutput> = {
2999
- readonly context?: TContext;
3000
- readonly outputs?: readonly TOutput[];
3001
- };
3002
- /** A guard either allows, generically rejects, or returns a domain-specific rejection. */
3003
- type DomainTransitionGuardResult = boolean | DomainError;
3004
- /** A guarded state change and its optional pure context reducer. */
3005
- type DomainTransition<TState extends string, TContext, TInput extends DomainMachineInput, TOutput, TSource extends TState = TState> = {
3006
- readonly target: TState;
3007
- /**
3008
- * Must be synchronous, deterministic, and side-effect-free. Return a
3009
- * `DomainError` to provide a typed rejection that `can()` treats as false and
3010
- * `dispatch()` throws unchanged.
3011
- */
3012
- readonly guard?: (input: {
3013
- readonly state: TSource;
3014
- readonly context: DomainMachineReadonly<TContext>;
3015
- readonly input: DomainMachineReadonly<TInput>;
3016
- }) => DomainTransitionGuardResult;
3017
- /** Must be synchronous, deterministic, and side-effect-free. */
3018
- readonly reduce?: (input: {
3019
- readonly state: TSource;
3020
- readonly context: DomainMachineReadonly<TContext>;
3021
- readonly input: DomainMachineReadonly<TInput>;
3022
- }) => DomainTransitionResult<TContext, TOutput> | undefined;
3023
- };
3024
- /** Configuration for one named control state. */
3025
- type DomainStateNode<TState extends string, TContext, TInput extends DomainMachineInput, TOutput, TName extends TState = TState> = {
3026
- readonly terminal?: boolean;
3027
- /** State-specific context invariant. Must be synchronous, deterministic, and side-effect-free. */
3028
- readonly validateContext?: (input: {
3029
- readonly state: TName;
3030
- readonly context: DomainMachineReadonly<TContext>;
3031
- }) => boolean;
3032
- readonly on?: { readonly [TType in TInput["type"]]?: DomainTransition<TState, TContext, Extract<TInput, {
3033
- readonly type: TType;
3034
- }>, TOutput, TName>; };
3035
- };
3036
- /** Complete, finite domain lifecycle definition. */
3037
- type DomainMachineDefinition<TState extends string, TContext, TInput extends DomainMachineInput, TOutput = never> = {
3038
- readonly initial: TState;
3039
- readonly initialContext: () => TContext;
3040
- /** Must be synchronous, deterministic, and side-effect-free. */
3041
- readonly validateSnapshot?: (snapshot: DomainMachineSnapshot<TState, TContext>) => boolean;
3042
- readonly states: { readonly [TName in TState]: DomainStateNode<TState, TContext, TInput, TOutput, TName>; };
3043
- };
3044
- /** Result of a successful transition. */
3045
- type DomainTransitionOutcome<TState extends string, TContext, TOutput> = {
3046
- readonly from: TState;
3047
- readonly to: TState;
3048
- readonly snapshot: DomainMachineSnapshot<TState, TContext>;
3049
- readonly outputs: readonly DomainMachineReadonly<TOutput>[];
3050
- };
3051
- //#endregion
3052
- //#region src/domain/state-machine/analyzer.d.ts
3053
- type DomainMachineDefinitionDiagnostic<TState extends string> = {
3054
- readonly code: "unreachable-state";
3055
- readonly state: TState;
3056
- } | {
3057
- readonly code: "structural-dead-end";
3058
- readonly state: TState;
3059
- } | {
3060
- readonly code: "no-terminal-path";
3061
- readonly state: TState;
3062
- };
3063
- type DomainMachineTransitionDescription<TState extends string, TInputType extends string> = {
3064
- readonly state: TState;
3065
- readonly inputType: TInputType;
3066
- readonly target: TState;
3067
- readonly guarded: boolean;
3068
- };
3069
- type DomainMachineDefinitionAnalysis<TState extends string, TInputType extends string> = {
3070
- readonly diagnostics: readonly DomainMachineDefinitionDiagnostic<TState>[];
3071
- readonly transitions: readonly DomainMachineTransitionDescription<TState, TInputType>[];
3072
- /** States reachable when every guard is assumed to allow its transition. */
3073
- readonly structurallyReachableStates: readonly TState[];
3074
- /** States with a graph path to a terminal state when every guard is assumed to allow it. */
3075
- readonly statesWithTerminalPath: readonly TState[];
3076
- };
3077
- /**
3078
- * Inspects the declarative transition graph without executing definition callbacks.
3079
- * Guarded edges are treated as possible edges, so diagnostics never claim more
3080
- * runtime reachability than the static graph can prove.
3081
- */
3082
- declare function analyzeDomainMachineDefinition<TState extends string, TContext, TInput extends DomainMachineInput, TOutput>(definition: DomainMachineDefinition<TState, TContext, TInput, TOutput>): DomainMachineDefinitionAnalysis<TState, TInput["type"]>;
3083
- //#endregion
3084
- //#region src/domain/state-machine/definition.d.ts
3085
- declare const preparedDefinitionBrand: unique symbol;
3086
- /**
3087
- * A machine definition that `prepareDomainMachineDefinition` has
3088
- * validated, defensively copied, and deeply frozen. Assignable wherever
3089
- * a plain `DomainMachineDefinition` is accepted; the reverse does NOT
3090
- * hold (the brand is required), so an API that demands a prepared
3091
- * definition rejects raw ones at compile time. The pure functions and
3092
- * the `DomainStateMachine` constructor recognize prepared definitions
3093
- * at runtime and skip their per-call validate-and-copy.
3094
- */
3095
- type PreparedDomainMachineDefinition<TState extends string, TContext, TInput extends DomainMachineInput, TOutput = never> = DomainMachineDefinition<TState, TContext, TInput, TOutput> & {
3096
- readonly [preparedDefinitionBrand]: true;
3097
- };
3098
- /**
3099
- * Validates and stabilizes a machine definition ONCE, for repeated use
3100
- * with the pure functions. Without it, `transitionDomainState` and
3101
- * `canTransitionDomainState` re-validate and defensively re-copy the
3102
- * WHOLE definition on every call (the documented safety of the raw
3103
- * path); on a hot dispatch path that is avoidable O(definition) work.
3104
- * The `DomainStateMachine` class does the equivalent once in its
3105
- * constructor; this export brings the same amortization to pure-API
3106
- * users:
3107
- *
3108
- * ```ts
3109
- * const prepared = prepareDomainMachineDefinition(orderLifecycle);
3110
- * // per dispatch: no re-validation, no definition copy
3111
- * const outcome = transitionDomainState(prepared, snapshot, input);
3112
- * ```
3113
- *
3114
- * The returned definition is a deeply frozen copy, isolated from later
3115
- * mutation of the input object. Preparing an already-prepared
3116
- * definition returns it unchanged.
3117
- */
3118
- declare function prepareDomainMachineDefinition<TState extends string, TContext, TInput extends DomainMachineInput, TOutput>(definition: DomainMachineDefinition<TState, TContext, TInput, TOutput>): PreparedDomainMachineDefinition<TState, TContext, TInput, TOutput>;
3119
- //#endregion
3120
- //#region src/domain/state-machine/errors.d.ts
3121
- /** No transition is defined for the input in the current state. */
3122
- declare class InvalidDomainTransitionError extends DomainError<"INVALID_DOMAIN_TRANSITION"> {
3123
- readonly state: string;
3124
- readonly inputType: string;
3125
- constructor(state: string, inputType: string);
3126
- }
3127
- /** A defined transition was rejected by its domain guard. */
3128
- declare class DomainTransitionGuardRejectedError extends DomainError<"DOMAIN_TRANSITION_GUARD_REJECTED"> {
3129
- readonly state: string;
3130
- readonly inputType: string;
3131
- constructor(state: string, inputType: string);
3132
- }
3133
- /** The machine definition violates its runtime contract. */
3134
- declare class InvalidDomainMachineDefinitionError extends KitWiringError<"INVALID_DOMAIN_MACHINE_DEFINITION"> {
3135
- constructor(message: string, cause?: unknown);
3136
- }
3137
- /** Context contains unsupported or unsafe runtime data. */
3138
- declare class InvalidDomainMachineContextError extends KitWiringError<"INVALID_DOMAIN_MACHINE_CONTEXT"> {
3139
- constructor(message: string, cause?: unknown);
3140
- }
3141
- /** A supplied or produced snapshot is malformed or violates invariants. */
3142
- declare class InvalidDomainMachineSnapshotError extends KitWiringError<"INVALID_DOMAIN_MACHINE_SNAPSHOT"> {
3143
- constructor(message: string, cause?: unknown);
3144
- }
3145
- /** An input is malformed or contains unsupported runtime data. */
3146
- declare class InvalidDomainMachineInputError extends KitWiringError<"INVALID_DOMAIN_MACHINE_INPUT"> {
3147
- constructor(message: string, cause?: unknown);
3148
- }
3149
- /** A guard returned a value other than `boolean` or `DomainError`. */
3150
- declare class InvalidDomainTransitionGuardResultError extends KitWiringError<"INVALID_DOMAIN_TRANSITION_GUARD_RESULT"> {
3151
- constructor(message: string, cause?: unknown);
3152
- }
3153
- /** A reducer returned a malformed result or unsupported output data. */
3154
- declare class InvalidDomainTransitionResultError extends KitWiringError<"INVALID_DOMAIN_TRANSITION_RESULT"> {
3155
- constructor(message: string, cause?: unknown);
3156
- }
3157
- /** A callback attempted to evaluate the same stateful machine recursively. */
3158
- declare class ReentrantDomainStateMachineEvaluationError extends KitWiringError<"REENTRANT_DOMAIN_STATE_MACHINE_EVALUATION"> {
3159
- constructor();
3160
- }
3161
- //#endregion
3162
- //#region src/domain/state-machine/transition.d.ts
3163
- /** Creates and validates a fresh initial snapshot from a machine definition. */
3164
- declare function createInitialDomainMachineSnapshot<TState extends string, TContext, TInput extends DomainMachineInput, TOutput>(definition: DomainMachineDefinition<TState, TContext, TInput, TOutput>): DomainMachineSnapshot<TState, TContext>;
3165
- /**
3166
- * Checks whether an input currently has an allowed transition.
3167
- *
3168
- * Returns `false` for missing transitions, terminal states, rejected guards,
3169
- * and inputs without an own string `type` property. Invalid payload data for a
3170
- * matching transition and broken guard code still throw structured errors.
3171
- */
3172
- declare function canTransitionDomainState<TState extends string, TContext, TInput extends DomainMachineInput, TOutput>(definition: DomainMachineDefinition<TState, TContext, TInput, TOutput>, snapshot: DomainMachineSnapshot<TState, TContext>, input: TInput): boolean;
3173
- /**
3174
- * Applies one input without mutating the input definition or snapshot.
3175
- *
3176
- * @throws {@link InvalidDomainTransitionError} when no transition is defined.
3177
- * @throws {@link DomainTransitionGuardRejectedError} when its guard rejects.
3178
- * @throws A concrete `DomainError` returned by a rejecting guard.
3179
- */
3180
- declare function transitionDomainState<TState extends string, TContext, TInput extends DomainMachineInput, TOutput>(definition: DomainMachineDefinition<TState, TContext, TInput, TOutput>, snapshot: DomainMachineSnapshot<TState, TContext>, input: TInput): DomainTransitionOutcome<TState, TContext, TOutput>;
3181
- //#endregion
3182
- //#region src/domain/state-machine/domain-state-machine.d.ts
3183
- /**
3184
- * Stateful convenience wrapper around the pure domain transition functions.
3185
- *
3186
- * Persist {@link snapshot}, not the machine instance. Pass a restored snapshot
3187
- * to the second constructor overload to validate and reconstitute a machine.
3188
- */
3189
- declare class DomainStateMachine<TState extends string, TContext, TInput extends DomainMachineInput, TOutput = never> {
3190
- #private;
3191
- private readonly definition;
3192
- constructor(definition: DomainMachineDefinition<TState, TContext, TInput, TOutput>);
3193
- constructor(definition: DomainMachineDefinition<TState, TContext, TInput, TOutput>, snapshot: DomainMachineSnapshot<TState, TContext> | undefined);
3194
- /** Returns a defensive, deeply frozen copy of the current snapshot. */
3195
- get snapshot(): DomainMachineSnapshot<TState, TContext>;
3196
- /** Current named control state. */
3197
- get state(): TState;
3198
- /** Current deeply readonly context. */
3199
- get context(): DomainMachineReadonly<TContext>;
3200
- /** Whether the current state permanently forbids outgoing transitions. */
3201
- isTerminal(): boolean;
3202
- /** Checks a transition without changing the current snapshot. */
3203
- can(input: TInput): boolean;
3204
- /** Applies an input and advances the current snapshot on success. */
3205
- dispatch(input: TInput): DomainTransitionOutcome<TState, TContext, TOutput>;
3206
- private evaluate;
3207
- }
3208
- //#endregion
3209
2972
  //#region src/internal/structural/deep-omit.d.ts
3210
2973
  type DeepOmitKey = string | symbol;
3211
2974
  type DeepOmitPathSegment = string | number | symbol;
@@ -3253,7 +3016,7 @@ interface DeepOmitOptions {
3253
3016
  * built via `Object.create(proto)` so the prototype is preserved, but the
3254
3017
  * constructor is NOT re-invoked, so class invariants enforced by the
3255
3018
  * constructor are not re-checked. `deepOmit` is therefore best used for
3256
- * comparison/serialisation (`voEqualsExcept`, `deepEqualExcept`), not as
3019
+ * comparison/serialisation (`valueObjectEqualsExcept`, `deepEqualExcept`), not as
3257
3020
  * a general-purpose clone for behaviour-carrying objects.
3258
3021
  *
3259
3022
  * @param value - The value to create a deep copy from
@@ -3262,58 +3025,35 @@ interface DeepOmitOptions {
3262
3025
  */
3263
3026
  declare function deepOmit<T>(value: T, options: DeepOmitOptions): T;
3264
3027
  //#endregion
3265
- //#region src/internal/structural/deep-equal-except.d.ts
3266
- type DeepEqualExceptOptions = DeepOmitOptions;
3267
- /**
3268
- * Performs a deep equality comparison between two values after omitting specified keys.
3269
- *
3270
- * This function first removes the specified keys from both values using `deepOmit`,
3271
- * then performs a deep equality check using `deepEqual`.
3272
- *
3273
- * @param a - The first value to compare
3274
- * @param b - The second value to compare
3275
- * @param options - Options specifying which keys to omit before comparison
3276
- * @returns `true` if the values are deeply equal after omitting specified keys, `false` otherwise
3277
- *
3278
- * @example
3279
- * ```ts
3280
- * const obj1 = { id: 1, name: "Alice", updatedAt: "2024-01-01" };
3281
- * const obj2 = { id: 2, name: "Alice", updatedAt: "2024-01-02" };
3282
- *
3283
- * deepEqualExcept(obj1, obj2, { ignoreKeys: ["id", "updatedAt"] }); // true
3284
- * ```
3285
- */
3286
- declare function deepEqualExcept(a: unknown, b: unknown, options: DeepEqualExceptOptions): boolean;
3287
- //#endregion
3288
3028
  //#region src/domain/value-object/value-object.d.ts
3289
- type VO<T> = Readonly<T>;
3029
+ type ValueObjectOf<T> = Readonly<T>;
3290
3030
  declare function deepFreeze<T>(obj: T): Readonly<T>;
3291
3031
  /**
3292
3032
  * Creates a deeply immutable value object from the given data.
3293
3033
  *
3294
3034
  * The input is first deep-cloned, then the clone is frozen, so calling
3295
- * `vo(input)` never freezes the caller's own object graph as a
3296
- * side-effect. Mutating the input afterwards does not bleed into the VO.
3297
- * Symbol-keyed properties are preserved (matching `voEquals`). A kit
3035
+ * `valueObject(input)` never freezes the caller's own object graph as a
3036
+ * side-effect. Mutating the input afterwards does not bleed into the value object.
3037
+ * Symbol-keyed properties are preserved (matching `valueObjectEquals`). A kit
3298
3038
  * `ValueObject` instance nested in the input is kept by reference and
3299
3039
  * frozen in place; it must keep all of its state in `props`. A value
3300
3040
  * object as the input itself is rejected.
3301
3041
  * Function values and every other custom class instance are rejected
3302
3042
  * (Value Objects are plain data, not behaviour-bearing object graphs). Inputs must be trusted and
3303
3043
  * Proxy-free: ECMAScript provides no portable way to identify a transparent
3304
- * Proxy without potentially executing its traps, so `vo()` is not a sandbox
3044
+ * Proxy without potentially executing its traps, so `valueObject()` is not a sandbox
3305
3045
  * for hostile in-process objects. Built-ins that cannot provide immutable,
3306
- * value-based semantics are rejected instead of weakening the VO contract.
3046
+ * value-based semantics are rejected instead of weakening the value object contract.
3307
3047
  *
3308
3048
  * @example
3309
3049
  * ```typescript
3310
3050
  * const nested = { lat: 52.5, lng: 13.4 };
3311
- * const address = vo({ street: "Main St", coordinates: nested });
3051
+ * const address = valueObject({ street: "Main St", coordinates: nested });
3312
3052
  * address.coordinates.lat = 99; // ❌ Cannot assign to read-only property
3313
3053
  * nested.lat = 0; // ✅ caller's input still mutable
3314
3054
  * ```
3315
3055
  */
3316
- declare function vo<T>(t: T): VO<T>;
3056
+ declare function valueObject<T>(t: T): ValueObjectOf<T>;
3317
3057
  /**
3318
3058
  * Compares two value objects for equality based on their values.
3319
3059
  * Uses deep equality comparison that handles:
@@ -3329,22 +3069,22 @@ declare function vo<T>(t: T): VO<T>;
3329
3069
  *
3330
3070
  * @example
3331
3071
  * ```typescript
3332
- * const money1 = vo({ amount: 100, currency: "USD" });
3333
- * const money2 = vo({ amount: 100, currency: "USD" });
3334
- * voEquals(money1, money2); // true
3072
+ * const money1 = valueObject({ amount: 100, currency: "USD" });
3073
+ * const money2 = valueObject({ amount: 100, currency: "USD" });
3074
+ * valueObjectEquals(money1, money2); // true
3335
3075
  *
3336
- * const address1 = vo({
3076
+ * const address1 = valueObject({
3337
3077
  * street: "Main St",
3338
3078
  * coordinates: { lat: 52.5, lng: 13.4 }
3339
3079
  * });
3340
- * const address2 = vo({
3080
+ * const address2 = valueObject({
3341
3081
  * street: "Main St",
3342
3082
  * coordinates: { lat: 52.5, lng: 13.4 }
3343
3083
  * });
3344
- * voEquals(address1, address2); // true
3084
+ * valueObjectEquals(address1, address2); // true
3345
3085
  * ```
3346
3086
  */
3347
- declare function voEquals<T>(a: VO<T>, b: VO<T>): boolean;
3087
+ declare function valueObjectEquals<T>(a: ValueObjectOf<T>, b: ValueObjectOf<T>): boolean;
3348
3088
  /**
3349
3089
  * Compares two value objects for equality while ignoring specified keys.
3350
3090
  * Useful for comparing value objects that contain metadata or optional fields
@@ -3363,38 +3103,38 @@ declare function voEquals<T>(a: VO<T>, b: VO<T>): boolean;
3363
3103
  * @example
3364
3104
  * ```typescript
3365
3105
  * // Value object with metadata
3366
- * const address1 = vo({
3106
+ * const address1 = valueObject({
3367
3107
  * street: "Main St",
3368
3108
  * city: "Berlin",
3369
3109
  * metadata: { createdAt: "2024-01-01", updatedAt: "2024-01-02" }
3370
3110
  * });
3371
3111
  *
3372
- * const address2 = vo({
3112
+ * const address2 = valueObject({
3373
3113
  * street: "Main St",
3374
3114
  * city: "Berlin",
3375
3115
  * metadata: { createdAt: "2024-01-01", updatedAt: "2024-01-03" }
3376
3116
  * });
3377
3117
  *
3378
3118
  * // Compare ignoring metadata timestamps
3379
- * voEqualsExcept(address1, address2, {
3119
+ * valueObjectEqualsExcept(address1, address2, {
3380
3120
  * ignoreKeys: ["updatedAt"],
3381
3121
  * ignoreKeyPredicate: (key, path) => path.includes("metadata")
3382
3122
  * }); // true
3383
3123
  *
3384
3124
  * // Compare ignoring all metadata
3385
- * voEqualsExcept(address1, address2, {
3125
+ * valueObjectEqualsExcept(address1, address2, {
3386
3126
  * ignoreKeyPredicate: (key, path) => path.includes("metadata")
3387
3127
  * }); // true
3388
3128
  * ```
3389
3129
  */
3390
- declare function voEqualsExcept<T>(a: VO<T>, b: VO<T>, options: DeepEqualExceptOptions): boolean;
3130
+ declare function valueObjectEqualsExcept<T>(a: ValueObjectOf<T>, b: ValueObjectOf<T>, options: DeepOmitOptions): boolean;
3391
3131
  /**
3392
3132
  * Creates a value object with optional validation.
3393
3133
  * Returns a Result type instead of throwing an error.
3394
3134
  *
3395
3135
  * Note: the Result covers VALIDATION failures only. Non-data values and
3396
3136
  * built-ins without immutable value semantics still throw a
3397
- * `TypeError` from `vo()`; they cannot occur in parsed JSON and signal
3137
+ * `TypeError` from `valueObject()`; they cannot occur in parsed JSON and signal
3398
3138
  * a programming error, not a validation failure.
3399
3139
  *
3400
3140
  * @param t - The data to convert into a value object
@@ -3404,7 +3144,7 @@ declare function voEqualsExcept<T>(a: VO<T>, b: VO<T>, options: DeepEqualExceptO
3404
3144
  *
3405
3145
  * @example
3406
3146
  * ```typescript
3407
- * const result = voWithValidation(
3147
+ * const result = valueObjectOrError(
3408
3148
  * { amount: 100, currency: "USD" },
3409
3149
  * (m) => m.amount >= 0 && m.currency.length === 3,
3410
3150
  * "Invalid money: amount must be non-negative and currency must be 3 characters"
@@ -3417,7 +3157,7 @@ declare function voEqualsExcept<T>(a: VO<T>, b: VO<T>, options: DeepEqualExceptO
3417
3157
  * }
3418
3158
  * ```
3419
3159
  */
3420
- declare function voWithValidation<T>(t: T, validate: (value: T) => boolean, errorMessage?: string): Result<VO<T>, string>;
3160
+ declare function valueObjectOrError<T>(t: T, validate: (value: T) => boolean, errorMessage?: string): Result<ValueObjectOf<T>, string>;
3421
3161
  /**
3422
3162
  * Interface for Value Objects.
3423
3163
  * Value Objects are immutable and defined by their properties.
@@ -3515,16 +3255,16 @@ declare abstract class ValueObject<T extends object> implements IValueObject<T>
3515
3255
  toJSON(): Readonly<T>;
3516
3256
  }
3517
3257
  //#endregion
3518
- //#region src/domain/value-object/vo-validated.d.ts
3258
+ //#region src/domain/value-object/value-object-or-issues.d.ts
3519
3259
  /**
3520
3260
  * Builds an immutable value object while collecting **all** validation
3521
3261
  * violations into a single {@link ValidationError}, instead of failing on the
3522
3262
  * first one. This is the Result-first, multi-error counterpart to
3523
- * `voWithValidation` (which returns a single string message).
3263
+ * `valueObjectOrError` (which returns a single string message).
3524
3264
  *
3525
3265
  * The `validate` callback receives a fresh `ValidationError` to push field
3526
3266
  * issues onto (via `addIssue` / `addIssues`) and the raw input. When no issue
3527
- * was recorded the input is frozen into a `VO<T>` and returned as `Ok`;
3267
+ * was recorded the input is frozen into a `ValueObjectOf<T>` and returned as `Ok`;
3528
3268
  * otherwise the populated `ValidationError` is returned as `Err`.
3529
3269
  *
3530
3270
  * `ValidationError` comes from `@shirudo/base-error`; import it from there to
@@ -3534,7 +3274,7 @@ declare abstract class ValueObject<T extends object> implements IValueObject<T>
3534
3274
  *
3535
3275
  * @example
3536
3276
  * ```ts
3537
- * const result = voValidated(
3277
+ * const result = valueObjectOrIssues(
3538
3278
  * { email, age },
3539
3279
  * (issues, m) => {
3540
3280
  * if (!isEmail(m.email))
@@ -3547,38 +3287,9 @@ declare abstract class ValueObject<T extends object> implements IValueObject<T>
3547
3287
  * // result.isErr() → result.error.publicIssues() has both violations
3548
3288
  * ```
3549
3289
  */
3550
- declare function voValidated<T>(t: T, validate: (issues: ValidationError, value: T) => void, message?: string): Result<VO<T>, ValidationError>;
3290
+ declare function valueObjectOrIssues<T>(t: T, validate: (issues: ValidationError, value: T) => void, message?: string): Result<ValueObjectOf<T>, ValidationError>;
3551
3291
  //#endregion
3552
- //#region src/internal/structural/deep-equal.d.ts
3553
- /**
3554
- * Performs a deep equality check between two values.
3555
- *
3556
- * This function compares values recursively, handling:
3557
- * - Primitives (with special handling for NaN)
3558
- * - Arrays (nested arrays supported)
3559
- * - Objects (plain objects and class instances)
3560
- * - TypedArrays (Uint8Array, Int32Array, etc.)
3561
- * - DataView
3562
- * - Maps and Sets
3563
- * - Dates and RegExp
3564
- * - Wrapper objects (Boolean, Number, String)
3565
- * - Circular references (detected and handled)
3566
- *
3567
- * @param a - The first value to compare
3568
- * @param b - The second value to compare
3569
- * @returns `true` if the values are deeply equal, `false` otherwise
3570
- *
3571
- * @example
3572
- * ```ts
3573
- * deepEqual([1, 2, 3], [1, 2, 3]); // true
3574
- * deepEqual({ a: 1, b: [2, 3] }, { a: 1, b: [2, 3] }); // true
3575
- * deepEqual(NaN, NaN); // true
3576
- * deepEqual([1, 2], [1, 2, 3]); // false
3577
- * ```
3578
- */
3579
- declare function deepEqual(a: unknown, b: unknown): boolean;
3580
- //#endregion
3581
- //#region src/internal/structural/detach-state.d.ts
3292
+ //#region src/internal/structural/copy-plain-state.d.ts
3582
3293
  /**
3583
3294
  * Returns a copy of `state` that shares no object with the original.
3584
3295
  * Throws a `TypeError` that names the path when the graph carries a value
@@ -3587,7 +3298,7 @@ declare function deepEqual(a: unknown, b: unknown): boolean;
3587
3298
  * symbol-keyed, non-enumerable, or accessor property and an expando on a
3588
3299
  * built-in are dropped. A function or a symbol value throws a raw
3589
3300
  * `DataCloneError`. An Error, a Promise, a WeakMap, or a WeakSet cannot be
3590
- * detached at all. A SharedArrayBuffer and a view over one keep sharing
3301
+ * copied at all. A SharedArrayBuffer and a view over one keep sharing
3591
3302
  * their memory. A Proxy fails in the walk or in the clone; a failure in
3592
3303
  * the clone is rethrown as a `TypeError` with the cause. An error that a
3593
3304
  * Proxy trap throws in the walk passes unchanged, so a coded error of the
@@ -3616,12 +3327,41 @@ declare function deepEqual(a: unknown, b: unknown): boolean;
3616
3327
  * throws. A non-enumerable symbol key passes anywhere: it is metadata by
3617
3328
  * convention.
3618
3329
  *
3619
- * The concrete entity uses it for a detached read DTO of a plain-data
3330
+ * The concrete entity uses it for the plain state of a plain-data
3620
3331
  * state. The snapshot model uses it for the captured DTO and the restored
3621
3332
  * state. A state that carries a class-based child is mapped to plain data
3622
3333
  * first, in the entity or in the model.
3623
3334
  */
3624
- declare function detachState<T>(state: T, subject?: string): T;
3335
+ declare function copyPlainState<T>(state: T, subject?: string): T;
3336
+ //#endregion
3337
+ //#region src/internal/structural/deep-equal.d.ts
3338
+ /**
3339
+ * Performs a deep equality check between two values.
3340
+ *
3341
+ * This function compares values recursively, handling:
3342
+ * - Primitives (with special handling for NaN)
3343
+ * - Arrays (nested arrays supported)
3344
+ * - Objects (plain objects and class instances)
3345
+ * - TypedArrays (Uint8Array, Int32Array, etc.)
3346
+ * - DataView
3347
+ * - Maps and Sets
3348
+ * - Dates and RegExp
3349
+ * - Wrapper objects (Boolean, Number, String)
3350
+ * - Circular references (detected and handled)
3351
+ *
3352
+ * @param a - The first value to compare
3353
+ * @param b - The second value to compare
3354
+ * @returns `true` if the values are deeply equal, `false` otherwise
3355
+ *
3356
+ * @example
3357
+ * ```ts
3358
+ * deepEqual([1, 2, 3], [1, 2, 3]); // true
3359
+ * deepEqual({ a: 1, b: [2, 3] }, { a: 1, b: [2, 3] }); // true
3360
+ * deepEqual(NaN, NaN); // true
3361
+ * deepEqual([1, 2], [1, 2, 3]); // false
3362
+ * ```
3363
+ */
3364
+ declare function deepEqual(a: unknown, b: unknown): boolean;
3625
3365
  //#endregion
3626
3366
  //#region src/messaging/event-bus/errors.d.ts
3627
3367
  /**
@@ -3689,7 +3429,7 @@ interface PublishChainState {
3689
3429
  * ```ts
3690
3430
  * import { AsyncLocalStorage } from "node:async_hooks";
3691
3431
  *
3692
- * const bus = new EventBusImpl<OrderEvent>({
3432
+ * const bus = new InProcessEventBus<OrderEvent>({
3693
3433
  * chainStore: new AsyncLocalStorage<PublishChainState>(),
3694
3434
  * });
3695
3435
  * ```
@@ -3767,7 +3507,7 @@ interface EventBusObservers {
3767
3507
  */
3768
3508
  readonly onSubscriptionThresholdExceeded: (report: SubscriptionThresholdReport) => void;
3769
3509
  }
3770
- /** Construction options for {@link EventBusImpl}. */
3510
+ /** Construction options for {@link InProcessEventBus}. */
3771
3511
  interface EventBusOptions {
3772
3512
  /**
3773
3513
  * Subscriptions for one event type above which the bus reports through
@@ -3812,7 +3552,7 @@ interface EventBusOptions {
3812
3552
  *
3813
3553
  * @example
3814
3554
  * ```typescript
3815
- * const bus = new EventBusImpl<OrderEvent>();
3555
+ * const bus = new InProcessEventBus<OrderEvent>();
3816
3556
  *
3817
3557
  * bus.subscribe("OrderCreated", async (event) => {
3818
3558
  * await sendEmail(event.payload.customerId);
@@ -3872,7 +3612,7 @@ interface EventBusOptions {
3872
3612
  * the signal.
3873
3613
  *
3874
3614
  */
3875
- declare class EventBusImpl<Evt extends AnyDomainEvent> implements EventBus<Evt> {
3615
+ declare class InProcessEventBus<Evt extends AnyDomainEvent> implements EventBus<Evt> {
3876
3616
  private readonly handlers;
3877
3617
  private readonly catchAllHandlers;
3878
3618
  private readonly maxPublishDepth;
@@ -3963,7 +3703,7 @@ declare function encodeIntegrationMessage(message: IntegrationMessage): string;
3963
3703
  */
3964
3704
  declare function decodeIntegrationMessage(serialized: string): IntegrationMessage;
3965
3705
  /**
3966
- * Composes a validated public message into a minted local projector input.
3706
+ * Composes a validated public message into a kit-built local projector input.
3967
3707
  * Relationship headers become local event metadata. The public JSON schema is
3968
3708
  * retained; producer-private domain types are not reconstructed.
3969
3709
  */
@@ -4035,9 +3775,9 @@ interface InMemoryOutboxOptions {
4035
3775
  * another aggregate version. Without an `InMemoryTransactionScope`, it keeps
4036
3776
  * the first add of a rolled-back attempt. Dead-lettered and acknowledged
4037
3777
  * retries must match the complete original candidate receipt. Reusing an `eventId` for another source or commit position
4038
- * throws {@link EventHarvestError} while the pending, dead-letter, or bounded
3778
+ * throws {@link EventCollectionError} while the pending, dead-letter, or bounded
4039
3779
  * dispatched receipt still proves the collision. `add` also throws
4040
- * {@link EventHarvestError} for a malformed candidate: a part that is not an
3780
+ * {@link EventCollectionError} for a malformed candidate: a part that is not an
4041
3781
  * object, an `eventId` or `type` that is not an own string data property, a
4042
3782
  * source field that is not a string, or a position that is not a valid
4043
3783
  * commit position. Insertion order is preserved:
@@ -4052,7 +3792,7 @@ interface InMemoryOutboxOptions {
4052
3792
  * To link future eventful commits, the implementation also retains one
4053
3793
  * source cursor per qualified aggregate after dispatch. `endEventSources`
4054
3794
  * marks the cursor of a removed aggregate as ended, and a new event of that
4055
- * source then throws {@link EventHarvestError}. Consequently a
3795
+ * source then throws {@link EventCollectionError}. Consequently a
4056
3796
  * long-lived instance is bounded only when `maxRecords` and `maxSources` are
4057
3797
  * configured, plus `maxRetainedDispatchedEventIds`; use a durable adapter with
4058
3798
  * an explicit source-head lifecycle and an event-id unique key for unbounded
@@ -4084,10 +3824,10 @@ interface InMemoryOutboxOptions {
4084
3824
  *
4085
3825
  * @example
4086
3826
  * ```ts
4087
- * import { InMemoryOutbox, EventBusImpl } from "@shirudo/ddd-kit";
3827
+ * import { InMemoryOutbox, InProcessEventBus } from "@shirudo/ddd-kit";
4088
3828
  *
4089
3829
  * const outbox = new InMemoryOutbox<OrderEvent>();
4090
- * const bus = new EventBusImpl<OrderEvent>();
3830
+ * const bus = new InProcessEventBus<OrderEvent>();
4091
3831
  *
4092
3832
  * const uow = makeOrderUnitOfWork({ outbox, bus });
4093
3833
  * await uow.run(async ({ repositories }) => {
@@ -4518,7 +4258,7 @@ interface RetryPolicy {
4518
4258
  *
4519
4259
  * **Classification is by error, not by guesswork.** Only errors the
4520
4260
  * `isRetryable` predicate accepts are retried; everything else (a
4521
- * `DomainError`, `EventHarvestError`, `UnenrolledChangesError`,
4261
+ * `DomainError`, `EventCollectionError`, `UnregisteredChangesError`,
4522
4262
  * `DuplicateAggregateError`, a non-Error throw) surfaces immediately.
4523
4263
  * After `maxAttempts` the last error is rethrown unchanged, so a caller
4524
4264
  * can still match `ConcurrencyConflictError` and map it to HTTP 409.
@@ -4633,7 +4373,7 @@ interface SnapshotModel<TAggregate extends SnapshotAggregate, TSnapshotState> {
4633
4373
  /** Type-inference helper for declaring an adapter-owned snapshot model. */
4634
4374
  declare function defineSnapshotModel<TAggregate extends SnapshotAggregate, TSnapshotState>(model: SnapshotModel<TAggregate, TSnapshotState>): SnapshotModel<TAggregate, TSnapshotState>;
4635
4375
  /**
4636
- * Captures a detached persistence envelope at an application-supplied time.
4376
+ * Captures an independent persistence envelope at an application-supplied time.
4637
4377
  * The application decides when snapshotting is worthwhile; this function does
4638
4378
  * not read a clock or perform I/O. The envelope is deep-frozen, its `state`
4639
4379
  * and its `snapshotAt` included: a write into the captured state or a
@@ -4660,5 +4400,5 @@ declare function captureAggregateSnapshot<TAggregate extends SnapshotAggregate,
4660
4400
  */
4661
4401
  declare function reconstituteAggregateFromSnapshot<TAggregate extends SnapshotAggregate, TSnapshotState>(model: SnapshotModel<TAggregate, TSnapshotState>, id: TAggregate["id"], snapshot: AggregateSnapshot<unknown>): TAggregate;
4662
4402
  //#endregion
4663
- export { type AbsentStreamPages, type Aggregate, type AggregateClass, type AggregateCommitToken, type AggregateConfig, AggregateDeletedError, type AggregateDeletedErrorOptions, type AggregateIdentity, type AggregateIdentityMismatchOptions, AggregateNotFoundError, type AggregateNotFoundErrorOptions, type AggregatePersistence, type AggregatePersistenceWrite, type AggregateSnapshot, AggregateTrackingError, type AggregateTrackingErrorOptions, type AggregateTrackingReason, type AggregateWriteIntent, type AggregateWriteRegistration, type AnyDomainEvent, type AnyUncommittedDomainEvent, type AppendOnlyWriteRegistration, CapabilityRegistryConflictError, type ClassifyConcurrencyConflictOptions, type ClockFactory, type Command, CommandBus, type CommandBusOptions, type CommandCommitOriginCandidate, type CommandHandler, type CommandMessageContent, type CommandMessageRelationships, type CommandOutboxCommitCandidate, type CommandOutboxMapper, type CommandOutboxWriter, type CommitEnrollment, type CommitEnrollmentOptions, CommitError, type CommitPosition, type CommittedDomainEvent, type CompatibleRepositoryDefinitions, ConcurrencyConflictError, type ConcurrencyConflictErrorOptions, type ConcurrencyConflictReason, type CreateDomainEventFromFactsOptions, type CreateDomainEventOptions, type CreateDomainEventStampOptions, type CreateUncommittedDomainEventOptions, type DeadLetterDeadline, type DeadLetterRecord, DeadlineProcessor, type DeadlineProcessorObservers, type DeadlineProcessorOptions, type DeadlineStore, type DeepEqualExceptOptions, type DeepOmitKey, type DeepOmitOptions, type DeepOmitPathSegment, type DeliveryFailureAssessment, type DeliveryFailureClassifier, type DeliveryFailureKind, DirectStateMutationError, type DirectStateMutationErrorOptions, type DispatchTrackingOutbox, DomainError, type DomainErrorClass, type DomainEvent, type DomainEventFactory, type DomainEventFactoryOptions, type DomainEventStamp, type DomainEventStampFactory, type DomainEventStampProvider, type DomainEventValidationCode, DomainEventValidationError, type DomainEventValidationField, type DomainMachineDefinition, type DomainMachineDefinitionAnalysis, type DomainMachineDefinitionDiagnostic, type DomainMachineInput, type DomainMachineReadonly, type DomainMachineSnapshot, type DomainMachineTransitionDescription, DomainStateMachine, type DomainStateNode, type DomainTransition, DomainTransitionGuardRejectedError, type DomainTransitionGuardResult, type DomainTransitionOutcome, type DomainTransitionResult, type DueDeadline, DuplicateAggregateError, type DuplicateAggregateErrorOptions, DuplicateEventIdError, type DuplicateEventIdErrorOptions, DuplicateHandlerRegistrationError, type DuplicateHandlerRegistrationErrorOptions, type DurableCommandMessage, Entity, type EntityConfig, ErrorMapperFailedError, type ErrorMapperFailedErrorOptions, type EventBus, EventBusClosedError, EventBusImpl, type EventBusObservers, type EventBusOptions, type EventCommitCandidate, type EventCommitCandidatePosition, type EventHandler, EventHarvestError, type EventIdFactory, type EventMetadata, EventSourcedAggregate, type EventStore, type EventStoreAppendOptions, type EventStreamPageReason, type EventStreamReader, type ExecutionContext, type FlushStatementReason, FoldReturnedNoStateError, ForeignEventError, type HandlerFailureReport, HostileStateKeyError, type ICommandBus, type IEntity, type IQueryBus, type IValueObject, type Id, type IdGenerator, type IdempotencyClaim, type IdempotencyClaimHandle, IdempotencyClaimLostError, type IdempotencyClaimLostErrorOptions, IdempotencyCompletionWithoutClaimError, IdempotencyInFlightError, type IdempotencyInFlightErrorOptions, IdempotencyKeyReuseError, type IdempotencyKeyReuseErrorOptions, type IdempotencyLease, type IdempotencyOperationErrorContext, type IdempotencyReconciliation, type IdempotencyReconciliationDecision, IdempotencyReconciliationRequiredError, type IdempotencyReconciliationRequiredErrorOptions, type IdempotencyStore, type IdempotentCommitRequest, type IdempotentCommitResult, type IdempotentExecution, type Identifiable, IdentityMap, InMemoryCapacityExceededError, type InMemoryCapacityExceededErrorOptions, InMemoryDeadlineStore, type InMemoryDeadlineStoreOptions, InMemoryEventStore, type InMemoryEventStoreOptions, InMemoryIdempotencyStore, type InMemoryIdempotencyStoreOptions, InMemoryOutbox, type InMemoryOutboxOptions, InMemoryProjectionCheckpointStore, type InMemoryProjectionCheckpointStoreOptions, InMemorySnapshotStore, type InMemorySnapshotStoreOptions, type InMemoryTransaction, type InMemoryTransactionParticipant, InMemoryTransactionScope, InfrastructureError, type IntegrationMessage, type IntegrationMessageContent, type IntegrationMessageMapper, type IntegrationMessageRelationships, InvalidCommandMessageError, InvalidDomainMachineContextError, InvalidDomainMachineDefinitionError, InvalidDomainMachineInputError, InvalidDomainMachineSnapshotError, InvalidDomainTransitionError, InvalidDomainTransitionGuardResultError, InvalidDomainTransitionResultError, InvalidEventStreamPageError, type InvalidEventStreamPageErrorOptions, InvalidFlushStatementError, type InvalidFlushStatementErrorOptions, InvalidIntegrationMessageError, InvalidRepositoryAdapterError, type InvalidRepositoryAdapterErrorOptions, type InvalidRepositoryAdapterReason, InvalidRepositoryDefinitionError, InvalidVersionError, type JsonObject, type JsonPrimitive, type JsonValue, type KitErrorCode, type KitErrorOptions, type MatchedRows, MisattributedEventError, MissingEntityIdError, MissingFoldError, MissingHandlerError, NestedUnitOfWorkError, type OnceOptions, type Outbox, OutboxDispatcher, type OutboxDispatcherObservers, type OutboxDispatcherOptions, type OutboxRecord, type OutboxSink, type OutboxWriter, type PendingDomainEvent, PendingEventBatchMismatchError, type PendingEventBatchMismatchErrorOptions, PendingEventLimitExceededError, type PendingEventLimitExceededErrorOptions, type PersistenceBaseline, type PersistenceChanges, type PersistenceLifecycle, type PersistenceModel, type PhysicalRemovalRegistration, type PinTargetVersionOptions, type PinnedTargetVersion, type PreparedDomainMachineDefinition, type ProjectOptions, type Projection, type ProjectionBatchResult, type ProjectionCheckpoint, type ProjectionCheckpointStore, type ProjectionEventHandler, type ProjectionFromHandlersOptions, ProjectionGapError, type ProjectionHandlers, ProjectionIdentityViolationError, ProjectionOrderViolationError, type ProjectionPosition, ProjectionReceiptViolationError, Projector, type ProjectorOptions, type PublishAbortedReport, type PublishChainState, type PublishChainStore, PublishDepthExceededError, type PublishOptions, type PublishedCommand, type Query, QueryBus, type QueryBusOptions, type QueryHandler, type ReachableStreamPages, type ReadStreamOptions, type ReadStreamPagesOptions, ReentrantDomainStateMachineEvaluationError, ReentrantEventRecordingError, type ReentrantEventRecordingErrorOptions, ReplayRejectedError, type ReplayRejectedErrorOptions, ReplayTargetMismatchError, type ReplayTargetMismatchErrorOptions, type ReplayTargetMismatchReason, type ReplayableAggregate, type ReplayableStreamPages, type RepositoriesOf, type Repository, type RepositoryDefinition, type RepositoryDefinitionOptions, RepositoryErrorMappingFailedError, type RepositoryErrorMappingFailedErrorOptions, type RepositoryTracking, type RetryPolicy, RetryingTransactionScope, RollbackError, type RunOptions, type SharedDomainEventStampOptions, SnapshotCorruptedError, type SnapshotModel, SnapshotSchemaMismatchError, type SnapshotSchemaMismatchErrorOptions, type SnapshotStore, SnapshotTimeValidationError, SnapshotVersionNotRestoredError, type SnapshotVersionNotRestoredErrorOptions, Specification, type SpecificationComposite, StateStoredAggregate, type StateValidator, type StreamPages, type StreamReadResult, type SubscriptionThresholdReport, TransactionClosedError, type TransactionScope, type TransactionalOptions, type UncommittedDomainEvent, type UncommittedDomainEventOf, UnenrolledChangesError, type UnenrolledChangesErrorOptions, UnitOfWork, type UnitOfWorkContext, type UnitOfWorkDeps, type UnitOfWorkIdentityMap, UnmanagedInstanceError, UnmintedEventError, UnprojectableEventError, type UnreachableStreamPages, UnregisteredHandlerError, type UnregisteredHandlerErrorOptions, UnreplayableAggregateError, type UnreplayableAggregateErrorOptions, type VO, ValueObject, type Version, type VersionedFlushStatements, type VersionedWrite, type WithCommitDeps, type WithCommitWorkResult, type WithIdempotentCommitDeps, analyzeDomainMachineDefinition, canTransitionDomainState, captureAggregateSnapshot, capturePersistenceBaseline, classifyConcurrencyConflict, copyMetadata, createDomainEvent, createDomainEventFactory, createDomainEventFromFacts, createInitialDomainMachineSnapshot, createIntegrationMessage, createUncommittedDomainEvent, decodeIntegrationMessage, deepEqual, deepEqualExcept, deepFreeze, deepOmit, defaultDomainEventFactory, defineRepository, defineSnapshotModel, derivePersistenceChanges, detachState, domainErrorToResult, encodeIntegrationMessage, entityIds, eventBusSink, findEntityById, freezeShallow, hasEntityId, ignoreProjectionEvent, insertPersistenceBaseline, integrationMessageToCommittedEvent, isDomainErrorLike, isInfrastructureErrorLike, isPositionAfter, isWiringErrorLike, mergeMetadata, outboxWriterAcceptingEventLoss, persistenceProjectionDrifted, pinTargetVersion, prepareDomainMachineDefinition, projectionFromHandlers, readStreamPages, recapturePersistenceBaseline, reconstituteAggregateFromHistory, reconstituteAggregateFromSnapshot, reconstituteAggregateFromStreamPages, recordDomainEvent, recordPendingEvents, removeEntityById, replaceEntityById, routeEventsToCommandOutbox, sameEntity, sameVersion, specification, toVersion, transitionDomainState, updateEntityById, versionedFlush, vo, voEquals, voEqualsExcept, voValidated, voWithValidation, withCommit, withIdempotentCommit };
4403
+ export { type AbsentStreamPages, type Aggregate, type AggregateClass, type AggregateCommitToken, type AggregateConfig, AggregateDeletedError, type AggregateDeletedErrorOptions, type AggregateIdentity, type AggregateIdentityMismatchOptions, AggregateNotFoundError, type AggregateNotFoundErrorOptions, type AggregatePersistence, type AggregatePersistenceWrite, type AggregateSnapshot, AggregateTrackingError, type AggregateTrackingErrorOptions, type AggregateTrackingReason, type AggregateWriteIntent, type AggregateWriteRegistration, type AnyDomainEvent, type AnyUnstampedDomainEvent, type AppendOnlyWriteRegistration, CapabilityRegistryConflictError, type ClassifyConcurrencyConflictOptions, type ClockFactory, type Command, CommandBus, type CommandBusOptions, type CommandCommitOriginCandidate, type CommandHandler, type CommandMessageContent, type CommandMessageRelationships, type CommandOutboxCommitCandidate, type CommandOutboxMapper, type CommandOutboxWriter, CommitError, type CommitPosition, type CommitRegistration, type CommitRegistrationOptions, type CommittedDomainEvent, type CompatibleRepositoryDefinitions, ConcurrencyConflictError, type ConcurrencyConflictErrorOptions, type ConcurrencyConflictReason, type CreateDomainEventOptions, type CreateDomainEventStampOptions, type CreateStampedDomainEventOptions, type DeadLetterDeadline, type DeadLetterRecord, DeadlineProcessor, type DeadlineProcessorObservers, type DeadlineProcessorOptions, type DeadlineStore, type DeepOmitKey, type DeepOmitOptions, type DeepOmitPathSegment, type DeliveryFailureAssessment, type DeliveryFailureClassifier, type DeliveryFailureKind, DirectStateMutationError, type DirectStateMutationErrorOptions, type DispatchTrackingOutbox, DomainError, type DomainErrorClass, type DomainEvent, type DomainEventFactory, type DomainEventFactoryOptions, type DomainEventStamp, type DomainEventStampFactory, type DomainEventStampProvider, type DomainEventValidationCode, DomainEventValidationError, type DomainEventValidationField, type DueDeadline, DuplicateAggregateError, type DuplicateAggregateErrorOptions, DuplicateEventIdError, type DuplicateEventIdErrorOptions, DuplicateHandlerRegistrationError, type DuplicateHandlerRegistrationErrorOptions, type DurableCommandMessage, Entity, type EntityConfig, ErrorMapperFailedError, type ErrorMapperFailedErrorOptions, type EventBus, EventBusClosedError, type EventBusObservers, type EventBusOptions, EventCollectionError, type EventCommitCandidate, type EventCommitCandidatePosition, type EventHandler, type EventIdFactory, type EventMetadata, EventSourcedAggregate, type EventStore, type EventStoreAppendOptions, type EventStreamPageReason, type EventStreamReader, type ExecutionContext, type FlushStatementReason, FoldReturnedNoStateError, ForeignEventError, HandBuiltEventError, type HandlerFailureReport, type ICommandBus, type IEntity, type IQueryBus, type Id, type IdGenerator, type IdempotencyClaim, type IdempotencyClaimHandle, IdempotencyClaimLostError, type IdempotencyClaimLostErrorOptions, IdempotencyCompletionWithoutClaimError, IdempotencyInFlightError, type IdempotencyInFlightErrorOptions, IdempotencyKeyReuseError, type IdempotencyKeyReuseErrorOptions, type IdempotencyLease, type IdempotencyOperationErrorContext, type IdempotencyReconciliation, type IdempotencyReconciliationDecision, IdempotencyReconciliationRequiredError, type IdempotencyReconciliationRequiredErrorOptions, type IdempotencyStore, type IdempotentCommitRequest, type IdempotentCommitResult, type IdempotentExecution, type Identifiable, IdentityMap, InMemoryCapacityExceededError, type InMemoryCapacityExceededErrorOptions, InMemoryDeadlineStore, type InMemoryDeadlineStoreOptions, InMemoryEventStore, type InMemoryEventStoreOptions, InMemoryIdempotencyStore, type InMemoryIdempotencyStoreOptions, InMemoryOutbox, type InMemoryOutboxOptions, InMemoryProjectionCheckpointStore, type InMemoryProjectionCheckpointStoreOptions, InMemorySnapshotStore, type InMemorySnapshotStoreOptions, type InMemoryTransaction, type InMemoryTransactionParticipant, InMemoryTransactionScope, InProcessEventBus, InfrastructureError, type IntegrationMessage, type IntegrationMessageContent, type IntegrationMessageMapper, type IntegrationMessageRelationships, InvalidCommandMessageError, InvalidEventStreamPageError, type InvalidEventStreamPageErrorOptions, InvalidFlushStatementError, type InvalidFlushStatementErrorOptions, InvalidIntegrationMessageError, InvalidRepositoryAdapterError, type InvalidRepositoryAdapterErrorOptions, type InvalidRepositoryAdapterReason, InvalidRepositoryDefinitionError, InvalidVersionError, type JsonObject, type JsonPrimitive, type JsonValue, type KitErrorCode, type KitErrorOptions, type MatchedRows, MisattributedEventError, MissingEntityIdError, MissingFoldError, MissingHandlerError, NestedUnitOfWorkError, type OnceOptions, type Outbox, OutboxDispatcher, type OutboxDispatcherObservers, type OutboxDispatcherOptions, type OutboxRecord, type OutboxSink, type OutboxWriter, type PendingDomainEvent, PendingEventBatchMismatchError, type PendingEventBatchMismatchErrorOptions, PendingEventLimitExceededError, type PendingEventLimitExceededErrorOptions, type PersistenceChanges, type PersistenceLifecycle, type PersistenceModel, type PhysicalRemovalRegistration, type PinTargetVersionOptions, type PinnedTargetVersion, type ProjectOptions, type Projection, type ProjectionBatchResult, type ProjectionCheckpoint, type ProjectionCheckpointStore, type ProjectionEventHandler, type ProjectionFromHandlersOptions, ProjectionGapError, type ProjectionHandlers, ProjectionIdentityViolationError, ProjectionOrderViolationError, type ProjectionPosition, ProjectionReceiptViolationError, Projector, type ProjectorOptions, PrototypePollutionError, type PublishAbortedReport, type PublishChainState, type PublishChainStore, PublishDepthExceededError, type PublishOptions, type PublishedCommand, type Query, QueryBus, type QueryBusOptions, type QueryHandler, type ReachableStreamPages, type ReadStreamOptions, type ReadStreamPagesOptions, ReentrantEventRecordingError, type ReentrantEventRecordingErrorOptions, ReplayRejectedError, type ReplayRejectedErrorOptions, ReplayTargetMismatchError, type ReplayTargetMismatchErrorOptions, type ReplayTargetMismatchReason, type ReplayableAggregate, type ReplayableStreamPages, type RepositoriesOf, type Repository, type RepositoryDefinition, type RepositoryDefinitionOptions, RepositoryErrorMappingFailedError, type RepositoryErrorMappingFailedErrorOptions, type RepositoryTracking, type RetryPolicy, RetryingTransactionScope, RollbackError, type RunOptions, type SharedDomainEventStampOptions, SnapshotCorruptedError, type SnapshotModel, SnapshotSchemaMismatchError, type SnapshotSchemaMismatchErrorOptions, type SnapshotStore, SnapshotTimeValidationError, SnapshotVersionNotRestoredError, type SnapshotVersionNotRestoredErrorOptions, Specification, type SpecificationComposite, StateStoredAggregate, type StateValidator, type StreamPages, type StreamReadResult, type SubscriptionThresholdReport, TransactionClosedError, type TransactionScope, type TransactionalOptions, UnitOfWork, type UnitOfWorkContext, type UnitOfWorkDeps, type UnitOfWorkIdentityMap, UnmanagedInstanceError, UnprojectableEventError, type UnreachableStreamPages, UnregisteredChangesError, type UnregisteredChangesErrorOptions, UnregisteredHandlerError, type UnregisteredHandlerErrorOptions, UnreplayableAggregateError, type UnreplayableAggregateErrorOptions, type UnstampedDomainEvent, type UnstampedDomainEventOf, ValueObject, type ValueObjectOf, type Version, type VersionedFlushStatements, type VersionedWrite, type WithCommitDeps, type WithCommitWorkResult, type WithIdempotentCommitDeps, captureAggregateSnapshot, classifyConcurrencyConflict, copyMetadata, copyPlainState, createDomainEvent, createDomainEventFactory, createIntegrationMessage, createStampedDomainEvent, decodeIntegrationMessage, deepEqual, deepFreeze, deepOmit, defaultDomainEventFactory, defineRepository, defineSnapshotModel, domainErrorToResult, encodeIntegrationMessage, entityIds, eventBusSink, findEntityById, hasEntityId, ignoreProjectionEvent, integrationMessageToCommittedEvent, isDomainErrorLike, isInfrastructureErrorLike, isPositionAfter, isWiringErrorLike, mergeMetadata, outboxWriterAcceptingEventLoss, pinTargetVersion, projectionFromHandlers, readStreamPages, reconstituteAggregateFromHistory, reconstituteAggregateFromSnapshot, reconstituteAggregateFromStreamPages, removeEntityById, replaceEntityById, routeEventsToCommandOutbox, sameEntity, sameVersion, specification, stampPendingEvents, toVersion, updateEntityById, valueObject, valueObjectEquals, valueObjectEqualsExcept, valueObjectOrError, valueObjectOrIssues, versionedFlush, withCommit, withIdempotentCommit };
4664
4404
  //# sourceMappingURL=index.d.ts.map