sinfactura-types 1.10.346 → 1.10.348

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.
@@ -142,6 +142,13 @@ exports.CYCLE_COUNT_ERROR_CODES = [
142
142
  'CYCLE_COUNT_NOT_OPEN',
143
143
  'CYCLE_COUNT_ILLEGAL_TRANSITION',
144
144
  'CYCLE_COUNT_VERSION_CONFLICT',
145
+ // Finalise refuses a session whose COUNTED CONTENT moved since the caller's
146
+ // read, distinct from the row-version conflict above: the caller's revision
147
+ // is stale, and committing it would finalise a count nobody took. Answered
148
+ // by `cycle-counts/_finalize.ts`; landed one PR after this list was
149
+ // published, and the guard test that keeps this list honest caught it on
150
+ // `main` rather than in either PR's own gate.
151
+ 'CYCLE_COUNT_CONTENT_CONFLICT',
145
152
  'CYCLE_COUNT_TOLERANCE_EXCEEDED',
146
153
  'CYCLE_COUNT_ID_UNUSABLE',
147
154
  'ROLE_FORBIDDEN',
@@ -214,12 +214,17 @@ exports.SOCKET_ACTIONS = [
214
214
  * writes up to one per leg; a client that needs it reads
215
215
  * `GET /inventory?mode=movements`.
216
216
  *
217
- * The producer is the single write chokepoint of `POST /inventory`
218
- * (`commitMovement` → `postInventoryLevelFrames`,
219
- * `stacks/lambdas/inventory/`), covering every write mode: receipt,
220
- * adjustment, write-off, transfer, reserve and release. The GET modes emit
221
- * nothing, and `dynamoUpdate` is not involved at all — these rows live on the
222
- * inventory satellite table, which no generic row writer touches.
217
+ * `postInventoryLevelFrames` (`stacks/lambdas/inventory/_shared.ts`) is the
218
+ * one function that emits this frame, but it has TWO call sites, not one:
219
+ * `POST /inventory`'s `commitMovement` chokepoint (`stacks/lambdas/inventory/`,
220
+ * covering every write mode — receipt, adjustment, write-off, transfer,
221
+ * reserve and release) AND `POST /transfers`' dispatch and per-line-arrival
222
+ * handlers (`stacks/lambdas/transfers/_dispatch.ts`, `_receive.ts`), which
223
+ * call it directly to restate the same two locations' balances a transfer
224
+ * moved stock between. See `'stockTransfers'` below for that domain's own
225
+ * frame. The GET modes emit nothing, and `dynamoUpdate` is not involved at
226
+ * all — these rows live on the inventory satellite table, which no generic
227
+ * row writer touches.
223
228
  */
224
229
  'inventory',
225
230
  'invoices',
@@ -522,6 +527,13 @@ exports.SOCKET_ACTIONS = [
522
527
  * close short arrivals, and the difference is a loss that needs its own
523
528
  * adjustment. A client must read the line quantities rather than inferring
524
529
  * completeness from the status.
530
+ *
531
+ * ⚠️ **This is not the only frame a transfer write emits.** Dispatch and a
532
+ * per-line arrival also call `postInventoryLevelFrames` directly
533
+ * (`stacks/lambdas/transfers/_dispatch.ts`, `_receive.ts`) to restate the
534
+ * per-location `'inventory'` balance at both ends of the move — see
535
+ * `'inventory'` above. A client reconciling socket traffic against its
536
+ * `POST /transfers` request log should expect both actions.
525
537
  */
526
538
  'stockTransfers',
527
539
  ];
@@ -401,5 +401,5 @@ export declare const isOverCycleCountToleranceRule: (input: {
401
401
  * ⚠️ Cross-cutting refusals are NOT repeated here — check `GATING_ERROR_CODES`
402
402
  * as well.
403
403
  */
404
- export declare const CYCLE_COUNT_ERROR_CODES: readonly ["CYCLE_COUNT_NOT_FOUND", "CYCLE_COUNT_NOT_OPEN", "CYCLE_COUNT_ILLEGAL_TRANSITION", "CYCLE_COUNT_VERSION_CONFLICT", "CYCLE_COUNT_TOLERANCE_EXCEEDED", "CYCLE_COUNT_ID_UNUSABLE", "ROLE_FORBIDDEN", "VALIDATION_FAILED", "INVALID_CURSOR", "PRODUCT_NOT_FOUND", "STOCK_ADJUSTMENT_RACED"];
404
+ export declare const CYCLE_COUNT_ERROR_CODES: readonly ["CYCLE_COUNT_NOT_FOUND", "CYCLE_COUNT_NOT_OPEN", "CYCLE_COUNT_ILLEGAL_TRANSITION", "CYCLE_COUNT_VERSION_CONFLICT", "CYCLE_COUNT_CONTENT_CONFLICT", "CYCLE_COUNT_TOLERANCE_EXCEEDED", "CYCLE_COUNT_ID_UNUSABLE", "ROLE_FORBIDDEN", "VALIDATION_FAILED", "INVALID_CURSOR", "PRODUCT_NOT_FOUND", "STOCK_ADJUSTMENT_RACED"];
405
405
  export type CycleCountErrorCode = (typeof CYCLE_COUNT_ERROR_CODES)[number];
@@ -137,6 +137,13 @@ export const CYCLE_COUNT_ERROR_CODES = [
137
137
  'CYCLE_COUNT_NOT_OPEN',
138
138
  'CYCLE_COUNT_ILLEGAL_TRANSITION',
139
139
  'CYCLE_COUNT_VERSION_CONFLICT',
140
+ // Finalise refuses a session whose COUNTED CONTENT moved since the caller's
141
+ // read, distinct from the row-version conflict above: the caller's revision
142
+ // is stale, and committing it would finalise a count nobody took. Answered
143
+ // by `cycle-counts/_finalize.ts`; landed one PR after this list was
144
+ // published, and the guard test that keeps this list honest caught it on
145
+ // `main` rather than in either PR's own gate.
146
+ 'CYCLE_COUNT_CONTENT_CONFLICT',
140
147
  'CYCLE_COUNT_TOLERANCE_EXCEEDED',
141
148
  'CYCLE_COUNT_ID_UNUSABLE',
142
149
  'ROLE_FORBIDDEN',
@@ -783,7 +783,16 @@ declare global {
783
783
  receivedAt?: number;
784
784
  /** Operator note. ⚠️ Never personal data — this row is not scrubbed and has no TTL. */
785
785
  notes?: string;
786
- /** Lowercase '#'-joined write-side index. Internal; not part of the read contract. */
786
+ /**
787
+ * Lowercase '#'-joined write-side index. Internal; not part of the read
788
+ * contract.
789
+ *
790
+ * ⚠️ **Never present on a transfer that reached a client**, on either the
791
+ * REST body or the socket frame: every read path strips it, exactly as the
792
+ * keys and the open-index attributes are stripped. It is declared here only
793
+ * because it is part of the STORED shape a writer builds. A consumer that
794
+ * reads it is reading a field that is contractually absent.
795
+ */
787
796
  search?: string;
788
797
  /** Soft delete. ⚠️ Movements written by the transfer survive it — they are real moves. */
789
798
  disabled?: boolean;
@@ -865,6 +874,37 @@ declare global {
865
874
  /** True when the ledger half was already there and only the projection moved. */
866
875
  replayed: boolean;
867
876
  }
877
+ /**
878
+ * ONE row of "what is still in flight" — the unaltered wire shape of the
879
+ * transfers list in its `open` mode.
880
+ *
881
+ * ⚠️ **A PROJECTION, not a `StockTransfer`.** It is served from the sparse
882
+ * `openTransferKey-openTransferRef` index, whose projection deliberately
883
+ * omits `items`: the lines are the bulk of the document and projecting a list
884
+ * attribute would put the whole thing into the index that exists to stay
885
+ * small. A consumer that needs the lines reads the transfer by id — it must
886
+ * NOT read an absent `items` as "a transfer with no lines", which is the
887
+ * failure typing this as a `StockTransfer` would produce.
888
+ *
889
+ * ⚠️ Every member here is `status`-open by construction
890
+ * (`draft | in_transit | partially_received`); a terminal transfer leaves the
891
+ * index in the same write that closes it, so this shape never carries one.
892
+ *
893
+ * ⚠️ `disabled` is NOT projected and therefore not declared: the open list
894
+ * cannot be filtered by it, and a consumer must not infer that an entry is
895
+ * live.
896
+ */
897
+ interface OpenStockTransferSummary {
898
+ storeId: string;
899
+ transferId: string;
900
+ status: StockTransferStatus;
901
+ fromWarehouseId: string;
902
+ toWarehouseId: string;
903
+ userId: string;
904
+ createdAt: number;
905
+ updatedAt: number;
906
+ shippedAt?: number;
907
+ }
868
908
  /**
869
909
  * How a multi-location store chooses which warehouse fills a line.
870
910
  *
package/dist/socket.js CHANGED
@@ -211,12 +211,17 @@ export const SOCKET_ACTIONS = [
211
211
  * writes up to one per leg; a client that needs it reads
212
212
  * `GET /inventory?mode=movements`.
213
213
  *
214
- * The producer is the single write chokepoint of `POST /inventory`
215
- * (`commitMovement` → `postInventoryLevelFrames`,
216
- * `stacks/lambdas/inventory/`), covering every write mode: receipt,
217
- * adjustment, write-off, transfer, reserve and release. The GET modes emit
218
- * nothing, and `dynamoUpdate` is not involved at all — these rows live on the
219
- * inventory satellite table, which no generic row writer touches.
214
+ * `postInventoryLevelFrames` (`stacks/lambdas/inventory/_shared.ts`) is the
215
+ * one function that emits this frame, but it has TWO call sites, not one:
216
+ * `POST /inventory`'s `commitMovement` chokepoint (`stacks/lambdas/inventory/`,
217
+ * covering every write mode — receipt, adjustment, write-off, transfer,
218
+ * reserve and release) AND `POST /transfers`' dispatch and per-line-arrival
219
+ * handlers (`stacks/lambdas/transfers/_dispatch.ts`, `_receive.ts`), which
220
+ * call it directly to restate the same two locations' balances a transfer
221
+ * moved stock between. See `'stockTransfers'` below for that domain's own
222
+ * frame. The GET modes emit nothing, and `dynamoUpdate` is not involved at
223
+ * all — these rows live on the inventory satellite table, which no generic
224
+ * row writer touches.
220
225
  */
221
226
  'inventory',
222
227
  'invoices',
@@ -519,6 +524,13 @@ export const SOCKET_ACTIONS = [
519
524
  * close short arrivals, and the difference is a loss that needs its own
520
525
  * adjustment. A client must read the line quantities rather than inferring
521
526
  * completeness from the status.
527
+ *
528
+ * ⚠️ **This is not the only frame a transfer write emits.** Dispatch and a
529
+ * per-line arrival also call `postInventoryLevelFrames` directly
530
+ * (`stacks/lambdas/transfers/_dispatch.ts`, `_receive.ts`) to restate the
531
+ * per-location `'inventory'` balance at both ends of the move — see
532
+ * `'inventory'` above. A client reconciling socket traffic against its
533
+ * `POST /transfers` request log should expect both actions.
522
534
  */
523
535
  'stockTransfers',
524
536
  ];
package/dist/user.d.ts CHANGED
@@ -77,6 +77,30 @@ declare global {
77
77
  * from `notifications` above rather than a key inside it.
78
78
  */
79
79
  broadcastChannels?: UserBroadcastChannels;
80
+ /**
81
+ * Per-user audible-bell preference — a CLIENT-ONLY chime toggle.
82
+ *
83
+ * ⚠️ The api never reads this field. It stores it and hands it back, and
84
+ * that is the whole of its server-side role: no delivery decision, no
85
+ * queue, no notification path anywhere in this repo branches on it. Do
86
+ * NOT read the absence of a server reader as evidence that it is dead —
87
+ * the consumers are the FEs, and they are the reason it exists:
88
+ * - `app` — `src/helpers/socketActions/store.ts` decides whether an
89
+ * inbound socket frame plays a sound, and `src/components/users/
90
+ * Notifications.tsx` renders the toggle that writes it;
91
+ * - `mobile` — `src/notifications/sounds.ts` gates the push chime, and
92
+ * `src/screens/Mas/NotificationPrefs/QuietHours/QuietHoursScreen.tsx`
93
+ * renders it.
94
+ *
95
+ * ⚠️ DEFAULT-ON, and the polarity is load-bearing: ABSENT means ON. Both
96
+ * readers test `!== false`, never `Boolean(...)`, so a consumer that
97
+ * coerces will silence the bell for every user who never touched the
98
+ * setting. Being default-on is also why no backfill was ever needed.
99
+ *
100
+ * Distinct from the `notifications.<KEY>` per-type opt-in map above —
101
+ * that map decides DELIVERY, this decides only whether a sound plays,
102
+ * and it is the INVERSE of the map's default (see `docs/NOTIFICATIONS.md`).
103
+ */
80
104
  notificationSound?: boolean;
81
105
  permissions?: UserPermissions;
82
106
  emailVerified?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.346",
3
+ "version": "1.10.348",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",