@classytic/cart 0.1.1 → 0.1.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.
Files changed (44) hide show
  1. package/dist/{cart-event-catalog-BIbi2Q_n.d.mts → cart-event-catalog-BxDJhtTM.d.mts} +1 -1
  2. package/dist/cart.error-BwWy4RlY.mjs +27 -0
  3. package/dist/{shipping.bridge-_VwuKCSE.d.mts → clock.port-BUe6Dk_M.d.mts} +27 -10
  4. package/dist/{create-cart-DRYSw5Bj.mjs → create-cart-4wql1XGi.mjs} +33 -15
  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-iFWUnl8m.mjs → errors-7Pd0yATM.mjs} +2 -27
  18. package/dist/{id.port-CpYO7sc1.d.mts → id.port-DitjeoHg.d.mts} +1 -19
  19. package/dist/{index-PD-kf5pR.d.mts → index-qfN8dZN9.d.mts} +7 -6
  20. package/dist/index.d.mts +14 -14
  21. package/dist/index.mjs +14 -13
  22. package/dist/{internal-event-bus-BGcwAeqK.d.mts → internal-event-bus-DhSLiZHi.d.mts} +5 -5
  23. package/dist/{kind-registry-Ba4PO4WC.mjs → kind-registry-C99h_-8t.mjs} +1 -1
  24. package/dist/{kind-registry-CqOJHV-2.d.mts → kind-registry-D03c2VV5.d.mts} +1 -1
  25. package/dist/{kind.error-CCjTB6kW.mjs → kind.error-DIaJpdUb.mjs} +2 -27
  26. package/dist/kinds/index.d.mts +2 -2
  27. package/dist/kinds/index.mjs +2 -2
  28. package/dist/{line-kind-DOYygKG4.d.mts → line-kind-CKOWafK0.d.mts} +11 -6
  29. package/dist/{outbox-store-bP30uBXd.mjs → outbox-store-CWW8ppxS.mjs} +1 -1
  30. package/dist/{reservation.entity-gmeCFe8a.d.mts → reservation.entity-WdaZCJg9.d.mts} +4 -4
  31. package/dist/{state-transition.error-CML7cQSd.mjs → stale-quote.error-BkFLXWo5.mjs} +24 -22
  32. package/dist/state-transition.error-2fRLh3p0.mjs +26 -0
  33. package/dist/state-transitions-Bm3lC2Uv.mjs +61 -0
  34. package/dist/{state-transitions-CbPYzeca.d.mts → state-transitions-D8CRykBv.d.mts} +19 -9
  35. package/dist/{variant.kind-CCwwWAB6.d.mts → variant.kind-Cpo_Hh7G.d.mts} +65 -2
  36. package/dist/{variant.kind-BpEzENX-.mjs → variant.kind-z2gwH9Vo.mjs} +93 -11
  37. package/package.json +8 -6
  38. package/dist/saga-steps-aP8iTHT3.mjs +0 -26
  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/{index-DNLi60D-.d.mts → index-2Ag-54t8.d.mts} +0 -0
  44. /package/dist/{outbox-store-CTWz9pvG.d.mts → outbox-store-CBt9fSYh.d.mts} +0 -0
@@ -1,4 +1,4 @@
1
- import { _ as CartEventMeta, b as CartEventName, h as CartDomainEvent } from "./outbox-store-CTWz9pvG.mjs";
1
+ import { _ as CartEventMeta, b as CartEventName, h as CartDomainEvent } from "./outbox-store-CBt9fSYh.mjs";
2
2
 
3
3
  //#region src/domain/events/event-schema.d.ts
