sinfactura-types 1.10.411 → 1.10.413
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/cjs/webhook.js +18 -1
- package/dist/webhook.d.ts +71 -1
- package/dist/webhook.js +17 -0
- package/package.json +1 -1
package/dist/cjs/webhook.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
// BREAKING change to every subscriber that exhaustively switches on it, even
|
|
44
44
|
// though it adds rather than removes.
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.ORDER_CREATED_SOURCES = exports.PRINT_JOB_SETTLED_OUTCOMES = exports.WEBHOOK_EVENT_TYPES = void 0;
|
|
46
|
+
exports.CUSTOMER_CREATED_SOURCES = exports.ORDER_CREATED_SOURCES = exports.PRINT_JOB_SETTLED_OUTCOMES = exports.WEBHOOK_EVENT_TYPES = void 0;
|
|
47
47
|
/**
|
|
48
48
|
* Every event an integrator can subscribe to — print-state transitions and
|
|
49
49
|
* business events alike.
|
|
@@ -72,6 +72,8 @@ exports.WEBHOOK_EVENT_TYPES = [
|
|
|
72
72
|
'order.created',
|
|
73
73
|
'order.status_changed',
|
|
74
74
|
'invoice.generated',
|
|
75
|
+
'customer.created',
|
|
76
|
+
'customer.imported',
|
|
75
77
|
];
|
|
76
78
|
/** Terminal outcomes for a print job. Closed union — a job printed, or it failed. */
|
|
77
79
|
exports.PRINT_JOB_SETTLED_OUTCOMES = ['printed', 'failed'];
|
|
@@ -99,3 +101,18 @@ exports.PRINT_JOB_SETTLED_OUTCOMES = ['printed', 'failed'];
|
|
|
99
101
|
* learn about.
|
|
100
102
|
*/
|
|
101
103
|
exports.ORDER_CREATED_SOURCES = ['pos', 'storefront', 'service_delivery', 'mercadolibre'];
|
|
104
|
+
/**
|
|
105
|
+
* Where a `customer.created` event was minted — the three paths that create
|
|
106
|
+
* ONE human customer per request.
|
|
107
|
+
*
|
|
108
|
+
* ⚠️ A CLOSED union: rule 1 applies, so a fourth member mints
|
|
109
|
+
* `customer.created.v2` rather than widening this.
|
|
110
|
+
*
|
|
111
|
+
* ⚠️ The bulk CSV import is deliberately NOT a member. It creates up to 10,000
|
|
112
|
+
* rows in one call, and one event per row would fan 10,000 × subscribers
|
|
113
|
+
* deliveries out of a single request already near its time ceiling. It emits
|
|
114
|
+
* one {@link CustomerImportedPayload} instead.
|
|
115
|
+
*
|
|
116
|
+
* The store's synthetic walk-in customer is never announced: it is not a person.
|
|
117
|
+
*/
|
|
118
|
+
exports.CUSTOMER_CREATED_SOURCES = ['pos', 'storefront', 'mercadolibre'];
|
package/dist/webhook.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* immediately subscribable — and a store that subscribes to an event with no
|
|
11
11
|
* emit site gets silence it cannot distinguish from "nothing happened".
|
|
12
12
|
*/
|
|
13
|
-
export declare const WEBHOOK_EVENT_TYPES: readonly ["print.queued", "print.received", "print.printed", "print.failed", "print.agent.connected", "print.agent.disconnected", "print.printer.online", "print.printer.offline", "print.job.settled", "payment.received", "product.stock_low", "product.stock_out", "order.created", "order.status_changed", "invoice.generated"];
|
|
13
|
+
export declare const WEBHOOK_EVENT_TYPES: readonly ["print.queued", "print.received", "print.printed", "print.failed", "print.agent.connected", "print.agent.disconnected", "print.printer.online", "print.printer.offline", "print.job.settled", "payment.received", "product.stock_low", "product.stock_out", "order.created", "order.status_changed", "invoice.generated", "customer.created", "customer.imported"];
|
|
14
14
|
export type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
|
|
15
15
|
/** Terminal outcomes for a print job. Closed union — a job printed, or it failed. */
|
|
16
16
|
export declare const PRINT_JOB_SETTLED_OUTCOMES: readonly ["printed", "failed"];
|
|
@@ -484,3 +484,73 @@ export interface InvoiceGeneratedPayload {
|
|
|
484
484
|
*/
|
|
485
485
|
occurredAt: number;
|
|
486
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Where a `customer.created` event was minted — the three paths that create
|
|
489
|
+
* ONE human customer per request.
|
|
490
|
+
*
|
|
491
|
+
* ⚠️ A CLOSED union: rule 1 applies, so a fourth member mints
|
|
492
|
+
* `customer.created.v2` rather than widening this.
|
|
493
|
+
*
|
|
494
|
+
* ⚠️ The bulk CSV import is deliberately NOT a member. It creates up to 10,000
|
|
495
|
+
* rows in one call, and one event per row would fan 10,000 × subscribers
|
|
496
|
+
* deliveries out of a single request already near its time ceiling. It emits
|
|
497
|
+
* one {@link CustomerImportedPayload} instead.
|
|
498
|
+
*
|
|
499
|
+
* The store's synthetic walk-in customer is never announced: it is not a person.
|
|
500
|
+
*/
|
|
501
|
+
export declare const CUSTOMER_CREATED_SOURCES: readonly ["pos", "storefront", "mercadolibre"];
|
|
502
|
+
export type CustomerCreatedSource = (typeof CUSTOMER_CREATED_SOURCES)[number];
|
|
503
|
+
/**
|
|
504
|
+
* Payload for `customer.created` — a new human customer row is durable.
|
|
505
|
+
*
|
|
506
|
+
* ⚠️ **Ids only, never identity.** Name, email, phone, CUIT, the `afip[]`
|
|
507
|
+
* fiscal block and `marketing.consent[].ip` are all personal data under Ley
|
|
508
|
+
* 25.326 leaving our network to a tenant-registered URL. An integrator that
|
|
509
|
+
* needs the row reads `GET /customers` under its own token. Enumerated, never
|
|
510
|
+
* spread from the row.
|
|
511
|
+
*
|
|
512
|
+
* ⚠️ **Upserts do not emit.** An operator edit, a storefront profile change or
|
|
513
|
+
* a repeat MercadoLibre buyer resolving to an existing row is silence.
|
|
514
|
+
*
|
|
515
|
+
* ⚠️ **The MercadoLibre leg is AT-MOST-ONCE**, for the same reason as the
|
|
516
|
+
* `order.created` MercadoLibre leg: it rides an SQS consumer, and a record that
|
|
517
|
+
* commits the customer then dies before the emit is redelivered to a resolver
|
|
518
|
+
* that now MATCHES the row and so creates nothing.
|
|
519
|
+
*/
|
|
520
|
+
export interface CustomerCreatedPayload {
|
|
521
|
+
customerId: string;
|
|
522
|
+
source: CustomerCreatedSource;
|
|
523
|
+
/**
|
|
524
|
+
* Server-stamped Unix milliseconds, taken at the post-commit emit — same
|
|
525
|
+
* convention and reason as {@link OrderCreatedPayload.occurredAt}. NOT
|
|
526
|
+
* `Customer.createdAt`.
|
|
527
|
+
*/
|
|
528
|
+
occurredAt: number;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Payload for `customer.imported` — ONE event per bulk CSV import that wrote
|
|
532
|
+
* at least one row.
|
|
533
|
+
*
|
|
534
|
+
* The import reserves a CONTIGUOUS block of customer ids for the whole file
|
|
535
|
+
* before the first row lands; `firstCustomerId`..`lastCustomerId` is that
|
|
536
|
+
* block. A reader lists the new rows with `GET /customers` over that range.
|
|
537
|
+
*
|
|
538
|
+
* ⚠️ **The range is the RESERVATION, not the set that landed.** A row the
|
|
539
|
+
* store refused mid-import leaves a gap, so `createdCount` can be smaller than
|
|
540
|
+
* the range width; never derive the count from the ids.
|
|
541
|
+
*
|
|
542
|
+
* ⚠️ **A partly failed import still emits** when any row landed: those rows
|
|
543
|
+
* are durable whatever happened to the rest, and silence would be
|
|
544
|
+
* indistinguishable from "nothing was imported".
|
|
545
|
+
*
|
|
546
|
+
* Ids and a count only — never a row, for the reasons on
|
|
547
|
+
* {@link CustomerCreatedPayload}.
|
|
548
|
+
*/
|
|
549
|
+
export interface CustomerImportedPayload {
|
|
550
|
+
firstCustomerId: string;
|
|
551
|
+
lastCustomerId: string;
|
|
552
|
+
/** Rows that actually landed. Always at least 1: a zero-row import emits nothing. */
|
|
553
|
+
createdCount: number;
|
|
554
|
+
/** Server-stamped Unix milliseconds at the emit. */
|
|
555
|
+
occurredAt: number;
|
|
556
|
+
}
|
package/dist/webhook.js
CHANGED
|
@@ -69,6 +69,8 @@ export const WEBHOOK_EVENT_TYPES = [
|
|
|
69
69
|
'order.created',
|
|
70
70
|
'order.status_changed',
|
|
71
71
|
'invoice.generated',
|
|
72
|
+
'customer.created',
|
|
73
|
+
'customer.imported',
|
|
72
74
|
];
|
|
73
75
|
/** Terminal outcomes for a print job. Closed union — a job printed, or it failed. */
|
|
74
76
|
export const PRINT_JOB_SETTLED_OUTCOMES = ['printed', 'failed'];
|
|
@@ -96,3 +98,18 @@ export const PRINT_JOB_SETTLED_OUTCOMES = ['printed', 'failed'];
|
|
|
96
98
|
* learn about.
|
|
97
99
|
*/
|
|
98
100
|
export const ORDER_CREATED_SOURCES = ['pos', 'storefront', 'service_delivery', 'mercadolibre'];
|
|
101
|
+
/**
|
|
102
|
+
* Where a `customer.created` event was minted — the three paths that create
|
|
103
|
+
* ONE human customer per request.
|
|
104
|
+
*
|
|
105
|
+
* ⚠️ A CLOSED union: rule 1 applies, so a fourth member mints
|
|
106
|
+
* `customer.created.v2` rather than widening this.
|
|
107
|
+
*
|
|
108
|
+
* ⚠️ The bulk CSV import is deliberately NOT a member. It creates up to 10,000
|
|
109
|
+
* rows in one call, and one event per row would fan 10,000 × subscribers
|
|
110
|
+
* deliveries out of a single request already near its time ceiling. It emits
|
|
111
|
+
* one {@link CustomerImportedPayload} instead.
|
|
112
|
+
*
|
|
113
|
+
* The store's synthetic walk-in customer is never announced: it is not a person.
|
|
114
|
+
*/
|
|
115
|
+
export const CUSTOMER_CREATED_SOURCES = ['pos', 'storefront', 'mercadolibre'];
|