sinfactura-types 1.10.394 → 1.10.396
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/favorite.js +13 -0
- package/dist/cjs/index.js +1 -0
- package/dist/favorite.d.ts +93 -0
- package/dist/favorite.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mercadolibre.d.ts +2 -0
- package/dist/order.d.ts +26 -13
- package/dist/store.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// A shopper's saved ("hearted") products, one row per product.
|
|
3
|
+
//
|
|
4
|
+
// ⚠️ Forward-only. A customer whose favorites were written before these rows
|
|
5
|
+
// existed still carries the LEGACY `Customer.favorites` array on the CUSTOMER
|
|
6
|
+
// row; `GET /favorites` reads both (rows win on a shared `productId`) and the
|
|
7
|
+
// first `add`/`remove`/`merge` for that customer materializes the array into
|
|
8
|
+
// rows and then drops it. Nothing backfills.
|
|
9
|
+
//
|
|
10
|
+
// ⚠️ A row stores ids and a timestamp, never a product snapshot. Name, price and
|
|
11
|
+
// pictures are resolved at READ time against the live catalogue and the
|
|
12
|
+
// customer's own price list, so a favorite never shows a stale price.
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/cjs/index.js
CHANGED
|
@@ -45,6 +45,7 @@ __exportStar(require("./customerNote.js"), exports);
|
|
|
45
45
|
__exportStar(require("./customerTimeline.js"), exports);
|
|
46
46
|
__exportStar(require("./cycleCount.js"), exports);
|
|
47
47
|
__exportStar(require("./delivery.js"), exports);
|
|
48
|
+
__exportStar(require("./favorite.js"), exports);
|
|
48
49
|
__exportStar(require("./gating.js"), exports);
|
|
49
50
|
__exportStar(require("./holdingCost.js"), exports);
|
|
50
51
|
__exportStar(require("./demo.js"), exports);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
/** The stored row: `PK = FAVORITE#{storeId}#{customerId}`, `SK = {listId}#{productId}`. */
|
|
3
|
+
interface Favorite {
|
|
4
|
+
storeId: string;
|
|
5
|
+
customerId: string;
|
|
6
|
+
/** Only `'default'` is written today. */
|
|
7
|
+
listId: string;
|
|
8
|
+
productId: string;
|
|
9
|
+
/**
|
|
10
|
+
* ms epoch of the heart click. `0` on a row materialized from the legacy
|
|
11
|
+
* array, which never recorded one — so those sort last.
|
|
12
|
+
*/
|
|
13
|
+
addedAt: number;
|
|
14
|
+
createdAt: number;
|
|
15
|
+
updatedAt?: number;
|
|
16
|
+
entityType: 'FAVORITE';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One favorite as it crosses the wire, resolved at read time.
|
|
20
|
+
*
|
|
21
|
+
* `available: true` — the storefront product projection (the same fields and
|
|
22
|
+
* `prices` as `GET /products`, priced at the customer's own price list) plus
|
|
23
|
+
* `productId`, `addedAt` and `available`.
|
|
24
|
+
*
|
|
25
|
+
* `available: false` — the product is deleted, disabled, hidden from the
|
|
26
|
+
* storefront or cannot be priced. ONLY `productId`, `addedAt` and `available`
|
|
27
|
+
* are present; there is no stale name or price to render.
|
|
28
|
+
*/
|
|
29
|
+
type FavoriteView = Partial<Product> & {
|
|
30
|
+
productId: string;
|
|
31
|
+
addedAt: number;
|
|
32
|
+
available: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The `'favorites'` socket frame from `POST /favorites { mode: 'add' }` and
|
|
36
|
+
* `DELETE /favorites` — a DELTA, one per change, to the one customer.
|
|
37
|
+
*
|
|
38
|
+
* ⚠️ The legacy whole-array `POST /favorites` (no `mode`) still emits the old
|
|
39
|
+
* `{ storeId, customerId, favorites }` shape on the same action; a client
|
|
40
|
+
* tells them apart by the presence of `op`.
|
|
41
|
+
*/
|
|
42
|
+
interface FavoritesChangedPayload {
|
|
43
|
+
storeId: string;
|
|
44
|
+
customerId: string;
|
|
45
|
+
op: 'added' | 'removed';
|
|
46
|
+
favorite: FavoriteView;
|
|
47
|
+
}
|
|
48
|
+
/** `GET /favorites` — the newest (up to 200) favorites by `addedAt`, one page, no cursor. */
|
|
49
|
+
interface FavoritesList {
|
|
50
|
+
storeId: string;
|
|
51
|
+
customerId: string;
|
|
52
|
+
favorites: FavoriteView[];
|
|
53
|
+
count: number;
|
|
54
|
+
/**
|
|
55
|
+
* `true` when the customer has MORE favorites than the list carries (a
|
|
56
|
+
* concurrent-add overshoot past the 200 cap); the oldest were cut.
|
|
57
|
+
*/
|
|
58
|
+
truncated: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** `POST /favorites { mode: 'add' }`. `created: false` — it was already a favorite, nothing written. */
|
|
61
|
+
interface FavoriteAddResult {
|
|
62
|
+
storeId: string;
|
|
63
|
+
customerId: string;
|
|
64
|
+
created: boolean;
|
|
65
|
+
favorite: FavoriteView;
|
|
66
|
+
}
|
|
67
|
+
/** `DELETE /favorites?productId=`. `removed: false` — there was no such favorite. */
|
|
68
|
+
interface FavoriteRemoveResult {
|
|
69
|
+
storeId: string;
|
|
70
|
+
customerId: string;
|
|
71
|
+
productId: string;
|
|
72
|
+
removed: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** Why a `merge` id was not added. */
|
|
75
|
+
type FavoriteMergeSkipReason = 'PRODUCT_NOT_FOUND' | 'FAVORITES_LIMIT_REACHED';
|
|
76
|
+
/**
|
|
77
|
+
* `POST /favorites { mode: 'merge', productIds }` — the guest device's list
|
|
78
|
+
* folded into the account at login. `favorites` is the WHOLE list after the
|
|
79
|
+
* merge, exactly as `GET /favorites` would return it, so the client replaces
|
|
80
|
+
* its list from this body; no socket frame is sent for a merge.
|
|
81
|
+
*/
|
|
82
|
+
interface FavoritesMergeResult extends FavoritesList {
|
|
83
|
+
/** Ids that became new favorites, in request order. */
|
|
84
|
+
added: string[];
|
|
85
|
+
/** Ids that were already favorites — idempotent, nothing written. */
|
|
86
|
+
alreadyPresent: string[];
|
|
87
|
+
skipped: {
|
|
88
|
+
productId: string;
|
|
89
|
+
reason: FavoriteMergeSkipReason;
|
|
90
|
+
}[];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {};
|
package/dist/favorite.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// A shopper's saved ("hearted") products, one row per product.
|
|
2
|
+
//
|
|
3
|
+
// ⚠️ Forward-only. A customer whose favorites were written before these rows
|
|
4
|
+
// existed still carries the LEGACY `Customer.favorites` array on the CUSTOMER
|
|
5
|
+
// row; `GET /favorites` reads both (rows win on a shared `productId`) and the
|
|
6
|
+
// first `add`/`remove`/`merge` for that customer materializes the array into
|
|
7
|
+
// rows and then drops it. Nothing backfills.
|
|
8
|
+
//
|
|
9
|
+
// ⚠️ A row stores ids and a timestamp, never a product snapshot. Name, price and
|
|
10
|
+
// pictures are resolved at READ time against the live catalogue and the
|
|
11
|
+
// customer's own price list, so a favorite never shows a stale price.
|
|
12
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from './customerNote.ts';
|
|
|
21
21
|
export * from './customerTimeline.ts';
|
|
22
22
|
export * from './cycleCount.ts';
|
|
23
23
|
export * from './delivery.ts';
|
|
24
|
+
export * from './favorite.ts';
|
|
24
25
|
export * from './gating.ts';
|
|
25
26
|
export * from './holdingCost.ts';
|
|
26
27
|
export * from './demo.ts';
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export * from "./customerNote.js";
|
|
|
29
29
|
export * from "./customerTimeline.js";
|
|
30
30
|
export * from "./cycleCount.js";
|
|
31
31
|
export * from "./delivery.js";
|
|
32
|
+
export * from "./favorite.js";
|
|
32
33
|
export * from "./gating.js";
|
|
33
34
|
export * from "./holdingCost.js";
|
|
34
35
|
export * from "./demo.js";
|
package/dist/mercadolibre.d.ts
CHANGED
|
@@ -221,6 +221,8 @@ declare global {
|
|
|
221
221
|
userId?: string;
|
|
222
222
|
nickname?: string;
|
|
223
223
|
connectedAt?: number;
|
|
224
|
+
/** unix ms of the latest accepted OAuth link — see `Mercadolibre.lastLinkedAt`. */
|
|
225
|
+
lastLinkedAt?: number;
|
|
224
226
|
expiresAt?: number;
|
|
225
227
|
syncPolicy?: Mercadolibre['syncPolicy'];
|
|
226
228
|
health?: MercadolibreHealth;
|
package/dist/order.d.ts
CHANGED
|
@@ -748,9 +748,12 @@ declare global {
|
|
|
748
748
|
*/
|
|
749
749
|
returns?: ReturnSummary[];
|
|
750
750
|
/**
|
|
751
|
-
* Customer self-cancellation
|
|
752
|
-
*
|
|
753
|
-
* `readyAt`/`deliveredAt
|
|
751
|
+
* Customer self-cancellation: the WHY and the WHO of a dead order. A
|
|
752
|
+
* cancellation also lands the row in the same end state an operator
|
|
753
|
+
* soft-delete does — `disabled: true`, `readyAt`/`deliveredAt` stamped at
|
|
754
|
+
* the cancel instant, `deliveredDate` that day, `fulfilmentStatus:
|
|
755
|
+
* 'delivered'` and a `comments` note — so every reader that decides "is
|
|
756
|
+
* this a live sale" from `disabled` treats it as dead.
|
|
754
757
|
* All four fields are absent on a non-cancelled order.
|
|
755
758
|
*/
|
|
756
759
|
cancelledAt?: number;
|
|
@@ -852,12 +855,21 @@ declare global {
|
|
|
852
855
|
* Evaluated in this order, first match wins:
|
|
853
856
|
* - `ready` — `readyAt > 0`.
|
|
854
857
|
* - `delivered` — `deliveredAt > 0` or `deliveredDate > 0`.
|
|
855
|
-
* - `
|
|
858
|
+
* - `cancelled` — `cancelledAt` is stamped. Ranked ahead of `disabled`
|
|
859
|
+
* because a customer cancellation stamps `disabled: true` as well, so a
|
|
860
|
+
* cancelled order always satisfies both and `cancelled` is the specific one.
|
|
861
|
+
* - `disabled` — `disabled === true` (soft-delete, or the dead state a
|
|
862
|
+
* customer cancellation also leaves).
|
|
856
863
|
* - `invoiced` — `invoices[]` holds a voucher that is not `rejected`.
|
|
857
864
|
* A voucher with no `fiscalStatus` at all is legacy and counts as live.
|
|
858
865
|
* - `payment-linked` — `linkedPayments` is non-empty. The platform never
|
|
859
866
|
* unlinks or refunds a provider payment on the operator's behalf.
|
|
860
|
-
*
|
|
867
|
+
*
|
|
868
|
+
* ⚠️ As a FIRST match this list rarely reports `cancelled`: both dead-state
|
|
869
|
+
* writers stamp `readyAt`, so `ready` wins on `mode: 'edit'`. The rank pays
|
|
870
|
+
* off on the per-field `POST /orders` gate, which walks the whole list, and
|
|
871
|
+
* the single-field legs (`mode: 'delivery'`, `'disable'`, `'return'`) test
|
|
872
|
+
* `cancelled` ahead of `disabled` explicitly for the same reason.
|
|
861
873
|
*/
|
|
862
874
|
type OrderLockReason = 'ready' | 'delivered' | 'disabled' | 'invoiced' | 'payment-linked' | 'cancelled';
|
|
863
875
|
/**
|
|
@@ -911,14 +923,15 @@ declare global {
|
|
|
911
923
|
* documented exemption from the transition table below.)
|
|
912
924
|
*
|
|
913
925
|
* **`cancelled` is NOT a value here either — cancellation is a THIRD
|
|
914
|
-
* axis**, carried by `cancelledAt`/`cancelledBy`/`cancellationSource
|
|
915
|
-
*
|
|
916
|
-
*
|
|
917
|
-
*
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
*
|
|
921
|
-
*
|
|
926
|
+
* axis**, carried by `cancelledAt`/`cancelledBy`/`cancellationSource`:
|
|
927
|
+
* the why and the who. ⚠️ A customer cancellation lands the row in the
|
|
928
|
+
* SAME dead state the soft-delete writer does — `disabled: true` and the
|
|
929
|
+
* three timestamps stamped, so it too RECOMPUTES this field to `delivered`
|
|
930
|
+
* under the same documented exemption — because almost every reader
|
|
931
|
+
* decides "is this a live sale" from `disabled` alone, and a cancelled row
|
|
932
|
+
* left live could be walked back to `ready` and notify the customer who
|
|
933
|
+
* cancelled it. Collapsing cancellation into this union would still
|
|
934
|
+
* destroy the why, which is what the three cancellation fields keep.
|
|
922
935
|
*
|
|
923
936
|
* `not_delivered` is the one value NOT derivable from today's rows: it
|
|
924
937
|
* means a delivery ATTEMPT failed or was cancelled by the carrier, which no
|
package/dist/store.d.ts
CHANGED
|
@@ -971,6 +971,14 @@ declare global {
|
|
|
971
971
|
connectedAt?: number;
|
|
972
972
|
/** unix ms of the latest same-seller reconnect; absent until one happens, cleared by a switch. */
|
|
973
973
|
reconnectedAt?: number;
|
|
974
|
+
/**
|
|
975
|
+
* unix ms of the LATEST accepted OAuth link — stamped on every accepted
|
|
976
|
+
* link (first connect, same-seller reconnect, confirmed switch, switch
|
|
977
|
+
* back to a previous seller) and never restored from `sellerHistory`,
|
|
978
|
+
* unlike `connectedAt`. A refused or raced link leaves it untouched.
|
|
979
|
+
* Absent on a leaf not relinked since the field shipped (forward-only).
|
|
980
|
+
*/
|
|
981
|
+
lastLinkedAt?: number;
|
|
974
982
|
/**
|
|
975
983
|
* Every ML seller this store has been linked to, keyed by seller
|
|
976
984
|
* `user_id`. `firstLinkedAt` (unix ms) is written once per seller, on the
|