4
4
  /**
@@ -0,0 +1,27 @@
1
+ //#region src/domain/errors/cart.error.ts
2
+ var CartError = class extends Error {
3
+ /** Optional structured context for logging / debugging. */
4
+ context;
5
+ constructor(message, context) {
6
+ super(message);
7
+ this.name = new.target.name;
8
+ this.context = context;
9
+ Object.setPrototypeOf(this, new.target.prototype);
10
+ }
11
+ /**
12
+ * Serialize to a wire-safe shape. Suitable for HTTP error bodies and
13
+ * structured logging. Never includes stack frames.
14
+ */
15
+ toJSON() {
16
+ return {
17
+ name: this.name,
18
+ code: this.code,
19
+ category: this.category,
20
+ message: this.message,
21
+ retryable: this.retryable,
22
+ context: this.context
23
+ };
24
+ }
25
+ };
26
+ //#endregion
27
+ export { CartError as t };
@@ -41,10 +41,9 @@ interface PricedLine {
41
41
  /** Accumulated tax applied to this line by the tax step. */
42
42
  taxTotal: Money;
43
43
  /**
44
- * Validity window for this priced line. The saga's step 2
45
- * (revalidation) compares this against the clock and triggers
46
- * LineKind.revalidate() on expiry according to the kind's StaleBehavior.
47
- * `null` means no expiry (e.g., hard-priced SKUs).
44
+ * Validity window for this priced line. Checkout compares this against
45
+ * the engine clock and rejects expired snapshots without extra bridge
46
+ * reads. `null` means no expiry (e.g., hard-priced SKUs).
48
47
  */
49
48
  validUntil: Date | null;
50
49
  /**
@@ -58,10 +57,10 @@ interface PricedLine {
58
57
  /**
59
58
  * Whole-cart pricing snapshot — the output of running the full pipeline.
60
59
  *
61
- * Written to the draft on every mutation and frozen onto the checkout on saga
62
- * step 4. Drives idempotent revalidation: saga step 3 compares
63
- * `snapshot.pricingHash` against the client-supplied expectedPricingHash and
64
- * aborts with PriceChangedError if they differ.
60
+ * Written to the draft on every mutation and frozen onto the checkout. Drives
61
+ * cheap checkout freshness: first reject expired `pricingValidUntil`, then
62
+ * compare `snapshot.pricingHash` against the client-supplied
63
+ * expectedPricingHash and abort with PriceChangedError if they differ.
65
64
  */
66
65
  interface PricingSnapshot {
67
66
  /** Per-line priced rows, one entry per LineItem in draft order. */
@@ -92,7 +91,7 @@ interface PricingSnapshot {
92
91
  pricingValidUntil: Date | null;
93
92
  /**
94
93
  * Content hash of the priced snapshot. Computed from the sorted line array,
95
- * adjustments, and totals. Used by the finalize saga step 3 to detect
94
+ * adjustments, and totals. Used by checkout's hash check to detect
96
95
  * "price changed since the client confirmed" and abort with
97
96
  * PriceChangedError so the client can re-display and re-confirm.
98
97
  */
@@ -535,4 +534,22 @@ interface ShippingMethod {
535
534
  };
536
535
  }
537
536
  //#endregion
538
- export { PricingSnapshot as C, PricedLine as S, PromotionsBridge as _, TaxBreakdown as a, BridgeStatus as b, TaxCalculationResult as c, ReservationRequest as d, CatalogBridge as f, PromotionResult as g, CartSnapshot as h, ShippingQuoteRequest as i, InventoryBridge as l, AdjustmentSpec as m, ShippingMethod as n, TaxBridge as o, ProductSummary as p, ShippingQuote as r, TaxCalculationRequest as s, ShippingBridge as t, ReservationRef as u, Address as v, OperationContext$1 as x, BridgeRef as y };
537
+ //#region src/domain/ports/clock.port.d.ts
538
+ /**
539
+ * Clock port — the one source of "now" in the cart engine.
540
+ *
541
+ * Injected through config so tests can install a fake clock and fast-forward
542
+ * through TTLs, validity windows, and saga lease expirations. Production
543
+ * hosts pass nothing and get a default `systemClock` that calls `new Date()`.
544
+ *
545
+ * Never read `Date.now()` or `new Date()` directly in cart code. Always use
546
+ * `engine.clock.now()`. Integration tests assert this via ESLint rule.
547
+ */
548
+ interface ClockPort {
549
+ /** Wall clock — used for timestamps, TTL expiry, idempotency leases. */
550
+ now(): Date;
551
+ }
552
+ /** Default system clock — passes straight through to `new Date()`. */
553
+ declare const systemClock: ClockPort;
554
+ //#endregion
555
+ export { OperationContext$1 as C, BridgeStatus as S, PricingSnapshot as T, CartSnapshot as _, ShippingQuote as a, Address as b, TaxBridge as c, InventoryBridge as d, ReservationRef as f, AdjustmentSpec as g, ProductSummary as h, ShippingMethod as i, TaxCalculationRequest as l, CatalogBridge as m, systemClock as n, ShippingQuoteRequest as o, ReservationRequest as p, ShippingBridge as r, TaxBreakdown as s, ClockPort as t, TaxCalculationResult as u, PromotionResult as v, PricedLine as w, BridgeRef as x, PromotionsBridge as y };
@@ -1,13 +1,13 @@
1
- import { t as KindError } from "./kind.error-CCjTB6kW.mjs";
2
- import { i as ConcurrencyError, n as PriceChangedError, r as NotFoundError, t as StateTransitionError } from "./state-transition.error-CML7cQSd.mjs";
3
- import { n as CartEvents, t as createCartEvent } from "./domain-event-DHNkz15G.mjs";
4
- import { n as cryptoIdPort, r as systemClock } from "./id.port-C3rlDAKP.mjs";
5
- import { t as createKindRegistry } from "./kind-registry-Ba4PO4WC.mjs";
6
- import { t as CheckoutStep } from "./saga-steps-aP8iTHT3.mjs";
1
+ import { i as ConcurrencyError, n as PriceChangedError, r as NotFoundError, t as StaleQuoteError } from "./stale-quote.error-BkFLXWo5.mjs";
2
+ import { t as KindError } from "./kind.error-DIaJpdUb.mjs";
3
+ import { n as CartEvents, t as createCartEvent } from "./domain-event-CIEORKF6.mjs";
4
+ import { n as cryptoIdPort, r as systemClock } from "./id.port-BhbFZJPm.mjs";
5
+ import { t as createKindRegistry } from "./kind-registry-C99h_-8t.mjs";
6
+ import { i as CheckoutStep, t as CHECKOUT_MACHINE } from "./state-transitions-Bm3lC2Uv.mjs";
7
7
  import { money } from "@classytic/primitives/money";
8
8
  import { matchEventPattern } from "@classytic/primitives/events";
9
9
  import mongoose, { Schema } from "mongoose";
10
- import { resolveTenantConfig } from "@classytic/primitives/tenant";
10
+ import { resolveTenantConfig } from "@classytic/repo-core/tenant";
11
11
  import { Repository, customIdPlugin, isDuplicateKeyError, multiTenantPlugin, prefixedId } from "@classytic/mongokit";
12
12
  //#region src/models/checkout.model.ts
13
13
  function createCheckoutModel(connection, opts = {}) {
@@ -365,7 +365,7 @@ function createIdempotencyModel(connection, opts = {}) {
365
365
  //#region src/models/inject-tenant.ts
366
366
  /**
367
367
  * Mongoose-specific adapter around `resolveTenantConfig()` from
368
- * `@classytic/primitives/tenant`. The pure resolution lives in primitives
368
+ * `@classytic/repo-core/tenant`. The pure resolution lives in primitives
369
369
  * (zero runtime deps) — this file only handles the Mongoose schema
370
370
  * mutations (add field, prepend tenant to indexes) that primitives can't
371
371
  * own without a mongoose dependency.
@@ -610,7 +610,9 @@ var CheckoutRepository = class extends Repository {
610
610
  if (draft.status !== "active") throw new Error(`Cannot create checkout from draft in status '${draft.status}'`);
611
611
  if (draft.lines.length === 0) throw new Error("Cannot create checkout from an empty draft");
612
612
  if (!draft.pricing) throw new Error("Cannot create checkout from a draft with no priced snapshot — call addItem first");
613
- const draftPricingHash = draft.pricing.pricingHash;
613
+ const pricingSnapshot = draft.pricing;
614
+ assertSnapshotNotExpired(pricingSnapshot, draft.lines, () => this.clock.now());
615
+ const draftPricingHash = pricingSnapshot.pricingHash;
614
616
  if (input.expectedPricingHash !== null && draftPricingHash !== input.expectedPricingHash) throw new PriceChangedError(input.expectedPricingHash, draftPricingHash ?? "<missing>", { draftPublicId: input.draftPublicId });
615
617
  const existing = await this.findOpenByDraft(draft._id, ctx);
616
618
  if (existing) return existing;
@@ -672,7 +674,7 @@ var CheckoutRepository = class extends Repository {
672
674
  lean: true,
673
675
  throwOnNotFound: false
674
676
  });
675
- if (checkout.state !== "open") throw new StateTransitionError(checkout.publicId, checkout.state, "finalized");
677
+ CHECKOUT_MACHINE.assertTransition(checkout.publicId, checkout.state, "finalized");
676
678
  const nowIso = this.clock.now().toISOString();
677
679
  const updated = await this.updateWithVersion(checkout._id, checkout.version, {
678
680
  state: "finalized",
@@ -705,7 +707,7 @@ var CheckoutRepository = class extends Repository {
705
707
  }
706
708
  async cancel(input, ctx) {
707
709
  const checkout = await this.requireCheckout(input.checkoutPublicId, ctx);
708
- if (checkout.state !== "open") throw new StateTransitionError(checkout.publicId, checkout.state, "canceled");
710
+ CHECKOUT_MACHINE.assertTransition(checkout.publicId, checkout.state, "canceled");
709
711
  const nowIso = this.clock.now().toISOString();
710
712
  const updated = await this.updateWithVersion(checkout._id, checkout.version, {
711
713
  state: "canceled",
@@ -801,6 +803,19 @@ var CheckoutRepository = class extends Repository {
801
803
  return checkout;
802
804
  }
803
805
  };
806
+ function assertSnapshotNotExpired(pricing, draftLines, now) {
807
+ if (!pricing.pricingValidUntil) return;
808
+ const expiresAt = new Date(pricing.pricingValidUntil);
809
+ const currentTime = now();
810
+ if (Number.isNaN(expiresAt.getTime()) || expiresAt > currentTime) return;
811
+ const expired = pricing.lines?.find((pricedLine) => {
812
+ if (!pricedLine.validUntil) return false;
813
+ const validUntil = new Date(pricedLine.validUntil);
814
+ return !Number.isNaN(validUntil.getTime()) && validUntil <= currentTime;
815
+ });
816
+ const line = draftLines.find((item) => item.lineId === expired?.lineId);
817
+ throw new StaleQuoteError(expired?.lineId ?? "<cart>", typeof line?.kind === "string" ? line.kind : "<unknown>", "pricing snapshot expired; refresh the draft before checkout", { pricingValidUntil: expiresAt.toISOString() });
818
+ }
804
819
  function isNotFound$2(err) {
805
820
  return typeof err === "object" && err !== null && err.status === 404;
806
821
  }
@@ -831,8 +846,10 @@ function isNotFound$2(err) {
831
846
  * checkout-freeze still catches drift, so reuse here is safe.
832
847
  */
833
848
  async function runPricing(opts) {
849
+ const computedAt = opts.clock.now();
834
850
  const kindCtx = {
835
851
  ...opts.ctx,
852
+ clock: opts.clock,
836
853
  bridges: {
837
854
  catalog: opts.bridges.catalog,
838
855
  inventory: opts.bridges.inventory,
@@ -872,7 +889,7 @@ async function runPricing(opts) {
872
889
  for (const result of promoResults.sort((a, b) => b.priority - a.priority)) {
873
890
  const appliedAmount = computeAdjustmentAmount(result, pricedLines, opts.currency);
874
891
  adjustments.push({
875
- adjustmentId: `adj_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
892
+ adjustmentId: `adj_${computedAt.getTime()}_${adjustments.length + 1}`,
876
893
  source: "promotion",
877
894
  ruleRef: result.ruleRef,
878
895
  spec: result.adjustment,
@@ -880,7 +897,7 @@ async function runPricing(opts) {
880
897
  appliedAmount,
881
898
  explanation: result.explanation,
882
899
  priority: result.priority,
883
- appliedAt: opts.clock.now()
900
+ appliedAt: computedAt
884
901
  });
885
902
  if (result.targetLineId) {
886
903
  const target = pricedLines.find((l) => l.lineId === result.targetLineId);
@@ -960,7 +977,7 @@ async function runPricing(opts) {
960
977
  },
961
978
  pricingValidUntil,
962
979
  pricingHash: buildPricingHash(pricedLines),
963
- computedAt: opts.clock.now()
980
+ computedAt
964
981
  },
965
982
  adjustments
966
983
  };
@@ -1359,6 +1376,7 @@ var DraftRepository = class extends Repository {
1359
1376
  kindContextFor(ctx) {
1360
1377
  return {
1361
1378
  ...ctx,
1379
+ clock: this.clock,
1362
1380
  bridges: {
1363
1381
  catalog: this.bridges.catalog,
1364
1382
  inventory: this.bridges.inventory,
@@ -1566,7 +1584,7 @@ var ReservationRepository = class extends Repository {
1566
1584
  page: 1,
1567
1585
  limit,
1568
1586
  countStrategy: "none"
1569
- }, this.readOptions(ctx))).docs;
1587
+ }, this.readOptions(ctx))).data;
1570
1588
  }
1571
1589
  /** Atomic transition `held → released` via version check. */
1572
1590
  async markReleased(reservationId, expectedVersion, reason, ctx) {
@@ -1,2 +1,2 @@
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-PD-kf5pR.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-qfN8dZN9.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 PriceChangedError, r as NotFoundError, t as StateTransitionError } from "../../state-transition.error-CML7cQSd.mjs";
3
- import { a as ReservationError, i as SagaError, n as IdempotencyBusyError, r as IdempotencyStorageError, t as StaleQuoteError } from "../../errors-iFWUnl8m.mjs";
1
+ import { t as CartError } from "../../cart.error-BwWy4RlY.mjs";
2
+ import { i as ConcurrencyError, n as PriceChangedError, r as NotFoundError, t as StaleQuoteError } from "../../stale-quote.error-BkFLXWo5.mjs";
3
+ import { n as UnknownKindError, t as KindError } from "../../kind.error-DIaJpdUb.mjs";
4
+ import { i as ReservationError, n as IdempotencyStorageError, r as SagaError, t as IdempotencyBusyError } from "../../errors-7Pd0yATM.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 cartEventsByName, i as cartEventDefinitions, n as MemoryOutboxStore, o as createCartEventRegistry, r as OutboxOwnershipError, s as defineCartEvent, t as InvalidOutboxEventError } from "../../outbox-store-bP30uBXd.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 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-PD-kf5pR.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 { 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-_VwuKCSE.mjs";
6
- import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "../reservation.entity-gmeCFe8a.mjs";
7
- import { a as CheckoutFlowState, i as SagaStepFn, n as isLegalCheckoutTransition, o as CheckoutStep, r as SagaDependencies, s as CheckoutStepNumber, t as CHECKOUT_STATE_TRANSITIONS } from "../state-transitions-CbPYzeca.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-DOYygKG4.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-CqOJHV-2.mjs";
10
- import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../id.port-CpYO7sc1.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-qfN8dZN9.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 OperationContext, S as BridgeStatus, T as PricingSnapshot, _ as CartSnapshot, a as ShippingQuote, c as TaxBridge, d as InventoryBridge, f as ReservationRef, g as AdjustmentSpec, h as ProductSummary, i as ShippingMethod, l as TaxCalculationRequest, m as CatalogBridge, n as systemClock, o as ShippingQuoteRequest, p as ReservationRequest, r as ShippingBridge, s as TaxBreakdown, t as ClockPort, u as TaxCalculationResult, v as PromotionResult, w as PricedLine, x as BridgeRef, y as PromotionsBridge } from "../clock.port-BUe6Dk_M.mjs";
6
+ import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "../reservation.entity-WdaZCJg9.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-D8CRykBv.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-CKOWafK0.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-D03c2VV5.mjs";
10
+ import { n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../id.port-DitjeoHg.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, 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 };
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 PriceChangedError, r as NotFoundError, t as StateTransitionError } from "../state-transition.error-CML7cQSd.mjs";
4
- import { a as ReservationError, i as SagaError, n as IdempotencyBusyError, r as IdempotencyStorageError, t as StaleQuoteError } from "../errors-iFWUnl8m.mjs";
5
- import { n as CartEvents, t as createCartEvent } from "../domain-event-DHNkz15G.mjs";
6
- 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-bP30uBXd.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 { t as CheckoutStep } from "../saga-steps-aP8iTHT3.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 { i as ConcurrencyError, n as PriceChangedError, r as NotFoundError, t as StaleQuoteError } from "../stale-quote.error-BkFLXWo5.mjs";
4
+ import { n as UnknownKindError, t as KindError } from "../kind.error-DIaJpdUb.mjs";
5
+ import { i as ReservationError, n as IdempotencyStorageError, r as SagaError, t as IdempotencyBusyError } from "../errors-7Pd0yATM.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-Bm3lC2Uv.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, 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 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-_VwuKCSE.mjs";
2
- import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../../id.port-CpYO7sc1.mjs";
1
+ import { C as OperationContext, S as BridgeStatus, _ as CartSnapshot, a as ShippingQuote, c as TaxBridge, d as InventoryBridge, f as ReservationRef, g as AdjustmentSpec, h as ProductSummary, i as ShippingMethod, l as TaxCalculationRequest, m as CatalogBridge, n as systemClock, o as ShippingQuoteRequest, p as ReservationRequest, r as ShippingBridge, s as TaxBreakdown, t as ClockPort, u as TaxCalculationResult, v as PromotionResult, x as BridgeRef, y as PromotionsBridge } from "../../clock.port-BUe6Dk_M.mjs";
2
+ import { n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../../id.port-DitjeoHg.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, i as SagaStepFn, n as isLegalCheckoutTransition, o as CheckoutStep, r as SagaDependencies, s as CheckoutStepNumber, t as CHECKOUT_STATE_TRANSITIONS } from "../../state-transitions-CbPYzeca.mjs";
2
- export { CHECKOUT_STATE_TRANSITIONS, type CheckoutFlowState, CheckoutStep, type CheckoutStepNumber, type SagaDependencies, type SagaStepFn, 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-D8CRykBv.mjs";
2
+ export { CHECKOUT_MACHINE, CHECKOUT_STATE_TRANSITIONS, type CheckoutFlowState, CheckoutStep, type CheckoutStepNumber, type SagaDependencies, type SagaStepFn, isLegalCheckoutTransition };
@@ -1,3 +1,2 @@
1
- import { t as CheckoutStep } from "../../saga-steps-aP8iTHT3.mjs";
2
- import { n as isLegalCheckoutTransition, t as CHECKOUT_STATE_TRANSITIONS } from "../../state-transitions-CpJpZZTK.mjs";
3
- export { CHECKOUT_STATE_TRANSITIONS, CheckoutStep, isLegalCheckoutTransition };
1
+ import { i as CheckoutStep, n as CHECKOUT_STATE_TRANSITIONS, r as isLegalCheckoutTransition, t as CHECKOUT_MACHINE } from "../../state-transitions-Bm3lC2Uv.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-BGcwAeqK.mjs";
2
+ import { a as CartEngine, i as CartConfig, n as createCart, r as CartBridges, t as InProcessCartEventBus } from "../internal-event-bus-DhSLiZHi.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-DRYSw5Bj.mjs";
1
+ import { n as InProcessCartEventBus, t as createCart } from "../create-cart-4wql1XGi.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
@@ -69,29 +69,4 @@ var IdempotencyStorageError = class extends CartError {
69
69
  }
70
70
  };
71
71
  //#endregion
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 };
72
+ export { ReservationError as i, IdempotencyStorageError as n, SagaError as r, IdempotencyBusyError as t };
@@ -1,21 +1,3 @@
1
- //#region src/domain/ports/clock.port.d.ts
2
- /**
3
- * Clock port — the one source of "now" in the cart engine.
4
- *
5
- * Injected through config so tests can install a fake clock and fast-forward
6
- * through TTLs, validity windows, and saga lease expirations. Production
7
- * hosts pass nothing and get a default `systemClock` that calls `new Date()`.
8
- *
9
- * Never read `Date.now()` or `new Date()` directly in cart code. Always use
10
- * `engine.clock.now()`. Integration tests assert this via ESLint rule.
11
- */
12
- interface ClockPort {
13
- /** Wall clock — used for timestamps, TTL expiry, idempotency leases. */
14
- now(): Date;
15
- }
16
- /** Default system clock — passes straight through to `new Date()`. */
17
- declare const systemClock: ClockPort;
18
- //#endregion
19
1
  //#region src/domain/ports/id.port.d.ts
20
2
  /**
21
3
  * IdPort — a swappable source of unique identifiers.
@@ -61,4 +43,4 @@ declare const cryptoIdPort: IdPort;
61
43
  */
62
44
  declare function createCounterIdPort(prefix?: string): IdPort;
63
45
  //#endregion
64
- export { systemClock as a, ClockPort as i, createCounterIdPort as n, cryptoIdPort as r, IdPort as t };
46
+ export { createCounterIdPort as n, cryptoIdPort as r, IdPort 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
  /**
@@ -103,11 +103,12 @@ declare class NotFoundError extends CartError {
103
103
  //#endregion
104
104
  //#region src/domain/errors/price-changed.error.d.ts
105
105
  /**
106
- * The re-run pricing snapshot's hash does not match the `expectedPricingHash`
107
- * the client supplied when initiating finalize. Fired from saga step 3.
106
+ * The stored pricing snapshot's hash does not match the `expectedPricingHash`
107
+ * the client supplied when initiating checkout. Fired from the cheap hash
108
+ * check before the checkout snapshot is frozen.
108
109
  *
109
110
  * This is a safety interlock: the client saw totals X, but by the time the
110
- * saga ran, totals are now Y. Rather than silently charging a different
111
+ * checkout ran, totals are now Y. Rather than silently charging a different
111
112
  * amount, the saga aborts with this error so the client re-displays and
112
113
  * re-confirms.
113
114
  *
@@ -194,8 +195,8 @@ declare class IdempotencyStorageError extends CartError {
194
195
  //#endregion
195
196
  //#region src/domain/errors/stale-quote.error.d.ts
196
197
  /**
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).
198
+ * A priced line's validity window has elapsed. Fired during checkout's
199
+ * freshness check before the snapshot is frozen.
199
200
  *
200
201
  * Example: a bid line whose underlying auction moved to a new highest bid
201
202
  * while the user was reviewing the cart.
package/dist/index.d.mts CHANGED
@@ -1,20 +1,20 @@
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-PD-kf5pR.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 { 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-_VwuKCSE.mjs";
6
- import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "./reservation.entity-gmeCFe8a.mjs";
7
- import { a as CheckoutFlowState, i as SagaStepFn, n as isLegalCheckoutTransition, o as CheckoutStep, r as SagaDependencies, s as CheckoutStepNumber, t as CHECKOUT_STATE_TRANSITIONS } from "./state-transitions-CbPYzeca.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-DOYygKG4.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-CqOJHV-2.mjs";
10
- import { a as systemClock, i as ClockPort, n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "./id.port-CpYO7sc1.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-qfN8dZN9.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 OperationContext, S as BridgeStatus, T as PricingSnapshot, _ as CartSnapshot, a as ShippingQuote, b as Address, c as TaxBridge, d as InventoryBridge, f as ReservationRef, g as AdjustmentSpec, h as ProductSummary, i as ShippingMethod, l as TaxCalculationRequest, m as CatalogBridge, n as systemClock, o as ShippingQuoteRequest, p as ReservationRequest, r as ShippingBridge, s as TaxBreakdown, t as ClockPort, u as TaxCalculationResult, v as PromotionResult, w as PricedLine, x as BridgeRef, y as PromotionsBridge } from "./clock.port-BUe6Dk_M.mjs";
6
+ import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "./reservation.entity-WdaZCJg9.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-D8CRykBv.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-CKOWafK0.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-D03c2VV5.mjs";
10
+ import { n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "./id.port-DitjeoHg.mjs";
11
11
  import { CartConfigShape, cartConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./engine/cart-config.schema.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-BGcwAeqK.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-CCwwWAB6.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-DhSLiZHi.mjs";
13
+ import { a as timeslotKind, c as skuKind, d as serviceFeeKind, f as serviceFeePayloadSchema, g as bundlePayloadSchema, h as bundleKind, i as TimeslotPayload, l as skuPayloadSchema, m as BundlePayload, n as variantKind, o as timeslotPayloadSchema, p as BundleComponent, r as variantPayloadSchema, s as SkuPayload, t as VariantPayload, u as ServiceFeePayload } from "./variant.kind-Cpo_Hh7G.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
16
  import { Schema } from "mongoose";
17
- import { ResolvedTenantConfig, TenantConfig } from "@classytic/primitives/tenant";
17
+ import { ResolvedTenantConfig, TenantConfig } from "@classytic/repo-core/tenant";
18
18
 
19
19
  //#region src/services/abandonment.service.d.ts
20
20
  /**
@@ -115,4 +115,4 @@ type CartTenantInput = TenantConfig | boolean | {
115
115
  /** Re-export of primitives' resolved shape under the legacy name. */
116
116
  type ResolvedTenant = ResolvedTenantConfig;
117
117
  //#endregion
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 };
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 ServiceFeePayload, 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, serviceFeeKind, serviceFeePayloadSchema, skuKind, skuPayloadSchema, subtractMoney, sumMoney, systemClock, timeslotKind, timeslotPayloadSchema, toMajor, variantKind, variantPayloadSchema };
package/dist/index.mjs CHANGED
@@ -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 PriceChangedError, r as NotFoundError, t as StateTransitionError } from "./state-transition.error-CML7cQSd.mjs";
4
- import { a as ReservationError, i as SagaError, n as IdempotencyBusyError, r as IdempotencyStorageError, t as StaleQuoteError } from "./errors-iFWUnl8m.mjs";
5
- import { n as CartEvents, t as createCartEvent } from "./domain-event-DHNkz15G.mjs";
6
- 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-bP30uBXd.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 { t as CheckoutStep } from "./saga-steps-aP8iTHT3.mjs";
10
- import { n as isLegalCheckoutTransition, t as CHECKOUT_STATE_TRANSITIONS } from "./state-transitions-CpJpZZTK.mjs";
11
- import { a as IdempotencyRepository, c as CheckoutRepository, d as createIdempotencyModel, f as createDraftModel, i as ReservationRepository, l as createCartModels, n as InProcessCartEventBus, o as DraftRepository, p as createCheckoutModel, r as createCartRepositories, s as runPricing, t as createCart, u as createReservationModel } from "./create-cart-DRYSw5Bj.mjs";
12
- import { a as skuKind, c as bundlePayloadSchema, i as timeslotPayloadSchema, n as variantPayloadSchema, o as skuPayloadSchema, r as timeslotKind, s as bundleKind, t as variantKind } from "./variant.kind-BpEzENX-.mjs";
2
+ import { t as CartError } from "./cart.error-BwWy4RlY.mjs";
3
+ import { i as ConcurrencyError, n as PriceChangedError, r as NotFoundError, t as StaleQuoteError } from "./stale-quote.error-BkFLXWo5.mjs";
4
+ import { n as UnknownKindError, t as KindError } from "./kind.error-DIaJpdUb.mjs";
5
+ import { i as ReservationError, n as IdempotencyStorageError, r as SagaError, t as IdempotencyBusyError } from "./errors-7Pd0yATM.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 } from "./state-transitions-Bm3lC2Uv.mjs";
12
+ import { a as IdempotencyRepository, c as CheckoutRepository, d as createIdempotencyModel, f as createDraftModel, i as ReservationRepository, l as createCartModels, n as InProcessCartEventBus, o as DraftRepository, p as createCheckoutModel, r as createCartRepositories, s as runPricing, t as createCart, u as createReservationModel } from "./create-cart-4wql1XGi.mjs";
13
+ import { a as skuKind, c as serviceFeePayloadSchema, i as timeslotPayloadSchema, l as bundleKind, n as variantPayloadSchema, o as skuPayloadSchema, r as timeslotKind, s as serviceFeeKind, t as variantKind, u as bundlePayloadSchema } from "./variant.kind-z2gwH9Vo.mjs";
13
14
  import { cartConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./engine/cart-config.schema.mjs";
14
15
  import { addMoney, fromMajor, money, multiplyMoney, subtractMoney, sumMoney, toMajor } from "@classytic/primitives/money";
15
16
  //#region src/services/abandonment.service.ts
@@ -40,7 +41,7 @@ async function findAbandonedDrafts(opts) {
40
41
  organizationId: ctx.organizationId,
41
42
  skipTenant: ctx.skipTenant,
42
43
  lean: true
43
- })).docs;
44
+ })).data;
44
45
  }
45
46
  /**
46
47
  * Mark a batch of drafts as abandoned. Returns the count of drafts
@@ -89,4 +90,4 @@ async function mergeDrafts(opts) {
89
90
  return updated;
90
91
  }
91
92
  //#endregion
92
- export { CART_REF_NEW, CHECKOUT_STATE_TRANSITIONS, CartError, CartEvents, CheckoutRepository, CheckoutStep, ConcurrencyError, DraftRepository, IdempotencyBusyError, IdempotencyRepository, IdempotencyStorageError, InProcessCartEventBus, InvalidOutboxEventError, KindError, MemoryOutboxStore, NotFoundError, OutboxOwnershipError, PriceChangedError, ReservationError, ReservationRepository, SagaError, StaleQuoteError, StateTransitionError, UnknownKindError, 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 };
93
+ export { CART_REF_NEW, CHECKOUT_STATE_TRANSITIONS, CartError, CartEvents, CheckoutRepository, CheckoutStep, ConcurrencyError, DraftRepository, IdempotencyBusyError, IdempotencyRepository, IdempotencyStorageError, InProcessCartEventBus, InvalidOutboxEventError, KindError, MemoryOutboxStore, NotFoundError, OutboxOwnershipError, PriceChangedError, ReservationError, ReservationRepository, SagaError, StaleQuoteError, StateTransitionError, UnknownKindError, 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, serviceFeeKind, serviceFeePayloadSchema, skuKind, skuPayloadSchema, subtractMoney, sumMoney, systemClock, timeslotKind, timeslotPayloadSchema, toMajor, variantKind, variantPayloadSchema };