@classytic/cart 0.1.0 → 0.1.2

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.
Files changed (45) hide show
  1. package/README.md +1 -10
  2. package/dist/{cart-event-catalog-BIbi2Q_n.d.mts → cart-event-catalog-BxDJhtTM.d.mts} +1 -1
  3. package/dist/cart.error-BwWy4RlY.mjs +27 -0
  4. package/dist/{create-cart-q3CXxPP7.mjs → create-cart-B4l61iKT.mjs} +589 -543
  5. package/dist/domain/errors/index.d.mts +1 -1
  6. package/dist/domain/errors/index.mjs +5 -3
  7. package/dist/domain/events/index.d.mts +2 -2
  8. package/dist/domain/events/index.mjs +2 -2
  9. package/dist/domain/index.d.mts +11 -11
  10. package/dist/domain/index.mjs +11 -10
  11. package/dist/domain/ports/index.d.mts +2 -2
  12. package/dist/domain/ports/index.mjs +1 -1
  13. package/dist/domain/saga/index.d.mts +2 -2
  14. package/dist/domain/saga/index.mjs +2 -3
  15. package/dist/engine/index.d.mts +1 -1
  16. package/dist/engine/index.mjs +1 -1
  17. package/dist/{errors-CHR9RlbY.mjs → errors-DzR7Pipp.mjs} +27 -27
  18. package/dist/{index-Doi5uzux.d.mts → index-BFBUk6qT.d.mts} +68 -68
  19. package/dist/index.d.mts +73 -58
  20. package/dist/index.mjs +50 -49
  21. package/dist/{internal-event-bus-IkUfQJxn.d.mts → internal-event-bus-DKcDteh-.d.mts} +109 -84
  22. package/dist/{line-item.entity-B3M_i-pw.d.mts → kind-registry-C1n47C7h.d.mts} +52 -52
  23. package/dist/{kind-registry-Ba4PO4WC.mjs → kind-registry-C99h_-8t.mjs} +1 -1
  24. package/dist/{kind.error-CCjTB6kW.mjs → kind.error-DIaJpdUb.mjs} +2 -27
  25. package/dist/kinds/index.d.mts +1 -1
  26. package/dist/kinds/index.mjs +1 -1
  27. package/dist/{line-kind-Bndo6IS8.d.mts → line-kind-Ck3fVXzG.d.mts} +1 -1
  28. package/dist/{cart-event-catalog-BOP9aDhL.mjs → outbox-store-CWW8ppxS.mjs} +31 -31
  29. package/dist/{not-found.error-B6WYnAjX.mjs → price-changed.error-C-wGVcfc.mjs} +23 -47
  30. package/dist/{idempotency-record.entity-DIFXjN1V.d.mts → reservation.entity-b5cZ1ojx.d.mts} +72 -72
  31. package/dist/{shipping.bridge-DD4A_O0O.d.mts → shipping.bridge-CmQFTgSE.d.mts} +82 -82
  32. package/dist/state-transition.error-2fRLh3p0.mjs +26 -0
  33. package/dist/{saga-step-fn-Cyob38iU.d.mts → state-transitions-X_Eix5Iw.d.mts} +31 -30
  34. package/dist/state-transitions-e4z3Yhxb.mjs +61 -0
  35. package/dist/{bundle.kind-BdgnyKZt.d.mts → variant.kind-9P1DXdXu.d.mts} +51 -51
  36. package/dist/{bundle.kind-DFydSxV_.mjs → variant.kind-DfEh2oku.mjs} +133 -133
  37. package/package.json +14 -7
  38. package/dist/saga-steps-B27LI7xp.mjs +0 -27
  39. package/dist/state-transitions-CpJpZZTK.mjs +0 -21
  40. /package/dist/{cart-status.vo-2iisZGhb.d.mts → cart-status.vo-CNJw4aaB.d.mts} +0 -0
  41. /package/dist/{domain-event-DHNkz15G.mjs → domain-event-CIEORKF6.mjs} +0 -0
  42. /package/dist/{id.port-C3rlDAKP.mjs → id.port-BhbFZJPm.mjs} +0 -0
  43. /package/dist/{id.port-DPXLrqb2.d.mts → id.port-C7ygWLRU.d.mts} +0 -0
  44. /package/dist/{index-DEHBdV_z.d.mts → index-2Ag-54t8.d.mts} +0 -0
  45. /package/dist/{outbox-store-CTWz9pvG.d.mts → outbox-store-CBt9fSYh.d.mts} +0 -0
@@ -1,2 +1,2 @@
1
- import { a as IdempotencyBusyError, c as SagaFailurePhase, d as ReservationError, f as ConcurrencyError, i as UnknownKindError, l as PriceChangedError, m as CartErrorCategory, n as StateTransitionError, o as IdempotencyStorageError, p as CartError, r as KindError, s as SagaError, t as NotFoundError, u as StaleQuoteError } from "../../index-Doi5uzux.mjs";
1
+ import { a as SagaError, c as PriceChangedError, d as UnknownKindError, f as ConcurrencyError, i as IdempotencyStorageError, l as NotFoundError, m as CartErrorCategory, n as StaleQuoteError, o as SagaFailurePhase, p as CartError, r as IdempotencyBusyError, s as ReservationError, t as StateTransitionError, u as KindError } from "../../index-BFBUk6qT.mjs";
2
2
  export { CartError, CartErrorCategory, ConcurrencyError, IdempotencyBusyError, IdempotencyStorageError, KindError, NotFoundError, PriceChangedError, ReservationError, SagaError, SagaFailurePhase, StaleQuoteError, StateTransitionError, UnknownKindError };
@@ -1,4 +1,6 @@
1
- import { n as UnknownKindError, r as CartError, t as KindError } from "../../kind.error-CCjTB6kW.mjs";
2
- import { i as ConcurrencyError, n as StateTransitionError, r as PriceChangedError, t as NotFoundError } from "../../not-found.error-B6WYnAjX.mjs";
3
- import { a as ReservationError, i as StaleQuoteError, n as IdempotencyStorageError, r as SagaError, t as IdempotencyBusyError } from "../../errors-CHR9RlbY.mjs";
1
+ import { t as CartError } from "../../cart.error-BwWy4RlY.mjs";
2
+ import { n as NotFoundError, r as ConcurrencyError, t as PriceChangedError } from "../../price-changed.error-C-wGVcfc.mjs";
3
+ import { n as UnknownKindError, t as KindError } from "../../kind.error-DIaJpdUb.mjs";
4
+ import { a as ReservationError, i as SagaError, n as IdempotencyBusyError, r as IdempotencyStorageError, t as StaleQuoteError } from "../../errors-DzR7Pipp.mjs";
5
+ import { t as StateTransitionError } from "../../state-transition.error-2fRLh3p0.mjs";
4
6
  export { CartError, ConcurrencyError, IdempotencyBusyError, IdempotencyStorageError, KindError, NotFoundError, PriceChangedError, ReservationError, SagaError, StaleQuoteError, StateTransitionError, UnknownKindError };
