sinfactura-types 1.10.404 → 1.10.406

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.
@@ -37,6 +37,13 @@ exports.GATING_ERROR_CODES = void 0;
37
37
  * - `WAREHOUSE_OUT_OF_SCOPE` · 403 — `stacks/helpers/warehouseScope.ts`, on a
38
38
  * stock write naming a depósito outside the operator's
39
39
  * `User.allowedWarehouseIds`; `data.warehouseId` names it.
40
+ * - `ROLE_FORBIDDEN` · 403 — `stacks/helpers/response.ts` (`tryCatch`), ahead
41
+ * of every other gate, when an ACCOUNTANT token reaches a route outside
42
+ * `ACCOUNTANT_ALLOWED_ROUTES` (`@helpers/accountantGate`). ⚠️ The same code is
43
+ * ALSO a member of several domain unions (`cash`, `stock`, `appointment`,
44
+ * `cycleCount`), where a HANDLER refuses a role on its own; that membership
45
+ * describes those routes' own role checks and is NOT this reach — the
46
+ * wrapper answers it on any wrapped route, for an ACCOUNTANT claim.
40
47
  *
41
48
  * ⚠️ A domain's own error union does NOT list these, and that is deliberate:
42
49
  * they are reachable from endpoints whose union predates them, and duplicating
@@ -60,4 +67,5 @@ exports.GATING_ERROR_CODES = [
60
67
  'PLAN_UPGRADE_REQUIRED',
61
68
  'CAPABILITY_REQUIRED',
62
69
  'WAREHOUSE_OUT_OF_SCOPE',
70
+ 'ROLE_FORBIDDEN',
63
71
  ];
@@ -1,2 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REPORT_WAREHOUSE_NONE = void 0;
4
+ /**
5
+ * The `warehouseId` query value that selects rows carrying NO depósito, on the
6
+ * reports that take a sucursal filter (`mode=sales`, `GET /shifts`).
7
+ *
8
+ * Those rows were written before depósito-aware sales (or on a store that has
9
+ * not switched `stockAuthority`), and they stay in their own bucket: a report
10
+ * filtered to the primary depósito never includes them, however the rest of the
11
+ * app chooses to DISPLAY an absent depósito. Omitting `warehouseId` altogether
12
+ * is still the unfiltered, store-wide report.
13
+ *
14
+ * ⚠️ `mode=stocks` does not take it — stock is a balance, not a dated row, and a
15
+ * per-depósito balance is read from the levels alone.
16
+ */
17
+ exports.REPORT_WAREHOUSE_NONE = 'none';
package/dist/gating.d.ts CHANGED
@@ -34,6 +34,13 @@
34
34
  * - `WAREHOUSE_OUT_OF_SCOPE` · 403 — `stacks/helpers/warehouseScope.ts`, on a
35
35
  * stock write naming a depósito outside the operator's
36
36
  * `User.allowedWarehouseIds`; `data.warehouseId` names it.
37
+ * - `ROLE_FORBIDDEN` · 403 — `stacks/helpers/response.ts` (`tryCatch`), ahead
38
+ * of every other gate, when an ACCOUNTANT token reaches a route outside
39
+ * `ACCOUNTANT_ALLOWED_ROUTES` (`@helpers/accountantGate`). ⚠️ The same code is
40
+ * ALSO a member of several domain unions (`cash`, `stock`, `appointment`,
41
+ * `cycleCount`), where a HANDLER refuses a role on its own; that membership
42
+ * describes those routes' own role checks and is NOT this reach — the
43
+ * wrapper answers it on any wrapped route, for an ACCOUNTANT claim.
37
44
  *
38
45
  * ⚠️ A domain's own error union does NOT list these, and that is deliberate:
39
46
  * they are reachable from endpoints whose union predates them, and duplicating
@@ -45,6 +52,6 @@
45
52
  * answer `SUBSCRIPTION_READONLY`. Membership here means "exists and is
46
53
  * cross-cutting", not "every route emits it".
47
54
  */
48
- export declare const GATING_ERROR_CODES: readonly ["MAINTENANCE", "IMPERSONATION_READONLY", "IMPERSONATION_SESSION_INVALID", "IMPERSONATION_REGISTRY_UNAVAILABLE", "CSRF_ORIGIN_REJECTED", "SUBSCRIPTION_READONLY", "SUBSCRIPTION_STATE_UNAVAILABLE", "PLAN_LIMIT_EXCEEDED", "PLAN_UPGRADE_REQUIRED", "CAPABILITY_REQUIRED", "WAREHOUSE_OUT_OF_SCOPE"];
55
+ export declare const GATING_ERROR_CODES: readonly ["MAINTENANCE", "IMPERSONATION_READONLY", "IMPERSONATION_SESSION_INVALID", "IMPERSONATION_REGISTRY_UNAVAILABLE", "CSRF_ORIGIN_REJECTED", "SUBSCRIPTION_READONLY", "SUBSCRIPTION_STATE_UNAVAILABLE", "PLAN_LIMIT_EXCEEDED", "PLAN_UPGRADE_REQUIRED", "CAPABILITY_REQUIRED", "WAREHOUSE_OUT_OF_SCOPE", "ROLE_FORBIDDEN"];
49
56
  export type GatingErrorCode = (typeof GATING_ERROR_CODES)[number];
50
57
  export {};
