@commercelayer/sdk 7.0.0-beta.17 → 7.0.0-beta.19

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.
Files changed (297) hide show
  1. package/lib/api.cjs +0 -1
  2. package/lib/api.js +0 -1
  3. package/lib/client.cjs +45 -54
  4. package/lib/client.js +45 -54
  5. package/lib/commercelayer.cjs +11 -13
  6. package/lib/commercelayer.js +11 -13
  7. package/lib/common.cjs +0 -1
  8. package/lib/common.js +0 -1
  9. package/lib/config.cjs +0 -2
  10. package/lib/config.js +0 -2
  11. package/lib/debug.cjs +0 -2
  12. package/lib/debug.js +0 -2
  13. package/lib/enum.cjs +0 -2
  14. package/lib/enum.js +0 -2
  15. package/lib/error.cjs +19 -22
  16. package/lib/error.js +19 -22
  17. package/lib/fetch.cjs +17 -24
  18. package/lib/fetch.js +17 -24
  19. package/lib/index.cjs +0 -1
  20. package/lib/index.d.cts +1 -1
  21. package/lib/index.d.ts +1 -1
  22. package/lib/index.js +0 -1
  23. package/lib/jsonapi.cjs +0 -1
  24. package/lib/jsonapi.js +0 -1
  25. package/lib/query.cjs +0 -1
  26. package/lib/query.js +0 -1
  27. package/lib/resource.cjs +21 -26
  28. package/lib/resource.js +21 -26
  29. package/lib/resources/addresses.cjs +10 -12
  30. package/lib/resources/addresses.js +10 -12
  31. package/lib/resources/adjustments.cjs +8 -10
  32. package/lib/resources/adjustments.js +8 -10
  33. package/lib/resources/adyen_gateways.cjs +8 -10
  34. package/lib/resources/adyen_gateways.js +8 -10
  35. package/lib/resources/adyen_payments.cjs +10 -12
  36. package/lib/resources/adyen_payments.js +10 -12
  37. package/lib/resources/applications.cjs +5 -7
  38. package/lib/resources/applications.js +5 -7
  39. package/lib/resources/attachments.cjs +8 -10
  40. package/lib/resources/attachments.js +8 -10
  41. package/lib/resources/authorizations.cjs +11 -13
  42. package/lib/resources/authorizations.js +11 -13
  43. package/lib/resources/avalara_accounts.cjs +8 -10
  44. package/lib/resources/avalara_accounts.js +8 -10
  45. package/lib/resources/axerve_gateways.cjs +8 -10
  46. package/lib/resources/axerve_gateways.js +8 -10
  47. package/lib/resources/axerve_payments.cjs +9 -11
  48. package/lib/resources/axerve_payments.js +9 -11
  49. package/lib/resources/bing_geocoders.cjs +8 -10
  50. package/lib/resources/bing_geocoders.js +8 -10
  51. package/lib/resources/braintree_gateways.cjs +8 -10
  52. package/lib/resources/braintree_gateways.js +8 -10
  53. package/lib/resources/braintree_payments.cjs +8 -10
  54. package/lib/resources/braintree_payments.js +8 -10
  55. package/lib/resources/bundles.cjs +12 -14
  56. package/lib/resources/bundles.js +12 -14
  57. package/lib/resources/buy_x_pay_y_promotions.cjs +12 -14
  58. package/lib/resources/buy_x_pay_y_promotions.js +12 -14
  59. package/lib/resources/captures.cjs +10 -12
  60. package/lib/resources/captures.js +10 -12
  61. package/lib/resources/carrier_accounts.cjs +8 -10
  62. package/lib/resources/carrier_accounts.js +8 -10
  63. package/lib/resources/checkout_com_gateways.cjs +8 -10
  64. package/lib/resources/checkout_com_gateways.js +8 -10
  65. package/lib/resources/checkout_com_payments.cjs +10 -12
  66. package/lib/resources/checkout_com_payments.js +10 -12
  67. package/lib/resources/cleanups.cjs +9 -11
  68. package/lib/resources/cleanups.js +9 -11
  69. package/lib/resources/coupon_codes_promotion_rules.cjs +8 -10
  70. package/lib/resources/coupon_codes_promotion_rules.js +8 -10
  71. package/lib/resources/coupon_recipients.cjs +8 -10
  72. package/lib/resources/coupon_recipients.js +8 -10
  73. package/lib/resources/coupons.cjs +10 -12
  74. package/lib/resources/coupons.js +10 -12
  75. package/lib/resources/custom_promotion_rules.cjs +8 -10
  76. package/lib/resources/custom_promotion_rules.js +8 -10
  77. package/lib/resources/customer_addresses.cjs +8 -10
  78. package/lib/resources/customer_addresses.js +8 -10
  79. package/lib/resources/customer_groups.cjs +8 -10
  80. package/lib/resources/customer_groups.js +8 -10
  81. package/lib/resources/customer_password_resets.cjs +9 -11
  82. package/lib/resources/customer_password_resets.js +9 -11
  83. package/lib/resources/customer_payment_sources.cjs +8 -10
  84. package/lib/resources/customer_payment_sources.js +8 -10
  85. package/lib/resources/customer_subscriptions.cjs +8 -10
  86. package/lib/resources/customer_subscriptions.js +8 -10
  87. package/lib/resources/customers.cjs +10 -12
  88. package/lib/resources/customers.js +10 -12
  89. package/lib/resources/delivery_lead_times.cjs +8 -10
  90. package/lib/resources/delivery_lead_times.js +8 -10
  91. package/lib/resources/discount_engine_items.cjs +5 -7
  92. package/lib/resources/discount_engine_items.js +5 -7
  93. package/lib/resources/discount_engines.cjs +5 -7
  94. package/lib/resources/discount_engines.js +5 -7
  95. package/lib/resources/easypost_pickups.cjs +9 -11
  96. package/lib/resources/easypost_pickups.js +9 -11
  97. package/lib/resources/event_callbacks.cjs +5 -7
  98. package/lib/resources/event_callbacks.js +5 -7
  99. package/lib/resources/events.cjs +7 -9
  100. package/lib/resources/events.js +7 -9
  101. package/lib/resources/exports.cjs +9 -11
  102. package/lib/resources/exports.js +9 -11
  103. package/lib/resources/external_gateways.cjs +9 -11
  104. package/lib/resources/external_gateways.js +9 -11
  105. package/lib/resources/external_payments.cjs +8 -10
  106. package/lib/resources/external_payments.js +8 -10
  107. package/lib/resources/external_promotions.cjs +13 -15
  108. package/lib/resources/external_promotions.js +13 -15
  109. package/lib/resources/external_tax_calculators.cjs +9 -11
  110. package/lib/resources/external_tax_calculators.js +9 -11
  111. package/lib/resources/fixed_amount_promotions.cjs +12 -14
  112. package/lib/resources/fixed_amount_promotions.js +12 -14
  113. package/lib/resources/fixed_price_promotions.cjs +12 -14
  114. package/lib/resources/fixed_price_promotions.js +12 -14
  115. package/lib/resources/flex_promotions.cjs +12 -14
  116. package/lib/resources/flex_promotions.js +12 -14
  117. package/lib/resources/free_gift_promotions.cjs +12 -14
  118. package/lib/resources/free_gift_promotions.js +12 -14
  119. package/lib/resources/free_shipping_promotions.cjs +12 -14
  120. package/lib/resources/free_shipping_promotions.js +12 -14
  121. package/lib/resources/geocoders.cjs +5 -7
  122. package/lib/resources/geocoders.js +5 -7
  123. package/lib/resources/gift_card_recipients.cjs +8 -10
  124. package/lib/resources/gift_card_recipients.js +8 -10
  125. package/lib/resources/gift_cards.cjs +14 -16
  126. package/lib/resources/gift_cards.js +14 -16
  127. package/lib/resources/google_geocoders.cjs +8 -10
  128. package/lib/resources/google_geocoders.js +8 -10
  129. package/lib/resources/imports.cjs +9 -11
  130. package/lib/resources/imports.js +9 -11
  131. package/lib/resources/in_stock_subscriptions.cjs +10 -12
  132. package/lib/resources/in_stock_subscriptions.js +10 -12
  133. package/lib/resources/inventory_models.cjs +8 -10
  134. package/lib/resources/inventory_models.js +8 -10
  135. package/lib/resources/inventory_return_locations.cjs +8 -10
  136. package/lib/resources/inventory_return_locations.js +8 -10
  137. package/lib/resources/inventory_stock_locations.cjs +8 -10
  138. package/lib/resources/inventory_stock_locations.js +8 -10
  139. package/lib/resources/klarna_gateways.cjs +8 -10
  140. package/lib/resources/klarna_gateways.js +8 -10
  141. package/lib/resources/klarna_payments.cjs +9 -11
  142. package/lib/resources/klarna_payments.js +9 -11
  143. package/lib/resources/line_item_options.cjs +10 -12
  144. package/lib/resources/line_item_options.js +10 -12
  145. package/lib/resources/line_items.cjs +13 -15
  146. package/lib/resources/line_items.js +13 -15
  147. package/lib/resources/links.cjs +10 -12
  148. package/lib/resources/links.js +10 -12
  149. package/lib/resources/manual_gateways.cjs +8 -10
  150. package/lib/resources/manual_gateways.js +8 -10
  151. package/lib/resources/manual_tax_calculators.cjs +8 -10
  152. package/lib/resources/manual_tax_calculators.js +8 -10
  153. package/lib/resources/markets.cjs +10 -12
  154. package/lib/resources/markets.js +10 -12
  155. package/lib/resources/merchants.cjs +8 -10
  156. package/lib/resources/merchants.js +8 -10
  157. package/lib/resources/notifications.cjs +8 -10
  158. package/lib/resources/notifications.js +8 -10
  159. package/lib/resources/order_amount_promotion_rules.cjs +8 -10
  160. package/lib/resources/order_amount_promotion_rules.js +8 -10
  161. package/lib/resources/order_copies.cjs +8 -10
  162. package/lib/resources/order_copies.js +8 -10
  163. package/lib/resources/order_factories.cjs +5 -7
  164. package/lib/resources/order_factories.js +5 -7
  165. package/lib/resources/order_subscription_items.cjs +8 -10
  166. package/lib/resources/order_subscription_items.js +8 -10
  167. package/lib/resources/order_subscriptions.cjs +14 -16
  168. package/lib/resources/order_subscriptions.js +14 -16
  169. package/lib/resources/orders.cjs +41 -43
  170. package/lib/resources/orders.js +41 -43
  171. package/lib/resources/organizations.cjs +5 -7
  172. package/lib/resources/organizations.js +5 -7
  173. package/lib/resources/packages.cjs +8 -10
  174. package/lib/resources/packages.js +8 -10
  175. package/lib/resources/parcel_line_items.cjs +8 -10
  176. package/lib/resources/parcel_line_items.js +8 -10
  177. package/lib/resources/parcels.cjs +8 -10
  178. package/lib/resources/parcels.js +8 -10
  179. package/lib/resources/payment_gateways.cjs +5 -7
  180. package/lib/resources/payment_gateways.js +5 -7
  181. package/lib/resources/payment_methods.cjs +10 -12
  182. package/lib/resources/payment_methods.js +10 -12
  183. package/lib/resources/payment_options.cjs +8 -10
  184. package/lib/resources/payment_options.js +8 -10
  185. package/lib/resources/paypal_gateways.cjs +8 -10
  186. package/lib/resources/paypal_gateways.js +8 -10
  187. package/lib/resources/paypal_payments.cjs +8 -10
  188. package/lib/resources/paypal_payments.js +8 -10
  189. package/lib/resources/percentage_discount_promotions.cjs +12 -14
  190. package/lib/resources/percentage_discount_promotions.js +12 -14
  191. package/lib/resources/pickups.cjs +5 -7
  192. package/lib/resources/pickups.js +5 -7
  193. package/lib/resources/price_frequency_tiers.cjs +8 -10
  194. package/lib/resources/price_frequency_tiers.js +8 -10
  195. package/lib/resources/price_list_schedulers.cjs +10 -12
  196. package/lib/resources/price_list_schedulers.js +10 -12
  197. package/lib/resources/price_lists.cjs +8 -10
  198. package/lib/resources/price_lists.js +8 -10
  199. package/lib/resources/price_tiers.cjs +5 -7
  200. package/lib/resources/price_tiers.js +5 -7
  201. package/lib/resources/price_volume_tiers.cjs +8 -10
  202. package/lib/resources/price_volume_tiers.js +8 -10
  203. package/lib/resources/prices.cjs +8 -10
  204. package/lib/resources/prices.js +8 -10
  205. package/lib/resources/promotion_rules.cjs +5 -7
  206. package/lib/resources/promotion_rules.js +5 -7
  207. package/lib/resources/promotions.cjs +5 -7
  208. package/lib/resources/promotions.js +5 -7
  209. package/lib/resources/recurring_order_copies.cjs +8 -10
  210. package/lib/resources/recurring_order_copies.js +8 -10
  211. package/lib/resources/refunds.cjs +7 -9
  212. package/lib/resources/refunds.js +7 -9
  213. package/lib/resources/reserved_stocks.cjs +5 -7
  214. package/lib/resources/reserved_stocks.js +5 -7
  215. package/lib/resources/resource_errors.cjs +5 -7
  216. package/lib/resources/resource_errors.js +5 -7
  217. package/lib/resources/return_line_items.cjs +9 -11
  218. package/lib/resources/return_line_items.js +9 -11
  219. package/lib/resources/returns.cjs +21 -23
  220. package/lib/resources/returns.js +21 -23
  221. package/lib/resources/satispay_gateways.cjs +8 -10
  222. package/lib/resources/satispay_gateways.js +8 -10
  223. package/lib/resources/satispay_payments.cjs +9 -11
  224. package/lib/resources/satispay_payments.js +9 -11
  225. package/lib/resources/shipments.cjs +23 -25
  226. package/lib/resources/shipments.js +23 -25
  227. package/lib/resources/shipping_categories.cjs +8 -10
  228. package/lib/resources/shipping_categories.js +8 -10
  229. package/lib/resources/shipping_method_tiers.cjs +5 -7
  230. package/lib/resources/shipping_method_tiers.js +5 -7
  231. package/lib/resources/shipping_methods.cjs +11 -13
  232. package/lib/resources/shipping_methods.js +11 -13
  233. package/lib/resources/shipping_weight_tiers.cjs +8 -10
  234. package/lib/resources/shipping_weight_tiers.js +8 -10
  235. package/lib/resources/shipping_zones.cjs +8 -10
  236. package/lib/resources/shipping_zones.js +8 -10
  237. package/lib/resources/sku_list_items.cjs +8 -10
  238. package/lib/resources/sku_list_items.js +8 -10
  239. package/lib/resources/sku_list_promotion_rules.cjs +8 -10
  240. package/lib/resources/sku_list_promotion_rules.js +8 -10
  241. package/lib/resources/sku_lists.cjs +8 -10
  242. package/lib/resources/sku_lists.js +8 -10
  243. package/lib/resources/sku_options.cjs +10 -12
  244. package/lib/resources/sku_options.js +10 -12
  245. package/lib/resources/skus.cjs +10 -12
  246. package/lib/resources/skus.js +10 -12
  247. package/lib/resources/stock_items.cjs +9 -11
  248. package/lib/resources/stock_items.js +9 -11
  249. package/lib/resources/stock_line_items.cjs +11 -13
  250. package/lib/resources/stock_line_items.js +11 -13
  251. package/lib/resources/stock_locations.cjs +8 -10
  252. package/lib/resources/stock_locations.js +8 -10
  253. package/lib/resources/stock_reservations.cjs +9 -11
  254. package/lib/resources/stock_reservations.js +9 -11
  255. package/lib/resources/stock_transfers.cjs +14 -16
  256. package/lib/resources/stock_transfers.js +14 -16
  257. package/lib/resources/stores.cjs +8 -10
  258. package/lib/resources/stores.js +8 -10
  259. package/lib/resources/stripe_gateways.cjs +8 -10
  260. package/lib/resources/stripe_gateways.js +8 -10
  261. package/lib/resources/stripe_payments.cjs +10 -12
  262. package/lib/resources/stripe_payments.js +10 -12
  263. package/lib/resources/stripe_tax_accounts.cjs +8 -10
  264. package/lib/resources/stripe_tax_accounts.js +8 -10
  265. package/lib/resources/subscription_models.cjs +8 -10
  266. package/lib/resources/subscription_models.js +8 -10
  267. package/lib/resources/tags.cjs +8 -10
  268. package/lib/resources/tags.js +8 -10
  269. package/lib/resources/talon_one_accounts.cjs +8 -10
  270. package/lib/resources/talon_one_accounts.js +8 -10
  271. package/lib/resources/tax_calculators.cjs +5 -7
  272. package/lib/resources/tax_calculators.js +5 -7
  273. package/lib/resources/tax_categories.cjs +8 -10
  274. package/lib/resources/tax_categories.js +8 -10
  275. package/lib/resources/tax_rules.cjs +8 -10
  276. package/lib/resources/tax_rules.js +8 -10
  277. package/lib/resources/taxjar_accounts.cjs +8 -10
  278. package/lib/resources/taxjar_accounts.js +8 -10
  279. package/lib/resources/transactions.cjs +5 -7
  280. package/lib/resources/transactions.js +5 -7
  281. package/lib/resources/versions.cjs +5 -7
  282. package/lib/resources/versions.js +5 -7
  283. package/lib/resources/vertex_accounts.cjs +9 -11
  284. package/lib/resources/vertex_accounts.js +9 -11
  285. package/lib/resources/voids.cjs +7 -9
  286. package/lib/resources/voids.js +7 -9
  287. package/lib/resources/webhooks.cjs +11 -13
  288. package/lib/resources/webhooks.js +11 -13
  289. package/lib/resources/wire_transfers.cjs +8 -10
  290. package/lib/resources/wire_transfers.js +8 -10
  291. package/lib/static.cjs +0 -1
  292. package/lib/static.js +0 -1
  293. package/lib/util.cjs +0 -2
  294. package/lib/util.js +0 -2
  295. package/package.json +4 -4
  296. package/lib/chunk-AQ5VUG5P.js +0 -12
  297. package/lib/chunk-JE77HYXB.cjs +0 -17
