sinfactura-types 1.10.346 → 1.10.347

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.
@@ -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
  ];
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.346",
3
+ "version": "1.10.347",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",