sinfactura-types 1.10.367 → 1.10.368
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/mercadolibre.d.ts +87 -0
- package/dist/store.d.ts +21 -0
- package/package.json +1 -1
package/dist/mercadolibre.d.ts
CHANGED
|
@@ -98,6 +98,93 @@ declare global {
|
|
|
98
98
|
data: MercadolibreSettlementPeriod[];
|
|
99
99
|
LastEvaluatedKey?: Record<string, unknown>;
|
|
100
100
|
}
|
|
101
|
+
/** What started a reconciliation run. */
|
|
102
|
+
type MlOrderReconcileTrigger = 'reconnect' | 'daily' | 'manual';
|
|
103
|
+
/** A reconciliation window on `date_created`, unix ms, `from` inclusive, `to` inclusive. */
|
|
104
|
+
interface MlOrderReconcileWindow {
|
|
105
|
+
from: number;
|
|
106
|
+
to: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* FE → BE body of `POST /mercadolibre/orders/sync` (ADMIN). Both bounds are
|
|
110
|
+
* unix ms and optional: `to` defaults to now, `from` to `to − 72h`. A `to`
|
|
111
|
+
* in the future is clamped to now. The window may span at most 60 days.
|
|
112
|
+
*/
|
|
113
|
+
interface MlOrdersSyncRequest {
|
|
114
|
+
from?: number;
|
|
115
|
+
to?: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* BE → FE `202` of `POST /mercadolibre/orders/sync`. The run is ASYNC (a
|
|
119
|
+
* multi-page `orders/search` walk with 429 back-off does not fit the API's
|
|
120
|
+
* 29 s cap); its outcome lands as one `MlOrderReconcileSummary` row in the
|
|
121
|
+
* store's integration events log, tagged with this `jobId`.
|
|
122
|
+
*/
|
|
123
|
+
interface MlOrdersSyncResponse {
|
|
124
|
+
jobId: string;
|
|
125
|
+
window: MlOrderReconcileWindow;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Refusals of `POST /mercadolibre/orders/sync` — each writes nothing.
|
|
129
|
+
* `ML_SYNC_WINDOW_INVALID` (400) — a bound is not a finite unix-ms number,
|
|
130
|
+
* or `from` is not before `to`.
|
|
131
|
+
* `ML_SYNC_WINDOW_TOO_LARGE` (400) — the window spans more than 60 days.
|
|
132
|
+
* `ML_SYNC_RATE_LIMITED` (429) — a manual run for this store started less
|
|
133
|
+
* than 10 minutes ago.
|
|
134
|
+
* `ML_NOT_CONNECTED` (409) — the store has no connected MercadoLibre seller.
|
|
135
|
+
*/
|
|
136
|
+
type MlOrdersSyncErrorCode = 'ML_SYNC_WINDOW_INVALID' | 'ML_SYNC_WINDOW_TOO_LARGE' | 'ML_SYNC_RATE_LIMITED' | 'ML_NOT_CONNECTED';
|
|
137
|
+
/**
|
|
138
|
+
* The one integration-events row a reconciliation run writes
|
|
139
|
+
* (`type: 'reconcile-sweep'`, `storeId` set). `scanned` counts orders ML listed;
|
|
140
|
+
* `created` those with no local pointer (each one is a lost notification);
|
|
141
|
+
* `updated` those whose ML `last_updated` is newer than ours;
|
|
142
|
+
* `skippedPreConnect` those created before the store's `connectedAt`,
|
|
143
|
+
* which the order worker refuses — never enqueued and never counted as
|
|
144
|
+
* recovered (absent on rows written before it existed). `truncated`
|
|
145
|
+
* means the run stopped at its page/time budget and resumes from its
|
|
146
|
+
* checkpoint next time — the counts cover only what was walked.
|
|
147
|
+
*/
|
|
148
|
+
interface MlOrderReconcileSummary {
|
|
149
|
+
trigger: MlOrderReconcileTrigger;
|
|
150
|
+
window: MlOrderReconcileWindow;
|
|
151
|
+
scanned: number;
|
|
152
|
+
created: number;
|
|
153
|
+
updated: number;
|
|
154
|
+
skippedPreConnect?: number;
|
|
155
|
+
truncated?: boolean;
|
|
156
|
+
jobId?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* `errorCode` of the row written for each notification re-enqueued by the
|
|
160
|
+
* reconnect replay (`storeId` set, so the tenant log shows what was
|
|
161
|
+
* recovered). `retry:manual` is the tenant retry; `retry:platform` the
|
|
162
|
+
* MANAGER retry of a row that carries no `storeId`.
|
|
163
|
+
*/
|
|
164
|
+
type MlEventRetryCode = 'retry:manual' | 'retry:reconnect' | 'retry:platform';
|
|
165
|
+
/**
|
|
166
|
+
* MANAGER body of the platform retry of an ML event row that has no
|
|
167
|
+
* `storeId` (an `unknown-seller` drop). The target store is named
|
|
168
|
+
* explicitly and must currently be linked to the row's `mlUserId`.
|
|
169
|
+
*/
|
|
170
|
+
interface MlPlatformEventRetryRequest {
|
|
171
|
+
mode: 'retry';
|
|
172
|
+
ts: number;
|
|
173
|
+
id: string;
|
|
174
|
+
storeId: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Refusals of the MANAGER platform retry — each writes nothing and
|
|
178
|
+
* enqueues nothing.
|
|
179
|
+
* `ML_EVENT_NOT_FOUND` (404) — no such row.
|
|
180
|
+
* `ML_EVENT_NOT_RETRYABLE` (422) — the row lacks the notification fields.
|
|
181
|
+
* `ML_EVENT_ALREADY_SCOPED` (409) — the row already carries a `storeId`;
|
|
182
|
+
* the tenant retry owns it.
|
|
183
|
+
* `ML_EVENT_STORE_NOT_CONNECTED` (409) — the named store has no linked seller.
|
|
184
|
+
* `ML_EVENT_SELLER_MISMATCH` (409) — the named store's linked seller is not
|
|
185
|
+
* the row's `mlUserId`.
|
|
186
|
+
*/
|
|
187
|
+
type MlPlatformEventRetryErrorCode = 'ML_EVENT_NOT_FOUND' | 'ML_EVENT_NOT_RETRYABLE' | 'ML_EVENT_ALREADY_SCOPED' | 'ML_EVENT_STORE_NOT_CONNECTED' | 'ML_EVENT_SELLER_MISMATCH' | 'ML_EVENT_RETRY_ENQUEUE_FAILED' | 'PROVIDER_NOT_SUPPORTED';
|
|
101
188
|
interface MlOauthDisconnectResponse {
|
|
102
189
|
disconnected: true;
|
|
103
190
|
storeId: string;
|
package/dist/store.d.ts
CHANGED
|
@@ -916,7 +916,28 @@ declare global {
|
|
|
916
916
|
* unpublished) carries them — so this expiry travels alone.
|
|
917
917
|
*/
|
|
918
918
|
expiresAt?: number;
|
|
919
|
+
/**
|
|
920
|
+
* unix ms of the FIRST link of this store to the currently linked seller —
|
|
921
|
+
* the date the pre-connect order guard compares against. A reconnect of
|
|
922
|
+
* the same seller keeps it. A first connect or a confirmed switch takes
|
|
923
|
+
* that seller's `sellerHistory[userId].firstLinkedAt` when the store was
|
|
924
|
+
* linked to it before, else the link time.
|
|
925
|
+
*/
|
|
919
926
|
connectedAt?: number;
|
|
927
|
+
/** unix ms of the latest same-seller reconnect; absent until one happens, cleared by a switch. */
|
|
928
|
+
reconnectedAt?: number;
|
|
929
|
+
/**
|
|
930
|
+
* Every ML seller this store has been linked to, keyed by seller
|
|
931
|
+
* `user_id`. `firstLinkedAt` (unix ms) is written once per seller, on the
|
|
932
|
+
* first successful link recorded for it, and never moved after that.
|
|
933
|
+
* A confirmed switch also records the seller being left, from its
|
|
934
|
+
* `connectedAt`. Survives a disconnect and a switch, so switching back to
|
|
935
|
+
* a seller restores its original `connectedAt`. Forward-only: a store
|
|
936
|
+
* starts recording at its next link after this field shipped.
|
|
937
|
+
*/
|
|
938
|
+
sellerHistory?: Record<string, {
|
|
939
|
+
firstLinkedAt: number;
|
|
940
|
+
}>;
|
|
920
941
|
tokenType?: string;
|
|
921
942
|
scope?: string;
|
|
922
943
|
status?: MercadolibreConnectionStatus;
|