package/lib/error.js CHANGED
@@ -1,4 +1,3 @@
1
- import { __publicField } from './chunk-AQ5VUG5P.js';
2
1
  import { FetchError } from './fetch';
3
2
 
4
3
  var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
@@ -11,39 +10,37 @@ var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
11
10
  ErrorType2["TOKEN_REFRESH"] = "token-refresh";
12
11
  return ErrorType2;
13
12
  })(ErrorType || {});
14
- const _SdkError = class _SdkError extends Error {
13
+ class SdkError extends Error {
14
+ static NAME = "SdkError";
15
+ static isSdkError(error) {
16
+ return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
17
+ }
18
+ type;
19
+ code;
20
+ source;
15
21
  constructor(error) {
16
22
  super(error.message);
17
- __publicField(this, "type");
18
- __publicField(this, "code");
19
- __publicField(this, "source");
20
- this.name = _SdkError.NAME;
23
+ this.name = SdkError.NAME;
21
24
  this.type = error.type || "client" /* CLIENT */;
22
25
  }
23
- static isSdkError(error) {
24
- return error && [_SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
26
+ }
27
+ class ApiError extends SdkError {
28
+ static NAME = "ApiError";
29
+ static isApiError(error) {
30
+ return SdkError.isSdkError(error) && error.name === ApiError.NAME && error.type === "response" /* RESPONSE */;
25
31
  }
26
- };
27
- __publicField(_SdkError, "NAME", "SdkError");
28
- let SdkError = _SdkError;
29
- const _ApiError = class _ApiError extends SdkError {
32
+ errors = [];
33
+ status;
34
+ statusText;
30
35
  // constructor(error: SdkError)
31
36
  constructor(error) {
32
37
  super({ ...error, type: "response" /* RESPONSE */ });
33
- __publicField(this, "errors", []);
34
- __publicField(this, "status");
35
- __publicField(this, "statusText");
36
- this.name = _ApiError.NAME;
37
- }
38
- static isApiError(error) {
39
- return SdkError.isSdkError(error) && error.name === _ApiError.NAME && error.type === "response" /* RESPONSE */;
38
+ this.name = ApiError.NAME;
40
39
  }
41
40
  first() {
42
41
  return this.errors?.length > 0 ? this.errors[0] : void 0;
43
42
  }
44
- };
45
- __publicField(_ApiError, "NAME", "ApiError");
46
- let ApiError = _ApiError;
43
+ }
47
44
  const isRequestError = (error) => {
48
45
  return error instanceof TypeError && error.message !== "fetch failed";
49
46
  };
package/lib/fetch.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var chunkJE77HYXB_cjs = require('./chunk-JE77HYXB.cjs');
4
3
  var error = require('./error');
5
4
  var Debug = require('./debug');
6
5
 
@@ -8,41 +7,35 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
7
 
9
8
  var Debug__default = /*#__PURE__*/_interopDefault(Debug);
10
9
 
11
- var _errors, _status, _statusText, _request;
12
10
  const debug = Debug__default.default("fetch");
13
- const _FetchError = class _FetchError extends Error {
11
+ class FetchError extends Error {
12
+ static isFetchError = (error) => {
13
+ return error instanceof FetchError;
14
+ };
15
+ #errors;
16
+ #status;
17
+ #statusText;
18
+ #request;
14
19
  constructor(status, statusText, body, request) {
15
20
  super(statusText);
16
- chunkJE77HYXB_cjs.__privateAdd(this, _errors);
17
- chunkJE77HYXB_cjs.__privateAdd(this, _status);
18
- chunkJE77HYXB_cjs.__privateAdd(this, _statusText);
19
- chunkJE77HYXB_cjs.__privateAdd(this, _request);
20
- chunkJE77HYXB_cjs.__privateSet(this, _status, status);
21
- chunkJE77HYXB_cjs.__privateSet(this, _statusText, statusText);
22
- if (body) chunkJE77HYXB_cjs.__privateSet(this, _errors, body.errors);
23
- if (request) chunkJE77HYXB_cjs.__privateSet(this, _request, request);
21
+ this.#status = status;
22
+ this.#statusText = statusText;
23
+ if (body) this.#errors = body.errors;
24
+ if (request) this.#request = request;
24
25
  }
25
26
  get errors() {
26
- return chunkJE77HYXB_cjs.__privateGet(this, _errors);
27
+ return this.#errors;
27
28
  }
28
29
  get status() {
29
- return chunkJE77HYXB_cjs.__privateGet(this, _status);
30
+ return this.#status;
30
31
  }
31
32
  get statusText() {
32
- return chunkJE77HYXB_cjs.__privateGet(this, _statusText);
33
+ return this.#statusText;
33
34
  }
34
35
  get request() {
35
- return chunkJE77HYXB_cjs.__privateGet(this, _request);
36
+ return this.#request;
36
37
  }
37
- };
38
- _errors = new WeakMap();
39
- _status = new WeakMap();
40
- _statusText = new WeakMap();
41
- _request = new WeakMap();
42
- chunkJE77HYXB_cjs.__publicField(_FetchError, "isFetchError", (error) => {
43
- return error instanceof _FetchError;
44
- });
45
- let FetchError = _FetchError;
38
+ }
46
39
  const fetchURL = async (url, requestOptions, clientOptions) => {
47
40
  debug("fetch: %s, %O, native[%s]", url, requestOptions || {}, clientOptions?.fetch ? "no" : "yes");
48
41
  const interceptors = clientOptions?.interceptors;
package/lib/fetch.js CHANGED
@@ -1,42 +1,35 @@
1
- import { __publicField, __privateAdd, __privateSet, __privateGet } from './chunk-AQ5VUG5P.js';
2
1
  import { SdkError, ErrorType } from './error';
3
2
  import Debug from './debug';
4
3
 
5
- var _errors, _status, _statusText, _request;
6
4
  const debug = Debug("fetch");
7
- const _FetchError = class _FetchError extends Error {
5
+ class FetchError extends Error {
6
+ static isFetchError = (error) => {
7
+ return error instanceof FetchError;
8
+ };
9
+ #errors;
10
+ #status;
11
+ #statusText;
12
+ #request;
8
13
  constructor(status, statusText, body, request) {
9
14
  super(statusText);
10
- __privateAdd(this, _errors);
11
- __privateAdd(this, _status);
12
- __privateAdd(this, _statusText);
13
- __privateAdd(this, _request);
14
- __privateSet(this, _status, status);
15
- __privateSet(this, _statusText, statusText);
16
- if (body) __privateSet(this, _errors, body.errors);
17
- if (request) __privateSet(this, _request, request);
15
+ this.#status = status;
16
+ this.#statusText = statusText;
17
+ if (body) this.#errors = body.errors;
18
+ if (request) this.#request = request;
18
19
  }
19
20
  get errors() {
20
- return __privateGet(this, _errors);
21
+ return this.#errors;
21
22
  }
22
23
  get status() {
23
- return __privateGet(this, _status);
24
+ return this.#status;
24
25
  }
25
26
  get statusText() {
26
- return __privateGet(this, _statusText);
27
+ return this.#statusText;
27
28
  }
28
29
  get request() {
29
- return __privateGet(this, _request);
30
+ return this.#request;
30
31
  }
31
- };
32
- _errors = new WeakMap();
33
- _status = new WeakMap();
34
- _statusText = new WeakMap();
35
- _request = new WeakMap();
36
- __publicField(_FetchError, "isFetchError", (error) => {
37
- return error instanceof _FetchError;
38
- });
39
- let FetchError = _FetchError;
32
+ }
40
33
  const fetchURL = async (url, requestOptions, clientOptions) => {
41
34
  debug("fetch: %s, %O, native[%s]", url, requestOptions || {}, clientOptions?.fetch ? "no" : "yes");
42
35
  const interceptors = clientOptions?.interceptors;
package/lib/index.cjs CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./chunk-JE77HYXB.cjs');
6
5
  var commercelayer = require('./commercelayer');
7
6
  var api = require('./api');
8
7
  var _static = require('./static');
package/lib/index.d.cts CHANGED
@@ -2,6 +2,6 @@ export { default as CommerceLayer, CommerceLayerClient, CommerceLayerConfig, Com
2
2
  export { bO as Address, bP as AddressCreate, bR as AddressSort, bQ as AddressUpdate, bS as Adjustment, bT as AdjustmentCreate, bV as AdjustmentSort, bU as AdjustmentUpdate, bW as AdyenGateway, bX as AdyenGatewayCreate, bZ as AdyenGatewaySort, bY as AdyenGatewayUpdate, b_ as AdyenPayment, b$ as AdyenPaymentCreate, c1 as AdyenPaymentSort, c0 as AdyenPaymentUpdate, c2 as Application, c3 as ApplicationSort, c4 as Attachment, c5 as AttachmentCreate, c7 as AttachmentSort, c6 as AttachmentUpdate, c8 as Authorization, ca as AuthorizationSort, c9 as AuthorizationUpdate, cb as AvalaraAccount, cc as AvalaraAccountCreate, ce as AvalaraAccountSort, cd as AvalaraAccountUpdate, cf as AxerveGateway, cg as AxerveGatewayCreate, ci as AxerveGatewaySort, ch as AxerveGatewayUpdate, cj as AxervePayment, ck as AxervePaymentCreate, cm as AxervePaymentSort, cl as AxervePaymentUpdate, cn as BingGeocoder, co as BingGeocoderCreate, cq as BingGeocoderSort, cp as BingGeocoderUpdate, cr as BraintreeGateway, cs as BraintreeGatewayCreate, cu as BraintreeGatewaySort, ct as BraintreeGatewayUpdate, cv as BraintreePayment, cw as BraintreePaymentCreate, cy as BraintreePaymentSort, cx as BraintreePaymentUpdate, cz as Bundle, cA as BundleCreate, cC as BundleSort, cB as BundleUpdate, cD as BuyXPayYPromotion, cE as BuyXPayYPromotionCreate, cG as BuyXPayYPromotionSort, cF as BuyXPayYPromotionUpdate, cH as Capture, cJ as CaptureSort, cI as CaptureUpdate, cK as CarrierAccount, cL as CarrierAccountCreate, cN as CarrierAccountSort, cM as CarrierAccountUpdate, cO as CheckoutComGateway, cP as CheckoutComGatewayCreate, cR as CheckoutComGatewaySort, cQ as CheckoutComGatewayUpdate, cS as CheckoutComPayment, cT as CheckoutComPaymentCreate, cV as CheckoutComPaymentSort, cU as CheckoutComPaymentUpdate, cW as Cleanup, cX as CleanupCreate, cZ as CleanupSort, cY as CleanupUpdate, d6 as Coupon, c_ as CouponCodesPromotionRule, c$ as CouponCodesPromotionRuleCreate, d1 as CouponCodesPromotionRuleSort, d0 as CouponCodesPromotionRuleUpdate, d7 as CouponCreate, d2 as CouponRecipient, d3 as CouponRecipientCreate, d5 as CouponRecipientSort, d4 as CouponRecipientUpdate, d9 as CouponSort, d8 as CouponUpdate, x as CreatableResource, C as CreatableResourceType, da as CustomPromotionRule, db as CustomPromotionRuleCreate, dd as CustomPromotionRuleSort, dc as CustomPromotionRuleUpdate, dz as Customer, de as CustomerAddress, df as CustomerAddressCreate, dh as CustomerAddressSort, dg as CustomerAddressUpdate, dA as CustomerCreate, di as CustomerGroup, dj as CustomerGroupCreate, dl as CustomerGroupSort, dk as CustomerGroupUpdate, dm as CustomerPasswordReset, dn as CustomerPasswordResetCreate, dq as CustomerPasswordResetSort, dp as CustomerPasswordResetUpdate, dr as CustomerPaymentSource, ds as CustomerPaymentSourceCreate, du as CustomerPaymentSourceSort, dt as CustomerPaymentSourceUpdate, dC as CustomerSort, dv as CustomerSubscription, dw as CustomerSubscriptionCreate, dy as CustomerSubscriptionSort, dx as CustomerSubscriptionUpdate, dB as CustomerUpdate, z as DeletableResource, D as DeletableResourceType, dD as DeliveryLeadTime, dE as DeliveryLeadTimeCreate, dG as DeliveryLeadTimeSort, dF as DeliveryLeadTimeUpdate, dJ as DiscountEngine, dH as DiscountEngineItem, dI as DiscountEngineItemSort, dK as DiscountEngineSort, dL as EasypostPickup, dM as EasypostPickupCreate, dO as EasypostPickupSort, dN as EasypostPickupUpdate, dR as Event, dP as EventCallback, dQ as EventCallbackSort, dT as EventSort, dS as EventUpdate, dU as Export, dV as ExportCreate, dX as ExportSort, dW as ExportUpdate, dY as ExternalGateway, dZ as ExternalGatewayCreate, d$ as ExternalGatewaySort, d_ as ExternalGatewayUpdate, e0 as ExternalPayment, e1 as ExternalPaymentCreate, e3 as ExternalPaymentSort, e2 as ExternalPaymentUpdate, e4 as ExternalPromotion, e5 as ExternalPromotionCreate, e7 as ExternalPromotionSort, e6 as ExternalPromotionUpdate, e8 as ExternalTaxCalculator, e9 as ExternalTaxCalculatorCreate, eb as ExternalTaxCalculatorSort, ea as ExternalTaxCalculatorUpdate, ec as FixedAmountPromotion, ed as FixedAmountPromotionCreate, ef as FixedAmountPromotionSort, ee as FixedAmountPromotionUpdate, eg as FixedPricePromotion, eh as FixedPricePromotionCreate, ej as FixedPricePromotionSort, ei as FixedPricePromotionUpdate, ek as FlexPromotion, el as FlexPromotionCreate, en as FlexPromotionSort, em as FlexPromotionUpdate, eo as FreeGiftPromotion, ep as FreeGiftPromotionCreate, er as FreeGiftPromotionSort, eq as FreeGiftPromotionUpdate, es as FreeShippingPromotion, et as FreeShippingPromotionCreate, ev as FreeShippingPromotionSort, eu as FreeShippingPromotionUpdate, ew as Geocoder, ex as GeocoderSort, eC as GiftCard, eD as GiftCardCreate, ey as GiftCardRecipient, ez as GiftCardRecipientCreate, eB as GiftCardRecipientSort, eA as GiftCardRecipientUpdate, eF as GiftCardSort, eE as GiftCardUpdate, eG as GoogleGeocoder, eH as GoogleGeocoderCreate, eJ as GoogleGeocoderSort, eI as GoogleGeocoderUpdate, eK as Import, eL as ImportCreate, eN as ImportSort, eM as ImportUpdate, eO as InStockSubscription, eP as InStockSubscriptionCreate, eR as InStockSubscriptionSort, eQ as InStockSubscriptionUpdate, eS as InventoryModel, eT as InventoryModelCreate, eV as InventoryModelSort, eU as InventoryModelUpdate, eW as InventoryReturnLocation, eX as InventoryReturnLocationCreate, eZ as InventoryReturnLocationSort, eY as InventoryReturnLocationUpdate, e_ as InventoryStockLocation, e$ as InventoryStockLocationCreate, f1 as InventoryStockLocationSort, f0 as InventoryStockLocationUpdate, f2 as KlarnaGateway, f3 as KlarnaGatewayCreate, f5 as KlarnaGatewaySort, f4 as KlarnaGatewayUpdate, f6 as KlarnaPayment, f7 as KlarnaPaymentCreate, f9 as KlarnaPaymentSort, f8 as KlarnaPaymentUpdate, fe as LineItem, ff as LineItemCreate, fa as LineItemOption, fb as LineItemOptionCreate, fd as LineItemOptionSort, fc as LineItemOptionUpdate, fh as LineItemSort, fg as LineItemUpdate, fi as Link, fj as LinkCreate, fl as LinkSort, fk as LinkUpdate, m as ListMeta, L as ListResponse, w as ListableResource, v as ListableResourceType, fm as ManualGateway, fn as ManualGatewayCreate, fp as ManualGatewaySort, fo as ManualGatewayUpdate, fq as ManualTaxCalculator, fr as ManualTaxCalculatorCreate, ft as ManualTaxCalculatorSort, fs as ManualTaxCalculatorUpdate, fu as Market, fv as MarketCreate, fx as MarketSort, fw as MarketUpdate, fy as Merchant, fz as MerchantCreate, fB as MerchantSort, fA as MerchantUpdate, M as Metadata, fC as Notification, fD as NotificationCreate, fF as NotificationSort, fE as NotificationUpdate, fY as Order, fG as OrderAmountPromotionRule, fH as OrderAmountPromotionRuleCreate, fJ as OrderAmountPromotionRuleSort, fI as OrderAmountPromotionRuleUpdate, fK as OrderCopy, fL as OrderCopyCreate, fN as OrderCopySort, fM as OrderCopyUpdate, fZ as OrderCreate, fO as OrderFactory, fP as OrderFactorySort, f$ as OrderSort, fU as OrderSubscription, fV as OrderSubscriptionCreate, fQ as OrderSubscriptionItem, fR as OrderSubscriptionItemCreate, fT as OrderSubscriptionItemSort, fS as OrderSubscriptionItemUpdate, fX as OrderSubscriptionSort, fW as OrderSubscriptionUpdate, f_ as OrderUpdate, g0 as Organization, g1 as OrganizationSort, g2 as Package, g3 as PackageCreate, g5 as PackageSort, g4 as PackageUpdate, ga as Parcel, gb as ParcelCreate, g6 as ParcelLineItem, g7 as ParcelLineItemCreate, g9 as ParcelLineItemSort, g8 as ParcelLineItemUpdate, gd as ParcelSort, gc as ParcelUpdate, ge as PaymentGateway, gf as PaymentGatewaySort, gg as PaymentMethod, gh as PaymentMethodCreate, gj as PaymentMethodSort, gi as PaymentMethodUpdate, gk as PaymentOption, gl as PaymentOptionCreate, gn as PaymentOptionSort, gm as PaymentOptionUpdate, go as PaypalGateway, gp as PaypalGatewayCreate, gr as PaypalGatewaySort, gq as PaypalGatewayUpdate, gs as PaypalPayment, gt as PaypalPaymentCreate, gv as PaypalPaymentSort, gu as PaypalPaymentUpdate, gw as PercentageDiscountPromotion, gx as PercentageDiscountPromotionCreate, gz as PercentageDiscountPromotionSort, gy as PercentageDiscountPromotionUpdate, gA as Pickup, gB as PickupSort, gU as Price, gV as PriceCreate, gC as PriceFrequencyTier, gD as PriceFrequencyTierCreate, gF as PriceFrequencyTierSort, gE as PriceFrequencyTierUpdate, gK as PriceList, gL as PriceListCreate, gG as PriceListScheduler, gH as PriceListSchedulerCreate, gJ as PriceListSchedulerSort, gI as PriceListSchedulerUpdate, gN as PriceListSort, gM as PriceListUpdate, gX as PriceSort, gO as PriceTier, gP as PriceTierSort, gW as PriceUpdate, gQ as PriceVolumeTier, gR as PriceVolumeTierCreate, gT as PriceVolumeTierSort, gS as PriceVolumeTierUpdate, g_ as Promotion, gY as PromotionRule, gZ as PromotionRuleSort, g$ as PromotionSort, a as QueryFields, h as QueryFilter, Q as QueryInclude, e as QueryPageNumber, f as QueryPageSize, d as QueryParams, c as QueryParamsList, b as QueryParamsRetrieve, g as QuerySort, h0 as RecurringOrderCopy, h1 as RecurringOrderCopyCreate, h3 as RecurringOrderCopySort, h2 as RecurringOrderCopyUpdate, h4 as Refund, h6 as RefundSort, h5 as RefundUpdate, h7 as ReservedStock, h8 as ReservedStockSort, j as Resource, k as ResourceCreate, h9 as ResourceError, ha as ResourceErrorSort, p as ResourceFilter, i as ResourceId, n as ResourceRel, o as ResourceSort, R as ResourceType, s as ResourceTypeLock, l as ResourceUpdate, q as ResourcesConfig, r as ResourcesInitConfig, u as RetrievableResource, t as RetrievableResourceType, hf as Return, hg as ReturnCreate, hb as ReturnLineItem, hc as ReturnLineItemCreate, he as ReturnLineItemSort, hd as ReturnLineItemUpdate, hi as ReturnSort, hh as ReturnUpdate, hj as SatispayGateway, hk as SatispayGatewayCreate, hm as SatispayGatewaySort, hl as SatispayGatewayUpdate, hn as SatispayPayment, ho as SatispayPaymentCreate, hq as SatispayPaymentSort, hp as SatispayPaymentUpdate, hr as Shipment, hs as ShipmentCreate, hu as ShipmentSort, ht as ShipmentUpdate, hv as ShippingCategory, hw as ShippingCategoryCreate, hy as ShippingCategorySort, hx as ShippingCategoryUpdate, hB as ShippingMethod, hC as ShippingMethodCreate, hE as ShippingMethodSort, hz as ShippingMethodTier, hA as ShippingMethodTierSort, hD as ShippingMethodUpdate, hF as ShippingWeightTier, hG as ShippingWeightTierCreate, hI as ShippingWeightTierSort, hH as ShippingWeightTierUpdate, hJ as ShippingZone, hK as ShippingZoneCreate, hM as ShippingZoneSort, hL as ShippingZoneUpdate, i1 as Sku, i2 as SkuCreate, hV as SkuList, hW as SkuListCreate, hN as SkuListItem, hO as SkuListItemCreate, hQ as SkuListItemSort, hP as SkuListItemUpdate, hR as SkuListPromotionRule, hS as SkuListPromotionRuleCreate, hU as SkuListPromotionRuleSort, hT as SkuListPromotionRuleUpdate, hY as SkuListSort, hX as SkuListUpdate, hZ as SkuOption, h_ as SkuOptionCreate, i0 as SkuOptionSort, h$ as SkuOptionUpdate, i4 as SkuSort, i3 as SkuUpdate, i5 as StockItem, i6 as StockItemCreate, i8 as StockItemSort, i7 as StockItemUpdate, i9 as StockLineItem, ia as StockLineItemCreate, ic as StockLineItemSort, ib as StockLineItemUpdate, id as StockLocation, ie as StockLocationCreate, ih as StockLocationSort, ig as StockLocationUpdate, ii as StockReservation, ij as StockReservationCreate, il as StockReservationSort, ik as StockReservationUpdate, im as StockTransfer, io as StockTransferCreate, iq as StockTransferSort, ip as StockTransferUpdate, ir as Store, is as StoreCreate, iu as StoreSort, it as StoreUpdate, iv as StripeGateway, iw as StripeGatewayCreate, iy as StripeGatewaySort, ix as StripeGatewayUpdate, iz as StripePayment, iA as StripePaymentCreate, iC as StripePaymentSort, iB as StripePaymentUpdate, iD as StripeTaxAccount, iE as StripeTaxAccountCreate, iG as StripeTaxAccountSort, iF as StripeTaxAccountUpdate, iH as SubscriptionModel, iI as SubscriptionModelCreate, iK as SubscriptionModelSort, iJ as SubscriptionModelUpdate, iL as Tag, iM as TagCreate, iO as TagSort, iN as TagUpdate, A as TaggableResource, T as TaggableResourceType, iP as TalonOneAccount, iQ as TalonOneAccountCreate, iS as TalonOneAccountSort, iR as TalonOneAccountUpdate, iT as TaxCalculator, iU as TaxCalculatorSort, iV as TaxCategory, iW as TaxCategoryCreate, iY as TaxCategorySort, iX as TaxCategoryUpdate, iZ as TaxRule, i_ as TaxRuleCreate, j0 as TaxRuleSort, i$ as TaxRuleUpdate, j1 as TaxjarAccount, j2 as TaxjarAccountCreate, j4 as TaxjarAccountSort, j3 as TaxjarAccountUpdate, j5 as Transaction, j6 as TransactionSort, y as UpdatableResource, U as UpdatableResourceType, j7 as Version, j8 as VersionSort, B as VersionableResource, V as VersionableResourceType, j9 as VertexAccount, ja as VertexAccountCreate, jc as VertexAccountSort, jb as VertexAccountUpdate, jd as Void, jf as VoidSort, je as VoidUpdate, jg as Webhook, jh as WebhookCreate, jj as WebhookSort, ji as WebhookUpdate, jk as WireTransfer, jl as WireTransferCreate, jn as WireTransferSort, jm as WireTransferUpdate, E as addresses, F as adjustments, G as adyen_gateways, H as adyen_payments, I as application, J as attachments, K as authorizations, N as avalara_accounts, O as axerve_gateways, P as axerve_payments, S as bing_geocoders, W as braintree_gateways, X as braintree_payments, Y as bundles, Z as buy_x_pay_y_promotions, _ as captures, $ as carrier_accounts, a0 as checkout_com_gateways, a1 as checkout_com_payments, a2 as cleanups, a3 as coupon_codes_promotion_rules, a4 as coupon_recipients, a5 as coupons, a6 as custom_promotion_rules, a7 as customer_addresses, a8 as customer_groups, a9 as customer_password_resets, aa as customer_payment_sources, ab as customer_subscriptions, ac as customers, ad as delivery_lead_times, ae as discount_engine_items, af as discount_engines, ag as easypost_pickups, ah as event_callbacks, ai as events, aj as exports, ak as external_gateways, al as external_payments, am as external_promotions, an as external_tax_calculators, ao as fixed_amount_promotions, ap as fixed_price_promotions, aq as flex_promotions, ar as free_gift_promotions, as as free_shipping_promotions, at as geocoders, au as gift_card_recipients, av as gift_cards, aw as google_geocoders, ax as imports, ay as in_stock_subscriptions, az as inventory_models, aA as inventory_return_locations, aB as inventory_stock_locations, aC as klarna_gateways, aD as klarna_payments, aE as line_item_options, aF as line_items, aG as links, aH as manual_gateways, aI as manual_tax_calculators, aJ as markets, aK as merchants, aL as notifications, aM as order_amount_promotion_rules, aN as order_copies, aO as order_factories, aP as order_subscription_items, aQ as order_subscriptions, aR as orders, aS as organization, aT as packages, aU as parcel_line_items, aV as parcels, aW as payment_gateways, aX as payment_methods, aY as payment_options, aZ as paypal_gateways, a_ as paypal_payments, a$ as percentage_discount_promotions, b0 as pickups, b1 as price_frequency_tiers, b2 as price_list_schedulers, b3 as price_lists, b4 as price_tiers, b5 as price_volume_tiers, b6 as prices, b7 as promotion_rules, b8 as promotions, b9 as recurring_order_copies, ba as refunds, bb as reserved_stocks, bc as resource_errors, bd as return_line_items, be as returns, bf as satispay_gateways, bg as satispay_payments, bh as shipments, bi as shipping_categories, bj as shipping_method_tiers, bk as shipping_methods, bl as shipping_weight_tiers, bm as shipping_zones, bn as sku_list_items, bo as sku_list_promotion_rules, bp as sku_lists, bq as sku_options, br as skus, bs as stock_items, bt as stock_line_items, bu as stock_locations, bv as stock_reservations, bw as stock_transfers, bx as stores, by as stripe_gateways, bz as stripe_payments, bA as stripe_tax_accounts, bB as subscription_models, bC as tags, bD as talon_one_accounts, bE as tax_calculators, bF as tax_categories, bG as tax_rules, bH as taxjar_accounts, bI as transactions, bJ as versions, bK as vertex_accounts, bL as voids, bM as webhooks, bN as wire_transfers } from './api-CRmSToGa.cjs';
3
3
  export { CommerceLayerStatic } from './static.cjs';
4
4
  export { E as ErrorObj, H as HeadersObj, R as RequestObj, a as ResponseObj } from './interceptor-5MISI1yn.cjs';
5
- export { ApiError, ErrorType, SdkError } from './error.cjs';
5
+ export { ApiError, SdkError } from './error.cjs';
6
6
  import './client.cjs';
7
7
  import './types.cjs';
package/lib/index.d.ts CHANGED
@@ -2,6 +2,6 @@ export { default as CommerceLayer, CommerceLayerClient, CommerceLayerConfig, Com
2
2
  export { bO as Address, bP as AddressCreate, bR as AddressSort, bQ as AddressUpdate, bS as Adjustment, bT as AdjustmentCreate, bV as AdjustmentSort, bU as AdjustmentUpdate, bW as AdyenGateway, bX as AdyenGatewayCreate, bZ as AdyenGatewaySort, bY as AdyenGatewayUpdate, b_ as AdyenPayment, b$ as AdyenPaymentCreate, c1 as AdyenPaymentSort, c0 as AdyenPaymentUpdate, c2 as Application, c3 as ApplicationSort, c4 as Attachment, c5 as AttachmentCreate, c7 as AttachmentSort, c6 as AttachmentUpdate, c8 as Authorization, ca as AuthorizationSort, c9 as AuthorizationUpdate, cb as AvalaraAccount, cc as AvalaraAccountCreate, ce as AvalaraAccountSort, cd as AvalaraAccountUpdate, cf as AxerveGateway, cg as AxerveGatewayCreate, ci as AxerveGatewaySort, ch as AxerveGatewayUpdate, cj as AxervePayment, ck as AxervePaymentCreate, cm as AxervePaymentSort, cl as AxervePaymentUpdate, cn as BingGeocoder, co as BingGeocoderCreate, cq as BingGeocoderSort, cp as BingGeocoderUpdate, cr as BraintreeGateway, cs as BraintreeGatewayCreate, cu as BraintreeGatewaySort, ct as BraintreeGatewayUpdate, cv as BraintreePayment, cw as BraintreePaymentCreate, cy as BraintreePaymentSort, cx as BraintreePaymentUpdate, cz as Bundle, cA as BundleCreate, cC as BundleSort, cB as BundleUpdate, cD as BuyXPayYPromotion, cE as BuyXPayYPromotionCreate, cG as BuyXPayYPromotionSort, cF as BuyXPayYPromotionUpdate, cH as Capture, cJ as CaptureSort, cI as CaptureUpdate, cK as CarrierAccount, cL as CarrierAccountCreate, cN as CarrierAccountSort, cM as CarrierAccountUpdate, cO as CheckoutComGateway, cP as CheckoutComGatewayCreate, cR as CheckoutComGatewaySort, cQ as CheckoutComGatewayUpdate, cS as CheckoutComPayment, cT as CheckoutComPaymentCreate, cV as CheckoutComPaymentSort, cU as CheckoutComPaymentUpdate, cW as Cleanup, cX as CleanupCreate, cZ as CleanupSort, cY as CleanupUpdate, d6 as Coupon, c_ as CouponCodesPromotionRule, c$ as CouponCodesPromotionRuleCreate, d1 as CouponCodesPromotionRuleSort, d0 as CouponCodesPromotionRuleUpdate, d7 as CouponCreate, d2 as CouponRecipient, d3 as CouponRecipientCreate, d5 as CouponRecipientSort, d4 as CouponRecipientUpdate, d9 as CouponSort, d8 as CouponUpdate, x as CreatableResource, C as CreatableResourceType, da as CustomPromotionRule, db as CustomPromotionRuleCreate, dd as CustomPromotionRuleSort, dc as CustomPromotionRuleUpdate, dz as Customer, de as CustomerAddress, df as CustomerAddressCreate, dh as CustomerAddressSort, dg as CustomerAddressUpdate, dA as CustomerCreate, di as CustomerGroup, dj as CustomerGroupCreate, dl as CustomerGroupSort, dk as CustomerGroupUpdate, dm as CustomerPasswordReset, dn as CustomerPasswordResetCreate, dq as CustomerPasswordResetSort, dp as CustomerPasswordResetUpdate, dr as CustomerPaymentSource, ds as CustomerPaymentSourceCreate, du as CustomerPaymentSourceSort, dt as CustomerPaymentSourceUpdate, dC as CustomerSort, dv as CustomerSubscription, dw as CustomerSubscriptionCreate, dy as CustomerSubscriptionSort, dx as CustomerSubscriptionUpdate, dB as CustomerUpdate, z as DeletableResource, D as DeletableResourceType, dD as DeliveryLeadTime, dE as DeliveryLeadTimeCreate, dG as DeliveryLeadTimeSort, dF as DeliveryLeadTimeUpdate, dJ as DiscountEngine, dH as DiscountEngineItem, dI as DiscountEngineItemSort, dK as DiscountEngineSort, dL as EasypostPickup, dM as EasypostPickupCreate, dO as EasypostPickupSort, dN as EasypostPickupUpdate, dR as Event, dP as EventCallback, dQ as EventCallbackSort, dT as EventSort, dS as EventUpdate, dU as Export, dV as ExportCreate, dX as ExportSort, dW as ExportUpdate, dY as ExternalGateway, dZ as ExternalGatewayCreate, d$ as ExternalGatewaySort, d_ as ExternalGatewayUpdate, e0 as ExternalPayment, e1 as ExternalPaymentCreate, e3 as ExternalPaymentSort, e2 as ExternalPaymentUpdate, e4 as ExternalPromotion, e5 as ExternalPromotionCreate, e7 as ExternalPromotionSort, e6 as ExternalPromotionUpdate, e8 as ExternalTaxCalculator, e9 as ExternalTaxCalculatorCreate, eb as ExternalTaxCalculatorSort, ea as ExternalTaxCalculatorUpdate, ec as FixedAmountPromotion, ed as FixedAmountPromotionCreate, ef as FixedAmountPromotionSort, ee as FixedAmountPromotionUpdate, eg as FixedPricePromotion, eh as FixedPricePromotionCreate, ej as FixedPricePromotionSort, ei as FixedPricePromotionUpdate, ek as FlexPromotion, el as FlexPromotionCreate, en as FlexPromotionSort, em as FlexPromotionUpdate, eo as FreeGiftPromotion, ep as FreeGiftPromotionCreate, er as FreeGiftPromotionSort, eq as FreeGiftPromotionUpdate, es as FreeShippingPromotion, et as FreeShippingPromotionCreate, ev as FreeShippingPromotionSort, eu as FreeShippingPromotionUpdate, ew as Geocoder, ex as GeocoderSort, eC as GiftCard, eD as GiftCardCreate, ey as GiftCardRecipient, ez as GiftCardRecipientCreate, eB as GiftCardRecipientSort, eA as GiftCardRecipientUpdate, eF as GiftCardSort, eE as GiftCardUpdate, eG as GoogleGeocoder, eH as GoogleGeocoderCreate, eJ as GoogleGeocoderSort, eI as GoogleGeocoderUpdate, eK as Import, eL as ImportCreate, eN as ImportSort, eM as ImportUpdate, eO as InStockSubscription, eP as InStockSubscriptionCreate, eR as InStockSubscriptionSort, eQ as InStockSubscriptionUpdate, eS as InventoryModel, eT as InventoryModelCreate, eV as InventoryModelSort, eU as InventoryModelUpdate, eW as InventoryReturnLocation, eX as InventoryReturnLocationCreate, eZ as InventoryReturnLocationSort, eY as InventoryReturnLocationUpdate, e_ as InventoryStockLocation, e$ as InventoryStockLocationCreate, f1 as InventoryStockLocationSort, f0 as InventoryStockLocationUpdate, f2 as KlarnaGateway, f3 as KlarnaGatewayCreate, f5 as KlarnaGatewaySort, f4 as KlarnaGatewayUpdate, f6 as KlarnaPayment, f7 as KlarnaPaymentCreate, f9 as KlarnaPaymentSort, f8 as KlarnaPaymentUpdate, fe as LineItem, ff as LineItemCreate, fa as LineItemOption, fb as LineItemOptionCreate, fd as LineItemOptionSort, fc as LineItemOptionUpdate, fh as LineItemSort, fg as LineItemUpdate, fi as Link, fj as LinkCreate, fl as LinkSort, fk as LinkUpdate, m as ListMeta, L as ListResponse, w as ListableResource, v as ListableResourceType, fm as ManualGateway, fn as ManualGatewayCreate, fp as ManualGatewaySort, fo as ManualGatewayUpdate, fq as ManualTaxCalculator, fr as ManualTaxCalculatorCreate, ft as ManualTaxCalculatorSort, fs as ManualTaxCalculatorUpdate, fu as Market, fv as MarketCreate, fx as MarketSort, fw as MarketUpdate, fy as Merchant, fz as MerchantCreate, fB as MerchantSort, fA as MerchantUpdate, M as Metadata, fC as Notification, fD as NotificationCreate, fF as NotificationSort, fE as NotificationUpdate, fY as Order, fG as OrderAmountPromotionRule, fH as OrderAmountPromotionRuleCreate, fJ as OrderAmountPromotionRuleSort, fI as OrderAmountPromotionRuleUpdate, fK as OrderCopy, fL as OrderCopyCreate, fN as OrderCopySort, fM as OrderCopyUpdate, fZ as OrderCreate, fO as OrderFactory, fP as OrderFactorySort, f$ as OrderSort, fU as OrderSubscription, fV as OrderSubscriptionCreate, fQ as OrderSubscriptionItem, fR as OrderSubscriptionItemCreate, fT as OrderSubscriptionItemSort, fS as OrderSubscriptionItemUpdate, fX as OrderSubscriptionSort, fW as OrderSubscriptionUpdate, f_ as OrderUpdate, g0 as Organization, g1 as OrganizationSort, g2 as Package, g3 as PackageCreate, g5 as PackageSort, g4 as PackageUpdate, ga as Parcel, gb as ParcelCreate, g6 as ParcelLineItem, g7 as ParcelLineItemCreate, g9 as ParcelLineItemSort, g8 as ParcelLineItemUpdate, gd as ParcelSort, gc as ParcelUpdate, ge as PaymentGateway, gf as PaymentGatewaySort, gg as PaymentMethod, gh as PaymentMethodCreate, gj as PaymentMethodSort, gi as PaymentMethodUpdate, gk as PaymentOption, gl as PaymentOptionCreate, gn as PaymentOptionSort, gm as PaymentOptionUpdate, go as PaypalGateway, gp as PaypalGatewayCreate, gr as PaypalGatewaySort, gq as PaypalGatewayUpdate, gs as PaypalPayment, gt as PaypalPaymentCreate, gv as PaypalPaymentSort, gu as PaypalPaymentUpdate, gw as PercentageDiscountPromotion, gx as PercentageDiscountPromotionCreate, gz as PercentageDiscountPromotionSort, gy as PercentageDiscountPromotionUpdate, gA as Pickup, gB as PickupSort, gU as Price, gV as PriceCreate, gC as PriceFrequencyTier, gD as PriceFrequencyTierCreate, gF as PriceFrequencyTierSort, gE as PriceFrequencyTierUpdate, gK as PriceList, gL as PriceListCreate, gG as PriceListScheduler, gH as PriceListSchedulerCreate, gJ as PriceListSchedulerSort, gI as PriceListSchedulerUpdate, gN as PriceListSort, gM as PriceListUpdate, gX as PriceSort, gO as PriceTier, gP as PriceTierSort, gW as PriceUpdate, gQ as PriceVolumeTier, gR as PriceVolumeTierCreate, gT as PriceVolumeTierSort, gS as PriceVolumeTierUpdate, g_ as Promotion, gY as PromotionRule, gZ as PromotionRuleSort, g$ as PromotionSort, a as QueryFields, h as QueryFilter, Q as QueryInclude, e as QueryPageNumber, f as QueryPageSize, d as QueryParams, c as QueryParamsList, b as QueryParamsRetrieve, g as QuerySort, h0 as RecurringOrderCopy, h1 as RecurringOrderCopyCreate, h3 as RecurringOrderCopySort, h2 as RecurringOrderCopyUpdate, h4 as Refund, h6 as RefundSort, h5 as RefundUpdate, h7 as ReservedStock, h8 as ReservedStockSort, j as Resource, k as ResourceCreate, h9 as ResourceError, ha as ResourceErrorSort, p as ResourceFilter, i as ResourceId, n as ResourceRel, o as ResourceSort, R as ResourceType, s as ResourceTypeLock, l as ResourceUpdate, q as ResourcesConfig, r as ResourcesInitConfig, u as RetrievableResource, t as RetrievableResourceType, hf as Return, hg as ReturnCreate, hb as ReturnLineItem, hc as ReturnLineItemCreate, he as ReturnLineItemSort, hd as ReturnLineItemUpdate, hi as ReturnSort, hh as ReturnUpdate, hj as SatispayGateway, hk as SatispayGatewayCreate, hm as SatispayGatewaySort, hl as SatispayGatewayUpdate, hn as SatispayPayment, ho as SatispayPaymentCreate, hq as SatispayPaymentSort, hp as SatispayPaymentUpdate, hr as Shipment, hs as ShipmentCreate, hu as ShipmentSort, ht as ShipmentUpdate, hv as ShippingCategory, hw as ShippingCategoryCreate, hy as ShippingCategorySort, hx as ShippingCategoryUpdate, hB as ShippingMethod, hC as ShippingMethodCreate, hE as ShippingMethodSort, hz as ShippingMethodTier, hA as ShippingMethodTierSort, hD as ShippingMethodUpdate, hF as ShippingWeightTier, hG as ShippingWeightTierCreate, hI as ShippingWeightTierSort, hH as ShippingWeightTierUpdate, hJ as ShippingZone, hK as ShippingZoneCreate, hM as ShippingZoneSort, hL as ShippingZoneUpdate, i1 as Sku, i2 as SkuCreate, hV as SkuList, hW as SkuListCreate, hN as SkuListItem, hO as SkuListItemCreate, hQ as SkuListItemSort, hP as SkuListItemUpdate, hR as SkuListPromotionRule, hS as SkuListPromotionRuleCreate, hU as SkuListPromotionRuleSort, hT as SkuListPromotionRuleUpdate, hY as SkuListSort, hX as SkuListUpdate, hZ as SkuOption, h_ as SkuOptionCreate, i0 as SkuOptionSort, h$ as SkuOptionUpdate, i4 as SkuSort, i3 as SkuUpdate, i5 as StockItem, i6 as StockItemCreate, i8 as StockItemSort, i7 as StockItemUpdate, i9 as StockLineItem, ia as StockLineItemCreate, ic as StockLineItemSort, ib as StockLineItemUpdate, id as StockLocation, ie as StockLocationCreate, ih as StockLocationSort, ig as StockLocationUpdate, ii as StockReservation, ij as StockReservationCreate, il as StockReservationSort, ik as StockReservationUpdate, im as StockTransfer, io as StockTransferCreate, iq as StockTransferSort, ip as StockTransferUpdate, ir as Store, is as StoreCreate, iu as StoreSort, it as StoreUpdate, iv as StripeGateway, iw as StripeGatewayCreate, iy as StripeGatewaySort, ix as StripeGatewayUpdate, iz as StripePayment, iA as StripePaymentCreate, iC as StripePaymentSort, iB as StripePaymentUpdate, iD as StripeTaxAccount, iE as StripeTaxAccountCreate, iG as StripeTaxAccountSort, iF as StripeTaxAccountUpdate, iH as SubscriptionModel, iI as SubscriptionModelCreate, iK as SubscriptionModelSort, iJ as SubscriptionModelUpdate, iL as Tag, iM as TagCreate, iO as TagSort, iN as TagUpdate, A as TaggableResource, T as TaggableResourceType, iP as TalonOneAccount, iQ as TalonOneAccountCreate, iS as TalonOneAccountSort, iR as TalonOneAccountUpdate, iT as TaxCalculator, iU as TaxCalculatorSort, iV as TaxCategory, iW as TaxCategoryCreate, iY as TaxCategorySort, iX as TaxCategoryUpdate, iZ as TaxRule, i_ as TaxRuleCreate, j0 as TaxRuleSort, i$ as TaxRuleUpdate, j1 as TaxjarAccount, j2 as TaxjarAccountCreate, j4 as TaxjarAccountSort, j3 as TaxjarAccountUpdate, j5 as Transaction, j6 as TransactionSort, y as UpdatableResource, U as UpdatableResourceType, j7 as Version, j8 as VersionSort, B as VersionableResource, V as VersionableResourceType, j9 as VertexAccount, ja as VertexAccountCreate, jc as VertexAccountSort, jb as VertexAccountUpdate, jd as Void, jf as VoidSort, je as VoidUpdate, jg as Webhook, jh as WebhookCreate, jj as WebhookSort, ji as WebhookUpdate, jk as WireTransfer, jl as WireTransferCreate, jn as WireTransferSort, jm as WireTransferUpdate, E as addresses, F as adjustments, G as adyen_gateways, H as adyen_payments, I as application, J as attachments, K as authorizations, N as avalara_accounts, O as axerve_gateways, P as axerve_payments, S as bing_geocoders, W as braintree_gateways, X as braintree_payments, Y as bundles, Z as buy_x_pay_y_promotions, _ as captures, $ as carrier_accounts, a0 as checkout_com_gateways, a1 as checkout_com_payments, a2 as cleanups, a3 as coupon_codes_promotion_rules, a4 as coupon_recipients, a5 as coupons, a6 as custom_promotion_rules, a7 as customer_addresses, a8 as customer_groups, a9 as customer_password_resets, aa as customer_payment_sources, ab as customer_subscriptions, ac as customers, ad as delivery_lead_times, ae as discount_engine_items, af as discount_engines, ag as easypost_pickups, ah as event_callbacks, ai as events, aj as exports, ak as external_gateways, al as external_payments, am as external_promotions, an as external_tax_calculators, ao as fixed_amount_promotions, ap as fixed_price_promotions, aq as flex_promotions, ar as free_gift_promotions, as as free_shipping_promotions, at as geocoders, au as gift_card_recipients, av as gift_cards, aw as google_geocoders, ax as imports, ay as in_stock_subscriptions, az as inventory_models, aA as inventory_return_locations, aB as inventory_stock_locations, aC as klarna_gateways, aD as klarna_payments, aE as line_item_options, aF as line_items, aG as links, aH as manual_gateways, aI as manual_tax_calculators, aJ as markets, aK as merchants, aL as notifications, aM as order_amount_promotion_rules, aN as order_copies, aO as order_factories, aP as order_subscription_items, aQ as order_subscriptions, aR as orders, aS as organization, aT as packages, aU as parcel_line_items, aV as parcels, aW as payment_gateways, aX as payment_methods, aY as payment_options, aZ as paypal_gateways, a_ as paypal_payments, a$ as percentage_discount_promotions, b0 as pickups, b1 as price_frequency_tiers, b2 as price_list_schedulers, b3 as price_lists, b4 as price_tiers, b5 as price_volume_tiers, b6 as prices, b7 as promotion_rules, b8 as promotions, b9 as recurring_order_copies, ba as refunds, bb as reserved_stocks, bc as resource_errors, bd as return_line_items, be as returns, bf as satispay_gateways, bg as satispay_payments, bh as shipments, bi as shipping_categories, bj as shipping_method_tiers, bk as shipping_methods, bl as shipping_weight_tiers, bm as shipping_zones, bn as sku_list_items, bo as sku_list_promotion_rules, bp as sku_lists, bq as sku_options, br as skus, bs as stock_items, bt as stock_line_items, bu as stock_locations, bv as stock_reservations, bw as stock_transfers, bx as stores, by as stripe_gateways, bz as stripe_payments, bA as stripe_tax_accounts, bB as subscription_models, bC as tags, bD as talon_one_accounts, bE as tax_calculators, bF as tax_categories, bG as tax_rules, bH as taxjar_accounts, bI as transactions, bJ as versions, bK as vertex_accounts, bL as voids, bM as webhooks, bN as wire_transfers } from './api-CUXmETkx.js';
3
3
  export { CommerceLayerStatic } from './static.js';
4
4
  export { E as ErrorObj, H as HeadersObj, R as RequestObj, a as ResponseObj } from './interceptor-5MISI1yn.js';
5
- export { ApiError, ErrorType, SdkError } from './error.js';
5
+ export { ApiError, SdkError } from './error.js';
6
6
  import './client.js';
7
7
  import './types.js';
package/lib/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import './chunk-AQ5VUG5P.js';
2
1
  export { CommerceLayer, default } from './commercelayer';
3
2
  export * from './api';
4
3
  export { CommerceLayerStatic } from './static';
package/lib/jsonapi.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- require('./chunk-JE77HYXB.cjs');
4
3
  var common = require('./common');
5
4
  var config = require('./config');
6
5
  var Debug = require('./debug');
package/lib/jsonapi.js CHANGED
@@ -1,4 +1,3 @@
1
- import './chunk-AQ5VUG5P.js';
2
1
  import { isResourceType, isResourceId } from './common';
3
2
  import config from './config';
4
3
  import Debug from './debug';
package/lib/query.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- require('./chunk-JE77HYXB.cjs');
4
3
  var error = require('./error');
5
4
  var Debug = require('./debug');
6
5
 
package/lib/query.js CHANGED
@@ -1,4 +1,3 @@
1
- import './chunk-AQ5VUG5P.js';
2
1
  import { SdkError, ErrorType } from './error';
3
2
  import Debug from './debug';
4
3
 
package/lib/resource.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var chunkJE77HYXB_cjs = require('./chunk-JE77HYXB.cjs');
4
3
  var ApiClient = require('./client');
5
4
  var jsonapi = require('./jsonapi');
6
5
  var query = require('./query');
@@ -14,12 +13,11 @@ var ApiClient__default = /*#__PURE__*/_interopDefault(ApiClient);
14
13
  var config__default = /*#__PURE__*/_interopDefault(config);
15
14
  var Debug__default = /*#__PURE__*/_interopDefault(Debug);
16
15
 
17
- var _client, _config;
18
16
  const debug = Debug__default.default("resource");
19
17
  class ListResponse extends Array {
18
+ meta;
20
19
  constructor(meta, data) {
21
20
  super(...data || []);
22
- chunkJE77HYXB_cjs.__publicField(this, "meta");
23
21
  this.meta = meta;
24
22
  }
25
23
  first() {
@@ -50,30 +48,29 @@ class ListResponse extends Array {
50
48
  return this.meta.pageCount;
51
49
  }
52
50
  }
53
- const _ApiResourceAdapter = class _ApiResourceAdapter {
51
+ class ApiResourceAdapter {
52
+ static adapter;
54
53
  constructor() {
55
54
  }
56
55
  static init(config2) {
57
- return _ApiResourceAdapter.adapter = new ResourceAdapter(config2);
56
+ return ApiResourceAdapter.adapter = new ResourceAdapter(config2);
58
57
  }
59
58
  static get(config2) {
60
- if (config2) return _ApiResourceAdapter.init(config2);
59
+ if (config2) return ApiResourceAdapter.init(config2);
61
60
  else {
62
- if (_ApiResourceAdapter.adapter) return _ApiResourceAdapter.adapter;
61
+ if (ApiResourceAdapter.adapter) return ApiResourceAdapter.adapter;
63
62
  else throw new error.SdkError({ message: "Commerce Layer not initialized" });
64
63
  }
65
64
  }
66
65
  static config(config2) {
67
- _ApiResourceAdapter.get().config(config2);
66
+ ApiResourceAdapter.get().config(config2);
68
67
  }
69
- };
70
- chunkJE77HYXB_cjs.__publicField(_ApiResourceAdapter, "adapter");
71
- let ApiResourceAdapter = _ApiResourceAdapter;
68
+ }
72
69
  class ResourceAdapter {
70
+ #client;
71
+ #config = {};
73
72
  constructor(config2) {
74
- chunkJE77HYXB_cjs.__privateAdd(this, _client);
75
- chunkJE77HYXB_cjs.__privateAdd(this, _config, {});
76
- chunkJE77HYXB_cjs.__privateSet(this, _client, ApiClient__default.default.create(config2));
73
+ this.#client = ApiClient__default.default.create(config2);
77
74
  this.localConfig(config2);
78
75
  }
79
76
  localConfig(config2) {
@@ -81,17 +78,17 @@ class ResourceAdapter {
81
78
  config(config2) {
82
79
  debug("config %o", config2);
83
80
  this.localConfig(config2);
84
- chunkJE77HYXB_cjs.__privateGet(this, _client).config(config2);
81
+ this.#client.config(config2);
85
82
  return this;
86
83
  }
87
84
  get client() {
88
- return chunkJE77HYXB_cjs.__privateGet(this, _client);
85
+ return this.#client;
89
86
  }
90
87
  async singleton(resource, params, options, path) {
91
88
  debug("singleton: %o, %O, %O", resource, params || {}, options || {});
92
89
  const queryParams = query.generateQueryStringParams(params, resource);
93
90
  if (options?.params) Object.assign(queryParams, options?.params);
94
- const res = await chunkJE77HYXB_cjs.__privateGet(this, _client).request("GET", `${path || resource.type}`, void 0, { ...options, params: queryParams });
91
+ const res = await this.#client.request("GET", `${path || resource.type}`, void 0, { ...options, params: queryParams });
95
92
  const r = jsonapi.denormalize(res);
96
93
  return r;
97
94
  }
@@ -99,7 +96,7 @@ class ResourceAdapter {
99
96
  debug("retrieve: %o, %O, %O", resource, params || {}, options || {});
100
97
  const queryParams = query.generateQueryStringParams(params, resource);
101
98
  if (options?.params) Object.assign(queryParams, options?.params);
102
- const res = await chunkJE77HYXB_cjs.__privateGet(this, _client).request("GET", `${resource.type}/${resource.id}`, void 0, { ...options, params: queryParams });
99
+ const res = await this.#client.request("GET", `${resource.type}/${resource.id}`, void 0, { ...options, params: queryParams });
103
100
  const r = jsonapi.denormalize(res);
104
101
  return r;
105
102
  }
@@ -108,7 +105,7 @@ class ResourceAdapter {
108
105
  const queryParams = query.generateQueryStringParams(params, resource);
109
106
  if (options?.params) Object.assign(queryParams, options?.params);
110
107
  if (!queryParams["page[number]"]) queryParams["page[number]"] = "1";
111
- const res = await chunkJE77HYXB_cjs.__privateGet(this, _client).request("GET", `${resource.type}`, void 0, { ...options, params: queryParams });
108
+ const res = await this.#client.request("GET", `${resource.type}`, void 0, { ...options, params: queryParams });
112
109
  const r = jsonapi.denormalize(res);
113
110
  const meta = {
114
111
  pageCount: Number(res.meta?.page_count),
@@ -123,7 +120,7 @@ class ResourceAdapter {
123
120
  const queryParams = query.generateQueryStringParams(params, resource);
124
121
  if (options?.params) Object.assign(queryParams, options?.params);
125
122
  const data = jsonapi.normalize(resource);
126
- const res = await chunkJE77HYXB_cjs.__privateGet(this, _client).request("POST", resource.type, data, { ...options, params: queryParams });
123
+ const res = await this.#client.request("POST", resource.type, data, { ...options, params: queryParams });
127
124
  const r = jsonapi.denormalize(res);
128
125
  return r;
129
126
  }
@@ -132,19 +129,19 @@ class ResourceAdapter {
132
129
  const queryParams = query.generateQueryStringParams(params, resource);
133
130
  if (options?.params) Object.assign(queryParams, options?.params);
134
131
  const data = jsonapi.normalize(resource);
135
- const res = await chunkJE77HYXB_cjs.__privateGet(this, _client).request("PATCH", `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
132
+ const res = await this.#client.request("PATCH", `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
136
133
  const r = jsonapi.denormalize(res);
137
134
  return r;
138
135
  }
139
136
  async delete(resource, options) {
140
137
  debug("delete: %o, %O", resource, options || {});
141
- await chunkJE77HYXB_cjs.__privateGet(this, _client).request("DELETE", `${resource.type}/${resource.id}`, void 0, options);
138
+ await this.#client.request("DELETE", `${resource.type}/${resource.id}`, void 0, options);
142
139
  }
143
140
  async fetch(resource, path, params, options) {
144
141
  debug("fetch: %o, %O, %O", path, params || {}, options || {});
145
142
  const queryParams = query.generateQueryStringParams(params, resource);
146
143
  if (options?.params) Object.assign(queryParams, options?.params);
147
- const res = await chunkJE77HYXB_cjs.__privateGet(this, _client).request("GET", path, void 0, { ...options, params: queryParams });
144
+ const res = await this.#client.request("GET", path, void 0, { ...options, params: queryParams });
148
145
  const r = jsonapi.denormalize(res);
149
146
  if (Array.isArray(r)) {
150
147
  const p = params;
@@ -158,9 +155,8 @@ class ResourceAdapter {
158
155
  } else return r;
159
156
  }
160
157
  }
161
- _client = new WeakMap();
162
- _config = new WeakMap();
163
158
  class ApiResourceBase {
159
+ static TYPE;
164
160
  // #resources?: ResourceAdapter
165
161
  constructor(adapter) {
166
162
  debug("new resource instance: %s", this.type());
@@ -187,7 +183,6 @@ class ApiResourceBase {
187
183
  return this.resources.update({ ...resource, type: this.type() }, params, options);
188
184
  }
189
185
  }
190
- chunkJE77HYXB_cjs.__publicField(ApiResourceBase, "TYPE");
191
186
  class ApiResource extends ApiResourceBase {
192
187
  async retrieve(id, params, options) {
193
188
  return this.resources.retrieve(typeof id === "string" ? { type: this.type(), id } : id, params, options);
package/lib/resource.js CHANGED
@@ -1,4 +1,3 @@
1
- import { __publicField, __privateAdd, __privateSet, __privateGet } from './chunk-AQ5VUG5P.js';
2
1
  import ApiClient from './client';
3
2
  import { denormalize, normalize } from './jsonapi';
4
3
  import { generateQueryStringParams, isParamsList } from './query';
@@ -6,12 +5,11 @@ import config from './config';
6
5
  import { SdkError } from './error';
7
6
  import Debug from './debug';
8
7
 
9
- var _client, _config;
10
8
  const debug = Debug("resource");
11
9
  class ListResponse extends Array {
10
+ meta;
12
11
  constructor(meta, data) {
13
12
  super(...data || []);
14
- __publicField(this, "meta");
15
13
  this.meta = meta;
16
14
  }
17
15
  first() {
@@ -42,30 +40,29 @@ class ListResponse extends Array {
42
40
  return this.meta.pageCount;
43
41
  }
44
42
  }
45
- const _ApiResourceAdapter = class _ApiResourceAdapter {
43
+ class ApiResourceAdapter {
44
+ static adapter;
46
45
  constructor() {
47
46
  }
48
47
  static init(config2) {
49
- return _ApiResourceAdapter.adapter = new ResourceAdapter(config2);
48
+ return ApiResourceAdapter.adapter = new ResourceAdapter(config2);
50
49
  }
51
50
  static get(config2) {
52
- if (config2) return _ApiResourceAdapter.init(config2);
51
+ if (config2) return ApiResourceAdapter.init(config2);
53
52
  else {
54
- if (_ApiResourceAdapter.adapter) return _ApiResourceAdapter.adapter;
53
+ if (ApiResourceAdapter.adapter) return ApiResourceAdapter.adapter;
55
54
  else throw new SdkError({ message: "Commerce Layer not initialized" });
56
55
  }
57
56
  }
58
57
  static config(config2) {
59
- _ApiResourceAdapter.get().config(config2);
58
+ ApiResourceAdapter.get().config(config2);
60
59
  }
61
- };
62
- __publicField(_ApiResourceAdapter, "adapter");
63
- let ApiResourceAdapter = _ApiResourceAdapter;
60
+ }
64
61
  class ResourceAdapter {
62
+ #client;
63
+ #config = {};
65
64
  constructor(config2) {
66
- __privateAdd(this, _client);
67
- __privateAdd(this, _config, {});
68
- __privateSet(this, _client, ApiClient.create(config2));
65
+ this.#client = ApiClient.create(config2);
69
66
  this.localConfig(config2);
70
67
  }
71
68
  localConfig(config2) {
@@ -73,17 +70,17 @@ class ResourceAdapter {
73
70
  config(config2) {
74
71
  debug("config %o", config2);
75
72
  this.localConfig(config2);
76
- __privateGet(this, _client).config(config2);
73
+ this.#client.config(config2);
77
74
  return this;
78
75
  }
79
76
  get client() {
80
- return __privateGet(this, _client);
77
+ return this.#client;
81
78
  }
82
79
  async singleton(resource, params, options, path) {
83
80
  debug("singleton: %o, %O, %O", resource, params || {}, options || {});
84
81
  const queryParams = generateQueryStringParams(params, resource);
85
82
  if (options?.params) Object.assign(queryParams, options?.params);
86
- const res = await __privateGet(this, _client).request("GET", `${path || resource.type}`, void 0, { ...options, params: queryParams });
83
+ const res = await this.#client.request("GET", `${path || resource.type}`, void 0, { ...options, params: queryParams });
87
84
  const r = denormalize(res);
88
85
  return r;
89
86
  }
@@ -91,7 +88,7 @@ class ResourceAdapter {
91
88
  debug("retrieve: %o, %O, %O", resource, params || {}, options || {});
92
89
  const queryParams = generateQueryStringParams(params, resource);
93
90
  if (options?.params) Object.assign(queryParams, options?.params);
94
- const res = await __privateGet(this, _client).request("GET", `${resource.type}/${resource.id}`, void 0, { ...options, params: queryParams });
91
+ const res = await this.#client.request("GET", `${resource.type}/${resource.id}`, void 0, { ...options, params: queryParams });
95
92
  const r = denormalize(res);
96
93
  return r;
97
94
  }
@@ -100,7 +97,7 @@ class ResourceAdapter {
100
97
  const queryParams = generateQueryStringParams(params, resource);
101
98
  if (options?.params) Object.assign(queryParams, options?.params);
102
99
  if (!queryParams["page[number]"]) queryParams["page[number]"] = "1";
103
- const res = await __privateGet(this, _client).request("GET", `${resource.type}`, void 0, { ...options, params: queryParams });
100
+ const res = await this.#client.request("GET", `${resource.type}`, void 0, { ...options, params: queryParams });
104
101
  const r = denormalize(res);
105
102
  const meta = {
106
103
  pageCount: Number(res.meta?.page_count),
@@ -115,7 +112,7 @@ class ResourceAdapter {
115
112
  const queryParams = generateQueryStringParams(params, resource);
116
113
  if (options?.params) Object.assign(queryParams, options?.params);
117
114
  const data = normalize(resource);
118
- const res = await __privateGet(this, _client).request("POST", resource.type, data, { ...options, params: queryParams });
115
+ const res = await this.#client.request("POST", resource.type, data, { ...options, params: queryParams });
119
116
  const r = denormalize(res);
120
117
  return r;
121
118
  }
@@ -124,19 +121,19 @@ class ResourceAdapter {
124
121
  const queryParams = generateQueryStringParams(params, resource);
125
122
  if (options?.params) Object.assign(queryParams, options?.params);
126
123
  const data = normalize(resource);
127
- const res = await __privateGet(this, _client).request("PATCH", `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
124
+ const res = await this.#client.request("PATCH", `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
128
125
  const r = denormalize(res);
129
126
  return r;
130
127
  }
131
128
  async delete(resource, options) {
132
129
  debug("delete: %o, %O", resource, options || {});
133
- await __privateGet(this, _client).request("DELETE", `${resource.type}/${resource.id}`, void 0, options);
130
+ await this.#client.request("DELETE", `${resource.type}/${resource.id}`, void 0, options);
134
131
  }
135
132
  async fetch(resource, path, params, options) {
136
133
  debug("fetch: %o, %O, %O", path, params || {}, options || {});
137
134
  const queryParams = generateQueryStringParams(params, resource);
138
135
  if (options?.params) Object.assign(queryParams, options?.params);
139
- const res = await __privateGet(this, _client).request("GET", path, void 0, { ...options, params: queryParams });
136
+ const res = await this.#client.request("GET", path, void 0, { ...options, params: queryParams });
140
137
  const r = denormalize(res);
141
138
  if (Array.isArray(r)) {
142
139
  const p = params;
@@ -150,9 +147,8 @@ class ResourceAdapter {
150
147
  } else return r;
151
148
  }
152
149
  }
153
- _client = new WeakMap();
154
- _config = new WeakMap();
155
150
  class ApiResourceBase {
151
+ static TYPE;
156
152
  // #resources?: ResourceAdapter
157
153
  constructor(adapter) {
158
154
  debug("new resource instance: %s", this.type());
@@ -179,7 +175,6 @@ class ApiResourceBase {
179
175
  return this.resources.update({ ...resource, type: this.type() }, params, options);
180
176
  }
181
177
  }
182
- __publicField(ApiResourceBase, "TYPE");
183
178
  class ApiResource extends ApiResourceBase {
184
179
  async retrieve(id, params, options) {
185
180
  return this.resources.retrieve(typeof id === "string" ? { type: this.type(), id } : id, params, options);