@shirudo/ddd-kit 2.2.0 → 3.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","names":[],"sources":["../../src/core/errors.ts"],"sourcesContent":["import { StructuredError } from \"@shirudo/base-error\";\n\n/**\n * **The kit's error identity model (since v3).** Every kit error is a\n * structured error carrying exactly ONE identifier: `code`, a stable\n * SCREAMING_SNAKE string, and `error.name === error.code` by design, so\n * there is no name/code drift and nothing to keep in sync. `category`\n * follows the class hierarchy mechanically (`\"DOMAIN\"`,\n * `\"INFRASTRUCTURE\"`, or `\"WIRING\"` for the crash-loud family) and\n * `retryable` is a plain boolean field.\n *\n * **No base-error adoption required.** Consumers branch with a plain\n * `switch (error.code)`, catch via `instanceof DomainError` /\n * `instanceof InfrastructureError` (exported from this kit), and read\n * `retryable` / `cause` as ordinary properties. base-error's toolbox\n * (`matchError` exhaustive dispatch, `isStructuredError`, the\n * public-error catalog and `toProblem`) works on every kit error as an\n * OPT-IN benefit on top, never as a prerequisite.\n */\n\n/**\n * Options for consumer subclasses of {@link DomainError} and\n * {@link InfrastructureError}: the `code` (which also becomes\n * `error.name`) and the technical `message` are the only obligations;\n * `retryable` defaults to `false` and the category is fixed by the base.\n */\nexport interface KitErrorOptions<TCode extends string> {\n\t/** Stable SCREAMING_SNAKE identifier; also becomes `error.name`. */\n\tcode: TCode;\n\t/** Technical message for logs and debugging, never for clients. */\n\tmessage: string;\n\t/** Optional underlying error preserved in the cause chain. */\n\tcause?: unknown;\n\t/** Whether retrying the failed operation can succeed. Default `false`. */\n\tretryable?: boolean;\n}\n\n/**\n * Abstract base for **domain-invariant violations**. Domain methods\n * (aggregates, entity validation hooks, value-object constructors)\n * throw `DomainError`-derived exceptions when a business rule is\n * violated. Consumers derive their own concrete errors (e.g.\n * `class OrderAlreadyShippedError extends DomainError<\"ORDER_ALREADY_SHIPPED\">`)\n * for `instanceof`-style catching at the App-Service boundary, where\n * they typically map to HTTP 400 / business-rule responses.\n *\n * The library itself ships no business-rule `DomainError` subclass: the\n * kit can't know your invariants. (The domain-state-machine module's\n * transition errors are the structural exception.)\n *\n * The `category` is fixed to `\"DOMAIN\"` and `retryable` defaults to\n * `false`, so a subclass supplies only its `code` and `message`:\n *\n * ```ts\n * class OrderAlreadyShippedError extends DomainError<\"ORDER_ALREADY_SHIPPED\"> {\n * constructor(orderId: string) {\n * super({\n * code: \"ORDER_ALREADY_SHIPPED\",\n * message: `Order ${orderId} has already been shipped`,\n * });\n * }\n * }\n * ```\n */\nexport abstract class DomainError<\n\tTCode extends string = string,\n> extends StructuredError<TCode, \"DOMAIN\"> {\n\tprotected constructor(options: KitErrorOptions<TCode>) {\n\t\tsuper({\n\t\t\tcode: options.code,\n\t\t\tcategory: \"DOMAIN\",\n\t\t\tretryable: options.retryable ?? false,\n\t\t\tmessage: options.message,\n\t\t\tcause: options.cause,\n\t\t});\n\t}\n}\n\n/**\n * Internal base for the kit's crash-loud **WIRING** family: deterministic\n * programming/configuration bugs that must fail the operation loudly and\n * never be absorbed by generic domain or infrastructure handlers. One\n * implementation of the `{ category: \"WIRING\", retryable: false }` shape\n * so the family cannot drift. Exported for the kit's own modules only;\n * not part of the package entries.\n */\nexport abstract class KitWiringError<\n\tTCode extends string,\n> extends StructuredError<TCode, \"WIRING\"> {\n\tprotected constructor(code: TCode, message: string, cause?: unknown) {\n\t\tsuper({ code, category: \"WIRING\", retryable: false, message, cause });\n\t}\n}\n\n/**\n * Abstract base for **infrastructure / persistence failures** that the\n * App-Service can recover from: typically by retrying, by returning\n * HTTP 404 / 409, or by surfacing a \"please try again\" UX. These are\n * not domain-invariant violations (the business rules were not\n * broken); they describe race conditions and missing rows at the\n * storage boundary.\n *\n * The `category` is fixed to `\"INFRASTRUCTURE\"`; `retryable` defaults\n * to `false` (opt in per subclass, see {@link ConcurrencyConflictError}).\n *\n * Library-internal concrete subclasses: {@link AggregateNotFoundError},\n * {@link ConcurrencyConflictError}, {@link DuplicateAggregateError},\n * plus the unit-of-work lifecycle wrappers `CommitError` and\n * `RollbackError` (in `src/app/unit-of-work.ts`).\n */\nexport abstract class InfrastructureError<\n\tTCode extends string = string,\n> extends StructuredError<TCode, \"INFRASTRUCTURE\"> {\n\tprotected constructor(options: KitErrorOptions<TCode>) {\n\t\tsuper({\n\t\t\tcode: options.code,\n\t\t\tcategory: \"INFRASTRUCTURE\",\n\t\t\tretryable: options.retryable ?? false,\n\t\t\tmessage: options.message,\n\t\t\tcause: options.cause,\n\t\t});\n\t}\n}\n\n/**\n * Copy-safe membership check for the kit's domain-error family.\n *\n * `instanceof` is false for an error constructed by another loaded copy of\n * the kit (a separately installed adapter package, a CJS/ESM dual load), so\n * kit boundaries that route by error family fall back to the structural\n * `category` field, the stable cross-copy contract.\n */\nexport function isDomainErrorLike(value: unknown): value is DomainError {\n\treturn (\n\t\tvalue instanceof DomainError ||\n\t\t(value instanceof Error &&\n\t\t\t(value as { readonly category?: unknown }).category === \"DOMAIN\")\n\t);\n}\n\n/**\n * Copy-safe membership check for the kit's infrastructure-error family.\n * Same rationale as {@link isDomainErrorLike}.\n */\nexport function isInfrastructureErrorLike(\n\tvalue: unknown,\n): value is InfrastructureError {\n\treturn (\n\t\tvalue instanceof InfrastructureError ||\n\t\t(value instanceof Error &&\n\t\t\t(value as { readonly category?: unknown }).category === \"INFRASTRUCTURE\")\n\t);\n}\n\n/** Options bag for {@link InMemoryCapacityExceededError}. */\nexport interface InMemoryCapacityExceededErrorOptions {\n\t/** Concrete reference adapter whose configured capacity was exhausted. */\n\treadonly store: string;\n\t/** Bounded collection or logical resource, such as `events` or `sources`. */\n\treadonly resource: string;\n\t/** Configured maximum number of retained records. */\n\treadonly limit: number;\n\t/** Records retained before the rejected operation. */\n\treadonly current: number;\n\t/** New records the rejected operation would have retained. */\n\treadonly attempted: number;\n}\n\n/**\n * A finite-capacity in-memory reference adapter rejected new state before\n * mutation. Existing records remain usable; callers must release explicit\n * lifecycle state, increase the configured limit, or switch to a durable\n * adapter. The error is not retryable without one of those external changes.\n */\nexport class InMemoryCapacityExceededError extends InfrastructureError<\"IN_MEMORY_CAPACITY_EXCEEDED\"> {\n\treadonly store: string;\n\treadonly resource: string;\n\treadonly limit: number;\n\treadonly current: number;\n\treadonly attempted: number;\n\n\tconstructor(options: InMemoryCapacityExceededErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"IN_MEMORY_CAPACITY_EXCEEDED\",\n\t\t\tmessage:\n\t\t\t\t`${options.store} cannot retain ${options.attempted} new ` +\n\t\t\t\t`${options.resource}: configured limit ${options.limit}, ` +\n\t\t\t\t`currently retained ${options.current}`,\n\t\t});\n\t\tthis.store = options.store;\n\t\tthis.resource = options.resource;\n\t\tthis.limit = options.limit;\n\t\tthis.current = options.current;\n\t\tthis.attempted = options.attempted;\n\t}\n}\n\n/**\n * Thrown when event dispatch reaches a type with no own handler registration.\n * This covers `EventSourcedAggregate.apply()` and the exhaustive\n * `projectionFromHandlers` helper: the declared event union and its handler map\n * disagree at runtime, which is a programming / configuration bug rather than\n * a domain or infrastructure failure.\n *\n * Deliberately **not** on `DomainError` or `InfrastructureError`:\n * a generic `catch (e instanceof DomainError)` handler at the App\n * layer must not mask a forgotten handler; this should crash loud and\n * fail the calling Use Case so the bug surfaces in development. The\n * replay through `loadFromHistory` also lets it propagate uncaught instead\n * of wrapping it in `Result.Err`.\n *\n * Use `isBaseError(e)` from `@shirudo/base-error` to detect\n * \"any structured error from the kit or any other BaseError-using\n * library\" at the App boundary.\n */\nexport class MissingHandlerError extends KitWiringError<\"MISSING_HANDLER\"> {\n\tconstructor(\n\t\tpublic readonly eventType: string,\n\t\tcause?: unknown,\n\t) {\n\t\tsuper(\n\t\t\t\"MISSING_HANDLER\",\n\t\t\t`Missing handler for event type: ${eventType}`,\n\t\t\tcause,\n\t\t);\n\t}\n}\n\n/**\n * Thrown by `Projector.project` when an event cannot be projected\n * safely because its cursor is missing or malformed, or its aggregate\n * address is absent. Applying such an event would break idempotency, so\n * the batch fails. Events written by `withCommit` carry the complete\n * cursor automatically; other sources compose a gap-proof committed-event\n * envelope. A well-formed cursor that does not continue the stored chain\n * instead throws {@link ProjectionGapError}.\n *\n * A wiring error, not a `DomainError`: see {@link MissingHandlerError}\n * for the rationale of crashing loud at the App layer.\n */\nexport class UnprojectableEventError extends KitWiringError<\"UNPROJECTABLE_EVENT\"> {\n\tconstructor(\n\t\tpublic readonly projection: string,\n\t\tpublic readonly eventId: string,\n\t\treason: string,\n\t\tcause?: unknown,\n\t) {\n\t\tsuper(\n\t\t\t\"UNPROJECTABLE_EVENT\",\n\t\t\t`Projector(${projection}): event ${eventId} ${reason}`,\n\t\t\tcause,\n\t\t);\n\t}\n}\n\n/**\n * Thrown when a valid projection cursor does not continue the stored\n * per-aggregate chain. This is an infrastructure/delivery failure: an\n * event or commit is missing, commonly because a partition reordered or\n * dead-lettered it. The projector does not apply the later event and the\n * checkpoint stays put until the missing history is replayed or the\n * projection is rebuilt.\n */\nexport class ProjectionGapError extends InfrastructureError<\"PROJECTION_GAP\"> {\n\tconstructor(\n\t\tpublic readonly projection: string,\n\t\tpublic readonly eventId: string,\n\t\tpublic readonly previousPosition: string,\n\t\tpublic readonly receivedPosition: string,\n\t) {\n\t\tsuper({\n\t\t\tcode: \"PROJECTION_GAP\",\n\t\t\tmessage:\n\t\t\t\t`Projector(${projection}): event ${eventId} creates a projection ` +\n\t\t\t\t`gap after ${previousPosition}; received ${receivedPosition}. ` +\n\t\t\t\t\"Replay the missing commit before advancing the checkpoint.\",\n\t\t});\n\t}\n}\n\n/**\n * Thrown when one batch delivers previously unseen positions of the same\n * aggregate in descending order. Unlike {@link ProjectionGapError}, this is\n * direct proof that the feed violated its per-aggregate ordering contract;\n * no missing-history inference is needed. Positions already covered by the\n * checkpoint at batch start and exact receipts repeated inside the batch\n * remain valid redeliveries and do not trip this diagnostic guard.\n */\nexport class ProjectionOrderViolationError extends InfrastructureError<\"PROJECTION_ORDER_VIOLATION\"> {\n\tconstructor(\n\t\tpublic readonly projection: string,\n\t\tpublic readonly eventId: string,\n\t\tpublic readonly previousReceivedPosition: string,\n\t\tpublic readonly receivedPosition: string,\n\t) {\n\t\tsuper({\n\t\t\tcode: \"PROJECTION_ORDER_VIOLATION\",\n\t\t\tmessage:\n\t\t\t\t`Projector(${projection}): event ${eventId} at ${receivedPosition} ` +\n\t\t\t\t`arrived after the later unprocessed position ${previousReceivedPosition} ` +\n\t\t\t\t\"in the same batch. Partition or serialize the feed by aggregate source.\",\n\t\t});\n\t}\n}\n\n/**\n * Thrown when a source maps different event identities to one position, either\n * inside the current batch or at the position stored as the projection's\n * watermark. The checkpoint retains the identity of that one last-applied\n * event, so the durable collision is provable without keeping an unbounded\n * processed-event ledger. Positions behind the watermark remain governed by\n * the source's one-logical-event-per-position contract.\n */\nexport class ProjectionIdentityViolationError extends InfrastructureError<\"PROJECTION_IDENTITY_VIOLATION\"> {\n\tconstructor(\n\t\tpublic readonly projection: string,\n\t\tpublic readonly eventId: string,\n\t\tpublic readonly recordedEventId: string,\n\t\tpublic readonly position: string,\n\t) {\n\t\tsuper({\n\t\t\tcode: \"PROJECTION_IDENTITY_VIOLATION\",\n\t\t\tmessage:\n\t\t\t\t`Projector(${projection}): position ${position} was already associated ` +\n\t\t\t\t`with event ${recordedEventId}, but the source supplied event ${eventId} ` +\n\t\t\t\t\"at the same position. A source must map exactly one logical event to each position.\",\n\t\t});\n\t}\n}\n\n/**\n * Thrown when one logical projection position keeps its event identity but its\n * commit-boundary receipt changes. `commitSize` and\n * `previousEventfulAggregateVersion` are part of the continuity proof, so a\n * source must keep them immutable just like the eventId. Accepting a\n * contradictory redelivery could hide an incomplete commit or predecessor.\n */\nexport class ProjectionReceiptViolationError extends InfrastructureError<\"PROJECTION_RECEIPT_VIOLATION\"> {\n\tconstructor(\n\t\tpublic readonly projection: string,\n\t\tpublic readonly eventId: string,\n\t\tpublic readonly recordedReceipt: string,\n\t\tpublic readonly receivedReceipt: string,\n\t) {\n\t\tsuper({\n\t\t\tcode: \"PROJECTION_RECEIPT_VIOLATION\",\n\t\t\tmessage:\n\t\t\t\t`Projector(${projection}): event ${eventId} changed its commit receipt ` +\n\t\t\t\t`at one logical position from ${recordedReceipt} to ${receivedReceipt}. ` +\n\t\t\t\t\"A source must keep commitSize and previousEventfulAggregateVersion immutable.\",\n\t\t});\n\t}\n}\n\n/** A malformed or non-JSON-safe message at an integration boundary. */\nexport class InvalidIntegrationMessageError extends InfrastructureError<\"INVALID_INTEGRATION_MESSAGE\"> {\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly reason: string,\n\t\tcause?: unknown,\n\t) {\n\t\tsuper({\n\t\t\tcode: \"INVALID_INTEGRATION_MESSAGE\",\n\t\t\tmessage: `Invalid integration message at ${path}: ${reason}`,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\n/** A malformed or non-JSON-safe command selected for durable delivery. */\nexport class InvalidCommandMessageError extends InfrastructureError<\"INVALID_COMMAND_MESSAGE\"> {\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly reason: string,\n\t\tcause?: unknown,\n\t) {\n\t\tsuper({\n\t\t\tcode: \"INVALID_COMMAND_MESSAGE\",\n\t\t\tmessage: `Invalid command message at ${path}: ${reason}`,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\n/**\n * Thrown by `Entity` (constructor and `setState`) and by the event\n * metadata helpers (`createDomainEvent`'s `options.metadata`,\n * `mergeMetadata`, `copyMetadata`) when the value carries an own\n * `\"__proto__\"` data key:\n * the shape `JSON.parse` produces for hostile DB rows or request bodies\n * handed to reconstitute factories. Such a key can never be legitimate\n * domain state; accepting it would hand a prototype-pollution payload to\n * every downstream consumer that copies the state through `[[Set]]`\n * (`Object.assign`, for-in assignment loops), and dropping it would be\n * silent data mutation.\n *\n * Deliberately **not** a `DomainError` or `InfrastructureError` (same\n * posture as {@link MissingHandlerError}): untrusted input reaching the\n * domain layer unvalidated is a boundary bug, and a generic\n * business-rule handler must not absorb it. Validate and strip untrusted\n * input at the application edge; model genuinely arbitrary keys with a\n * `Map`, not a plain object.\n */\nexport class HostileStateKeyError extends KitWiringError<\"HOSTILE_STATE_KEY\"> {\n\tconstructor(\n\t\tpublic readonly key: string,\n\t\tsubject: string = \"Entity state\",\n\t) {\n\t\tsuper(\n\t\t\t\"HOSTILE_STATE_KEY\",\n\t\t\t`${subject} carries a hostile own \"${key}\" key, which can never ` +\n\t\t\t\t\"be legitimate domain data. Validate and strip untrusted input \" +\n\t\t\t\t\"at the boundary, or model arbitrary keys with a Map.\",\n\t\t);\n\t}\n}\n\n/**\n * Thrown by `EventSourcedAggregate.loadFromHistory` when the replay target\n * carries unflushed `pendingEvents`. Replaying persisted facts onto that\n * instance would advance the version underneath decisions made against an\n * older state and could later claim history the stream does not carry.\n *\n * Deliberately **not** a `DomainError` or `InfrastructureError` (same\n * posture as {@link MissingHandlerError}): a deterministic programming\n * bug in how the aggregate was constructed before the restore. It\n * propagates as a throw instead of riding the replay methods' `Result`\n * channel, so a generic corrupted-stream handler cannot absorb it.\n * Reconstitution belongs on a bare instance: construct the aggregate\n * without factory-recorded events or prior mutations, then restore.\n *\n * Each throw site carries the safe remedy in its `reason`. Persistence\n * lifecycle state is intentionally not mutable through the aggregate API:\n * commit an actually saved instance through application orchestration, or\n * discard a dirty instance and replay into a fresh one.\n */\nexport class UnreplayableAggregateError extends KitWiringError<\"UNREPLAYABLE_AGGREGATE\"> {\n\tconstructor(\n\t\tpublic readonly aggregateId: string,\n\t\treason: string,\n\t) {\n\t\tsuper(\n\t\t\t\"UNREPLAYABLE_AGGREGATE\",\n\t\t\t`Cannot replay onto aggregate ${aggregateId}: ${reason}. ` +\n\t\t\t\t\"Reconstitute on a fresh instance (no factory-recorded events, \" +\n\t\t\t\t\"no unpersisted mutations).\",\n\t\t);\n\t}\n}\n\n/**\n * Thrown by `EventSourcedAggregate.apply()` when a NEW event carries an\n * `aggregateId` or `aggregateType` naming a different aggregate: a\n * deterministic programming bug at the call site (a hand-built or\n * copied event addressed elsewhere), caught before the event can be\n * recorded and poison the own stream. Events with MISSING address\n * fields do not trip this: `apply()` stamps them from the aggregate,\n * the same guarantee `createEvent` gives. A wiring error, distinct\n * from {@link ForeignEventError} on purpose: a wrong new event is a\n * bug in today's code, a wrong PERSISTED row is corrupted or miswired\n * infrastructure, and handlers for one must not absorb the other.\n */\nexport class MisaddressedEventError extends KitWiringError<\"MISADDRESSED_EVENT\"> {\n\tconstructor(\n\t\tpublic readonly expectedAggregateId: string,\n\t\tpublic readonly expectedAggregateType: string,\n\t\tpublic readonly eventType: string,\n\t\tpublic readonly actualAggregateId?: string,\n\t\tpublic readonly actualAggregateType?: string,\n\t) {\n\t\tsuper(\n\t\t\t\"MISADDRESSED_EVENT\",\n\t\t\t`New event \"${eventType}\" is addressed to ` +\n\t\t\t\t`${actualAggregateType ?? expectedAggregateType} ${actualAggregateId ?? expectedAggregateId} ` +\n\t\t\t\t`but was applied on ${expectedAggregateType} ${expectedAggregateId}: ` +\n\t\t\t\t\"fix the call site (createEvent stamps the right address).\",\n\t\t);\n\t}\n}\n\n/**\n * The structural-integrity rejection for a stored snapshot. A consumer's\n * adapter-owned `SnapshotModel` may throw it from migration or reconstitution\n * when the blob could not have been produced by any version of the model\n * (missing fields, impossible types, truncated data). An\n * `InfrastructureError`, because corrupted persistence is a storage\n * problem, never a business rejection; it is nevertheless RECOVERABLE\n * by design: the repository catches it, discards the derived snapshot, and\n * refolds from the authoritative event stream.\n */\nexport class SnapshotCorruptedError extends InfrastructureError<\"SNAPSHOT_CORRUPTED\"> {\n\tconstructor(message: string, cause?: unknown) {\n\t\tsuper({ code: \"SNAPSHOT_CORRUPTED\", message, cause });\n\t}\n}\n\n/**\n * Thrown when an event reaches the aggregate's recording paths\n * (`apply`, `commit`, `addDomainEvent`) without having been minted by\n * the kit's constructors: `createDomainEvent`,\n * `createDomainEventFromFacts`, `createUncommittedDomainEvent`, or aggregate\n * event helpers\n * deep-freeze the event and defensively copy payload and metadata,\n * and register the result in an internal, unforgeable mint marker.\n * Anything else (a hand-rolled literal, a shallow-frozen copy with\n * mutable nested data) is rejected: a mutable event recorded next to\n * a state change can silently diverge from it afterwards. A wiring\n * error: deterministic bug at the call site, the remedy is minting\n * through the constructors.\n */\nexport class UnmintedEventError extends KitWiringError<\"UNMINTED_EVENT\"> {\n\tconstructor(eventType: string) {\n\t\tsuper(\n\t\t\t\"UNMINTED_EVENT\",\n\t\t\t`Event \"${eventType}\" was not minted by a domain-event constructor ` +\n\t\t\t\t\"or aggregate createEvent(...) helper. Those \" +\n\t\t\t\t\"constructors deep-freeze the event \" +\n\t\t\t\t\"and defensively copy payload and metadata; a mutable event \" +\n\t\t\t\t\"could diverge from the state change it records.\",\n\t\t);\n\t}\n}\n\n/**\n * Thrown by `recordPendingEvents` when the aggregate's pending-event list\n * changes while its events are being stamped: a stamp provider that\n * directly or transitively triggers a new decision on the same aggregate\n * would otherwise have that decision silently discarded when recording\n * replaces the pending list. Recording is atomic: when this guard fires,\n * every decision (including the re-entrant one) remains unrecorded. A\n * wiring error: deterministic bug at the call site, the remedy is keeping\n * stamp providers free of domain decisions.\n */\nexport class ReentrantEventRecordingError extends KitWiringError<\"REENTRANT_EVENT_RECORDING\"> {\n\tconstructor(aggregateId: string) {\n\t\tsuper(\n\t\t\t\"REENTRANT_EVENT_RECORDING\",\n\t\t\t`Pending events of aggregate ${aggregateId} changed while ` +\n\t\t\t\t\"recordPendingEvents was stamping them. A stamp provider must not \" +\n\t\t\t\t\"trigger new decisions on the aggregate being recorded; make every \" +\n\t\t\t\t\"domain decision first, then record.\",\n\t\t);\n\t}\n}\n\n/**\n * Thrown by `recordPendingEvents` when two events in one aggregate's pending\n * batch carry the same `eventId`: a stamp provider that returns one reused\n * stamp (or repeats an explicit id) would otherwise mint two distinct facts\n * sharing one identity, and downstream idempotent consumers keyed on\n * `eventId` silently drop one of them. A wiring error: deterministic bug in\n * the stamp provider, the remedy is one fresh identity per decision.\n */\nexport class DuplicateEventIdError extends KitWiringError<\"DUPLICATE_EVENT_ID\"> {\n\tconstructor(\n\t\taggregateId: string,\n\t\t/** The identity two pending events would have shared. */\n\t\tpublic readonly eventId: string,\n\t) {\n\t\tsuper(\n\t\t\t\"DUPLICATE_EVENT_ID\",\n\t\t\t`Two pending events of aggregate ${aggregateId} carry the same ` +\n\t\t\t\t`eventId \"${eventId}\". Each decision needs its own identity; ` +\n\t\t\t\t\"return a fresh stamp per event from the stamp provider.\",\n\t\t);\n\t}\n}\n\n/**\n * Thrown by persisted-event consumers (including `loadFromHistory` and\n * `Projector`) when an event carries an\n * `aggregateId` or `aggregateType` that names a different aggregate:\n * the persisted row belongs to someone else (a miswired stream read,\n * ids colliding across aggregate types, a corrupted store). An\n * `InfrastructureError`, NOT a `DomainError` (same posture as\n * {@link SnapshotSchemaMismatchError}): a wrong address is data\n * corruption or wiring, never an expected business rejection, so it\n * must not be absorbed by generic domain error handling or presented\n * as a 4xx. It therefore PROPAGATES as a throw through the replay\n * methods' `Result` contract (which reserves `Err` for `DomainError`),\n * after the usual all-or-nothing rollback. History events without the\n * optional address fields pass unchecked (the fields are optional on\n * the event shape); new events are covered by\n * {@link MisaddressedEventError}.\n */\nexport class ForeignEventError extends InfrastructureError<\"FOREIGN_EVENT\"> {\n\tconstructor(\n\t\tpublic readonly expectedAggregateId: string,\n\t\tpublic readonly expectedAggregateType: string,\n\t\tpublic readonly eventType: string,\n\t\tpublic readonly actualAggregateId?: string,\n\t\tpublic readonly actualAggregateType?: string,\n\t) {\n\t\tsuper({\n\t\t\tcode: \"FOREIGN_EVENT\",\n\t\t\tmessage:\n\t\t\t\t`Persisted event \"${eventType}\" belongs to ` +\n\t\t\t\t`${actualAggregateType ?? expectedAggregateType} ${actualAggregateId ?? expectedAggregateId}, ` +\n\t\t\t\t`not to ${expectedAggregateType} ${expectedAggregateId}: ` +\n\t\t\t\t\"the stream row addresses a different aggregate.\",\n\t\t});\n\t}\n}\n\n/** Constructor options for {@link NonProgressingEventStreamPageError}. */\nexport interface NonProgressingEventStreamPageErrorOptions {\n\treadonly aggregateType: string;\n\treadonly aggregateId: string;\n\t/** Exclusive continuation cursor supplied to `EventStore.readStream`. */\n\treadonly fromVersion: number;\n\t/** Pinned inclusive stream version the replay still has to reach. */\n\treadonly targetVersion: number;\n}\n\n/**\n * Thrown by a paged EventStore consumer when `readStream` returns no events\n * even though its continuation cursor has not reached the pinned target.\n * Such a page cannot advance and violates the EventStore port contract; a\n * replay loop that merely continued would spin forever.\n *\n * This is a non-retryable infrastructure error: the persistence adapter\n * deterministically contradicted its port contract, so retrying the same read\n * is not a recovery policy. Run `createEventStoreContractTests` against the\n * adapter and fix its windowing/continuation implementation.\n */\nexport class NonProgressingEventStreamPageError extends InfrastructureError<\"NON_PROGRESSING_EVENT_STREAM_PAGE\"> {\n\treadonly aggregateType: string;\n\treadonly aggregateId: string;\n\treadonly fromVersion: number;\n\treadonly targetVersion: number;\n\n\tconstructor(options: NonProgressingEventStreamPageErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"NON_PROGRESSING_EVENT_STREAM_PAGE\",\n\t\t\tmessage:\n\t\t\t\t`EventStore returned no events for ${options.aggregateType}(${options.aggregateId}) ` +\n\t\t\t\t`after version ${options.fromVersion}, before pinned target version ` +\n\t\t\t\t`${options.targetVersion}. The page cannot advance; run the EventStore ` +\n\t\t\t\t\"contract suite and fix the adapter's continuation window.\",\n\t\t});\n\t\tthis.aggregateType = options.aggregateType;\n\t\tthis.aggregateId = options.aggregateId;\n\t\tthis.fromVersion = options.fromVersion;\n\t\tthis.targetVersion = options.targetVersion;\n\t}\n}\n\n/**\n * Thrown when an event harvested from an aggregate cannot be safely composed\n * into a commit envelope, or when an outbox can prove that accepting a\n * candidate would violate its event identity/source chain. Harvest failures\n * include missing `aggregateId` / `aggregateType` (downstream routing would\n * break), or an\n * eventful persisted aggregate did not advance its version (two commits\n * would receive the same source position). These programming bugs are\n * deterministic and fail identically on every retry.\n *\n * Deliberately **not** an {@link InfrastructureError} (same reasoning as\n * {@link MissingHandlerError}): this is a deterministic programming error,\n * not a transient storage failure. A `catch (e instanceof InfrastructureError)`\n * retry handler, or a retrying `TransactionScope`, must NOT mask it or loop on\n * it forever; it should crash loud so the caller misuse surfaces in\n * development. This is why `withCommit` throws it directly and\n * `UnitOfWork.run` passes it through unchanged instead of wrapping it in\n * `CommitError`.\n */\nexport class EventHarvestError extends KitWiringError<\"EVENT_HARVEST_FAILED\"> {\n\tconstructor(\n\t\tmessage: string,\n\t\t/** The `type` of the offending event, for programmatic routing. */\n\t\tpublic readonly eventType?: string,\n\t) {\n\t\tsuper(\"EVENT_HARVEST_FAILED\", message);\n\t}\n}\n\n/**\n * Shared guard for the loud-rejection contract on own `__proto__` data\n * keys (the shape `JSON.parse` produces for hostile rows, bodies, or\n * envelopes): used by `Entity` state copies and the event metadata\n * helpers. One implementation so the contract cannot drift.\n * Module-internal export; not part of the package entries.\n */\nexport function assertNoHostileOwnProtoKey(\n\tvalue: object,\n\tsubject: string,\n): void {\n\tif (Object.hasOwn(value, \"__proto__\")) {\n\t\tthrow new HostileStateKeyError(\"__proto__\", subject);\n\t}\n}\n\n/** Constructor options for {@link UnregisteredHandlerError}. */\nexport interface UnregisteredHandlerErrorOptions {\n\t/** Which bus rejected the dispatch. */\n\treadonly busKind: \"command\" | \"query\";\n\t/** The message type no handler was registered for. */\n\treadonly messageType: string;\n}\n\n/**\n * Produced by the in-memory `CommandBus` / `QueryBus` when a message is\n * dispatched for a type no handler was registered under: a wiring bug\n * (typo in the type string, missing `register` call at bootstrap), not\n * a domain or infrastructure failure.\n *\n * Carries the `WIRING` category (same crash-loud family as\n * {@link MissingHandlerError}), and since v3 it is THROWN by `execute`\n * and `executeUnsafe` alike, never delivered through the error channel:\n * the channel carries expected failures a registered handler produced,\n * and a generic err-branch must not absorb a mis-wired bus. Catch it\n * only at a boundary that turns bugs into 500s.\n */\nexport class UnregisteredHandlerError extends KitWiringError<\"UNREGISTERED_HANDLER\"> {\n\treadonly busKind: \"command\" | \"query\";\n\treadonly messageType: string;\n\n\tconstructor(options: UnregisteredHandlerErrorOptions) {\n\t\tsuper(\n\t\t\t\"UNREGISTERED_HANDLER\",\n\t\t\t`No handler registered for ${options.busKind} type: ${options.messageType}`,\n\t\t);\n\t\tthis.busKind = options.busKind;\n\t\tthis.messageType = options.messageType;\n\t}\n}\n\n/** Constructor options for {@link DuplicateHandlerRegistrationError}. */\nexport interface DuplicateHandlerRegistrationErrorOptions {\n\t/** Which bus rejected the registration. */\n\treadonly busKind: \"command\" | \"query\";\n\t/** The message type a handler was already registered for. */\n\treadonly messageType: string;\n}\n\n/**\n * Produced by `CommandBus.register` / `QueryBus.register` when a handler\n * is registered for a type that already has one: silent replacement would\n * turn the first handler into dead code with no signal, so the wiring bug\n * surfaces at registration time. Same crash-loud family as\n * {@link UnregisteredHandlerError}; catch it only at a boundary that\n * turns bugs into 500s.\n */\nexport class DuplicateHandlerRegistrationError extends KitWiringError<\"DUPLICATE_HANDLER_REGISTRATION\"> {\n\treadonly busKind: \"command\" | \"query\";\n\treadonly messageType: string;\n\n\tconstructor(options: DuplicateHandlerRegistrationErrorOptions) {\n\t\tsuper(\n\t\t\t\"DUPLICATE_HANDLER_REGISTRATION\",\n\t\t\t`A handler for ${options.busKind} type \"${options.messageType}\" is ` +\n\t\t\t\t\"already registered; the duplicate would silently shadow the \" +\n\t\t\t\t\"first. Register each type exactly once at bootstrap.\",\n\t\t);\n\t\tthis.busKind = options.busKind;\n\t\tthis.messageType = options.messageType;\n\t}\n}\n\n/** Constructor options for {@link ErrorMapperFailedError}. */\nexport interface ErrorMapperFailedErrorOptions {\n\t/** Which bus was mapping the failure. */\n\treadonly busKind: \"command\" | \"query\";\n\t/** The registered handler's ORIGINAL failure (also set as `cause`). */\n\treadonly handlerError: unknown;\n\t/** The mapper failure or invalid-decision diagnostic. */\n\treadonly mapperError: unknown;\n}\n\n/**\n * Produced by the in-memory `CommandBus` / `QueryBus` when the configured\n * `mapExpectedError` policy fails while classifying a registered handler's\n * failure, either by throwing or by returning an invalid decision. A broken\n * mapper is a wiring bug: letting its failure propagate bare would\n * replace the handler's original failure entirely, and the rest of the\n * kit is fastidious about never letting a secondary failure mask the\n * primary one (`RollbackError.rollbackCause`, the neutralized observers).\n *\n * The handler's original failure is preserved as `cause` (so cause-chain\n * walks, retryability checks, and error-type mapping keep working) and\n * the mapper's own failure rides along as {@link mapperCause}.\n *\n * Carries the `WIRING` category (same crash-loud family as\n * {@link MissingHandlerError} and {@link UnregisteredHandlerError}): it is\n * thrown, never delivered through the error channel.\n */\nexport class ErrorMapperFailedError extends KitWiringError<\"ERROR_MAPPER_FAILED\"> {\n\treadonly busKind: \"command\" | \"query\";\n\t/** The mapper failure or invalid-decision diagnostic. */\n\treadonly mapperCause: unknown;\n\n\tconstructor(options: ErrorMapperFailedErrorOptions) {\n\t\tsuper(\n\t\t\t\"ERROR_MAPPER_FAILED\",\n\t\t\t`The ${options.busKind} bus mapExpectedError policy failed while ` +\n\t\t\t\t\"classifying a \" +\n\t\t\t\t\"handler failure. The original handler error is preserved as \" +\n\t\t\t\t\"cause; the mapper's own failure as mapperCause.\",\n\t\t\toptions.handlerError,\n\t\t);\n\t\tthis.busKind = options.busKind;\n\t\tthis.mapperCause = options.mapperError;\n\t}\n}\n\n/**\n * Thrown at the end of a `UnitOfWork.run` when an aggregate that was\n * loaded into the identity map changed but no `update` intent was registered.\n * Without this guard the changed state or pending events would be silently\n * dropped.\n *\n * Deliberately **not** an `InfrastructureError` (same posture as\n * {@link MissingHandlerError}): a programming bug that must crash loud,\n * not be absorbed by a generic infrastructure-error handler. The throw\n * happens inside the transaction, so the unit of work rolls back and\n * leaves no partial state.\n *\n * **Scope of the guard.** A best-effort runtime safety net, not a proof.\n * It sees aggregates that repository adapters register through\n * `tracking.trackLoaded` and detects ordinary state changes through the version\n * captured at load. The pending-event count remains a second guard for an\n * invalid event-only mutation that did not advance the version. A freshly\n * created aggregate that is never passed to `add` is invisible to the kit.\n */\nexport class UnenrolledChangesError extends KitWiringError<\"UNENROLLED_CHANGES\"> {\n\tconstructor(public readonly aggregateId: string) {\n\t\tsuper(\n\t\t\t\"UNENROLLED_CHANGES\",\n\t\t\t`Aggregate ${aggregateId} was loaded and changed in this unit of work, ` +\n\t\t\t\t\"but no update intent was registered. Call repository.update(aggregate) \" +\n\t\t\t\t\"after the final domain decision so state and events flush together.\",\n\t\t);\n\t}\n}\n\n/**\n * Thrown when an aggregate removed within the current unit of work is added,\n * updated, or tracked again in the same operation. Removal is final within an\n * operation; writing afterwards would resurrect the row, which is always a\n * use-case bug.\n *\n * Carries the `WIRING` category (same reasoning as\n * {@link MissingHandlerError}): a programming bug that should crash\n * loud, not be absorbed by a generic infrastructure-error handler.\n */\nexport class AggregateDeletedError extends KitWiringError<\"AGGREGATE_DELETED\"> {\n\tconstructor(public readonly aggregateId: string) {\n\t\tsuper(\n\t\t\t\"AGGREGATE_DELETED\",\n\t\t\t`Aggregate ${aggregateId} was removed in this unit of work and ` +\n\t\t\t\t\"cannot be added, updated, tracked, or removed through another \" +\n\t\t\t\t\"instance again. Removal is final within an operation. A repeated \" +\n\t\t\t\t\"remove of the SAME instance is an accepted no-op; if the \" +\n\t\t\t\t\"aggregate must remain, do not remove it.\",\n\t\t);\n\t}\n}\n\n/**\n * Thrown by `AggregatePersistence.getById()` when an aggregate with the\n * given id does not exist. `InfrastructureError` because the storage\n * boundary, not a business rule, decided the row is absent. Use the\n * nullable variant `findById()` if \"not found\" is a valid outcome.\n *\n * Accepts an optional `cause` so a repository adapter can wrap a lower-level\n * \"row not found\" or driver-level error without\n * losing context. Cause-chain helpers (`getRootCause`,\n * `findInCauseChain`) from `@shirudo/base-error` traverse the chain.\n *\n * Not retryable: retrying won't make the row appear.\n */\nexport interface AggregateNotFoundErrorOptions {\n\treadonly aggregateType: string;\n\treadonly id: string;\n\t/** Optional lower-level error to preserve in the cause chain. */\n\treadonly cause?: unknown;\n}\n\nexport class AggregateNotFoundError extends InfrastructureError<\"AGGREGATE_NOT_FOUND\"> {\n\treadonly aggregateType: string;\n\treadonly id: string;\n\n\tconstructor(options: AggregateNotFoundErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"AGGREGATE_NOT_FOUND\",\n\t\t\tmessage: `Aggregate not found: ${options.aggregateType}(${options.id})`,\n\t\t\tcause: options.cause,\n\t\t});\n\t\tthis.aggregateType = options.aggregateType;\n\t\tthis.id = options.id;\n\t}\n}\n\n/**\n * Thrown by a repository's `add()` flush when a row with the\n * aggregate's id already exists (unique-constraint violation): two\n * concurrent creators raced on the same business-derived id, or the\n * id generator collided. Same delegation model as\n * {@link ConcurrencyConflictError}: the kit ships the class, the\n * consumer repository maps its driver's unique-violation signal to it\n * instead of letting a raw driver error escape -\n *\n * - Postgres: SQLSTATE `23505` (`unique_violation`)\n * - MySQL/MariaDB: errno `1062` (`ER_DUP_ENTRY`)\n * - SQLite: `SQLITE_CONSTRAINT_UNIQUE` (extended code 2067)\n *\n * `InfrastructureError` because the storage boundary detects the\n * collision. NOT retryable: re-running the same INSERT cannot succeed.\n * The right reactions are domain decisions - map to HTTP 409, or for\n * idempotency-key flows load the existing aggregate and treat the\n * request as already-applied.\n */\nexport interface DuplicateAggregateErrorOptions {\n\treadonly aggregateType: string;\n\treadonly aggregateId: string;\n\t/** Optional driver-level error to preserve in the cause chain. */\n\treadonly cause?: unknown;\n}\n\nexport class DuplicateAggregateError extends InfrastructureError<\"DUPLICATE_AGGREGATE\"> {\n\treadonly aggregateType: string;\n\treadonly aggregateId: string;\n\n\tconstructor(options: DuplicateAggregateErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"DUPLICATE_AGGREGATE\",\n\t\t\tmessage: `Duplicate aggregate: ${options.aggregateType}(${options.aggregateId}) already exists`,\n\t\t\tcause: options.cause,\n\t\t});\n\t\tthis.aggregateType = options.aggregateType;\n\t\tthis.aggregateId = options.aggregateId;\n\t}\n}\n\n/**\n * Thrown by `reconstituteAggregateFromSnapshot` when the stored snapshot\n * carries a different schema version than its adapter-owned `SnapshotModel`\n * and the model declares no `migrate` function. Without the check, a snapshot\n * written against an older DTO shape would surface as an undefined-field crash on\n * the first method call after a much later restore.\n *\n * `InfrastructureError` because the storage boundary served outdated\n * data; the schema evolving past stored snapshots is an expected\n * lifecycle event, not a programming bug. NOT retryable: the recovery\n * is a code path, not a repeat. Add `migrate` to the snapshot model (upgrade\n * old DTOs in place), or catch this error in the repository, discard the\n * snapshot, and refold from the full event stream / reload from the source of\n * truth.\n */\nexport interface SnapshotSchemaMismatchErrorOptions {\n\treadonly aggregateType: string;\n\treadonly aggregateId: string;\n\treadonly expectedSchemaVersion: number;\n\treadonly actualSchemaVersion: number;\n}\n\nexport class SnapshotSchemaMismatchError extends InfrastructureError<\"SNAPSHOT_SCHEMA_MISMATCH\"> {\n\treadonly aggregateType: string;\n\treadonly aggregateId: string;\n\treadonly expectedSchemaVersion: number;\n\treadonly actualSchemaVersion: number;\n\n\tconstructor(options: SnapshotSchemaMismatchErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"SNAPSHOT_SCHEMA_MISMATCH\",\n\t\t\tmessage:\n\t\t\t\t`Snapshot schema mismatch on ${options.aggregateType}(${options.aggregateId}): ` +\n\t\t\t\t`the snapshot model expects schema ${options.expectedSchemaVersion}, ` +\n\t\t\t\t`the stored snapshot carries ${options.actualSchemaVersion}. Override ` +\n\t\t\t\t`the model's migrate function to upgrade old snapshots, or discard the snapshot ` +\n\t\t\t\t`and refold from the full event stream.`,\n\t\t});\n\t\tthis.aggregateType = options.aggregateType;\n\t\tthis.aggregateId = options.aggregateId;\n\t\tthis.expectedSchemaVersion = options.expectedSchemaVersion;\n\t\tthis.actualSchemaVersion = options.actualSchemaVersion;\n\t}\n}\n\n/**\n * Surfaced by a Unit-of-Work flush when the aggregate's expected version does\n * not match the version currently persisted: i.e. another writer\n * updated the aggregate concurrently. The canonical optimistic-\n * concurrency signal; the App-Service typically reloads, re-applies\n * the use case, and retries, or surfaces HTTP 409 to the caller.\n *\n * **Retry means a FRESH unit of work** (a new `UnitOfWork.run()` /\n * `withCommit` invocation): reload, re-apply, and register `update` again. Do NOT catch this\n * inside the same `run()` callback and continue: the failed aggregate\n * is already enrolled (its events would be committed for a write that\n * never happened) and the identity map still serves the same stale\n * instance to any in-place \"reload\".\n *\n * `InfrastructureError` because the persistence layer (not a domain\n * rule) detects the race. Marks itself as `retryable: true` so the\n * `isRetryable` predicate from `@shirudo/base-error` picks it up.\n */\nexport interface ConcurrencyConflictErrorOptions {\n\treadonly aggregateType: string;\n\treadonly aggregateId: string;\n\treadonly expectedVersion: number;\n\treadonly actualVersion: number;\n\t/** Optional driver-level error to preserve in the cause chain. */\n\treadonly cause?: unknown;\n}\n\nexport class ConcurrencyConflictError extends InfrastructureError<\"CONCURRENCY_CONFLICT\"> {\n\treadonly aggregateType: string;\n\treadonly aggregateId: string;\n\treadonly expectedVersion: number;\n\treadonly actualVersion: number;\n\n\tconstructor(options: ConcurrencyConflictErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"CONCURRENCY_CONFLICT\",\n\t\t\tmessage: `Concurrency conflict on ${options.aggregateType}(${options.aggregateId}): expected version ${options.expectedVersion}, actual ${options.actualVersion}`,\n\t\t\tcause: options.cause,\n\t\t\t// The canonical OCC pattern: reload the aggregate, re-apply the\n\t\t\t// use case, retry in a FRESH unit of work. The structured field\n\t\t\t// is what the retry classifier (someChainRetryable) reads.\n\t\t\tretryable: true,\n\t\t});\n\t\tthis.aggregateType = options.aggregateType;\n\t\tthis.aggregateId = options.aggregateId;\n\t\tthis.expectedVersion = options.expectedVersion;\n\t\tthis.actualVersion = options.actualVersion;\n\t}\n}\n\n/**\n * Options bag for {@link IdempotencyKeyReuseError}.\n */\nexport interface IdempotencyKeyReuseErrorOptions {\n\treadonly key: string;\n\treadonly storedFingerprint: string;\n\treadonly receivedFingerprint: string;\n\t/** Optional driver-level error to preserve in the cause chain. */\n\treadonly cause?: unknown;\n}\n\n/**\n * Thrown by `IdempotencyStore.claim()` when the same idempotency key\n * arrives with a DIFFERENT command fingerprint than the one it was\n * first claimed with: the caller is reusing a key for a different\n * command. Replaying the stored outcome would answer a question that\n * was never asked; rejecting is the only safe reaction.\n *\n * `InfrastructureError` because the store detects the collision, same\n * delegation model as {@link DuplicateAggregateError}. NOT retryable:\n * re-sending the same mismatched pair cannot succeed. Map it to an\n * unprocessable/conflict application outcome.\n */\nexport class IdempotencyKeyReuseError extends InfrastructureError<\"IDEMPOTENCY_KEY_REUSE\"> {\n\treadonly key: string;\n\treadonly storedFingerprint: string;\n\treadonly receivedFingerprint: string;\n\n\tconstructor(options: IdempotencyKeyReuseErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"IDEMPOTENCY_KEY_REUSE\",\n\t\t\tmessage:\n\t\t\t\t`Idempotency key reuse on \"${options.key}\": stored fingerprint ` +\n\t\t\t\t`${options.storedFingerprint}, received ${options.receivedFingerprint}`,\n\t\t\tcause: options.cause,\n\t\t});\n\t\tthis.key = options.key;\n\t\tthis.storedFingerprint = options.storedFingerprint;\n\t\tthis.receivedFingerprint = options.receivedFingerprint;\n\t}\n}\n\n/** Options bag for {@link IdempotencyClaimLostError}. */\nexport interface IdempotencyClaimLostErrorOptions {\n\treadonly key: string;\n\treadonly token: string;\n\t/** Optional driver-level error to preserve in the cause chain. */\n\treadonly cause?: unknown;\n}\n\n/**\n * Thrown when a leased idempotency owner tries to renew, complete, or\n * reconcile through a claim token that no longer owns the key. The usual\n * cause is lease expiry followed by a successful takeover. The stale\n * execution must abort before its transaction commits; retrying starts from\n * a fresh claim or replays the winner.\n */\nexport class IdempotencyClaimLostError extends InfrastructureError<\"IDEMPOTENCY_CLAIM_LOST\"> {\n\treadonly key: string;\n\treadonly token: string;\n\n\tconstructor(options: IdempotencyClaimLostErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"IDEMPOTENCY_CLAIM_LOST\",\n\t\t\tmessage:\n\t\t\t\t`Idempotency claim for key \"${options.key}\" no longer belongs to ` +\n\t\t\t\t`token \"${options.token}\"`,\n\t\t\tcause: options.cause,\n\t\t\tretryable: true,\n\t\t});\n\t\tthis.key = options.key;\n\t\tthis.token = options.token;\n\t}\n}\n\n/**\n * Options bag for {@link IdempotencyInFlightError}.\n */\nexport interface IdempotencyInFlightErrorOptions {\n\treadonly key: string;\n\t/** Optional driver-level error to preserve in the cause chain. */\n\treadonly cause?: unknown;\n}\n\n/**\n * Thrown by `IdempotencyStore.claim()` when the key is already claimed\n * by an execution that has not completed yet: the first delivery of the\n * command is still running (or crashed mid-flight on a\n * non-transactional store). Retryable by design: a later retry either\n * finds the completed outcome and replays it, or finds the claim\n * released (rolled back) and executes fresh. `RetryingTransactionScope`\n * picks this up through the `retryable` flag without extra wiring.\n */\nexport class IdempotencyInFlightError extends InfrastructureError<\"IDEMPOTENCY_IN_FLIGHT\"> {\n\treadonly key: string;\n\n\tconstructor(options: IdempotencyInFlightErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"IDEMPOTENCY_IN_FLIGHT\",\n\t\t\tmessage:\n\t\t\t\t`Idempotency key \"${options.key}\" is claimed by an execution ` +\n\t\t\t\t`that has not completed yet`,\n\t\t\tcause: options.cause,\n\t\t\tretryable: true,\n\t\t});\n\t\tthis.key = options.key;\n\t}\n}\n\n/** Options bag for {@link IdempotencyReconciliationRequiredError}. */\nexport interface IdempotencyReconciliationRequiredErrorOptions {\n\treadonly key: string;\n\treadonly fingerprint: string;\n\treadonly token: string;\n\treadonly expiredAt: string;\n}\n\n/**\n * An expired staged outcome cannot be replayed or discarded until the\n * application checks the authoritative write model. Immediate retry without\n * that evidence cannot make progress, so this error is deliberately not\n * marked retryable.\n */\nexport class IdempotencyReconciliationRequiredError extends InfrastructureError<\"IDEMPOTENCY_RECONCILIATION_REQUIRED\"> {\n\treadonly key: string;\n\treadonly fingerprint: string;\n\treadonly token: string;\n\treadonly expiredAt: string;\n\n\tconstructor(options: IdempotencyReconciliationRequiredErrorOptions) {\n\t\tsuper({\n\t\t\tcode: \"IDEMPOTENCY_RECONCILIATION_REQUIRED\",\n\t\t\tmessage:\n\t\t\t\t`Idempotency key \"${options.key}\" has an expired staged outcome; ` +\n\t\t\t\t\"consult the authoritative write model before confirming or releasing it\",\n\t\t});\n\t\tthis.key = options.key;\n\t\tthis.fingerprint = options.fingerprint;\n\t\tthis.token = options.token;\n\t\tthis.expiredAt = options.expiredAt;\n\t}\n}\n\n/**\n * Thrown by `IdempotencyStore.complete()` when no pending claim exists\n * for the key: `complete` ran without a preceding successful `claim`\n * in the same execution, or against a key whose claim was already\n * completed or abandoned. Always a wiring bug in hand-rolled\n * orchestration (`withIdempotentCommit` cannot produce it), hence the\n * crash-loud category.\n */\nexport class IdempotencyCompletionWithoutClaimError extends KitWiringError<\"IDEMPOTENCY_COMPLETED_WITHOUT_CLAIM\"> {\n\tconstructor(public readonly key: string) {\n\t\tsuper(\n\t\t\t\"IDEMPOTENCY_COMPLETED_WITHOUT_CLAIM\",\n\t\t\t`IdempotencyStore.complete() called for key \"${key}\" without a ` +\n\t\t\t\t\"pending claim; call claim() first (or use withIdempotentCommit)\",\n\t\t);\n\t}\n}\n\n/**\n * The closed union of every error code the kit itself can produce\n * (consumer subclasses of {@link DomainError} / {@link InfrastructureError}\n * add their own on top). Useful for building `switch` tables or\n * base-error `matchError` cases that cover kit and consumer codes\n * together, without importing anything from base-error.\n */\nexport type KitErrorCode =\n\t| \"AGGREGATE_DELETED\"\n\t| \"AGGREGATE_NOT_FOUND\"\n\t| \"AGGREGATE_TRACKING\"\n\t| \"COMMIT_FAILED\"\n\t| \"CONCURRENCY_CONFLICT\"\n\t| \"DOMAIN_TRANSITION_GUARD_REJECTED\"\n\t| \"DUPLICATE_AGGREGATE\"\n\t| \"DUPLICATE_EVENT_ID\"\n\t| \"DUPLICATE_HANDLER_REGISTRATION\"\n\t| \"ERROR_MAPPER_FAILED\"\n\t| \"EVENT_ADDRESS_INVALID\"\n\t| \"EVENT_HARVEST_FAILED\"\n\t| \"EVENT_ID_INVALID\"\n\t| \"EVENT_ID_REQUIRED\"\n\t| \"EVENT_OCCURRED_AT_INVALID\"\n\t| \"EVENT_OCCURRED_AT_REQUIRED\"\n\t| \"EVENT_SCHEMA_VERSION_INVALID\"\n\t| \"EVENT_TYPE_INVALID\"\n\t| \"FOREIGN_EVENT\"\n\t| \"HOSTILE_STATE_KEY\"\n\t| \"IDEMPOTENCY_CLAIM_LOST\"\n\t| \"IDEMPOTENCY_COMPLETED_WITHOUT_CLAIM\"\n\t| \"IDEMPOTENCY_IN_FLIGHT\"\n\t| \"IDEMPOTENCY_KEY_REUSE\"\n\t| \"IDEMPOTENCY_RECONCILIATION_REQUIRED\"\n\t| \"IN_MEMORY_CAPACITY_EXCEEDED\"\n\t| \"INVALID_DOMAIN_MACHINE_CONTEXT\"\n\t| \"INVALID_DOMAIN_MACHINE_DEFINITION\"\n\t| \"INVALID_DOMAIN_MACHINE_INPUT\"\n\t| \"INVALID_DOMAIN_MACHINE_SNAPSHOT\"\n\t| \"INVALID_DOMAIN_TRANSITION\"\n\t| \"INVALID_DOMAIN_TRANSITION_GUARD_RESULT\"\n\t| \"INVALID_DOMAIN_TRANSITION_RESULT\"\n\t| \"INVALID_COMMAND_MESSAGE\"\n\t| \"INVALID_INTEGRATION_MESSAGE\"\n\t| \"INVALID_MONEY\"\n\t| \"INVALID_REPOSITORY_ADAPTER\"\n\t| \"INVALID_REPOSITORY_DEFINITION\"\n\t| \"MISADDRESSED_EVENT\"\n\t| \"MISSING_HANDLER\"\n\t| \"MONEY_CURRENCY_MISMATCH\"\n\t| \"MONEY_PRECISION_LOSS\"\n\t| \"MONEY_SCALE_MISMATCH\"\n\t| \"NESTED_UNIT_OF_WORK\"\n\t| \"NON_PROGRESSING_EVENT_STREAM_PAGE\"\n\t| \"PROJECTION_GAP\"\n\t| \"PROJECTION_IDENTITY_VIOLATION\"\n\t| \"PROJECTION_ORDER_VIOLATION\"\n\t| \"PROJECTION_RECEIPT_VIOLATION\"\n\t| \"REENTRANT_DOMAIN_STATE_MACHINE_EVALUATION\"\n\t| \"REENTRANT_EVENT_RECORDING\"\n\t| \"REPOSITORY_ERROR_MAPPING_FAILED\"\n\t| \"ROLLBACK_FAILED\"\n\t| \"SNAPSHOT_CORRUPTED\"\n\t| \"SNAPSHOT_SCHEMA_MISMATCH\"\n\t| \"SNAPSHOT_TIME_INVALID\"\n\t| \"TRANSACTION_CLOSED\"\n\t| \"UNENROLLED_CHANGES\"\n\t| \"UNKNOWN_CURRENCY\"\n\t| \"UNMINTED_EVENT\"\n\t| \"UNPROJECTABLE_EVENT\"\n\t| \"UNREGISTERED_HANDLER\"\n\t| \"UNREPLAYABLE_AGGREGATE\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,IAAsB,cAAtB,cAEU,gBAAiC;CAC1C,AAAU,YAAY,SAAiC;EACtD,MAAM;GACL,MAAM,QAAQ;GACd,UAAU;GACV,WAAW,QAAQ,aAAa;GAChC,SAAS,QAAQ;GACjB,OAAO,QAAQ;EAChB,CAAC;CACF;AACD;;;;;;;;;AAUA,IAAsB,iBAAtB,cAEU,gBAAiC;CAC1C,AAAU,YAAY,MAAa,SAAiB,OAAiB;EACpE,MAAM;GAAE;GAAM,UAAU;GAAU,WAAW;GAAO;GAAS;EAAM,CAAC;CACrE;AACD;;;;;;;;;;;;;;;;;AAkBA,IAAsB,sBAAtB,cAEU,gBAAyC;CAClD,AAAU,YAAY,SAAiC;EACtD,MAAM;GACL,MAAM,QAAQ;GACd,UAAU;GACV,WAAW,QAAQ,aAAa;GAChC,SAAS,QAAQ;GACjB,OAAO,QAAQ;EAChB,CAAC;CACF;AACD;;;;;;;;;AAUA,SAAgB,kBAAkB,OAAsC;CACvE,OACC,iBAAiB,eAChB,iBAAiB,SAChB,MAA0C,aAAa;AAE3D;;;;;AAMA,SAAgB,0BACf,OAC+B;CAC/B,OACC,iBAAiB,uBAChB,iBAAiB,SAChB,MAA0C,aAAa;AAE3D;;;;;;;AAsBA,IAAa,gCA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