@@ -1,3 +1,3 @@
1
- import { S as CartEvents, _ as CartEventMeta, a as OutboxErrorInfo, b as CartEventName, c as OutboxFailureDecision, d as OutboxStore, f as OutboxStoreWriteOptions, g as CartEventAggregate, h as CartDomainEvent, i as OutboxClaimOptions, l as OutboxFailurePolicy, m as CartAggregateType, n as MemoryOutboxStore, o as OutboxFailOptions, p as OutboxWriteOptions, r as OutboxAcknowledgeOptions, s as OutboxFailureContext, t as InvalidOutboxEventError, u as OutboxOwnershipError, v as createCartEvent, x as CartEventPayload, y as CartEventMap } from "../../outbox-store-CTWz9pvG.mjs";
2
- import { a as CartEventRegistry, c as defineCartEvent, d as EventValidationResult, f as EventValidator, i as CartEventDefinitionInput, l as EventSchema, n as cartEventsByName, o as PayloadOf, r as CartEventDefinition, s as createCartEventRegistry, t as cartEventDefinitions, u as EventSchemaProperty } from "../../cart-event-catalog-BIbi2Q_n.mjs";
1
+ import { S as CartEvents, _ as CartEventMeta, a as OutboxErrorInfo, b as CartEventName, c as OutboxFailureDecision, d as OutboxStore, f as OutboxStoreWriteOptions, g as CartEventAggregate, h as CartDomainEvent, i as OutboxClaimOptions, l as OutboxFailurePolicy, m as CartAggregateType, n as MemoryOutboxStore, o as OutboxFailOptions, p as OutboxWriteOptions, r as OutboxAcknowledgeOptions, s as OutboxFailureContext, t as InvalidOutboxEventError, u as OutboxOwnershipError, v as createCartEvent, x as CartEventPayload, y as CartEventMap } from "../../outbox-store-CBt9fSYh.mjs";
2
+ import { a as CartEventRegistry, c as defineCartEvent, d as EventValidationResult, f as EventValidator, i as CartEventDefinitionInput, l as EventSchema, n as cartEventsByName, o as PayloadOf, r as CartEventDefinition, s as createCartEventRegistry, t as cartEventDefinitions, u as EventSchemaProperty } from "../../cart-event-catalog-BxDJhtTM.mjs";
3
3
  export { type CartAggregateType, type CartDomainEvent, type CartEventAggregate, type CartEventDefinition, type CartEventDefinitionInput, type CartEventMap, type CartEventMeta, type CartEventName, type CartEventPayload, type CartEventRegistry, CartEvents, type EventSchema, type EventSchemaProperty, type EventValidationResult, type EventValidator, InvalidOutboxEventError, MemoryOutboxStore, type OutboxAcknowledgeOptions, type OutboxClaimOptions, type OutboxErrorInfo, type OutboxFailOptions, type OutboxFailureContext, type OutboxFailureDecision, type OutboxFailurePolicy, OutboxOwnershipError, type OutboxStore, type OutboxStoreWriteOptions, type OutboxWriteOptions, type PayloadOf, cartEventDefinitions, cartEventsByName, createCartEvent, createCartEventRegistry, defineCartEvent };
@@ -1,3 +1,3 @@
1
- import { n as CartEvents, t as createCartEvent } from "../../domain-event-DHNkz15G.mjs";
2
- import { a as OutboxOwnershipError, i as MemoryOutboxStore, n as cartEventsByName, o as createCartEventRegistry, r as InvalidOutboxEventError, s as defineCartEvent, t as cartEventDefinitions } from "../../cart-event-catalog-BOP9aDhL.mjs";
1
+ import { n as CartEvents, t as createCartEvent } from "../../domain-event-CIEORKF6.mjs";
2
+ import { a as cartEventsByName, i as cartEventDefinitions, n as MemoryOutboxStore, o as createCartEventRegistry, r as OutboxOwnershipError, s as defineCartEvent, t as InvalidOutboxEventError } from "../../outbox-store-CWW8ppxS.mjs";
3
3
  export { CartEvents, InvalidOutboxEventError, MemoryOutboxStore, OutboxOwnershipError, cartEventDefinitions, cartEventsByName, createCartEvent, createCartEventRegistry, defineCartEvent };
@@ -1,12 +1,12 @@
1
- import { a as IdempotencyBusyError, c as SagaFailurePhase, d as ReservationError, f as ConcurrencyError, i as UnknownKindError, l as PriceChangedError, m as CartErrorCategory, n as StateTransitionError, o as IdempotencyStorageError, p as CartError, r as KindError, s as SagaError, t as NotFoundError, u as StaleQuoteError } from "../index-Doi5uzux.mjs";
2
- import { n as DraftStatus, r as ReservationStatus, t as CheckoutState } from "../cart-status.vo-2iisZGhb.mjs";
3
- import { S as CartEvents, _ as CartEventMeta, a as OutboxErrorInfo, b as CartEventName, c as OutboxFailureDecision, d as OutboxStore, f as OutboxStoreWriteOptions, g as CartEventAggregate, h as CartDomainEvent, i as OutboxClaimOptions, l as OutboxFailurePolicy, m as CartAggregateType, n as MemoryOutboxStore, o as OutboxFailOptions, p as OutboxWriteOptions, r as OutboxAcknowledgeOptions, s as OutboxFailureContext, t as InvalidOutboxEventError, u as OutboxOwnershipError, v as createCartEvent, x as CartEventPayload, y as CartEventMap } from "../outbox-store-CTWz9pvG.mjs";
4
- import { a as CartEventRegistry, c as defineCartEvent, d as EventValidationResult, f as EventValidator, i as CartEventDefinitionInput, l as EventSchema, n as cartEventsByName, o as PayloadOf, r as CartEventDefinition, s as createCartEventRegistry, t as cartEventDefinitions, u as EventSchemaProperty } from "../cart-event-catalog-BIbi2Q_n.mjs";
5
- import { a as IdempotencyIdentity, c as TotalsSnapshot, i as CART_REF_NEW, n as KindRegistry, o as IdempotencyReplay, r as createKindRegistry, s as OperationName, t as LineItem } from "../line-item.entity-B3M_i-pw.mjs";
6
- import { C as PricingSnapshot, S as PricedLine, _ as ProductSummary, a as TaxBreakdown, b as BridgeStatus, c as TaxCalculationResult, d as PromotionResult, f as PromotionsBridge, g as CatalogBridge, h as ReservationRequest, i as ShippingQuoteRequest, l as AdjustmentSpec, m as ReservationRef, n as ShippingMethod, o as TaxBridge, p as InventoryBridge, r as ShippingQuote, s as TaxCalculationRequest, t as ShippingBridge, u as CartSnapshot, x as OperationContext, y as BridgeRef } from "../shipping.bridge-DD4A_O0O.mjs";
7
- import { a as RevalidationResult, c as ValidityPolicy, i as LineLike, l as LineDisplay, n as KindContext, o as StaleBehavior, r as LineKind, s as StaleTrigger, t as KindBridges } from "../line-kind-Bndo6IS8.mjs";
8
- import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../id.port-DPXLrqb2.mjs";
9
- import { a as CheckoutFlowState, c as CheckoutStepNumber, i as isLegalCheckoutTransition, l as SagaStep, n as SagaStepFn, o as SagaState, r as CHECKOUT_STATE_TRANSITIONS, s as CheckoutStep, t as SagaDependencies, u as SagaStepNumber } from "../saga-step-fn-Cyob38iU.mjs";
10
- import { a as Adjustment, i as Draft, n as Reservation, r as Checkout, t as IdempotencyRecord } from "../idempotency-record.entity-DIFXjN1V.mjs";
1
+ import { a as SagaError, c as PriceChangedError, d as UnknownKindError, f as ConcurrencyError, i as IdempotencyStorageError, l as NotFoundError, m as CartErrorCategory, n as StaleQuoteError, o as SagaFailurePhase, p as CartError, r as IdempotencyBusyError, s as ReservationError, t as StateTransitionError, u as KindError } from "../index-BFBUk6qT.mjs";
2
+ import { n as DraftStatus, r as ReservationStatus, t as CheckoutState } from "../cart-status.vo-CNJw4aaB.mjs";
3
+ import { S as CartEvents, _ as CartEventMeta, a as OutboxErrorInfo, b as CartEventName, c as OutboxFailureDecision, d as OutboxStore, f as OutboxStoreWriteOptions, g as CartEventAggregate, h as CartDomainEvent, i as OutboxClaimOptions, l as OutboxFailurePolicy, m as CartAggregateType, n as MemoryOutboxStore, o as OutboxFailOptions, p as OutboxWriteOptions, r as OutboxAcknowledgeOptions, s as OutboxFailureContext, t as InvalidOutboxEventError, u as OutboxOwnershipError, v as createCartEvent, x as CartEventPayload, y as CartEventMap } from "../outbox-store-CBt9fSYh.mjs";
4
+ import { a as CartEventRegistry, c as defineCartEvent, d as EventValidationResult, f as EventValidator, i as CartEventDefinitionInput, l as EventSchema, n as cartEventsByName, o as PayloadOf, r as CartEventDefinition, s as createCartEventRegistry, t as cartEventDefinitions, u as EventSchemaProperty } from "../cart-event-catalog-BxDJhtTM.mjs";
5
+ import { C as PricingSnapshot, S as PricedLine, _ as PromotionsBridge, a as TaxBreakdown, b as BridgeStatus, c as TaxCalculationResult, d as ReservationRequest, f as CatalogBridge, g as PromotionResult, h as CartSnapshot, i as ShippingQuoteRequest, l as InventoryBridge, m as AdjustmentSpec, n as ShippingMethod, o as TaxBridge, p as ProductSummary, r as ShippingQuote, s as TaxCalculationRequest, t as ShippingBridge, u as ReservationRef, x as OperationContext, y as BridgeRef } from "../shipping.bridge-CmQFTgSE.mjs";
6
+ import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "../reservation.entity-b5cZ1ojx.mjs";
7
+ import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep, t as CHECKOUT_MACHINE } from "../state-transitions-X_Eix5Iw.mjs";
8
+ import { a as RevalidationResult, c as ValidityPolicy, i as LineLike, l as LineDisplay, n as KindContext, o as StaleBehavior, r as LineKind, s as StaleTrigger, t as KindBridges } from "../line-kind-Ck3fVXzG.mjs";
9
+ import { a as IdempotencyReplay, c as LineItem, i as IdempotencyIdentity, n as createKindRegistry, o as OperationName, r as CART_REF_NEW, s as TotalsSnapshot, t as KindRegistry } from "../kind-registry-C1n47C7h.mjs";
10
+ import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../id.port-C7ygWLRU.mjs";
11
11
  import { Money, addMoney, fromMajor, money, multiplyMoney, subtractMoney, sumMoney, toMajor } from "@classytic/primitives/money";
