platform-types 1.10.726 → 1.10.728

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.
@@ -141,7 +141,8 @@ export const APPOINTMENT_ERROR_CODES = [
141
141
  'ROLE_FORBIDDEN',
142
142
  'APPOINTMENT_FEED_SECRET_NOT_CONFIGURED',
143
143
  'APPOINTMENT_FEED_IDENTITY_INVALID',
144
- // The storefront's self-booking surface, while the store has `modules.appointments` off.
144
+ // The storefront's self-booking surface, while the store has `modules.appointments` off;
145
+ // its `data` is `StoreModuleDisabledData` (`StoreModuleRefusalBody` types the whole body).
145
146
  'STORE_MODULE_DISABLED',
146
147
  ];
147
148
  /**
@@ -144,7 +144,8 @@ exports.APPOINTMENT_ERROR_CODES = [
144
144
  'ROLE_FORBIDDEN',
145
145
  'APPOINTMENT_FEED_SECRET_NOT_CONFIGURED',
146
146
  'APPOINTMENT_FEED_IDENTITY_INVALID',
147
- // The storefront's self-booking surface, while the store has `modules.appointments` off.
147
+ // The storefront's self-booking surface, while the store has `modules.appointments` off;
148
+ // its `data` is `StoreModuleDisabledData` (`StoreModuleRefusalBody` types the whole body).
148
149
  'STORE_MODULE_DISABLED',
149
150
  ];
150
151
  /**
package/dist/cjs/store.js CHANGED
@@ -60,7 +60,10 @@ exports.isStoreModuleOn = isStoreModuleOn;
60
60
  * `STORE_MODULE_KEYS`; `data.module` carries it.
61
61
  * - `STORE_MODULE_NOT_BOOLEAN` (400) — a module's value was not `true`/`false`.
62
62
  * - `STORE_MODULE_WAREHOUSES_ACTIVE` (409) — `multiWarehouse` off while more
63
- * than one depósito is active; `data.activeWarehouses` carries the count.
63
+ * than one depósito is active, or the depósito read stopped before it could
64
+ * count them all; `data.activeWarehouses` carries the count, and
65
+ * `data.truncated: true` marks it as a floor (see
66
+ * {@link StoreModuleWarehousesActiveData}).
64
67
  * - `STORE_MODULE_TRANSFER_IN_FLIGHT` (409) — `multiWarehouse` off while a stock
65
68
  * transfer is in transit or partially received; `data.transferId` names one.
66
69
  * - `STORE_MODULE_CUSTOMER_BALANCES` (409) — `customerAccounts` off while a
package/dist/return.d.ts CHANGED
@@ -9,7 +9,14 @@ declare global {
9
9
  type ReturnRefundMethod = 'account' | 'cash';
10
10
  /** Return planning refusals: invalid selected lines, too many return summaries, or more than 100 transaction items. */
11
11
  type ReturnPlanFailureCode = 'RETURN_INVALID_SUBSET' | 'RETURN_LIMIT_REACHED' | 'RETURN_TRANSACTION_TOO_LARGE' | 'UNIT_QUANTITY_NOT_WHOLE' | 'UNIT_QUANTITY_UNREPRESENTABLE';
