sinfactura-types 1.10.263 → 1.10.264

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/product.d.ts CHANGED
@@ -330,13 +330,20 @@ declare global {
330
330
  quantity: number;
331
331
  cost: number;
332
332
  }[];
333
- sales?: {
334
- stockId: string;
335
- orderId: string;
336
- fullName: string;
337
- quantity: number;
338
- price: number;
339
- }[];
333
+ /**
334
+ * ⚠️ **Two shapes, chosen by `statsWindow`, and this field declares only
335
+ * the first.** `products/_get.ts` returns `ProductSalesLineRow[]` when
336
+ * `statsWindow` is the default, and `ProductSalesRollupRow[]` — a
337
+ * per-month aggregate — for any other window.
338
+ *
339
+ * The declared type is deliberately NOT a union: widening it would break
340
+ * every consumer that reads `sales[].orderId` without narrowing first,
341
+ * and this package publishes patch versions, so a breaking type change
342
+ * would arrive as one. A consumer reading a non-default window should
343
+ * assert to `ProductSalesRollupRow[]` — a published type it can name —
344
+ * rather than restating the shape locally.
345
+ */
346
+ sales?: ProductSalesLineRow[];
340
347
  totalIncome?: number;
341
348
  totalSales?: number;
342
349
  zone?: string;
@@ -401,6 +408,46 @@ declare global {
401
408
  evidence?: string;
402
409
  }[];
403
410
  }
411
+ /**
412
+ * One sale LINE on a product's stats — the shape `Product.sales` carries when
413
+ * `statsWindow` is the default. One entry per movement, not per period.
414
+ */
415
+ interface ProductSalesLineRow {
416
+ stockId: string;
417
+ orderId: string;
418
+ fullName: string;
419
+ quantity: number;
420
+ price: number;
421
+ }
422
+ /**
423
+ * One MONTH of a product's stats — the shape `Product.sales` carries for any
424
+ * non-default `statsWindow`. Built by `products/_get.ts`, which folds the
425
+ * line rows into per-period buckets.
426
+ *
427
+ * ⚠️ `orders`, `serviceOrders` and `adjustments` are three DISJOINT counts,
428
+ * not a total and two of its parts. A movement lands in exactly one, and the
429
+ * split is the point: a service order and a manual stock adjustment are both
430
+ * real movements that must stay visible, and neither is an order. Summing
431
+ * them to get "total movements" is fine; reading `orders` as that total is
432
+ * the misread this split exists to prevent.
433
+ */
434
+ interface ProductSalesRollupRow {
435
+ /** Period start, as the handler's own bucket key. */
436
+ date: number;
437
+ /** Units moved in the period, across all three counts below. */
438
+ quantity: number;
439
+ /** Movements from a customer order. */
440
+ orders: number;
441
+ /** Movements from a service order — real, and not an order. */
442
+ serviceOrders: number;
443
+ /**
444
+ * Movements from a manual stock adjustment (`products/_postStockAdjust.ts`).
445
+ * Counted under its own key for the same reason `serviceOrders` is: the
446
+ * movement is real and must stay visible, but it is not an order and must
447
+ * not be counted as one.
448
+ */
449
+ adjustments: number;
450
+ }
404
451
  interface ProductBarcode {
405
452
  value: string;
406
453
  type: 'EAN13' | 'EAN8' | 'UPC' | 'GTIN14' | 'CODE128' | 'internal';
package/dist/report.d.ts CHANGED
@@ -92,9 +92,28 @@ declare global {
92
92
  CBTE_NUMERO: number;
93
93
  RAZON_SOCIAL: string;
94
94
  CUIT: string;
95
+ /**
96
+ * Sum of EVERY declared alícuota base, so `NETO` reconciles with `TOTAL`.
97
+ * ⚠️ NOT `NETO10 + NETO21` — a voucher on one of the four rates the row
98
+ * does not persist would be under-reported by that sum. The two named
99
+ * columns stay as their own explicit columns beside this one; do not
100
+ * derive or cross-check `NETO` from them.
101
+ */
95
102
  NETO: number;
96
103
  NETO10: number;
97
104
  NETO21: number;
105
+ /**
106
+ * The declared perception, as its own column. `0` on every row that
107
+ * declared nothing and on every row predating the field, so it is
108
+ * required rather than optional — `reports/_invoices.ts` emits it
109
+ * unconditionally.
110
+ *
111
+ * ⚠️ Without this column `NETO` and `TOTAL` stop reconciling the moment a
112
+ * voucher carries a perception: it sits INSIDE `TOTAL` (`ImpTotal` is
113
+ * derived from `ImpTrib`) and in none of the columns beside it, so the
114
+ * sheet showed a gap it gave the reader no way to name.
115
+ */
116
+ PERCEPCIONES: number;
98
117
  TOTAL: number;
99
118
  }
100
119
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.263",
3
+ "version": "1.10.264",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",