platform-types 1.10.729 → 1.10.731

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/cash.d.ts CHANGED
@@ -141,10 +141,16 @@ declare global {
141
141
  currency: string;
142
142
  /**
143
143
  * The depósito (`Warehouse.warehouseId`) this drawer sits in, stamped once at
144
- * apertura so a sucursal can count and close its own tills. The cashier's
145
- * `User.defaultWarehouseId` when it names an active depósito, else the
146
- * store's primary — the sale depósito ladder without its request and
147
- * channel rungs.
144
+ * apertura so a sucursal can count and close its own tills. The sale
145
+ * depósito ladder without its request and channel rungs, under the same
146
+ * `multiWarehouse` switch and sucursal scope: the cashier's
147
+ * `User.defaultWarehouseId` when it names an active depósito in their scope,
148
+ * else the store's primary, else a scoped cashier's first active allowed
149
+ * depósito. With `Store.config.modules.multiWarehouse` off the default is
150
+ * skipped, so the shift sits where the cashier's sales land. A scoped
151
+ * cashier with no active depósito left in scope falls back to the unscoped
152
+ * ladder (the default when on, else the primary), so the shift is still
153
+ * stamped.
148
154
  *
149
155
  * ⚠️ Optional and FORWARD-ONLY: shifts opened before it existed, shifts at a
150
156
  * store with no depósito, and the store's default drawer carry none.
package/dist/cjs/store.js CHANGED
@@ -72,7 +72,10 @@ exports.isStoreModuleOn = isStoreModuleOn;
72
72
  * stopped before it could prove every balance is zero. Retrying is harmless but
73
73
  * walks the same rows, so a very large customer book keeps answering it.
74
74
  * - `STORE_MODULE_DISABLED` (403) — a server-enforced module is off (storefront
75
- * self-booking, storefront survey); `data.module` names it.
75
+ * self-booking, storefront survey); `data.module` names it. `POST /warehouses`
76
+ * answers it too when a create, or returning a depósito to service, would add
77
+ * a second active depósito while `multiWarehouse` is off
78
+ * (`data.module: 'multiWarehouse'`). Always 403, and never an Action Denied row.
76
79
  */
77
80
  exports.STORE_MODULE_ERROR_CODES = [
78
81
  'STORE_MODULE_UNKNOWN',
@@ -22,7 +22,7 @@
22
22
  * returned to the store's operators, and is never logged.
23
23
  */
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.WORK_ITEM_TEXT_MAX = exports.WORK_ITEM_PAGE_MAX = exports.WORK_ITEM_HISTORY_KINDS = exports.WORK_ITEM_SOURCE_VERDICTS = exports.WORK_ITEM_AVAILABILITIES = exports.WORK_ITEM_STATUSES = exports.WORK_ITEM_FAMILIES = void 0;
25
+ exports.WORK_ITEM_ERROR_CODES = exports.WORK_ITEM_TEXT_MAX = exports.WORK_ITEM_PAGE_MAX = exports.WORK_ITEM_HISTORY_KINDS = exports.WORK_ITEM_SOURCE_VERDICTS = exports.WORK_ITEM_AVAILABILITIES = exports.WORK_ITEM_STATUSES = exports.WORK_ITEM_FAMILIES = void 0;
26
26
  exports.WORK_ITEM_FAMILIES = [
27
27
  'order-create',
28
28
  'collection',
@@ -41,3 +41,65 @@ exports.WORK_ITEM_HISTORY_KINDS = ['reported', 'handover-requested', 'accepted',
41
41
  exports.WORK_ITEM_PAGE_MAX = 100;
42
42
  /** Upper bound on `summary` and on a `correct` note, in characters. */
43
43
  exports.WORK_ITEM_TEXT_MAX = 500;
44
+ /**
45
+ * Refusals from `/work-items` — `stacks/lambdas/workItems/*.ts` (`_get`,
46
+ * `_post`). EVERYTHING those files can answer, not a selection.
47
+ *
48
+ * ⚠️ Completeness is asserted mechanically:
49
+ * `tests/unit/workItemPublishedContract.test.ts` reads those source files off
50
+ * disk and fails on any literal `error: '…'` code missing from this tuple, and
51
+ * on any member here that no source (or named shared helper) can answer.
52
+ *
53
+ * - `WORK_ITEM_NOT_FOUND` · 404 — no such item in this store. Payload-free.
54
+ * - `WORK_ITEM_NOT_OPEN` · 409 — a transition on a `resolved`/`corrected`
55
+ * item, by a caller with authority over it; `data` is
56
+ * {@link WorkItemStateConflictData}. Authority is checked BEFORE state, so a
57
+ * caller without it gets its mode's refusal instead (`handover`/`resolve`:
58
+ * `WORK_ITEM_NOT_RESPONSIBLE`; `accept`: `WORK_ITEM_NO_PENDING_HANDOVER`,
59
+ * since a close strips the handover) — never read either as "still open".
60
+ * - `WORK_ITEM_VERSION_CONFLICT` · 409 — `expectedVersion` is stale, or the
61
+ * write lost its compare-and-swap; `data` is {@link WorkItemStateConflictData}
62
+ * when the item could be re-read, else absent.
63
+ * - `WORK_ITEM_NOT_RESPONSIBLE` · 403 — `handover`/`resolve` by someone who is
64
+ * neither the responsible user nor ADMIN-tier.
65
+ * - `WORK_ITEM_HANDOVER_TO_SELF` · 400 — `toUserId` already holds the item.
66
+ * - `WORK_ITEM_TARGET_USER_NOT_FOUND` · 404 — `toUserId` is not a live operator
67
+ * of this store.
68
+ * - `WORK_ITEM_NO_PENDING_HANDOVER` · 409 — `accept` with no handover pending,
69
+ * including on an item that has since been closed. Payload-free.
70
+ * - `WORK_ITEM_NOT_HANDOVER_TARGET` · 403 — `accept` by anyone but the named
71
+ * receiver.
72
+ * - `WORK_ITEM_UNRESOLVED_AT_SOURCE` · 409 — `resolve` whose source read is not
73
+ * authoritative; `data` is {@link WorkItemUnresolvedAtSourceData}.
74
+ * - `WORK_ITEM_SOURCE_REF_INVALID` · 400 — an `order-create` report whose
75
+ * `attemptKey` was not minted for this store and caller.
76
+ * - `WORK_ITEM_CAPTURED_AT_AHEAD` · 400 — `capturedAt` beyond the server's
77
+ * skew allowance.
78
+ * - `ROLE_FORBIDDEN` · 403 — `GET ?scope=store` or `correct` by a non-ADMIN-tier
79
+ * caller.
80
+ * - `INVALID_CURSOR` · 400 — a `?startKey=` that does not decode, or decodes to
81
+ * a key outside this store's open-item range. Restart from the first page.
82
+ * Read path only.
83
+ * - `VALIDATION_FAILED` · 400 — `stacks/helpers/validateRequest.ts`, on every
84
+ * leg (including a family's missing required `sourceRef` field).
85
+ *
86
+ * ⚠️ `UNHANDLED_ERROR` is deliberately NOT here: it is `tryCatch`'s generic
87
+ * envelope for an unexpected throw and belongs to no endpoint. Cross-cutting
88
+ * refusals are NOT repeated here — check `GATING_ERROR_CODES` as well.
89
+ */
90
+ exports.WORK_ITEM_ERROR_CODES = [
91
+ 'WORK_ITEM_NOT_FOUND',
92
+ 'WORK_ITEM_NOT_OPEN',
93
+ 'WORK_ITEM_VERSION_CONFLICT',
94
+ 'WORK_ITEM_NOT_RESPONSIBLE',
95
+ 'WORK_ITEM_HANDOVER_TO_SELF',
96
+ 'WORK_ITEM_TARGET_USER_NOT_FOUND',
97
+ 'WORK_ITEM_NO_PENDING_HANDOVER',
98
+ 'WORK_ITEM_NOT_HANDOVER_TARGET',
99
+ 'WORK_ITEM_UNRESOLVED_AT_SOURCE',
100
+ 'WORK_ITEM_SOURCE_REF_INVALID',
101
+ 'WORK_ITEM_CAPTURED_AT_AHEAD',
102
+ 'ROLE_FORBIDDEN',
103
+ 'INVALID_CURSOR',
104
+ 'VALIDATION_FAILED',
105
+ ];
package/dist/store.d.ts CHANGED
@@ -933,7 +933,10 @@ declare global {
933
933
  * so none is recorded, broadcast or mailed.
934
934
  * - `multiWarehouse` — every sale resolves to the primary depósito (a
935
935
  * scoped operator's sale to their own home depósito when the primary is
936
- * outside their scope), and only the primary feeds MercadoLibre.
936
+ * outside their scope), and only the primary feeds MercadoLibre. A cash
937
+ * shift opens on that same depósito (the cashier's default is skipped),
938
+ * and creating or reactivating a depósito while another is active is
939
+ * refused `403 STORE_MODULE_DISABLED`.
937
940
  * - `loyalty` — the automatic earn credits nothing (the `loyalty-earn`
938
941
  * worker skips it, including one queued before the switch). The
939
942
  * operator's `POST /loyalty/earn` and every read stay reachable.
@@ -2044,7 +2047,10 @@ export declare const isStoreModuleOn: (modules: StoreModules | null | undefined,
2044
2047
  * stopped before it could prove every balance is zero. Retrying is harmless but
2045
2048
  * walks the same rows, so a very large customer book keeps answering it.
2046
2049
  * - `STORE_MODULE_DISABLED` (403) — a server-enforced module is off (storefront
2047
- * self-booking, storefront survey); `data.module` names it.
2050
+ * self-booking, storefront survey); `data.module` names it. `POST /warehouses`
2051
+ * answers it too when a create, or returning a depósito to service, would add
2052
+ * a second active depósito while `multiWarehouse` is off
2053
+ * (`data.module: 'multiWarehouse'`). Always 403, and never an Action Denied row.
2048
2054
  */
2049
2055
  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"];
2050
2056
  export type StoreModuleErrorCode = (typeof STORE_MODULE_ERROR_CODES)[number];
@@ -2086,7 +2092,7 @@ export interface StoreModuleCustomerBalancesData {
2086
2092
  export interface StoreModuleBalanceCheckIncompleteData {
2087
2093
  module: 'customerAccounts';
2088
2094
  }
2089
- /** `data` of `403 STORE_MODULE_DISABLED` — the switched-off module the request needed. */
2095
+ /** `data` of `STORE_MODULE_DISABLED` (403) — the switched-off module the request needed. */
2090
2096
  export interface StoreModuleDisabledData {
2091
2097
  module: StoreModuleKey;
2092
2098
  }
package/dist/store.js CHANGED
@@ -67,7 +67,10 @@ export const isStoreModuleOn = (modules, module) => modules?.[module] !== false;
67
67
  * stopped before it could prove every balance is zero. Retrying is harmless but
68
68
  * walks the same rows, so a very large customer book keeps answering it.
69
69
  * - `STORE_MODULE_DISABLED` (403) — a server-enforced module is off (storefront
70
- * self-booking, storefront survey); `data.module` names it.
70
+ * self-booking, storefront survey); `data.module` names it. `POST /warehouses`
71
+ * answers it too when a create, or returning a depósito to service, would add
72
+ * a second active depósito while `multiWarehouse` is off
73
+ * (`data.module: 'multiWarehouse'`). Always 403, and never an Action Denied row.
71
74
  */
72
75
  export const STORE_MODULE_ERROR_CODES = [
73
76
  'STORE_MODULE_UNKNOWN',
@@ -169,6 +169,27 @@ declare global {
169
169
  openCount: number;
170
170
  availability: Record<WorkItemFamily, WorkItemAvailability>;
171
171
  }
172
+ /**
173
+ * `data` of a state-bearing `409` — `WORK_ITEM_NOT_OPEN` (always) and
174
+ * `WORK_ITEM_VERSION_CONFLICT` (when the item could be re-read; a lost
175
+ * compare-and-swap whose re-read finds nothing answers with no `data`).
176
+ * `current` is the item as the server holds it now. The pre-write refusals
177
+ * are answered only past the mode's authority gate. ⚠️ The post-commit
178
+ * conflict (a compare-and-swap lost after that gate passed) re-reads the item
179
+ * and returns it WITHOUT re-checking authority, so its `current` can reflect
180
+ * a responsibility or handover that moved in the race.
181
+ */
182
+ interface WorkItemStateConflictData {
183
+ current: WorkItem;
184
+ }
185
+ /**
186
+ * `data` of `409 WORK_ITEM_UNRESOLVED_AT_SOURCE` — the source read that did
187
+ * not decide the item. `verdict.verdict` is `pending` or `unknown`, never an
188
+ * authoritative one.
189
+ */
190
+ interface WorkItemUnresolvedAtSourceData {
191
+ verdict: WorkItemSourceVerdict;
192
+ }
172
193
  /** The `workItems` socket frame's `data` — refetch, never patch from it. */
173
194
  interface WorkItemFrameData {
174
195
  itemId: string;
@@ -186,3 +207,51 @@ export declare const WORK_ITEM_HISTORY_KINDS: readonly ["reported", "handover-re
186
207
  export declare const WORK_ITEM_PAGE_MAX = 100;
187
208
  /** Upper bound on `summary` and on a `correct` note, in characters. */
188
209
  export declare const WORK_ITEM_TEXT_MAX = 500;
210
+ /**
211
+ * Refusals from `/work-items` — `stacks/lambdas/workItems/*.ts` (`_get`,
212
+ * `_post`). EVERYTHING those files can answer, not a selection.
213
+ *
214
+ * ⚠️ Completeness is asserted mechanically:
215
+ * `tests/unit/workItemPublishedContract.test.ts` reads those source files off
216
+ * disk and fails on any literal `error: '…'` code missing from this tuple, and
217
+ * on any member here that no source (or named shared helper) can answer.
218
+ *
219
+ * - `WORK_ITEM_NOT_FOUND` · 404 — no such item in this store. Payload-free.
220
+ * - `WORK_ITEM_NOT_OPEN` · 409 — a transition on a `resolved`/`corrected`
221
+ * item, by a caller with authority over it; `data` is
222
+ * {@link WorkItemStateConflictData}. Authority is checked BEFORE state, so a
223
+ * caller without it gets its mode's refusal instead (`handover`/`resolve`:
224
+ * `WORK_ITEM_NOT_RESPONSIBLE`; `accept`: `WORK_ITEM_NO_PENDING_HANDOVER`,
225
+ * since a close strips the handover) — never read either as "still open".
226
+ * - `WORK_ITEM_VERSION_CONFLICT` · 409 — `expectedVersion` is stale, or the
227
+ * write lost its compare-and-swap; `data` is {@link WorkItemStateConflictData}
228
+ * when the item could be re-read, else absent.
229
+ * - `WORK_ITEM_NOT_RESPONSIBLE` · 403 — `handover`/`resolve` by someone who is
230
+ * neither the responsible user nor ADMIN-tier.
231
+ * - `WORK_ITEM_HANDOVER_TO_SELF` · 400 — `toUserId` already holds the item.
232
+ * - `WORK_ITEM_TARGET_USER_NOT_FOUND` · 404 — `toUserId` is not a live operator
233
+ * of this store.
234
+ * - `WORK_ITEM_NO_PENDING_HANDOVER` · 409 — `accept` with no handover pending,
235
+ * including on an item that has since been closed. Payload-free.
236
+ * - `WORK_ITEM_NOT_HANDOVER_TARGET` · 403 — `accept` by anyone but the named
237
+ * receiver.
238
+ * - `WORK_ITEM_UNRESOLVED_AT_SOURCE` · 409 — `resolve` whose source read is not
239
+ * authoritative; `data` is {@link WorkItemUnresolvedAtSourceData}.
240
+ * - `WORK_ITEM_SOURCE_REF_INVALID` · 400 — an `order-create` report whose
241
+ * `attemptKey` was not minted for this store and caller.
242
+ * - `WORK_ITEM_CAPTURED_AT_AHEAD` · 400 — `capturedAt` beyond the server's
243
+ * skew allowance.
244
+ * - `ROLE_FORBIDDEN` · 403 — `GET ?scope=store` or `correct` by a non-ADMIN-tier
245
+ * caller.
246
+ * - `INVALID_CURSOR` · 400 — a `?startKey=` that does not decode, or decodes to
247
+ * a key outside this store's open-item range. Restart from the first page.
248
+ * Read path only.
249
+ * - `VALIDATION_FAILED` · 400 — `stacks/helpers/validateRequest.ts`, on every
250
+ * leg (including a family's missing required `sourceRef` field).
251
+ *
252
+ * ⚠️ `UNHANDLED_ERROR` is deliberately NOT here: it is `tryCatch`'s generic
253
+ * envelope for an unexpected throw and belongs to no endpoint. Cross-cutting
254
+ * refusals are NOT repeated here — check `GATING_ERROR_CODES` as well.
255
+ */
256
+ export declare const WORK_ITEM_ERROR_CODES: readonly ["WORK_ITEM_NOT_FOUND", "WORK_ITEM_NOT_OPEN", "WORK_ITEM_VERSION_CONFLICT", "WORK_ITEM_NOT_RESPONSIBLE", "WORK_ITEM_HANDOVER_TO_SELF", "WORK_ITEM_TARGET_USER_NOT_FOUND", "WORK_ITEM_NO_PENDING_HANDOVER", "WORK_ITEM_NOT_HANDOVER_TARGET", "WORK_ITEM_UNRESOLVED_AT_SOURCE", "WORK_ITEM_SOURCE_REF_INVALID", "WORK_ITEM_CAPTURED_AT_AHEAD", "ROLE_FORBIDDEN", "INVALID_CURSOR", "VALIDATION_FAILED"];
257
+ export type WorkItemErrorCode = (typeof WORK_ITEM_ERROR_CODES)[number];
package/dist/workItem.js CHANGED
@@ -38,3 +38,65 @@ export const WORK_ITEM_HISTORY_KINDS = ['reported', 'handover-requested', 'accep
38
38
  export const WORK_ITEM_PAGE_MAX = 100;
39
39
  /** Upper bound on `summary` and on a `correct` note, in characters. */
40
40
  export const WORK_ITEM_TEXT_MAX = 500;
41
+ /**
42
+ * Refusals from `/work-items` — `stacks/lambdas/workItems/*.ts` (`_get`,
43
+ * `_post`). EVERYTHING those files can answer, not a selection.
44
+ *
45
+ * ⚠️ Completeness is asserted mechanically:
46
+ * `tests/unit/workItemPublishedContract.test.ts` reads those source files off
47
+ * disk and fails on any literal `error: '…'` code missing from this tuple, and
48
+ * on any member here that no source (or named shared helper) can answer.
49
+ *
50
+ * - `WORK_ITEM_NOT_FOUND` · 404 — no such item in this store. Payload-free.
51
+ * - `WORK_ITEM_NOT_OPEN` · 409 — a transition on a `resolved`/`corrected`
52
+ * item, by a caller with authority over it; `data` is
53
+ * {@link WorkItemStateConflictData}. Authority is checked BEFORE state, so a
54
+ * caller without it gets its mode's refusal instead (`handover`/`resolve`:
55
+ * `WORK_ITEM_NOT_RESPONSIBLE`; `accept`: `WORK_ITEM_NO_PENDING_HANDOVER`,
56
+ * since a close strips the handover) — never read either as "still open".
57
+ * - `WORK_ITEM_VERSION_CONFLICT` · 409 — `expectedVersion` is stale, or the
58
+ * write lost its compare-and-swap; `data` is {@link WorkItemStateConflictData}
59
+ * when the item could be re-read, else absent.
60
+ * - `WORK_ITEM_NOT_RESPONSIBLE` · 403 — `handover`/`resolve` by someone who is
61
+ * neither the responsible user nor ADMIN-tier.
62
+ * - `WORK_ITEM_HANDOVER_TO_SELF` · 400 — `toUserId` already holds the item.
63
+ * - `WORK_ITEM_TARGET_USER_NOT_FOUND` · 404 — `toUserId` is not a live operator
64
+ * of this store.
65
+ * - `WORK_ITEM_NO_PENDING_HANDOVER` · 409 — `accept` with no handover pending,
66
+ * including on an item that has since been closed. Payload-free.
67
+ * - `WORK_ITEM_NOT_HANDOVER_TARGET` · 403 — `accept` by anyone but the named
68
+ * receiver.
69
+ * - `WORK_ITEM_UNRESOLVED_AT_SOURCE` · 409 — `resolve` whose source read is not
70
+ * authoritative; `data` is {@link WorkItemUnresolvedAtSourceData}.
71
+ * - `WORK_ITEM_SOURCE_REF_INVALID` · 400 — an `order-create` report whose
72
+ * `attemptKey` was not minted for this store and caller.
73
+ * - `WORK_ITEM_CAPTURED_AT_AHEAD` · 400 — `capturedAt` beyond the server's
74
+ * skew allowance.
75
+ * - `ROLE_FORBIDDEN` · 403 — `GET ?scope=store` or `correct` by a non-ADMIN-tier
76
+ * caller.
77
+ * - `INVALID_CURSOR` · 400 — a `?startKey=` that does not decode, or decodes to
78
+ * a key outside this store's open-item range. Restart from the first page.
79
+ * Read path only.
80
+ * - `VALIDATION_FAILED` · 400 — `stacks/helpers/validateRequest.ts`, on every
81
+ * leg (including a family's missing required `sourceRef` field).
82
+ *
83
+ * ⚠️ `UNHANDLED_ERROR` is deliberately NOT here: it is `tryCatch`'s generic
84
+ * envelope for an unexpected throw and belongs to no endpoint. Cross-cutting
85
+ * refusals are NOT repeated here — check `GATING_ERROR_CODES` as well.
86
+ */
87
+ export const WORK_ITEM_ERROR_CODES = [
88
+ 'WORK_ITEM_NOT_FOUND',
89
+ 'WORK_ITEM_NOT_OPEN',
90
+ 'WORK_ITEM_VERSION_CONFLICT',
91
+ 'WORK_ITEM_NOT_RESPONSIBLE',
92
+ 'WORK_ITEM_HANDOVER_TO_SELF',
93
+ 'WORK_ITEM_TARGET_USER_NOT_FOUND',
94
+ 'WORK_ITEM_NO_PENDING_HANDOVER',
95
+ 'WORK_ITEM_NOT_HANDOVER_TARGET',
96
+ 'WORK_ITEM_UNRESOLVED_AT_SOURCE',
97
+ 'WORK_ITEM_SOURCE_REF_INVALID',
98
+ 'WORK_ITEM_CAPTURED_AT_AHEAD',
99
+ 'ROLE_FORBIDDEN',
100
+ 'INVALID_CURSOR',
101
+ 'VALIDATION_FAILED',
102
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.729",
3
+ "version": "1.10.731",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",