12
- /** Cash handed back in the return transaction, linked to its drawer and compensating account debit. */
12
+ /**
13
+ * Cash handed back in the return transaction, linked to its drawer and, for a
14
+ * named customer, its compensating account debit. On a walk-in return (the
15
+ * system customer) no `ACCOUNT#` row is written, so `accountId` is only the
16
+ * payout id the drawer `refund` event carries — it names no ledger row.
17
+ * `amount` is the full return total for a named customer; on a walk-in return
18
+ * it is only the part the order had actually been paid (see `owedReduction`).
19
+ */
13
20
  interface ReturnCashRefund {
14
21
  amount: number;
15
22
  currency: string;
@@ -150,8 +157,20 @@ declare global {
150
157
  fiscalAllocation?: ReturnFiscalAllocation;
151
158
  /** Absent on legacy rows: account. Cash never retains a customer balance credit. */
152
159
  refundMethod?: ReturnRefundMethod;
153
- /** Present only when the return paid its full total in cash. */
160
+ /**
161
+ * Present only when cash left the drawer: the full total for a named
162
+ * customer's cash return, the paid part of a walk-in return. A walk-in
163
+ * return of goods never paid for carries none.
164
+ */
154
165
  cashRefund?: ReturnCashRefund;
166
+ /**
167
+ * Walk-in returns only (the system customer). The part of `total` the
168
+ * order had never been paid: it moved no money and lowered what the order
169
+ * still owes, so the till collects that much less. `total` equals
170
+ * `cashRefund.amount` (or 0) plus this. Absent when zero, and on every
171
+ * named-customer return.
172
+ */
173
+ owedReduction?: number;
155
174
  reason: ReturnReason;
156
175
  notes?: string;
157
176
  userId: string;
@@ -591,6 +610,8 @@ declare global {
591
610
  refundMethod?: ReturnRefundMethod;
592
611
  /** Mirrors the committed cash payout on Return.cashRefund. */
593
612
  cashRefund?: ReturnCashRefund;
613
+ /** Mirrors Return.owedReduction: the unpaid part of a walk-in return, which lowered what the order owes. */
614
+ owedReduction?: number;
594
615
  reason: ReturnReason;
595
616
  ncStatus?: ReturnCreditNoteStatus;
596
617
  creditNoteId?: string;
@@ -713,7 +734,7 @@ declare global {
713
734
  */
714
735
  interface CreateReturnRequest {
715
736
  mode: 'return';
716
- /** Omission credits the customer account. Cash pays the full server-calculated return total; no provider refund. */
737
+ /** Omission credits the customer account. Cash pays the full server-calculated return total; no provider refund. A walk-in order (the system customer) is always refunded in cash, whatever is sent, but only up to what the order was paid; the unpaid rest lowers what the order still owes. */
717
738
  refundMethod?: ReturnRefundMethod;
718
739
  /** Client-minted UUID; the idempotency key. A replay returns the original outcome. */
719
740
  requestId: string;
@@ -728,7 +749,7 @@ declare global {
728
749
  /**
729
750
  * Required when the order has a non-empty `linkedPayments` map: the
730
751
  * operator acknowledges SINFACTURA does NOT refund or unlink the provider
731
- * payment. The return pays by refundMethod (account by default).
752
+ * payment. The return pays by refundMethod (account by default; always cash on a walk-in order).
732
753
  */
733
754
  acknowledgeNoProviderRefund?: boolean;
734
755
  /**
package/dist/store.d.ts CHANGED
@@ -907,8 +907,10 @@ declare global {
907
907
  * `400 STORE_MODULE_NOT_BOOLEAN`.
908
908
  *
909
909
  * Turning a module OFF is refused while it still carries state:
910
- * `multiWarehouse` while more than one depósito is active
911
- * (`409 STORE_MODULE_WAREHOUSES_ACTIVE`) or a transfer is in transit or
910
+ * `multiWarehouse` while more than one depósito is active, or the
911
+ * depósito read could not finish counting
912
+ * (`409 STORE_MODULE_WAREHOUSES_ACTIVE`, `data.truncated: true` on the
913
+ * latter — `StoreModuleWarehousesActiveData`) or a transfer is in transit or
912
914
  * partially received (`409 STORE_MODULE_TRANSFER_IN_FLIGHT`);
913
915
  * `customerAccounts` while any customer carries a non-zero balance
914
916
  * (`409 STORE_MODULE_CUSTOMER_BALANCES`, or
@@ -2025,7 +2027,10 @@ export declare const isStoreModuleOn: (modules: StoreModules | null | undefined,
2025
2027
  * `STORE_MODULE_KEYS`; `data.module` carries it.
2026
2028
  * - `STORE_MODULE_NOT_BOOLEAN` (400) — a module's value was not `true`/`false`.
2027
2029
  * - `STORE_MODULE_WAREHOUSES_ACTIVE` (409) — `multiWarehouse` off while more
2028
- * than one depósito is active; `data.activeWarehouses` carries the count.
2030
+ * than one depósito is active, or the depósito read stopped before it could
2031
+ * count them all; `data.activeWarehouses` carries the count, and
2032
+ * `data.truncated: true` marks it as a floor (see
2033
+ * {@link StoreModuleWarehousesActiveData}).
2029
2034
  * - `STORE_MODULE_TRANSFER_IN_FLIGHT` (409) — `multiWarehouse` off while a stock
2030
2035
  * transfer is in transit or partially received; `data.transferId` names one.
2031
2036
  * - `STORE_MODULE_CUSTOMER_BALANCES` (409) — `customerAccounts` off while a
@@ -2038,3 +2043,73 @@ export declare const isStoreModuleOn: (modules: StoreModules | null | undefined,
2038
2043
  */
2039
2044
  export declare const STORE_MODULE_ERROR_CODES: readonly ["STORE_MODULE_UNKNOWN", "STORE_MODULE_NOT_BOOLEAN", "STORE_MODULE_WAREHOUSES_ACTIVE", "STORE_MODULE_TRANSFER_IN_FLIGHT", "STORE_MODULE_CUSTOMER_BALANCES", "STORE_MODULE_BALANCE_CHECK_INCOMPLETE", "STORE_MODULE_DISABLED"];
2040
2045
  export type StoreModuleErrorCode = (typeof STORE_MODULE_ERROR_CODES)[number];
2046
+ /** `data` of `400 STORE_MODULE_UNKNOWN` — the unknown key, cut to its first 64 UTF-16 code units. */
2047
+ export interface StoreModuleUnknownData {
2048
+ module: string;
2049
+ }
2050
+ /** `data` of `400 STORE_MODULE_NOT_BOOLEAN` — the module whose value was not a boolean. */
2051
+ export interface StoreModuleNotBooleanData {
2052
+ module: StoreModuleKey;
2053
+ }
2054
+ /**
2055
+ * `data` of `409 STORE_MODULE_WAREHOUSES_ACTIVE`.
2056
+ *
2057
+ * `activeWarehouses` is the number of active depósitos the read SAW.
2058
+ * `truncated: true` marks the read as stopped early, so that number is a FLOOR:
2059
+ * at `2` or more the store still has extra depósitos to deactivate (the true
2060
+ * count is at least that); at `0` or `1` the refusal means only "could not
2061
+ * finish counting", and deactivating depósitos is not the remedy. `truncated`
2062
+ * is present only on a stopped read; its absence means the count is exact (and
2063
+ * therefore above one).
2064
+ */
2065
+ export interface StoreModuleWarehousesActiveData {
2066
+ module: 'multiWarehouse';
2067
+ activeWarehouses: number;
2068
+ truncated?: true;
2069
+ }
2070
+ /** `data` of `409 STORE_MODULE_TRANSFER_IN_FLIGHT` — one in-flight transfer, the bare `TRF…` id. */
2071
+ export interface StoreModuleTransferInFlightData {
2072
+ module: 'multiWarehouse';
2073
+ transferId: string;
2074
+ }
2075
+ /** `data` of `409 STORE_MODULE_CUSTOMER_BALANCES` — one customer with a balance, the bare `CUST…` id. */
2076
+ export interface StoreModuleCustomerBalancesData {
2077
+ module: 'customerAccounts';
2078
+ customerId: string;
2079
+ }
2080
+ /** `data` of `409 STORE_MODULE_BALANCE_CHECK_INCOMPLETE`. */
2081
+ export interface StoreModuleBalanceCheckIncompleteData {
2082
+ module: 'customerAccounts';
2083
+ }
2084
+ /** `data` of `403 STORE_MODULE_DISABLED` — the switched-off module the request needed. */
2085
+ export interface StoreModuleDisabledData {
2086
+ module: StoreModuleKey;
2087
+ }
2088
+ /**
2089
+ * Each `STORE_MODULE_*` code and the `data` it carries — the union below is
2090
+ * derived from it. Keyed by exactly `StoreModuleErrorCode`, both ways: a code
2091
+ * missing here fails the union's index, and a key no code names fails
2092
+ * `tests/unit/storeModules.test.ts`'s type-level check.
2093
+ */
2094
+ export interface StoreModuleRefusalDataByCode {
2095
+ STORE_MODULE_UNKNOWN: StoreModuleUnknownData;
2096
+ STORE_MODULE_NOT_BOOLEAN: StoreModuleNotBooleanData;
2097
+ STORE_MODULE_WAREHOUSES_ACTIVE: StoreModuleWarehousesActiveData;
2098
+ STORE_MODULE_TRANSFER_IN_FLIGHT: StoreModuleTransferInFlightData;
2099
+ STORE_MODULE_CUSTOMER_BALANCES: StoreModuleCustomerBalancesData;
2100
+ STORE_MODULE_BALANCE_CHECK_INCOMPLETE: StoreModuleBalanceCheckIncompleteData;
2101
+ STORE_MODULE_DISABLED: StoreModuleDisabledData;
2102
+ }
2103
+ /**
2104
+ * The wire body of any store-module refusal, discriminated on `error` —
2105
+ * narrowing on the code types `data`. Every emitter checks its whole body
2106
+ * against it with `satisfies`, so a code cannot travel with another code's
2107
+ * `data`.
2108
+ */
2109
+ export type StoreModuleRefusalBody = {
2110
+ [Code in StoreModuleErrorCode]: {
2111
+ error: Code;
2112
+ message: string;
2113
+ data: StoreModuleRefusalDataByCode[Code];
2114
+ };
2115
+ }[StoreModuleErrorCode];
package/dist/store.js CHANGED
@@ -55,7 +55,10 @@ export const isStoreModuleOn = (modules, module) => modules?.[module] !== false;
55
55
  * `STORE_MODULE_KEYS`; `data.module` carries it.
56
56
  * - `STORE_MODULE_NOT_BOOLEAN` (400) — a module's value was not `true`/`false`.
57
57
  * - `STORE_MODULE_WAREHOUSES_ACTIVE` (409) — `multiWarehouse` off while more
58
- * than one depósito is active; `data.activeWarehouses` carries the count.
58
+ * than one depósito is active, or the depósito read stopped before it could
59
+ * count them all; `data.activeWarehouses` carries the count, and
60
+ * `data.truncated: true` marks it as a floor (see
61
+ * {@link StoreModuleWarehousesActiveData}).
59
62
  * - `STORE_MODULE_TRANSFER_IN_FLIGHT` (409) — `multiWarehouse` off while a stock
60
63
  * transfer is in transit or partially received; `data.transferId` names one.
61
64
  * - `STORE_MODULE_CUSTOMER_BALANCES` (409) — `customerAccounts` off while a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.726",
3
+ "version": "1.10.728",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",