sinfactura-types 1.10.320 → 1.10.321

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/order.d.ts CHANGED
@@ -102,6 +102,38 @@ declare global {
102
102
  /** userId of the operator who rang it. */
103
103
  recordedBy?: string;
104
104
  }
105
+ /**
106
+ * One line of an ORDER — a cart line plus the ledger stamp only an order has.
107
+ *
108
+ * Separate from {@link CartLine} deliberately: a cart has no `SALE#` ledger
109
+ * row, so a stamp declared there would be a field no cart writer can ever
110
+ * populate and every cart reader would have to explain away. `Order.items`
111
+ * stays assignable from a cart's own lines, because every added field is
112
+ * optional and orders copy cart lines verbatim.
113
+ */
114
+ interface OrderLine extends CartLine {
115
+ /**
116
+ * The stamp THIS line's `SALE#` ledger row is keyed by —
117
+ * `${productId}-${saleTs}`.
118
+ *
119
+ * ⚠️ **Server-owned, always.** The edit request schema is `.strict()` and
120
+ * accepts only `productId`/`quantity`/`price`, so a client cannot supply
121
+ * one; the server carries it forward from the stored line, or allocates a
122
+ * fresh one when it mints a replacement row. A writer that echoed a
123
+ * client value here would let a caller re-point another order's ledger row.
124
+ *
125
+ * ⚠️ **Lines of the SAME product share one value.** The ledger SK carries
126
+ * no line index, so a product spanning several lines owns exactly one row
127
+ * and every one of those lines names it.
128
+ *
129
+ * ⚠️ OPTIONAL PERMANENTLY. Absent means "resolve through the ORDER row's
130
+ * own `saleTs`, then its `createdAt`" — which is every line written before
131
+ * per-line stamping, forward-only, never backfilled. Resolution belongs to
132
+ * ONE helper (`saleLedgerTsForLine`); reading this field directly
133
+ * addresses nothing for the whole legacy population.
134
+ */
135
+ saleTs?: number;
136
+ }
105
137
  interface Order {
106
138
  storeId: string;
107
139
  orderId: string;
@@ -669,7 +701,7 @@ declare global {
669
701
  source?: 'auto' | 'manual';
670
702
  };
671
703
  disabled?: boolean;
672
- items: Partial<CartLine>[];
704
+ items: Partial<OrderLine>[];
673
705
  rating?: number;
674
706
  comment?: string;
675
707
  surveyDate?: number;
package/dist/stock.d.ts CHANGED
@@ -49,7 +49,26 @@ declare global {
49
49
  * movement is UNVALUED, never that it was free.
50
50
  */
51
51
  cost?: number;
52
+ /**
53
+ * The movement has been RETRACTED and must not count toward on-hand.
54
+ *
55
+ * ⚠️ Supersedes the legacy `notEvaluate` spelling, which no writer ever
56
+ * used. This one HAS writers: every order-lifecycle reversal stamps it —
57
+ * a cancelled sale, a disabled order, the replaced half of an edited one
58
+ * and a voided MercadoLibre sale — because the ledger is retract-only and
59
+ * a movement row is never deleted and never overwritten.
60
+ */
52
61
  skip?: boolean;
62
+ /**
63
+ * When the retraction happened, in Unix ms. Present only alongside
64
+ * {@link StockBase.skip}.
65
+ *
66
+ * ⚠️ OPTIONAL PERMANENTLY, and absence does NOT mean "not retracted" —
67
+ * `skip` alone answers that. Rows stamped before this field existed carry
68
+ * none, this platform never backfills, and a reader that treats a missing
69
+ * `retractedAt` as "still live" re-counts every one of them.
70
+ */
71
+ retractedAt?: number;
53
72
  }
54
73
  /**
55
74
  * Attributes persisted on every stock-movement row. `storeId` and `stockId`
@@ -81,7 +100,21 @@ declare global {
81
100
  * `reports?mode=stocks` reports `costlessProducts` beside its totals.
82
101
  */
83
102
  cost?: number;
103
+ /**
104
+ * The movement has been RETRACTED — see {@link StockBase.skip}. The ledger
105
+ * is retract-only: a reversal stamps this in place rather than deleting
106
+ * the row, so the audit trail survives the retraction.
107
+ *
108
+ * ⚠️ A writer stamping this owes {@link StoredStockBase.retractedAt}
109
+ * beside it. Nothing structurally forces the pair, so the writer owes it.
110
+ */
84
111
  skip?: boolean;
112
+ /**
113
+ * When the retraction happened, in Unix ms — see
114
+ * {@link StockBase.retractedAt} for why absence is permanent and is not
115
+ * the same statement as `skip` being absent.
116
+ */
117
+ retractedAt?: number;
85
118
  }
86
119
  /**
87
120
  * Why an operator moved stock by hand, rather than through a purchase, a sale
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.320",
3
+ "version": "1.10.321",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",