package/dist/gating.js CHANGED
@@ -34,6 +34,13 @@
34
34
  * - `WAREHOUSE_OUT_OF_SCOPE` · 403 — `stacks/helpers/warehouseScope.ts`, on a
35
35
  * stock write naming a depósito outside the operator's
36
36
  * `User.allowedWarehouseIds`; `data.warehouseId` names it.
37
+ * - `ROLE_FORBIDDEN` · 403 — `stacks/helpers/response.ts` (`tryCatch`), ahead
38
+ * of every other gate, when an ACCOUNTANT token reaches a route outside
39
+ * `ACCOUNTANT_ALLOWED_ROUTES` (`@helpers/accountantGate`). ⚠️ The same code is
40
+ * ALSO a member of several domain unions (`cash`, `stock`, `appointment`,
41
+ * `cycleCount`), where a HANDLER refuses a role on its own; that membership
42
+ * describes those routes' own role checks and is NOT this reach — the
43
+ * wrapper answers it on any wrapped route, for an ACCOUNTANT claim.
37
44
  *
38
45
  * ⚠️ A domain's own error union does NOT list these, and that is deliberate:
39
46
  * they are reachable from endpoints whose union predates them, and duplicating
@@ -57,4 +64,5 @@ export const GATING_ERROR_CODES = [
57
64
  'PLAN_UPGRADE_REQUIRED',
58
65
  'CAPABILITY_REQUIRED',
59
66
  'WAREHOUSE_OUT_OF_SCOPE',
67
+ 'ROLE_FORBIDDEN',
60
68
  ];
package/dist/report.d.ts CHANGED
@@ -348,7 +348,9 @@ declare global {
348
348
  * One currency's slice of a `GET /reports?mode=sales` RANGE.
349
349
  *
350
350
  * Sits beside `data` in the response, never inside a `ReportSales` row:
351
- * `{ message, data, byCurrency, mixedCurrency, truncated? }`. The per-day rows
351
+ * `{ message, data, byCurrency, mixedCurrency, truncated?, warehouseId? }` —
352
+ * `warehouseId` echoes the sucursal filter (`REPORT_WAREHOUSE_NONE` included)
353
+ * and is absent on the unfiltered report. The per-day rows
352
354
  * remain unchanged and remain BLENDED across currencies — a client rendering a
353
355
  * mixed range must show these range totals and SUPPRESS the day rows, because a
354
356
  * blended day figure is a wrong number rather than an imprecise one.
@@ -821,4 +823,18 @@ declare global {
821
823
  unconvertedCurrencies?: string[];
822
824
  }
823
825
  }
826
+ /**
827
+ * The `warehouseId` query value that selects rows carrying NO depósito, on the
828
+ * reports that take a sucursal filter (`mode=sales`, `GET /shifts`).
829
+ *
830
+ * Those rows were written before depósito-aware sales (or on a store that has
831
+ * not switched `stockAuthority`), and they stay in their own bucket: a report
832
+ * filtered to the primary depósito never includes them, however the rest of the
833
+ * app chooses to DISPLAY an absent depósito. Omitting `warehouseId` altogether
834
+ * is still the unfiltered, store-wide report.
835
+ *
836
+ * ⚠️ `mode=stocks` does not take it — stock is a balance, not a dated row, and a
837
+ * per-depósito balance is read from the levels alone.
838
+ */
839
+ export declare const REPORT_WAREHOUSE_NONE = "none";
824
840
  export {};
package/dist/report.js CHANGED
@@ -1 +1,14 @@
1
- export {};
1
+ /**
2
+ * The `warehouseId` query value that selects rows carrying NO depósito, on the
3
+ * reports that take a sucursal filter (`mode=sales`, `GET /shifts`).
4
+ *
5
+ * Those rows were written before depósito-aware sales (or on a store that has
6
+ * not switched `stockAuthority`), and they stay in their own bucket: a report
7
+ * filtered to the primary depósito never includes them, however the rest of the
8
+ * app chooses to DISPLAY an absent depósito. Omitting `warehouseId` altogether
9
+ * is still the unfiltered, store-wide report.
10
+ *
11
+ * ⚠️ `mode=stocks` does not take it — stock is a balance, not a dated row, and a
12
+ * per-depósito balance is read from the levels alone.
13
+ */
14
+ export const REPORT_WAREHOUSE_NONE = 'none';
package/dist/return.d.ts CHANGED
@@ -24,6 +24,21 @@ declare global {
24
24
  customerId: string;
25
25
  invoiceId?: string;
26
26
  creditNoteId?: string;
27
+ /**
28
+ * The originating SALE's depósito — the order's first line carrying an
29
+ * `OrderLine.warehouseId`, frozen when the return is written. It is what a
30
+ * sucursal sales report nets this return against, so the report filters on
31
+ * it without joining back to the order.
32
+ *
33
+ * ⚠️ Not where the units went back to: a return may restock another
34
+ * depósito (`CreateReturnRequest.warehouseId`), and its `INCOME#` ledger
35
+ * rows record that one.
36
+ *
37
+ * ⚠️ OPTIONAL PERMANENTLY. Absent on returns written before it existed and
38
+ * on returns of orders whose lines carry no depósito; a report puts those
39
+ * under `REPORT_WAREHOUSE_NONE`, never under the primary.
40
+ */
41
+ warehouseId?: string;
27
42
  items: ReturnItem[];
28
43
  /**
29
44
  * GROSS sum of the selected lines, BEFORE the originating order's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.404",
3
+ "version": "1.10.406",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",