@classytic/pos 0.7.0 → 0.8.0
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/CHANGELOG.md +10 -453
- package/dist/commands/pos-commands.d.mts +3 -1
- package/dist/commands/pos-commands.mjs +4 -2
- package/dist/domain/enums/payment-method.enum.d.mts +1 -1
- package/dist/domain/enums/payment-method.enum.mjs +2 -2
- package/dist/domain/errors/pos.errors.d.mts +1 -22
- package/dist/domain/errors/pos.errors.mjs +2 -27
- package/dist/domain/index.d.mts +2 -2
- package/dist/domain/index.mjs +2 -2
- package/dist/domain/sale/tender.d.mts +11 -11
- package/dist/domain/sale/tender.mjs +1 -1
- package/dist/domain/shift/shift-decisions.d.mts +3 -4
- package/dist/domain/shift/shift-decisions.mjs +3 -3
- package/dist/domain/shift/shift.types.d.mts +0 -2
- package/dist/domain/value-objects/shift-policy.vo.d.mts +1 -6
- package/dist/domain/value-objects/shift-policy.vo.mjs +2 -7
- package/dist/engine/capability.errors.d.mts +23 -0
- package/dist/engine/capability.errors.mjs +28 -0
- package/dist/engine/define-pos.mjs +1 -1
- package/dist/engine/index.d.mts +2 -1
- package/dist/engine/index.mjs +3 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/models/shift.model.mjs +1 -1
- package/dist/repositories/shift.repository.d.mts +20 -31
- package/dist/repositories/shift.repository.mjs +30 -44
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,453 +1,10 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- `
|
|
11
|
-
entry, and THROWS on a bridge failure so the outbox retries; a delivery with no marker does nothing.
|
|
12
|
-
- `CloseShiftResult.ledgerPending`. A retried `close` of a shift whose durable post is owed reports it and never posts inline.
|
|
13
|
-
- `shiftClosedEvent` / `shiftForceClosedEvent` are `durability: 'durable'` with `occurrence = shiftId`; inline mode writes the same fixed id.
|
|
14
|
-
- Peer `@classytic/primitives` is now `>=0.31.0` (`./durable-events`). Pinned by `tests/integration/deferred-ledger-post.scenario.test.ts`.
|
|
15
|
-
|
|
16
|
-
### Added — `./grant`: the till's offline grant
|
|
17
|
-
`TillGrant` — branch, register, the branch's `ShiftPolicy`, `OrderDiscountLimits` and the counter-sale rule,
|
|
18
|
-
signed by the deployment; its `iat` is the signed checkpoint. `readTillGrant(token, keyOf, { sn })` reads only a
|
|
19
|
-
whole grant issued to that till. Browser-safe. `checkSaleAgainstGrant` names what a recorded sale did outside its
|
|
20
|
-
grant (discount over the ceiling, an unallowed full comp, made after expiry). The server records each grant it
|
|
21
|
-
issues (`repositories.tillGrant`, model `TillGrant` → `pos_till_grants`, kept 90 days past expiry). Pinned by `tests/unit/till-grant.test.ts` (the device check
|
|
22
|
-
is falsified).
|
|
23
|
-
|
|
24
|
-
### ⚠ Changed — a sale takes stock from `stock/<productId>`, and keeps it until the server's count does
|
|
25
|
-
- Stock lives in its own document, `RecordableStock`: the shape a server publishes to tills, and
|
|
26
|
-
the till's own in free mode. A sale's writes go to `stock`, never to `products`.
|
|
27
|
-
`RecordedSale.stock` lists tracked goods only. `takeFromStock(current, productId, variantSku,
|
|
28
|
-
quantity)` starts from zero when there is no document. A count may go negative.
|
|
29
|
-
- `pos.sale` gains `pending`. Once the server has recorded the sale, its stock still leaves the
|
|
30
|
-
shelf on the device until the order's `metadata.stockIssue` is `posted`. A `failed` issue keeps
|
|
31
|
-
the subtraction.
|
|
32
|
-
- `RecordableProduct` is removed.
|
|
33
|
-
|
|
34
|
-
### Added — a guard: `./domain` and `./commands` stay browser-safe
|
|
35
|
-
|
|
36
|
-
The offline till bundles these two subpaths. `tests/unit/browser-safe.arch.test.ts` fails on any
|
|
37
|
-
runtime import beyond each other and `@classytic/primitives` (no database, no Node built-ins, no
|
|
38
|
-
server folders). Type-only imports may also name repo-core contracts; no server type is allowed
|
|
39
|
-
(the debt list is empty and must stay so). Both checks were broken on purpose to prove them.
|
|
40
|
-
|
|
41
|
-
### ⚠ Changed — the ledger and notification ports take a `ShiftRecord`, not a Mongoose document
|
|
42
|
-
|
|
43
|
-
`IShift`, `PendingLedgerPost` and `PendingLedgerPostTrigger` move into `domain/shift/shift.types.ts`
|
|
44
|
-
(exported from the root and from `./domain`, under the same names). `ShiftRecord` is the shift's
|
|
45
|
-
fields plus an id. `LedgerBridge` and `NotificationBridge` now receive it instead of
|
|
46
|
-
`ShiftDocument`, so the browser-safe declarations no longer reference Mongoose. An implementation
|
|
47
|
-
that called a document method on the shift must read its fields instead; none in this repo did.
|
|
48
|
-
|
|
49
|
-
### Added — `pos.customer.upsert` in the command pack
|
|
50
|
-
|
|
51
|
-
A customer the till created or changed, under its device id. On the reference server, a phone that
|
|
52
|
-
already belongs to another customer keeps that record (a real server aliases the till's id to it).
|
|
53
|
-
Refused ⇒ suppressed; sales keep their customer snapshot. `RecordableCustomer` is exported.
|
|
54
|
-
|
|
55
|
-
### Added — `shift.open` takes a caller-minted `id` and `openedAt`
|
|
56
|
-
|
|
57
|
-
A shift opened offline keeps the till's id and the time its drawer opened, so the device and the
|
|
58
|
-
server name one shift. The register's one-open-shift rule is unchanged. Pinned by
|
|
59
|
-
`tests/integration/open-offline-shift.scenario.test.ts` (id falsified).
|
|
60
|
-
|
|
61
|
-
### Added — the shift report (`@classytic/pos/domain`)
|
|
62
|
-
|
|
63
|
-
`buildShiftReport(shift, orders)` — X while the shift is open, Z once it is final: sales (gross,
|
|
64
|
-
discounts, tax added, tax included, net), refunds, the payment split and cash figures from the
|
|
65
|
-
drawer's own breakdown, cash moves by reason, top items and sales by cashier. One function, so a
|
|
66
|
-
server's report route and an offline till give the same figures for the same sales.
|
|
67
|
-
|
|
68
|
-
### Added — shift decisions (`@classytic/pos/domain`)
|
|
69
|
-
|
|
70
|
-
`seedBreakdown`, `applyCounts`, `isCashRow`, `decideShiftClose`, `decideBlindClose`: the opening
|
|
71
|
-
breakdown, a count's effect, and whether a close may proceed (state machine, counts required from
|
|
72
|
-
`open`, variance gate) as pure functions. The repository persists their result (CAS, ledger and
|
|
73
|
-
events unchanged), and an offline till decides through the same functions.
|
|
74
|
-
|
|
75
|
-
### Added — the sale rules (`@classytic/pos/domain`)
|
|
76
|
-
|
|
77
|
-
Moved here from `@spinekit/pos` so every till decides a sale the same way — the server and an
|
|
78
|
-
offline device alike:
|
|
79
|
-
|
|
80
|
-
- **Tender:** `validateTenderLegs`, `allocateTender` (tendered → applied → change; only APPLIED is
|
|
81
|
-
money), `assertTenderSettles`, `tenderSummary`, `createTenderMethodResolver`,
|
|
82
|
-
`DEFAULT_TENDER_METHOD_RESOLVER`, and the types `TenderPolicy`, `TenderMethodDeclaration`,
|
|
83
|
-
`PosTenderSummary`, …
|
|
84
|
-
- **Order discount:** `decideOrderDiscount({ subtotalMinor, requestedMinor, reason, authorized,
|
|
85
|
-
approvedBy, limits })` — pure and sync; refuses (never clamps) naming `authority | reason |
|
|
86
|
-
limit | full-comp`. Also `discountCeilingMinor`, `OrderDiscountLimits`, `PosOrderDiscountRecord`.
|
|
87
|
-
- **Errors**, now `PosError` subclasses with unchanged codes and statuses: `TenderMismatchError`
|
|
88
|
-
(`pos.tender.mismatch`, now with `details`), `TenderMethodRefusedError`,
|
|
89
|
-
`OrderDiscountRefusedError`, `PriceOverrideRefusedError`.
|
|
90
|
-
- `mongoose`, `@classytic/mongokit` and `@classytic/validation` are now OPTIONAL peers: only the engine needs them, and a
|
|
91
|
-
browser till that imports `@classytic/pos/domain` should not have them installed.
|
|
92
|
-
|
|
93
|
-
### Changed — `getActiveShift` refuses to guess the register (BREAKING for multi-register callers)
|
|
94
|
-
|
|
95
|
-
Without `registerId`, and with several registers active at the branch, `getActiveShift` threw
|
|
96
|
-
nothing and returned the most recently opened shift — so a till that had not named its register
|
|
97
|
-
(a reload, a second tab) rang sales into another cashier's drawer, surfacing only as an
|
|
98
|
-
unexplained variance at close. It now throws `RegisterRequiredError` (409,
|
|
99
|
-
`POS_REGISTER_REQUIRED`) whose `meta.registers` lists each active register's `registerId`,
|
|
100
|
-
`shiftId`, `state` and `openedAt`. One active shift, or a named register, behaves as before.
|
|
101
|
-
|
|
102
|
-
### Changed — peer floors
|
|
103
|
-
|
|
104
|
-
`@classytic/order` `>=0.19.0` (was `>=0.17.0`), `@classytic/mongokit` `>=3.41.0`, `@classytic/primitives` `>=0.32.0`, `@classytic/repo-core` `>=0.31.0`, `@classytic/tax-core` `>=0.6.0`, `@classytic/validation` `>=0.6.0`, `mongoose` `>=9.11.0`.
|
|
105
|
-
|
|
106
|
-
## [0.6.0] — 2026-09-04
|
|
107
|
-
|
|
108
|
-
### Added
|
|
109
|
-
|
|
110
|
-
- `ShiftRepository.findActiveByBranch(organizationId)` — returns all active shifts for a branch (dashboard "registers open now" widget); routed through `findAll` so the tenant plugin injects and casts `organizationId`
|
|
111
|
-
|
|
112
|
-
### Changed — peer floors raised to current
|
|
113
|
-
|
|
114
|
-
- `@classytic/mongokit` `>=3.33.0` → **`>=3.36.0`**
|
|
115
|
-
- `@classytic/primitives` `>=0.23.0` → **`>=0.26.4`**
|
|
116
|
-
- `@classytic/repo-core` `>=0.24.0` → **`>=0.26.0`**
|
|
117
|
-
|
|
118
|
-
## [0.5.0] — 2026-08-26
|
|
119
|
-
|
|
120
|
-
### Fixed — CRITICAL: cash drawer identified by kind, not by code spelling
|
|
121
|
-
|
|
122
|
-
Five call sites in `ShiftRepository` located the cash breakdown row with
|
|
123
|
-
`r.method === 'cash'`. On any deployment whose cash code is not literally
|
|
124
|
-
`"cash"` — a Spanish till (`'efectivo'`), a French one (`'espèces'`), or the
|
|
125
|
-
package's own documented `'cash_register_3'` — every comparison matched nothing
|
|
126
|
-
silently:
|
|
127
|
-
|
|
128
|
-
- the opening float was written to no row (`open()`)
|
|
129
|
-
- `recordCashMovement` could not find a row to increment
|
|
130
|
-
- `expectedCash` read `null` on every close projection
|
|
131
|
-
- the variance gate skipped entirely (`if (expectedAmount != null)` never fired)
|
|
132
|
-
- the till closed unreconciled with no error
|
|
133
|
-
|
|
134
|
-
The row already carried the right answer: `open()` resolves `methodKind` on the
|
|
135
|
-
line immediately above the first of those comparisons.
|
|
136
|
-
|
|
137
|
-
**Fix:** `isCashRow(r)` keys on `r.methodKind === PAYMENT_METHOD_KIND.CASH` from
|
|
138
|
-
`@classytic/primitives/payment-method-kind`. Legacy rows written before
|
|
139
|
-
`methodKind` existed (Mongoose default `'other'` for absent field) fall back to
|
|
140
|
-
`r.method === 'cash'` so an in-flight shift from an older deployment remains
|
|
141
|
-
reconcilable. All five call sites replaced. Covered by
|
|
142
|
-
`tests/unit/cash-row-is-kind-not-code.test.ts` with non-English codes on purpose
|
|
143
|
-
— a test seeding `'cash'` passes with or without the fix and proves nothing.
|
|
144
|
-
|
|
145
|
-
## [0.4.0] — 2026-08-17
|
|
146
|
-
|
|
147
|
-
### Fixed — CRITICAL: the Z-report journal entry could post twice
|
|
148
|
-
|
|
149
|
-
`close()` and `forceClose()` invoked `ledger.onShiftClosed` **before** the FSM
|
|
150
|
-
compare-and-set, outside any transaction. Three shipped triggers close the same
|
|
151
|
-
shift (the lazy-close at register open, the oversight endpoint, the EOD cron),
|
|
152
|
-
so two of them reading `state: 'open'` at the same instant both passed
|
|
153
|
-
`canTransition` and **both posted a journal entry for one day's cash**. One won
|
|
154
|
-
the state write; the loser threw `IllegalShiftTransitionError` *after* its entry
|
|
155
|
-
had committed, and hosts caught and logged it. Two Z-reports in the GL, one
|
|
156
|
-
shift document, nothing errored. The crash variant was worse: a process dying
|
|
157
|
-
between the post and the state write left the shift `open` with
|
|
158
|
-
`journalEntryId` unset, so every retry posted another entry forever.
|
|
159
|
-
|
|
160
|
-
The bridge now runs **after** the CAS, so it is unreachable to every caller but
|
|
161
|
-
one, and the claim is durable so a crash converges instead of re-posting.
|
|
162
|
-
|
|
163
|
-
### Changed — BREAKING
|
|
164
|
-
|
|
165
|
-
- **`LedgerBridge.onShiftClosed` takes a request object with a REQUIRED
|
|
166
|
-
`idempotencyKey`**: `onShiftClosed({ idempotencyKey, shift, trigger, attempt }, ctx)`.
|
|
167
|
-
The key is deterministic — `pos:shift:<shiftId>:close`, exported as
|
|
168
|
-
`shiftCloseIdempotencyKey(shiftId)`. The old contract ("idempotency is the
|
|
169
|
-
host's responsibility; the bridge SHOULD return the same id on retry") was
|
|
170
|
-
prose with nothing enforcing it; the resume path now depends on it, so it is
|
|
171
|
-
a compiler-enforced field. Hosts must dedupe on it.
|
|
172
|
-
- **`close()` and `forceClose()` return `CloseShiftResult`**, not
|
|
173
|
-
`ShiftDocument`: `{ shift, outcome, journalEntryId, ledgerPosted, ledgerError? }`
|
|
174
|
-
where `outcome` is `'closed' | 'already-closed' | 'resumed'`. A caller that
|
|
175
|
-
lost the race, or that is retrying a crashed close, needs to distinguish those
|
|
176
|
-
without catching an exception. **A losing caller's `countedByMethod` is not
|
|
177
|
-
applied** — check `outcome` before telling a human their drawer count landed.
|
|
178
|
-
- **`forceClose()` on an already-terminal shift no longer throws
|
|
179
|
-
`ShiftFinalizedError`** — it returns `{ outcome: 'already-closed' }`. Same for
|
|
180
|
-
`close()`. Every MUTATING verb (`pause`, `resume`, `recordCashMovement`,
|
|
181
|
-
`blindClose`) still throws; only the two close verbs converge.
|
|
182
|
-
|
|
183
|
-
### Added
|
|
184
|
-
|
|
185
|
-
- `Shift.pendingLedgerPost` — a durable claim marker written in the SAME CAS
|
|
186
|
-
that moves the shift to its terminal state and cleared by the write that
|
|
187
|
-
records `journalEntryId`. Non-null means "a close won the CAS and the entry
|
|
188
|
-
is not yet recorded"; retrying `close`/`forceClose` resumes from it.
|
|
189
|
-
- `ShiftRepository.findShiftsWithPendingLedgerPost(olderThan?)` — the
|
|
190
|
-
operational sweep for shifts stuck mid-post (backed by a partial index). An
|
|
191
|
-
unobservable stuck state converges only by luck.
|
|
192
|
-
- `shiftCloseIdempotencyKey(shiftId)` + the `ShiftClosePosting` type, exported
|
|
193
|
-
from the root and `@classytic/pos/domain`.
|
|
194
|
-
- `mockIdempotentLedgerBridge()` in the test helpers — a *correct* host adapter
|
|
195
|
-
that dedupes on the key, so a test can assert "one shift, one journal entry"
|
|
196
|
-
independently of invocation count.
|
|
197
|
-
|
|
198
|
-
## 1.0.0 - 2026-07-29
|
|
199
|
-
|
|
200
|
-
### Changed
|
|
201
|
-
- **License:** relicensed from MIT to the **Classytic Source-Available License** (Community & Commercial). Evaluation/development use remains free; production use now requires a commercial license from Classytic LLC. See `LICENSE`.
|
|
202
|
-
- Major bump marks the license change; versions published before 1.0.0 remain under their original MIT terms.
|
|
203
|
-
|
|
204
|
-
## [0.8.0] — 2026-07-27
|
|
205
|
-
|
|
206
|
-
### Added — three active-shift read verbs, absorbed from host shims
|
|
207
|
-
|
|
208
|
-
`getActiveShift` and `getByIdUnscoped` existed as hand-rolled helpers in the
|
|
209
|
-
be-prod host (`resources/sales/pos/shift.repository.ts`, whose own docstring
|
|
210
|
-
already said "repository now lives in @classytic/pos"). Every fork would have
|
|
211
|
-
had to re-derive them — and the host copy had already drifted, hand-casting
|
|
212
|
-
`organizationId` to an ObjectId and keeping a private duplicate of the
|
|
213
|
-
active-state set. They are kernel domain logic, so they live here now:
|
|
214
|
-
|
|
215
|
-
- **`getActiveShift(ctx, registerId?)`** — the active shift (`open | paused |
|
|
216
|
-
blind_closed`) or `null`. Encodes which states count as active
|
|
217
|
-
(`ACTIVE_SHIFT_STATES`) plus the at-most-one invariant the
|
|
218
|
-
`uniq_active_shift_per_register` partial index enforces. Routed through the
|
|
219
|
-
inherited `findAll`, so the tenant plugin injects AND CASTS the scope field —
|
|
220
|
-
a hex-string `organizationId` now just works, with no host-side `isValid`
|
|
221
|
-
dance. Pass `registerId` on any multi-till deployment; omitting it returns an
|
|
222
|
-
arbitrary active shift for the branch (single-register back-compat).
|
|
223
|
-
- **`getByIdUnscoped(id)`** — deliberately UNSCOPED lean read so a host can
|
|
224
|
-
distinguish "shift does not exist" (404) from "shift belongs to another
|
|
225
|
-
branch" (403); a tenant-scoped read collapses both to `null`. Raw `Model`
|
|
226
|
-
read, flagged per CLAUDE.md (same documented exception as `findStaleShifts`),
|
|
227
|
-
with `deletedAt: null` explicit because the soft-delete plugin is bypassed
|
|
228
|
-
too. **Caller contract: compare `organizationId` before acting — this grants
|
|
229
|
-
no authority.**
|
|
230
|
-
- `findStaleShifts` is now listed as a canonical verb (it always existed) and no
|
|
231
|
-
longer inlines its own copy of the active-state array.
|
|
232
|
-
|
|
233
|
-
Hosts must NOT re-add these or an `ACTIVE_SHIFT_STATES` copy — importing the
|
|
234
|
-
kernel's is the whole point.
|
|
235
|
-
|
|
236
|
-
### Changed
|
|
237
|
-
|
|
238
|
-
- Peers: `@classytic/mongokit` `>=3.22.0` → **`>=3.25.0`**, `@classytic/repo-core`
|
|
239
|
-
`>=0.13.0` → **`>=0.17.0`** (mongokit 3.25+ itself requires repo-core 0.17, so
|
|
240
|
-
every consumer inherits that floor — declaring it makes the constraint visible
|
|
241
|
-
instead of an install-time ERESOLVE).
|
|
242
|
-
- Toolchain: tsdown `^0.21.5` → **`^0.22.13`**, TypeScript `^5.7` → **`^7.0.2`**.
|
|
243
|
-
Output extensions are UNCHANGED (`.mjs` / `.d.mts`), so the exports map and
|
|
244
|
-
every consumer's deep imports are untouched. `tsconfig` gained
|
|
245
|
-
`"types": ["node"]` — TS7 native needs node globals (`console`, `AbortSignal`)
|
|
246
|
-
named explicitly.
|
|
247
|
-
|
|
248
|
-
148 tests green (10 new).
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
## [0.7.0] — unpublished (2026-07-23)
|
|
252
|
-
|
|
253
|
-
### Added — `incrementSales({ dedupeRef })` exactly-once claim
|
|
254
|
-
|
|
255
|
-
- `IncrementSalesInput.dedupeRef?: string` — optional claim-first dedupe key.
|
|
256
|
-
When set, the repo insert-first claims `(shiftId, dedupeRef)` in the new
|
|
257
|
-
`pos_shift_sale_dedupe` collection BEFORE applying the `$inc`; a duplicate
|
|
258
|
-
claim (unique-index hit) skips the increment and returns
|
|
259
|
-
`{ applied: false, reason: 'duplicate' }`. Motivation: hosts fire
|
|
260
|
-
`incrementSales` from order-create hooks that re-run when the surrounding
|
|
261
|
-
Mongo transaction retries transiently — the shift `$inc` is NOT part of that
|
|
262
|
-
transaction, so a naive re-run double-counted the sale. Callers pass a
|
|
263
|
-
retry-stable identity (e.g. `shift-sale:{orderNumber}:{method}` —
|
|
264
|
-
orderNumber survives a txn retry; a per-attempt `_id` does not). Claim
|
|
265
|
-
order is claim-then-`$inc` deliberately: the residual crash window
|
|
266
|
-
under-counts once (reconcilable at close) instead of double-counting money.
|
|
267
|
-
- `incrementSales` now returns `Promise<IncrementSalesResult>`
|
|
268
|
-
(`{ applied, reason? }`) instead of `void` — additive for callers that
|
|
269
|
-
ignored the old `void`. Zero/negative amounts return
|
|
270
|
-
`{ applied: false, reason: 'zero-amount' }` (previously silent return).
|
|
271
|
-
- New model `ShiftSaleDedupe` (`pos_shift_sale_dedupe`), registered in
|
|
272
|
-
`POS_MODEL_NAMES` / `DEFAULT_COLLECTIONS` / `PosModels`. Documented
|
|
273
|
-
deviations (mirrors `@classytic/order`'s `order_idempotency` exemption —
|
|
274
|
-
ephemeral claim state): NO soft delete (a soft-deleted claim would re-admit
|
|
275
|
-
a duplicate `$inc`), NO tenant field (scoping is structural via the
|
|
276
|
-
globally-unique `shiftId`); 30-day TTL reaps stale claims. New exports:
|
|
277
|
-
`IShiftSaleDedupe`, `ShiftSaleDedupeDocument`, `ShiftSaleDedupeModel`,
|
|
278
|
-
`IncrementSalesResult`.
|
|
279
|
-
- `ShiftRepositoryConfig.dedupeModel?` — wired automatically by
|
|
280
|
-
`createPosEngine`; a `dedupeRef` call on a repo constructed without the
|
|
281
|
-
model throws (fail loud, never silently double-count).
|
|
282
|
-
|
|
283
|
-
## [0.6.0] — unpublished (2026-07-23)
|
|
284
|
-
|
|
285
|
-
Combined release reconciling two concurrently-developed change sets into one
|
|
286
|
-
coherent build (both were staged locally at `0.5.2`): the multi-register
|
|
287
|
-
feature (minor) and the `deletedAt` wire-hygiene fix.
|
|
288
|
-
|
|
289
|
-
### Added — POS registers (multi-register)
|
|
290
|
-
|
|
291
|
-
- New `Register` model + `RegisterRepository`: a register/till/terminal is the
|
|
292
|
-
point of sale a cashier signs on to. A branch (`organizationId`) may have
|
|
293
|
-
MANY registers; the `Shift` partial-unique index
|
|
294
|
-
(`uniq_active_shift_per_register`) permits one active shift PER register, so
|
|
295
|
-
cashiers on different registers in the same branch run parallel shifts.
|
|
296
|
-
`code` is unique per branch among live (non-soft-deleted) registers — a
|
|
297
|
-
deleted register frees its code for reuse. Vertical-agnostic (retail till,
|
|
298
|
-
restaurant terminal, clinic desk, wash bay). New public exports:
|
|
299
|
-
`RegisterRepository`, `RegisterRepositoryConfig`, `IRegister`,
|
|
300
|
-
`RegisterDocument`, `RegisterModel`.
|
|
301
|
-
|
|
302
|
-
### Fixed — `deletedAt` no longer leaks onto the wire
|
|
303
|
-
|
|
304
|
-
- The soft-delete marker `deletedAt` is a persistence-only field (it exists so
|
|
305
|
-
`softDeletePlugin` can `$set` it and the partial-unique indexes can filter on
|
|
306
|
-
`{ deletedAt: null }`), but it was serializing into API responses. Hosts
|
|
307
|
-
serialize POS docs on paths that bypass framework response-schema hygiene and
|
|
308
|
-
fall through to Mongoose serialization — `raw` routes (`POST /pos/shifts/open`)
|
|
309
|
-
via Fastify `JSON.stringify` → `doc.toJSON()`, and Arc's action pipeline
|
|
310
|
-
(`close`/`reconcile`) via `sendControllerResponse` → `rawData.toJSON()` — so
|
|
311
|
-
the model must hide the field itself.
|
|
312
|
-
- `Shift` and `Register` now declare `deletedAt` with `select: false` (covers
|
|
313
|
-
`.lean()` reads) and strip it via `toJSON`/`toObject` transforms (cover every
|
|
314
|
-
hydrated-document path) through the shared `hideSoftDeleteField` helper. No
|
|
315
|
-
behavior change to soft-delete itself: the field is still stored, still drives
|
|
316
|
-
the partial-unique indexes, and is still queryable with an explicit
|
|
317
|
-
`.select('+deletedAt')`.
|
|
318
|
-
|
|
319
|
-
## [0.5.1] — unpublished (2026-07-22)
|
|
320
|
-
|
|
321
|
-
### Changed — event infra consolidated onto `@classytic/primitives/event-infra`
|
|
322
|
-
|
|
323
|
-
- `InProcessPosBus` is now a thin subclass of primitives' shared
|
|
324
|
-
`InProcessEventBus` (name `in-process-pos`, log label `pos` — wire
|
|
325
|
-
behavior identical, gains `publishMany`). `MemoryOutboxStore` is
|
|
326
|
-
re-exported from `@classytic/primitives/event-infra` instead of a local
|
|
327
|
-
copy (gains `all()` / `clear()` test helpers). `createPosEvent` delegates
|
|
328
|
-
to primitives' `createScopedEvent`. No public API or event-shape changes.
|
|
329
|
-
- `@classytic/primitives` peer floor raised to `>=0.13.0` (the
|
|
330
|
-
`/event-infra` subpath + `createScopedEvent`).
|
|
331
|
-
|
|
332
|
-
## [0.5.0] — unpublished (2026-07-22)
|
|
333
|
-
|
|
334
|
-
### Added — engine lifecycle: `destroy()`
|
|
335
|
-
|
|
336
|
-
- **`PosEngine.destroy()`** — closes the self-created `InProcessPosBus`
|
|
337
|
-
(skipped when the host injected `eventTransport`). The `outbox` store is
|
|
338
|
-
always host-provided and is never touched.
|
|
339
|
-
- `destroy()` follows the fleet ownsBus convention (manufacturing/purchase
|
|
340
|
-
pattern): only what the engine itself created is closed; a host-injected
|
|
341
|
-
transport is the host's to close. Idempotent — a second call is a no-op.
|
|
342
|
-
Mongoose models/connection are untouched (host-owned).
|
|
343
|
-
- Lifecycle coverage in `tests/integration/engine-lifecycle.test.ts`.
|
|
344
|
-
|
|
345
|
-
## [0.4.0] — unpublished (2026-07-22)
|
|
346
|
-
|
|
347
|
-
### Changed — Shift money fields now REJECT floats at the persistence layer (new peer: `@classytic/validation >=0.2.0`)
|
|
348
|
-
|
|
349
|
-
- Every money-bearing Shift field now carries the shared
|
|
350
|
-
`mongooseMinorUnits` validator from `@classytic/validation/money`:
|
|
351
|
-
root cash totals (`openingCash`, `expectedCash`, `countedCash`,
|
|
352
|
-
`cashDifference`, `salesTotal`, `refundTotal`), every
|
|
353
|
-
`paymentBreakdown` amount (`openingAmount`, `salesAmount`, `taxAmount`,
|
|
354
|
-
`refundAmount`, `refundTaxAmount`, `cashInAmount`, `cashOutAmount`,
|
|
355
|
-
`expectedAmount`, `countedAmount`, `difference`), and
|
|
356
|
-
`cashMovements[].amount`. The repository verbs (`incrementSales`,
|
|
357
|
-
`recordCashMovement`) already rejected non-integer amounts — but a
|
|
358
|
-
direct `create`/`update` through the inherited mongokit verbs persisted
|
|
359
|
-
major-unit floats silently. Now the schema fails loudly with
|
|
360
|
-
`"<label> must be an integer in minor units (e.g. paisa), not major units"`.
|
|
361
|
-
- Sign semantics preserved per field's domain: magnitudes keep `min: 0`
|
|
362
|
-
(direction lives in `cashMovements[].type`); `cashDifference` /
|
|
363
|
-
`paymentBreakdown[].difference` (counted − expected) stay legitimately
|
|
364
|
-
SIGNED; nullable reconciliation fields still accept `null`.
|
|
365
|
-
- `@classytic/validation >=0.2.0` added as a peer dependency (dev
|
|
366
|
-
`^0.2.0`), matching the fleet convention (purchase, flow, order).
|
|
367
|
-
- Breaking-leaning for hosts that were (incorrectly) storing major-unit
|
|
368
|
-
floats — hence the minor bump. Integer-minor-unit callers are unaffected.
|
|
369
|
-
- Regression coverage: `tests/unit/shift-money-minor-units.test.ts`.
|
|
370
|
-
|
|
371
|
-
## [0.3.1] — 2026-07-16
|
|
372
|
-
|
|
373
|
-
### Fixed
|
|
374
|
-
|
|
375
|
-
- injectTenantField no longer force-indexes the tenant field: the compound
|
|
376
|
-
prepend makes the tenant the leading key of every index, so the bare single
|
|
377
|
-
was a redundant prefix paid on every insert (PACKAGE_RULES P11.1, fleet
|
|
378
|
-
index audit). A dedicated tenant index is still created when a schema
|
|
379
|
-
declares no compounds to prepend. Index-declaration change only.
|
|
380
|
-
|
|
381
|
-
## [0.3.0] — unpublished (2026-07-15)
|
|
382
|
-
|
|
383
|
-
### Changed — mongokit 3.22 `applyTransition()` adopted (peer floors: mongokit >=3.22.0, repo-core >=0.13.0, primitives >=0.11.0)
|
|
384
|
-
|
|
385
|
-
- Shift lifecycle (`pause` / `resume` via the shared helper, plus
|
|
386
|
-
`blindClose` / `close` / `forceClose`) rides `applyTransition` with the
|
|
387
|
-
new verb-closing `shiftMachine(verb)` adapter over the FSM module —
|
|
388
|
-
pre-flight AND race diagnosis throw the verb-keyed
|
|
389
|
-
`IllegalShiftTransitionError`, now with the ON-DISK state on
|
|
390
|
-
now-illegal races (previously the stale pre-read); pure races remap to
|
|
391
|
-
the historical shape. Clean registry install.
|
|
392
|
-
|
|
393
|
-
## 0.2.0 — Stack upgrade + PACKAGE_RULES compliance
|
|
394
|
-
|
|
395
|
-
### Fixed (behavioral) — 2026-07-05 addendum
|
|
396
|
-
|
|
397
|
-
- **Ghost-event publish under host sessions (§P8.1).** `dispatch` published
|
|
398
|
-
to the transport regardless of `ctx.session` — a host rollback left
|
|
399
|
-
subscribers having seen an event for a write that never landed. Now:
|
|
400
|
-
session + NO outbox throws the new `UnmanagedSessionError`
|
|
401
|
-
(`POS_SESSION_UNMANAGED`); session + outbox is durable-relay-only (row
|
|
402
|
-
joins the host tx, immediate publish skipped).
|
|
403
|
-
|
|
404
|
-
Peer minimums raised to `@classytic/mongokit >=3.16.0`, `@classytic/repo-core >=0.6.0`,
|
|
405
|
-
`@classytic/primitives >=0.7.2`. No new features — correctness + compliance.
|
|
406
|
-
|
|
407
|
-
### Added
|
|
408
|
-
- **Transactional outbox support (P8 / §5.5 / §16).** Engine + repository accept
|
|
409
|
-
`outbox?: OutboxStore`. Every domain event now flows through one session-bound
|
|
410
|
-
`dispatch()`: `outbox.save` runs first under `ctx.session` and **propagates** on
|
|
411
|
-
failure (the host's transaction rolls back); `transport.publish` runs second and
|
|
412
|
-
**swallows** failures (the host relay re-delivers). Both sides share one envelope
|
|
413
|
-
`meta.id` so relay re-publish is dedup-able. `MemoryOutboxStore` shipped from
|
|
414
|
-
`@classytic/pos/events` for tests/dev (host owns production durability).
|
|
415
|
-
- **Zod event catalog (§18).** `posEventDefinitions[]` exported from the package
|
|
416
|
-
root and `/events`; one Zod schema per `POS_EVENTS` constant drives runtime
|
|
417
|
-
validation, static types, and arc `EventRegistry`/OpenAPI introspection. No-drift
|
|
418
|
-
invariant test added.
|
|
419
|
-
- **`pos:shift.variance.detected`** is now emitted at close when the variance gate
|
|
420
|
-
trips (including manager-overridden closes) — previously a declared-but-unused
|
|
421
|
-
constant.
|
|
422
|
-
- **Capability boot gate.** `createPosEngine` asserts `repo.capabilities.transactions`
|
|
423
|
-
at boot (fail loud, not a cryptic driver error on the first close); opt out with
|
|
424
|
-
`allowNonTransactional: true` for standalone-Mongo dev.
|
|
425
|
-
- `ctx.signal` / `ctx.retryPolicy` are now threaded to every repo call via
|
|
426
|
-
`repoOptionsFromCtx` (cooperative cancellation + driver-round-trip retries).
|
|
427
|
-
|
|
428
|
-
### Fixed
|
|
429
|
-
- **Money integrity.** `incrementSales` and `recordCashMovement` reject non-integer
|
|
430
|
-
(fractional) minor-unit amounts instead of `$inc`-ing float drift into totals.
|
|
431
|
-
- **Event-name drift.** `pause`/`resume` emitted `pos:shift.pause`/`pos:shift.resume`;
|
|
432
|
-
now correctly emit the catalog names `pos:shift.paused`/`pos:shift.resumed`.
|
|
433
|
-
- **Soft-delete leak in `findStaleShifts`.** The raw cross-tenant cron scan now
|
|
434
|
-
carries an explicit `deletedAt: null` guard so the EOD backstop can't revive a
|
|
435
|
-
soft-deleted shift.
|
|
436
|
-
- **Build hygiene.** `declarationMap` / `sourceMap` turned OFF in tsconfig (they leak
|
|
437
|
-
source); `exactOptionalPropertyTypes: true` enabled (mandatory).
|
|
438
|
-
|
|
439
|
-
## 0.1.1 — Initial public release
|
|
440
|
-
|
|
441
|
-
- `createPosEngine()` factory with `connection` + `defaultPolicy`
|
|
442
|
-
- `Shift` model + Mongoose schema (3 indexes, all justified)
|
|
443
|
-
- `ShiftRepository` extending mongokit `Repository<IShift>` with domain verbs:
|
|
444
|
-
`open`, `pause`, `resume`, `recordCashMovement`, `incrementSales`,
|
|
445
|
-
`blindClose`, `close`, `forceClose`
|
|
446
|
-
- 5-state FSM: `open` → `paused` ↔ `open` → `blind_closed` → `closed`;
|
|
447
|
-
any active state → `orphaned_closed` via `forceClose`
|
|
448
|
-
- Bridges: `ledger` (JE emission), `policy` (per-branch policy resolver),
|
|
449
|
-
`notification` (variance + orphan alerts)
|
|
450
|
-
- Multi-tenant scoping via mongokit `multiTenantPlugin` (default ON)
|
|
451
|
-
- 7-year soft-delete retention via `softDeletePlugin`
|
|
452
|
-
- Zod v4 body schemas at `@classytic/pos/schemas` for arc 2.11 wiring
|
|
453
|
-
- Test fixtures at `@classytic/pos/testing` for host integration tests
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.8.0 — 2026-11-28
|
|
6
|
+
|
|
7
|
+
Peers raised to the latest published: `@classytic/mongokit >=3.47.0`, `@classytic/order >=0.24.0`, `@classytic/primitives >=0.39.0`, `@classytic/repo-core >=0.39.0`, `@classytic/tax-core >=0.7.0`, `mongoose >=9.13.1`.
|
|
8
|
+
|
|
9
|
+
- `ShiftRepository.findStaleShifts` returns each shift's `salesCount` and `salesTotal` (minor units). No consumer action.
|
|
10
|
+
- `TenderSettlement` gains `acquirer-captured` (a card captured at the counter); it settles immediately like cash and is never change-capable by default.
|
|
@@ -23,7 +23,7 @@ export declare class PosCommandRejection extends Error {
|
|
|
23
23
|
}
|
|
24
24
|
interface BreakdownRow {
|
|
25
25
|
method: string;
|
|
26
|
-
methodKind
|
|
26
|
+
methodKind: string;
|
|
27
27
|
openingAmount: number;
|
|
28
28
|
salesAmount: number;
|
|
29
29
|
refundAmount: number;
|
|
@@ -82,10 +82,12 @@ export interface RecordedSale {
|
|
|
82
82
|
quantity: number;
|
|
83
83
|
}>;
|
|
84
84
|
/** What the drawer took, by shift payment method (applied amounts — change excluded). */
|
|
85
|
+
/** `methodKind` per leg, as on a refund: a method the shift has not seen yet still lands on the right row kind. */
|
|
85
86
|
takings: {
|
|
86
87
|
totalMinor: number;
|
|
87
88
|
byMethod: ReadonlyArray<{
|
|
88
89
|
method: string;
|
|
90
|
+
methodKind: string;
|
|
89
91
|
amountMinor: number;
|
|
90
92
|
}>;
|
|
91
93
|
};
|
|
@@ -60,9 +60,10 @@ function takenStock(sale, current) {
|
|
|
60
60
|
/** The shift with a sale's takings added: count, total, and each method's sales. */
|
|
61
61
|
function addTakings(shift, takings, at) {
|
|
62
62
|
const rows = new Map(shift.paymentBreakdown.map((row) => [row.method, { ...row }]));
|
|
63
|
-
for (const { method, amountMinor } of takings.byMethod) {
|
|
63
|
+
for (const { method, methodKind, amountMinor } of takings.byMethod) {
|
|
64
64
|
const row = rows.get(method) ?? {
|
|
65
65
|
method,
|
|
66
|
+
methodKind,
|
|
66
67
|
openingAmount: 0,
|
|
67
68
|
salesAmount: 0,
|
|
68
69
|
refundAmount: 0,
|
|
@@ -132,9 +133,10 @@ function addRefund(order, refund) {
|
|
|
132
133
|
/** The shift with a refund paid out of its drawer: each method's refunds, count and total. */
|
|
133
134
|
function addRefundToShift(shift, refund) {
|
|
134
135
|
const rows = new Map(shift.paymentBreakdown.map((row) => [row.method, { ...row }]));
|
|
135
|
-
for (const { method, amountMinor } of refund.byMethod) {
|
|
136
|
+
for (const { method, methodKind, amountMinor } of refund.byMethod) {
|
|
136
137
|
const row = rows.get(method) ?? {
|
|
137
138
|
method,
|
|
139
|
+
methodKind,
|
|
138
140
|
openingAmount: 0,
|
|
139
141
|
salesAmount: 0,
|
|
140
142
|
refundAmount: 0,
|
|
@@ -11,7 +11,7 @@ import { PaymentMethodKind } from "@classytic/primitives/payment-method-kind";
|
|
|
11
11
|
* `SHIFT_PAYMENT_METHODS` is only the out-of-the-box DEFAULT policy + the seed
|
|
12
12
|
* for kind resolution — never a hard constraint on what a host may accept.
|
|
13
13
|
*/
|
|
14
|
-
export declare const SHIFT_PAYMENT_METHODS: readonly ['cash', 'card', '
|
|
14
|
+
export declare const SHIFT_PAYMENT_METHODS: readonly ['cash', 'card', 'mobile_money', 'bank_transfer'];
|
|
15
15
|
/** A payment method CODE (open string). Baseline defaults in {@link SHIFT_PAYMENT_METHODS}. */
|
|
16
16
|
export type ShiftPaymentMethod = string;
|
|
17
17
|
/** Default baseline code → universal kind. */
|
|
@@ -14,14 +14,14 @@ import { PAYMENT_METHOD_KIND } from "@classytic/primitives/payment-method-kind";
|
|
|
14
14
|
const SHIFT_PAYMENT_METHODS = [
|
|
15
15
|
"cash",
|
|
16
16
|
"card",
|
|
17
|
-
"
|
|
17
|
+
"mobile_money",
|
|
18
18
|
"bank_transfer"
|
|
19
19
|
];
|
|
20
20
|
/** Default baseline code → universal kind. */
|
|
21
21
|
const DEFAULT_METHOD_KINDS = {
|
|
22
22
|
cash: PAYMENT_METHOD_KIND.CASH,
|
|
23
23
|
card: PAYMENT_METHOD_KIND.CARD,
|
|
24
|
-
|
|
24
|
+
mobile_money: PAYMENT_METHOD_KIND.MOBILE_MONEY,
|
|
25
25
|
bank_transfer: PAYMENT_METHOD_KIND.BANK_TRANSFER
|
|
26
26
|
};
|
|
27
27
|
/** Every valid kind value — for the mongoose enum on `paymentBreakdown.methodKind`. */
|
|
@@ -2,12 +2,7 @@ import { HttpError } from "@classytic/repo-core/errors";
|
|
|
2
2
|
//#region src/domain/errors/pos.errors.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* `status` makes every POS throwable satisfy `HttpError` from
|
|
5
|
-
* `@classytic/repo-core/errors
|
|
6
|
-
* the correct status natively — no per-host `errorMapper`. Without it every
|
|
7
|
-
* POS error reached the client as `arc.internal_error` / 500, including
|
|
8
|
-
* `ShiftNotFoundError` (404) and `ActiveShiftAlreadyOpenError` (409).
|
|
9
|
-
*
|
|
10
|
-
* Defaults to 422; subclasses override with `readonly status = N` (a subclass
|
|
5
|
+
* `@classytic/repo-core/errors`. Defaults to 422; subclasses override with `readonly status = N` (a subclass
|
|
11
6
|
* field initializer runs after this constructor, so it wins).
|
|
12
7
|
*/
|
|
13
8
|
export declare class PosError extends Error implements HttpError {
|
|
@@ -110,22 +105,6 @@ export declare class ReasonCodePolicyInvalidError extends PosError {
|
|
|
110
105
|
readonly status = 409;
|
|
111
106
|
constructor();
|
|
112
107
|
}
|
|
113
|
-
export declare class PosCapabilityError extends Error {
|
|
114
|
-
readonly code = "POS_CAPABILITY";
|
|
115
|
-
readonly status = 422;
|
|
116
|
-
readonly missing: readonly string[];
|
|
117
|
-
/**
|
|
118
|
-
* `true` when the backend never ANSWERED (the connection was not open at
|
|
119
|
-
* bind, or the driver exposed no topology) rather than answering "no".
|
|
120
|
-
* Both refuse — an unobserved outcome is never a positive one (AGENTS.md
|
|
121
|
-
* FAIL LOUD rule 3) — but the operator's fix is completely different, so
|
|
122
|
-
* the message has to distinguish them.
|
|
123
|
-
*/
|
|
124
|
-
readonly indeterminate: boolean;
|
|
125
|
-
constructor(missing: readonly string[], opts?: {
|
|
126
|
-
indeterminate?: boolean;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
108
|
/** The tender does not settle the sale, and the deployment's `TenderPolicy` does not permit that shape. */
|
|
130
109
|
export declare class TenderMismatchError extends PosError {
|
|
131
110
|
readonly status = 400;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
//#region src/domain/errors/pos.errors.ts
|
|
2
2
|
/**
|
|
3
3
|
* `status` makes every POS throwable satisfy `HttpError` from
|
|
4
|
-
* `@classytic/repo-core/errors
|
|
5
|
-
* the correct status natively — no per-host `errorMapper`. Without it every
|
|
6
|
-
* POS error reached the client as `arc.internal_error` / 500, including
|
|
7
|
-
* `ShiftNotFoundError` (404) and `ActiveShiftAlreadyOpenError` (409).
|
|
8
|
-
*
|
|
9
|
-
* Defaults to 422; subclasses override with `readonly status = N` (a subclass
|
|
4
|
+
* `@classytic/repo-core/errors`. Defaults to 422; subclasses override with `readonly status = N` (a subclass
|
|
10
5
|
* field initializer runs after this constructor, so it wins).
|
|
11
6
|
*/
|
|
12
7
|
var PosError = class extends Error {
|
|
@@ -147,26 +142,6 @@ var ReasonCodePolicyInvalidError = class extends PosError {
|
|
|
147
142
|
this.name = "ReasonCodePolicyInvalidError";
|
|
148
143
|
}
|
|
149
144
|
};
|
|
150
|
-
var PosCapabilityError = class extends Error {
|
|
151
|
-
code = "POS_CAPABILITY";
|
|
152
|
-
status = 422;
|
|
153
|
-
missing;
|
|
154
|
-
/**
|
|
155
|
-
* `true` when the backend never ANSWERED (the connection was not open at
|
|
156
|
-
* bind, or the driver exposed no topology) rather than answering "no".
|
|
157
|
-
* Both refuse — an unobserved outcome is never a positive one (AGENTS.md
|
|
158
|
-
* FAIL LOUD rule 3) — but the operator's fix is completely different, so
|
|
159
|
-
* the message has to distinguish them.
|
|
160
|
-
*/
|
|
161
|
-
indeterminate;
|
|
162
|
-
constructor(missing, opts = {}) {
|
|
163
|
-
const indeterminate = opts.indeterminate === true;
|
|
164
|
-
super(indeterminate ? `[pos] could NOT determine whether the backend supports: ${missing.join(", ")}. An unconfirmed answer is treated as unsupported — the close / forceClose pipelines run through CAS and are transactional. Bind AFTER \`await mongoose.connect(...)\`, or \`await probeMongoCapabilities(connection)\` first, or pass \`allowNonTransactional: true\`.` : `[pos] missing required capabilities: ${missing.join(", ")}. POS fails loud at bind rather than posting a Z-report for cash nobody counted.` + (missing.some((flag) => !flag.startsWith("outbox.")) ? " The close / forceClose pipelines run through CAS and are transactional — MongoDB must run as a replica set (repo-core 0.6 / mongokit 3.16+). Pass `allowNonTransactional: true` for standalone-Mongo local dev." : ""));
|
|
165
|
-
this.name = "PosCapabilityError";
|
|
166
|
-
this.missing = missing;
|
|
167
|
-
this.indeterminate = indeterminate;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
145
|
/** The tender does not settle the sale, and the deployment's `TenderPolicy` does not permit that shape. */
|
|
171
146
|
var TenderMismatchError = class extends PosError {
|
|
172
147
|
status = 400;
|
|
@@ -234,4 +209,4 @@ var TenderMethodRefusedError = class extends PosError {
|
|
|
234
209
|
}
|
|
235
210
|
};
|
|
236
211
|
//#endregion
|
|
237
|
-
export { ActiveShiftAlreadyOpenError, CashMovementInvalidError, CashMovementKeyReusedError, CashOutExceedsDrawerError, IllegalShiftTransitionError, OrderDiscountRefusedError,
|
|
212
|
+
export { ActiveShiftAlreadyOpenError, CashMovementInvalidError, CashMovementKeyReusedError, CashOutExceedsDrawerError, IllegalShiftTransitionError, OrderDiscountRefusedError, PosError, PriceOverrideRefusedError, ReasonCodePolicyInvalidError, RegisterRequiredError, ShiftCountsRequiredError, ShiftFinalizedError, ShiftNotFoundError, ShiftPausedError, TenderMethodRefusedError, TenderMismatchError, UnmanagedSessionError, VarianceExceededError };
|
package/dist/domain/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { SHIFT_VERBS, ShiftVerb, allowedVerbs, canTransition, nextState } from "
|
|
|
6
6
|
import { CashMovement } from "./value-objects/cash-movement.vo.mjs";
|
|
7
7
|
import { PaymentBreakdown, computeDifference, computeExpected } from "./value-objects/payment-breakdown.vo.mjs";
|
|
8
8
|
import { ShiftPolicy, defaultShiftPolicy, isReasonCodeAllowed, isWithinVarianceThreshold } from "./value-objects/shift-policy.vo.mjs";
|
|
9
|
-
import { ActiveRegister, ActiveShiftAlreadyOpenError, CashMovementInvalidError, CashMovementKeyReusedError, CashOutExceedsDrawerError, IllegalShiftTransitionError, OrderDiscountRefusal, OrderDiscountRefusedError,
|
|
9
|
+
import { ActiveRegister, ActiveShiftAlreadyOpenError, CashMovementInvalidError, CashMovementKeyReusedError, CashOutExceedsDrawerError, IllegalShiftTransitionError, OrderDiscountRefusal, OrderDiscountRefusedError, PosError, PriceOverrideRefusedError, ReasonCodePolicyInvalidError, RegisterRequiredError, ShiftCountsRequiredError, ShiftFinalizedError, ShiftNotFoundError, ShiftPausedError, TenderMethodRefusal, TenderMethodRefusedError, TenderMismatchError, UnmanagedSessionError, VarianceExceededError } from "./errors/pos.errors.mjs";
|
|
10
10
|
import { AllocatedTenderLeg, DEFAULT_TENDER_METHOD_RESOLVER, PosTenderSummary, ResolvedTenderMethod, TenderAllocation, TenderLegInput, TenderMethodDeclaration, TenderMethodResolver, TenderMethodTableOptions, TenderPolicy, TenderSettlement, TillTenderMethod, ValidatedTenderLeg, allocateTender, assertTenderSettles, createTenderMethodResolver, tenderSummary, tillTenderMethods, validateTenderLegs } from "./sale/tender.mjs";
|
|
11
11
|
import { DecideOrderDiscountInput, OrderDiscountDecision, OrderDiscountLimits, PosOrderDiscountRecord, decideOrderDiscount, discountCeilingMinor } from "./sale/discount.mjs";
|
|
12
12
|
import { DecideLinePriceInput, LinePriceDecision, PRICE_OVERRIDE_NOTE_MAX, PRICE_OVERRIDE_REASONS, PRICE_OVERRIDE_REASONS_NEEDING_NOTE, PosPriceOverrideRecord, PriceOverrideReason, decideLinePrice, isPriceOverrideReason } from "./sale/price-override.mjs";
|
|
@@ -19,4 +19,4 @@ import { PosContext } from "./ports/common.mjs";
|
|
|
19
19
|
import { LedgerBridge, ShiftClosePosting, shiftCloseIdempotencyKey } from "./ports/ledger.bridge.mjs";
|
|
20
20
|
import { PolicyBridge } from "./ports/policy.bridge.mjs";
|
|
21
21
|
import { NotificationBridge } from "./ports/notification.bridge.mjs";
|
|
22
|
-
export { ACTIVE_SHIFT_STATES, ActiveRegister, ActiveShiftAlreadyOpenError, AllocatedTenderLeg, CASH_MOVEMENT_REASON_CODES, CLOSED_BY_VALUES, CashMovement, CashMovementInvalidError, CashMovementKeyReusedError, CashMovementReasonCode, CashOutExceedsDrawerError, ClosedBy, CountableRow, DEFAULT_METHOD_KINDS, DEFAULT_TENDER_METHOD_RESOLVER, DecideLinePriceInput, DecideOrderDiscountInput, FINAL_SHIFT_STATES, type IShift, IllegalShiftTransitionError, type LedgerBridge, LinePriceDecision, type NotificationBridge, OrderDiscountDecision, OrderDiscountLimits, OrderDiscountRefusal, OrderDiscountRefusedError, PAYMENT_METHOD_KIND_VALUES, PRICE_OVERRIDE_NOTE_MAX, PRICE_OVERRIDE_REASONS, PRICE_OVERRIDE_REASONS_NEEDING_NOTE, PaymentBreakdown, type PendingLedgerPost, type PendingLedgerPostTrigger, type PolicyBridge,
|
|
22
|
+
export { ACTIVE_SHIFT_STATES, ActiveRegister, ActiveShiftAlreadyOpenError, AllocatedTenderLeg, CASH_MOVEMENT_REASON_CODES, CLOSED_BY_VALUES, CashMovement, CashMovementInvalidError, CashMovementKeyReusedError, CashMovementReasonCode, CashOutExceedsDrawerError, ClosedBy, CountableRow, DEFAULT_METHOD_KINDS, DEFAULT_TENDER_METHOD_RESOLVER, DecideLinePriceInput, DecideOrderDiscountInput, FINAL_SHIFT_STATES, type IShift, IllegalShiftTransitionError, type LedgerBridge, LinePriceDecision, type NotificationBridge, OrderDiscountDecision, OrderDiscountLimits, OrderDiscountRefusal, OrderDiscountRefusedError, PAYMENT_METHOD_KIND_VALUES, PRICE_OVERRIDE_NOTE_MAX, PRICE_OVERRIDE_REASONS, PRICE_OVERRIDE_REASONS_NEEDING_NOTE, PaymentBreakdown, type PendingLedgerPost, type PendingLedgerPostTrigger, type PolicyBridge, type PosContext, PosError, PosOrderDiscountRecord, PosPriceOverrideRecord, PosTenderSummary, PriceOverrideReason, PriceOverrideRefusedError, ReasonCodePolicyInvalidError, RegisterRequiredError, ReportOrder, ReportShift, ResolvedTenderMethod, SHIFT_PAYMENT_METHODS, SHIFT_STATES, SHIFT_VERBS, ShiftCloseDecision, type ShiftClosePosting, ShiftCountsRequiredError, ShiftFinalizedError, ShiftNotFoundError, ShiftPausedError, ShiftPaymentMethod, ShiftPolicy, type ShiftRecord, ShiftReport, ShiftState, ShiftVerb, TenderAllocation, TenderLegInput, TenderMethodDeclaration, TenderMethodRefusal, TenderMethodRefusedError, TenderMethodResolver, TenderMethodTableOptions, TenderMismatchError, TenderPolicy, TenderSettlement, TillTenderMethod, UnmanagedSessionError, ValidatedTenderLeg, VarianceExceededError, allocateTender, allowedVerbs, applyCounts, assertTenderSettles, buildShiftReport, canTransition, computeDifference, computeExpected, createTenderMethodResolver, decideBlindClose, decideLinePrice, decideOrderDiscount, decideShiftClose, defaultShiftPolicy, discountCeilingMinor, isActiveShiftState, isCashRow, isFinalShiftState, isPriceOverrideReason, isReasonCodeAllowed, isWithinVarianceThreshold, nextState, quickCashAmounts, resolveMethodKind, seedBreakdown, serviceSku, serviceSlug, shiftCloseIdempotencyKey, tenderSummary, tillTenderMethods, validateTenderLegs };
|