@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.
- package/dist/{cart-event-catalog-BIbi2Q_n.d.mts → cart-event-catalog-BxDJhtTM.d.mts} +1 -1
- package/dist/cart.error-BwWy4RlY.mjs +27 -0
- package/dist/{shipping.bridge-_VwuKCSE.d.mts → clock.port-BUe6Dk_M.d.mts} +27 -10
- package/dist/{create-cart-DRYSw5Bj.mjs → create-cart-4wql1XGi.mjs} +33 -15
- package/dist/domain/errors/index.d.mts +1 -1
- package/dist/domain/errors/index.mjs +5 -3
- package/dist/domain/events/index.d.mts +2 -2
- package/dist/domain/events/index.mjs +2 -2
- package/dist/domain/index.d.mts +11 -11
- package/dist/domain/index.mjs +11 -10
- package/dist/domain/ports/index.d.mts +2 -2
- package/dist/domain/ports/index.mjs +1 -1
- package/dist/domain/saga/index.d.mts +2 -2
- package/dist/domain/saga/index.mjs +2 -3
- package/dist/engine/index.d.mts +1 -1
- package/dist/engine/index.mjs +1 -1
- package/dist/{errors-iFWUnl8m.mjs → errors-7Pd0yATM.mjs} +2 -27
- package/dist/{id.port-CpYO7sc1.d.mts → id.port-DitjeoHg.d.mts} +1 -19
- package/dist/{index-PD-kf5pR.d.mts → index-qfN8dZN9.d.mts} +7 -6
- package/dist/index.d.mts +14 -14
- package/dist/index.mjs +14 -13
- package/dist/{internal-event-bus-BGcwAeqK.d.mts → internal-event-bus-DhSLiZHi.d.mts} +5 -5
- package/dist/{kind-registry-Ba4PO4WC.mjs → kind-registry-C99h_-8t.mjs} +1 -1
- package/dist/{kind-registry-CqOJHV-2.d.mts → kind-registry-D03c2VV5.d.mts} +1 -1
- package/dist/{kind.error-CCjTB6kW.mjs → kind.error-DIaJpdUb.mjs} +2 -27
- package/dist/kinds/index.d.mts +2 -2
- package/dist/kinds/index.mjs +2 -2
- package/dist/{line-kind-DOYygKG4.d.mts → line-kind-CKOWafK0.d.mts} +11 -6
- package/dist/{outbox-store-bP30uBXd.mjs → outbox-store-CWW8ppxS.mjs} +1 -1
- package/dist/{reservation.entity-gmeCFe8a.d.mts → reservation.entity-WdaZCJg9.d.mts} +4 -4
- package/dist/{state-transition.error-CML7cQSd.mjs → stale-quote.error-BkFLXWo5.mjs} +24 -22
- package/dist/state-transition.error-2fRLh3p0.mjs +26 -0
- package/dist/state-transitions-Bm3lC2Uv.mjs +61 -0
- package/dist/{state-transitions-CbPYzeca.d.mts → state-transitions-D8CRykBv.d.mts} +19 -9
- package/dist/{variant.kind-CCwwWAB6.d.mts → variant.kind-Cpo_Hh7G.d.mts} +65 -2
- package/dist/{variant.kind-BpEzENX-.mjs → variant.kind-z2gwH9Vo.mjs} +93 -11
- package/package.json +8 -6
- package/dist/saga-steps-aP8iTHT3.mjs +0 -26
- package/dist/state-transitions-CpJpZZTK.mjs +0 -21
- /package/dist/{cart-status.vo-2iisZGhb.d.mts → cart-status.vo-CNJw4aaB.d.mts} +0 -0
- /package/dist/{domain-event-DHNkz15G.mjs → domain-event-CIEORKF6.mjs} +0 -0
- /package/dist/{id.port-C3rlDAKP.mjs → id.port-BhbFZJPm.mjs} +0 -0
- /package/dist/{index-DNLi60D-.d.mts → index-2Ag-54t8.d.mts} +0 -0
- /package/dist/{outbox-store-CTWz9pvG.d.mts → outbox-store-CBt9fSYh.d.mts} +0 -0
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//#region src/domain/saga/saga-steps.ts
|
|
2
|
-
/**
|
|
3
|
-
* Checkout flow steps. Deliberately minimal — cart's job is to freeze a
|
|
4
|
-
* snapshot and transition its state. Everything external (payment, order
|
|
5
|
-
* creation, fulfillment) is the host's problem.
|
|
6
|
-
*
|
|
7
|
-
* This enum exists purely for logging / metrics / ordered state-transition
|
|
8
|
-
* dispatch. Cart does not run a "saga engine" — the `CheckoutRepository`
|
|
9
|
-
* domain methods run these steps in plain sequential code and let
|
|
10
|
-
* exceptions propagate. Compensation is one operation (`cancel`) rather
|
|
11
|
-
* than a reverse walk of a multi-step chain.
|
|
12
|
-
*/
|
|
13
|
-
const CheckoutStep = {
|
|
14
|
-
/** Step 1 — load draft + validate status + version. */
|
|
15
|
-
LoadDraft: 1,
|
|
16
|
-
/** Step 2 — re-run kind.revalidate() on stale lines. */
|
|
17
|
-
Revalidate: 2,
|
|
18
|
-
/** Step 3 — re-run pricing pipeline, compare expectedPricingHash. */
|
|
19
|
-
Reprice: 3,
|
|
20
|
-
/** Step 4 — create the checkout document with the frozen snapshot. */
|
|
21
|
-
CreateCheckout: 4,
|
|
22
|
-
/** Step 5 — commit (host-called after its own external work succeeds). */
|
|
23
|
-
Commit: 5
|
|
24
|
-
};
|
|
25
|
-
//#endregion
|
|
26
|
-
export { CheckoutStep as t };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//#region src/domain/saga/state-transitions.ts
|
|
2
|
-
/**
|
|
3
|
-
* Frozen state transitions for Checkout.state. Three states, two
|
|
4
|
-
* terminal outcomes — finalized (success) or canceled (failure / manual
|
|
5
|
-
* cancel / abandonment).
|
|
6
|
-
*
|
|
7
|
-
* Enforced by `CheckoutRepository.updateWithVersion` callers: the
|
|
8
|
-
* service methods pass the expected current state in the filter so
|
|
9
|
-
* racing writers see exactly one winner.
|
|
10
|
-
*/
|
|
11
|
-
const CHECKOUT_STATE_TRANSITIONS = {
|
|
12
|
-
open: ["finalized", "canceled"],
|
|
13
|
-
finalized: [],
|
|
14
|
-
canceled: []
|
|
15
|
-
};
|
|
16
|
-
/** Predicate — is `to` a legal transition from `from`? */
|
|
17
|
-
function isLegalCheckoutTransition(from, to) {
|
|
18
|
-
return CHECKOUT_STATE_TRANSITIONS[from]?.includes(to) ?? false;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { isLegalCheckoutTransition as n, CHECKOUT_STATE_TRANSITIONS as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|