sinfactura-types 1.8.5 → 1.9.0
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/audit.d.ts +54 -27
- package/dist/cjs/index.js +54 -40
- package/dist/cjs/report.js +2 -0
- package/dist/cjs/socket.js +161 -0
- package/dist/index.d.ts +42 -40
- package/dist/index.js +54 -40
- package/dist/invoice.d.ts +9 -0
- package/dist/order.d.ts +38 -1
- package/dist/print.d.ts +175 -5
- package/dist/report.d.ts +36 -0
- package/dist/report.js +1 -0
- package/dist/return.d.ts +148 -0
- package/dist/socket.d.ts +157 -0
- package/dist/socket.js +156 -0
- package/dist/stock.d.ts +18 -0
- package/dist/storefrontEvent.d.ts +21 -1
- package/dist/supplier.d.ts +10 -0
- package/dist/userActivity.d.ts +28 -1
- package/package.json +1 -1
package/dist/audit.d.ts
CHANGED
|
@@ -1,36 +1,63 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* One entry of the generic order audit trail (api#548).
|
|
4
|
+
*
|
|
5
|
+
* ⚠️ **Reshaped in types#111.** The previous declaration invented its own
|
|
6
|
+
* columns (`auditId`, `changes[]`, `itemChanges`, `oldTotal`, `newTotal`)
|
|
7
|
+
* that did not match what the api's `writeAuditEntry`/`listAuditEntries`
|
|
8
|
+
* actually persist and return — so a handler could not satisfy both. This is
|
|
9
|
+
* now a faithful projection of the stored `AuditEntry`, which is the single
|
|
10
|
+
* storage shape for every audited entity.
|
|
11
|
+
*
|
|
12
|
+
* Safe to reshape: nothing imported the old declaration (it was referenced
|
|
13
|
+
* only inside this file), and the order audit read endpoint does not exist yet.
|
|
14
|
+
*
|
|
15
|
+
* Storage: `PK = AUDIT#ORDER#{storeId}#{orderId}`, `SK = {timestampMs}`
|
|
16
|
+
* zero-padded to 13 chars, newest-first on read. `PK`/`SK` are stripped
|
|
17
|
+
* before the row reaches the wire.
|
|
18
|
+
*/
|
|
19
|
+
interface OrderAuditEntry {
|
|
20
|
+
entity: 'ORDER';
|
|
21
|
+
/** The `orderId`. */
|
|
22
|
+
entityId: string;
|
|
3
23
|
storeId: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
fullName?: string;
|
|
24
|
+
/** ms epoch; also the source of the sort key. */
|
|
25
|
+
timestamp: number;
|
|
26
|
+
actor: OrderAuditActor;
|
|
8
27
|
action: OrderAuditAction;
|
|
28
|
+
/**
|
|
29
|
+
* Changed business fields only, before and after. Line-level detail
|
|
30
|
+
* (added/removed/modified lines, keyed by original order-array index) and
|
|
31
|
+
* totals live INSIDE these payloads rather than as extra top-level
|
|
32
|
+
* columns, because the generic writer has no such columns.
|
|
33
|
+
*
|
|
34
|
+
* Must be sanitized: no `PK`/`SK`, no secrets, no unnecessary customer PII.
|
|
35
|
+
*/
|
|
36
|
+
before: Record<string, unknown>;
|
|
37
|
+
after: Record<string, unknown>;
|
|
38
|
+
/** Why the mutation happened. Required by the generic writer. */
|
|
39
|
+
reason: string;
|
|
9
40
|
createdAt: number;
|
|
10
|
-
dated: number;
|
|
11
|
-
changes?: OrderAuditChange[];
|
|
12
|
-
itemChanges?: {
|
|
13
|
-
added: Partial<BasketItem>[];
|
|
14
|
-
removed: Partial<BasketItem>[];
|
|
15
|
-
modified: Array<{
|
|
16
|
-
productId: string;
|
|
17
|
-
name?: string;
|
|
18
|
-
oldQuantity: number;
|
|
19
|
-
newQuantity: number;
|
|
20
|
-
oldPrice: number;
|
|
21
|
-
newPrice: number;
|
|
22
|
-
}>;
|
|
23
|
-
};
|
|
24
|
-
oldTotal?: number;
|
|
25
|
-
newTotal?: number;
|
|
26
|
-
returnId?: string;
|
|
27
41
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
/** Who performed an audited order mutation. `fullName` is denormalized at write time. */
|
|
43
|
+
interface OrderAuditActor {
|
|
44
|
+
userId: string;
|
|
45
|
+
fullName: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* `GET /orders?mode=audit&orderId=…` response payload (api#548).
|
|
49
|
+
*
|
|
50
|
+
* `cursor` is an opaque base64url encoding of the underlying
|
|
51
|
+
* `LastEvaluatedKey`; raw DynamoDB keys are never exposed. Absent when there
|
|
52
|
+
* is no further page. An order with no history is `items: []`, not a 404.
|
|
53
|
+
*/
|
|
54
|
+
interface OrderAuditPage {
|
|
55
|
+
items: OrderAuditEntry[];
|
|
56
|
+
cursor?: string;
|
|
32
57
|
}
|
|
33
|
-
type OrderAuditAction = 'order_created' | 'order_edited' | 'order_ready' | 'order_delivered' | 'order_delivery_cancelled' | 'order_disabled' | 'order_enabled' | 'order_returned'
|
|
58
|
+
type OrderAuditAction = 'order_created' | 'order_edited' | 'order_ready' | 'order_delivered' | 'order_delivery_cancelled' | 'order_disabled' | 'order_enabled' | 'order_returned'
|
|
59
|
+
/** Customer (or operator) cancellation — distinct from `order_disabled` (api#591). */
|
|
60
|
+
| 'order_cancelled' | 'discount_changed' | 'payment_method_changed' | 'delivery_method_changed' | 'delivery_address_changed' | 'invoice_created' | 'credit_note_created';
|
|
34
61
|
/** One ARCA fiscal SOAP interaction (FECAESolicitar | FECompConsultar | ConstatarComprobante). Stored raw (CUIT unmasked) for 10y; masked at read. */
|
|
35
62
|
interface FiscalAuditEvent {
|
|
36
63
|
/** Schema version for forward-compat (start at 1). */
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,43 +14,57 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
__exportStar(require("./
|
|
30
|
-
__exportStar(require("./
|
|
31
|
-
__exportStar(require("./
|
|
32
|
-
__exportStar(require("./
|
|
33
|
-
__exportStar(require("./
|
|
34
|
-
__exportStar(require("./
|
|
35
|
-
__exportStar(require("./
|
|
36
|
-
__exportStar(require("./
|
|
37
|
-
__exportStar(require("./
|
|
38
|
-
__exportStar(require("./
|
|
39
|
-
__exportStar(require("./
|
|
40
|
-
__exportStar(require("./
|
|
41
|
-
__exportStar(require("./
|
|
42
|
-
__exportStar(require("./
|
|
43
|
-
__exportStar(require("./
|
|
44
|
-
__exportStar(require("./
|
|
45
|
-
__exportStar(require("./
|
|
46
|
-
__exportStar(require("./
|
|
47
|
-
__exportStar(require("./
|
|
48
|
-
__exportStar(require("./
|
|
49
|
-
__exportStar(require("./
|
|
50
|
-
__exportStar(require("./
|
|
51
|
-
__exportStar(require("./
|
|
52
|
-
__exportStar(require("./
|
|
53
|
-
__exportStar(require("./
|
|
54
|
-
__exportStar(require("./
|
|
55
|
-
__exportStar(require("./
|
|
56
|
-
__exportStar(require("./
|
|
17
|
+
// Explicit `.js` specifiers are REQUIRED, not stylistic (types#107).
|
|
18
|
+
//
|
|
19
|
+
// This package is `"type": "module"`, so Node's ESM resolver applies to
|
|
20
|
+
// `dist/index.js` and it does NOT do extensionless resolution — a bare
|
|
21
|
+
// `export * from "./account"` throws ERR_MODULE_NOT_FOUND at import time.
|
|
22
|
+
// That went unnoticed for the package's whole life because every module was
|
|
23
|
+
// ambient-only (`declare global` + `export {}`): nothing ever imported a
|
|
24
|
+
// runtime VALUE, so Node never actually loaded this file. `./socket.js` is the
|
|
25
|
+
// first module exporting real values, which made the latent break reachable.
|
|
26
|
+
//
|
|
27
|
+
// TypeScript maps `./x.js` back to `./x.ts` at compile time, and the CJS build
|
|
28
|
+
// resolves it fine too, so one spelling works for both targets.
|
|
29
|
+
__exportStar(require("./account.js"), exports);
|
|
30
|
+
__exportStar(require("./afip.js"), exports);
|
|
31
|
+
__exportStar(require("./ai.js"), exports);
|
|
32
|
+
__exportStar(require("./api.js"), exports);
|
|
33
|
+
__exportStar(require("./audit.js"), exports);
|
|
34
|
+
__exportStar(require("./auth.js"), exports);
|
|
35
|
+
__exportStar(require("./basket.js"), exports);
|
|
36
|
+
__exportStar(require("./brands.js"), exports);
|
|
37
|
+
__exportStar(require("./cash.js"), exports);
|
|
38
|
+
__exportStar(require("./categories.js"), exports);
|
|
39
|
+
__exportStar(require("./currency.js"), exports);
|
|
40
|
+
__exportStar(require("./customer.js"), exports);
|
|
41
|
+
__exportStar(require("./demo.js"), exports);
|
|
42
|
+
__exportStar(require("./impersonation.js"), exports);
|
|
43
|
+
__exportStar(require("./imports.js"), exports);
|
|
44
|
+
__exportStar(require("./invoice.js"), exports);
|
|
45
|
+
__exportStar(require("./log.js"), exports);
|
|
46
|
+
__exportStar(require("./maintenance.js"), exports);
|
|
47
|
+
__exportStar(require("./mercadolibre.js"), exports);
|
|
48
|
+
__exportStar(require("./mercadopago.js"), exports);
|
|
49
|
+
__exportStar(require("./notification.js"), exports);
|
|
50
|
+
__exportStar(require("./order.js"), exports);
|
|
51
|
+
__exportStar(require("./payment.js"), exports);
|
|
52
|
+
__exportStar(require("./platform.js"), exports);
|
|
53
|
+
__exportStar(require("./pricing.js"), exports);
|
|
54
|
+
__exportStar(require("./print.js"), exports);
|
|
55
|
+
__exportStar(require("./product.js"), exports);
|
|
56
|
+
__exportStar(require("./report.js"), exports);
|
|
57
|
+
__exportStar(require("./return.js"), exports);
|
|
58
|
+
__exportStar(require("./serviceOrder.js"), exports);
|
|
59
|
+
__exportStar(require("./serviceTemplate.js"), exports);
|
|
60
|
+
__exportStar(require("./socket.js"), exports);
|
|
61
|
+
__exportStar(require("./stock.js"), exports);
|
|
62
|
+
__exportStar(require("./store.js"), exports);
|
|
63
|
+
__exportStar(require("./storefrontEvent.js"), exports);
|
|
64
|
+
__exportStar(require("./subscription.js"), exports);
|
|
65
|
+
__exportStar(require("./support.js"), exports);
|
|
66
|
+
__exportStar(require("./supplier.js"), exports);
|
|
67
|
+
__exportStar(require("./user.js"), exports);
|
|
68
|
+
__exportStar(require("./userActivity.js"), exports);
|
|
69
|
+
__exportStar(require("./whatsapp.js"), exports);
|
|
70
|
+
__exportStar(require("./provinces.js"), exports);
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* WebSocket wire contract — the single source of truth for the SINFACTURA
|
|
4
|
+
* realtime protocol (types#107).
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ This module is deliberately NOT `declare global`. Everything here is a
|
|
7
|
+
* REAL runtime export, because clients need the action names as *values* to
|
|
8
|
+
* validate an incoming frame and to key an exhaustive switch — an ambient type
|
|
9
|
+
* alone cannot do either. Import them:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { SOCKET_ACTIONS, type SocketAction } from 'sinfactura-types';
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Producers/consumers this contract binds:
|
|
16
|
+
* - `api` — `stacks/wss/lambdas/socket/default.ts` (client→server zod union)
|
|
17
|
+
* and every `wsPost*` broadcast helper (server→client).
|
|
18
|
+
* - `app` / `storefront` — `Sockets.tsx` action dispatch.
|
|
19
|
+
* - `cloudprint` — the print agent's `websocket-client.ts`.
|
|
20
|
+
*
|
|
21
|
+
* Delivery path is always Lambda → SQS `ws-message` → WSS Lambda → API Gateway
|
|
22
|
+
* Management API → client. Nothing posts to a connection directly.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.isSocketKeepAlive = exports.SOCKET_KEEPALIVE = exports.SOCKET_AUTH_FAIL_REASONS = exports.LIVE_CLIENT_SOCKET_ACTIONS = exports.CLIENT_SOCKET_ACTIONS = exports.isSocketAction = exports.SOCKET_ACTIONS = void 0;
|
|
26
|
+
/* -------------------------------------------------------------------------- */
|
|
27
|
+
/* Server → client data frames */
|
|
28
|
+
/* -------------------------------------------------------------------------- */
|
|
29
|
+
/**
|
|
30
|
+
* Every `action` the backend broadcasts on a data frame.
|
|
31
|
+
*
|
|
32
|
+
* Derived from the api's actual producers: `postData: { action }` blocks, the
|
|
33
|
+
* `action` argument of `dynamoUpdate` (which auto-broadcasts via `wsPostStore`),
|
|
34
|
+
* and the payment/log call sites. Grouped for readability only — the wire
|
|
35
|
+
* treats them as one flat union.
|
|
36
|
+
*
|
|
37
|
+
* ⚠️ Audience is NOT encoded here. `print*` frames go to the print agent
|
|
38
|
+
* (`wsPostPrinter`), several ops frames go to admins/managers only
|
|
39
|
+
* (`wsPostAdmin`), and most entity frames go to all store users
|
|
40
|
+
* (`wsPostStore`). A client must ignore actions it does not own rather than
|
|
41
|
+
* assume it receives all of them.
|
|
42
|
+
*/
|
|
43
|
+
exports.SOCKET_ACTIONS = [
|
|
44
|
+
// Entity upserts — mostly emitted by `dynamoUpdate`'s auto-broadcast.
|
|
45
|
+
'account',
|
|
46
|
+
'baskets',
|
|
47
|
+
'brands',
|
|
48
|
+
'cash',
|
|
49
|
+
'categories',
|
|
50
|
+
'customers',
|
|
51
|
+
'globals',
|
|
52
|
+
'invoices',
|
|
53
|
+
'literals',
|
|
54
|
+
'orders',
|
|
55
|
+
'products',
|
|
56
|
+
'shifts',
|
|
57
|
+
'stores',
|
|
58
|
+
'suppliers',
|
|
59
|
+
'supplier-invoice',
|
|
60
|
+
'support',
|
|
61
|
+
'surveys',
|
|
62
|
+
'users',
|
|
63
|
+
'favorites',
|
|
64
|
+
// Explicit deletions — the row is gone, not updated.
|
|
65
|
+
'account-delete',
|
|
66
|
+
'baskets-delete',
|
|
67
|
+
'log-delete',
|
|
68
|
+
// Notifications & messaging.
|
|
69
|
+
'notifications',
|
|
70
|
+
'support-message',
|
|
71
|
+
'whatsapp-message',
|
|
72
|
+
// Payments & providers.
|
|
73
|
+
'payment_received',
|
|
74
|
+
'payment_linked',
|
|
75
|
+
'payment_unlinked',
|
|
76
|
+
'mercadopago',
|
|
77
|
+
'mercadopago_dynamic_qr_created',
|
|
78
|
+
'mercadopago_static_qr_created',
|
|
79
|
+
'mp_hook_log_appended',
|
|
80
|
+
'mp_ipn_log_appended',
|
|
81
|
+
'stripe',
|
|
82
|
+
'subscription',
|
|
83
|
+
// Fiscal.
|
|
84
|
+
'caea',
|
|
85
|
+
// Print agent audience (`wsPostPrinter`).
|
|
86
|
+
'print',
|
|
87
|
+
'print-order',
|
|
88
|
+
'print-invoice',
|
|
89
|
+
'print-product',
|
|
90
|
+
'print-tag',
|
|
91
|
+
'print_job_failed',
|
|
92
|
+
// Operations / operator surfaces.
|
|
93
|
+
'logs',
|
|
94
|
+
'maintenance',
|
|
95
|
+
'currency_auto_updated',
|
|
96
|
+
'drain_progress',
|
|
97
|
+
'integration_event_appended',
|
|
98
|
+
'userActivityRecorded',
|
|
99
|
+
];
|
|
100
|
+
/** Runtime guard — narrows an untrusted string to a known action. */
|
|
101
|
+
const isSocketAction = (value) => typeof value === 'string' && exports.SOCKET_ACTIONS.includes(value);
|
|
102
|
+
exports.isSocketAction = isSocketAction;
|
|
103
|
+
/* -------------------------------------------------------------------------- */
|
|
104
|
+
/* Client → server frames */
|
|
105
|
+
/* -------------------------------------------------------------------------- */
|
|
106
|
+
/**
|
|
107
|
+
* The client-driven actions the WSS `$default` route accepts.
|
|
108
|
+
*
|
|
109
|
+
* The first four mirror the zod discriminated union in
|
|
110
|
+
* `api/stacks/wss/lambdas/socket/default.ts` and are live today.
|
|
111
|
+
*
|
|
112
|
+
* ⚠️ `register_printers` is published AHEAD of the backend (api#2005 /
|
|
113
|
+
* api#2006 / sinfactura/print#156) so the agent, api, and app lanes can build
|
|
114
|
+
* against one `.d.ts` instead of discovering a mismatch at integration. The
|
|
115
|
+
* api's union does **not** accept it yet — sending it before api#2006 ships
|
|
116
|
+
* fails validation. Check the api lane before wiring it in an agent build.
|
|
117
|
+
*/
|
|
118
|
+
exports.CLIENT_SOCKET_ACTIONS = ['auth', 'logs', 'heartbeat', 'ack', 'register_printers'];
|
|
119
|
+
/** Client→server actions the backend accepts **today**. */
|
|
120
|
+
exports.LIVE_CLIENT_SOCKET_ACTIONS = ['auth', 'logs', 'heartbeat', 'ack'];
|
|
121
|
+
/* -------------------------------------------------------------------------- */
|
|
122
|
+
/* Control frames */
|
|
123
|
+
/* -------------------------------------------------------------------------- */
|
|
124
|
+
/**
|
|
125
|
+
* Why the backend refused the handshake (api#977 / app#1353).
|
|
126
|
+
*
|
|
127
|
+
* These exist because API Gateway translates a server-side disconnect into an
|
|
128
|
+
* opaque 1006 close with no reason. Without an explicit frame the client cannot
|
|
129
|
+
* tell a rejection from a network blip and burns its retry budget.
|
|
130
|
+
*/
|
|
131
|
+
exports.SOCKET_AUTH_FAIL_REASONS = [
|
|
132
|
+
'no_token',
|
|
133
|
+
'invalid_role',
|
|
134
|
+
'invalid_token',
|
|
135
|
+
'not_authenticated',
|
|
136
|
+
'server_error',
|
|
137
|
+
];
|
|
138
|
+
/* -------------------------------------------------------------------------- */
|
|
139
|
+
/* Keep-alive */
|
|
140
|
+
/* -------------------------------------------------------------------------- */
|
|
141
|
+
/**
|
|
142
|
+
* The keep-alive is **raw strings, not JSON** — the client sends the literal
|
|
143
|
+
* body `ping` and the backend replies with the literal body `pong`.
|
|
144
|
+
*
|
|
145
|
+
* `api/stacks/wss/lambdas/socket/default.ts` matches these before body
|
|
146
|
+
* parsing, precisely because `JSON.parse('ping')` throws. `live` is accepted as
|
|
147
|
+
* a legacy alias for `ping` from older clients; never send it from new code.
|
|
148
|
+
*
|
|
149
|
+
* Do not wrap these in a `SocketMessage`.
|
|
150
|
+
*/
|
|
151
|
+
exports.SOCKET_KEEPALIVE = {
|
|
152
|
+
/** Client → server. */
|
|
153
|
+
ping: 'ping',
|
|
154
|
+
/** Server → client. */
|
|
155
|
+
pong: 'pong',
|
|
156
|
+
/** Deprecated client → server alias for `ping`, still accepted. */
|
|
157
|
+
legacyPing: 'live',
|
|
158
|
+
};
|
|
159
|
+
/** Recognises either accepted keep-alive request body. */
|
|
160
|
+
const isSocketKeepAlive = (body) => body === exports.SOCKET_KEEPALIVE.ping || body === exports.SOCKET_KEEPALIVE.legacyPing;
|
|
161
|
+
exports.isSocketKeepAlive = isSocketKeepAlive;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
export * from "./account";
|
|
2
|
-
export * from "./afip";
|
|
3
|
-
export * from "./ai";
|
|
4
|
-
export * from "./api";
|
|
5
|
-
export * from "./audit";
|
|
6
|
-
export * from "./auth";
|
|
7
|
-
export * from "./basket";
|
|
8
|
-
export * from "./brands";
|
|
9
|
-
export * from "./cash";
|
|
10
|
-
export * from "./categories";
|
|
11
|
-
export * from "./currency";
|
|
12
|
-
export * from "./customer";
|
|
13
|
-
export * from "./demo";
|
|
14
|
-
export * from "./impersonation";
|
|
15
|
-
export * from "./imports";
|
|
16
|
-
export * from "./invoice";
|
|
17
|
-
export * from "./log";
|
|
18
|
-
export * from "./maintenance";
|
|
19
|
-
export * from "./mercadolibre";
|
|
20
|
-
export * from "./mercadopago";
|
|
21
|
-
export * from "./notification";
|
|
22
|
-
export * from "./order";
|
|
23
|
-
export * from "./payment";
|
|
24
|
-
export * from "./platform";
|
|
25
|
-
export * from "./pricing";
|
|
26
|
-
export * from "./print";
|
|
27
|
-
export * from "./product";
|
|
28
|
-
export * from "./
|
|
29
|
-
export * from "./
|
|
30
|
-
export * from "./
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./
|
|
33
|
-
export * from "./
|
|
34
|
-
export * from "./
|
|
35
|
-
export * from "./
|
|
36
|
-
export * from "./
|
|
37
|
-
export * from "./
|
|
38
|
-
export * from "./
|
|
39
|
-
export * from "./
|
|
40
|
-
export * from "./
|
|
1
|
+
export * from "./account.js";
|
|
2
|
+
export * from "./afip.js";
|
|
3
|
+
export * from "./ai.js";
|
|
4
|
+
export * from "./api.js";
|
|
5
|
+
export * from "./audit.js";
|
|
6
|
+
export * from "./auth.js";
|
|
7
|
+
export * from "./basket.js";
|
|
8
|
+
export * from "./brands.js";
|
|
9
|
+
export * from "./cash.js";
|
|
10
|
+
export * from "./categories.js";
|
|
11
|
+
export * from "./currency.js";
|
|
12
|
+
export * from "./customer.js";
|
|
13
|
+
export * from "./demo.js";
|
|
14
|
+
export * from "./impersonation.js";
|
|
15
|
+
export * from "./imports.js";
|
|
16
|
+
export * from "./invoice.js";
|
|
17
|
+
export * from "./log.js";
|
|
18
|
+
export * from "./maintenance.js";
|
|
19
|
+
export * from "./mercadolibre.js";
|
|
20
|
+
export * from "./mercadopago.js";
|
|
21
|
+
export * from "./notification.js";
|
|
22
|
+
export * from "./order.js";
|
|
23
|
+
export * from "./payment.js";
|
|
24
|
+
export * from "./platform.js";
|
|
25
|
+
export * from "./pricing.js";
|
|
26
|
+
export * from "./print.js";
|
|
27
|
+
export * from "./product.js";
|
|
28
|
+
export * from "./report.js";
|
|
29
|
+
export * from "./return.js";
|
|
30
|
+
export * from "./serviceOrder.js";
|
|
31
|
+
export * from "./serviceTemplate.js";
|
|
32
|
+
export * from "./socket.js";
|
|
33
|
+
export * from "./stock.js";
|
|
34
|
+
export * from "./store.js";
|
|
35
|
+
export * from "./storefrontEvent.js";
|
|
36
|
+
export * from "./subscription.js";
|
|
37
|
+
export * from "./support.js";
|
|
38
|
+
export * from "./supplier.js";
|
|
39
|
+
export * from "./user.js";
|
|
40
|
+
export * from "./userActivity.js";
|
|
41
|
+
export * from "./whatsapp.js";
|
|
42
|
+
export * from "./provinces.js";
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from "./
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
23
|
-
export * from "./
|
|
24
|
-
export * from "./
|
|
25
|
-
export * from "./
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./
|
|
28
|
-
export * from "./
|
|
29
|
-
export * from "./
|
|
30
|
-
export * from "./
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./
|
|
33
|
-
export * from "./
|
|
34
|
-
export * from "./
|
|
35
|
-
export * from "./
|
|
36
|
-
export * from "./
|
|
37
|
-
export * from "./
|
|
38
|
-
export * from "./
|
|
39
|
-
export * from "./
|
|
40
|
-
export * from "./
|
|
1
|
+
// Explicit `.js` specifiers are REQUIRED, not stylistic (types#107).
|
|
2
|
+
//
|
|
3
|
+
// This package is `"type": "module"`, so Node's ESM resolver applies to
|
|
4
|
+
// `dist/index.js` and it does NOT do extensionless resolution — a bare
|
|
5
|
+
// `export * from "./account"` throws ERR_MODULE_NOT_FOUND at import time.
|
|
6
|
+
// That went unnoticed for the package's whole life because every module was
|
|
7
|
+
// ambient-only (`declare global` + `export {}`): nothing ever imported a
|
|
8
|
+
// runtime VALUE, so Node never actually loaded this file. `./socket.js` is the
|
|
9
|
+
// first module exporting real values, which made the latent break reachable.
|
|
10
|
+
//
|
|
11
|
+
// TypeScript maps `./x.js` back to `./x.ts` at compile time, and the CJS build
|
|
12
|
+
// resolves it fine too, so one spelling works for both targets.
|
|
13
|
+
export * from "./account.js";
|
|
14
|
+
export * from "./afip.js";
|
|
15
|
+
export * from "./ai.js";
|
|
16
|
+
export * from "./api.js";
|
|
17
|
+
export * from "./audit.js";
|
|
18
|
+
export * from "./auth.js";
|
|
19
|
+
export * from "./basket.js";
|
|
20
|
+
export * from "./brands.js";
|
|
21
|
+
export * from "./cash.js";
|
|
22
|
+
export * from "./categories.js";
|
|
23
|
+
export * from "./currency.js";
|
|
24
|
+
export * from "./customer.js";
|
|
25
|
+
export * from "./demo.js";
|
|
26
|
+
export * from "./impersonation.js";
|
|
27
|
+
export * from "./imports.js";
|
|
28
|
+
export * from "./invoice.js";
|
|
29
|
+
export * from "./log.js";
|
|
30
|
+
export * from "./maintenance.js";
|
|
31
|
+
export * from "./mercadolibre.js";
|
|
32
|
+
export * from "./mercadopago.js";
|
|
33
|
+
export * from "./notification.js";
|
|
34
|
+
export * from "./order.js";
|
|
35
|
+
export * from "./payment.js";
|
|
36
|
+
export * from "./platform.js";
|
|
37
|
+
export * from "./pricing.js";
|
|
38
|
+
export * from "./print.js";
|
|
39
|
+
export * from "./product.js";
|
|
40
|
+
export * from "./report.js";
|
|
41
|
+
export * from "./return.js";
|
|
42
|
+
export * from "./serviceOrder.js";
|
|
43
|
+
export * from "./serviceTemplate.js";
|
|
44
|
+
export * from "./socket.js";
|
|
45
|
+
export * from "./stock.js";
|
|
46
|
+
export * from "./store.js";
|
|
47
|
+
export * from "./storefrontEvent.js";
|
|
48
|
+
export * from "./subscription.js";
|
|
49
|
+
export * from "./support.js";
|
|
50
|
+
export * from "./supplier.js";
|
|
51
|
+
export * from "./user.js";
|
|
52
|
+
export * from "./userActivity.js";
|
|
53
|
+
export * from "./whatsapp.js";
|
|
54
|
+
export * from "./provinces.js";
|
package/dist/invoice.d.ts
CHANGED
|
@@ -100,6 +100,15 @@ declare global {
|
|
|
100
100
|
* Optional: forward-only, so rows written before api#1559 carry no ttl.
|
|
101
101
|
*/
|
|
102
102
|
ttl?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Expected payment due date, Unix ms (api#713 / types#110).
|
|
105
|
+
*
|
|
106
|
+
* Optional and forward-only. Unrelated to `ttl` above (a DDB cost boundary)
|
|
107
|
+
* and to `caeExpiration` (an ARCA authorization window) — this is a
|
|
108
|
+
* commercial payment term, and it is what the AR dunning chains schedule
|
|
109
|
+
* against. Inherited from the order or set independently at issuance.
|
|
110
|
+
*/
|
|
111
|
+
dueDate?: number;
|
|
103
112
|
}
|
|
104
113
|
interface InvoiceItem {
|
|
105
114
|
code: string;
|
package/dist/order.d.ts
CHANGED
|
@@ -14,6 +14,15 @@ declare global {
|
|
|
14
14
|
currencyValue?: number;
|
|
15
15
|
currencyValueAt?: number;
|
|
16
16
|
paymentMethod: number;
|
|
17
|
+
/**
|
|
18
|
+
* Expected payment due date, Unix ms (api#713 / types#110).
|
|
19
|
+
*
|
|
20
|
+
* Optional and forward-only. Purely declarative in v1: nothing in the
|
|
21
|
+
* platform computes it from payment terms (Net 15/30, per-customer
|
|
22
|
+
* credit days) — that is a separate product decision. An Invoice issued
|
|
23
|
+
* against this order may inherit it or set its own independently.
|
|
24
|
+
*/
|
|
25
|
+
dueDate?: number;
|
|
17
26
|
deliveryMethod: number;
|
|
18
27
|
invoiceMethod?: {
|
|
19
28
|
condFiscal: number;
|
|
@@ -29,7 +38,29 @@ declare global {
|
|
|
29
38
|
orderPrinted?: boolean;
|
|
30
39
|
tagPrinted?: boolean;
|
|
31
40
|
invoices?: Partial<Invoice>[];
|
|
32
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Bounded, embedded projections of this order's returns (api#547),
|
|
43
|
+
* capped at 50. The canonical rows live under `RETURN#${storeId}`.
|
|
44
|
+
*
|
|
45
|
+
* ⚠️ Element type narrowed from `Partial<Return>` to `ReturnSummary` in
|
|
46
|
+
* types#111. Safe: the returns feature is unbuilt, so nothing produced or
|
|
47
|
+
* consumed this field at the time of the change.
|
|
48
|
+
*/
|
|
49
|
+
returns?: ReturnSummary[];
|
|
50
|
+
/**
|
|
51
|
+
* Customer self-cancellation (api#591). Cancelled is a DISTINCT state
|
|
52
|
+
* from `disabled` (operator soft-delete) — do not conflate them, and note
|
|
53
|
+
* that `disabled` additionally stamps `readyAt`/`deliveredAt`/
|
|
54
|
+
* `deliveredDate`, which cancellation must NOT do.
|
|
55
|
+
*
|
|
56
|
+
* All four are absent on a non-cancelled order.
|
|
57
|
+
*/
|
|
58
|
+
cancelledAt?: number;
|
|
59
|
+
/** Who cancelled: the customerId for a self-cancellation, else the userId. */
|
|
60
|
+
cancelledBy?: string;
|
|
61
|
+
cancellationSource?: OrderCancellationSource;
|
|
62
|
+
/** Bounded free text supplied by the canceller. */
|
|
63
|
+
cancellationReason?: string;
|
|
33
64
|
mercadolibreCreditNote?: {
|
|
34
65
|
creditNoteNumber?: number;
|
|
35
66
|
emittedAt?: number;
|
|
@@ -68,6 +99,12 @@ declare global {
|
|
|
68
99
|
mercadolibre?: OrderMercadolibre;
|
|
69
100
|
}
|
|
70
101
|
type OrderChannel = 'meli';
|
|
102
|
+
/**
|
|
103
|
+
* Who initiated a cancellation (api#591). `customer` is the storefront
|
|
104
|
+
* self-service path; `operator` is reserved for a future back-office
|
|
105
|
+
* cancellation that is still distinct from `disabled`.
|
|
106
|
+
*/
|
|
107
|
+
type OrderCancellationSource = 'customer' | 'operator';
|
|
71
108
|
interface MercadolibreCreditNoteStamp {
|
|
72
109
|
creditNoteNumber?: number;
|
|
73
110
|
emittedAt?: number;
|