sinfactura-types 1.10.409 → 1.10.411

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/account.d.ts CHANGED
@@ -34,6 +34,12 @@ declare global {
34
34
  details?: string;
35
35
  debit?: number;
36
36
  credit?: number;
37
+ /**
38
+ * The movement's amount in this row's `currency` — equal to whichever of
39
+ * `credit`/`debit` is set. ⚠️ LEGACY: a manual `POST /account` row written
40
+ * before `source*` existed carries the amount the operator TYPED here, in
41
+ * the typed currency, while `credit`/`debit` beside it are converted.
42
+ */
37
43
  amount?: number;
38
44
  /**
39
45
  * Absent = an ordinary movement, which is every row written to date.
@@ -66,7 +72,29 @@ declare global {
66
72
  * being normalized to catalogId.
67
73
  */
68
74
  currency?: string;
75
+ /**
76
+ * Pesos per unit of this row's `currency` at write time (ADR-0013), so
77
+ * `credit * currencyValue` is the movement in pesos.
78
+ *
79
+ * ⚠️ LEGACY, forward-only: rows written before `source*` existed can carry
80
+ * the TYPED or PAID currency's rate instead — a non-peso row with `1` here
81
+ * is the tell. Treat `1` on a non-peso row as absent; no row is backfilled.
82
+ */
69
83
  currencyValue?: number;
84
+ /**
85
+ * PROVENANCE — the currency the money arrived in, when it differs from
86
+ * `currency` (or an operator override changed the amount). Audit only: the
87
+ * row's money is `credit`/`debit`/`amount`, in `currency`. Set together with
88
+ * `sourceCurrencyValue`; `sourceAmount` rides with them on the manual and
89
+ * payment-link writers, while the order-derived receivable and return
90
+ * credit carry the pair alone. Published to the operator, withheld from the
91
+ * customer wire.
92
+ */
93
+ sourceCurrency?: string;
94
+ /** Pesos per unit of `sourceCurrency` as applied — the operator's override when one was typed. */
95
+ sourceCurrencyValue?: number;
96
+ /** The amount as typed or paid, in `sourceCurrency`. */
97
+ sourceAmount?: number;
70
98
  /**
71
99
  * @deprecated Unix ms at which `currencyValue` was effective (ADR-0013) —
72
100
  * but NO writer stamps it on ACCOUNT rows: only the parallel Cash mirror
package/dist/ai.d.ts CHANGED
@@ -575,5 +575,31 @@ declare global {
575
575
  * Check `GatingErrorCode` IN ADDITION to this union, never instead of it.
576
576
  */
577
577
  type QuoteDraftErrorCode = 'VALIDATION_FAILED' | 'QUOTE_DRAFT_NO_MATCH' | 'QUOTE_DRAFT_AMBIGUOUS' | 'COST_CEILING_EXCEEDED' | 'AI_OPT_OUT' | 'QUOTE_DRAFT_BLOCKED' | 'QUOTE_DRAFT_GENERATION_FAILED' | 'QUOTE_DRAFT_UNGROUNDED' | 'QUOTE_DRAFT_INVALID_QUANTITY' | 'QUOTE_DRAFT_DUPLICATE_LINE' | 'QUOTE_DRAFT_TOO_MANY_LINES';
578
+ /**
579
+ * The ONE spent-budget refusal every AI spend route answers —
580
+ * `POST /products/enrich`, `/reports/narrative`, `/marketing/copy`,
581
+ * `/reminders/draft`, `/suppliers/doc-extract`,
582
+ * `/suppliers/price-list-extract` and `/presupuestos/draft`, and any AI
583
+ * route added later. There is no second spelling and no 429 for it.
584
+ *
585
+ * - 403 — the TENANT's own ceiling. Carries `feature`, `upsell` and `period`.
586
+ * `upsell` is true only for `monthly`: a daily tenant ceiling is one
587
+ * app-wide value no upgrade lifts, and it resets on its own.
588
+ * - 503 — the PLATFORM-wide ceiling, an operator hard stop no tenant action
589
+ * clears. Carries `period` only.
590
+ *
591
+ * `message` repeats the code rather than prose; switch on `error` and the status.
592
+ */
593
+ type AiCostCeilingRefusal = {
594
+ error: 'COST_CEILING_EXCEEDED';
595
+ message: 'COST_CEILING_EXCEEDED';
596
+ feature: 'aiFeatures';
597
+ upsell: boolean;
598
+ period: 'daily' | 'monthly';
599
+ } | {
600
+ error: 'COST_CEILING_EXCEEDED';
601
+ message: 'COST_CEILING_EXCEEDED';
602
+ period: 'daily' | 'monthly';
603
+ };
578
604
  }
579
605
  export {};
package/dist/order.d.ts CHANGED
@@ -203,6 +203,10 @@ declare global {
203
203
  * is the stamp AS A WHOLE, because the write follows an already-committed
204
204
  * appointment and is best-effort; that is the drift the paragraph above
205
205
  * is about, and it is why the appointment stays authoritative.
206
+ *
207
+ * ⚠️ **On the `orders` socket frame a clear arrives as `null`** for all
208
+ * three, so a client merging the frame into a cached row drops the turno.
209
+ * The row itself never stores `null`.
206
210
  */
207
211
  appointmentId?: string;
208
212
  /**
@@ -618,6 +622,17 @@ declare global {
618
622
  * disagree and a create agrees with what an edit recomputes. The `SALE#`
619
623
  * rows omit their own `cost` in the same case rather than booking a `0`.
620
624
  *
625
+ * ⚠️ **Denominated in this order's `currency`**, like `total`, and so is
626
+ * each `items[].cost`. `Product.cost` is stated in the PRODUCT's currency;
627
+ * every writer (the four create legs and `mode: 'edit'`) converts it at
628
+ * write time at the rate this row freezes as `currencyValue`, so
629
+ * `total - cost` is one denomination. A product whose currency has no
630
+ * usable rate is never converted 1:1: the create legs omit `cost` and log
631
+ * `ORDER_COST_CURRENCY_UNRATED`, and an edit refuses with that code.
632
+ * ⚠️ Forward-only: rows written before the conversion carry the PRODUCT's
633
+ * figure, which on a foreign-currency order is usually pesos. Nothing
634
+ * backfills them, and an edit keeps an untouched line's stored cost.
635
+ *
621
636
  * ⚠️ Optional for TWO reasons now, and only one of them is the audience. The
622
637
  * customer boundary removes it — `stripBasketCost` deletes it from the
623
638
  * customer `GET /orders` legs and from every customer-reaching socket frame.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.409",
3
+ "version": "1.10.411",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",