@gradientedge/commercetools-utils 1.55.1 → 2.2.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/.nvmrc +1 -0
- package/build/api/CommercetoolsApi.d.ts +43 -24
- package/build/api/CommercetoolsApi.d.ts.map +1 -1
- package/build/api/CommercetoolsApi.js +88 -97
- package/build/api/CommercetoolsApi.js.map +1 -1
- package/build/auth/CommercetoolsAuth.d.ts +16 -1
- package/build/auth/CommercetoolsAuth.d.ts.map +1 -1
- package/build/auth/CommercetoolsAuthApi.d.ts +3 -2
- package/build/auth/CommercetoolsAuthApi.d.ts.map +1 -1
- package/build/auth/CommercetoolsAuthApi.js +11 -11
- package/build/auth/CommercetoolsAuthApi.js.map +1 -1
- package/build/auth/CommercetoolsGrant.js +2 -2
- package/build/auth/CommercetoolsGrant.js.map +1 -1
- package/build/auth/scopes.js +1 -1
- package/build/auth/scopes.js.map +1 -1
- package/build/auth/utils.js +1 -1
- package/build/auth/utils.js.map +1 -1
- package/build/error/CommercetoolsError.js +5 -5
- package/build/error/CommercetoolsError.js.map +1 -1
- package/build/utils/format.js +2 -2
- package/build/utils/format.js.map +1 -1
- package/build/utils/mask.js +2 -2
- package/build/utils/mask.js.map +1 -1
- package/build/utils/useragent.js +1 -1
- package/build/utils/useragent.js.map +1 -1
- package/package.json +23 -22
|
@@ -71,7 +71,7 @@ var DEFAULT_RETRY_CONFIG = {
|
|
|
71
71
|
*/
|
|
72
72
|
var RETRYABLE_STATUS_CODES = [500, 501, 502, 503, 504];
|
|
73
73
|
/**
|
|
74
|
-
* The config options passed in to the {@see
|
|
74
|
+
* The config options passed in to the {@see HttpsAgent.Agent} used
|
|
75
75
|
* with the axios instance that we create.
|
|
76
76
|
*/
|
|
77
77
|
var DEFAULT_HTTPS_AGENT_CONFIG = {
|
|
@@ -89,7 +89,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
89
89
|
this.config = config;
|
|
90
90
|
this.auth = new __1.CommercetoolsAuth(config);
|
|
91
91
|
this.endpoints = constants_1.REGION_URLS[this.config.region];
|
|
92
|
-
this.userAgent = utils_1.buildUserAgent(this.config.systemIdentifier);
|
|
92
|
+
this.userAgent = (0, utils_1.buildUserAgent)(this.config.systemIdentifier);
|
|
93
93
|
this.axios = this.createAxiosInstance();
|
|
94
94
|
this.retry = config.retry || DEFAULT_RETRY_CONFIG;
|
|
95
95
|
}
|
|
@@ -105,42 +105,43 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
105
105
|
else {
|
|
106
106
|
agent = new https_1.Agent(DEFAULT_HTTPS_AGENT_CONFIG);
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
var instance = axios_1.default.create({
|
|
109
109
|
timeout: this.config.timeoutMs || constants_2.DEFAULT_REQUEST_TIMEOUT_MS,
|
|
110
|
-
headers: { common: { 'User-Agent': this.userAgent } },
|
|
111
110
|
paramsSerializer: function (params) {
|
|
112
111
|
return qs_1.default.stringify(params, { arrayFormat: 'repeat' });
|
|
113
112
|
},
|
|
114
113
|
httpsAgent: agent,
|
|
115
114
|
});
|
|
115
|
+
instance.defaults.headers.common['User-Agent'] = this.userAgent;
|
|
116
|
+
return instance;
|
|
116
117
|
};
|
|
117
118
|
/**
|
|
118
119
|
* Get a store given it's id
|
|
119
120
|
* https://docs.commercetools.com/api/projects/stores#get-a-store-by-id
|
|
120
121
|
*/
|
|
121
122
|
CommercetoolsApi.prototype.getStoreById = function (options) {
|
|
122
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/stores/"
|
|
123
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/stores/".concat(options.id), method: 'GET' }));
|
|
123
124
|
};
|
|
124
125
|
/**
|
|
125
126
|
* Get a store given it's key
|
|
126
127
|
* https://docs.commercetools.com/api/projects/stores#get-a-store-by-key
|
|
127
128
|
*/
|
|
128
129
|
CommercetoolsApi.prototype.getStoreByKey = function (options) {
|
|
129
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/stores/key="
|
|
130
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/stores/key=".concat(options.key), method: 'GET' }));
|
|
130
131
|
};
|
|
131
132
|
/**
|
|
132
133
|
* Get an individual category by id:
|
|
133
134
|
* https://docs.commercetools.com/api/projects/categories#get-category-by-id
|
|
134
135
|
*/
|
|
135
136
|
CommercetoolsApi.prototype.getCategoryById = function (options) {
|
|
136
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/"
|
|
137
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/".concat(options.id), method: 'GET' }));
|
|
137
138
|
};
|
|
138
139
|
/**
|
|
139
140
|
* Get an individual category by key:
|
|
140
141
|
* https://docs.commercetools.com/api/projects/categories#get-category-by-key
|
|
141
142
|
*/
|
|
142
143
|
CommercetoolsApi.prototype.getCategoryByKey = function (options) {
|
|
143
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/key="
|
|
144
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/key=".concat(options.key), method: 'GET' }));
|
|
144
145
|
};
|
|
145
146
|
/**
|
|
146
147
|
* Query channels:
|
|
@@ -165,7 +166,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
165
166
|
* https://docs.commercetools.com/api/projects/channels#get-channel-by-id
|
|
166
167
|
*/
|
|
167
168
|
CommercetoolsApi.prototype.getChannelById = function (options) {
|
|
168
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/channels/"
|
|
169
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/channels/".concat(options.id), method: 'GET' }));
|
|
169
170
|
};
|
|
170
171
|
/**
|
|
171
172
|
* Get an category by id or key. Either the id or the key must be provided.
|
|
@@ -175,27 +176,27 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
175
176
|
throw new error_1.CommercetoolsError('Either an id, key or slug must be provided');
|
|
176
177
|
}
|
|
177
178
|
if (options.id) {
|
|
178
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/"
|
|
179
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/".concat(options.id), method: 'GET' }));
|
|
179
180
|
}
|
|
180
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/key="
|
|
181
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/key=".concat(options.key), method: 'GET' }));
|
|
181
182
|
};
|
|
182
183
|
/**
|
|
183
184
|
* Get a category projection by slug and locale
|
|
185
|
+
* Queries the categories for the given slug + locale using:
|
|
186
|
+
* https://docs.commercetools.com/api/projects/categories#query-categories
|
|
184
187
|
*/
|
|
185
|
-
CommercetoolsApi.prototype.getCategoryBySlug = function (
|
|
186
|
-
if (params === void 0) { params = {}; }
|
|
188
|
+
CommercetoolsApi.prototype.getCategoryBySlug = function (options) {
|
|
187
189
|
return __awaiter(this, void 0, void 0, function () {
|
|
188
190
|
var data;
|
|
189
191
|
return __generator(this, function (_a) {
|
|
190
192
|
switch (_a.label) {
|
|
191
|
-
case 0: return [4 /*yield*/, this.request({
|
|
192
|
-
path: "/categories",
|
|
193
|
-
method: 'GET',
|
|
194
|
-
params: __assign(__assign({}, params), { where: "slug(" + languageCode + "=\"" + slug + "\")" }),
|
|
195
|
-
})];
|
|
193
|
+
case 0: return [4 /*yield*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(__assign(__assign({}, options), { params: __assign(__assign({}, options === null || options === void 0 ? void 0 : options.params), { where: "slug(".concat(options.languageCode, "=\"").concat(options.slug, "\")") }) }))), { path: "/categories", method: 'GET' }))];
|
|
196
194
|
case 1:
|
|
197
195
|
data = _a.sent();
|
|
198
|
-
|
|
196
|
+
if (!data.count) {
|
|
197
|
+
throw new error_1.CommercetoolsError("No category found with slug [".concat(options.slug, "] and language code [").concat(options.languageCode, "]"), { options: options }, 404);
|
|
198
|
+
}
|
|
199
|
+
return [2 /*return*/, data.results[0]];
|
|
199
200
|
}
|
|
200
201
|
});
|
|
201
202
|
});
|
|
@@ -204,13 +205,8 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
204
205
|
* Query categories
|
|
205
206
|
* https://docs.commercetools.com/api/projects/categories#query-categories
|
|
206
207
|
*/
|
|
207
|
-
CommercetoolsApi.prototype.queryCategories = function (
|
|
208
|
-
|
|
209
|
-
return this.request({
|
|
210
|
-
path: "/categories",
|
|
211
|
-
method: 'GET',
|
|
212
|
-
params: params,
|
|
213
|
-
});
|
|
208
|
+
CommercetoolsApi.prototype.queryCategories = function (options) {
|
|
209
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories", method: 'GET' }));
|
|
214
210
|
};
|
|
215
211
|
/**
|
|
216
212
|
* Get the parent categories of a given category. This method returns an array
|
|
@@ -237,52 +233,45 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
237
233
|
* Get an individual product by id:
|
|
238
234
|
* https://docs.commercetools.com/api/projects/products#get-product-by-id
|
|
239
235
|
*/
|
|
240
|
-
CommercetoolsApi.prototype.getProductById = function (
|
|
241
|
-
|
|
242
|
-
return this.request({
|
|
243
|
-
path: "/products/" + id,
|
|
244
|
-
method: 'GET',
|
|
245
|
-
params: params,
|
|
246
|
-
});
|
|
236
|
+
CommercetoolsApi.prototype.getProductById = function (options) {
|
|
237
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/".concat(options.id), method: 'GET' }));
|
|
247
238
|
};
|
|
248
239
|
/**
|
|
249
240
|
* Get an individual product by key:
|
|
250
241
|
* https://docs.commercetools.com/api/projects/products#get-product-by-key
|
|
251
242
|
*/
|
|
252
243
|
CommercetoolsApi.prototype.getProductByKey = function (options) {
|
|
253
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/key="
|
|
244
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/key=".concat(options.key), method: 'GET' }));
|
|
254
245
|
};
|
|
255
246
|
/**
|
|
256
247
|
* Get a product projection by id
|
|
257
248
|
* https://docs.commercetools.com/api/projects/productProjections#get-productprojection-by-id
|
|
258
249
|
*/
|
|
259
250
|
CommercetoolsApi.prototype.getProductProjectionById = function (options) {
|
|
260
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-projections/"
|
|
251
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-projections/".concat(options.id), method: 'GET' }));
|
|
261
252
|
};
|
|
262
253
|
/**
|
|
263
254
|
* Get a product projection by key
|
|
264
255
|
* https://docs.commercetools.com/api/projects/productProjections#get-productprojection-by-key
|
|
265
256
|
*/
|
|
266
257
|
CommercetoolsApi.prototype.getProductProjectionByKey = function (options) {
|
|
267
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-projections/key="
|
|
258
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-projections/key=".concat(options.key), method: 'GET' }));
|
|
268
259
|
};
|
|
269
260
|
/**
|
|
270
261
|
* Get a product projection by slug and locale
|
|
271
262
|
*/
|
|
272
|
-
CommercetoolsApi.prototype.getProductProjectionBySlug = function (
|
|
273
|
-
if (params === void 0) { params = {}; }
|
|
263
|
+
CommercetoolsApi.prototype.getProductProjectionBySlug = function (options) {
|
|
274
264
|
return __awaiter(this, void 0, void 0, function () {
|
|
275
265
|
var data;
|
|
276
266
|
return __generator(this, function (_a) {
|
|
277
267
|
switch (_a.label) {
|
|
278
|
-
case 0: return [4 /*yield*/, this.request({
|
|
279
|
-
path: "/product-projections",
|
|
280
|
-
method: 'GET',
|
|
281
|
-
params: __assign(__assign({}, params), { where: "slug(" + languageCode + "=\"" + slug + "\")" }),
|
|
282
|
-
})];
|
|
268
|
+
case 0: return [4 /*yield*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(__assign(__assign({}, options), { params: __assign(__assign({}, options === null || options === void 0 ? void 0 : options.params), { where: "slug(".concat(options.languageCode, "=\"").concat(options.slug, "\")") }) }))), { path: "/product-projections", method: 'GET' }))];
|
|
283
269
|
case 1:
|
|
284
270
|
data = _a.sent();
|
|
285
|
-
|
|
271
|
+
if (!data.count) {
|
|
272
|
+
throw new error_1.CommercetoolsError("No product projection found with slug [".concat(options.slug, "] and language code [").concat(options.languageCode, "]"), { options: options }, 404);
|
|
273
|
+
}
|
|
274
|
+
return [2 /*return*/, data.results[0]];
|
|
286
275
|
}
|
|
287
276
|
});
|
|
288
277
|
});
|
|
@@ -291,13 +280,8 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
291
280
|
* Query product projections
|
|
292
281
|
* https://docs.commercetools.com/api/projects/productProjections#query-productprojections
|
|
293
282
|
*/
|
|
294
|
-
CommercetoolsApi.prototype.queryProductProjections = function (
|
|
295
|
-
|
|
296
|
-
return this.request({
|
|
297
|
-
path: "/product-projections",
|
|
298
|
-
method: 'GET',
|
|
299
|
-
params: params,
|
|
300
|
-
});
|
|
283
|
+
CommercetoolsApi.prototype.queryProductProjections = function (options) {
|
|
284
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-projections", method: 'GET' }));
|
|
301
285
|
};
|
|
302
286
|
/**
|
|
303
287
|
* Search product projections
|
|
@@ -313,7 +297,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
313
297
|
CommercetoolsApi.prototype.getCartById = function (options) {
|
|
314
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
315
299
|
return __generator(this, function (_a) {
|
|
316
|
-
return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/carts/"
|
|
300
|
+
return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/carts/".concat(options.id), options.storeKey), method: 'GET' }))];
|
|
317
301
|
});
|
|
318
302
|
});
|
|
319
303
|
};
|
|
@@ -357,7 +341,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
357
341
|
CommercetoolsApi.prototype.updateCartById = function (options) {
|
|
358
342
|
return __awaiter(this, void 0, void 0, function () {
|
|
359
343
|
return __generator(this, function (_a) {
|
|
360
|
-
return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/carts/"
|
|
344
|
+
return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/carts/".concat(options.id), options.storeKey), method: 'POST', data: {
|
|
361
345
|
version: options.version,
|
|
362
346
|
actions: options.actions,
|
|
363
347
|
} }))];
|
|
@@ -382,7 +366,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
382
366
|
CommercetoolsApi.prototype.getMyCartById = function (options) {
|
|
383
367
|
return __awaiter(this, void 0, void 0, function () {
|
|
384
368
|
return __generator(this, function (_a) {
|
|
385
|
-
return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/carts/"
|
|
369
|
+
return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/carts/".concat(options.cartId), options.storeKey), method: 'GET', accessToken: options.accessToken }))];
|
|
386
370
|
});
|
|
387
371
|
});
|
|
388
372
|
};
|
|
@@ -410,7 +394,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
410
394
|
case 0: return [4 /*yield*/, this.getMyActiveCart(options)];
|
|
411
395
|
case 1:
|
|
412
396
|
cart = _a.sent();
|
|
413
|
-
return [4 /*yield*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/carts/"
|
|
397
|
+
return [4 /*yield*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/carts/".concat(cart.id), options.storeKey), method: 'DELETE', params: __assign(__assign({}, options.params), { version: cart.version }), accessToken: options.accessToken }))];
|
|
414
398
|
case 2: return [2 /*return*/, _a.sent()];
|
|
415
399
|
}
|
|
416
400
|
});
|
|
@@ -428,7 +412,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
428
412
|
case 0: return [4 /*yield*/, this.getMyCartById(options)];
|
|
429
413
|
case 1:
|
|
430
414
|
cart = _a.sent();
|
|
431
|
-
return [4 /*yield*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/carts/"
|
|
415
|
+
return [4 /*yield*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/carts/".concat(options.cartId), options.storeKey), method: 'DELETE', params: __assign(__assign({}, options.params), { version: cart.version }), accessToken: options.accessToken }))];
|
|
432
416
|
case 2: return [2 /*return*/, _a.sent()];
|
|
433
417
|
}
|
|
434
418
|
});
|
|
@@ -448,7 +432,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
448
432
|
case 0: return [4 /*yield*/, this.getMyActiveCart(options)];
|
|
449
433
|
case 1:
|
|
450
434
|
cart = _a.sent();
|
|
451
|
-
return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/carts/"
|
|
435
|
+
return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/carts/".concat(cart.id), options.storeKey), method: 'POST', data: {
|
|
452
436
|
version: cart.version,
|
|
453
437
|
actions: options.actions,
|
|
454
438
|
}, accessToken: options.accessToken }))];
|
|
@@ -485,7 +469,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
485
469
|
return __awaiter(this, void 0, void 0, function () {
|
|
486
470
|
return __generator(this, function (_a) {
|
|
487
471
|
switch (_a.label) {
|
|
488
|
-
case 0: return [4 /*yield*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/carts/"
|
|
472
|
+
case 0: return [4 /*yield*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/carts/".concat(options.id), options.storeKey), method: 'DELETE', params: __assign(__assign({}, options.params), { version: options.version }) }))];
|
|
489
473
|
case 1: return [2 /*return*/, _a.sent()];
|
|
490
474
|
}
|
|
491
475
|
});
|
|
@@ -503,7 +487,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
503
487
|
* https://docs.commercetools.com/api/projects/me-orders#get-order-by-id
|
|
504
488
|
*/
|
|
505
489
|
CommercetoolsApi.prototype.getMyOrderById = function (options) {
|
|
506
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/orders/"
|
|
490
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/orders/".concat(options.id), options.storeKey), method: 'GET', accessToken: options.accessToken }));
|
|
507
491
|
};
|
|
508
492
|
/**
|
|
509
493
|
* Query my orders:
|
|
@@ -517,42 +501,42 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
517
501
|
* https://docs.commercetools.com/api/projects/orders#update-order-by-id
|
|
518
502
|
*/
|
|
519
503
|
CommercetoolsApi.prototype.updateOrderById = function (options) {
|
|
520
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/"
|
|
504
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/".concat(options.id), options.storeKey), method: 'POST', data: options.data }));
|
|
521
505
|
};
|
|
522
506
|
/**
|
|
523
507
|
* Update an order by order number:
|
|
524
508
|
* https://docs.commercetools.com/api/projects/orders#update-order-by-ordernumber
|
|
525
509
|
*/
|
|
526
510
|
CommercetoolsApi.prototype.updateOrderByOrderNumber = function (options) {
|
|
527
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/order-number="
|
|
511
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/order-number=".concat(options.orderNumber), options.storeKey), method: 'POST', data: options.data }));
|
|
528
512
|
};
|
|
529
513
|
/**
|
|
530
514
|
* Get an order by id:
|
|
531
515
|
* https://docs.commercetools.com/api/projects/orders#get-order-by-id
|
|
532
516
|
*/
|
|
533
517
|
CommercetoolsApi.prototype.getOrderById = function (options) {
|
|
534
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/"
|
|
518
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/".concat(options.id), options.storeKey), method: 'GET' }));
|
|
535
519
|
};
|
|
536
520
|
/**
|
|
537
521
|
* Get an order by order number:
|
|
538
522
|
* https://docs.commercetools.com/api/projects/orders#get-order-by-ordernumber
|
|
539
523
|
*/
|
|
540
524
|
CommercetoolsApi.prototype.getOrderByOrderNumber = function (options) {
|
|
541
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/order-number="
|
|
525
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/order-number=".concat(options.orderNumber), options.storeKey), method: 'GET' }));
|
|
542
526
|
};
|
|
543
527
|
/**
|
|
544
528
|
* Delete an order by id:
|
|
545
529
|
* https://docs.commercetools.com/api/projects/orders#delete-order-by-id
|
|
546
530
|
*/
|
|
547
531
|
CommercetoolsApi.prototype.deleteOrderById = function (options) {
|
|
548
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/"
|
|
532
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/".concat(options.id), options.storeKey), method: 'DELETE', params: __assign(__assign({}, options.params), { version: options.version, dataErasure: options.dataErasure }) }));
|
|
549
533
|
};
|
|
550
534
|
/**
|
|
551
535
|
* Delete an order by order number:
|
|
552
536
|
* https://docs.commercetools.com/api/projects/orders#delete-order-by-ordernumber
|
|
553
537
|
*/
|
|
554
538
|
CommercetoolsApi.prototype.deleteOrderByOrderNumber = function (options) {
|
|
555
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/order-number="
|
|
539
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/orders/order-number=".concat(options.orderNo), options.storeKey), method: 'DELETE', params: __assign(__assign({}, options.params), { version: options.version, dataErasure: options.dataErasure }) }));
|
|
556
540
|
};
|
|
557
541
|
/**
|
|
558
542
|
* Query orders:
|
|
@@ -573,14 +557,14 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
573
557
|
* https://docs.commercetools.com/api/projects/products#update-product-by-key
|
|
574
558
|
*/
|
|
575
559
|
CommercetoolsApi.prototype.updateProductByKey = function (options) {
|
|
576
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/key="
|
|
560
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/key=".concat(options.key), method: 'POST', data: options.data }));
|
|
577
561
|
};
|
|
578
562
|
/**
|
|
579
563
|
* Update a product by id:
|
|
580
564
|
* https://docs.commercetools.com/api/projects/products#update-product-by-id
|
|
581
565
|
*/
|
|
582
566
|
CommercetoolsApi.prototype.updateProductById = function (options) {
|
|
583
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/"
|
|
567
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/".concat(options.id), method: 'POST', data: options.data }));
|
|
584
568
|
};
|
|
585
569
|
/**
|
|
586
570
|
* Delete a product by id:
|
|
@@ -605,7 +589,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
605
589
|
product = _a.sent();
|
|
606
590
|
version = product.version;
|
|
607
591
|
_a.label = 2;
|
|
608
|
-
case 2: return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/"
|
|
592
|
+
case 2: return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/".concat(options.id), method: 'DELETE', params: __assign(__assign({}, options.params), { version: version }) }))];
|
|
609
593
|
}
|
|
610
594
|
});
|
|
611
595
|
});
|
|
@@ -633,7 +617,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
633
617
|
product = _a.sent();
|
|
634
618
|
version = product.version;
|
|
635
619
|
_a.label = 2;
|
|
636
|
-
case 2: return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/key="
|
|
620
|
+
case 2: return [2 /*return*/, this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/key=".concat(options.key), method: 'DELETE', params: __assign(__assign({}, options.params), { version: version }) }))];
|
|
637
621
|
}
|
|
638
622
|
});
|
|
639
623
|
});
|
|
@@ -645,7 +629,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
645
629
|
* https://docs.commercetools.com/api/projects/products#unpublish
|
|
646
630
|
*/
|
|
647
631
|
CommercetoolsApi.prototype.unpublishProductByKey = function (options) {
|
|
648
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/key="
|
|
632
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/key=".concat(options.key), method: 'POST', params: options.params, data: {
|
|
649
633
|
version: options.version,
|
|
650
634
|
actions: [{ action: 'unpublish' }],
|
|
651
635
|
} }));
|
|
@@ -657,7 +641,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
657
641
|
* https://docs.commercetools.com/api/projects/products#unpublish
|
|
658
642
|
*/
|
|
659
643
|
CommercetoolsApi.prototype.unpublishProductById = function (options) {
|
|
660
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/"
|
|
644
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/products/".concat(options.id), method: 'POST', params: options.params, data: {
|
|
661
645
|
version: options.version,
|
|
662
646
|
actions: [{ action: 'unpublish' }],
|
|
663
647
|
} }));
|
|
@@ -679,7 +663,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
679
663
|
*/
|
|
680
664
|
CommercetoolsApi.prototype.updateCategoryByKey = function (options) {
|
|
681
665
|
return this.request({
|
|
682
|
-
path: "/categories/key="
|
|
666
|
+
path: "/categories/key=".concat(options.key),
|
|
683
667
|
method: 'POST',
|
|
684
668
|
data: options.data,
|
|
685
669
|
});
|
|
@@ -689,21 +673,21 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
689
673
|
* https://docs.commercetools.com/api/projects/categories#update-category-by-id
|
|
690
674
|
*/
|
|
691
675
|
CommercetoolsApi.prototype.updateCategoryById = function (options) {
|
|
692
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/"
|
|
676
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/".concat(options.id), method: 'POST', data: options.data }));
|
|
693
677
|
};
|
|
694
678
|
/**
|
|
695
679
|
* Delete a category by id:
|
|
696
680
|
* https://docs.commercetools.com/api/projects/categories#delete-category-by-id
|
|
697
681
|
*/
|
|
698
682
|
CommercetoolsApi.prototype.deleteCategoryById = function (options) {
|
|
699
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/"
|
|
683
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/".concat(options.id), method: 'DELETE', params: __assign(__assign({}, options.params), { version: options.version }) }));
|
|
700
684
|
};
|
|
701
685
|
/**
|
|
702
686
|
* Delete a category by key:
|
|
703
687
|
* https://docs.commercetools.com/api/projects/categories#delete-category-by-key
|
|
704
688
|
*/
|
|
705
689
|
CommercetoolsApi.prototype.deleteCategoryByKey = function (options) {
|
|
706
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/key="
|
|
690
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/categories/key=".concat(options.key), method: 'DELETE', params: __assign(__assign({}, options.params), { version: options.version }) }));
|
|
707
691
|
};
|
|
708
692
|
/**
|
|
709
693
|
* Create a customer account:
|
|
@@ -717,22 +701,29 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
717
701
|
* https://docs.commercetools.com/api/projects/customers#delete-customer-by-id
|
|
718
702
|
*/
|
|
719
703
|
CommercetoolsApi.prototype.deleteCustomerById = function (options) {
|
|
720
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/"
|
|
704
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/".concat(options.id), options.storeKey), method: 'DELETE', params: __assign(__assign({}, options.params), { version: options.version, dataErasure: options.dataErasure }) }));
|
|
721
705
|
};
|
|
722
706
|
/**
|
|
723
707
|
* Delete a customer account by key
|
|
724
708
|
* https://docs.commercetools.com/api/projects/customers#delete-customer-by-key
|
|
725
709
|
*/
|
|
726
710
|
CommercetoolsApi.prototype.deleteCustomerByKey = function (options) {
|
|
727
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/key="
|
|
711
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/key=".concat(options.key), options.storeKey), method: 'DELETE', params: __assign(__assign({}, options.params), { version: options.version, dataErasure: options.dataErasure }) }));
|
|
728
712
|
};
|
|
729
713
|
/**
|
|
730
|
-
* Create a customer account given an anonymous access token:
|
|
714
|
+
* Create a customer account given an (optional) anonymous access token:
|
|
731
715
|
* https://docs.commercetools.com/api/projects/me-profile#create-customer-sign-up
|
|
732
716
|
*/
|
|
733
717
|
CommercetoolsApi.prototype.createMyAccount = function (options) {
|
|
734
718
|
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/signup", options.storeKey), method: 'POST', data: options.data, accessToken: options.accessToken }));
|
|
735
719
|
};
|
|
720
|
+
/**
|
|
721
|
+
* Login to customer's account given an (optional) anonymous access token:
|
|
722
|
+
* https://docs.commercetools.com/api/projects/me-profile#authenticate-customer-sign-in
|
|
723
|
+
*/
|
|
724
|
+
CommercetoolsApi.prototype.loginMyAccount = function (options) {
|
|
725
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/me/login", options.storeKey), method: 'POST', data: options.data, accessToken: options.accessToken }));
|
|
726
|
+
};
|
|
736
727
|
/**
|
|
737
728
|
* Login to customer's account:
|
|
738
729
|
* https://docs.commercetools.com/api/projects/customers#authenticate-customer-sign-in
|
|
@@ -780,21 +771,21 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
780
771
|
* https://docs.commercetools.com/api/projects/customers#get-customer-by-id
|
|
781
772
|
*/
|
|
782
773
|
CommercetoolsApi.prototype.getCustomerById = function (options) {
|
|
783
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/"
|
|
774
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/".concat(options.id), options.storeKey), method: 'GET' }));
|
|
784
775
|
};
|
|
785
776
|
/**
|
|
786
777
|
* Get a customer by key:
|
|
787
778
|
* https://docs.commercetools.com/api/projects/customers#get-customer-by-key
|
|
788
779
|
*/
|
|
789
780
|
CommercetoolsApi.prototype.getCustomerByKey = function (options) {
|
|
790
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/key="
|
|
781
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/key=".concat(options.key), options.storeKey), method: 'GET' }));
|
|
791
782
|
};
|
|
792
783
|
/**
|
|
793
784
|
* Get a customer by password token:
|
|
794
785
|
* https://docs.commercetools.com/api/projects/customers#get-customer-by-password-token
|
|
795
786
|
*/
|
|
796
787
|
CommercetoolsApi.prototype.getCustomerByPasswordToken = function (options) {
|
|
797
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/password-token="
|
|
788
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: this.applyStore("/customers/password-token=".concat(options.token), options.storeKey), method: 'GET' }));
|
|
798
789
|
};
|
|
799
790
|
/**
|
|
800
791
|
* Query customers:
|
|
@@ -808,63 +799,63 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
808
799
|
* https://docs.commercetools.com/api/projects/customers#update-customer-by-id
|
|
809
800
|
*/
|
|
810
801
|
CommercetoolsApi.prototype.updateCustomerById = function (options) {
|
|
811
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/customers/"
|
|
802
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/customers/".concat(options.id), method: 'POST', data: options.data }));
|
|
812
803
|
};
|
|
813
804
|
/**
|
|
814
805
|
* Update a customer by key:
|
|
815
806
|
* https://docs.commercetools.com/api/projects/customers#update-customer-by-key
|
|
816
807
|
*/
|
|
817
808
|
CommercetoolsApi.prototype.updateCustomerByKey = function (options) {
|
|
818
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/customers/key="
|
|
809
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/customers/key=".concat(options.key), method: 'POST', data: options.data }));
|
|
819
810
|
};
|
|
820
811
|
/**
|
|
821
812
|
* Get a product type by id:
|
|
822
813
|
* https://docs.commercetools.com/api/projects/productTypes#get-a-producttype-by-id
|
|
823
814
|
*/
|
|
824
815
|
CommercetoolsApi.prototype.getProductTypeById = function (options) {
|
|
825
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-types/"
|
|
816
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-types/".concat(options.id), method: 'GET' }));
|
|
826
817
|
};
|
|
827
818
|
/**
|
|
828
819
|
* Get a product type by key:
|
|
829
820
|
* https://docs.commercetools.com/api/projects/productTypes#get-a-producttype-by-key
|
|
830
821
|
*/
|
|
831
822
|
CommercetoolsApi.prototype.getProductTypeByKey = function (options) {
|
|
832
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-types/key="
|
|
823
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/product-types/key=".concat(options.key), method: 'GET' }));
|
|
833
824
|
};
|
|
834
825
|
/**
|
|
835
826
|
* Get a type by id:
|
|
836
827
|
* https://docs.commercetools.com/api/projects/types#get-type-by-id
|
|
837
828
|
*/
|
|
838
829
|
CommercetoolsApi.prototype.getTypeById = function (options) {
|
|
839
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/types/"
|
|
830
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/types/".concat(options.id), method: 'GET' }));
|
|
840
831
|
};
|
|
841
832
|
/**
|
|
842
833
|
* Get a type by key:
|
|
843
834
|
* https://docs.commercetools.com/api/projects/types#get-type-by-key
|
|
844
835
|
*/
|
|
845
836
|
CommercetoolsApi.prototype.getTypeByKey = function (options) {
|
|
846
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/types/key="
|
|
837
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/types/key=".concat(options.key), method: 'GET' }));
|
|
847
838
|
};
|
|
848
839
|
/**
|
|
849
840
|
* Get a discount code by id:
|
|
850
841
|
* https://docs.commercetools.com/api/projects/discountCodes#get-discountcode-by-id
|
|
851
842
|
*/
|
|
852
843
|
CommercetoolsApi.prototype.getDiscountCodeById = function (options) {
|
|
853
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/discount-codes/"
|
|
844
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/discount-codes/".concat(options.id), method: 'GET' }));
|
|
854
845
|
};
|
|
855
846
|
/**
|
|
856
847
|
* Get a cart discount code by id:
|
|
857
848
|
* https://docs.commercetools.com/api/projects/cartDiscounts#get-cartdiscount-by-id
|
|
858
849
|
*/
|
|
859
850
|
CommercetoolsApi.prototype.getCartDiscountById = function (options) {
|
|
860
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/cart-discounts/"
|
|
851
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/cart-discounts/".concat(options.id), method: 'GET' }));
|
|
861
852
|
};
|
|
862
853
|
/**
|
|
863
854
|
* Get a cart discount by key:
|
|
864
855
|
* https://docs.commercetools.com/api/projects/cartDiscounts#get-cartdiscount-by-key
|
|
865
856
|
*/
|
|
866
857
|
CommercetoolsApi.prototype.getCartDiscountByKey = function (options) {
|
|
867
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/cart-discounts/key="
|
|
858
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/cart-discounts/key=".concat(options.key), method: 'GET' }));
|
|
868
859
|
};
|
|
869
860
|
/**
|
|
870
861
|
* Query cart discounts:
|
|
@@ -878,14 +869,14 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
878
869
|
* https://docs.commercetools.com/api/projects/custom-objects#get-customobject-by-container-and-key
|
|
879
870
|
*/
|
|
880
871
|
CommercetoolsApi.prototype.getCustomObject = function (options) {
|
|
881
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/custom-objects/"
|
|
872
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/custom-objects/".concat(options.container, "/").concat(options.key), method: 'GET' }));
|
|
882
873
|
};
|
|
883
874
|
/**
|
|
884
875
|
* Get a custom object by id
|
|
885
876
|
* https://docs.commercetools.com/api/projects/custom-objects#get-customobject
|
|
886
877
|
*/
|
|
887
878
|
CommercetoolsApi.prototype.getCustomObjectById = function (options) {
|
|
888
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/custom-objects/"
|
|
879
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/custom-objects/".concat(options.id), method: 'GET' }));
|
|
889
880
|
};
|
|
890
881
|
/**
|
|
891
882
|
* Save a custom object
|
|
@@ -899,7 +890,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
899
890
|
* https://docs.commercetools.com/api/projects/custom-objects#delete-customobject-by-container-and-key
|
|
900
891
|
*/
|
|
901
892
|
CommercetoolsApi.prototype.deleteCustomObject = function (options) {
|
|
902
|
-
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/custom-objects/"
|
|
893
|
+
return this.request(__assign(__assign({}, this.extractCommonRequestOptions(options)), { path: "/custom-objects/".concat(options.container, "/").concat(options.key), method: 'DELETE' }));
|
|
903
894
|
};
|
|
904
895
|
/**
|
|
905
896
|
* Execute a GraphQL statement:
|
|
@@ -987,7 +978,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
987
978
|
switch (_a.label) {
|
|
988
979
|
case 0:
|
|
989
980
|
accessToken = options.accessToken;
|
|
990
|
-
url = this.endpoints.api
|
|
981
|
+
url = "".concat(this.endpoints.api, "/").concat(this.config.projectKey).concat(options.path);
|
|
991
982
|
opts = __assign({}, options);
|
|
992
983
|
opts.path && delete opts.path;
|
|
993
984
|
opts.accessToken && delete opts.accessToken;
|
|
@@ -998,7 +989,7 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
998
989
|
accessToken = grant.accessToken;
|
|
999
990
|
_a.label = 2;
|
|
1000
991
|
case 2:
|
|
1001
|
-
headers = __assign(__assign(__assign({}, this.axios.defaults.headers), { Authorization: "Bearer "
|
|
992
|
+
headers = __assign(__assign(__assign({}, this.axios.defaults.headers), { Authorization: "Bearer ".concat(accessToken) }), opts.headers);
|
|
1002
993
|
if (typeof options.correlationId === 'string' && options.correlationId !== '') {
|
|
1003
994
|
headers['X-Correlation-ID'] = options.correlationId;
|
|
1004
995
|
delete options.correlationId;
|
|
@@ -1066,10 +1057,10 @@ var CommercetoolsApi = /** @class */ (function () {
|
|
|
1066
1057
|
*/
|
|
1067
1058
|
CommercetoolsApi.prototype.applyStore = function (path, storeKey) {
|
|
1068
1059
|
if (typeof storeKey === 'string' && storeKey !== '') {
|
|
1069
|
-
return "/in-store/key="
|
|
1060
|
+
return "/in-store/key=".concat(storeKey).concat(path);
|
|
1070
1061
|
}
|
|
1071
1062
|
else if (this.config.storeKey) {
|
|
1072
|
-
return "/in-store/key="
|
|
1063
|
+
return "/in-store/key=".concat(this.config.storeKey).concat(path);
|
|
1073
1064
|
}
|
|
1074
1065
|
return path;
|
|
1075
1066
|
};
|