12
- export { type Adjustment, AdjustmentSpec, BridgeRef, BridgeStatus, CART_REF_NEW, CHECKOUT_STATE_TRANSITIONS, CartAggregateType, CartDomainEvent, CartError, CartErrorCategory, CartEventAggregate, CartEventDefinition, CartEventDefinitionInput, CartEventMap, CartEventMeta, CartEventName, CartEventPayload, CartEventRegistry, CartEvents, CartSnapshot, CatalogBridge, type Checkout, CheckoutFlowState, type CheckoutState, CheckoutStep, CheckoutStepNumber, ClockPort, ConcurrencyError, type Draft, type DraftStatus, EventSchema, EventSchemaProperty, EventValidationResult, EventValidator, IdPort, IdempotencyBusyError, type IdempotencyIdentity, type IdempotencyRecord, type IdempotencyReplay, IdempotencyStorageError, InvalidOutboxEventError, InventoryBridge, type KindBridges, type KindContext, KindError, type KindRegistry, type LineDisplay, type LineItem, type LineKind, type LineLike, MemoryOutboxStore, type Money, NotFoundError, OperationContext, type OperationName, OutboxAcknowledgeOptions, OutboxClaimOptions, OutboxErrorInfo, OutboxFailOptions, OutboxFailureContext, OutboxFailureDecision, OutboxFailurePolicy, OutboxOwnershipError, OutboxStore, OutboxStoreWriteOptions, OutboxWriteOptions, PayloadOf, PriceChangedError, type PricedLine, type PricingSnapshot, ProductSummary, PromotionResult, PromotionsBridge, type Reservation, ReservationError, ReservationRef, ReservationRequest, type ReservationStatus, type RevalidationResult, SagaDependencies, SagaError, SagaFailurePhase, SagaState, SagaStep, SagaStepFn, SagaStepNumber, ShippingBridge, ShippingMethod, ShippingQuote, ShippingQuoteRequest, type StaleBehavior, StaleQuoteError, type StaleTrigger, StateTransitionError, TaxBreakdown, TaxBridge, TaxCalculationRequest, TaxCalculationResult, type TotalsSnapshot, UnknownKindError, type ValidityPolicy, addMoney, cartEventDefinitions, cartEventsByName, createCartEvent, createCartEventRegistry, createCounterIdPort, createKindRegistry, cryptoIdPort, defineCartEvent, fromMajor, isLegalCheckoutTransition, money, multiplyMoney, subtractMoney, sumMoney, systemClock, toMajor };
12
+ export { type Adjustment, AdjustmentSpec, BridgeRef, BridgeStatus, CART_REF_NEW, CHECKOUT_MACHINE, CHECKOUT_STATE_TRANSITIONS, CartAggregateType, CartDomainEvent, CartError, CartErrorCategory, CartEventAggregate, CartEventDefinition, CartEventDefinitionInput, CartEventMap, CartEventMeta, CartEventName, CartEventPayload, CartEventRegistry, CartEvents, CartSnapshot, CatalogBridge, type Checkout, CheckoutFlowState, type CheckoutState, CheckoutStep, CheckoutStepNumber, ClockPort, ConcurrencyError, type Draft, type DraftStatus, EventSchema, EventSchemaProperty, EventValidationResult, EventValidator, IdPort, IdempotencyBusyError, type IdempotencyIdentity, type IdempotencyRecord, type IdempotencyReplay, IdempotencyStorageError, InvalidOutboxEventError, InventoryBridge, type KindBridges, type KindContext, KindError, type KindRegistry, type LineDisplay, type LineItem, type LineKind, type LineLike, MemoryOutboxStore, type Money, NotFoundError, OperationContext, type OperationName, OutboxAcknowledgeOptions, OutboxClaimOptions, OutboxErrorInfo, OutboxFailOptions, OutboxFailureContext, OutboxFailureDecision, OutboxFailurePolicy, OutboxOwnershipError, OutboxStore, OutboxStoreWriteOptions, OutboxWriteOptions, PayloadOf, PriceChangedError, type PricedLine, type PricingSnapshot, ProductSummary, PromotionResult, PromotionsBridge, type Reservation, ReservationError, ReservationRef, ReservationRequest, type ReservationStatus, type RevalidationResult, SagaDependencies, SagaError, SagaFailurePhase, SagaStepFn, ShippingBridge, ShippingMethod, ShippingQuote, ShippingQuoteRequest, type StaleBehavior, StaleQuoteError, type StaleTrigger, StateTransitionError, TaxBreakdown, TaxBridge, TaxCalculationRequest, TaxCalculationResult, type TotalsSnapshot, UnknownKindError, type ValidityPolicy, addMoney, cartEventDefinitions, cartEventsByName, createCartEvent, createCartEventRegistry, createCounterIdPort, createKindRegistry, cryptoIdPort, defineCartEvent, fromMajor, isLegalCheckoutTransition, money, multiplyMoney, subtractMoney, sumMoney, systemClock, toMajor };
@@ -1,15 +1,16 @@
1
1
  import { t as CART_REF_NEW } from "../idempotency-key.vo-D0lJsvGn.mjs";
2
- import { n as UnknownKindError, r as CartError, t as KindError } from "../kind.error-CCjTB6kW.mjs";
3
- import { i as ConcurrencyError, n as StateTransitionError, r as PriceChangedError, t as NotFoundError } from "../not-found.error-B6WYnAjX.mjs";
4
- import { a as ReservationError, i as StaleQuoteError, n as IdempotencyStorageError, r as SagaError, t as IdempotencyBusyError } from "../errors-CHR9RlbY.mjs";
5
- import { n as CartEvents, t as createCartEvent } from "../domain-event-DHNkz15G.mjs";
6
- import { a as OutboxOwnershipError, i as MemoryOutboxStore, n as cartEventsByName, o as createCartEventRegistry, r as InvalidOutboxEventError, s as defineCartEvent, t as cartEventDefinitions } from "../cart-event-catalog-BOP9aDhL.mjs";
7
- import { n as cryptoIdPort, r as systemClock, t as createCounterIdPort } from "../id.port-C3rlDAKP.mjs";
8
- import { t as createKindRegistry } from "../kind-registry-Ba4PO4WC.mjs";
9
- import { n as SagaStep, t as CheckoutStep } from "../saga-steps-B27LI7xp.mjs";
10
- import { n as isLegalCheckoutTransition, t as CHECKOUT_STATE_TRANSITIONS } from "../state-transitions-CpJpZZTK.mjs";
2
+ import { t as CartError } from "../cart.error-BwWy4RlY.mjs";
3
+ import { n as NotFoundError, r as ConcurrencyError, t as PriceChangedError } from "../price-changed.error-C-wGVcfc.mjs";
4
+ import { n as UnknownKindError, t as KindError } from "../kind.error-DIaJpdUb.mjs";
5
+ import { a as ReservationError, i as SagaError, n as IdempotencyBusyError, r as IdempotencyStorageError, t as StaleQuoteError } from "../errors-DzR7Pipp.mjs";
6
+ import { t as StateTransitionError } from "../state-transition.error-2fRLh3p0.mjs";
7
+ import { n as CartEvents, t as createCartEvent } from "../domain-event-CIEORKF6.mjs";
8
+ import { a as cartEventsByName, i as cartEventDefinitions, n as MemoryOutboxStore, o as createCartEventRegistry, r as OutboxOwnershipError, s as defineCartEvent, t as InvalidOutboxEventError } from "../outbox-store-CWW8ppxS.mjs";
9
+ import { n as cryptoIdPort, r as systemClock, t as createCounterIdPort } from "../id.port-BhbFZJPm.mjs";
10
+ import { t as createKindRegistry } from "../kind-registry-C99h_-8t.mjs";
11
+ import { i as CheckoutStep, n as CHECKOUT_STATE_TRANSITIONS, r as isLegalCheckoutTransition, t as CHECKOUT_MACHINE } from "../state-transitions-e4z3Yhxb.mjs";
11
12
  import "./events/index.mjs";
