@wix/auto_sdk_stores_inventory 1.0.74 → 1.0.76
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/build/cjs/index.js +4 -4
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/schemas.js +134 -132
- package/build/cjs/schemas.js.map +1 -1
- package/build/es/index.mjs +4 -4
- package/build/es/index.mjs.map +1 -1
- package/build/es/schemas.mjs +134 -132
- package/build/es/schemas.mjs.map +1 -1
- package/package.json +3 -3
- package/build/internal/cjs/index.js +0 -560
- package/build/internal/cjs/index.js.map +0 -1
- package/build/internal/cjs/index.typings.js +0 -467
- package/build/internal/cjs/index.typings.js.map +0 -1
- package/build/internal/cjs/meta.js +0 -427
- package/build/internal/cjs/meta.js.map +0 -1
- package/build/internal/cjs/schemas.js +0 -274
- package/build/internal/cjs/schemas.js.map +0 -1
- package/build/internal/es/index.mjs +0 -528
- package/build/internal/es/index.mjs.map +0 -1
- package/build/internal/es/index.typings.mjs +0 -437
- package/build/internal/es/index.typings.mjs.map +0 -1
- package/build/internal/es/meta.mjs +0 -394
- package/build/internal/es/meta.mjs.map +0 -1
- package/build/internal/es/schemas.mjs +0 -228
- package/build/internal/es/schemas.mjs.map +0 -1
|
@@ -1,560 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
ReasonType: () => ReasonType,
|
|
24
|
-
WebhookIdentityType: () => WebhookIdentityType,
|
|
25
|
-
decrementInventory: () => decrementInventory4,
|
|
26
|
-
getInventoryVariants: () => getInventoryVariants4,
|
|
27
|
-
incrementInventory: () => incrementInventory4,
|
|
28
|
-
onInventoryItemChanged: () => onInventoryItemChanged2,
|
|
29
|
-
onInventoryVariantsChanged: () => onInventoryVariantsChanged2,
|
|
30
|
-
queryInventory: () => queryInventory4,
|
|
31
|
-
updateInventoryVariants: () => updateInventoryVariants4
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(index_exports);
|
|
34
|
-
|
|
35
|
-
// src/stores-v2-inventory-inventory.public.ts
|
|
36
|
-
var import_rename_all_nested_keys2 = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
37
|
-
var import_field_mask = require("@wix/sdk-runtime/transformations/field-mask");
|
|
38
|
-
var import_timestamp3 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
39
|
-
var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
40
|
-
var import_sdk_types = require("@wix/sdk-types");
|
|
41
|
-
|
|
42
|
-
// src/stores-v2-inventory-inventory.universal.ts
|
|
43
|
-
var import_transform_error = require("@wix/sdk-runtime/transform-error");
|
|
44
|
-
var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
45
|
-
|
|
46
|
-
// src/stores-v2-inventory-inventory.http.ts
|
|
47
|
-
var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
48
|
-
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
49
|
-
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
50
|
-
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
51
|
-
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
52
|
-
const domainToMappings = {
|
|
53
|
-
"api._api_base_domain_": [
|
|
54
|
-
{
|
|
55
|
-
srcPath: "/wix-ecommerce-catalog-web",
|
|
56
|
-
destPath: ""
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
"www._base_domain_": [
|
|
60
|
-
{
|
|
61
|
-
srcPath: "/_api/catalog-server",
|
|
62
|
-
destPath: ""
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
srcPath: "/wix-ecommerce-catalog",
|
|
66
|
-
destPath: ""
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
"ecom._base_domain_": [
|
|
70
|
-
{
|
|
71
|
-
srcPath: "/_api/catalog-server",
|
|
72
|
-
destPath: ""
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
"*.pub.wix-code.com": [
|
|
76
|
-
{
|
|
77
|
-
srcPath: "/_api/catalog-server",
|
|
78
|
-
destPath: ""
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"www.wixapis.com": [
|
|
82
|
-
{
|
|
83
|
-
srcPath: "/stores/v1/inventoryItems",
|
|
84
|
-
destPath: "/v1/inventoryItems"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
srcPath: "/stores/v2/inventoryItems",
|
|
88
|
-
destPath: "/v2/inventoryItems"
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"manage._base_domain_": [
|
|
92
|
-
{
|
|
93
|
-
srcPath: "/wix-ecommerce-catalog",
|
|
94
|
-
destPath: ""
|
|
95
|
-
}
|
|
96
|
-
],
|
|
97
|
-
"editor.wixapps.net": [
|
|
98
|
-
{
|
|
99
|
-
srcPath: "/_api/catalog-server",
|
|
100
|
-
destPath: ""
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
"www.wixgateway.com": [
|
|
104
|
-
{
|
|
105
|
-
srcPath: "/stores/v1/products",
|
|
106
|
-
destPath: "/v1/products"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
srcPath: "/stores/v1/collections",
|
|
110
|
-
destPath: "/v1/collections"
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
"editor._base_domain_": [
|
|
114
|
-
{
|
|
115
|
-
srcPath: "/_api/catalog-server",
|
|
116
|
-
destPath: ""
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
"blocks._base_domain_": [
|
|
120
|
-
{
|
|
121
|
-
srcPath: "/_api/catalog-server",
|
|
122
|
-
destPath: ""
|
|
123
|
-
}
|
|
124
|
-
],
|
|
125
|
-
"create.editorx": [
|
|
126
|
-
{
|
|
127
|
-
srcPath: "/_api/catalog-server",
|
|
128
|
-
destPath: ""
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
};
|
|
132
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
133
|
-
}
|
|
134
|
-
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
135
|
-
const domainToMappings = {
|
|
136
|
-
"api._api_base_domain_": [
|
|
137
|
-
{
|
|
138
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
139
|
-
destPath: ""
|
|
140
|
-
}
|
|
141
|
-
],
|
|
142
|
-
"manage._base_domain_": [
|
|
143
|
-
{
|
|
144
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
145
|
-
destPath: ""
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
"www.wixapis.com": [
|
|
149
|
-
{
|
|
150
|
-
srcPath: "/stores-reader/v2/collections",
|
|
151
|
-
destPath: "/v2/collections"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
155
|
-
destPath: "/v2/inventoryItems"
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
"www._base_domain_": [
|
|
159
|
-
{
|
|
160
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
161
|
-
destPath: ""
|
|
162
|
-
}
|
|
163
|
-
],
|
|
164
|
-
"editor._base_domain_": [
|
|
165
|
-
{
|
|
166
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
167
|
-
destPath: ""
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
"blocks._base_domain_": [
|
|
171
|
-
{
|
|
172
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
173
|
-
destPath: ""
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
"create.editorx": [
|
|
177
|
-
{
|
|
178
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
179
|
-
destPath: ""
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
|
-
_: [
|
|
183
|
-
{
|
|
184
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
185
|
-
destPath: "/v2/inventoryItems"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
srcPath: "/stores-reader/v2/collections",
|
|
189
|
-
destPath: "/v2/collections"
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
};
|
|
193
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
194
|
-
}
|
|
195
|
-
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
196
|
-
function getInventoryVariants(payload) {
|
|
197
|
-
function __getInventoryVariants({ host }) {
|
|
198
|
-
const metadata = {
|
|
199
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
200
|
-
method: "POST",
|
|
201
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
202
|
-
packageName: PACKAGE_NAME,
|
|
203
|
-
migrationOptions: {
|
|
204
|
-
optInTransformResponse: true
|
|
205
|
-
},
|
|
206
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
207
|
-
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
208
|
-
data: payload,
|
|
209
|
-
host
|
|
210
|
-
}),
|
|
211
|
-
data: payload,
|
|
212
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
213
|
-
{
|
|
214
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
215
|
-
paths: [{ path: "inventoryItem.lastUpdated" }]
|
|
216
|
-
}
|
|
217
|
-
])
|
|
218
|
-
};
|
|
219
|
-
return metadata;
|
|
220
|
-
}
|
|
221
|
-
return __getInventoryVariants;
|
|
222
|
-
}
|
|
223
|
-
function queryInventory(payload) {
|
|
224
|
-
function __queryInventory({ host }) {
|
|
225
|
-
const metadata = {
|
|
226
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
227
|
-
method: "POST",
|
|
228
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
229
|
-
packageName: PACKAGE_NAME,
|
|
230
|
-
migrationOptions: {
|
|
231
|
-
optInTransformResponse: true
|
|
232
|
-
},
|
|
233
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
234
|
-
protoPath: "/v2/inventoryItems/query",
|
|
235
|
-
data: payload,
|
|
236
|
-
host
|
|
237
|
-
}),
|
|
238
|
-
data: payload,
|
|
239
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
240
|
-
{
|
|
241
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
242
|
-
paths: [{ path: "inventoryItems.lastUpdated" }]
|
|
243
|
-
}
|
|
244
|
-
])
|
|
245
|
-
};
|
|
246
|
-
return metadata;
|
|
247
|
-
}
|
|
248
|
-
return __queryInventory;
|
|
249
|
-
}
|
|
250
|
-
function updateInventoryVariants(payload) {
|
|
251
|
-
function __updateInventoryVariants({ host }) {
|
|
252
|
-
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
253
|
-
{
|
|
254
|
-
transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
|
|
255
|
-
paths: [{ path: "inventoryItem.lastUpdated" }]
|
|
256
|
-
}
|
|
257
|
-
]);
|
|
258
|
-
const metadata = {
|
|
259
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
260
|
-
method: "PATCH",
|
|
261
|
-
methodFqn: "wix.inventory.api.v1.InventoryWriteApi.UpdateInventoryVariants",
|
|
262
|
-
packageName: PACKAGE_NAME,
|
|
263
|
-
migrationOptions: {
|
|
264
|
-
optInTransformResponse: true
|
|
265
|
-
},
|
|
266
|
-
url: resolveWixInventoryApiV1InventoryWriteApiUrl({
|
|
267
|
-
protoPath: "/v2/inventoryItems/product/{inventoryItem.productId}",
|
|
268
|
-
data: serializedData,
|
|
269
|
-
host
|
|
270
|
-
}),
|
|
271
|
-
data: serializedData
|
|
272
|
-
};
|
|
273
|
-
return metadata;
|
|
274
|
-
}
|
|
275
|
-
return __updateInventoryVariants;
|
|
276
|
-
}
|
|
277
|
-
function decrementInventory(payload) {
|
|
278
|
-
function __decrementInventory({ host }) {
|
|
279
|
-
const metadata = {
|
|
280
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
281
|
-
method: "POST",
|
|
282
|
-
methodFqn: "wix.inventory.api.v1.InventoryWriteApi.DecrementInventory",
|
|
283
|
-
packageName: PACKAGE_NAME,
|
|
284
|
-
migrationOptions: {
|
|
285
|
-
optInTransformResponse: true
|
|
286
|
-
},
|
|
287
|
-
url: resolveWixInventoryApiV1InventoryWriteApiUrl({
|
|
288
|
-
protoPath: "/v2/inventoryItems/decrement",
|
|
289
|
-
data: payload,
|
|
290
|
-
host
|
|
291
|
-
}),
|
|
292
|
-
data: payload
|
|
293
|
-
};
|
|
294
|
-
return metadata;
|
|
295
|
-
}
|
|
296
|
-
return __decrementInventory;
|
|
297
|
-
}
|
|
298
|
-
function incrementInventory(payload) {
|
|
299
|
-
function __incrementInventory({ host }) {
|
|
300
|
-
const metadata = {
|
|
301
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
302
|
-
method: "POST",
|
|
303
|
-
methodFqn: "wix.inventory.api.v1.InventoryWriteApi.IncrementInventory",
|
|
304
|
-
packageName: PACKAGE_NAME,
|
|
305
|
-
migrationOptions: {
|
|
306
|
-
optInTransformResponse: true
|
|
307
|
-
},
|
|
308
|
-
url: resolveWixInventoryApiV1InventoryWriteApiUrl({
|
|
309
|
-
protoPath: "/v2/inventoryItems/increment",
|
|
310
|
-
data: payload,
|
|
311
|
-
host
|
|
312
|
-
}),
|
|
313
|
-
data: payload
|
|
314
|
-
};
|
|
315
|
-
return metadata;
|
|
316
|
-
}
|
|
317
|
-
return __incrementInventory;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// src/stores-v2-inventory-inventory.universal.ts
|
|
321
|
-
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
322
|
-
ReasonType2["UNKNOWN"] = "UNKNOWN";
|
|
323
|
-
ReasonType2["ORDER"] = "ORDER";
|
|
324
|
-
ReasonType2["MANUAL"] = "MANUAL";
|
|
325
|
-
ReasonType2["REVERT_INVENTORY_CHANGE"] = "REVERT_INVENTORY_CHANGE";
|
|
326
|
-
return ReasonType2;
|
|
327
|
-
})(ReasonType || {});
|
|
328
|
-
var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
329
|
-
WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
|
|
330
|
-
WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
331
|
-
WebhookIdentityType2["MEMBER"] = "MEMBER";
|
|
332
|
-
WebhookIdentityType2["WIX_USER"] = "WIX_USER";
|
|
333
|
-
WebhookIdentityType2["APP"] = "APP";
|
|
334
|
-
return WebhookIdentityType2;
|
|
335
|
-
})(WebhookIdentityType || {});
|
|
336
|
-
async function getInventoryVariants2(inventoryId, options) {
|
|
337
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
338
|
-
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
339
|
-
inventoryId,
|
|
340
|
-
externalId: options?.externalId,
|
|
341
|
-
productId: options?.productId,
|
|
342
|
-
variantIds: options?.variantIds
|
|
343
|
-
});
|
|
344
|
-
const reqOpts = getInventoryVariants(payload);
|
|
345
|
-
sideEffects?.onSiteCall?.();
|
|
346
|
-
try {
|
|
347
|
-
const result = await httpClient.request(reqOpts);
|
|
348
|
-
sideEffects?.onSuccess?.(result);
|
|
349
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
350
|
-
} catch (err) {
|
|
351
|
-
const transformedError = (0, import_transform_error.transformError)(
|
|
352
|
-
err,
|
|
353
|
-
{
|
|
354
|
-
spreadPathsToArguments: {},
|
|
355
|
-
explicitPathsToArguments: {
|
|
356
|
-
inventoryId: "$[0]",
|
|
357
|
-
externalId: "$[1].externalId",
|
|
358
|
-
productId: "$[1].productId",
|
|
359
|
-
variantIds: "$[1].variantIds"
|
|
360
|
-
},
|
|
361
|
-
singleArgumentUnchanged: false
|
|
362
|
-
},
|
|
363
|
-
["inventoryId", "options"]
|
|
364
|
-
);
|
|
365
|
-
sideEffects?.onError?.(err);
|
|
366
|
-
throw transformedError;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
async function queryInventory2(options) {
|
|
370
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
371
|
-
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
372
|
-
query: options?.query
|
|
373
|
-
});
|
|
374
|
-
const reqOpts = queryInventory(payload);
|
|
375
|
-
sideEffects?.onSiteCall?.();
|
|
376
|
-
try {
|
|
377
|
-
const result = await httpClient.request(reqOpts);
|
|
378
|
-
sideEffects?.onSuccess?.(result);
|
|
379
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
380
|
-
} catch (err) {
|
|
381
|
-
const transformedError = (0, import_transform_error.transformError)(
|
|
382
|
-
err,
|
|
383
|
-
{
|
|
384
|
-
spreadPathsToArguments: {},
|
|
385
|
-
explicitPathsToArguments: { query: "$[0].query" },
|
|
386
|
-
singleArgumentUnchanged: false
|
|
387
|
-
},
|
|
388
|
-
["options"]
|
|
389
|
-
);
|
|
390
|
-
sideEffects?.onError?.(err);
|
|
391
|
-
throw transformedError;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
395
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
396
|
-
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
397
|
-
inventoryItem: { ...inventoryItem, productId }
|
|
398
|
-
});
|
|
399
|
-
const reqOpts = updateInventoryVariants(payload);
|
|
400
|
-
sideEffects?.onSiteCall?.();
|
|
401
|
-
try {
|
|
402
|
-
const result = await httpClient.request(reqOpts);
|
|
403
|
-
sideEffects?.onSuccess?.(result);
|
|
404
|
-
} catch (err) {
|
|
405
|
-
const transformedError = (0, import_transform_error.transformError)(
|
|
406
|
-
err,
|
|
407
|
-
{
|
|
408
|
-
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
409
|
-
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
410
|
-
singleArgumentUnchanged: false
|
|
411
|
-
},
|
|
412
|
-
["productId", "inventoryItem"]
|
|
413
|
-
);
|
|
414
|
-
sideEffects?.onError?.(err);
|
|
415
|
-
throw transformedError;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
async function decrementInventory2(decrementData) {
|
|
419
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
420
|
-
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
421
|
-
decrementData
|
|
422
|
-
});
|
|
423
|
-
const reqOpts = decrementInventory(payload);
|
|
424
|
-
sideEffects?.onSiteCall?.();
|
|
425
|
-
try {
|
|
426
|
-
const result = await httpClient.request(reqOpts);
|
|
427
|
-
sideEffects?.onSuccess?.(result);
|
|
428
|
-
} catch (err) {
|
|
429
|
-
const transformedError = (0, import_transform_error.transformError)(
|
|
430
|
-
err,
|
|
431
|
-
{
|
|
432
|
-
spreadPathsToArguments: {},
|
|
433
|
-
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
434
|
-
singleArgumentUnchanged: false
|
|
435
|
-
},
|
|
436
|
-
["decrementData"]
|
|
437
|
-
);
|
|
438
|
-
sideEffects?.onError?.(err);
|
|
439
|
-
throw transformedError;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
async function incrementInventory2(incrementData) {
|
|
443
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
444
|
-
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
445
|
-
incrementData
|
|
446
|
-
});
|
|
447
|
-
const reqOpts = incrementInventory(payload);
|
|
448
|
-
sideEffects?.onSiteCall?.();
|
|
449
|
-
try {
|
|
450
|
-
const result = await httpClient.request(reqOpts);
|
|
451
|
-
sideEffects?.onSuccess?.(result);
|
|
452
|
-
} catch (err) {
|
|
453
|
-
const transformedError = (0, import_transform_error.transformError)(
|
|
454
|
-
err,
|
|
455
|
-
{
|
|
456
|
-
spreadPathsToArguments: {},
|
|
457
|
-
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
458
|
-
singleArgumentUnchanged: false
|
|
459
|
-
},
|
|
460
|
-
["incrementData"]
|
|
461
|
-
);
|
|
462
|
-
sideEffects?.onError?.(err);
|
|
463
|
-
throw transformedError;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// src/stores-v2-inventory-inventory.public.ts
|
|
468
|
-
function getInventoryVariants3(httpClient) {
|
|
469
|
-
return (inventoryId, options) => getInventoryVariants2(
|
|
470
|
-
inventoryId,
|
|
471
|
-
options,
|
|
472
|
-
// @ts-ignore
|
|
473
|
-
{ httpClient }
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
function queryInventory3(httpClient) {
|
|
477
|
-
return (options) => queryInventory2(
|
|
478
|
-
options,
|
|
479
|
-
// @ts-ignore
|
|
480
|
-
{ httpClient }
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
function updateInventoryVariants3(httpClient) {
|
|
484
|
-
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
485
|
-
productId,
|
|
486
|
-
inventoryItem,
|
|
487
|
-
// @ts-ignore
|
|
488
|
-
{ httpClient }
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
function decrementInventory3(httpClient) {
|
|
492
|
-
return (decrementData) => decrementInventory2(
|
|
493
|
-
decrementData,
|
|
494
|
-
// @ts-ignore
|
|
495
|
-
{ httpClient }
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
function incrementInventory3(httpClient) {
|
|
499
|
-
return (incrementData) => incrementInventory2(
|
|
500
|
-
incrementData,
|
|
501
|
-
// @ts-ignore
|
|
502
|
-
{ httpClient }
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
var onInventoryItemChanged = (0, import_sdk_types.EventDefinition)(
|
|
506
|
-
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
507
|
-
false,
|
|
508
|
-
(event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
|
|
509
|
-
(0, import_transform_paths2.transformPaths)(event, [
|
|
510
|
-
{
|
|
511
|
-
transformFn: import_field_mask.transformRESTFieldMaskToSDKFieldMask,
|
|
512
|
-
paths: [{ path: "data.fieldMask" }]
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
transformFn: import_timestamp3.transformRESTTimestampToSDKTimestamp,
|
|
516
|
-
paths: [{ path: "data.updatedDate" }]
|
|
517
|
-
}
|
|
518
|
-
])
|
|
519
|
-
)
|
|
520
|
-
)();
|
|
521
|
-
var onInventoryVariantsChanged = (0, import_sdk_types.EventDefinition)(
|
|
522
|
-
"com.wix.ecommerce.inventory.api.v1.InventoryVariantsChanged",
|
|
523
|
-
false,
|
|
524
|
-
(event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
|
|
525
|
-
(0, import_transform_paths2.transformPaths)(event, [
|
|
526
|
-
{
|
|
527
|
-
transformFn: import_timestamp3.transformRESTTimestampToSDKTimestamp,
|
|
528
|
-
paths: [{ path: "data.updatedDate" }]
|
|
529
|
-
}
|
|
530
|
-
])
|
|
531
|
-
)
|
|
532
|
-
)();
|
|
533
|
-
|
|
534
|
-
// src/stores-v2-inventory-inventory.context.ts
|
|
535
|
-
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
536
|
-
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
537
|
-
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
538
|
-
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
539
|
-
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
540
|
-
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
541
|
-
var incrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(incrementInventory3);
|
|
542
|
-
var onInventoryItemChanged2 = (0, import_event_definition_modules.createEventModule)(
|
|
543
|
-
onInventoryItemChanged
|
|
544
|
-
);
|
|
545
|
-
var onInventoryVariantsChanged2 = (0, import_event_definition_modules.createEventModule)(
|
|
546
|
-
onInventoryVariantsChanged
|
|
547
|
-
);
|
|
548
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
549
|
-
0 && (module.exports = {
|
|
550
|
-
ReasonType,
|
|
551
|
-
WebhookIdentityType,
|
|
552
|
-
decrementInventory,
|
|
553
|
-
getInventoryVariants,
|
|
554
|
-
incrementInventory,
|
|
555
|
-
onInventoryItemChanged,
|
|
556
|
-
onInventoryVariantsChanged,
|
|
557
|
-
queryInventory,
|
|
558
|
-
updateInventoryVariants
|
|
559
|
-
});
|
|
560
|
-
//# sourceMappingURL=index.js.map
|