@shirudo/ddd-kit 3.0.0-rc.5 → 3.0.0-rc.7
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/chunks/ports.js +82 -16
- package/dist/chunks/ports.js.map +1 -1
- package/dist/chunks/snapshot-store.d.ts +4 -2
- package/dist/index.d.ts +63 -11
- package/dist/index.js +121 -65
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -931,9 +931,11 @@ interface AggregateSnapshot<TState> {
|
|
|
931
931
|
* part of this surface. The application shell holds that authority.
|
|
932
932
|
*
|
|
933
933
|
* @template TId - The aggregate root identifier (branded via `Id<Tag>`)
|
|
934
|
-
* @template TEvent - The domain-event union
|
|
934
|
+
* @template TEvent - The domain-event union. Defaults to `AnyDomainEvent`,
|
|
935
|
+
* so a bound written as `Aggregate<TId>` admits every aggregate root,
|
|
936
|
+
* with or without events.
|
|
935
937
|
*/
|
|
936
|
-
interface Aggregate<TId extends Id<string>, TEvent extends AnyDomainEvent =
|
|
938
|
+
interface Aggregate<TId extends Id<string>, TEvent extends AnyDomainEvent = AnyDomainEvent> {
|
|
937
939
|
readonly id: TId;
|
|
938
940
|
readonly version: Version;
|
|
939
941
|
readonly pendingEvents: ReadonlyArray<PendingDomainEvent<TEvent>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1533,6 +1533,12 @@ interface RepositoryTracking<TAggregate extends Aggregate<Id<string>, AnyDomainE
|
|
|
1533
1533
|
* the exact moment at which the application registered its write intent.
|
|
1534
1534
|
* Adapters must use the expected/current version pair for their OCC predicate
|
|
1535
1535
|
* and must not read mutable write state back from an aggregate reference.
|
|
1536
|
+
*
|
|
1537
|
+
* The predicate itself is adapter code. The compare-and-set must run in the
|
|
1538
|
+
* store's own write statement. The kit does not know the store, so it cannot
|
|
1539
|
+
* write that statement. The kit owns the version pair and
|
|
1540
|
+
* {@link ConcurrencyConflictError}; the repository contract suite proves the
|
|
1541
|
+
* predicate.
|
|
1536
1542
|
*/
|
|
1537
1543
|
interface AggregatePersistenceWrite<TAggregate extends Aggregate<Id<string>, AnyDomainEvent>, TChangeSet> {
|
|
1538
1544
|
readonly intent: AggregateWriteIntent;
|
|
@@ -1731,7 +1737,12 @@ interface RunOptions {
|
|
|
1731
1737
|
declare const repositoryDefinitionBrand: unique symbol;
|
|
1732
1738
|
/** Adapter wiring accepted by {@link defineRepository}. */
|
|
1733
1739
|
interface RepositoryDefinitionOptions<TCtx, TRepositoryPort extends object, TAggregate extends Aggregate<Id<string>, AnyDomainEvent>, TBaseline, TChangeSet, TRemoval extends boolean = false> {
|
|
1734
|
-
/**
|
|
1740
|
+
/**
|
|
1741
|
+
* Concrete aggregate class used as the Identity Map key, and for nothing
|
|
1742
|
+
* else. The read adapter passes the same class to `identityMap.get`, so
|
|
1743
|
+
* the class is exported. Its protected constructor keeps `new` out of
|
|
1744
|
+
* reach; the static factories stay the only door.
|
|
1745
|
+
*/
|
|
1735
1746
|
readonly aggregate: AggregateClass<TAggregate>;
|
|
1736
1747
|
/** Adapter-owned projection, baseline, and change-set policy. */
|
|
1737
1748
|
readonly persistence: PersistenceModel<TAggregate, TBaseline, TChangeSet>;
|
|
@@ -2031,9 +2042,11 @@ declare abstract class Entity<TState, TId extends Id<string>> implements IEntity
|
|
|
2031
2042
|
* `TState` publicly would expose the aggregate's live object graph and
|
|
2032
2043
|
* let nested mutation bypass behavior, validation, versioning, and
|
|
2033
2044
|
* dirty tracking. Concrete entities should expose business-meaningful queries or
|
|
2034
|
-
* detached immutable DTOs.
|
|
2035
|
-
*
|
|
2036
|
-
*
|
|
2045
|
+
* detached immutable DTOs (`deepFreeze(detachState(this.state))` for a
|
|
2046
|
+
* plain-data state). Snapshot projection belongs to the persistence
|
|
2047
|
+
* adapter, which captures the aggregate from outside through those
|
|
2048
|
+
* queries and DTOs rather than asking the entity to create its own
|
|
2049
|
+
* persistence memento.
|
|
2037
2050
|
*/
|
|
2038
2051
|
protected get state(): TState;
|
|
2039
2052
|
/**
|
|
@@ -3159,9 +3172,12 @@ declare function deepFreeze<T>(obj: T): Readonly<T>;
|
|
|
3159
3172
|
* The input is first deep-cloned, then the clone is frozen, so calling
|
|
3160
3173
|
* `vo(input)` never freezes the caller's own object graph as a
|
|
3161
3174
|
* side-effect. Mutating the input afterwards does not bleed into the VO.
|
|
3162
|
-
* Symbol-keyed properties are preserved (matching `voEquals`)
|
|
3163
|
-
*
|
|
3164
|
-
*
|
|
3175
|
+
* Symbol-keyed properties are preserved (matching `voEquals`). A kit
|
|
3176
|
+
* `ValueObject` instance nested in the input is kept by reference and
|
|
3177
|
+
* frozen in place; it must keep all of its state in `props`. A value
|
|
3178
|
+
* object as the input itself is rejected.
|
|
3179
|
+
* Function values and every other custom class instance are rejected
|
|
3180
|
+
* (Value Objects are plain data, not behaviour-bearing object graphs). Inputs must be trusted and
|
|
3165
3181
|
* Proxy-free: ECMAScript provides no portable way to identify a transparent
|
|
3166
3182
|
* Proxy without potentially executing its traps, so `vo()` is not a sandbox
|
|
3167
3183
|
* for hostile in-process objects. Built-ins that cannot provide immutable,
|
|
@@ -3212,6 +3228,11 @@ declare function voEquals<T>(a: VO<T>, b: VO<T>): boolean;
|
|
|
3212
3228
|
* Useful for comparing value objects that contain metadata or optional fields
|
|
3213
3229
|
* that should not affect equality comparison.
|
|
3214
3230
|
*
|
|
3231
|
+
* The walk enters a nested `ValueObject` instance like any other object,
|
|
3232
|
+
* so inside it the path continues with `props`; `ignoreKeys: ["props"]`
|
|
3233
|
+
* empties every nested value object. The key under which the kit records
|
|
3234
|
+
* the class of the instance is never ignored.
|
|
3235
|
+
*
|
|
3215
3236
|
* @param a - First value object
|
|
3216
3237
|
* @param b - Second value object
|
|
3217
3238
|
* @param options - Options specifying which keys to ignore during comparison
|
|
@@ -3310,7 +3331,11 @@ interface IValueObject<T extends object> {
|
|
|
3310
3331
|
}
|
|
3311
3332
|
/**
|
|
3312
3333
|
* Abstract base class for creating Value Objects.
|
|
3313
|
-
* Value Objects are immutable and defined by their properties.
|
|
3334
|
+
* Value Objects are immutable and defined by their properties. A value
|
|
3335
|
+
* object can hold other value objects in its props. Every instance
|
|
3336
|
+
* records its class under an own symbol key, so `equals` compares a
|
|
3337
|
+
* nested value object by class and props and does not call its `equals`
|
|
3338
|
+
* method.
|
|
3314
3339
|
*
|
|
3315
3340
|
* @template T - The shape of the value object's properties
|
|
3316
3341
|
*/
|
|
@@ -3431,6 +3456,33 @@ declare function voValidated<T>(t: T, validate: (issues: ValidationError, value:
|
|
|
3431
3456
|
*/
|
|
3432
3457
|
declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
3433
3458
|
//#endregion
|
|
3459
|
+
//#region src/internal/structural/detach-state.d.ts
|
|
3460
|
+
/**
|
|
3461
|
+
* Returns a copy of `state` that shares no object with the original.
|
|
3462
|
+
* Throws a `TypeError` that names the path when the graph carries a value
|
|
3463
|
+
* a structured clone would lose or silently degrade. A class instance, a
|
|
3464
|
+
* subclass of a built-in included, loses the methods on its prototype. A
|
|
3465
|
+
* symbol-keyed, non-enumerable, or accessor property and an expando on a
|
|
3466
|
+
* built-in are dropped. A function or a symbol value throws a raw
|
|
3467
|
+
* `DataCloneError`. An Error, a Promise, a WeakMap, or a WeakSet cannot be
|
|
3468
|
+
* detached at all. A SharedArrayBuffer and a view over one keep sharing
|
|
3469
|
+
* their memory. A Proxy is invisible to the walk and fails inside the
|
|
3470
|
+
* clone; that failure is rethrown as a `TypeError` with the cause.
|
|
3471
|
+
*
|
|
3472
|
+
* Plain objects (from any realm), arrays, Dates, Maps, Sets, bigints, and
|
|
3473
|
+
* typed arrays pass. A RegExp passes: pattern and flags survive the clone,
|
|
3474
|
+
* and `lastIndex` restores as 0. The scan state of a global or sticky
|
|
3475
|
+
* pattern is not domain data. A non-enumerable property on a built-in
|
|
3476
|
+
* passes: it is the built-in's own machinery (`lastIndex`), not data. A
|
|
3477
|
+
* non-enumerable symbol key passes anywhere: it is metadata by convention.
|
|
3478
|
+
*
|
|
3479
|
+
* The concrete entity uses it for a detached read DTO of a plain-data
|
|
3480
|
+
* state. The snapshot model uses it for the captured DTO and the restored
|
|
3481
|
+
* state. A state that carries a class-based child is mapped to plain data
|
|
3482
|
+
* first, in the entity or in the model.
|
|
3483
|
+
*/
|
|
3484
|
+
declare function detachState<T>(state: T): T;
|
|
3485
|
+
//#endregion
|
|
3434
3486
|
//#region src/messaging/event-bus/errors.d.ts
|
|
3435
3487
|
/**
|
|
3436
3488
|
* Thrown when one publish chain reaches `maxPublishDepth`.
|
|
@@ -3976,7 +4028,7 @@ declare class InMemoryEventStore<Evt extends AnyDomainEvent> implements EventSto
|
|
|
3976
4028
|
* @template TAggregate - Aggregate root loaded and registered by the port.
|
|
3977
4029
|
* @template TId - Branded aggregate identifier.
|
|
3978
4030
|
*/
|
|
3979
|
-
interface AggregatePersistence<TAggregate extends Aggregate<TId>, TId extends Id<string>> {
|
|
4031
|
+
interface AggregatePersistence<TAggregate extends Aggregate<TId, AnyDomainEvent>, TId extends Id<string>> {
|
|
3980
4032
|
/**
|
|
3981
4033
|
* Finds an aggregate by identity.
|
|
3982
4034
|
*
|
|
@@ -4025,7 +4077,7 @@ interface AggregatePersistence<TAggregate extends Aggregate<TId>, TId extends Id
|
|
|
4025
4077
|
* by an order command, while read-heavy access remains on a projection or query
|
|
4026
4078
|
* port.
|
|
4027
4079
|
*/
|
|
4028
|
-
interface Repository<TAggregate extends Aggregate<TId>, TId extends Id<string>> extends AggregatePersistence<TAggregate, TId> {
|
|
4080
|
+
interface Repository<TAggregate extends Aggregate<TId, AnyDomainEvent>, TId extends Id<string>> extends AggregatePersistence<TAggregate, TId> {
|
|
4029
4081
|
/**
|
|
4030
4082
|
* Registers a tracked aggregate for physical removal at commit.
|
|
4031
4083
|
*
|
|
@@ -4222,5 +4274,5 @@ declare function captureAggregateSnapshot<TAggregate extends SnapshotAggregate,
|
|
|
4222
4274
|
*/
|
|
4223
4275
|
declare function reconstituteAggregateFromSnapshot<TAggregate extends SnapshotAggregate, TSnapshotState>(model: SnapshotModel<TAggregate, TSnapshotState>, id: TAggregate["id"], snapshot: AggregateSnapshot<unknown>): TAggregate;
|
|
4224
4276
|
//#endregion
|
|
4225
|
-
export { type Aggregate, type AggregateAddress, type AggregateAddressMismatchOptions, type AggregateClass, type AggregateCommitToken, type AggregateConfig, AggregateDeletedError, AggregateNotFoundError, type AggregateNotFoundErrorOptions, type AggregatePersistence, type AggregatePersistenceWrite, type AggregateSnapshot, AggregateTrackingError, type AggregateTrackingFailure, type AggregateWriteIntent, type AggregateWriteRegistration, type AnyDomainEvent, type AnyUncommittedDomainEvent, CapabilityRegistryConflictError, 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 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 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, 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 ExecutionContext, 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, InfrastructureError, type IntegrationMessage, type IntegrationMessageContent, type IntegrationMessageMapper, type IntegrationMessageRelationships, InvalidCommandMessageError, InvalidDomainMachineContextError, InvalidDomainMachineDefinitionError, InvalidDomainMachineInputError, InvalidDomainMachineSnapshotError, InvalidDomainTransitionError, InvalidDomainTransitionGuardResultError, InvalidDomainTransitionResultError, InvalidIntegrationMessageError, InvalidRepositoryAdapterError, InvalidRepositoryDefinitionError, InvalidVersionError, type JsonObject, type JsonPrimitive, type JsonValue, type KitErrorCode, type KitErrorOptions, MisaddressedEventError, MissingEntityIdError, MissingFoldError, MissingHandlerError, NestedUnitOfWorkError, NonProgressingEventStreamPageError, type NonProgressingEventStreamPageErrorOptions, type OnceOptions, type Outbox, OutboxDispatcher, type OutboxDispatcherObservers, type OutboxDispatcherOptions, type OutboxRecord, type OutboxSink, type OutboxWriter, type PendingDomainEvent, PendingEventBatchMismatchError, PendingEventLimitExceededError, type PendingEventLimitExceededErrorOptions, type PersistenceBaseline, type PersistenceChanges, type PersistenceLifecycle, type PersistenceModel, type PhysicalRemovalRegistration, 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 ReadStreamOptions, ReentrantDomainStateMachineEvaluationError, ReentrantEventRecordingError, ReplayHeadMismatchError, type ReplayHeadMismatchErrorOptions, type ReplayableAggregate, type RepositoriesOf, type Repository, type RepositoryDefinition, type RepositoryDefinitionOptions, RepositoryErrorMappingFailedError, 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 StreamReadResult, type SubscriptionThresholdReport, TransactionClosedError, type TransactionScope, type TransactionalOptions, type UncommittedDomainEvent, type UncommittedDomainEventOf, UnenrolledChangesError, UnitOfWork, type UnitOfWorkContext, type UnitOfWorkDeps, type UnitOfWorkIdentityMap, UnmanagedInstanceError, UnmintedEventError, UnprojectableEventError, UnregisteredHandlerError, type UnregisteredHandlerErrorOptions, UnreplayableAggregateError, type VO, ValueObject, type Version, type WithCommitDeps, type WithCommitWorkResult, type WithIdempotentCommitDeps, analyzeDomainMachineDefinition, canTransitionDomainState, captureAggregateSnapshot, capturePersistenceBaseline, copyMetadata, createDomainEvent, createDomainEventFactory, createDomainEventFromFacts, createInitialDomainMachineSnapshot, createIntegrationMessage, createUncommittedDomainEvent, decodeIntegrationMessage, deepEqual, deepEqualExcept, deepFreeze, deepOmit, defaultDomainEventFactory, defineRepository, defineSnapshotModel, derivePersistenceChanges, domainErrorToResult, encodeIntegrationMessage, entityIds, eventBusSink, findEntityById, freezeShallow, hasEntityId, ignoreProjectionEvent, insertPersistenceBaseline, integrationMessageToCommittedEvent, isDomainErrorLike, isInfrastructureErrorLike, isPositionAfter, mergeMetadata, outboxWriterAcceptingEventLoss, persistenceProjectionDrifted, prepareDomainMachineDefinition, projectionFromHandlers, recapturePersistenceBaseline, reconstituteAggregateFromHistory, reconstituteAggregateFromSnapshot, recordDomainEvent, recordPendingEvents, removeEntityById, replaceEntityById, routeEventsToCommandOutbox, sameEntity, sameVersion, specification, toVersion, transitionDomainState, updateEntityById, vo, voEquals, voEqualsExcept, voValidated, voWithValidation, withCommit, withIdempotentCommit };
|
|
4277
|
+
export { type Aggregate, type AggregateAddress, type AggregateAddressMismatchOptions, type AggregateClass, type AggregateCommitToken, type AggregateConfig, AggregateDeletedError, AggregateNotFoundError, type AggregateNotFoundErrorOptions, type AggregatePersistence, type AggregatePersistenceWrite, type AggregateSnapshot, AggregateTrackingError, type AggregateTrackingFailure, type AggregateWriteIntent, type AggregateWriteRegistration, type AnyDomainEvent, type AnyUncommittedDomainEvent, CapabilityRegistryConflictError, 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 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 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, 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 ExecutionContext, 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, InfrastructureError, type IntegrationMessage, type IntegrationMessageContent, type IntegrationMessageMapper, type IntegrationMessageRelationships, InvalidCommandMessageError, InvalidDomainMachineContextError, InvalidDomainMachineDefinitionError, InvalidDomainMachineInputError, InvalidDomainMachineSnapshotError, InvalidDomainTransitionError, InvalidDomainTransitionGuardResultError, InvalidDomainTransitionResultError, InvalidIntegrationMessageError, InvalidRepositoryAdapterError, InvalidRepositoryDefinitionError, InvalidVersionError, type JsonObject, type JsonPrimitive, type JsonValue, type KitErrorCode, type KitErrorOptions, MisaddressedEventError, MissingEntityIdError, MissingFoldError, MissingHandlerError, NestedUnitOfWorkError, NonProgressingEventStreamPageError, type NonProgressingEventStreamPageErrorOptions, type OnceOptions, type Outbox, OutboxDispatcher, type OutboxDispatcherObservers, type OutboxDispatcherOptions, type OutboxRecord, type OutboxSink, type OutboxWriter, type PendingDomainEvent, PendingEventBatchMismatchError, PendingEventLimitExceededError, type PendingEventLimitExceededErrorOptions, type PersistenceBaseline, type PersistenceChanges, type PersistenceLifecycle, type PersistenceModel, type PhysicalRemovalRegistration, 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 ReadStreamOptions, ReentrantDomainStateMachineEvaluationError, ReentrantEventRecordingError, ReplayHeadMismatchError, type ReplayHeadMismatchErrorOptions, type ReplayableAggregate, type RepositoriesOf, type Repository, type RepositoryDefinition, type RepositoryDefinitionOptions, RepositoryErrorMappingFailedError, 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 StreamReadResult, type SubscriptionThresholdReport, TransactionClosedError, type TransactionScope, type TransactionalOptions, type UncommittedDomainEvent, type UncommittedDomainEventOf, UnenrolledChangesError, UnitOfWork, type UnitOfWorkContext, type UnitOfWorkDeps, type UnitOfWorkIdentityMap, UnmanagedInstanceError, UnmintedEventError, UnprojectableEventError, UnregisteredHandlerError, type UnregisteredHandlerErrorOptions, UnreplayableAggregateError, type VO, ValueObject, type Version, type WithCommitDeps, type WithCommitWorkResult, type WithIdempotentCommitDeps, analyzeDomainMachineDefinition, canTransitionDomainState, captureAggregateSnapshot, capturePersistenceBaseline, 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, mergeMetadata, outboxWriterAcceptingEventLoss, persistenceProjectionDrifted, prepareDomainMachineDefinition, projectionFromHandlers, recapturePersistenceBaseline, reconstituteAggregateFromHistory, reconstituteAggregateFromSnapshot, recordDomainEvent, recordPendingEvents, removeEntityById, replaceEntityById, routeEventsToCommandOutbox, sameEntity, sameVersion, specification, toVersion, transitionDomainState, updateEntityById, vo, voEquals, voEqualsExcept, voValidated, voWithValidation, withCommit, withIdempotentCommit };
|
|
4226
4278
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as NonProgressingEventStreamPageError, B as SnapshotSchemaMismatchError, C as InvalidIntegrationMessageError, D as MissingEntityIdError, E as MisaddressedEventError, F as ProjectionOrderViolationError, G as UnprojectableEventError, H as UnenrolledChangesError, I as ProjectionReceiptViolationError, J as assertNoHostileOwnProtoKey, K as UnregisteredHandlerError, L as ReentrantEventRecordingError, M as PendingEventLimitExceededError, N as ProjectionGapError, O as MissingFoldError, P as ProjectionIdentityViolationError, R as ReplayHeadMismatchError, S as InvalidCommandMessageError, T as KitWiringError, U as UnmanagedInstanceError, V as SnapshotVersionNotRestoredError, W as UnmintedEventError, X as isInfrastructureErrorLike, Y as isDomainErrorLike, _ as IdempotencyInFlightError, a as DirectStateMutationError, b as InMemoryCapacityExceededError, c as DuplicateEventIdError, d as EventHarvestError, f as FoldReturnedNoStateError, g as IdempotencyCompletionWithoutClaimError, h as IdempotencyClaimLostError, i as ConcurrencyConflictError, j as PendingEventBatchMismatchError, k as MissingHandlerError, l as DuplicateHandlerRegistrationError, m as HostileStateKeyError, n as AggregateNotFoundError, o as DomainError, p as ForeignEventError, q as UnreplayableAggregateError, r as CapabilityRegistryConflictError, s as DuplicateAggregateError, t as AggregateDeletedError, u as ErrorMapperFailedError, v as IdempotencyKeyReuseError, w as InvalidVersionError, x as InfrastructureError, y as IdempotencyReconciliationRequiredError, z as SnapshotCorruptedError } from "./chunks/kit-errors.js";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as isBuiltInObject, C as voWithValidation, D as builtInTagWithoutInvokingAccessors, E as deepEqual, M as isWeakMap, O as findPropertyDescriptor, S as voEqualsExcept, T as deepOmit, _ as stampCooperativeBrand, a as createDomainEvent, b as vo, c as createUncommittedDomainEvent, d as isUncommittedDomainEvent, f as mergeMetadata, g as hasCooperativeBrand, h as SnapshotTimeValidationError, i as copyMetadata, j as isIntrinsicConstructorPrototype, k as hasIntrinsicPrototypeChain, l as defaultDomainEventFactory, m as DomainEventValidationError, n as adoptRecordedDomainEvent, o as createDomainEventFactory, p as recordDomainEvent, r as adoptUncommittedDomainEvent, s as createDomainEventFromFacts, t as isDispatchTrackingOutbox, u as isRecordedDomainEvent, v as ValueObject, w as deepEqualExcept, x as voEquals, y as deepFreeze } from "./chunks/ports.js";
|
|
3
3
|
import { err, ok } from "@shirudo/result";
|
|
4
4
|
import { ValidationError, someChainRetryable } from "@shirudo/base-error";
|
|
5
5
|
|
|
@@ -3518,9 +3518,11 @@ var Entity = class {
|
|
|
3518
3518
|
* `TState` publicly would expose the aggregate's live object graph and
|
|
3519
3519
|
* let nested mutation bypass behavior, validation, versioning, and
|
|
3520
3520
|
* dirty tracking. Concrete entities should expose business-meaningful queries or
|
|
3521
|
-
* detached immutable DTOs.
|
|
3522
|
-
*
|
|
3523
|
-
*
|
|
3521
|
+
* detached immutable DTOs (`deepFreeze(detachState(this.state))` for a
|
|
3522
|
+
* plain-data state). Snapshot projection belongs to the persistence
|
|
3523
|
+
* adapter, which captures the aggregate from outside through those
|
|
3524
|
+
* queries and DTOs rather than asking the entity to create its own
|
|
3525
|
+
* persistence memento.
|
|
3524
3526
|
*/
|
|
3525
3527
|
get state() {
|
|
3526
3528
|
return this._state;
|
|
@@ -5327,6 +5329,117 @@ function voValidated(t, validate, message = "Validation failed") {
|
|
|
5327
5329
|
return issues.hasIssues() ? err(issues) : ok(vo(t));
|
|
5328
5330
|
}
|
|
5329
5331
|
|
|
5332
|
+
//#endregion
|
|
5333
|
+
//#region src/internal/structural/detach-state.ts
|
|
5334
|
+
/**
|
|
5335
|
+
* Returns a copy of `state` that shares no object with the original.
|
|
5336
|
+
* Throws a `TypeError` that names the path when the graph carries a value
|
|
5337
|
+
* a structured clone would lose or silently degrade. A class instance, a
|
|
5338
|
+
* subclass of a built-in included, loses the methods on its prototype. A
|
|
5339
|
+
* symbol-keyed, non-enumerable, or accessor property and an expando on a
|
|
5340
|
+
* built-in are dropped. A function or a symbol value throws a raw
|
|
5341
|
+
* `DataCloneError`. An Error, a Promise, a WeakMap, or a WeakSet cannot be
|
|
5342
|
+
* detached at all. A SharedArrayBuffer and a view over one keep sharing
|
|
5343
|
+
* their memory. A Proxy is invisible to the walk and fails inside the
|
|
5344
|
+
* clone; that failure is rethrown as a `TypeError` with the cause.
|
|
5345
|
+
*
|
|
5346
|
+
* Plain objects (from any realm), arrays, Dates, Maps, Sets, bigints, and
|
|
5347
|
+
* typed arrays pass. A RegExp passes: pattern and flags survive the clone,
|
|
5348
|
+
* and `lastIndex` restores as 0. The scan state of a global or sticky
|
|
5349
|
+
* pattern is not domain data. A non-enumerable property on a built-in
|
|
5350
|
+
* passes: it is the built-in's own machinery (`lastIndex`), not data. A
|
|
5351
|
+
* non-enumerable symbol key passes anywhere: it is metadata by convention.
|
|
5352
|
+
*
|
|
5353
|
+
* The concrete entity uses it for a detached read DTO of a plain-data
|
|
5354
|
+
* state. The snapshot model uses it for the captured DTO and the restored
|
|
5355
|
+
* state. A state that carries a class-based child is mapped to plain data
|
|
5356
|
+
* first, in the entity or in the model.
|
|
5357
|
+
*/
|
|
5358
|
+
function detachState(state) {
|
|
5359
|
+
assertDetachable(state, "", /* @__PURE__ */ new WeakSet());
|
|
5360
|
+
try {
|
|
5361
|
+
return structuredClone(state);
|
|
5362
|
+
} catch (cause) {
|
|
5363
|
+
throw new TypeError("detachState: state holds a Proxy or a host object that cannot be cloned; map it to plain data", { cause });
|
|
5364
|
+
}
|
|
5365
|
+
}
|
|
5366
|
+
const INDEX_KEY = /^(0|[1-9]\d*)$/;
|
|
5367
|
+
function assertDetachable(value, path, seen) {
|
|
5368
|
+
if (typeof value === "function") throw new TypeError(`detachState: state${path} is a function; map it to plain data`);
|
|
5369
|
+
if (typeof value === "symbol") throw new TypeError(`detachState: state${path} is a symbol; map it to plain data`);
|
|
5370
|
+
if (value === null || typeof value !== "object") return;
|
|
5371
|
+
const object = value;
|
|
5372
|
+
if (seen.has(object)) return;
|
|
5373
|
+
seen.add(object);
|
|
5374
|
+
if (Array.isArray(object)) {
|
|
5375
|
+
if (!hasIntrinsicPrototypeChain(object, "Array")) throwClassInstance(object, path);
|
|
5376
|
+
assertOwnPropertiesDetachable(object, path, seen, "array");
|
|
5377
|
+
return;
|
|
5378
|
+
}
|
|
5379
|
+
const tag = builtInTagWithoutInvokingAccessors(object);
|
|
5380
|
+
if (tag !== void 0) {
|
|
5381
|
+
if (!hasIntrinsicPrototypeChain(object)) throwClassInstance(object, path);
|
|
5382
|
+
if (tag === "[object Map]") {
|
|
5383
|
+
let index = 0;
|
|
5384
|
+
for (const [key, entry] of object) {
|
|
5385
|
+
assertDetachable(key, `${path}<map key #${index}>`, seen);
|
|
5386
|
+
assertDetachable(entry, `${path}<map value #${index}>`, seen);
|
|
5387
|
+
index++;
|
|
5388
|
+
}
|
|
5389
|
+
} else if (tag === "[object Set]") {
|
|
5390
|
+
let index = 0;
|
|
5391
|
+
for (const member of object) {
|
|
5392
|
+
assertDetachable(member, `${path}<set member #${index}>`, seen);
|
|
5393
|
+
index++;
|
|
5394
|
+
}
|
|
5395
|
+
} else if (tag === "[object Promise]" || tag === "[object WeakMap]" || tag === "[object WeakSet]") throw new TypeError(`detachState: state${path} is a ${tag.slice(8, -1)} and cannot be detached`);
|
|
5396
|
+
else if (tag === "[object Error]") throw new TypeError(`detachState: state${path} is an Error; map it to plain data`);
|
|
5397
|
+
else if (sharesMemory(object, tag)) throw new TypeError(`detachState: state${path} is backed by a SharedArrayBuffer and the copy would share its memory; map it to plain data`);
|
|
5398
|
+
assertOwnPropertiesDetachable(object, path, seen, "built-in");
|
|
5399
|
+
return;
|
|
5400
|
+
}
|
|
5401
|
+
const prototype = Object.getPrototypeOf(object);
|
|
5402
|
+
if (!(prototype === null || isIntrinsicConstructorPrototype(prototype, "Object") && Object.getPrototypeOf(prototype) === null)) throwClassInstance(object, path);
|
|
5403
|
+
assertOwnPropertiesDetachable(object, path, seen, "record");
|
|
5404
|
+
}
|
|
5405
|
+
/**
|
|
5406
|
+
* Audits the own properties the clone would copy or drop. The clone keeps
|
|
5407
|
+
* the enumerable own keys of a record and of an array, expandos included,
|
|
5408
|
+
* and drops every own key of another built-in. `length` on an array and
|
|
5409
|
+
* the non-enumerable keys of a built-in (`lastIndex`) are its own
|
|
5410
|
+
* machinery, not data. Index keys of a typed array or a boxed String are
|
|
5411
|
+
* its content and pass as such.
|
|
5412
|
+
*/
|
|
5413
|
+
function assertOwnPropertiesDetachable(object, path, seen, kind) {
|
|
5414
|
+
for (const key of Reflect.ownKeys(object)) {
|
|
5415
|
+
const descriptor = Object.getOwnPropertyDescriptor(object, key);
|
|
5416
|
+
if (descriptor === void 0) continue;
|
|
5417
|
+
if (typeof key === "symbol") {
|
|
5418
|
+
if (!descriptor.enumerable) continue;
|
|
5419
|
+
throw new TypeError(`detachState: state${path} has a symbol-keyed property; map it to plain data`);
|
|
5420
|
+
}
|
|
5421
|
+
if (kind === "array" && key === "length") continue;
|
|
5422
|
+
const isIndex = INDEX_KEY.test(key);
|
|
5423
|
+
if (!descriptor.enumerable) {
|
|
5424
|
+
if (kind === "built-in") continue;
|
|
5425
|
+
throw new TypeError(`detachState: state${path}.${key} is not enumerable and the clone would drop it; map it to plain data`);
|
|
5426
|
+
}
|
|
5427
|
+
if (kind === "built-in" && isIndex) continue;
|
|
5428
|
+
const memberPath = isIndex ? `${path}[${key}]` : `${path}.${key}`;
|
|
5429
|
+
if (!("value" in descriptor)) throw new TypeError(`detachState: state${memberPath} is an accessor property; map it to plain data`);
|
|
5430
|
+
if (kind === "built-in") throw new TypeError(`detachState: state${memberPath} is an expando on a ${object.constructor?.name ?? "built-in"} and the clone would drop it; map it to plain data`);
|
|
5431
|
+
assertDetachable(descriptor.value, memberPath, seen);
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5434
|
+
function sharesMemory(object, tag) {
|
|
5435
|
+
if (tag === "[object SharedArrayBuffer]") return true;
|
|
5436
|
+
return ArrayBuffer.isView(object) && Object.prototype.toString.call(object.buffer) === "[object SharedArrayBuffer]";
|
|
5437
|
+
}
|
|
5438
|
+
function throwClassInstance(object, path) {
|
|
5439
|
+
const name = Object.getPrototypeOf(object)?.constructor?.name || "anonymous class";
|
|
5440
|
+
throw new TypeError(`detachState: state${path} is a class instance (${name}); map it to plain data`);
|
|
5441
|
+
}
|
|
5442
|
+
|
|
5330
5443
|
//#endregion
|
|
5331
5444
|
//#region src/messaging/event-bus/errors.ts
|
|
5332
5445
|
/** Keeps a deep chain readable in the message without losing the recent path. */
|
|
@@ -6907,7 +7020,7 @@ function defineSnapshotModel(model) {
|
|
|
6907
7020
|
function captureAggregateSnapshot(model, aggregate, snapshotAt) {
|
|
6908
7021
|
assertSnapshotModel(model);
|
|
6909
7022
|
const recordedAt = copySnapshotAt(snapshotAt);
|
|
6910
|
-
const state =
|
|
7023
|
+
const state = detachState(model.capture(aggregate));
|
|
6911
7024
|
return deepFreeze({
|
|
6912
7025
|
state,
|
|
6913
7026
|
version: aggregate.version,
|
|
@@ -6943,8 +7056,8 @@ function reconstituteAggregateFromSnapshot(model, id, snapshot) {
|
|
|
6943
7056
|
let aggregate;
|
|
6944
7057
|
try {
|
|
6945
7058
|
let state;
|
|
6946
|
-
if (storedSchemaVersion === model.schemaVersion) state =
|
|
6947
|
-
else if (model.migrate) state =
|
|
7059
|
+
if (storedSchemaVersion === model.schemaVersion) state = detachState(snapshot.state);
|
|
7060
|
+
else if (model.migrate) state = detachState(model.migrate(detachState(snapshot.state), storedSchemaVersion));
|
|
6948
7061
|
else throw new SnapshotSchemaMismatchError({
|
|
6949
7062
|
aggregateType: model.aggregateType,
|
|
6950
7063
|
aggregateId: String(id),
|
|
@@ -6974,64 +7087,7 @@ function copySnapshotAt(snapshotAt) {
|
|
|
6974
7087
|
if (!(snapshotAt instanceof Date) || !Number.isFinite(snapshotAt.getTime())) throw new SnapshotTimeValidationError();
|
|
6975
7088
|
return new Date(snapshotAt.getTime());
|
|
6976
7089
|
}
|
|
6977
|
-
function detachSnapshotState(state) {
|
|
6978
|
-
assertSnapshotSafe(state, "", /* @__PURE__ */ new WeakSet());
|
|
6979
|
-
return structuredClone(state);
|
|
6980
|
-
}
|
|
6981
|
-
/**
|
|
6982
|
-
* Rejects graphs that structured cloning would lose or silently degrade.
|
|
6983
|
-
* Snapshot models map class-based domain state to plain persistence DTOs.
|
|
6984
|
-
* A RegExp passes: pattern and flags survive the clone, and `lastIndex`
|
|
6985
|
-
* restores as 0. The scan state of a global or sticky pattern is not
|
|
6986
|
-
* domain data.
|
|
6987
|
-
*/
|
|
6988
|
-
function assertSnapshotSafe(value, path, seen) {
|
|
6989
|
-
if (typeof value === "function") throw new TypeError(`snapshot state${path} is a function; map it to serialisable data in the snapshot model`);
|
|
6990
|
-
if (typeof value === "symbol") throw new TypeError(`snapshot state${path} is a symbol; map it to serialisable data in the snapshot model`);
|
|
6991
|
-
if (value === null || typeof value !== "object") return;
|
|
6992
|
-
const object = value;
|
|
6993
|
-
if (seen.has(object)) return;
|
|
6994
|
-
seen.add(object);
|
|
6995
|
-
if (Array.isArray(object)) {
|
|
6996
|
-
for (let index = 0; index < object.length; index++) assertSnapshotSafe(object[index], `${path}[${index}]`, seen);
|
|
6997
|
-
return;
|
|
6998
|
-
}
|
|
6999
|
-
const tag = Object.prototype.toString.call(object);
|
|
7000
|
-
if (isBuiltInObject(object, tag)) {
|
|
7001
|
-
if (tag === "[object Map]") {
|
|
7002
|
-
let index = 0;
|
|
7003
|
-
for (const [key, entry] of object) {
|
|
7004
|
-
assertSnapshotSafe(key, `${path}<map key #${index}>`, seen);
|
|
7005
|
-
assertSnapshotSafe(entry, `${path}<map value #${index}>`, seen);
|
|
7006
|
-
index++;
|
|
7007
|
-
}
|
|
7008
|
-
return;
|
|
7009
|
-
}
|
|
7010
|
-
if (tag === "[object Set]") {
|
|
7011
|
-
let index = 0;
|
|
7012
|
-
for (const member of object) {
|
|
7013
|
-
assertSnapshotSafe(member, `${path}<set member #${index}>`, seen);
|
|
7014
|
-
index++;
|
|
7015
|
-
}
|
|
7016
|
-
return;
|
|
7017
|
-
}
|
|
7018
|
-
if (tag === "[object Promise]" || tag === "[object WeakMap]" || tag === "[object WeakSet]") throw new TypeError(`snapshot state${path} is a ${tag.slice(8, -1)} and cannot be persisted`);
|
|
7019
|
-
if (tag === "[object Error]") throw new TypeError(`snapshot state${path} is an Error; map it to plain data in the snapshot model`);
|
|
7020
|
-
return;
|
|
7021
|
-
}
|
|
7022
|
-
const prototype = Object.getPrototypeOf(object);
|
|
7023
|
-
if (prototype === Object.prototype || prototype === null) {
|
|
7024
|
-
for (const key of Reflect.ownKeys(object)) {
|
|
7025
|
-
if (!Object.getOwnPropertyDescriptor(object, key)?.enumerable) continue;
|
|
7026
|
-
if (typeof key === "symbol") throw new TypeError(`snapshot state${path} has a symbol-keyed property; map it to plain data in the snapshot model`);
|
|
7027
|
-
assertSnapshotSafe(object[key], `${path}.${key}`, seen);
|
|
7028
|
-
}
|
|
7029
|
-
return;
|
|
7030
|
-
}
|
|
7031
|
-
const name = prototype.constructor?.name || "anonymous class";
|
|
7032
|
-
throw new TypeError(`snapshot state${path} is a class instance (${name}); map it to plain data in the snapshot model`);
|
|
7033
|
-
}
|
|
7034
7090
|
|
|
7035
7091
|
//#endregion
|
|
7036
|
-
export { AggregateDeletedError, AggregateNotFoundError, AggregateTrackingError, CapabilityRegistryConflictError, CommandBus, CommitError, ConcurrencyConflictError, DeadlineProcessor, DirectStateMutationError, DomainError, DomainEventValidationError, DomainStateMachine, DomainTransitionGuardRejectedError, DuplicateAggregateError, DuplicateEventIdError, DuplicateHandlerRegistrationError, Entity, ErrorMapperFailedError, EventBusClosedError, EventBusImpl, EventHarvestError, EventSourcedAggregate, FoldReturnedNoStateError, ForeignEventError, HostileStateKeyError, IdempotencyClaimLostError, IdempotencyCompletionWithoutClaimError, IdempotencyInFlightError, IdempotencyKeyReuseError, IdempotencyReconciliationRequiredError, IdentityMap, InMemoryCapacityExceededError, InMemoryDeadlineStore, InMemoryEventStore, InMemoryIdempotencyStore, InMemoryOutbox, InMemoryProjectionCheckpointStore, InMemorySnapshotStore, InfrastructureError, InvalidCommandMessageError, InvalidDomainMachineContextError, InvalidDomainMachineDefinitionError, InvalidDomainMachineInputError, InvalidDomainMachineSnapshotError, InvalidDomainTransitionError, InvalidDomainTransitionGuardResultError, InvalidDomainTransitionResultError, InvalidIntegrationMessageError, InvalidRepositoryAdapterError, InvalidRepositoryDefinitionError, InvalidVersionError, MisaddressedEventError, MissingEntityIdError, MissingFoldError, MissingHandlerError, NestedUnitOfWorkError, NonProgressingEventStreamPageError, OutboxDispatcher, PendingEventBatchMismatchError, PendingEventLimitExceededError, ProjectionGapError, ProjectionIdentityViolationError, ProjectionOrderViolationError, ProjectionReceiptViolationError, Projector, PublishDepthExceededError, QueryBus, ReentrantDomainStateMachineEvaluationError, ReentrantEventRecordingError, ReplayHeadMismatchError, RepositoryErrorMappingFailedError, RetryingTransactionScope, RollbackError, SnapshotCorruptedError, SnapshotSchemaMismatchError, SnapshotTimeValidationError, SnapshotVersionNotRestoredError, Specification, StateStoredAggregate, TransactionClosedError, UnenrolledChangesError, UnitOfWork, UnmanagedInstanceError, UnmintedEventError, UnprojectableEventError, UnregisteredHandlerError, UnreplayableAggregateError, ValueObject, analyzeDomainMachineDefinition, canTransitionDomainState, captureAggregateSnapshot, capturePersistenceBaseline, copyMetadata, createDomainEvent, createDomainEventFactory, createDomainEventFromFacts, createInitialDomainMachineSnapshot, createIntegrationMessage, createUncommittedDomainEvent, decodeIntegrationMessage, deepEqual, deepEqualExcept, deepFreeze, deepOmit, defaultDomainEventFactory, defineRepository, defineSnapshotModel, derivePersistenceChanges, domainErrorToResult, encodeIntegrationMessage, entityIds, eventBusSink, findEntityById, freezeShallow, hasEntityId, ignoreProjectionEvent, insertPersistenceBaseline, integrationMessageToCommittedEvent, isDomainErrorLike, isInfrastructureErrorLike, isPositionAfter, mergeMetadata, outboxWriterAcceptingEventLoss, persistenceProjectionDrifted, prepareDomainMachineDefinition, projectionFromHandlers, recapturePersistenceBaseline, reconstituteAggregateFromHistory, reconstituteAggregateFromSnapshot, recordDomainEvent, recordPendingEvents, removeEntityById, replaceEntityById, routeEventsToCommandOutbox, sameEntity, sameVersion, specification, toVersion, transitionDomainState, updateEntityById, vo, voEquals, voEqualsExcept, voValidated, voWithValidation, withCommit, withIdempotentCommit };
|
|
7092
|
+
export { AggregateDeletedError, AggregateNotFoundError, AggregateTrackingError, CapabilityRegistryConflictError, CommandBus, CommitError, ConcurrencyConflictError, DeadlineProcessor, DirectStateMutationError, DomainError, DomainEventValidationError, DomainStateMachine, DomainTransitionGuardRejectedError, DuplicateAggregateError, DuplicateEventIdError, DuplicateHandlerRegistrationError, Entity, ErrorMapperFailedError, EventBusClosedError, EventBusImpl, EventHarvestError, EventSourcedAggregate, FoldReturnedNoStateError, ForeignEventError, HostileStateKeyError, IdempotencyClaimLostError, IdempotencyCompletionWithoutClaimError, IdempotencyInFlightError, IdempotencyKeyReuseError, IdempotencyReconciliationRequiredError, IdentityMap, InMemoryCapacityExceededError, InMemoryDeadlineStore, InMemoryEventStore, InMemoryIdempotencyStore, InMemoryOutbox, InMemoryProjectionCheckpointStore, InMemorySnapshotStore, InfrastructureError, InvalidCommandMessageError, InvalidDomainMachineContextError, InvalidDomainMachineDefinitionError, InvalidDomainMachineInputError, InvalidDomainMachineSnapshotError, InvalidDomainTransitionError, InvalidDomainTransitionGuardResultError, InvalidDomainTransitionResultError, InvalidIntegrationMessageError, InvalidRepositoryAdapterError, InvalidRepositoryDefinitionError, InvalidVersionError, MisaddressedEventError, MissingEntityIdError, MissingFoldError, MissingHandlerError, NestedUnitOfWorkError, NonProgressingEventStreamPageError, OutboxDispatcher, PendingEventBatchMismatchError, PendingEventLimitExceededError, ProjectionGapError, ProjectionIdentityViolationError, ProjectionOrderViolationError, ProjectionReceiptViolationError, Projector, PublishDepthExceededError, QueryBus, ReentrantDomainStateMachineEvaluationError, ReentrantEventRecordingError, ReplayHeadMismatchError, RepositoryErrorMappingFailedError, RetryingTransactionScope, RollbackError, SnapshotCorruptedError, SnapshotSchemaMismatchError, SnapshotTimeValidationError, SnapshotVersionNotRestoredError, Specification, StateStoredAggregate, TransactionClosedError, UnenrolledChangesError, UnitOfWork, UnmanagedInstanceError, UnmintedEventError, UnprojectableEventError, UnregisteredHandlerError, UnreplayableAggregateError, ValueObject, analyzeDomainMachineDefinition, canTransitionDomainState, captureAggregateSnapshot, capturePersistenceBaseline, 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, mergeMetadata, outboxWriterAcceptingEventLoss, persistenceProjectionDrifted, prepareDomainMachineDefinition, projectionFromHandlers, recapturePersistenceBaseline, reconstituteAggregateFromHistory, reconstituteAggregateFromSnapshot, recordDomainEvent, recordPendingEvents, removeEntityById, replaceEntityById, routeEventsToCommandOutbox, sameEntity, sameVersion, specification, toVersion, transitionDomainState, updateEntityById, vo, voEquals, voEqualsExcept, voValidated, voWithValidation, withCommit, withIdempotentCommit };
|
|
7037
7093
|
//# sourceMappingURL=index.js.map
|