@commercetools/api-request-builder
Advanced tools
Comparing version 5.6.3 to 6.0.0
@@ -5,17 +5,2 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
@@ -26,6 +11,5 @@ var keys = Object.keys(object); | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
@@ -38,15 +22,8 @@ | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
@@ -57,2 +34,17 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
@@ -78,6 +70,6 @@ * NOTE: | ||
var query = 'query'; | ||
var query$1 = 'query'; | ||
var queryOne = 'queryOne'; | ||
var queryExpand = 'queryExpand'; | ||
var queryLocation = 'queryLocation'; | ||
var queryExpand$1 = 'queryExpand'; | ||
var queryLocation$1 = 'queryLocation'; | ||
var search = 'search'; | ||
@@ -92,6 +84,6 @@ var projection = 'projection'; | ||
del: del, | ||
query: query, | ||
query: query$1, | ||
queryOne: queryOne, | ||
queryExpand: queryExpand, | ||
queryLocation: queryLocation, | ||
queryExpand: queryExpand$1, | ||
queryLocation: queryLocation$1, | ||
search: search, | ||
@@ -111,3 +103,3 @@ projection: projection, | ||
endpoint: '/cart-discounts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -117,3 +109,3 @@ carts: { | ||
endpoint: '/carts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -123,3 +115,3 @@ categories: { | ||
endpoint: '/categories', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -129,3 +121,3 @@ channels: { | ||
endpoint: '/channels', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -135,3 +127,3 @@ customerGroups: { | ||
endpoint: '/customer-groups', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -141,3 +133,3 @@ customers: { | ||
endpoint: '/customers', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -172,3 +164,3 @@ customersPassword: { | ||
endpoint: '/custom-objects', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -178,3 +170,3 @@ discountCodes: { | ||
endpoint: '/discount-codes', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -184,3 +176,3 @@ extensions: { | ||
endpoint: '/extensions', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -190,3 +182,3 @@ inventory: { | ||
endpoint: '/inventory', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -196,3 +188,3 @@ messages: { | ||
endpoint: '/messages', | ||
features: [query, queryOne, queryExpand] | ||
features: [query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -207,3 +199,3 @@ myActiveCart: { | ||
endpoint: '/me/carts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -213,3 +205,3 @@ myOrders: { | ||
endpoint: '/me/orders', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -219,3 +211,3 @@ orders: { | ||
endpoint: '/orders', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -225,3 +217,3 @@ orderEdits: { | ||
endpoint: '/orders/edits', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -231,3 +223,3 @@ orderImport: { | ||
endpoint: '/orders/import', | ||
features: [create, query] | ||
features: [create, query$1] | ||
}, | ||
@@ -237,3 +229,3 @@ payments: { | ||
endpoint: '/payments', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -243,3 +235,3 @@ productDiscounts: { | ||
endpoint: '/product-discounts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -249,3 +241,3 @@ productProjections: { | ||
endpoint: '/product-projections', | ||
features: [query, queryOne, queryExpand, projection] | ||
features: [query$1, queryOne, queryExpand$1, projection] | ||
}, | ||
@@ -255,3 +247,3 @@ productProjectionsSearch: { | ||
endpoint: '/product-projections/search', | ||
features: [search, queryOne, queryExpand, projection] | ||
features: [search, queryOne, queryExpand$1, projection] | ||
}, | ||
@@ -266,3 +258,3 @@ productProjectionsSuggest: { | ||
endpoint: '/products', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -272,3 +264,3 @@ productTypes: { | ||
endpoint: '/product-types', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -278,3 +270,3 @@ project: { | ||
endpoint: '/', | ||
features: [update, query] | ||
features: [update, query$1] | ||
}, | ||
@@ -284,3 +276,3 @@ reviews: { | ||
endpoint: '/reviews', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -290,3 +282,3 @@ shippingMethods: { | ||
endpoint: '/shipping-methods', | ||
features: [create, update, del, query, queryOne, queryExpand, queryLocation] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1, queryLocation$1] | ||
}, | ||
@@ -296,3 +288,3 @@ shoppingLists: { | ||
endpoint: '/shopping-lists', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -302,3 +294,3 @@ states: { | ||
endpoint: '/states', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -308,3 +300,3 @@ stores: { | ||
endpoint: '/stores', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -314,3 +306,3 @@ subscriptions: { | ||
endpoint: '/subscriptions', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -320,3 +312,3 @@ taxCategories: { | ||
endpoint: '/tax-categories', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -326,3 +318,3 @@ types: { | ||
endpoint: '/types', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -332,3 +324,3 @@ zones: { | ||
endpoint: '/zones', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
} | ||
@@ -404,3 +396,3 @@ }; | ||
if (this.features.includes(query)) { | ||
if (this.features.includes(query$1)) { | ||
this.params.pagination = getDefaultQueryParams().pagination; | ||
@@ -415,3 +407,3 @@ this.params.query = getDefaultQueryParams().query; | ||
if (this.features.includes(queryLocation)) this.params.location = getDefaultQueryParams().location; | ||
if (this.features.includes(queryLocation$1)) this.params.location = getDefaultQueryParams().location; | ||
if (this.features.includes(suggest)) this.params.searchKeywords = []; | ||
@@ -707,3 +699,3 @@ } | ||
var query$1 = /*#__PURE__*/Object.freeze({ | ||
var query = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -855,3 +847,3 @@ where: where, | ||
var queryLocation$1 = /*#__PURE__*/Object.freeze({ | ||
var queryLocation = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -884,3 +876,3 @@ byCountry: byCountry, | ||
var queryExpand$1 = /*#__PURE__*/Object.freeze({ | ||
var queryExpand = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -1219,6 +1211,6 @@ expand: expand | ||
}, features$1.reduce(function (acc, feature) { | ||
if (feature === query) return _objectSpread2(_objectSpread2(_objectSpread2({}, acc), query$1), queryPage); | ||
if (feature === query$1) return _objectSpread2(_objectSpread2(_objectSpread2({}, acc), query), queryPage); | ||
if (feature === queryOne) return _objectSpread2(_objectSpread2({}, acc), queryId); | ||
if (feature === queryLocation) return _objectSpread2(_objectSpread2({}, acc), queryLocation$1); | ||
if (feature === queryExpand) return _objectSpread2(_objectSpread2({}, acc), queryExpand$1); | ||
if (feature === queryLocation$1) return _objectSpread2(_objectSpread2({}, acc), queryLocation); | ||
if (feature === queryExpand$1) return _objectSpread2(_objectSpread2({}, acc), queryExpand); | ||
if (feature === search) return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, acc), querySearch), queryPage), {}, { | ||
@@ -1225,0 +1217,0 @@ params: getDefaultSearchParams() |
@@ -1,16 +0,1 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
@@ -21,6 +6,5 @@ var keys = Object.keys(object); | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
@@ -33,15 +17,8 @@ | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
@@ -52,2 +29,17 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
@@ -73,6 +65,6 @@ * NOTE: | ||
var query = 'query'; | ||
var query$1 = 'query'; | ||
var queryOne = 'queryOne'; | ||
var queryExpand = 'queryExpand'; | ||
var queryLocation = 'queryLocation'; | ||
var queryExpand$1 = 'queryExpand'; | ||
var queryLocation$1 = 'queryLocation'; | ||
var search = 'search'; | ||
@@ -87,6 +79,6 @@ var projection = 'projection'; | ||
del: del, | ||
query: query, | ||
query: query$1, | ||
queryOne: queryOne, | ||
queryExpand: queryExpand, | ||
queryLocation: queryLocation, | ||
queryExpand: queryExpand$1, | ||
queryLocation: queryLocation$1, | ||
search: search, | ||
@@ -106,3 +98,3 @@ projection: projection, | ||
endpoint: '/cart-discounts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -112,3 +104,3 @@ carts: { | ||
endpoint: '/carts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -118,3 +110,3 @@ categories: { | ||
endpoint: '/categories', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -124,3 +116,3 @@ channels: { | ||
endpoint: '/channels', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -130,3 +122,3 @@ customerGroups: { | ||
endpoint: '/customer-groups', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -136,3 +128,3 @@ customers: { | ||
endpoint: '/customers', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -167,3 +159,3 @@ customersPassword: { | ||
endpoint: '/custom-objects', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -173,3 +165,3 @@ discountCodes: { | ||
endpoint: '/discount-codes', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -179,3 +171,3 @@ extensions: { | ||
endpoint: '/extensions', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -185,3 +177,3 @@ inventory: { | ||
endpoint: '/inventory', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -191,3 +183,3 @@ messages: { | ||
endpoint: '/messages', | ||
features: [query, queryOne, queryExpand] | ||
features: [query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -202,3 +194,3 @@ myActiveCart: { | ||
endpoint: '/me/carts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -208,3 +200,3 @@ myOrders: { | ||
endpoint: '/me/orders', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -214,3 +206,3 @@ orders: { | ||
endpoint: '/orders', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -220,3 +212,3 @@ orderEdits: { | ||
endpoint: '/orders/edits', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -226,3 +218,3 @@ orderImport: { | ||
endpoint: '/orders/import', | ||
features: [create, query] | ||
features: [create, query$1] | ||
}, | ||
@@ -232,3 +224,3 @@ payments: { | ||
endpoint: '/payments', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -238,3 +230,3 @@ productDiscounts: { | ||
endpoint: '/product-discounts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -244,3 +236,3 @@ productProjections: { | ||
endpoint: '/product-projections', | ||
features: [query, queryOne, queryExpand, projection] | ||
features: [query$1, queryOne, queryExpand$1, projection] | ||
}, | ||
@@ -250,3 +242,3 @@ productProjectionsSearch: { | ||
endpoint: '/product-projections/search', | ||
features: [search, queryOne, queryExpand, projection] | ||
features: [search, queryOne, queryExpand$1, projection] | ||
}, | ||
@@ -261,3 +253,3 @@ productProjectionsSuggest: { | ||
endpoint: '/products', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -267,3 +259,3 @@ productTypes: { | ||
endpoint: '/product-types', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -273,3 +265,3 @@ project: { | ||
endpoint: '/', | ||
features: [update, query] | ||
features: [update, query$1] | ||
}, | ||
@@ -279,3 +271,3 @@ reviews: { | ||
endpoint: '/reviews', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -285,3 +277,3 @@ shippingMethods: { | ||
endpoint: '/shipping-methods', | ||
features: [create, update, del, query, queryOne, queryExpand, queryLocation] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1, queryLocation$1] | ||
}, | ||
@@ -291,3 +283,3 @@ shoppingLists: { | ||
endpoint: '/shopping-lists', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -297,3 +289,3 @@ states: { | ||
endpoint: '/states', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -303,3 +295,3 @@ stores: { | ||
endpoint: '/stores', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -309,3 +301,3 @@ subscriptions: { | ||
endpoint: '/subscriptions', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -315,3 +307,3 @@ taxCategories: { | ||
endpoint: '/tax-categories', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -321,3 +313,3 @@ types: { | ||
endpoint: '/types', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -327,3 +319,3 @@ zones: { | ||
endpoint: '/zones', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
} | ||
@@ -399,3 +391,3 @@ }; | ||
if (this.features.includes(query)) { | ||
if (this.features.includes(query$1)) { | ||
this.params.pagination = getDefaultQueryParams().pagination; | ||
@@ -410,3 +402,3 @@ this.params.query = getDefaultQueryParams().query; | ||
if (this.features.includes(queryLocation)) this.params.location = getDefaultQueryParams().location; | ||
if (this.features.includes(queryLocation$1)) this.params.location = getDefaultQueryParams().location; | ||
if (this.features.includes(suggest)) this.params.searchKeywords = []; | ||
@@ -702,3 +694,3 @@ } | ||
var query$1 = /*#__PURE__*/Object.freeze({ | ||
var query = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -850,3 +842,3 @@ where: where, | ||
var queryLocation$1 = /*#__PURE__*/Object.freeze({ | ||
var queryLocation = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -879,3 +871,3 @@ byCountry: byCountry, | ||
var queryExpand$1 = /*#__PURE__*/Object.freeze({ | ||
var queryExpand = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -1214,6 +1206,6 @@ expand: expand | ||
}, features$1.reduce(function (acc, feature) { | ||
if (feature === query) return _objectSpread2(_objectSpread2(_objectSpread2({}, acc), query$1), queryPage); | ||
if (feature === query$1) return _objectSpread2(_objectSpread2(_objectSpread2({}, acc), query), queryPage); | ||
if (feature === queryOne) return _objectSpread2(_objectSpread2({}, acc), queryId); | ||
if (feature === queryLocation) return _objectSpread2(_objectSpread2({}, acc), queryLocation$1); | ||
if (feature === queryExpand) return _objectSpread2(_objectSpread2({}, acc), queryExpand$1); | ||
if (feature === queryLocation$1) return _objectSpread2(_objectSpread2({}, acc), queryLocation); | ||
if (feature === queryExpand$1) return _objectSpread2(_objectSpread2({}, acc), queryExpand); | ||
if (feature === search) return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, acc), querySearch), queryPage), {}, { | ||
@@ -1220,0 +1212,0 @@ params: getDefaultSearchParams() |
@@ -5,19 +5,4 @@ (function (global, factory) { | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CommercetoolsApiRequestBuilder = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
})(this, (function (exports) { 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
@@ -28,6 +13,5 @@ var keys = Object.keys(object); | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
@@ -40,15 +24,8 @@ | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
@@ -59,2 +36,17 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
@@ -80,6 +72,6 @@ * NOTE: | ||
var query = 'query'; | ||
var query$1 = 'query'; | ||
var queryOne = 'queryOne'; | ||
var queryExpand = 'queryExpand'; | ||
var queryLocation = 'queryLocation'; | ||
var queryExpand$1 = 'queryExpand'; | ||
var queryLocation$1 = 'queryLocation'; | ||
var search = 'search'; | ||
@@ -94,6 +86,6 @@ var projection = 'projection'; | ||
del: del, | ||
query: query, | ||
query: query$1, | ||
queryOne: queryOne, | ||
queryExpand: queryExpand, | ||
queryLocation: queryLocation, | ||
queryExpand: queryExpand$1, | ||
queryLocation: queryLocation$1, | ||
search: search, | ||
@@ -113,3 +105,3 @@ projection: projection, | ||
endpoint: '/cart-discounts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -119,3 +111,3 @@ carts: { | ||
endpoint: '/carts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -125,3 +117,3 @@ categories: { | ||
endpoint: '/categories', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -131,3 +123,3 @@ channels: { | ||
endpoint: '/channels', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -137,3 +129,3 @@ customerGroups: { | ||
endpoint: '/customer-groups', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -143,3 +135,3 @@ customers: { | ||
endpoint: '/customers', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -174,3 +166,3 @@ customersPassword: { | ||
endpoint: '/custom-objects', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -180,3 +172,3 @@ discountCodes: { | ||
endpoint: '/discount-codes', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -186,3 +178,3 @@ extensions: { | ||
endpoint: '/extensions', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -192,3 +184,3 @@ inventory: { | ||
endpoint: '/inventory', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -198,3 +190,3 @@ messages: { | ||
endpoint: '/messages', | ||
features: [query, queryOne, queryExpand] | ||
features: [query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -209,3 +201,3 @@ myActiveCart: { | ||
endpoint: '/me/carts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -215,3 +207,3 @@ myOrders: { | ||
endpoint: '/me/orders', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -221,3 +213,3 @@ orders: { | ||
endpoint: '/orders', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -227,3 +219,3 @@ orderEdits: { | ||
endpoint: '/orders/edits', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -233,3 +225,3 @@ orderImport: { | ||
endpoint: '/orders/import', | ||
features: [create, query] | ||
features: [create, query$1] | ||
}, | ||
@@ -239,3 +231,3 @@ payments: { | ||
endpoint: '/payments', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -245,3 +237,3 @@ productDiscounts: { | ||
endpoint: '/product-discounts', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -251,3 +243,3 @@ productProjections: { | ||
endpoint: '/product-projections', | ||
features: [query, queryOne, queryExpand, projection] | ||
features: [query$1, queryOne, queryExpand$1, projection] | ||
}, | ||
@@ -257,3 +249,3 @@ productProjectionsSearch: { | ||
endpoint: '/product-projections/search', | ||
features: [search, queryOne, queryExpand, projection] | ||
features: [search, queryOne, queryExpand$1, projection] | ||
}, | ||
@@ -268,3 +260,3 @@ productProjectionsSuggest: { | ||
endpoint: '/products', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -274,3 +266,3 @@ productTypes: { | ||
endpoint: '/product-types', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -280,3 +272,3 @@ project: { | ||
endpoint: '/', | ||
features: [update, query] | ||
features: [update, query$1] | ||
}, | ||
@@ -286,3 +278,3 @@ reviews: { | ||
endpoint: '/reviews', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -292,3 +284,3 @@ shippingMethods: { | ||
endpoint: '/shipping-methods', | ||
features: [create, update, del, query, queryOne, queryExpand, queryLocation] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1, queryLocation$1] | ||
}, | ||
@@ -298,3 +290,3 @@ shoppingLists: { | ||
endpoint: '/shopping-lists', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -304,3 +296,3 @@ states: { | ||
endpoint: '/states', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -310,3 +302,3 @@ stores: { | ||
endpoint: '/stores', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -316,3 +308,3 @@ subscriptions: { | ||
endpoint: '/subscriptions', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -322,3 +314,3 @@ taxCategories: { | ||
endpoint: '/tax-categories', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -328,3 +320,3 @@ types: { | ||
endpoint: '/types', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
}, | ||
@@ -334,3 +326,3 @@ zones: { | ||
endpoint: '/zones', | ||
features: [create, update, del, query, queryOne, queryExpand] | ||
features: [create, update, del, query$1, queryOne, queryExpand$1] | ||
} | ||
@@ -406,3 +398,3 @@ }; | ||
if (this.features.includes(query)) { | ||
if (this.features.includes(query$1)) { | ||
this.params.pagination = getDefaultQueryParams().pagination; | ||
@@ -417,3 +409,3 @@ this.params.query = getDefaultQueryParams().query; | ||
if (this.features.includes(queryLocation)) this.params.location = getDefaultQueryParams().location; | ||
if (this.features.includes(queryLocation$1)) this.params.location = getDefaultQueryParams().location; | ||
if (this.features.includes(suggest)) this.params.searchKeywords = []; | ||
@@ -709,3 +701,3 @@ } | ||
var query$1 = /*#__PURE__*/Object.freeze({ | ||
var query = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -857,3 +849,3 @@ where: where, | ||
var queryLocation$1 = /*#__PURE__*/Object.freeze({ | ||
var queryLocation = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -886,3 +878,3 @@ byCountry: byCountry, | ||
var queryExpand$1 = /*#__PURE__*/Object.freeze({ | ||
var queryExpand = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
@@ -1221,6 +1213,6 @@ expand: expand | ||
}, features$1.reduce(function (acc, feature) { | ||
if (feature === query) return _objectSpread2(_objectSpread2(_objectSpread2({}, acc), query$1), queryPage); | ||
if (feature === query$1) return _objectSpread2(_objectSpread2(_objectSpread2({}, acc), query), queryPage); | ||
if (feature === queryOne) return _objectSpread2(_objectSpread2({}, acc), queryId); | ||
if (feature === queryLocation) return _objectSpread2(_objectSpread2({}, acc), queryLocation$1); | ||
if (feature === queryExpand) return _objectSpread2(_objectSpread2({}, acc), queryExpand$1); | ||
if (feature === queryLocation$1) return _objectSpread2(_objectSpread2({}, acc), queryLocation); | ||
if (feature === queryExpand$1) return _objectSpread2(_objectSpread2({}, acc), queryExpand); | ||
if (feature === search) return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, acc), querySearch), queryPage), {}, { | ||
@@ -1291,2 +1283,2 @@ params: getDefaultSearchParams() | ||
}))); | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).CommercetoolsApiRequestBuilder={})}(this,function(e){"use strict";function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(r,e){var t,n=Object.keys(r);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(r),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.push.apply(n,t)),n}function s(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?n(Object(t),!0).forEach(function(e){o(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}var r="create",t="update",i="delete",c="query",p="queryOne",h="queryExpand",f="queryLocation",d="search",y="projection",m="suggest",a=Object.freeze({__proto__:null,create:r,update:t,del:i,query:c,queryOne:p,queryExpand:h,queryLocation:f,search:d,projection:y,suggest:m}),u={login:{type:"login",endpoint:"/login",features:[r]},cartDiscounts:{type:"cart-discounts",endpoint:"/cart-discounts",features:[r,t,i,c,p,h]},carts:{type:"carts",endpoint:"/carts",features:[r,t,i,c,p,h]},categories:{type:"categories",endpoint:"/categories",features:[r,t,i,c,p,h]},channels:{type:"channels",endpoint:"/channels",features:[r,t,i,c,p,h]},customerGroups:{type:"customer-groups",endpoint:"/customer-groups",features:[r,t,i,c,p,h]},customers:{type:"customers",endpoint:"/customers",features:[r,t,i,c,p,h]},customersPassword:{type:"customers-password",endpoint:"/customers/password",features:[r]},customersPasswordToken:{type:"customers-password-token",endpoint:"/customers/password-token",features:[r,p]},customersPasswordReset:{type:"customers-password-reset",endpoint:"/customers/password/reset",features:[r]},customersEmailVerificationToken:{type:"customers-email-verification-token",endpoint:"/customers/email-token",features:[r,p]},customersEmailVerification:{type:"customers-email-verification",endpoint:"/customers/email/confirm",features:[r]},customObjects:{type:"custom-objects",endpoint:"/custom-objects",features:[r,t,i,c,p,h]},discountCodes:{type:"discount-codes",endpoint:"/discount-codes",features:[r,t,i,c,p,h]},extensions:{type:"extensions",endpoint:"/extensions",features:[r,t,i,c,p,h]},inventory:{type:"inventory",endpoint:"/inventory",features:[r,t,i,c,p,h]},messages:{type:"messages",endpoint:"/messages",features:[c,p,h]},myActiveCart:{type:"my-carts",endpoint:"/me/active-cart",features:[p]},myCarts:{type:"my-carts",endpoint:"/me/carts",features:[r,t,i,c,p,h]},myOrders:{type:"my-orders",endpoint:"/me/orders",features:[r,t,i,c,p,h]},orders:{type:"orders",endpoint:"/orders",features:[r,t,i,c,p,h]},orderEdits:{type:"orders-edits",endpoint:"/orders/edits",features:[r,t,i,c,p,h]},orderImport:{type:"orderImport",endpoint:"/orders/import",features:[r,c]},payments:{type:"payments",endpoint:"/payments",features:[r,t,i,c,p,h]},productDiscounts:{type:"product-discounts",endpoint:"/product-discounts",features:[r,t,i,c,p,h]},productProjections:{type:"product-projections",endpoint:"/product-projections",features:[c,p,h,y]},productProjectionsSearch:{type:"product-projections-search",endpoint:"/product-projections/search",features:[d,p,h,y]},productProjectionsSuggest:{type:"product-projections-suggest",endpoint:"/product-projections/suggest",features:[d,m,p,y]},products:{type:"products",endpoint:"/products",features:[r,t,i,c,p,h]},productTypes:{type:"product-types",endpoint:"/product-types",features:[r,t,i,c,p,h]},project:{type:"project",endpoint:"/",features:[t,c]},reviews:{type:"reviews",endpoint:"/reviews",features:[r,t,i,c,p,h]},shippingMethods:{type:"shipping-methods",endpoint:"/shipping-methods",features:[r,t,i,c,p,h,f]},shoppingLists:{type:"shopping-lists",endpoint:"/shopping-lists",features:[r,t,i,c,p,h]},states:{type:"states",endpoint:"/states",features:[r,t,i,c,p,h]},stores:{type:"stores",endpoint:"/stores",features:[r,t,i,c,p,h]},subscriptions:{type:"subscriptions",endpoint:"/subscriptions",features:[r,t,i,c,p,h]},taxCategories:{type:"tax-categories",endpoint:"/tax-categories",features:[r,t,i,c,p,h]},types:{type:"types",endpoint:"/types",features:[r,t,i,c,p,h]},zones:{type:"zones",endpoint:"/zones",features:[r,t,i,c,p,h]}};function l(){return{id:null,expand:[],pagination:{page:null,perPage:null,sort:[],withTotal:null},location:{currency:"",country:"",state:""},query:{operator:"and",where:[]},searchKeywords:[]}}function g(){return{expand:[],searchKeywords:[],pagination:{page:null,perPage:null,sort:[],withTotal:null},search:{facet:[],filter:[],filterByQuery:[],filterByFacets:[],fuzzy:!1,fuzzyLevel:0,markMatchingVariants:!1,text:null}}}var w=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function b(e){if("number"!=typeof e)throw new Error("A resource version is missing or invalid");return this.params.version=e,this}function v(){return this.params.dataErasure="dataErasure=true",this}function E(e){if("string"!=typeof e)throw new Error("A resource orderEditId is missing or invalid");return this.params.applyOrderEditTo=e,this}var C=Object.freeze({__proto__:null,where:function(e){if(!e)throw new Error("Required argument for `where` is missing");var r=encodeURIComponent(e);return this.params.query.where.push(r),this},whereOperator:function(e){if(!e)throw new Error("Required argument for `whereOperator` is missing");if("and"!==e&&"or"!==e)throw new Error("Required argument for `whereOperator` is invalid, allowed values are (`and`, `or`)");return this.params.query.operator=e,this}});var O=Object.freeze({__proto__:null,byId:function(e){if(!e)throw new Error("Required argument for `byId` is missing");if(this.params.key)throw new Error("A key for this resource has already been set. You cannot use both `byKey` and `byId`.");if(this.params.customerId)throw new Error("A customerId for this resource has already been set. You cannot use both `byId` and `byCustomerId`.");if(this.params.cartId)throw new Error("A cartId for this resource has already been set. You cannot use both `byId` and `byCartId`.");return this.params.id=e,this},byKey:function(e){if(!e)throw new Error("Required argument for `byKey` is missing");if(this.params.id)throw new Error("An ID for this resource has already been set. You cannot use both `byId` and `byKey`.");return this.params.key=e,this},byCustomerId:function(e){if(!e)throw new Error("Required argument for `byCustomerId` is missing");if(this.params.id)throw new Error("An ID for this resource has already been set. You cannot use both `byId` and `byCustomerId`.");return this.params.customerId=e,this},byOrderNumber:function(e){if("string"!=typeof e)throw new Error("Required argument for `byOrderNumber` is missing or invalid");return this.params.orderNumber=e,this},byCartId:function(e){if(!e)throw new Error("Required argument for `byCartId` is missing");if(this.params.id)throw new Error("An ID for this resource has already been set. You cannot use both `byId` and `byCartId`.");return this.params.cartId=e,this},byContainerAndKey:function(e,r){if("string"!=typeof e||"string"!=typeof r)throw new Error("Required `container` or `key` argument for `byContainerAndKey` needs to be a string");return this.params.container=e,this.params.key=r,this}});var j=Object.freeze({__proto__:null,byCountry:function(e){if(!e)throw new Error("Required argument for `byCountry` is missing");return this.params.location.country=e,this},byCurrency:function(e){if(!e)throw new Error("Required argument for `byCurrency` is missing");if(!this.params.location.country)throw new Error("A `country` for this resource has not been set. You must set the country in order to use the `byCurrency` method.");return this.params.location.currency=e,this},byState:function(e){if(!e)throw new Error("Required argument for `byState` is missing");if(!this.params.location.country)throw new Error("A `country` for this resource has not been set. You must set the country in order to use the `byState` method.");return this.params.location.state=e,this}});var I=Object.freeze({__proto__:null,expand:function(e){if(!e)throw new Error("Required argument for `expand` is missing");var r=encodeURIComponent(e);return this.params.expand.push(r),this}});var z=Object.freeze({__proto__:null,sort:function(e){var r=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(!e)throw new Error("Required argument for `sort` is missing");var t=r?"asc":"desc",n=encodeURIComponent("".concat(e," ").concat(t));return this.params.pagination.sort.push(n),this},page:function(e){if("number"!=typeof e&&!e)throw new Error("Required argument for `page` is missing or invalid");if("number"!=typeof e||e<1)throw new Error("Required argument for `page` must be a number >= 1");return this.params.pagination.page=e,this},perPage:function(e){if("number"!=typeof e&&!e)throw new Error("Required argument for `perPage` is missing or invalid");if("number"!=typeof e||e<0)throw new Error("Required argument for `perPage` must be a number >= 0");return this.params.pagination.perPage=e,this},withTotal:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];if("boolean"!=typeof e)throw new Error("Required argument for `withTotal` is missing or invalid");return this.params.pagination.withTotal=e,this}});var q=Object.freeze({__proto__:null,staged:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return this.params.staged=e,this},priceCurrency:function(e){return this.params.priceCurrency=e,this},priceCountry:function(e){return this.params.priceCountry=e,this},priceCustomerGroup:function(e){return this.params.priceCustomerGroup=e,this},priceChannel:function(e){return this.params.priceChannel=e,this}});var R=Object.freeze({__proto__:null,searchKeywords:function(e,r){if(!e||!r)throw new Error("Required arguments for `searchKeywords` are missing");return this.params.searchKeywords.push({lang:r,value:encodeURIComponent(e)}),this}});var _=Object.freeze({__proto__:null,text:function(e,r){if(!e||!r)throw new Error("Required arguments for `text` are missing");return this.params.search.text={lang:r,value:encodeURIComponent(e)},this},fuzzy:function(){return this.params.search.fuzzy=!0,this},fuzzyLevel:function(e){if(null==e)throw new Error("Required argument for `fuzzyLevel` is missing");return this.params.search.fuzzyLevel=e,this},markMatchingVariants:function(){return this.params.search.markMatchingVariants=!0,this},facet:function(e){if(!e)throw new Error("Required argument for `facet` is missing");var r=encodeURIComponent(e);return this.params.search.facet.push(r),this},filter:function(e){if(!e)throw new Error("Required argument for `filter` is missing");var r=encodeURIComponent(e);return this.params.search.filter.push(r),this},filterByQuery:function(e){if(!e)throw new Error("Required argument for `filterByQuery` is missing");var r=encodeURIComponent(e);return this.params.search.filterByQuery.push(r),this},filterByFacets:function(e){if(!e)throw new Error("Required argument for `filterByFacets` is missing");var r=encodeURIComponent(e);return this.params.search.filterByFacets.push(r),this}}),k=["type","endpoint","features"];function x(r,e){var a=1<arguments.length&&void 0!==e?e:"";if(!r)throw new Error("Cannot create a service without its definition.");if(k.forEach(function(e){if(!r[e])throw new Error("Definition is missing required parameter ".concat(e,"."))}),!Array.isArray(r.features)||!r.features.length)throw new Error("Definition requires `features` to be a non empty array.");if(!a)throw new Error("No project defined. Please enter a project key");var t=r.type,u=r.endpoint,n=r.features;return function(r,e){var t=1<arguments.length&&void 0!==e&&e,n={};return Object.keys(r).forEach(function(e){Object.defineProperty(n,e,{value:r[e],enumerable:!!t||"function"==typeof r[e]})}),n}(s(s({type:t,features:n,params:l(),withVersion:b,withFullDataErasure:v,applyOrderEditTo:E},n.reduce(function(e,r){return r===c?s(s(s({},e),C),z):r===p?s(s({},e),O):r===f?s(s({},e),j):r===h?s(s({},e),I):r===d?s(s(s(s({},e),_),z),{},{params:g()}):r===m?s(s(s(s({},e),_),z),R):r===y?s(s({},e),q):e},{})),{},{build:function(e){var r,t=0<arguments.length&&void 0!==e?e:{withProjectKey:!0,applyOrderEdit:!1},n=t.withProjectKey,o=t.applyOrderEdit,s=function(e){if(!e)throw new Error("Missing options object to build query string.");var r,t,n,o,s,i,a,u,c,p,h,f,d,y,m,l,g,w,b=e.query,v=e.pagination,E=e.search,C=e.expand,O=e.staged,j=e.priceCurrency,I=e.priceCountry,z=e.priceCustomerGroup,q=e.priceChannel,R=e.searchKeywords,_=e.version,k=e.customerId,x=e.cartId,P=e.location,K=e.dataErasure,T=e.applyOrderEditTo,B=[];return k&&B.push("customerId=".concat(k)),x&&B.push("cartId=".concat(x)),"boolean"==typeof O&&B.push("staged=".concat(O.toString())),j&&B.push("priceCurrency=".concat(j)),I&&B.push("priceCountry=".concat(I)),z&&B.push("priceCustomerGroup=".concat(z)),q&&B.push("priceChannel=".concat(q)),C&&C.length&&(B=B.concat(C.map(function(e){return"expand=".concat(e)}))),b&&(r=b.operator,(t=b.where.join(encodeURIComponent(" ".concat(r," "))))&&B.push("where=".concat(t))),P&&(n=P.country,o=P.currency,s=P.state,n&&B.push("country=".concat(n)),o&&B.push("currency=".concat(o)),s&&B.push("state=".concat(s))),v&&(i=v.page,a=v.perPage,u=v.sort,c=v.withTotal,"number"==typeof a&&B.push("limit=".concat(a)),i&&(p=(a||20)*(i-1),B.push("offset=".concat(p))),u&&u.length&&(B=B.concat(u.map(function(e){return"sort=".concat(e)}))),"boolean"==typeof c&&B.push("withTotal=".concat(String(c)))),E&&(h=E.text,f=E.fuzzy,d=E.fuzzyLevel,y=E.markMatchingVariants,m=E.facet,l=E.filter,g=E.filterByQuery,w=E.filterByFacets,h&&B.push("text.".concat(h.lang,"=").concat(h.value)),f&&B.push("fuzzy=true"),d&&B.push("fuzzyLevel=".concat(d)),B.push("markMatchingVariants=".concat(y.toString())),m.forEach(function(e){return B.push("facet=".concat(e))}),l.forEach(function(e){return B.push("filter=".concat(e))}),g.forEach(function(e){return B.push("filter.query=".concat(e))}),w.forEach(function(e){return B.push("filter.facets=".concat(e))})),R&&R.forEach(function(e){return B.push("searchKeywords.".concat(e.lang,"=").concat(e.value))}),_&&B.push("version=".concat(_)),K&&B.push(K),T&&B.push("/".concat(T,"/apply")),B.join("&")}(this.params),i=(n?"/".concat(a):"")+u+((r=this.params).id?"/".concat(r.id):r.orderNumber?"/order-number=".concat(r.orderNumber):r.key&&!r.container?"/key=".concat(r.key):r.key&&r.container?"/".concat(r.container,"/").concat(r.key):"")+(s&&!o?"?".concat(s):s);return function(){this.params.expand=l().expand,this.params.key=null,this.features.includes(p)&&(this.params.id=l().id),this.features.includes(c)&&(this.params.pagination=l().pagination,this.params.query=l().query),this.features.includes(d)&&(this.params.pagination=g().pagination,this.params.search=g().search),this.features.includes(f)&&(this.params.location=l().location),this.features.includes(m)&&(this.params.searchKeywords=[])}.call(this),i},parse:function(e){return function(e){var r=this,t=["expand","id","key","customerId","cartId","sort","page","perPage","staged","priceCurrency","priceCountry","priceCustomerGroup","priceChannel","text","fuzzy","fuzzyLevel","markMatchingVariants","facet","filter","filterByQuery","filterByFacets","searchKeywords","where","whereOperator","version","country","currency","state","dataErasure","withTotal","applyOrderEditTo","container","orderNumber"];Object.keys(e).forEach(function(e){if(!t.includes(e))throw new Error('Unknown key "'.concat(e,'"'))}),e.expand&&e.expand.forEach(function(e){r.expand(e)}),w(e,"id")&&this.byId(e.id),w(e,"key")&&!w(e,"container")&&this.byKey(e.key),w(e,"customerId")&&this.byCustomerId(e.customerId),w(e,"cartId")&&this.byCartId(e.cartId),w(e,"country")&&this.byCountry(e.country),w(e,"currency")&&this.byCurrency(e.currency),w(e,"state")&&this.byState(e.state),e.sort&&e.sort.forEach(function(e){r.sort(e.by,"asc"===e.direction)}),w(e,"page")&&this.page(e.page),w(e,"perPage")&&this.perPage(e.perPage),w(e,"staged")&&this.staged(e.staged),w(e,"priceCurrency")&&this.priceCurrency(e.priceCurrency),w(e,"priceCountry")&&this.priceCountry(e.priceCountry),w(e,"priceCustomerGroup")&&this.priceCustomerGroup(e.priceCustomerGroup),w(e,"priceChannel")&&this.priceChannel(e.priceChannel),w(e,"orderNumber")&&this.byOrderNumber(e.orderNumber),e.text&&this.text(e.text.value,e.text.language),e.fuzzy&&this.fuzzy(),w(e,"fuzzyLevel")&&this.fuzzyLevel(e.fuzzyLevel),e.markMatchingVariants&&this.markMatchingVariants(),e.facet&&e.facet.forEach(function(e){r.facet(e)}),e.filter&&e.filter.forEach(function(e){r.filter(e)}),e.filterByQuery&&e.filterByQuery.forEach(function(e){r.filterByQuery(e)}),e.filterByFacets&&e.filterByFacets.forEach(function(e){r.filterByFacets(e)}),e.searchKeywords&&e.searchKeywords.forEach(function(e){r.searchKeywords(e.value,e.language)}),e.where&&e.where.forEach(function(e){r.where(e)}),w(e,"whereOperator")&&this.whereOperator(e.whereOperator),w(e,"version")&&this.withVersion(e.version),w(e,"dataErasure")&&this.withFullDataErasure(),w(e,"withTotal")&&this.withTotal(e.withTotal),w(e,"applyOrderEditTo")&&this.applyOrderEditTo(e.applyOrderEditTo),w(e,"container")&&w(e,"key")&&this.byContainerAndKey(e.container,e.key)}.call(this,e),this}}))}e.createRequestBuilder=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=s(s({},u),t.customServices);return Object.keys(n).reduce(function(e,r){return s(s({},e),{},o({},r,x(n[r],t.projectKey)))},{})},e.features=a,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).CommercetoolsApiRequestBuilder={})}(this,function(e){"use strict";function n(r,e){var t,n=Object.keys(r);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(r),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.push.apply(n,t)),n}function s(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?n(Object(t),!0).forEach(function(e){o(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var r="create",t="update",i="delete",a="query",u="queryOne",c="queryExpand",p="queryLocation",h="search",f="projection",d="suggest",y=Object.freeze({__proto__:null,create:r,update:t,del:i,query:a,queryOne:u,queryExpand:c,queryLocation:p,search:h,projection:f,suggest:d}),m={login:{type:"login",endpoint:"/login",features:[r]},cartDiscounts:{type:"cart-discounts",endpoint:"/cart-discounts",features:[r,t,i,a,u,c]},carts:{type:"carts",endpoint:"/carts",features:[r,t,i,a,u,c]},categories:{type:"categories",endpoint:"/categories",features:[r,t,i,a,u,c]},channels:{type:"channels",endpoint:"/channels",features:[r,t,i,a,u,c]},customerGroups:{type:"customer-groups",endpoint:"/customer-groups",features:[r,t,i,a,u,c]},customers:{type:"customers",endpoint:"/customers",features:[r,t,i,a,u,c]},customersPassword:{type:"customers-password",endpoint:"/customers/password",features:[r]},customersPasswordToken:{type:"customers-password-token",endpoint:"/customers/password-token",features:[r,u]},customersPasswordReset:{type:"customers-password-reset",endpoint:"/customers/password/reset",features:[r]},customersEmailVerificationToken:{type:"customers-email-verification-token",endpoint:"/customers/email-token",features:[r,u]},customersEmailVerification:{type:"customers-email-verification",endpoint:"/customers/email/confirm",features:[r]},customObjects:{type:"custom-objects",endpoint:"/custom-objects",features:[r,t,i,a,u,c]},discountCodes:{type:"discount-codes",endpoint:"/discount-codes",features:[r,t,i,a,u,c]},extensions:{type:"extensions",endpoint:"/extensions",features:[r,t,i,a,u,c]},inventory:{type:"inventory",endpoint:"/inventory",features:[r,t,i,a,u,c]},messages:{type:"messages",endpoint:"/messages",features:[a,u,c]},myActiveCart:{type:"my-carts",endpoint:"/me/active-cart",features:[u]},myCarts:{type:"my-carts",endpoint:"/me/carts",features:[r,t,i,a,u,c]},myOrders:{type:"my-orders",endpoint:"/me/orders",features:[r,t,i,a,u,c]},orders:{type:"orders",endpoint:"/orders",features:[r,t,i,a,u,c]},orderEdits:{type:"orders-edits",endpoint:"/orders/edits",features:[r,t,i,a,u,c]},orderImport:{type:"orderImport",endpoint:"/orders/import",features:[r,a]},payments:{type:"payments",endpoint:"/payments",features:[r,t,i,a,u,c]},productDiscounts:{type:"product-discounts",endpoint:"/product-discounts",features:[r,t,i,a,u,c]},productProjections:{type:"product-projections",endpoint:"/product-projections",features:[a,u,c,f]},productProjectionsSearch:{type:"product-projections-search",endpoint:"/product-projections/search",features:[h,u,c,f]},productProjectionsSuggest:{type:"product-projections-suggest",endpoint:"/product-projections/suggest",features:[h,d,u,f]},products:{type:"products",endpoint:"/products",features:[r,t,i,a,u,c]},productTypes:{type:"product-types",endpoint:"/product-types",features:[r,t,i,a,u,c]},project:{type:"project",endpoint:"/",features:[t,a]},reviews:{type:"reviews",endpoint:"/reviews",features:[r,t,i,a,u,c]},shippingMethods:{type:"shipping-methods",endpoint:"/shipping-methods",features:[r,t,i,a,u,c,p]},shoppingLists:{type:"shopping-lists",endpoint:"/shopping-lists",features:[r,t,i,a,u,c]},states:{type:"states",endpoint:"/states",features:[r,t,i,a,u,c]},stores:{type:"stores",endpoint:"/stores",features:[r,t,i,a,u,c]},subscriptions:{type:"subscriptions",endpoint:"/subscriptions",features:[r,t,i,a,u,c]},taxCategories:{type:"tax-categories",endpoint:"/tax-categories",features:[r,t,i,a,u,c]},types:{type:"types",endpoint:"/types",features:[r,t,i,a,u,c]},zones:{type:"zones",endpoint:"/zones",features:[r,t,i,a,u,c]}};function l(){return{id:null,expand:[],pagination:{page:null,perPage:null,sort:[],withTotal:null},location:{currency:"",country:"",state:""},query:{operator:"and",where:[]},searchKeywords:[]}}function g(){return{expand:[],searchKeywords:[],pagination:{page:null,perPage:null,sort:[],withTotal:null},search:{facet:[],filter:[],filterByQuery:[],filterByFacets:[],fuzzy:!1,fuzzyLevel:0,markMatchingVariants:!1,text:null}}}function w(e,r){return Object.prototype.hasOwnProperty.call(e,r)}function b(e){if("number"!=typeof e)throw new Error("A resource version is missing or invalid");return this.params.version=e,this}function E(){return this.params.dataErasure="dataErasure=true",this}function v(e){if("string"!=typeof e)throw new Error("A resource orderEditId is missing or invalid");return this.params.applyOrderEditTo=e,this}var C=Object.freeze({__proto__:null,where:function(e){if(e)return e=encodeURIComponent(e),this.params.query.where.push(e),this;throw new Error("Required argument for `where` is missing")},whereOperator:function(e){if(!e)throw new Error("Required argument for `whereOperator` is missing");if("and"!==e&&"or"!==e)throw new Error("Required argument for `whereOperator` is invalid, allowed values are (`and`, `or`)");return this.params.query.operator=e,this}});var O=Object.freeze({__proto__:null,byId:function(e){if(!e)throw new Error("Required argument for `byId` is missing");if(this.params.key)throw new Error("A key for this resource has already been set. You cannot use both `byKey` and `byId`.");if(this.params.customerId)throw new Error("A customerId for this resource has already been set. You cannot use both `byId` and `byCustomerId`.");if(this.params.cartId)throw new Error("A cartId for this resource has already been set. You cannot use both `byId` and `byCartId`.");return this.params.id=e,this},byKey:function(e){if(!e)throw new Error("Required argument for `byKey` is missing");if(this.params.id)throw new Error("An ID for this resource has already been set. You cannot use both `byId` and `byKey`.");return this.params.key=e,this},byCustomerId:function(e){if(!e)throw new Error("Required argument for `byCustomerId` is missing");if(this.params.id)throw new Error("An ID for this resource has already been set. You cannot use both `byId` and `byCustomerId`.");return this.params.customerId=e,this},byOrderNumber:function(e){if("string"!=typeof e)throw new Error("Required argument for `byOrderNumber` is missing or invalid");return this.params.orderNumber=e,this},byCartId:function(e){if(!e)throw new Error("Required argument for `byCartId` is missing");if(this.params.id)throw new Error("An ID for this resource has already been set. You cannot use both `byId` and `byCartId`.");return this.params.cartId=e,this},byContainerAndKey:function(e,r){if("string"!=typeof e||"string"!=typeof r)throw new Error("Required `container` or `key` argument for `byContainerAndKey` needs to be a string");return this.params.container=e,this.params.key=r,this}});var j=Object.freeze({__proto__:null,byCountry:function(e){if(e)return this.params.location.country=e,this;throw new Error("Required argument for `byCountry` is missing")},byCurrency:function(e){if(!e)throw new Error("Required argument for `byCurrency` is missing");if(this.params.location.country)return this.params.location.currency=e,this;throw new Error("A `country` for this resource has not been set. You must set the country in order to use the `byCurrency` method.")},byState:function(e){if(!e)throw new Error("Required argument for `byState` is missing");if(this.params.location.country)return this.params.location.state=e,this;throw new Error("A `country` for this resource has not been set. You must set the country in order to use the `byState` method.")}});var I=Object.freeze({__proto__:null,expand:function(e){if(e)return e=encodeURIComponent(e),this.params.expand.push(e),this;throw new Error("Required argument for `expand` is missing")}});var z=Object.freeze({__proto__:null,sort:function(e){var r=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(e)return r=r?"asc":"desc",e=encodeURIComponent("".concat(e," ").concat(r)),this.params.pagination.sort.push(e),this;throw new Error("Required argument for `sort` is missing")},page:function(e){if("number"!=typeof e&&!e)throw new Error("Required argument for `page` is missing or invalid");if("number"!=typeof e||e<1)throw new Error("Required argument for `page` must be a number >= 1");return this.params.pagination.page=e,this},perPage:function(e){if("number"!=typeof e&&!e)throw new Error("Required argument for `perPage` is missing or invalid");if("number"!=typeof e||e<0)throw new Error("Required argument for `perPage` must be a number >= 0");return this.params.pagination.perPage=e,this},withTotal:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];if("boolean"!=typeof e)throw new Error("Required argument for `withTotal` is missing or invalid");return this.params.pagination.withTotal=e,this}});var q=Object.freeze({__proto__:null,staged:function(){return this.params.staged=0<arguments.length&&void 0!==arguments[0]&&arguments[0],this},priceCurrency:function(e){return this.params.priceCurrency=e,this},priceCountry:function(e){return this.params.priceCountry=e,this},priceCustomerGroup:function(e){return this.params.priceCustomerGroup=e,this},priceChannel:function(e){return this.params.priceChannel=e,this}});var R=Object.freeze({__proto__:null,searchKeywords:function(e,r){if(e&&r)return this.params.searchKeywords.push({lang:r,value:encodeURIComponent(e)}),this;throw new Error("Required arguments for `searchKeywords` are missing")}});var _=Object.freeze({__proto__:null,text:function(e,r){if(e&&r)return this.params.search.text={lang:r,value:encodeURIComponent(e)},this;throw new Error("Required arguments for `text` are missing")},fuzzy:function(){return this.params.search.fuzzy=!0,this},fuzzyLevel:function(e){if(null==e)throw new Error("Required argument for `fuzzyLevel` is missing");return this.params.search.fuzzyLevel=e,this},markMatchingVariants:function(){return this.params.search.markMatchingVariants=!0,this},facet:function(e){if(e)return e=encodeURIComponent(e),this.params.search.facet.push(e),this;throw new Error("Required argument for `facet` is missing")},filter:function(e){if(e)return e=encodeURIComponent(e),this.params.search.filter.push(e),this;throw new Error("Required argument for `filter` is missing")},filterByQuery:function(e){if(e)return e=encodeURIComponent(e),this.params.search.filterByQuery.push(e),this;throw new Error("Required argument for `filterByQuery` is missing")},filterByFacets:function(e){if(e)return e=encodeURIComponent(e),this.params.search.filterByFacets.push(e),this;throw new Error("Required argument for `filterByFacets` is missing")}}),k=["type","endpoint","features"];function x(r,e){var n=1<arguments.length&&void 0!==e?e:"";if(!r)throw new Error("Cannot create a service without its definition.");if(k.forEach(function(e){if(!r[e])throw new Error("Definition is missing required parameter ".concat(e,"."))}),!Array.isArray(r.features)||!r.features.length)throw new Error("Definition requires `features` to be a non empty array.");if(!n)throw new Error("No project defined. Please enter a project key");var e=r.type,o=r.endpoint,t=r.features;return function(r,e){var t=1<arguments.length&&void 0!==e&&e,n={};return Object.keys(r).forEach(function(e){Object.defineProperty(n,e,{value:r[e],enumerable:!!t||"function"==typeof r[e]})}),n}(s(s({type:e,features:t,params:l(),withVersion:b,withFullDataErasure:E,applyOrderEditTo:v},t.reduce(function(e,r){return r===a?s(s(s({},e),C),z):r===u?s(s({},e),O):r===p?s(s({},e),j):r===c?s(s({},e),I):r===h?s(s(s(s({},e),_),z),{},{params:g()}):r===d?s(s(s(s({},e),_),z),R):r===f?s(s({},e),q):e},{})),{},{build:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{withProjectKey:!0,applyOrderEdit:!1},r=e.withProjectKey,e=e.applyOrderEdit,t=function(e){if(!e)throw new Error("Missing options object to build query string.");var r=e.query,t=e.pagination,n=e.search,o=e.expand,s=e.staged,i=e.priceCurrency,a=e.priceCountry,u=e.priceCustomerGroup,c=e.priceChannel,p=e.searchKeywords,h=e.version,f=e.customerId,d=e.cartId,y=e.location,m=e.dataErasure,e=e.applyOrderEditTo,l=[];return f&&l.push("customerId=".concat(f)),d&&l.push("cartId=".concat(d)),"boolean"==typeof s&&l.push("staged=".concat(s.toString())),i&&l.push("priceCurrency=".concat(i)),a&&l.push("priceCountry=".concat(a)),u&&l.push("priceCustomerGroup=".concat(u)),c&&l.push("priceChannel=".concat(c)),o&&o.length&&(l=l.concat(o.map(function(e){return"expand=".concat(e)}))),r&&(f=r.operator,(d=r.where.join(encodeURIComponent(" ".concat(f," "))))&&l.push("where=".concat(d))),y&&(s=y.country,i=y.currency,a=y.state,s&&l.push("country=".concat(s)),i&&l.push("currency=".concat(i)),a&&l.push("state=".concat(a))),t&&(u=t.page,c=t.perPage,o=t.sort,r=t.withTotal,"number"==typeof c&&l.push("limit=".concat(c)),u&&l.push("offset=".concat((c||20)*(u-1))),o&&o.length&&(l=l.concat(o.map(function(e){return"sort=".concat(e)}))),"boolean"==typeof r&&l.push("withTotal=".concat(String(r)))),n&&(f=n.text,d=n.fuzzy,y=n.fuzzyLevel,s=n.markMatchingVariants,i=n.facet,a=n.filter,t=n.filterByQuery,c=n.filterByFacets,f&&l.push("text.".concat(f.lang,"=").concat(f.value)),d&&l.push("fuzzy=true"),y&&l.push("fuzzyLevel=".concat(y)),l.push("markMatchingVariants=".concat(s.toString())),i.forEach(function(e){return l.push("facet=".concat(e))}),a.forEach(function(e){return l.push("filter=".concat(e))}),t.forEach(function(e){return l.push("filter.query=".concat(e))}),c.forEach(function(e){return l.push("filter.facets=".concat(e))})),p&&p.forEach(function(e){return l.push("searchKeywords.".concat(e.lang,"=").concat(e.value))}),h&&l.push("version=".concat(h)),m&&l.push(m),e&&l.push("/".concat(e,"/apply")),l.join("&")}(this.params),r=(r?"/".concat(n):"")+o+((r=this.params).id?"/".concat(r.id):r.orderNumber?"/order-number=".concat(r.orderNumber):r.key&&!r.container?"/key=".concat(r.key):r.key&&r.container?"/".concat(r.container,"/").concat(r.key):"")+(t&&!e?"?".concat(t):t);return function(){this.params.expand=l().expand,this.params.key=null,this.features.includes(u)&&(this.params.id=l().id),this.features.includes(a)&&(this.params.pagination=l().pagination,this.params.query=l().query),this.features.includes(h)&&(this.params.pagination=g().pagination,this.params.search=g().search),this.features.includes(p)&&(this.params.location=l().location),this.features.includes(d)&&(this.params.searchKeywords=[])}.call(this),r},parse:function(e){return function(e){var r=this,t=["expand","id","key","customerId","cartId","sort","page","perPage","staged","priceCurrency","priceCountry","priceCustomerGroup","priceChannel","text","fuzzy","fuzzyLevel","markMatchingVariants","facet","filter","filterByQuery","filterByFacets","searchKeywords","where","whereOperator","version","country","currency","state","dataErasure","withTotal","applyOrderEditTo","container","orderNumber"];Object.keys(e).forEach(function(e){if(!t.includes(e))throw new Error('Unknown key "'.concat(e,'"'))}),e.expand&&e.expand.forEach(function(e){r.expand(e)}),w(e,"id")&&this.byId(e.id),w(e,"key")&&!w(e,"container")&&this.byKey(e.key),w(e,"customerId")&&this.byCustomerId(e.customerId),w(e,"cartId")&&this.byCartId(e.cartId),w(e,"country")&&this.byCountry(e.country),w(e,"currency")&&this.byCurrency(e.currency),w(e,"state")&&this.byState(e.state),e.sort&&e.sort.forEach(function(e){r.sort(e.by,"asc"===e.direction)}),w(e,"page")&&this.page(e.page),w(e,"perPage")&&this.perPage(e.perPage),w(e,"staged")&&this.staged(e.staged),w(e,"priceCurrency")&&this.priceCurrency(e.priceCurrency),w(e,"priceCountry")&&this.priceCountry(e.priceCountry),w(e,"priceCustomerGroup")&&this.priceCustomerGroup(e.priceCustomerGroup),w(e,"priceChannel")&&this.priceChannel(e.priceChannel),w(e,"orderNumber")&&this.byOrderNumber(e.orderNumber),e.text&&this.text(e.text.value,e.text.language),e.fuzzy&&this.fuzzy(),w(e,"fuzzyLevel")&&this.fuzzyLevel(e.fuzzyLevel),e.markMatchingVariants&&this.markMatchingVariants(),e.facet&&e.facet.forEach(function(e){r.facet(e)}),e.filter&&e.filter.forEach(function(e){r.filter(e)}),e.filterByQuery&&e.filterByQuery.forEach(function(e){r.filterByQuery(e)}),e.filterByFacets&&e.filterByFacets.forEach(function(e){r.filterByFacets(e)}),e.searchKeywords&&e.searchKeywords.forEach(function(e){r.searchKeywords(e.value,e.language)}),e.where&&e.where.forEach(function(e){r.where(e)}),w(e,"whereOperator")&&this.whereOperator(e.whereOperator),w(e,"version")&&this.withVersion(e.version),w(e,"dataErasure")&&this.withFullDataErasure(),w(e,"withTotal")&&this.withTotal(e.withTotal),w(e,"applyOrderEditTo")&&this.applyOrderEditTo(e.applyOrderEditTo),w(e,"container")&&w(e,"key")&&this.byContainerAndKey(e.container,e.key)}.call(this,e),this}}))}e.createRequestBuilder=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=s(s({},m),t.customServices);return Object.keys(n).reduce(function(e,r){return s(s({},e),{},o({},r,x(n[r],t.projectKey)))},{})},e.features=y,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -6,4 +6,7 @@ { | ||
}, | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"name": "@commercetools/api-request-builder", | ||
"version": "5.6.3", | ||
"version": "6.0.0", | ||
"description": "Helper functions to construct API requests URI for the commercetools platform in a declarative way.", | ||
@@ -34,4 +37,3 @@ "keywords": [ | ||
"build:bundles": "cross-env NODE_ENV=production rollup -c ../../rollup.config.js -n CommercetoolsApiRequestBuilder -i ./src/index.js" | ||
}, | ||
"gitHead": "a4aba36a508ab1eaee2e0388a799aa669e5da1b6" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146965
3471