12
13
  import "./ports/index.mjs";
13
14
  import "./saga/index.mjs";
14
15
  import { addMoney, fromMajor, money, multiplyMoney, subtractMoney, sumMoney, toMajor } from "@classytic/primitives/money";
15
- export { CART_REF_NEW, CHECKOUT_STATE_TRANSITIONS, CartError, CartEvents, CheckoutStep, ConcurrencyError, IdempotencyBusyError, IdempotencyStorageError, InvalidOutboxEventError, KindError, MemoryOutboxStore, NotFoundError, OutboxOwnershipError, PriceChangedError, ReservationError, SagaError, SagaStep, StaleQuoteError, StateTransitionError, UnknownKindError, addMoney, cartEventDefinitions, cartEventsByName, createCartEvent, createCartEventRegistry, createCounterIdPort, createKindRegistry, cryptoIdPort, defineCartEvent, fromMajor, isLegalCheckoutTransition, money, multiplyMoney, subtractMoney, sumMoney, systemClock, toMajor };
16
+ export { CART_REF_NEW, CHECKOUT_MACHINE, CHECKOUT_STATE_TRANSITIONS, CartError, CartEvents, CheckoutStep, ConcurrencyError, IdempotencyBusyError, IdempotencyStorageError, InvalidOutboxEventError, KindError, MemoryOutboxStore, NotFoundError, OutboxOwnershipError, PriceChangedError, ReservationError, SagaError, StaleQuoteError, StateTransitionError, UnknownKindError, addMoney, cartEventDefinitions, cartEventsByName, createCartEvent, createCartEventRegistry, createCounterIdPort, createKindRegistry, cryptoIdPort, defineCartEvent, fromMajor, isLegalCheckoutTransition, money, multiplyMoney, subtractMoney, sumMoney, systemClock, toMajor };
@@ -1,3 +1,3 @@
1
- import { _ as ProductSummary, a as TaxBreakdown, b as BridgeStatus, c as TaxCalculationResult, d as PromotionResult, f as PromotionsBridge, g as CatalogBridge, h as ReservationRequest, i as ShippingQuoteRequest, l as AdjustmentSpec, m as ReservationRef, n as ShippingMethod, o as TaxBridge, p as InventoryBridge, r as ShippingQuote, s as TaxCalculationRequest, t as ShippingBridge, u as CartSnapshot, x as OperationContext, y as BridgeRef } from "../../shipping.bridge-DD4A_O0O.mjs";
2
- import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../../id.port-DPXLrqb2.mjs";
1
+ import { _ as PromotionsBridge, a as TaxBreakdown, b as BridgeStatus, c as TaxCalculationResult, d as ReservationRequest, f as CatalogBridge, g as PromotionResult, h as CartSnapshot, i as ShippingQuoteRequest, l as InventoryBridge, m as AdjustmentSpec, n as ShippingMethod, o as TaxBridge, p as ProductSummary, r as ShippingQuote, s as TaxCalculationRequest, t as ShippingBridge, u as ReservationRef, x as OperationContext, y as BridgeRef } from "../../shipping.bridge-CmQFTgSE.mjs";
2
+ import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../../id.port-C7ygWLRU.mjs";
3
3
  export { AdjustmentSpec, BridgeRef, BridgeStatus, CartSnapshot, CatalogBridge, ClockPort, IdPort, InventoryBridge, OperationContext, ProductSummary, PromotionResult, PromotionsBridge, ReservationRef, ReservationRequest, ShippingBridge, ShippingMethod, ShippingQuote, ShippingQuoteRequest, TaxBreakdown, TaxBridge, TaxCalculationRequest, TaxCalculationResult, createCounterIdPort, cryptoIdPort, systemClock };
@@ -1,2 +1,2 @@
1
- import { n as cryptoIdPort, r as systemClock, t as createCounterIdPort } from "../../id.port-C3rlDAKP.mjs";
1
+ import { n as cryptoIdPort, r as systemClock, t as createCounterIdPort } from "../../id.port-BhbFZJPm.mjs";
2
2
  export { createCounterIdPort, cryptoIdPort, systemClock };
