@usethrottle/catalog 0.1.1 → 1.1.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/CHANGELOG.md +18 -0
- package/README.md +142 -11
- package/dist/admin.cjs +681 -0
- package/dist/admin.d.cts +660 -0
- package/dist/admin.d.ts +660 -0
- package/dist/admin.js +681 -0
- package/dist/{catalog-error-BWUoZCzY.d.ts → catalog-error-C_zLOtYA.d.ts} +3 -3
- package/dist/{catalog-error-DO6ANrGR.d.cts → catalog-error-s1BINNkt.d.cts} +3 -3
- package/dist/{chunk-CR7ILYCT.cjs → chunk-4ORXUW2U.cjs} +4 -2
- package/dist/{chunk-I3QRBPWD.js → chunk-JK2UY4CD.js} +3 -1
- package/dist/{client-BNtBTEyh.d.cts → client-BAoq6jmM.d.cts} +1 -1
- package/dist/{client-CHLvULRQ.d.ts → client-c2F-eCaL.d.ts} +1 -1
- package/dist/{types-DYfIvIaI.d.cts → contract-types-DhiThMEr.d.cts} +1 -272
- package/dist/{types-DYfIvIaI.d.ts → contract-types-DhiThMEr.d.ts} +1 -272
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/react.cjs +36 -25
- package/dist/react.d.cts +11 -5
- package/dist/react.d.ts +11 -5
- package/dist/react.js +20 -9
- package/dist/server.cjs +14 -13
- package/dist/server.d.cts +3 -2
- package/dist/server.d.ts +3 -2
- package/dist/server.js +3 -2
- package/dist/types-DsjoG8ce.d.cts +276 -0
- package/dist/types-xQLID-4j.d.ts +276 -0
- package/dist/url.d.cts +1 -0
- package/dist/url.d.ts +1 -0
- package/package.json +11 -1
package/dist/admin.d.cts
ADDED
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
export { C as CartLineError, a as CartLineProblem, b as CatalogError, c as CatalogErrorCode, d as CatalogErrorInit, e as CatalogErrorIssue, f as CatalogErrorSource, g as ClientErrorCode, h as CustomerTokenInvalidError, F as FeatureUnavailableError, N as NetworkError, O as OriginNotAllowedError, R as RateLimitedError, T as TimeoutError, i as isCatalogError } from './catalog-error-s1BINNkt.cjs';
|
|
2
|
+
import './contract-types-DhiThMEr.cjs';
|
|
3
|
+
|
|
4
|
+
type JobBatchAnswer = {
|
|
5
|
+
batchId: string;
|
|
6
|
+
sequence: number;
|
|
7
|
+
rowsAccepted: number;
|
|
8
|
+
rowsRefused: number;
|
|
9
|
+
issues: {
|
|
10
|
+
index: number;
|
|
11
|
+
code: 'INVALID_ROW' | 'INVALID_VALUE' | 'MISSING_SKU' | 'MISSING_PRODUCT_HANDLE' | 'UNKNOWN_SKU' | 'INVALID_GTIN_DROPPED' | 'DUPLICATE_SKU_REPLACED' | 'SCATTERED_PRODUCT_ROWS' | 'CONFLICTING_PRODUCT_VALUE' | 'PRODUCT_SPLIT_ACROSS_CHUNKS' | 'TOO_MANY_OPTIONS' | 'TOO_MANY_VARIANTS' | 'CATEGORY_TOO_DEEP' | 'INVALID_STATUS' | 'IMAGE_COPY_FAILED' | 'IMAGE_ONLY_ROW' | 'INVALID_CURRENCY' | 'PRICE_LIST_BASE_CURRENCY' | 'LIST_SALE_WITHOUT_PRICE' | 'LOCALE_NOT_ENABLED' | 'GROUP_NOT_FOUND' | 'GROUP_KIND_MISMATCH' | 'TRANSLATION_TOO_LONG' | 'TRANSLATION_CONFLICT' | 'UNKNOWN_PRODUCT_HANDLE' | 'INVALID_RATING' | 'REVIEW_DATE_IN_FUTURE' | 'REVIEW_TEXT_INVALID' | 'DUPLICATE_REVIEW' | 'REVIEW_ROW_LIMIT' | 'EXTERNAL_ID_REQUIRED' | 'SKU_CONFLICT' | 'FIELD_NOT_ALLOWED' | 'ATTRIBUTE_UNKNOWN' | 'HANDLE_TAKEN' | 'MERCHANT_HOLD' | 'QUANTITY_BELOW_ZERO' | 'QUANTITY_OUT_OF_RANGE' | 'STOCK_MODE_CONFLICT' | 'DUPLICATE_SKU_IN_BATCH' | 'QUANTITY_MODE_WITHOUT_QUANTITY';
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
type JobBatchRequest = {
|
|
15
|
+
rows: ((PushRow) | ({
|
|
16
|
+
[key: string]: JsonValue;
|
|
17
|
+
}))[];
|
|
18
|
+
};
|
|
19
|
+
type JsonValue = (string) | (number) | (boolean) | (JsonValue[]) | ({
|
|
20
|
+
[key: string]: JsonValue;
|
|
21
|
+
}) | null;
|
|
22
|
+
type OpenJobRequest = {
|
|
23
|
+
mode?: 'merge' | 'replace' | undefined;
|
|
24
|
+
fullSync?: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
type PushAssignVendorRequest = {
|
|
27
|
+
vendorId: string | null;
|
|
28
|
+
products: PushProductRef[];
|
|
29
|
+
};
|
|
30
|
+
type PushErrorEnvelope = {
|
|
31
|
+
error: {
|
|
32
|
+
code: string;
|
|
33
|
+
message: string;
|
|
34
|
+
requestId: string;
|
|
35
|
+
issues?: {
|
|
36
|
+
path: string;
|
|
37
|
+
message: string;
|
|
38
|
+
}[] | undefined;
|
|
39
|
+
};
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
type PushInventoryAnswer = {
|
|
43
|
+
results: {
|
|
44
|
+
sku: string | null;
|
|
45
|
+
status: 'updated' | 'unchanged' | 'not_found' | 'invalid';
|
|
46
|
+
code?: 'QUANTITY_BELOW_ZERO' | 'QUANTITY_OUT_OF_RANGE' | 'QUANTITY_MODE_WITHOUT_QUANTITY' | 'STOCK_MODE_CONFLICT' | 'DUPLICATE_SKU_IN_BATCH' | undefined;
|
|
47
|
+
message?: string | undefined;
|
|
48
|
+
quantity?: number | undefined;
|
|
49
|
+
sourceWins?: boolean | undefined;
|
|
50
|
+
}[];
|
|
51
|
+
};
|
|
52
|
+
type PushInventoryRequest = {
|
|
53
|
+
rows: (({
|
|
54
|
+
sku: string;
|
|
55
|
+
priceMinor?: number | undefined;
|
|
56
|
+
salePriceMinor?: number | null | undefined;
|
|
57
|
+
currency?: string | undefined;
|
|
58
|
+
availability?: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | undefined;
|
|
59
|
+
quantity?: number | undefined;
|
|
60
|
+
quantityMode?: 'set' | 'adjust' | undefined;
|
|
61
|
+
}) | ({
|
|
62
|
+
[key: string]: JsonValue;
|
|
63
|
+
}))[];
|
|
64
|
+
};
|
|
65
|
+
type PushJob = {
|
|
66
|
+
jobId: string;
|
|
67
|
+
state: 'open' | 'closed' | 'expired';
|
|
68
|
+
mode: 'merge' | 'replace';
|
|
69
|
+
fullSync: boolean;
|
|
70
|
+
vendorId: string | null;
|
|
71
|
+
openedAt: string;
|
|
72
|
+
expiresAt: string;
|
|
73
|
+
closedAt: string | null;
|
|
74
|
+
finishedAt: string | null;
|
|
75
|
+
failureCode: string | null;
|
|
76
|
+
batchesReceived: number;
|
|
77
|
+
rowsReceived: number;
|
|
78
|
+
rowsValidated: number;
|
|
79
|
+
rowsRefused: number;
|
|
80
|
+
batchesApplied?: number | undefined;
|
|
81
|
+
rowsApplied?: number | undefined;
|
|
82
|
+
rowsFailed?: number | undefined;
|
|
83
|
+
created?: number | undefined;
|
|
84
|
+
updated?: number | undefined;
|
|
85
|
+
unchanged?: number | undefined;
|
|
86
|
+
reportExpiresAt?: string | null | undefined;
|
|
87
|
+
batches?: {
|
|
88
|
+
batchId: string;
|
|
89
|
+
sequence: number;
|
|
90
|
+
rows: number;
|
|
91
|
+
rowsRefused: number;
|
|
92
|
+
status: 'staged' | 'applied' | 'discarded';
|
|
93
|
+
}[] | undefined;
|
|
94
|
+
};
|
|
95
|
+
type PushJobAnswer = {
|
|
96
|
+
job: PushJob;
|
|
97
|
+
};
|
|
98
|
+
type PushOpenApiDocument = {
|
|
99
|
+
openapi: string;
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
};
|
|
102
|
+
type PushProduct = {
|
|
103
|
+
title?: string | null | undefined;
|
|
104
|
+
description?: string | null | undefined;
|
|
105
|
+
brand?: string | null | undefined;
|
|
106
|
+
productType?: string | null | undefined;
|
|
107
|
+
googleCategory?: string | null | undefined;
|
|
108
|
+
link?: string | null | undefined;
|
|
109
|
+
images?: {
|
|
110
|
+
url: string;
|
|
111
|
+
altText?: string | undefined;
|
|
112
|
+
mediaId?: string | undefined;
|
|
113
|
+
width?: number | undefined;
|
|
114
|
+
height?: number | undefined;
|
|
115
|
+
}[] | null | undefined;
|
|
116
|
+
shortDescription?: string | null | undefined;
|
|
117
|
+
seoTitle?: string | null | undefined;
|
|
118
|
+
seoDescription?: string | null | undefined;
|
|
119
|
+
tags?: string[] | null | undefined;
|
|
120
|
+
categories?: string[] | null | undefined;
|
|
121
|
+
featured?: boolean | null | undefined;
|
|
122
|
+
draft: boolean;
|
|
123
|
+
options?: {
|
|
124
|
+
name: string;
|
|
125
|
+
values: {
|
|
126
|
+
value: string;
|
|
127
|
+
code: string;
|
|
128
|
+
}[];
|
|
129
|
+
}[] | null | undefined;
|
|
130
|
+
skuPattern?: {
|
|
131
|
+
base: string;
|
|
132
|
+
separator: '-' | '_' | '.' | '';
|
|
133
|
+
} | null | undefined;
|
|
134
|
+
externalId: string | null;
|
|
135
|
+
handle: string;
|
|
136
|
+
status: 'draft' | 'active' | 'archived';
|
|
137
|
+
held: boolean;
|
|
138
|
+
apiArchived: boolean;
|
|
139
|
+
purgeAfter: string | null;
|
|
140
|
+
vendorId: string | null;
|
|
141
|
+
attributes: {
|
|
142
|
+
[key: string]: JsonValue;
|
|
143
|
+
};
|
|
144
|
+
variants: {
|
|
145
|
+
title?: string | null | undefined;
|
|
146
|
+
description?: string | null | undefined;
|
|
147
|
+
gtin?: string | null | undefined;
|
|
148
|
+
mpn?: string | null | undefined;
|
|
149
|
+
condition?: 'new' | 'refurbished' | 'used' | null | undefined;
|
|
150
|
+
priceMinor?: number | null | undefined;
|
|
151
|
+
salePriceMinor?: number | null | undefined;
|
|
152
|
+
currency?: string | null | undefined;
|
|
153
|
+
availability?: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null | undefined;
|
|
154
|
+
quantity: number;
|
|
155
|
+
weightGrams?: number | null | undefined;
|
|
156
|
+
lengthMm?: number | null | undefined;
|
|
157
|
+
widthMm?: number | null | undefined;
|
|
158
|
+
heightMm?: number | null | undefined;
|
|
159
|
+
options?: Record<string, string> | null | undefined;
|
|
160
|
+
images?: {
|
|
161
|
+
url: string;
|
|
162
|
+
altText?: string | undefined;
|
|
163
|
+
mediaId?: string | undefined;
|
|
164
|
+
width?: number | undefined;
|
|
165
|
+
height?: number | undefined;
|
|
166
|
+
}[] | null | undefined;
|
|
167
|
+
compareAtPriceMinor?: number | null | undefined;
|
|
168
|
+
trackInventory?: boolean | null | undefined;
|
|
169
|
+
backorders?: 'deny' | 'allow' | null | undefined;
|
|
170
|
+
minOrderQuantity?: number | null | undefined;
|
|
171
|
+
maxOrderQuantity?: number | null | undefined;
|
|
172
|
+
image?: {
|
|
173
|
+
url: string;
|
|
174
|
+
altText?: string | undefined;
|
|
175
|
+
mediaId?: string | undefined;
|
|
176
|
+
width?: number | undefined;
|
|
177
|
+
height?: number | undefined;
|
|
178
|
+
} | null | undefined;
|
|
179
|
+
identifierExists?: boolean | null | undefined;
|
|
180
|
+
sku: string;
|
|
181
|
+
status: 'active' | 'archived';
|
|
182
|
+
}[];
|
|
183
|
+
};
|
|
184
|
+
type PushProductAnswer = {
|
|
185
|
+
product: PushProduct;
|
|
186
|
+
};
|
|
187
|
+
type PushProductOpsAnswer = {
|
|
188
|
+
results: {
|
|
189
|
+
index: number;
|
|
190
|
+
status: 'assigned' | 'done' | 'archived' | 'restored' | 'unchanged' | 'held' | 'not_found';
|
|
191
|
+
}[];
|
|
192
|
+
};
|
|
193
|
+
type PushProductRef = ({
|
|
194
|
+
externalId: string;
|
|
195
|
+
}) | ({
|
|
196
|
+
handle: string;
|
|
197
|
+
}) | ({
|
|
198
|
+
sku: string;
|
|
199
|
+
});
|
|
200
|
+
type PushProductsAnswer = (PushProductAnswer) | ({
|
|
201
|
+
products: PushProduct[];
|
|
202
|
+
nextCursor: string | null;
|
|
203
|
+
});
|
|
204
|
+
type PushProductsRequest = {
|
|
205
|
+
products: PushProductRef[];
|
|
206
|
+
};
|
|
207
|
+
type PushRenameRequest = {
|
|
208
|
+
product: PushProductRef;
|
|
209
|
+
handle: string;
|
|
210
|
+
};
|
|
211
|
+
type PushRow = {
|
|
212
|
+
sku: string;
|
|
213
|
+
productHandle?: string | undefined;
|
|
214
|
+
product?: {
|
|
215
|
+
title?: string | null | undefined;
|
|
216
|
+
description?: string | null | undefined;
|
|
217
|
+
brand?: string | null | undefined;
|
|
218
|
+
productType?: string | null | undefined;
|
|
219
|
+
googleCategory?: string | null | undefined;
|
|
220
|
+
link?: string | null | undefined;
|
|
221
|
+
images?: {
|
|
222
|
+
url: string;
|
|
223
|
+
altText?: string | undefined;
|
|
224
|
+
mediaId?: string | undefined;
|
|
225
|
+
width?: number | undefined;
|
|
226
|
+
height?: number | undefined;
|
|
227
|
+
}[] | null | undefined;
|
|
228
|
+
shortDescription?: string | null | undefined;
|
|
229
|
+
seoTitle?: string | null | undefined;
|
|
230
|
+
seoDescription?: string | null | undefined;
|
|
231
|
+
tags?: string[] | null | undefined;
|
|
232
|
+
categories?: ((string) | (string))[] | null | undefined;
|
|
233
|
+
featured?: boolean | null | undefined;
|
|
234
|
+
draft?: boolean | null | undefined;
|
|
235
|
+
options?: {
|
|
236
|
+
name: string;
|
|
237
|
+
values: {
|
|
238
|
+
value: string;
|
|
239
|
+
code: string;
|
|
240
|
+
}[];
|
|
241
|
+
}[] | null | undefined;
|
|
242
|
+
skuPattern?: {
|
|
243
|
+
base: string;
|
|
244
|
+
separator: '-' | '_' | '.' | '';
|
|
245
|
+
} | null | undefined;
|
|
246
|
+
} | undefined;
|
|
247
|
+
variant?: {
|
|
248
|
+
title?: string | null | undefined;
|
|
249
|
+
description?: string | null | undefined;
|
|
250
|
+
gtin?: string | null | undefined;
|
|
251
|
+
mpn?: string | null | undefined;
|
|
252
|
+
condition?: 'new' | 'refurbished' | 'used' | null | undefined;
|
|
253
|
+
priceMinor?: number | null | undefined;
|
|
254
|
+
salePriceMinor?: number | null | undefined;
|
|
255
|
+
currency?: string | null | undefined;
|
|
256
|
+
availability?: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null | undefined;
|
|
257
|
+
quantity?: number | null | undefined;
|
|
258
|
+
weightGrams?: number | null | undefined;
|
|
259
|
+
lengthMm?: number | null | undefined;
|
|
260
|
+
widthMm?: number | null | undefined;
|
|
261
|
+
heightMm?: number | null | undefined;
|
|
262
|
+
options?: Record<string, string> | null | undefined;
|
|
263
|
+
images?: {
|
|
264
|
+
url: string;
|
|
265
|
+
altText?: string | undefined;
|
|
266
|
+
mediaId?: string | undefined;
|
|
267
|
+
width?: number | undefined;
|
|
268
|
+
height?: number | undefined;
|
|
269
|
+
}[] | null | undefined;
|
|
270
|
+
compareAtPriceMinor?: number | null | undefined;
|
|
271
|
+
trackInventory?: boolean | null | undefined;
|
|
272
|
+
backorders?: 'deny' | 'allow' | null | undefined;
|
|
273
|
+
minOrderQuantity?: number | null | undefined;
|
|
274
|
+
maxOrderQuantity?: number | null | undefined;
|
|
275
|
+
image?: {
|
|
276
|
+
url: string;
|
|
277
|
+
altText?: string | undefined;
|
|
278
|
+
mediaId?: string | undefined;
|
|
279
|
+
width?: number | undefined;
|
|
280
|
+
height?: number | undefined;
|
|
281
|
+
} | null | undefined;
|
|
282
|
+
identifierExists?: boolean | null | undefined;
|
|
283
|
+
} | undefined;
|
|
284
|
+
attributes?: Record<string, (string) | (number) | (boolean) | null> | undefined;
|
|
285
|
+
prices?: Record<string, {
|
|
286
|
+
priceMinor?: number | null | undefined;
|
|
287
|
+
salePriceMinor?: number | null | undefined;
|
|
288
|
+
compareAtPriceMinor?: number | null | undefined;
|
|
289
|
+
}> | undefined;
|
|
290
|
+
translations?: Record<string, {
|
|
291
|
+
title?: string | null | undefined;
|
|
292
|
+
description?: string | null | undefined;
|
|
293
|
+
shortDescription?: string | null | undefined;
|
|
294
|
+
seoTitle?: string | null | undefined;
|
|
295
|
+
seoDescription?: string | null | undefined;
|
|
296
|
+
options?: Record<string, {
|
|
297
|
+
name: string;
|
|
298
|
+
values: Record<string, string>;
|
|
299
|
+
}> | null | undefined;
|
|
300
|
+
}> | undefined;
|
|
301
|
+
groupPrices?: Record<string, Record<string, number | null>> | undefined;
|
|
302
|
+
externalId?: string | undefined;
|
|
303
|
+
status?: 'draft' | 'active' | undefined;
|
|
304
|
+
quantityMode?: 'set' | 'adjust' | undefined;
|
|
305
|
+
};
|
|
306
|
+
type PushRunAnswer = {
|
|
307
|
+
run: {
|
|
308
|
+
runId: string;
|
|
309
|
+
origin: 'upload' | 'api';
|
|
310
|
+
uploadId: string | null;
|
|
311
|
+
fileType: 'products' | 'fitment' | 'oem' | 'supersessions' | 'reviews';
|
|
312
|
+
mode: 'upsert' | 'full_sync';
|
|
313
|
+
sourceName: string;
|
|
314
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
315
|
+
rowsRead: number;
|
|
316
|
+
rowsApplied: number;
|
|
317
|
+
rowsFailed: number;
|
|
318
|
+
rowsWarned: number;
|
|
319
|
+
created: number;
|
|
320
|
+
updated: number;
|
|
321
|
+
unchanged: number;
|
|
322
|
+
reportRows: number;
|
|
323
|
+
failureCode: string | null;
|
|
324
|
+
createdAt: string;
|
|
325
|
+
updatedAt: string;
|
|
326
|
+
finishedAt: string | null;
|
|
327
|
+
vendorId?: string | null | undefined;
|
|
328
|
+
pushMode?: 'merge' | 'replace' | undefined;
|
|
329
|
+
fullSync?: boolean | undefined;
|
|
330
|
+
reportExpiresAt?: string | null | undefined;
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
type PushRunStarted = {
|
|
334
|
+
runId: string;
|
|
335
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
336
|
+
};
|
|
337
|
+
type PushStockPage = {
|
|
338
|
+
rows: PushStockResult[];
|
|
339
|
+
nextCursor: string | null;
|
|
340
|
+
};
|
|
341
|
+
type PushStockResult = {
|
|
342
|
+
sequence: number;
|
|
343
|
+
rowNumber: number;
|
|
344
|
+
sku: string;
|
|
345
|
+
externalId: string | null;
|
|
346
|
+
quantity: number;
|
|
347
|
+
sourceWins: boolean;
|
|
348
|
+
};
|
|
349
|
+
type PushVariantsRequest = {
|
|
350
|
+
rows: (({
|
|
351
|
+
sku: string;
|
|
352
|
+
productHandle: string;
|
|
353
|
+
product?: {
|
|
354
|
+
title?: string | null | undefined;
|
|
355
|
+
description?: string | null | undefined;
|
|
356
|
+
brand?: string | null | undefined;
|
|
357
|
+
productType?: string | null | undefined;
|
|
358
|
+
googleCategory?: string | null | undefined;
|
|
359
|
+
link?: string | null | undefined;
|
|
360
|
+
images?: {
|
|
361
|
+
url: string;
|
|
362
|
+
altText?: string | undefined;
|
|
363
|
+
mediaId?: string | undefined;
|
|
364
|
+
width?: number | undefined;
|
|
365
|
+
height?: number | undefined;
|
|
366
|
+
}[] | null | undefined;
|
|
367
|
+
shortDescription?: string | null | undefined;
|
|
368
|
+
seoTitle?: string | null | undefined;
|
|
369
|
+
seoDescription?: string | null | undefined;
|
|
370
|
+
tags?: string[] | null | undefined;
|
|
371
|
+
categories?: ((string) | (string))[] | null | undefined;
|
|
372
|
+
featured?: boolean | null | undefined;
|
|
373
|
+
draft?: boolean | null | undefined;
|
|
374
|
+
options?: {
|
|
375
|
+
name: string;
|
|
376
|
+
values: {
|
|
377
|
+
value: string;
|
|
378
|
+
code: string;
|
|
379
|
+
}[];
|
|
380
|
+
}[] | null | undefined;
|
|
381
|
+
skuPattern?: {
|
|
382
|
+
base: string;
|
|
383
|
+
separator: '-' | '_' | '.' | '';
|
|
384
|
+
} | null | undefined;
|
|
385
|
+
} | undefined;
|
|
386
|
+
variant?: {
|
|
387
|
+
title?: string | null | undefined;
|
|
388
|
+
description?: string | null | undefined;
|
|
389
|
+
gtin?: string | null | undefined;
|
|
390
|
+
mpn?: string | null | undefined;
|
|
391
|
+
condition?: 'new' | 'refurbished' | 'used' | null | undefined;
|
|
392
|
+
priceMinor?: number | null | undefined;
|
|
393
|
+
salePriceMinor?: number | null | undefined;
|
|
394
|
+
currency?: string | null | undefined;
|
|
395
|
+
availability?: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null | undefined;
|
|
396
|
+
quantity?: number | null | undefined;
|
|
397
|
+
weightGrams?: number | null | undefined;
|
|
398
|
+
lengthMm?: number | null | undefined;
|
|
399
|
+
widthMm?: number | null | undefined;
|
|
400
|
+
heightMm?: number | null | undefined;
|
|
401
|
+
options?: Record<string, string> | null | undefined;
|
|
402
|
+
images?: {
|
|
403
|
+
url: string;
|
|
404
|
+
altText?: string | undefined;
|
|
405
|
+
mediaId?: string | undefined;
|
|
406
|
+
width?: number | undefined;
|
|
407
|
+
height?: number | undefined;
|
|
408
|
+
}[] | null | undefined;
|
|
409
|
+
compareAtPriceMinor?: number | null | undefined;
|
|
410
|
+
trackInventory?: boolean | null | undefined;
|
|
411
|
+
backorders?: 'deny' | 'allow' | null | undefined;
|
|
412
|
+
minOrderQuantity?: number | null | undefined;
|
|
413
|
+
maxOrderQuantity?: number | null | undefined;
|
|
414
|
+
image?: {
|
|
415
|
+
url: string;
|
|
416
|
+
altText?: string | undefined;
|
|
417
|
+
mediaId?: string | undefined;
|
|
418
|
+
width?: number | undefined;
|
|
419
|
+
height?: number | undefined;
|
|
420
|
+
} | null | undefined;
|
|
421
|
+
identifierExists?: boolean | null | undefined;
|
|
422
|
+
} | undefined;
|
|
423
|
+
attributes?: Record<string, (string) | (number) | (boolean) | null> | undefined;
|
|
424
|
+
prices?: Record<string, {
|
|
425
|
+
priceMinor?: number | null | undefined;
|
|
426
|
+
salePriceMinor?: number | null | undefined;
|
|
427
|
+
compareAtPriceMinor?: number | null | undefined;
|
|
428
|
+
}> | undefined;
|
|
429
|
+
translations?: Record<string, {
|
|
430
|
+
title?: string | null | undefined;
|
|
431
|
+
description?: string | null | undefined;
|
|
432
|
+
shortDescription?: string | null | undefined;
|
|
433
|
+
seoTitle?: string | null | undefined;
|
|
434
|
+
seoDescription?: string | null | undefined;
|
|
435
|
+
options?: Record<string, {
|
|
436
|
+
name: string;
|
|
437
|
+
values: Record<string, string>;
|
|
438
|
+
}> | null | undefined;
|
|
439
|
+
}> | undefined;
|
|
440
|
+
groupPrices?: Record<string, Record<string, number | null>> | undefined;
|
|
441
|
+
}) | ({
|
|
442
|
+
[key: string]: JsonValue;
|
|
443
|
+
}))[];
|
|
444
|
+
};
|
|
445
|
+
type PushWebhookEvent = {
|
|
446
|
+
id: string;
|
|
447
|
+
type: 'catalog.run.completed' | 'catalog.run.failed';
|
|
448
|
+
createdAt: string;
|
|
449
|
+
data: {
|
|
450
|
+
runId: string;
|
|
451
|
+
vendorId: string | null;
|
|
452
|
+
mode: 'merge' | 'replace';
|
|
453
|
+
fullSync: boolean;
|
|
454
|
+
failureCode: string | null;
|
|
455
|
+
received: number;
|
|
456
|
+
created: number;
|
|
457
|
+
updated: number;
|
|
458
|
+
unchanged: number;
|
|
459
|
+
rowsFailed: number;
|
|
460
|
+
rowsWarned: number;
|
|
461
|
+
finishedAt: string;
|
|
462
|
+
reportExpiresAt: string | null;
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
type CatalogPushErrorCode = 'AUTHENTICATION_FAILED' | 'VENDOR_PAUSED' | 'VENDOR_KEY_NOT_ALLOWED' | 'INVALID_REQUEST' | 'IDEMPOTENCY_KEY_REQUIRED' | 'NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'VENDOR_NOT_FOUND' | 'IDEMPOTENCY_CONFLICT' | 'RUN_IN_PROGRESS' | 'JOB_CLOSED' | 'JOB_FULL' | 'TOO_MANY_OPEN_JOBS' | 'REPORT_TOO_LARGE' | 'HANDLE_TAKEN' | 'IDENTIFIER_LOCKED' | 'REPORT_EXPIRED' | 'REQUEST_BODY_TOO_LARGE' | 'MAPPING_INVALID' | 'RATE_LIMITED' | 'PUSH_QUEUE_FULL' | 'INTERNAL_ERROR' | 'INFRASTRUCTURE_UNAVAILABLE';
|
|
466
|
+
|
|
467
|
+
type InventoryRows = PushInventoryRequest['rows'];
|
|
468
|
+
/**
|
|
469
|
+
* @experimental The admin entry may change in a minor release.
|
|
470
|
+
*/
|
|
471
|
+
type AdminInventoryNamespace = {
|
|
472
|
+
/** `PATCH /v1/catalog/inventory`: each row replaces the stored quantity. */
|
|
473
|
+
set(rows: InventoryRows): Promise<PushInventoryAnswer>;
|
|
474
|
+
/**
|
|
475
|
+
* Each row's `quantity` is a signed amount added to the stored one (every
|
|
476
|
+
* row is sent with `quantityMode: 'adjust'`). A missing `idempotencyKey` is
|
|
477
|
+
* generated with `crypto.randomUUID()`, and a retry within the call reuses
|
|
478
|
+
* it, so a delta is never applied twice.
|
|
479
|
+
*/
|
|
480
|
+
adjust(rows: InventoryRows, options?: {
|
|
481
|
+
idempotencyKey?: string;
|
|
482
|
+
}): Promise<PushInventoryAnswer>;
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* A page of products, with the cursor of the next one (`null` at the end).
|
|
487
|
+
* @experimental The admin entry may change in a minor release.
|
|
488
|
+
*/
|
|
489
|
+
type PushProductList = {
|
|
490
|
+
products: PushProduct[];
|
|
491
|
+
nextCursor: string | null;
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* @experimental The admin entry may change in a minor release.
|
|
495
|
+
*/
|
|
496
|
+
type AdminProductsNamespace = {
|
|
497
|
+
/** One product by exactly one of `externalId`, `sku` or `handle`. */
|
|
498
|
+
get(ref: PushProductRef): Promise<PushProduct>;
|
|
499
|
+
list(options?: {
|
|
500
|
+
cursor?: string;
|
|
501
|
+
limit?: number;
|
|
502
|
+
}): Promise<PushProductList>;
|
|
503
|
+
/** Takes the products off the storefront; each answer says what happened. */
|
|
504
|
+
archive(refs: PushProductsRequest['products']): Promise<PushProductOpsAnswer>;
|
|
505
|
+
restore(refs: PushProductsRequest['products']): Promise<PushProductOpsAnswer>;
|
|
506
|
+
rename(ref: PushProductRef, handle: string): Promise<PushProduct>;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
type Row = JobBatchRequest['rows'][number];
|
|
510
|
+
/**
|
|
511
|
+
* How `wait` polls.
|
|
512
|
+
* @experimental The admin entry may change in a minor release.
|
|
513
|
+
*/
|
|
514
|
+
type WaitOptions = {
|
|
515
|
+
/** Between polls. Defaults to 5000. */
|
|
516
|
+
intervalMs?: number;
|
|
517
|
+
/** In total. Defaults to 24 hours; then `TimeoutError`. */
|
|
518
|
+
timeoutMs?: number;
|
|
519
|
+
signal?: AbortSignal;
|
|
520
|
+
};
|
|
521
|
+
/**
|
|
522
|
+
* One sync job: send batches, close, then follow it to the end.
|
|
523
|
+
* @experimental The admin entry may change in a minor release.
|
|
524
|
+
*/
|
|
525
|
+
type PushJobHandle = {
|
|
526
|
+
readonly jobId: string;
|
|
527
|
+
/** A missing key is generated for this batch, so an adjust row always carries one. */
|
|
528
|
+
send(rows: JobBatchRequest['rows'], options?: {
|
|
529
|
+
idempotencyKey?: string;
|
|
530
|
+
}): Promise<JobBatchAnswer>;
|
|
531
|
+
/** Applies the staged batches together. */
|
|
532
|
+
close(): Promise<PushJob>;
|
|
533
|
+
get(options?: {
|
|
534
|
+
includeBatches?: boolean;
|
|
535
|
+
}): Promise<PushJob>;
|
|
536
|
+
/** Resolves with the job once it has finished or expired; read `failureCode`. */
|
|
537
|
+
wait(options?: WaitOptions): Promise<PushJob>;
|
|
538
|
+
/** The refused and failed rows. `409 REPORT_TOO_LARGE` for a very large report (row numbers are job-wide). */
|
|
539
|
+
errorsCsv(): Promise<string>;
|
|
540
|
+
/** The quantity each stock-writing row left, page by page. */
|
|
541
|
+
stockResults(): AsyncIterable<PushStockResult>;
|
|
542
|
+
stockCsv(): Promise<string>;
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Options for `jobs.run`.
|
|
546
|
+
* @experimental The admin entry may change in a minor release.
|
|
547
|
+
*/
|
|
548
|
+
type JobRunOptions = {
|
|
549
|
+
mode?: 'merge' | 'replace';
|
|
550
|
+
fullSync?: boolean;
|
|
551
|
+
/** Rows per batch, 1 to 1,000. Defaults to 1,000. */
|
|
552
|
+
batchRows?: number;
|
|
553
|
+
/** Cancels the waits between queue-full retries. */
|
|
554
|
+
signal?: AbortSignal;
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* @experimental The admin entry may change in a minor release.
|
|
558
|
+
*/
|
|
559
|
+
type JobsNamespace = {
|
|
560
|
+
open(options?: {
|
|
561
|
+
mode?: 'merge' | 'replace';
|
|
562
|
+
fullSync?: boolean;
|
|
563
|
+
}): Promise<PushJobHandle>;
|
|
564
|
+
/** Checks the job exists (a `404` otherwise) and returns its handle. */
|
|
565
|
+
get(jobId: string): Promise<PushJobHandle>;
|
|
566
|
+
/** A handle for a job you opened earlier. Sends no request. */
|
|
567
|
+
resume(jobId: string): PushJobHandle;
|
|
568
|
+
/**
|
|
569
|
+
* Opens a job, sends the rows in batches of at most 1,000 rows and 5 MB,
|
|
570
|
+
* closes it and returns the handle. The rows of one product must be next to
|
|
571
|
+
* each other: they are never split across batches.
|
|
572
|
+
*/
|
|
573
|
+
run(rows: Iterable<Row> | AsyncIterable<Row>, options?: JobRunOptions): Promise<PushJobHandle>;
|
|
574
|
+
};
|
|
575
|
+
/**
|
|
576
|
+
* @experimental The admin entry may change in a minor release.
|
|
577
|
+
*/
|
|
578
|
+
type BatchesNamespace = {
|
|
579
|
+
/**
|
|
580
|
+
* `POST /v1/catalog/variants`: one batch, answered with a run to follow.
|
|
581
|
+
* `mode` needs a vendor key (a store key's route ignores it: use `jobs.run`).
|
|
582
|
+
*/
|
|
583
|
+
send(rows: PushVariantsRequest['rows'], options?: {
|
|
584
|
+
mode?: 'merge' | 'replace';
|
|
585
|
+
idempotencyKey?: string;
|
|
586
|
+
}): Promise<PushRunStarted>;
|
|
587
|
+
};
|
|
588
|
+
/**
|
|
589
|
+
* @experimental The admin entry may change in a minor release.
|
|
590
|
+
*/
|
|
591
|
+
type RunsNamespace = {
|
|
592
|
+
get(runId: string): Promise<PushRunAnswer['run']>;
|
|
593
|
+
/** Resolves with the run once it has completed or failed; read `status`. */
|
|
594
|
+
wait(runId: string, options?: WaitOptions): Promise<PushRunAnswer['run']>;
|
|
595
|
+
errorsCsv(runId: string): Promise<string>;
|
|
596
|
+
stockResults(runId: string): AsyncIterable<PushStockResult>;
|
|
597
|
+
stockCsv(runId: string): Promise<string>;
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Options for `createCatalogAdmin`.
|
|
602
|
+
* @experimental The admin entry may change in a minor release.
|
|
603
|
+
*/
|
|
604
|
+
type CatalogAdminOptions = {
|
|
605
|
+
/** A secret (`pc_sk_`) or vendor (`pc_vk_`) key. Never put one in a browser. */
|
|
606
|
+
key: string;
|
|
607
|
+
/** Defaults to `https://catalog.usethrottle.dev`. */
|
|
608
|
+
baseUrl?: string;
|
|
609
|
+
/** Per request, in milliseconds. Defaults to 60 seconds. */
|
|
610
|
+
timeoutMs?: number;
|
|
611
|
+
fetch?: typeof fetch;
|
|
612
|
+
};
|
|
613
|
+
/**
|
|
614
|
+
* The server-only admin client for the catalog push API.
|
|
615
|
+
* @experimental The admin entry may change in a minor release.
|
|
616
|
+
*/
|
|
617
|
+
type CatalogAdmin = {
|
|
618
|
+
jobs: JobsNamespace;
|
|
619
|
+
batches: BatchesNamespace;
|
|
620
|
+
runs: RunsNamespace;
|
|
621
|
+
products: AdminProductsNamespace;
|
|
622
|
+
inventory: AdminInventoryNamespace;
|
|
623
|
+
};
|
|
624
|
+
/**
|
|
625
|
+
* Creates the admin client for the catalog push API: sync jobs, single
|
|
626
|
+
* batches, run and job polling, reports, product operations and stock writes.
|
|
627
|
+
* Server-only: it throws `CatalogError` `SERVER_ONLY` in a browser
|
|
628
|
+
* environment, and `INVALID_ADMIN_KEY` unless `key` is a `pc_sk_` or `pc_vk_`
|
|
629
|
+
* key. The key is never part of an error message.
|
|
630
|
+
* @experimental The admin entry may change in a minor release.
|
|
631
|
+
*/
|
|
632
|
+
declare function createCatalogAdmin(options: CatalogAdminOptions): CatalogAdmin;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* What `verifyCatalogWebhook` needs.
|
|
636
|
+
* @experimental The admin entry may change in a minor release.
|
|
637
|
+
*/
|
|
638
|
+
type VerifyCatalogWebhookInput = {
|
|
639
|
+
/** The request body exactly as received, before any JSON parsing. */
|
|
640
|
+
rawBody: string;
|
|
641
|
+
/** The `x-catalog-signature` header: `t=<seconds>,v1=<hex>[,v1=<hex>…]`. */
|
|
642
|
+
signature: string;
|
|
643
|
+
/** The webhook's signing secret. */
|
|
644
|
+
secret: string;
|
|
645
|
+
/** Unix seconds; defaults to the clock. */
|
|
646
|
+
now?: number;
|
|
647
|
+
/** Defaults to 300. */
|
|
648
|
+
toleranceSeconds?: number;
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* Checks a catalog webhook: exactly one `t` and 1 to 8 `v1` digests, any
|
|
652
|
+
* matching `v1` passes (secret rotation), HMAC-SHA256 over `<t>.<rawBody>`,
|
|
653
|
+
* compared in constant time, and `t` within the tolerance (300 s by default).
|
|
654
|
+
* Anything malformed, stale or unmatched is `false`; it never throws.
|
|
655
|
+
* @experimental The admin entry may change in a minor release.
|
|
656
|
+
*/
|
|
657
|
+
declare function verifyCatalogWebhook(input: VerifyCatalogWebhookInput): Promise<boolean>;
|
|
658
|
+
|
|
659
|
+
export { createCatalogAdmin, verifyCatalogWebhook };
|
|
660
|
+
export type { AdminInventoryNamespace, AdminProductsNamespace, BatchesNamespace, CatalogAdmin, CatalogAdminOptions, CatalogPushErrorCode, JobBatchAnswer, JobBatchRequest, JobRunOptions, JobsNamespace, JsonValue, OpenJobRequest, PushAssignVendorRequest, PushErrorEnvelope, PushInventoryAnswer, PushInventoryRequest, PushJob, PushJobAnswer, PushJobHandle, PushOpenApiDocument, PushProduct, PushProductAnswer, PushProductList, PushProductOpsAnswer, PushProductRef, PushProductsAnswer, PushProductsRequest, PushRenameRequest, PushRow, PushRunAnswer, PushRunStarted, PushStockPage, PushStockResult, PushVariantsRequest, PushWebhookEvent, RunsNamespace, VerifyCatalogWebhookInput, WaitOptions };
|