@@ -1,2 +1,2 @@
1
- import { a as CheckoutFlowState, c as CheckoutStepNumber, i as isLegalCheckoutTransition, l as SagaStep, n as SagaStepFn, o as SagaState, r as CHECKOUT_STATE_TRANSITIONS, s as CheckoutStep, t as SagaDependencies, u as SagaStepNumber } from "../../saga-step-fn-Cyob38iU.mjs";
2
- export { CHECKOUT_STATE_TRANSITIONS, type CheckoutFlowState, CheckoutStep, type CheckoutStepNumber, type SagaDependencies, type SagaState, SagaStep, type SagaStepFn, type SagaStepNumber, isLegalCheckoutTransition };
1
+ import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep, t as CHECKOUT_MACHINE } from "../../state-transitions-X_Eix5Iw.mjs";
2
+ export { CHECKOUT_MACHINE, CHECKOUT_STATE_TRANSITIONS, type CheckoutFlowState, CheckoutStep, type CheckoutStepNumber, type SagaDependencies, type SagaStepFn, isLegalCheckoutTransition };
@@ -1,3 +1,2 @@
1
- import { n as SagaStep, t as CheckoutStep } from "../../saga-steps-B27LI7xp.mjs";
2
- import { n as isLegalCheckoutTransition, t as CHECKOUT_STATE_TRANSITIONS } from "../../state-transitions-CpJpZZTK.mjs";
3
- export { CHECKOUT_STATE_TRANSITIONS, CheckoutStep, SagaStep, isLegalCheckoutTransition };
1
+ import { i as CheckoutStep, n as CHECKOUT_STATE_TRANSITIONS, r as isLegalCheckoutTransition, t as CHECKOUT_MACHINE } from "../../state-transitions-e4z3Yhxb.mjs";
2
+ export { CHECKOUT_MACHINE, CHECKOUT_STATE_TRANSITIONS, CheckoutStep, isLegalCheckoutTransition };
@@ -1,3 +1,3 @@
1
1
  import { CartConfigShape, cartConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./cart-config.schema.mjs";
2
- import { a as CartEngine, i as CartConfig, n as createCart, r as CartBridges, t as InProcessCartEventBus } from "../internal-event-bus-IkUfQJxn.mjs";
2
+ import { a as CartEngine, i as CartConfig, n as createCart, r as CartBridges, t as InProcessCartEventBus } from "../internal-event-bus-DKcDteh-.mjs";
3
3
  export { type CartBridges, type CartConfig, type CartConfigShape, type CartEngine, InProcessCartEventBus, cartConfigSchema, createCart, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema };
@@ -1,3 +1,3 @@
1
- import { n as InProcessCartEventBus, t as createCart } from "../create-cart-q3CXxPP7.mjs";
1
+ import { n as InProcessCartEventBus, t as createCart } from "../create-cart-B4l61iKT.mjs";
2
2
  import { cartConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./cart-config.schema.mjs";
3
3
  export { InProcessCartEventBus, cartConfigSchema, createCart, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema };
@@ -1,4 +1,4 @@
1
- import { r as CartError } from "./kind.error-CCjTB6kW.mjs";
1
+ import { t as CartError } from "./cart.error-BwWy4RlY.mjs";
2
2
  //#region src/domain/errors/reservation.error.ts
3
3
  /**
4
4
  * Inventory / slot reservation could not be secured. Thrown from the saga's
@@ -21,31 +21,6 @@ var ReservationError = class extends CartError {
21
21
  }
22
22
  };
23
23
  //#endregion
24
- //#region src/domain/errors/stale-quote.error.ts
25
- /**
26
- * A priced line's validity window has elapsed and its LineKind's revalidate()
27
- * returned `invalid`. Fired from the saga's step 2 (revalidation).
28
- *
29
- * Example: a bid line whose underlying auction moved to a new highest bid
30
- * while the user was reviewing the cart.
31
- *
32
- * Clients should re-read the cart, show the updated state, and confirm again.
33
- * Retryable with a new idempotency key.
34
- */
35
- var StaleQuoteError = class extends CartError {
36
- code = "cart/stale_quote";
37
- category = "validation";
38
- retryable = true;
39
- constructor(lineId, kind, reason, details) {
40
- super(`Line ${lineId} (${kind}) is no longer valid: ${reason}`, {
41
- lineId,
42
- kind,
43
- reason,
44
- ...details
45
- });
46
- }
47
- };
48
- //#endregion
49
24
  //#region src/domain/errors/saga.error.ts
50
25
  var SagaError = class extends CartError {
51
26
  code = "cart/saga_failure";
@@ -94,4 +69,29 @@ var IdempotencyStorageError = class extends CartError {
94
69
  }
95
70
  };
96
71
  //#endregion
97
- export { ReservationError as a, StaleQuoteError as i, IdempotencyStorageError as n, SagaError as r, IdempotencyBusyError as t };
72
+ //#region src/domain/errors/stale-quote.error.ts
73
+ /**
74
+ * A priced line's validity window has elapsed and its LineKind's revalidate()
75
+ * returned `invalid`. Fired from the saga's step 2 (revalidation).
76
+ *
77
+ * Example: a bid line whose underlying auction moved to a new highest bid
78
+ * while the user was reviewing the cart.
79
+ *
80
+ * Clients should re-read the cart, show the updated state, and confirm again.
81
+ * Retryable with a new idempotency key.
82
+ */
83
+ var StaleQuoteError = class extends CartError {
84
+ code = "cart/stale_quote";
85
+ category = "validation";
86
+ retryable = true;
87
+ constructor(lineId, kind, reason, details) {
88
+ super(`Line ${lineId} (${kind}) is no longer valid: ${reason}`, {
89
+ lineId,
90
+ kind,
91
+ reason,
92
+ ...details
93
+ });
94
+ }
95
+ };
96
+ //#endregion
97
+ export { ReservationError as a, SagaError as i, IdempotencyBusyError as n, IdempotencyStorageError as r, StaleQuoteError as t };
@@ -1,4 +1,4 @@
1
- import { t as CheckoutState } from "./cart-status.vo-2iisZGhb.mjs";
1
+ import { t as CheckoutState } from "./cart-status.vo-CNJw4aaB.mjs";
2
2
 
3
3
  //#region src/domain/errors/cart.error.d.ts
4
4
  /**
@@ -53,42 +53,52 @@ declare class ConcurrencyError extends CartError {
53
53
  constructor(resource: 'draft' | 'checkout' | 'reservation', expectedVersion: number, resourceId: string);
54
54
  }
55
55
  //#endregion
56
- //#region src/domain/errors/reservation.error.d.ts
56
+ //#region src/domain/errors/kind.error.d.ts
57
57
  /**
58
- * Inventory / slot reservation could not be secured. Thrown from the saga's
59
- * step 5 (InventoryBridge.reserve) and from compensating `release` when the
60
- * bridge reports the reservation no longer exists.
58
+ * A LineKind rejected a line during validate() or price().
61
59
  *
62
- * Category is `external` because the decision is owned by the inventory
63
- * system, not cart.
60
+ * Used for both:
61
+ * - User-facing validation failures ("quantity exceeds max per line")
62
+ * - Configuration failures ("kind 'timeslot' is not registered")
63
+ *
64
+ * `retryable: false` by default because changing the input will require a
65
+ * new idempotency key anyway.
64
66
  */
65
- declare class ReservationError extends CartError {
66
- readonly code = "cart/reservation_failed";
67
+ declare class KindError extends CartError {
68
+ readonly code: string;
67
69
  readonly category: CartErrorCategory;
68
- readonly retryable: boolean;
69
- constructor(message: string, opts: {
70
- retryable: boolean;
71
- bridgeError?: unknown;
72
- lineIds?: string[];
70
+ readonly retryable = false;
71
+ constructor(kind: string, reason: string, opts?: {
72
+ code?: string;
73
+ details?: Record<string, unknown>;
73
74
  });
74
75
  }
76
+ /**
77
+ * A kind referenced by a line is not registered in the engine's kind
78
+ * registry. This is a configuration bug — the host forgot to register the
79
+ * kind or registered it under a different name. Always fatal, never
80
+ * retryable.
81
+ */
82
+ declare class UnknownKindError extends CartError {
83
+ readonly code = "cart/unknown_kind";
84
+ readonly category: CartErrorCategory;
85
+ readonly retryable = false;
86
+ constructor(kind: string, registered: string[]);
87
+ }
75
88
  //#endregion
76
- //#region src/domain/errors/stale-quote.error.d.ts
89
+ //#region src/domain/errors/not-found.error.d.ts
77
90
  /**
78
- * A priced line's validity window has elapsed and its LineKind's revalidate()
79
- * returned `invalid`. Fired from the saga's step 2 (revalidation).
80
- *
81
- * Example: a bid line whose underlying auction moved to a new highest bid
82
- * while the user was reviewing the cart.
91
+ * The requested draft, checkout, or reservation does not exist (or is not
92
+ * visible under the caller's organizationId scope).
83
93
  *
84
- * Clients should re-read the cart, show the updated state, and confirm again.
85
- * Retryable with a new idempotency key.
94
+ * Retryable is false — the resource simply does not exist. If the host
95
+ * thinks it should, the bug is upstream.
86
96
  */
87
- declare class StaleQuoteError extends CartError {
88
- readonly code = "cart/stale_quote";
97
+ declare class NotFoundError extends CartError {
98
+ readonly code = "cart/not_found";
89
99
  readonly category: CartErrorCategory;
90
- readonly retryable = true;
91
- constructor(lineId: string, kind: string, reason: string, details?: Record<string, unknown>);
100
+ readonly retryable = false;
101
+ constructor(resource: 'draft' | 'checkout' | 'reservation' | 'line', ref: string, organizationId?: string);
92
102
  }
93
103
  //#endregion
94
104
  //#region src/domain/errors/price-changed.error.d.ts
@@ -111,6 +121,26 @@ declare class PriceChangedError extends CartError {
111
121
  constructor(expectedHash: string, actualHash: string, context?: Record<string, unknown>);
112
122
  }
113
123
  //#endregion
124
+ //#region src/domain/errors/reservation.error.d.ts
125
+ /**
126
+ * Inventory / slot reservation could not be secured. Thrown from the saga's
127
+ * step 5 (InventoryBridge.reserve) and from compensating `release` when the
128
+ * bridge reports the reservation no longer exists.
129
+ *
130
+ * Category is `external` because the decision is owned by the inventory
131
+ * system, not cart.
132
+ */
133
+ declare class ReservationError extends CartError {
134
+ readonly code = "cart/reservation_failed";
135
+ readonly category: CartErrorCategory;
136
+ readonly retryable: boolean;
137
+ constructor(message: string, opts: {
138
+ retryable: boolean;
139
+ bridgeError?: unknown;
140
+ lineIds?: string[];
141
+ });
142
+ }
143
+ //#endregion
114
144
  //#region src/domain/errors/saga.error.d.ts
115
145
  /**
116
146
  * Structured failure in the finalization saga.
@@ -162,37 +192,22 @@ declare class IdempotencyStorageError extends CartError {
162
192
  constructor(message: string, context: Record<string, unknown>);
163
193
  }
164
194
  //#endregion
165
- //#region src/domain/errors/kind.error.d.ts
195
+ //#region src/domain/errors/stale-quote.error.d.ts
166
196
  /**
167
- * A LineKind rejected a line during validate() or price().
197
+ * A priced line's validity window has elapsed and its LineKind's revalidate()
198
+ * returned `invalid`. Fired from the saga's step 2 (revalidation).
168
199
  *
169
- * Used for both:
170
- * - User-facing validation failures ("quantity exceeds max per line")
171
- * - Configuration failures ("kind 'timeslot' is not registered")
200
+ * Example: a bid line whose underlying auction moved to a new highest bid
201
+ * while the user was reviewing the cart.
172
202
  *
173
- * `retryable: false` by default because changing the input will require a
174
- * new idempotency key anyway.
175
- */
176
- declare class KindError extends CartError {
177
- readonly code: string;
178
- readonly category: CartErrorCategory;
179
- readonly retryable = false;
180
- constructor(kind: string, reason: string, opts?: {
181
- code?: string;
182
- details?: Record<string, unknown>;
183
- });
184
- }
185
- /**
186
- * A kind referenced by a line is not registered in the engine's kind
187
- * registry. This is a configuration bug — the host forgot to register the
188
- * kind or registered it under a different name. Always fatal, never
189
- * retryable.
203
+ * Clients should re-read the cart, show the updated state, and confirm again.
204
+ * Retryable with a new idempotency key.
190
205
  */
191
- declare class UnknownKindError extends CartError {
192
- readonly code = "cart/unknown_kind";
206
+ declare class StaleQuoteError extends CartError {
207
+ readonly code = "cart/stale_quote";
193
208
  readonly category: CartErrorCategory;
194
- readonly retryable = false;
195
- constructor(kind: string, registered: string[]);
209
+ readonly retryable = true;
210
+ constructor(lineId: string, kind: string, reason: string, details?: Record<string, unknown>);
196
211
  }
197
212
  //#endregion
198
213
  //#region src/domain/errors/state-transition.error.d.ts
@@ -213,19 +228,4 @@ declare class StateTransitionError extends CartError {
213
228
  constructor(checkoutId: string, from: CheckoutState, to: CheckoutState);
214
229
  }
215
230
  //#endregion
216
- //#region src/domain/errors/not-found.error.d.ts
217
- /**
218
- * The requested draft, checkout, or reservation does not exist (or is not
219
- * visible under the caller's organizationId scope).
220
- *
221
- * Retryable is false — the resource simply does not exist. If the host
222
- * thinks it should, the bug is upstream.
223
- */
224
- declare class NotFoundError extends CartError {
225
- readonly code = "cart/not_found";
226
- readonly category: CartErrorCategory;
227
- readonly retryable = false;
228
- constructor(resource: 'draft' | 'checkout' | 'reservation' | 'line', ref: string, organizationId?: string);
229
- }
230
- //#endregion
231
- export { IdempotencyBusyError as a, SagaFailurePhase as c, ReservationError as d, ConcurrencyError as f, UnknownKindError as i, PriceChangedError as l, CartErrorCategory as m, StateTransitionError as n, IdempotencyStorageError as o, CartError as p, KindError as r, SagaError as s, NotFoundError as t, StaleQuoteError as u };
231
+ export { SagaError as a, PriceChangedError as c, UnknownKindError as d, ConcurrencyError as f, IdempotencyStorageError as i, NotFoundError as l, CartErrorCategory as m, StaleQuoteError as n, SagaFailurePhase as o, CartError as p, IdempotencyBusyError as r, ReservationError as s, StateTransitionError as t, KindError as u };
package/dist/index.d.mts CHANGED
@@ -1,19 +1,69 @@
1
- import { a as IdempotencyBusyError, c as SagaFailurePhase, d as ReservationError, f as ConcurrencyError, i as UnknownKindError, l as PriceChangedError, m as CartErrorCategory, n as StateTransitionError, o as IdempotencyStorageError, p as CartError, r as KindError, s as SagaError, t as NotFoundError, u as StaleQuoteError } from "./index-Doi5uzux.mjs";
2
- import { n as DraftStatus, r as ReservationStatus, t as CheckoutState } from "./cart-status.vo-2iisZGhb.mjs";
3
- import { S as CartEvents, _ as CartEventMeta, a as OutboxErrorInfo, b as CartEventName, c as OutboxFailureDecision, d as OutboxStore, f as OutboxStoreWriteOptions, g as CartEventAggregate, h as CartDomainEvent, i as OutboxClaimOptions, l as OutboxFailurePolicy, m as CartAggregateType, n as MemoryOutboxStore, o as OutboxFailOptions, p as OutboxWriteOptions, r as OutboxAcknowledgeOptions, s as OutboxFailureContext, t as InvalidOutboxEventError, u as OutboxOwnershipError, v as createCartEvent, x as CartEventPayload, y as CartEventMap } from "./outbox-store-CTWz9pvG.mjs";
4
- import { a as CartEventRegistry, c as defineCartEvent, d as EventValidationResult, f as EventValidator, i as CartEventDefinitionInput, l as EventSchema, n as cartEventsByName, o as PayloadOf, r as CartEventDefinition, s as createCartEventRegistry, t as cartEventDefinitions, u as EventSchemaProperty } from "./cart-event-catalog-BIbi2Q_n.mjs";
5
- import { a as IdempotencyIdentity, c as TotalsSnapshot, i as CART_REF_NEW, n as KindRegistry, o as IdempotencyReplay, r as createKindRegistry, s as OperationName, t as LineItem } from "./line-item.entity-B3M_i-pw.mjs";
6
- import { C as PricingSnapshot, S as PricedLine, _ as ProductSummary, a as TaxBreakdown, b as BridgeStatus, c as TaxCalculationResult, d as PromotionResult, f as PromotionsBridge, g as CatalogBridge, h as ReservationRequest, i as ShippingQuoteRequest, l as AdjustmentSpec, m as ReservationRef, n as ShippingMethod, o as TaxBridge, p as InventoryBridge, r as ShippingQuote, s as TaxCalculationRequest, t as ShippingBridge, u as CartSnapshot, v as Address, x as OperationContext, y as BridgeRef } from "./shipping.bridge-DD4A_O0O.mjs";
7
- import { a as RevalidationResult, c as ValidityPolicy, i as LineLike, l as LineDisplay, n as KindContext, o as StaleBehavior, r as LineKind, s as StaleTrigger, t as KindBridges } from "./line-kind-Bndo6IS8.mjs";
8
- import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "./id.port-DPXLrqb2.mjs";
9
- import { a as CheckoutFlowState, c as CheckoutStepNumber, i as isLegalCheckoutTransition, l as SagaStep, n as SagaStepFn, o as SagaState, r as CHECKOUT_STATE_TRANSITIONS, s as CheckoutStep, t as SagaDependencies, u as SagaStepNumber } from "./saga-step-fn-Cyob38iU.mjs";
10
- import { a as Adjustment, i as Draft, n as Reservation, r as Checkout, t as IdempotencyRecord } from "./idempotency-record.entity-DIFXjN1V.mjs";
1
+ import { a as SagaError, c as PriceChangedError, d as UnknownKindError, f as ConcurrencyError, i as IdempotencyStorageError, l as NotFoundError, m as CartErrorCategory, n as StaleQuoteError, o as SagaFailurePhase, p as CartError, r as IdempotencyBusyError, s as ReservationError, t as StateTransitionError, u as KindError } from "./index-BFBUk6qT.mjs";
2
+ import { n as DraftStatus, r as ReservationStatus, t as CheckoutState } from "./cart-status.vo-CNJw4aaB.mjs";
3
+ import { S as CartEvents, _ as CartEventMeta, a as OutboxErrorInfo, b as CartEventName, c as OutboxFailureDecision, d as OutboxStore, f as OutboxStoreWriteOptions, g as CartEventAggregate, h as CartDomainEvent, i as OutboxClaimOptions, l as OutboxFailurePolicy, m as CartAggregateType, n as MemoryOutboxStore, o as OutboxFailOptions, p as OutboxWriteOptions, r as OutboxAcknowledgeOptions, s as OutboxFailureContext, t as InvalidOutboxEventError, u as OutboxOwnershipError, v as createCartEvent, x as CartEventPayload, y as CartEventMap } from "./outbox-store-CBt9fSYh.mjs";
4
+ import { a as CartEventRegistry, c as defineCartEvent, d as EventValidationResult, f as EventValidator, i as CartEventDefinitionInput, l as EventSchema, n as cartEventsByName, o as PayloadOf, r as CartEventDefinition, s as createCartEventRegistry, t as cartEventDefinitions, u as EventSchemaProperty } from "./cart-event-catalog-BxDJhtTM.mjs";
5
+ import { C as PricingSnapshot, S as PricedLine, _ as PromotionsBridge, a as TaxBreakdown, b as BridgeStatus, c as TaxCalculationResult, d as ReservationRequest, f as CatalogBridge, g as PromotionResult, h as CartSnapshot, i as ShippingQuoteRequest, l as InventoryBridge, m as AdjustmentSpec, n as ShippingMethod, o as TaxBridge, p as ProductSummary, r as ShippingQuote, s as TaxCalculationRequest, t as ShippingBridge, u as ReservationRef, v as Address, x as OperationContext, y as BridgeRef } from "./shipping.bridge-CmQFTgSE.mjs";
6
+ import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "./reservation.entity-b5cZ1ojx.mjs";
7
+ import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep } from "./state-transitions-X_Eix5Iw.mjs";
8
+ import { a as RevalidationResult, c as ValidityPolicy, i as LineLike, l as LineDisplay, n as KindContext, o as StaleBehavior, r as LineKind, s as StaleTrigger, t as KindBridges } from "./line-kind-Ck3fVXzG.mjs";
9
+ import { a as IdempotencyReplay, c as LineItem, i as IdempotencyIdentity, n as createKindRegistry, o as OperationName, r as CART_REF_NEW, s as TotalsSnapshot, t as KindRegistry } from "./kind-registry-C1n47C7h.mjs";
10
+ import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "./id.port-C7ygWLRU.mjs";
11
11
  import { CartConfigShape, cartConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./engine/cart-config.schema.mjs";
12
- import { C as DraftDocument, S as createCheckoutModel, _ as IdempotencyDocument, a as CartEngine, b as createReservationModel, c as createCartRepositories, d as CheckoutRepository, f as DraftRepository, g as createCartModels, h as CreateCartModelsOptions, i as CartConfig, l as IdempotencyRepository, m as CartModels, n as createCart, o as CartRepositories, p as CartModelName, r as CartBridges, s as CartRepositoryPluginBundle, t as InProcessCartEventBus, u as ReservationRepository, v as createIdempotencyModel, w as createDraftModel, x as CheckoutDocument, y as ReservationDocument } from "./internal-event-bus-IkUfQJxn.mjs";
13
- import { a as TimeslotPayload, c as VariantPayload, d as SkuPayload, f as skuKind, i as bundlePayloadSchema, l as variantKind, n as BundlePayload, o as timeslotKind, p as skuPayloadSchema, r as bundleKind, s as timeslotPayloadSchema, t as BundleComponent, u as variantPayloadSchema } from "./bundle.kind-BdgnyKZt.mjs";
12
+ import { C as IdempotencyDocument, D as CheckoutDocument, E as createDraftModel, O as createCheckoutModel, S as createReservationModel, T as DraftDocument, _ as CartModelName, a as CartEngine, b as createCartModels, c as CreateCartRepositoriesConfig, d as IdempotencyRepository, f as CheckoutRepository, g as CartEventPublisherDeps, h as DraftRepositoryDeps, i as CartConfig, l as createCartRepositories, m as DraftRepository, n as createCart, o as CartRepositories, p as CheckoutRepositoryDeps, r as CartBridges, s as CartRepositoryPluginBundle, t as InProcessCartEventBus, u as ReservationRepository, v as CartModels, w as createIdempotencyModel, x as ReservationDocument, y as CreateCartModelsOptions } from "./internal-event-bus-DKcDteh-.mjs";
13
+ import { a as timeslotKind, c as skuKind, d as BundlePayload, f as bundleKind, i as TimeslotPayload, l as skuPayloadSchema, n as variantKind, o as timeslotPayloadSchema, p as bundlePayloadSchema, r as variantPayloadSchema, s as SkuPayload, t as VariantPayload, u as BundleComponent } from "./variant.kind-9P1DXdXu.mjs";
14
14
  import { Money, addMoney, fromMajor, money, multiplyMoney, subtractMoney, sumMoney, toMajor } from "@classytic/primitives/money";
15
15
  import { EventHandler, EventTransport, PublishManyResult } from "@classytic/primitives/events";
16
+ import { Schema } from "mongoose";
17
+ import { ResolvedTenantConfig, TenantConfig } from "@classytic/primitives/tenant";
16
18
 
19
+ //#region src/services/abandonment.service.d.ts
20
+ /**
21
+ * Abandonment query primitives. Hosts call these from their own cron
22
+ * or worker — cart does not ship a scheduler.
23
+ */
24
+ /**
25
+ * Find drafts that have been active but not updated since `cutoff`.
26
+ * Returns up to `limit` drafts, sorted by `updatedAt` ascending (oldest
27
+ * first). Routes through mongokit's `getAll` so the multi-tenant plugin
28
+ * scopes the query at POLICY priority — pass `skipTenant: true` on `ctx`
29
+ * for cross-tenant admin sweeps.
30
+ */
31
+ declare function findAbandonedDrafts(opts: {
32
+ repo: DraftRepository;
33
+ cutoff: Date;
34
+ limit?: number;
35
+ ctx: OperationContext;
36
+ }): Promise<DraftDocument[]>;
37
+ /**
38
+ * Mark a batch of drafts as abandoned. Returns the count of drafts
39
+ * successfully transitioned.
40
+ */
41
+ declare function markAbandoned(opts: {
42
+ repo: DraftRepository;
43
+ draftIds: string[];
44
+ ctx: OperationContext;
45
+ }): Promise<number>;
46
+ //#endregion
47
+ //#region src/services/merge.service.d.ts
48
+ /**
49
+ * Merge a guest (session-scoped) draft into an authenticated user's
50
+ * active draft on login.
51
+ *
52
+ * Merge strategy: iterate the source's lines. For each line, if a line
53
+ * with the same `(kind, skuRef)` exists in the target, increment the
54
+ * target's quantity. Otherwise, append. Display snapshots carry over
55
+ * from the source since they're already captured.
56
+ *
57
+ * After merging, the source draft is marked `abandoned` so it's no
58
+ * longer active.
59
+ */
60
+ declare function mergeDrafts(opts: {
61
+ repo: DraftRepository;
62
+ sourcePublicId: string;
63
+ targetActorRef: string;
64
+ ctx: OperationContext;
65
+ }): Promise<DraftDocument>;
66
+ //#endregion
17
67
  //#region src/services/pricing.service.d.ts
18
68
  /**
19
69
  * Pricing pipeline — composable, bridge-activated.
@@ -52,52 +102,17 @@ declare function runPricing(opts: {
52
102
  adjustments: Adjustment[];
53
103
  }>;
54
104
  //#endregion
55
- //#region src/services/merge.service.d.ts
56
- /**
57
- * Merge a guest (session-scoped) draft into an authenticated user's
58
- * active draft on login.
59
- *
60
- * Merge strategy: iterate the source's lines. For each line, if a line
61
- * with the same `(kind, skuRef)` exists in the target, increment the
62
- * target's quantity. Otherwise, append. Display snapshots carry over
63
- * from the source since they're already captured.
64
- *
65
- * After merging, the source draft is marked `abandoned` so it's no
66
- * longer active.
67
- */
68
- declare function mergeDrafts(opts: {
69
- repo: DraftRepository;
70
- sourcePublicId: string;
71
- targetActorRef: string;
72
- ctx: OperationContext;
73
- }): Promise<DraftDocument>;
74
- //#endregion
75
- //#region src/services/abandonment.service.d.ts
76
- /**
77
- * Abandonment query primitives. Hosts call these from their own cron
78
- * or worker — cart does not ship a scheduler.
79
- */
105
+ //#region src/models/inject-tenant.d.ts
80
106
  /**
81
- * Find drafts that have been active but not updated since `cutoff`.
82
- * Returns up to `limit` drafts, sorted by `updatedAt` ascending (oldest
83
- * first). Routes through mongokit's `getAll` so the multi-tenant plugin
84
- * scopes the query at POLICY priority — pass `skipTenant: true` on `ctx`
85
- * for cross-tenant admin sweeps.
107
+ * Accept the same config surface other packages use (TenantConfig | boolean),
108
+ * and additionally support the legacy `{ tenantFieldType, multiTenant }` shape
109
+ * so the engine factory can forward its own config shorthand.
86
110
  */
87
- declare function findAbandonedDrafts(opts: {
88
- repo: DraftRepository;
89
- cutoff: Date;
90
- limit?: number;
91
- ctx: OperationContext;
92
- }): Promise<DraftDocument[]>;
93
- /**
94
- * Mark a batch of drafts as abandoned. Returns the count of drafts
95
- * successfully transitioned.
96
- */
97
- declare function markAbandoned(opts: {
98
- repo: DraftRepository;
99
- draftIds: string[];
100
- ctx: OperationContext;
101
- }): Promise<number>;
111
+ type CartTenantInput = TenantConfig | boolean | {
112
+ tenantFieldType?: 'objectId' | 'string';
113
+ multiTenant?: boolean;
114
+ };
115
+ /** Re-export of primitives' resolved shape under the legacy name. */
116
+ type ResolvedTenant = ResolvedTenantConfig;
102
117
  //#endregion
103
- export { type Address, type Adjustment, type AdjustmentSpec, type BridgeRef, type BridgeStatus, type BundleComponent, type BundlePayload, CART_REF_NEW, CHECKOUT_STATE_TRANSITIONS, type CartAggregateType, type CartBridges, type CartConfig, type CartConfigShape, type CartDomainEvent, type CartEngine, CartError, type CartErrorCategory, type CartEventAggregate, type CartEventDefinition, type CartEventDefinitionInput, type CartEventMap, type CartEventMeta, type CartEventName, type CartEventPayload, type CartEventRegistry, CartEvents, type CartModelName, type CartModels, type CartRepositories, type CartRepositoryPluginBundle, type CartSnapshot, type CatalogBridge, type Checkout, type CheckoutDocument, type CheckoutFlowState, CheckoutRepository, type CheckoutState, CheckoutStep, type CheckoutStepNumber, type ClockPort, ConcurrencyError, type CreateCartModelsOptions, type Draft, type DraftDocument, DraftRepository, type DraftStatus, type EventHandler, type EventSchema, type EventSchemaProperty, type EventTransport, type EventValidationResult, type EventValidator, type IdPort, IdempotencyBusyError, type IdempotencyDocument, type IdempotencyIdentity, type IdempotencyRecord, type IdempotencyReplay, IdempotencyRepository, IdempotencyStorageError, InProcessCartEventBus, InvalidOutboxEventError, type InventoryBridge, type KindBridges, type KindContext, KindError, type KindRegistry, type LineDisplay, type LineItem, type LineKind, type LineLike, MemoryOutboxStore, type Money, NotFoundError, type OperationContext, type OperationName, type OutboxAcknowledgeOptions, type OutboxClaimOptions, type OutboxErrorInfo, type OutboxFailOptions, type OutboxFailureContext, type OutboxFailureDecision, type OutboxFailurePolicy, OutboxOwnershipError, type OutboxStore, type OutboxStoreWriteOptions, type OutboxWriteOptions, type PayloadOf, PriceChangedError, type PricedLine, type PricingSnapshot, type ProductSummary, type PromotionResult, type PromotionsBridge, type PublishManyResult, type Reservation, type ReservationDocument, ReservationError, type ReservationRef, ReservationRepository, type ReservationRequest, type ReservationStatus, type RevalidationResult, type SagaDependencies, SagaError, type SagaFailurePhase, type SagaState, SagaStep, type SagaStepFn, type SagaStepNumber, type ShippingBridge, type ShippingMethod, type ShippingQuote, type ShippingQuoteRequest, type SkuPayload, type StaleBehavior, StaleQuoteError, type StaleTrigger, StateTransitionError, type TaxBreakdown, type TaxBridge, type TaxCalculationRequest, type TaxCalculationResult, type TimeslotPayload, type TotalsSnapshot, UnknownKindError, type ValidityPolicy, type VariantPayload, addMoney, bundleKind, bundlePayloadSchema, cartConfigSchema, cartEventDefinitions, cartEventsByName, createCart, createCartEvent, createCartEventRegistry, createCartModels, createCartRepositories, createCheckoutModel, createCounterIdPort, createDraftModel, createIdempotencyModel, createKindRegistry, createReservationModel, cryptoIdPort, defineCartEvent, findAbandonedDrafts, fromMajor, idempotencyConfigSchema, isLegalCheckoutTransition, markAbandoned, mergeDrafts, money, multiplyMoney, reservationConfigSchema, runPricing, scopeConfigSchema, skuKind, skuPayloadSchema, subtractMoney, sumMoney, systemClock, timeslotKind, timeslotPayloadSchema, toMajor, variantKind, variantPayloadSchema };
118
+ export { type Address, type Adjustment, type AdjustmentSpec, type BridgeRef, type BridgeStatus, type BundleComponent, type BundlePayload, CART_REF_NEW, CHECKOUT_STATE_TRANSITIONS, type CartAggregateType, type CartBridges, type CartConfig, type CartConfigShape, type CartDomainEvent, type CartEngine, CartError, type CartErrorCategory, type CartEventAggregate, type CartEventDefinition, type CartEventDefinitionInput, type CartEventMap, type CartEventMeta, type CartEventName, type CartEventPayload, type CartEventPublisherDeps, type CartEventRegistry, CartEvents, type CartModelName, type CartModels, type CartRepositories, type CartRepositoryPluginBundle, type CartSnapshot, type CartTenantInput, type CatalogBridge, type Checkout, type CheckoutDocument, type CheckoutFlowState, CheckoutRepository, type CheckoutRepositoryDeps, type CheckoutState, CheckoutStep, type CheckoutStepNumber, type ClockPort, ConcurrencyError, type CreateCartModelsOptions, type CreateCartRepositoriesConfig, type Draft, type DraftDocument, DraftRepository, type DraftRepositoryDeps, type DraftStatus, type EventHandler, type EventSchema, type EventSchemaProperty, type EventTransport, type EventValidationResult, type EventValidator, type IdPort, IdempotencyBusyError, type IdempotencyDocument, type IdempotencyIdentity, type IdempotencyRecord, type IdempotencyReplay, IdempotencyRepository, IdempotencyStorageError, InProcessCartEventBus, InvalidOutboxEventError, type InventoryBridge, type KindBridges, type KindContext, KindError, type KindRegistry, type LineDisplay, type LineItem, type LineKind, type LineLike, MemoryOutboxStore, type Money, NotFoundError, type OperationContext, type OperationName, type OutboxAcknowledgeOptions, type OutboxClaimOptions, type OutboxErrorInfo, type OutboxFailOptions, type OutboxFailureContext, type OutboxFailureDecision, type OutboxFailurePolicy, OutboxOwnershipError, type OutboxStore, type OutboxStoreWriteOptions, type OutboxWriteOptions, type PayloadOf, PriceChangedError, type PricedLine, type PricingSnapshot, type ProductSummary, type PromotionResult, type PromotionsBridge, type PublishManyResult, type Reservation, type ReservationDocument, ReservationError, type ReservationRef, ReservationRepository, type ReservationRequest, type ReservationStatus, type ResolvedTenant, type RevalidationResult, type SagaDependencies, SagaError, type SagaFailurePhase, type SagaStepFn, type ShippingBridge, type ShippingMethod, type ShippingQuote, type ShippingQuoteRequest, type SkuPayload, type StaleBehavior, StaleQuoteError, type StaleTrigger, StateTransitionError, type TaxBreakdown, type TaxBridge, type TaxCalculationRequest, type TaxCalculationResult, type TimeslotPayload, type TotalsSnapshot, UnknownKindError, type ValidityPolicy, type VariantPayload, addMoney, bundleKind, bundlePayloadSchema, cartConfigSchema, cartEventDefinitions, cartEventsByName, createCart, createCartEvent, createCartEventRegistry, createCartModels, createCartRepositories, createCheckoutModel, createCounterIdPort, createDraftModel, createIdempotencyModel, createKindRegistry, createReservationModel, cryptoIdPort, defineCartEvent, findAbandonedDrafts, fromMajor, idempotencyConfigSchema, isLegalCheckoutTransition, markAbandoned, mergeDrafts, money, multiplyMoney, reservationConfigSchema, runPricing, scopeConfigSchema, skuKind, skuPayloadSchema, subtractMoney, sumMoney, systemClock, timeslotKind, timeslotPayloadSchema, toMajor, variantKind, variantPayloadSchema };