@commercelayer/sdk 6.0.0-alfa.1 → 6.0.0-alfa.11

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 (537) hide show
  1. package/lib/cjs/api.d.ts +0 -3
  2. package/lib/cjs/api.js +0 -10
  3. package/lib/cjs/client.d.ts +6 -14
  4. package/lib/cjs/client.js +39 -73
  5. package/lib/cjs/commercelayer.d.ts +128 -127
  6. package/lib/cjs/commercelayer.js +268 -156
  7. package/lib/cjs/common.js +0 -11
  8. package/lib/cjs/config.d.ts +3 -0
  9. package/lib/cjs/config.js +3 -2
  10. package/lib/cjs/debug.js +0 -21
  11. package/lib/cjs/error.d.ts +6 -7
  12. package/lib/cjs/error.js +35 -33
  13. package/lib/cjs/fetch.d.ts +13 -0
  14. package/lib/cjs/fetch.js +67 -0
  15. package/lib/cjs/index.js +0 -2
  16. package/lib/cjs/interceptor.d.ts +24 -12
  17. package/lib/cjs/jsonapi.js +10 -7
  18. package/lib/cjs/model.d.ts +0 -3
  19. package/lib/cjs/model.js +0 -1
  20. package/lib/cjs/query.d.ts +3 -2
  21. package/lib/cjs/query.js +25 -7
  22. package/lib/cjs/resource.d.ts +4 -4
  23. package/lib/cjs/resource.js +14 -30
  24. package/lib/cjs/resources/addresses.d.ts +1 -0
  25. package/lib/cjs/resources/addresses.js +4 -1
  26. package/lib/cjs/resources/adjustments.d.ts +1 -0
  27. package/lib/cjs/resources/adjustments.js +4 -1
  28. package/lib/cjs/resources/adyen_gateways.d.ts +1 -0
  29. package/lib/cjs/resources/adyen_gateways.js +4 -1
  30. package/lib/cjs/resources/adyen_payments.d.ts +1 -0
  31. package/lib/cjs/resources/adyen_payments.js +4 -1
  32. package/lib/cjs/resources/application.d.ts +1 -0
  33. package/lib/cjs/resources/application.js +4 -1
  34. package/lib/cjs/resources/attachments.d.ts +1 -0
  35. package/lib/cjs/resources/attachments.js +4 -1
  36. package/lib/cjs/resources/authorizations.d.ts +1 -0
  37. package/lib/cjs/resources/authorizations.js +4 -1
  38. package/lib/cjs/resources/avalara_accounts.d.ts +1 -0
  39. package/lib/cjs/resources/avalara_accounts.js +4 -1
  40. package/lib/cjs/resources/axerve_gateways.d.ts +1 -0
  41. package/lib/cjs/resources/axerve_gateways.js +4 -1
  42. package/lib/cjs/resources/axerve_payments.d.ts +1 -0
  43. package/lib/cjs/resources/axerve_payments.js +4 -1
  44. package/lib/cjs/resources/billing_info_validation_rules.d.ts +1 -0
  45. package/lib/cjs/resources/billing_info_validation_rules.js +4 -1
  46. package/lib/cjs/resources/bing_geocoders.d.ts +1 -0
  47. package/lib/cjs/resources/bing_geocoders.js +4 -1
  48. package/lib/cjs/resources/braintree_gateways.d.ts +1 -0
  49. package/lib/cjs/resources/braintree_gateways.js +4 -1
  50. package/lib/cjs/resources/braintree_payments.d.ts +1 -0
  51. package/lib/cjs/resources/braintree_payments.js +4 -1
  52. package/lib/cjs/resources/bundles.d.ts +1 -0
  53. package/lib/cjs/resources/bundles.js +4 -1
  54. package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +1 -0
  55. package/lib/cjs/resources/buy_x_pay_y_promotions.js +4 -1
  56. package/lib/cjs/resources/captures.d.ts +1 -0
  57. package/lib/cjs/resources/captures.js +4 -1
  58. package/lib/cjs/resources/carrier_accounts.d.ts +1 -0
  59. package/lib/cjs/resources/carrier_accounts.js +4 -1
  60. package/lib/cjs/resources/checkout_com_gateways.d.ts +1 -0
  61. package/lib/cjs/resources/checkout_com_gateways.js +4 -1
  62. package/lib/cjs/resources/checkout_com_payments.d.ts +1 -0
  63. package/lib/cjs/resources/checkout_com_payments.js +4 -1
  64. package/lib/cjs/resources/cleanups.d.ts +1 -0
  65. package/lib/cjs/resources/cleanups.js +4 -1
  66. package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +1 -0
  67. package/lib/cjs/resources/coupon_codes_promotion_rules.js +4 -1
  68. package/lib/cjs/resources/coupon_recipients.d.ts +1 -0
  69. package/lib/cjs/resources/coupon_recipients.js +4 -1
  70. package/lib/cjs/resources/coupons.d.ts +1 -0
  71. package/lib/cjs/resources/coupons.js +4 -1
  72. package/lib/cjs/resources/custom_promotion_rules.d.ts +1 -0
  73. package/lib/cjs/resources/custom_promotion_rules.js +4 -1
  74. package/lib/cjs/resources/customer_addresses.d.ts +1 -0
  75. package/lib/cjs/resources/customer_addresses.js +4 -1
  76. package/lib/cjs/resources/customer_groups.d.ts +1 -0
  77. package/lib/cjs/resources/customer_groups.js +4 -1
  78. package/lib/cjs/resources/customer_password_resets.d.ts +1 -0
  79. package/lib/cjs/resources/customer_password_resets.js +4 -1
  80. package/lib/cjs/resources/customer_payment_sources.d.ts +1 -0
  81. package/lib/cjs/resources/customer_payment_sources.js +4 -1
  82. package/lib/cjs/resources/customer_subscriptions.d.ts +1 -0
  83. package/lib/cjs/resources/customer_subscriptions.js +4 -1
  84. package/lib/cjs/resources/customers.d.ts +1 -0
  85. package/lib/cjs/resources/customers.js +4 -1
  86. package/lib/cjs/resources/delivery_lead_times.d.ts +1 -0
  87. package/lib/cjs/resources/delivery_lead_times.js +4 -1
  88. package/lib/cjs/resources/event_callbacks.d.ts +1 -0
  89. package/lib/cjs/resources/event_callbacks.js +4 -1
  90. package/lib/cjs/resources/events.d.ts +4 -3
  91. package/lib/cjs/resources/events.js +8 -5
  92. package/lib/cjs/resources/exports.d.ts +1 -0
  93. package/lib/cjs/resources/exports.js +4 -1
  94. package/lib/cjs/resources/external_gateways.d.ts +1 -0
  95. package/lib/cjs/resources/external_gateways.js +4 -1
  96. package/lib/cjs/resources/external_payments.d.ts +1 -0
  97. package/lib/cjs/resources/external_payments.js +4 -1
  98. package/lib/cjs/resources/external_promotions.d.ts +1 -0
  99. package/lib/cjs/resources/external_promotions.js +4 -1
  100. package/lib/cjs/resources/external_tax_calculators.d.ts +1 -0
  101. package/lib/cjs/resources/external_tax_calculators.js +4 -1
  102. package/lib/cjs/resources/fixed_amount_promotions.d.ts +1 -0
  103. package/lib/cjs/resources/fixed_amount_promotions.js +4 -1
  104. package/lib/cjs/resources/fixed_price_promotions.d.ts +1 -0
  105. package/lib/cjs/resources/fixed_price_promotions.js +4 -1
  106. package/lib/cjs/resources/free_gift_promotions.d.ts +1 -0
  107. package/lib/cjs/resources/free_gift_promotions.js +4 -1
  108. package/lib/cjs/resources/free_shipping_promotions.d.ts +1 -0
  109. package/lib/cjs/resources/free_shipping_promotions.js +4 -1
  110. package/lib/cjs/resources/geocoders.d.ts +1 -0
  111. package/lib/cjs/resources/geocoders.js +4 -1
  112. package/lib/cjs/resources/gift_card_recipients.d.ts +1 -0
  113. package/lib/cjs/resources/gift_card_recipients.js +4 -1
  114. package/lib/cjs/resources/gift_cards.d.ts +1 -0
  115. package/lib/cjs/resources/gift_cards.js +4 -1
  116. package/lib/cjs/resources/google_geocoders.d.ts +1 -0
  117. package/lib/cjs/resources/google_geocoders.js +4 -1
  118. package/lib/cjs/resources/imports.d.ts +1 -0
  119. package/lib/cjs/resources/imports.js +4 -1
  120. package/lib/cjs/resources/in_stock_subscriptions.d.ts +1 -0
  121. package/lib/cjs/resources/in_stock_subscriptions.js +4 -1
  122. package/lib/cjs/resources/inventory_models.d.ts +1 -0
  123. package/lib/cjs/resources/inventory_models.js +4 -1
  124. package/lib/cjs/resources/inventory_return_locations.d.ts +1 -0
  125. package/lib/cjs/resources/inventory_return_locations.js +4 -1
  126. package/lib/cjs/resources/inventory_stock_locations.d.ts +1 -0
  127. package/lib/cjs/resources/inventory_stock_locations.js +4 -1
  128. package/lib/cjs/resources/klarna_gateways.d.ts +1 -0
  129. package/lib/cjs/resources/klarna_gateways.js +4 -1
  130. package/lib/cjs/resources/klarna_payments.d.ts +1 -0
  131. package/lib/cjs/resources/klarna_payments.js +4 -1
  132. package/lib/cjs/resources/line_item_options.d.ts +1 -0
  133. package/lib/cjs/resources/line_item_options.js +4 -1
  134. package/lib/cjs/resources/line_items.d.ts +1 -0
  135. package/lib/cjs/resources/line_items.js +4 -1
  136. package/lib/cjs/resources/manual_gateways.d.ts +1 -0
  137. package/lib/cjs/resources/manual_gateways.js +4 -1
  138. package/lib/cjs/resources/manual_tax_calculators.d.ts +1 -0
  139. package/lib/cjs/resources/manual_tax_calculators.js +4 -1
  140. package/lib/cjs/resources/markets.d.ts +1 -0
  141. package/lib/cjs/resources/markets.js +4 -1
  142. package/lib/cjs/resources/merchants.d.ts +1 -0
  143. package/lib/cjs/resources/merchants.js +4 -1
  144. package/lib/cjs/resources/order_amount_promotion_rules.d.ts +1 -0
  145. package/lib/cjs/resources/order_amount_promotion_rules.js +4 -1
  146. package/lib/cjs/resources/order_copies.d.ts +1 -0
  147. package/lib/cjs/resources/order_copies.js +4 -1
  148. package/lib/cjs/resources/order_factories.d.ts +1 -0
  149. package/lib/cjs/resources/order_factories.js +4 -1
  150. package/lib/cjs/resources/order_subscription_items.d.ts +1 -0
  151. package/lib/cjs/resources/order_subscription_items.js +4 -1
  152. package/lib/cjs/resources/order_subscriptions.d.ts +1 -0
  153. package/lib/cjs/resources/order_subscriptions.js +4 -1
  154. package/lib/cjs/resources/order_validation_rules.d.ts +1 -0
  155. package/lib/cjs/resources/order_validation_rules.js +4 -1
  156. package/lib/cjs/resources/orders.d.ts +1 -0
  157. package/lib/cjs/resources/orders.js +4 -1
  158. package/lib/cjs/resources/organization.d.ts +2 -0
  159. package/lib/cjs/resources/organization.js +4 -1
  160. package/lib/cjs/resources/packages.d.ts +1 -0
  161. package/lib/cjs/resources/packages.js +4 -1
  162. package/lib/cjs/resources/parcel_line_items.d.ts +1 -0
  163. package/lib/cjs/resources/parcel_line_items.js +4 -1
  164. package/lib/cjs/resources/parcels.d.ts +1 -0
  165. package/lib/cjs/resources/parcels.js +4 -1
  166. package/lib/cjs/resources/payment_gateways.d.ts +1 -0
  167. package/lib/cjs/resources/payment_gateways.js +4 -1
  168. package/lib/cjs/resources/payment_methods.d.ts +1 -0
  169. package/lib/cjs/resources/payment_methods.js +4 -1
  170. package/lib/cjs/resources/payment_options.d.ts +1 -0
  171. package/lib/cjs/resources/payment_options.js +4 -1
  172. package/lib/cjs/resources/paypal_gateways.d.ts +1 -0
  173. package/lib/cjs/resources/paypal_gateways.js +4 -1
  174. package/lib/cjs/resources/paypal_payments.d.ts +1 -0
  175. package/lib/cjs/resources/paypal_payments.js +4 -1
  176. package/lib/cjs/resources/percentage_discount_promotions.d.ts +1 -0
  177. package/lib/cjs/resources/percentage_discount_promotions.js +4 -1
  178. package/lib/cjs/resources/price_frequency_tiers.d.ts +1 -0
  179. package/lib/cjs/resources/price_frequency_tiers.js +4 -1
  180. package/lib/cjs/resources/price_lists.d.ts +1 -0
  181. package/lib/cjs/resources/price_lists.js +4 -1
  182. package/lib/cjs/resources/price_tiers.d.ts +1 -0
  183. package/lib/cjs/resources/price_tiers.js +4 -1
  184. package/lib/cjs/resources/price_volume_tiers.d.ts +1 -0
  185. package/lib/cjs/resources/price_volume_tiers.js +4 -1
  186. package/lib/cjs/resources/prices.d.ts +1 -0
  187. package/lib/cjs/resources/prices.js +4 -1
  188. package/lib/cjs/resources/promotion_rules.d.ts +1 -0
  189. package/lib/cjs/resources/promotion_rules.js +4 -1
  190. package/lib/cjs/resources/promotions.d.ts +1 -0
  191. package/lib/cjs/resources/promotions.js +4 -1
  192. package/lib/cjs/resources/recurring_order_copies.d.ts +1 -0
  193. package/lib/cjs/resources/recurring_order_copies.js +4 -1
  194. package/lib/cjs/resources/refunds.d.ts +1 -0
  195. package/lib/cjs/resources/refunds.js +4 -1
  196. package/lib/cjs/resources/reserved_stocks.d.ts +1 -0
  197. package/lib/cjs/resources/reserved_stocks.js +4 -1
  198. package/lib/cjs/resources/resource_errors.d.ts +1 -0
  199. package/lib/cjs/resources/resource_errors.js +4 -1
  200. package/lib/cjs/resources/return_line_items.d.ts +1 -0
  201. package/lib/cjs/resources/return_line_items.js +4 -1
  202. package/lib/cjs/resources/returns.d.ts +1 -0
  203. package/lib/cjs/resources/returns.js +4 -1
  204. package/lib/cjs/resources/satispay_gateways.d.ts +1 -0
  205. package/lib/cjs/resources/satispay_gateways.js +4 -1
  206. package/lib/cjs/resources/satispay_payments.d.ts +1 -0
  207. package/lib/cjs/resources/satispay_payments.js +4 -1
  208. package/lib/cjs/resources/shipments.d.ts +4 -0
  209. package/lib/cjs/resources/shipments.js +8 -1
  210. package/lib/cjs/resources/shipping_categories.d.ts +1 -0
  211. package/lib/cjs/resources/shipping_categories.js +4 -1
  212. package/lib/cjs/resources/shipping_method_tiers.d.ts +1 -0
  213. package/lib/cjs/resources/shipping_method_tiers.js +4 -1
  214. package/lib/cjs/resources/shipping_methods.d.ts +1 -0
  215. package/lib/cjs/resources/shipping_methods.js +4 -1
  216. package/lib/cjs/resources/shipping_weight_tiers.d.ts +1 -0
  217. package/lib/cjs/resources/shipping_weight_tiers.js +4 -1
  218. package/lib/cjs/resources/shipping_zones.d.ts +1 -0
  219. package/lib/cjs/resources/shipping_zones.js +4 -1
  220. package/lib/cjs/resources/sku_list_items.d.ts +1 -0
  221. package/lib/cjs/resources/sku_list_items.js +4 -1
  222. package/lib/cjs/resources/sku_list_promotion_rules.d.ts +1 -0
  223. package/lib/cjs/resources/sku_list_promotion_rules.js +4 -1
  224. package/lib/cjs/resources/sku_lists.d.ts +1 -0
  225. package/lib/cjs/resources/sku_lists.js +4 -1
  226. package/lib/cjs/resources/sku_options.d.ts +1 -0
  227. package/lib/cjs/resources/sku_options.js +4 -1
  228. package/lib/cjs/resources/skus.d.ts +1 -0
  229. package/lib/cjs/resources/skus.js +4 -1
  230. package/lib/cjs/resources/stock_items.d.ts +1 -0
  231. package/lib/cjs/resources/stock_items.js +4 -1
  232. package/lib/cjs/resources/stock_line_items.d.ts +1 -0
  233. package/lib/cjs/resources/stock_line_items.js +4 -1
  234. package/lib/cjs/resources/stock_locations.d.ts +1 -0
  235. package/lib/cjs/resources/stock_locations.js +4 -1
  236. package/lib/cjs/resources/stock_reservations.d.ts +1 -0
  237. package/lib/cjs/resources/stock_reservations.js +4 -1
  238. package/lib/cjs/resources/stock_transfers.d.ts +1 -0
  239. package/lib/cjs/resources/stock_transfers.js +4 -1
  240. package/lib/cjs/resources/stripe_gateways.d.ts +1 -0
  241. package/lib/cjs/resources/stripe_gateways.js +4 -1
  242. package/lib/cjs/resources/stripe_payments.d.ts +1 -0
  243. package/lib/cjs/resources/stripe_payments.js +4 -1
  244. package/lib/cjs/resources/subscription_models.d.ts +1 -0
  245. package/lib/cjs/resources/subscription_models.js +4 -1
  246. package/lib/cjs/resources/tags.d.ts +1 -0
  247. package/lib/cjs/resources/tags.js +4 -1
  248. package/lib/cjs/resources/tax_calculators.d.ts +1 -0
  249. package/lib/cjs/resources/tax_calculators.js +4 -1
  250. package/lib/cjs/resources/tax_categories.d.ts +1 -0
  251. package/lib/cjs/resources/tax_categories.js +4 -1
  252. package/lib/cjs/resources/tax_rules.d.ts +1 -0
  253. package/lib/cjs/resources/tax_rules.js +4 -1
  254. package/lib/cjs/resources/taxjar_accounts.d.ts +1 -0
  255. package/lib/cjs/resources/taxjar_accounts.js +4 -1
  256. package/lib/cjs/resources/transactions.d.ts +1 -0
  257. package/lib/cjs/resources/transactions.js +4 -1
  258. package/lib/cjs/resources/versions.d.ts +1 -0
  259. package/lib/cjs/resources/versions.js +4 -1
  260. package/lib/cjs/resources/voids.d.ts +1 -0
  261. package/lib/cjs/resources/voids.js +4 -1
  262. package/lib/cjs/resources/webhooks.d.ts +1 -0
  263. package/lib/cjs/resources/webhooks.js +4 -1
  264. package/lib/cjs/resources/wire_transfers.d.ts +1 -0
  265. package/lib/cjs/resources/wire_transfers.js +4 -1
  266. package/lib/cjs/static.js +0 -1
  267. package/lib/cjs/util.js +0 -1
  268. package/lib/esm/api.d.ts +0 -3
  269. package/lib/esm/api.js +0 -10
  270. package/lib/esm/client.d.ts +6 -14
  271. package/lib/esm/client.js +37 -73
  272. package/lib/esm/commercelayer.d.ts +128 -127
  273. package/lib/esm/commercelayer.js +266 -278
  274. package/lib/esm/common.js +0 -11
  275. package/lib/esm/config.d.ts +3 -0
  276. package/lib/esm/config.js +3 -2
  277. package/lib/esm/debug.js +0 -21
  278. package/lib/esm/error.d.ts +6 -7
  279. package/lib/esm/error.js +35 -31
  280. package/lib/esm/fetch.d.ts +13 -0
  281. package/lib/esm/fetch.js +46 -0
  282. package/lib/esm/index.js +0 -2
  283. package/lib/esm/interceptor.d.ts +24 -12
  284. package/lib/esm/jsonapi.js +10 -7
  285. package/lib/esm/model.d.ts +0 -3
  286. package/lib/esm/model.js +0 -1
  287. package/lib/esm/query.d.ts +3 -2
  288. package/lib/esm/query.js +24 -7
  289. package/lib/esm/resource.d.ts +4 -4
  290. package/lib/esm/resource.js +14 -30
  291. package/lib/esm/resources/addresses.d.ts +1 -0
  292. package/lib/esm/resources/addresses.js +4 -1
  293. package/lib/esm/resources/adjustments.d.ts +1 -0
  294. package/lib/esm/resources/adjustments.js +4 -1
  295. package/lib/esm/resources/adyen_gateways.d.ts +1 -0
  296. package/lib/esm/resources/adyen_gateways.js +4 -1
  297. package/lib/esm/resources/adyen_payments.d.ts +1 -0
  298. package/lib/esm/resources/adyen_payments.js +4 -1
  299. package/lib/esm/resources/application.d.ts +1 -0
  300. package/lib/esm/resources/application.js +4 -1
  301. package/lib/esm/resources/attachments.d.ts +1 -0
  302. package/lib/esm/resources/attachments.js +4 -1
  303. package/lib/esm/resources/authorizations.d.ts +1 -0
  304. package/lib/esm/resources/authorizations.js +4 -1
  305. package/lib/esm/resources/avalara_accounts.d.ts +1 -0
  306. package/lib/esm/resources/avalara_accounts.js +4 -1
  307. package/lib/esm/resources/axerve_gateways.d.ts +1 -0
  308. package/lib/esm/resources/axerve_gateways.js +4 -1
  309. package/lib/esm/resources/axerve_payments.d.ts +1 -0
  310. package/lib/esm/resources/axerve_payments.js +4 -1
  311. package/lib/esm/resources/billing_info_validation_rules.d.ts +1 -0
  312. package/lib/esm/resources/billing_info_validation_rules.js +4 -1
  313. package/lib/esm/resources/bing_geocoders.d.ts +1 -0
  314. package/lib/esm/resources/bing_geocoders.js +4 -1
  315. package/lib/esm/resources/braintree_gateways.d.ts +1 -0
  316. package/lib/esm/resources/braintree_gateways.js +4 -1
  317. package/lib/esm/resources/braintree_payments.d.ts +1 -0
  318. package/lib/esm/resources/braintree_payments.js +4 -1
  319. package/lib/esm/resources/bundles.d.ts +1 -0
  320. package/lib/esm/resources/bundles.js +4 -1
  321. package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +1 -0
  322. package/lib/esm/resources/buy_x_pay_y_promotions.js +4 -1
  323. package/lib/esm/resources/captures.d.ts +1 -0
  324. package/lib/esm/resources/captures.js +4 -1
  325. package/lib/esm/resources/carrier_accounts.d.ts +1 -0
  326. package/lib/esm/resources/carrier_accounts.js +4 -1
  327. package/lib/esm/resources/checkout_com_gateways.d.ts +1 -0
  328. package/lib/esm/resources/checkout_com_gateways.js +4 -1
  329. package/lib/esm/resources/checkout_com_payments.d.ts +1 -0
  330. package/lib/esm/resources/checkout_com_payments.js +4 -1
  331. package/lib/esm/resources/cleanups.d.ts +1 -0
  332. package/lib/esm/resources/cleanups.js +4 -1
  333. package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +1 -0
  334. package/lib/esm/resources/coupon_codes_promotion_rules.js +4 -1
  335. package/lib/esm/resources/coupon_recipients.d.ts +1 -0
  336. package/lib/esm/resources/coupon_recipients.js +4 -1
  337. package/lib/esm/resources/coupons.d.ts +1 -0
  338. package/lib/esm/resources/coupons.js +4 -1
  339. package/lib/esm/resources/custom_promotion_rules.d.ts +1 -0
  340. package/lib/esm/resources/custom_promotion_rules.js +4 -1
  341. package/lib/esm/resources/customer_addresses.d.ts +1 -0
  342. package/lib/esm/resources/customer_addresses.js +4 -1
  343. package/lib/esm/resources/customer_groups.d.ts +1 -0
  344. package/lib/esm/resources/customer_groups.js +4 -1
  345. package/lib/esm/resources/customer_password_resets.d.ts +1 -0
  346. package/lib/esm/resources/customer_password_resets.js +4 -1
  347. package/lib/esm/resources/customer_payment_sources.d.ts +1 -0
  348. package/lib/esm/resources/customer_payment_sources.js +4 -1
  349. package/lib/esm/resources/customer_subscriptions.d.ts +1 -0
  350. package/lib/esm/resources/customer_subscriptions.js +4 -1
  351. package/lib/esm/resources/customers.d.ts +1 -0
  352. package/lib/esm/resources/customers.js +4 -1
  353. package/lib/esm/resources/delivery_lead_times.d.ts +1 -0
  354. package/lib/esm/resources/delivery_lead_times.js +4 -1
  355. package/lib/esm/resources/event_callbacks.d.ts +1 -0
  356. package/lib/esm/resources/event_callbacks.js +4 -1
  357. package/lib/esm/resources/events.d.ts +4 -3
  358. package/lib/esm/resources/events.js +8 -5
  359. package/lib/esm/resources/exports.d.ts +1 -0
  360. package/lib/esm/resources/exports.js +4 -1
  361. package/lib/esm/resources/external_gateways.d.ts +1 -0
  362. package/lib/esm/resources/external_gateways.js +4 -1
  363. package/lib/esm/resources/external_payments.d.ts +1 -0
  364. package/lib/esm/resources/external_payments.js +4 -1
  365. package/lib/esm/resources/external_promotions.d.ts +1 -0
  366. package/lib/esm/resources/external_promotions.js +4 -1
  367. package/lib/esm/resources/external_tax_calculators.d.ts +1 -0
  368. package/lib/esm/resources/external_tax_calculators.js +4 -1
  369. package/lib/esm/resources/fixed_amount_promotions.d.ts +1 -0
  370. package/lib/esm/resources/fixed_amount_promotions.js +4 -1
  371. package/lib/esm/resources/fixed_price_promotions.d.ts +1 -0
  372. package/lib/esm/resources/fixed_price_promotions.js +4 -1
  373. package/lib/esm/resources/free_gift_promotions.d.ts +1 -0
  374. package/lib/esm/resources/free_gift_promotions.js +4 -1
  375. package/lib/esm/resources/free_shipping_promotions.d.ts +1 -0
  376. package/lib/esm/resources/free_shipping_promotions.js +4 -1
  377. package/lib/esm/resources/geocoders.d.ts +1 -0
  378. package/lib/esm/resources/geocoders.js +4 -1
  379. package/lib/esm/resources/gift_card_recipients.d.ts +1 -0
  380. package/lib/esm/resources/gift_card_recipients.js +4 -1
  381. package/lib/esm/resources/gift_cards.d.ts +1 -0
  382. package/lib/esm/resources/gift_cards.js +4 -1
  383. package/lib/esm/resources/google_geocoders.d.ts +1 -0
  384. package/lib/esm/resources/google_geocoders.js +4 -1
  385. package/lib/esm/resources/imports.d.ts +1 -0
  386. package/lib/esm/resources/imports.js +4 -1
  387. package/lib/esm/resources/in_stock_subscriptions.d.ts +1 -0
  388. package/lib/esm/resources/in_stock_subscriptions.js +4 -1
  389. package/lib/esm/resources/inventory_models.d.ts +1 -0
  390. package/lib/esm/resources/inventory_models.js +4 -1
  391. package/lib/esm/resources/inventory_return_locations.d.ts +1 -0
  392. package/lib/esm/resources/inventory_return_locations.js +4 -1
  393. package/lib/esm/resources/inventory_stock_locations.d.ts +1 -0
  394. package/lib/esm/resources/inventory_stock_locations.js +4 -1
  395. package/lib/esm/resources/klarna_gateways.d.ts +1 -0
  396. package/lib/esm/resources/klarna_gateways.js +4 -1
  397. package/lib/esm/resources/klarna_payments.d.ts +1 -0
  398. package/lib/esm/resources/klarna_payments.js +4 -1
  399. package/lib/esm/resources/line_item_options.d.ts +1 -0
  400. package/lib/esm/resources/line_item_options.js +4 -1
  401. package/lib/esm/resources/line_items.d.ts +1 -0
  402. package/lib/esm/resources/line_items.js +4 -1
  403. package/lib/esm/resources/manual_gateways.d.ts +1 -0
  404. package/lib/esm/resources/manual_gateways.js +4 -1
  405. package/lib/esm/resources/manual_tax_calculators.d.ts +1 -0
  406. package/lib/esm/resources/manual_tax_calculators.js +4 -1
  407. package/lib/esm/resources/markets.d.ts +1 -0
  408. package/lib/esm/resources/markets.js +4 -1
  409. package/lib/esm/resources/merchants.d.ts +1 -0
  410. package/lib/esm/resources/merchants.js +4 -1
  411. package/lib/esm/resources/order_amount_promotion_rules.d.ts +1 -0
  412. package/lib/esm/resources/order_amount_promotion_rules.js +4 -1
  413. package/lib/esm/resources/order_copies.d.ts +1 -0
  414. package/lib/esm/resources/order_copies.js +4 -1
  415. package/lib/esm/resources/order_factories.d.ts +1 -0
  416. package/lib/esm/resources/order_factories.js +4 -1
  417. package/lib/esm/resources/order_subscription_items.d.ts +1 -0
  418. package/lib/esm/resources/order_subscription_items.js +4 -1
  419. package/lib/esm/resources/order_subscriptions.d.ts +1 -0
  420. package/lib/esm/resources/order_subscriptions.js +4 -1
  421. package/lib/esm/resources/order_validation_rules.d.ts +1 -0
  422. package/lib/esm/resources/order_validation_rules.js +4 -1
  423. package/lib/esm/resources/orders.d.ts +1 -0
  424. package/lib/esm/resources/orders.js +4 -1
  425. package/lib/esm/resources/organization.d.ts +2 -0
  426. package/lib/esm/resources/organization.js +4 -1
  427. package/lib/esm/resources/packages.d.ts +1 -0
  428. package/lib/esm/resources/packages.js +4 -1
  429. package/lib/esm/resources/parcel_line_items.d.ts +1 -0
  430. package/lib/esm/resources/parcel_line_items.js +4 -1
  431. package/lib/esm/resources/parcels.d.ts +1 -0
  432. package/lib/esm/resources/parcels.js +4 -1
  433. package/lib/esm/resources/payment_gateways.d.ts +1 -0
  434. package/lib/esm/resources/payment_gateways.js +4 -1
  435. package/lib/esm/resources/payment_methods.d.ts +1 -0
  436. package/lib/esm/resources/payment_methods.js +4 -1
  437. package/lib/esm/resources/payment_options.d.ts +1 -0
  438. package/lib/esm/resources/payment_options.js +4 -1
  439. package/lib/esm/resources/paypal_gateways.d.ts +1 -0
  440. package/lib/esm/resources/paypal_gateways.js +4 -1
  441. package/lib/esm/resources/paypal_payments.d.ts +1 -0
  442. package/lib/esm/resources/paypal_payments.js +4 -1
  443. package/lib/esm/resources/percentage_discount_promotions.d.ts +1 -0
  444. package/lib/esm/resources/percentage_discount_promotions.js +4 -1
  445. package/lib/esm/resources/price_frequency_tiers.d.ts +1 -0
  446. package/lib/esm/resources/price_frequency_tiers.js +4 -1
  447. package/lib/esm/resources/price_lists.d.ts +1 -0
  448. package/lib/esm/resources/price_lists.js +4 -1
  449. package/lib/esm/resources/price_tiers.d.ts +1 -0
  450. package/lib/esm/resources/price_tiers.js +4 -1
  451. package/lib/esm/resources/price_volume_tiers.d.ts +1 -0
  452. package/lib/esm/resources/price_volume_tiers.js +4 -1
  453. package/lib/esm/resources/prices.d.ts +1 -0
  454. package/lib/esm/resources/prices.js +4 -1
  455. package/lib/esm/resources/promotion_rules.d.ts +1 -0
  456. package/lib/esm/resources/promotion_rules.js +4 -1
  457. package/lib/esm/resources/promotions.d.ts +1 -0
  458. package/lib/esm/resources/promotions.js +4 -1
  459. package/lib/esm/resources/recurring_order_copies.d.ts +1 -0
  460. package/lib/esm/resources/recurring_order_copies.js +4 -1
  461. package/lib/esm/resources/refunds.d.ts +1 -0
  462. package/lib/esm/resources/refunds.js +4 -1
  463. package/lib/esm/resources/reserved_stocks.d.ts +1 -0
  464. package/lib/esm/resources/reserved_stocks.js +4 -1
  465. package/lib/esm/resources/resource_errors.d.ts +1 -0
  466. package/lib/esm/resources/resource_errors.js +4 -1
  467. package/lib/esm/resources/return_line_items.d.ts +1 -0
  468. package/lib/esm/resources/return_line_items.js +4 -1
  469. package/lib/esm/resources/returns.d.ts +1 -0
  470. package/lib/esm/resources/returns.js +4 -1
  471. package/lib/esm/resources/satispay_gateways.d.ts +1 -0
  472. package/lib/esm/resources/satispay_gateways.js +4 -1
  473. package/lib/esm/resources/satispay_payments.d.ts +1 -0
  474. package/lib/esm/resources/satispay_payments.js +4 -1
  475. package/lib/esm/resources/shipments.d.ts +4 -0
  476. package/lib/esm/resources/shipments.js +8 -1
  477. package/lib/esm/resources/shipping_categories.d.ts +1 -0
  478. package/lib/esm/resources/shipping_categories.js +4 -1
  479. package/lib/esm/resources/shipping_method_tiers.d.ts +1 -0
  480. package/lib/esm/resources/shipping_method_tiers.js +4 -1
  481. package/lib/esm/resources/shipping_methods.d.ts +1 -0
  482. package/lib/esm/resources/shipping_methods.js +4 -1
  483. package/lib/esm/resources/shipping_weight_tiers.d.ts +1 -0
  484. package/lib/esm/resources/shipping_weight_tiers.js +4 -1
  485. package/lib/esm/resources/shipping_zones.d.ts +1 -0
  486. package/lib/esm/resources/shipping_zones.js +4 -1
  487. package/lib/esm/resources/sku_list_items.d.ts +1 -0
  488. package/lib/esm/resources/sku_list_items.js +4 -1
  489. package/lib/esm/resources/sku_list_promotion_rules.d.ts +1 -0
  490. package/lib/esm/resources/sku_list_promotion_rules.js +4 -1
  491. package/lib/esm/resources/sku_lists.d.ts +1 -0
  492. package/lib/esm/resources/sku_lists.js +4 -1
  493. package/lib/esm/resources/sku_options.d.ts +1 -0
  494. package/lib/esm/resources/sku_options.js +4 -1
  495. package/lib/esm/resources/skus.d.ts +1 -0
  496. package/lib/esm/resources/skus.js +4 -1
  497. package/lib/esm/resources/stock_items.d.ts +1 -0
  498. package/lib/esm/resources/stock_items.js +4 -1
  499. package/lib/esm/resources/stock_line_items.d.ts +1 -0
  500. package/lib/esm/resources/stock_line_items.js +4 -1
  501. package/lib/esm/resources/stock_locations.d.ts +1 -0
  502. package/lib/esm/resources/stock_locations.js +4 -1
  503. package/lib/esm/resources/stock_reservations.d.ts +1 -0
  504. package/lib/esm/resources/stock_reservations.js +4 -1
  505. package/lib/esm/resources/stock_transfers.d.ts +1 -0
  506. package/lib/esm/resources/stock_transfers.js +4 -1
  507. package/lib/esm/resources/stripe_gateways.d.ts +1 -0
  508. package/lib/esm/resources/stripe_gateways.js +4 -1
  509. package/lib/esm/resources/stripe_payments.d.ts +1 -0
  510. package/lib/esm/resources/stripe_payments.js +4 -1
  511. package/lib/esm/resources/subscription_models.d.ts +1 -0
  512. package/lib/esm/resources/subscription_models.js +4 -1
  513. package/lib/esm/resources/tags.d.ts +1 -0
  514. package/lib/esm/resources/tags.js +4 -1
  515. package/lib/esm/resources/tax_calculators.d.ts +1 -0
  516. package/lib/esm/resources/tax_calculators.js +4 -1
  517. package/lib/esm/resources/tax_categories.d.ts +1 -0
  518. package/lib/esm/resources/tax_categories.js +4 -1
  519. package/lib/esm/resources/tax_rules.d.ts +1 -0
  520. package/lib/esm/resources/tax_rules.js +4 -1
  521. package/lib/esm/resources/taxjar_accounts.d.ts +1 -0
  522. package/lib/esm/resources/taxjar_accounts.js +4 -1
  523. package/lib/esm/resources/transactions.d.ts +1 -0
  524. package/lib/esm/resources/transactions.js +4 -1
  525. package/lib/esm/resources/versions.d.ts +1 -0
  526. package/lib/esm/resources/versions.js +4 -1
  527. package/lib/esm/resources/voids.d.ts +1 -0
  528. package/lib/esm/resources/voids.js +4 -1
  529. package/lib/esm/resources/webhooks.d.ts +1 -0
  530. package/lib/esm/resources/webhooks.js +4 -1
  531. package/lib/esm/resources/wire_transfers.d.ts +1 -0
  532. package/lib/esm/resources/wire_transfers.js +4 -1
  533. package/lib/esm/static.js +0 -1
  534. package/lib/esm/util.js +1 -27
  535. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  536. package/lib/tsconfig.tsbuildinfo +1 -1
  537. package/package.json +10 -14
@@ -3,282 +3,268 @@ import { CommerceLayerStatic } from './static';
3
3
  import ResourceAdapter from './resource';
4
4
  import Debug from './debug';
5
5
  const debug = Debug('commercelayer');
6
- // Autogenerated schema version number, do not remove this line
7
- const OPEN_API_SCHEMA_VERSION = '5.0.0';
6
+ const OPEN_API_SCHEMA_VERSION = '5.1.0';
8
7
  export { OPEN_API_SCHEMA_VERSION };
9
8
  class CommerceLayerClient {
10
- // static get openApiSchemaVersion(): string { return OPEN_API_SCHEMA_VERSION }
11
9
  openApiSchemaVersion = OPEN_API_SCHEMA_VERSION;
12
10
  #adapter;
11
+ #slug;
12
+ #addresses;
13
+ #adjustments;
14
+ #adyen_gateways;
15
+ #adyen_payments;
16
+ #application;
17
+ #attachments;
18
+ #authorizations;
19
+ #avalara_accounts;
20
+ #axerve_gateways;
21
+ #axerve_payments;
22
+ #billing_info_validation_rules;
23
+ #bing_geocoders;
24
+ #braintree_gateways;
25
+ #braintree_payments;
26
+ #bundles;
27
+ #buy_x_pay_y_promotions;
28
+ #captures;
29
+ #carrier_accounts;
30
+ #checkout_com_gateways;
31
+ #checkout_com_payments;
32
+ #cleanups;
33
+ #coupon_codes_promotion_rules;
34
+ #coupon_recipients;
35
+ #coupons;
36
+ #custom_promotion_rules;
37
+ #customer_addresses;
38
+ #customer_groups;
39
+ #customer_password_resets;
40
+ #customer_payment_sources;
41
+ #customer_subscriptions;
42
+ #customers;
43
+ #delivery_lead_times;
44
+ #event_callbacks;
45
+ #events;
46
+ #exports;
47
+ #external_gateways;
48
+ #external_payments;
49
+ #external_promotions;
50
+ #external_tax_calculators;
51
+ #fixed_amount_promotions;
52
+ #fixed_price_promotions;
53
+ #free_gift_promotions;
54
+ #free_shipping_promotions;
55
+ #geocoders;
56
+ #gift_card_recipients;
57
+ #gift_cards;
58
+ #google_geocoders;
59
+ #imports;
60
+ #in_stock_subscriptions;
61
+ #inventory_models;
62
+ #inventory_return_locations;
63
+ #inventory_stock_locations;
64
+ #klarna_gateways;
65
+ #klarna_payments;
66
+ #line_item_options;
67
+ #line_items;
68
+ #manual_gateways;
69
+ #manual_tax_calculators;
70
+ #markets;
71
+ #merchants;
72
+ #order_amount_promotion_rules;
73
+ #order_copies;
74
+ #order_factories;
75
+ #order_subscription_items;
76
+ #order_subscriptions;
77
+ #order_validation_rules;
78
+ #orders;
13
79
  #organization;
14
- // #environment: ApiMode = sdkConfig.default.environment
15
- // ##__CL_RESOURCES_DEF_START__##
16
- // ##__CL_RESOURCES_DEF_TEMPLATE:: ##__TAB__####__RESOURCE_TYPE__##: api.##__RESOURCE_CLASS__##
17
- addresses;
18
- adjustments;
19
- adyen_gateways;
20
- adyen_payments;
21
- application;
22
- attachments;
23
- authorizations;
24
- avalara_accounts;
25
- axerve_gateways;
26
- axerve_payments;
27
- billing_info_validation_rules;
28
- bing_geocoders;
29
- braintree_gateways;
30
- braintree_payments;
31
- bundles;
32
- buy_x_pay_y_promotions;
33
- captures;
34
- carrier_accounts;
35
- checkout_com_gateways;
36
- checkout_com_payments;
37
- cleanups;
38
- coupon_codes_promotion_rules;
39
- coupon_recipients;
40
- coupons;
41
- custom_promotion_rules;
42
- customer_addresses;
43
- customer_groups;
44
- customer_password_resets;
45
- customer_payment_sources;
46
- customer_subscriptions;
47
- customers;
48
- delivery_lead_times;
49
- event_callbacks;
50
- events;
51
- exports;
52
- external_gateways;
53
- external_payments;
54
- external_promotions;
55
- external_tax_calculators;
56
- fixed_amount_promotions;
57
- fixed_price_promotions;
58
- free_gift_promotions;
59
- free_shipping_promotions;
60
- geocoders;
61
- gift_card_recipients;
62
- gift_cards;
63
- google_geocoders;
64
- imports;
65
- in_stock_subscriptions;
66
- inventory_models;
67
- inventory_return_locations;
68
- inventory_stock_locations;
69
- klarna_gateways;
70
- klarna_payments;
71
- line_item_options;
72
- line_items;
73
- manual_gateways;
74
- manual_tax_calculators;
75
- markets;
76
- merchants;
77
- order_amount_promotion_rules;
78
- order_copies;
79
- order_factories;
80
- order_subscription_items;
81
- order_subscriptions;
82
- order_validation_rules;
83
- orders;
84
- organization;
85
- packages;
86
- parcel_line_items;
87
- parcels;
88
- payment_gateways;
89
- payment_methods;
90
- payment_options;
91
- paypal_gateways;
92
- paypal_payments;
93
- percentage_discount_promotions;
94
- price_frequency_tiers;
95
- price_lists;
96
- price_tiers;
97
- price_volume_tiers;
98
- prices;
99
- promotion_rules;
100
- promotions;
101
- recurring_order_copies;
102
- refunds;
103
- reserved_stocks;
104
- resource_errors;
105
- return_line_items;
106
- returns;
107
- satispay_gateways;
108
- satispay_payments;
109
- shipments;
110
- shipping_categories;
111
- shipping_method_tiers;
112
- shipping_methods;
113
- shipping_weight_tiers;
114
- shipping_zones;
115
- sku_list_items;
116
- sku_list_promotion_rules;
117
- sku_lists;
118
- sku_options;
119
- skus;
120
- stock_items;
121
- stock_line_items;
122
- stock_locations;
123
- stock_reservations;
124
- stock_transfers;
125
- stripe_gateways;
126
- stripe_payments;
127
- subscription_models;
128
- tags;
129
- tax_calculators;
130
- tax_categories;
131
- tax_rules;
132
- taxjar_accounts;
133
- transactions;
134
- versions;
135
- voids;
136
- webhooks;
137
- wire_transfers;
138
- // ##__CL_RESOURCES_DEF_STOP__##
80
+ #packages;
81
+ #parcel_line_items;
82
+ #parcels;
83
+ #payment_gateways;
84
+ #payment_methods;
85
+ #payment_options;
86
+ #paypal_gateways;
87
+ #paypal_payments;
88
+ #percentage_discount_promotions;
89
+ #price_frequency_tiers;
90
+ #price_lists;
91
+ #price_tiers;
92
+ #price_volume_tiers;
93
+ #prices;
94
+ #promotion_rules;
95
+ #promotions;
96
+ #recurring_order_copies;
97
+ #refunds;
98
+ #reserved_stocks;
99
+ #resource_errors;
100
+ #return_line_items;
101
+ #returns;
102
+ #satispay_gateways;
103
+ #satispay_payments;
104
+ #shipments;
105
+ #shipping_categories;
106
+ #shipping_method_tiers;
107
+ #shipping_methods;
108
+ #shipping_weight_tiers;
109
+ #shipping_zones;
110
+ #sku_list_items;
111
+ #sku_list_promotion_rules;
112
+ #sku_lists;
113
+ #sku_options;
114
+ #skus;
115
+ #stock_items;
116
+ #stock_line_items;
117
+ #stock_locations;
118
+ #stock_reservations;
119
+ #stock_transfers;
120
+ #stripe_gateways;
121
+ #stripe_payments;
122
+ #subscription_models;
123
+ #tags;
124
+ #tax_calculators;
125
+ #tax_categories;
126
+ #tax_rules;
127
+ #taxjar_accounts;
128
+ #transactions;
129
+ #versions;
130
+ #voids;
131
+ #webhooks;
132
+ #wire_transfers;
139
133
  constructor(config) {
140
134
  debug('new commercelayer instance %O', config);
141
135
  this.#adapter = new ResourceAdapter(config);
142
- this.#organization = config.organization;
143
- // this.#environment = 'test'
144
- // ##__CL_RESOURCES_INIT_START__##
145
- // ##__CL_RESOURCES_INIT_TEMPLATE:: ##__TAB__####__TAB__##this.##__RESOURCE_TYPE__## = new api.##__RESOURCE_CLASS__##(this.#adapter)
146
- this.addresses = new api.Addresses(this.#adapter);
147
- this.adjustments = new api.Adjustments(this.#adapter);
148
- this.adyen_gateways = new api.AdyenGateways(this.#adapter);
149
- this.adyen_payments = new api.AdyenPayments(this.#adapter);
150
- this.application = new api.Applications(this.#adapter);
151
- this.attachments = new api.Attachments(this.#adapter);
152
- this.authorizations = new api.Authorizations(this.#adapter);
153
- this.avalara_accounts = new api.AvalaraAccounts(this.#adapter);
154
- this.axerve_gateways = new api.AxerveGateways(this.#adapter);
155
- this.axerve_payments = new api.AxervePayments(this.#adapter);
156
- this.billing_info_validation_rules = new api.BillingInfoValidationRules(this.#adapter);
157
- this.bing_geocoders = new api.BingGeocoders(this.#adapter);
158
- this.braintree_gateways = new api.BraintreeGateways(this.#adapter);
159
- this.braintree_payments = new api.BraintreePayments(this.#adapter);
160
- this.bundles = new api.Bundles(this.#adapter);
161
- this.buy_x_pay_y_promotions = new api.BuyXPayYPromotions(this.#adapter);
162
- this.captures = new api.Captures(this.#adapter);
163
- this.carrier_accounts = new api.CarrierAccounts(this.#adapter);
164
- this.checkout_com_gateways = new api.CheckoutComGateways(this.#adapter);
165
- this.checkout_com_payments = new api.CheckoutComPayments(this.#adapter);
166
- this.cleanups = new api.Cleanups(this.#adapter);
167
- this.coupon_codes_promotion_rules = new api.CouponCodesPromotionRules(this.#adapter);
168
- this.coupon_recipients = new api.CouponRecipients(this.#adapter);
169
- this.coupons = new api.Coupons(this.#adapter);
170
- this.custom_promotion_rules = new api.CustomPromotionRules(this.#adapter);
171
- this.customer_addresses = new api.CustomerAddresses(this.#adapter);
172
- this.customer_groups = new api.CustomerGroups(this.#adapter);
173
- this.customer_password_resets = new api.CustomerPasswordResets(this.#adapter);
174
- this.customer_payment_sources = new api.CustomerPaymentSources(this.#adapter);
175
- this.customer_subscriptions = new api.CustomerSubscriptions(this.#adapter);
176
- this.customers = new api.Customers(this.#adapter);
177
- this.delivery_lead_times = new api.DeliveryLeadTimes(this.#adapter);
178
- this.event_callbacks = new api.EventCallbacks(this.#adapter);
179
- this.events = new api.Events(this.#adapter);
180
- this.exports = new api.Exports(this.#adapter);
181
- this.external_gateways = new api.ExternalGateways(this.#adapter);
182
- this.external_payments = new api.ExternalPayments(this.#adapter);
183
- this.external_promotions = new api.ExternalPromotions(this.#adapter);
184
- this.external_tax_calculators = new api.ExternalTaxCalculators(this.#adapter);
185
- this.fixed_amount_promotions = new api.FixedAmountPromotions(this.#adapter);
186
- this.fixed_price_promotions = new api.FixedPricePromotions(this.#adapter);
187
- this.free_gift_promotions = new api.FreeGiftPromotions(this.#adapter);
188
- this.free_shipping_promotions = new api.FreeShippingPromotions(this.#adapter);
189
- this.geocoders = new api.Geocoders(this.#adapter);
190
- this.gift_card_recipients = new api.GiftCardRecipients(this.#adapter);
191
- this.gift_cards = new api.GiftCards(this.#adapter);
192
- this.google_geocoders = new api.GoogleGeocoders(this.#adapter);
193
- this.imports = new api.Imports(this.#adapter);
194
- this.in_stock_subscriptions = new api.InStockSubscriptions(this.#adapter);
195
- this.inventory_models = new api.InventoryModels(this.#adapter);
196
- this.inventory_return_locations = new api.InventoryReturnLocations(this.#adapter);
197
- this.inventory_stock_locations = new api.InventoryStockLocations(this.#adapter);
198
- this.klarna_gateways = new api.KlarnaGateways(this.#adapter);
199
- this.klarna_payments = new api.KlarnaPayments(this.#adapter);
200
- this.line_item_options = new api.LineItemOptions(this.#adapter);
201
- this.line_items = new api.LineItems(this.#adapter);
202
- this.manual_gateways = new api.ManualGateways(this.#adapter);
203
- this.manual_tax_calculators = new api.ManualTaxCalculators(this.#adapter);
204
- this.markets = new api.Markets(this.#adapter);
205
- this.merchants = new api.Merchants(this.#adapter);
206
- this.order_amount_promotion_rules = new api.OrderAmountPromotionRules(this.#adapter);
207
- this.order_copies = new api.OrderCopies(this.#adapter);
208
- this.order_factories = new api.OrderFactories(this.#adapter);
209
- this.order_subscription_items = new api.OrderSubscriptionItems(this.#adapter);
210
- this.order_subscriptions = new api.OrderSubscriptions(this.#adapter);
211
- this.order_validation_rules = new api.OrderValidationRules(this.#adapter);
212
- this.orders = new api.Orders(this.#adapter);
213
- this.organization = new api.Organizations(this.#adapter);
214
- this.packages = new api.Packages(this.#adapter);
215
- this.parcel_line_items = new api.ParcelLineItems(this.#adapter);
216
- this.parcels = new api.Parcels(this.#adapter);
217
- this.payment_gateways = new api.PaymentGateways(this.#adapter);
218
- this.payment_methods = new api.PaymentMethods(this.#adapter);
219
- this.payment_options = new api.PaymentOptions(this.#adapter);
220
- this.paypal_gateways = new api.PaypalGateways(this.#adapter);
221
- this.paypal_payments = new api.PaypalPayments(this.#adapter);
222
- this.percentage_discount_promotions = new api.PercentageDiscountPromotions(this.#adapter);
223
- this.price_frequency_tiers = new api.PriceFrequencyTiers(this.#adapter);
224
- this.price_lists = new api.PriceLists(this.#adapter);
225
- this.price_tiers = new api.PriceTiers(this.#adapter);
226
- this.price_volume_tiers = new api.PriceVolumeTiers(this.#adapter);
227
- this.prices = new api.Prices(this.#adapter);
228
- this.promotion_rules = new api.PromotionRules(this.#adapter);
229
- this.promotions = new api.Promotions(this.#adapter);
230
- this.recurring_order_copies = new api.RecurringOrderCopies(this.#adapter);
231
- this.refunds = new api.Refunds(this.#adapter);
232
- this.reserved_stocks = new api.ReservedStocks(this.#adapter);
233
- this.resource_errors = new api.ResourceErrors(this.#adapter);
234
- this.return_line_items = new api.ReturnLineItems(this.#adapter);
235
- this.returns = new api.Returns(this.#adapter);
236
- this.satispay_gateways = new api.SatispayGateways(this.#adapter);
237
- this.satispay_payments = new api.SatispayPayments(this.#adapter);
238
- this.shipments = new api.Shipments(this.#adapter);
239
- this.shipping_categories = new api.ShippingCategories(this.#adapter);
240
- this.shipping_method_tiers = new api.ShippingMethodTiers(this.#adapter);
241
- this.shipping_methods = new api.ShippingMethods(this.#adapter);
242
- this.shipping_weight_tiers = new api.ShippingWeightTiers(this.#adapter);
243
- this.shipping_zones = new api.ShippingZones(this.#adapter);
244
- this.sku_list_items = new api.SkuListItems(this.#adapter);
245
- this.sku_list_promotion_rules = new api.SkuListPromotionRules(this.#adapter);
246
- this.sku_lists = new api.SkuLists(this.#adapter);
247
- this.sku_options = new api.SkuOptions(this.#adapter);
248
- this.skus = new api.Skus(this.#adapter);
249
- this.stock_items = new api.StockItems(this.#adapter);
250
- this.stock_line_items = new api.StockLineItems(this.#adapter);
251
- this.stock_locations = new api.StockLocations(this.#adapter);
252
- this.stock_reservations = new api.StockReservations(this.#adapter);
253
- this.stock_transfers = new api.StockTransfers(this.#adapter);
254
- this.stripe_gateways = new api.StripeGateways(this.#adapter);
255
- this.stripe_payments = new api.StripePayments(this.#adapter);
256
- this.subscription_models = new api.SubscriptionModels(this.#adapter);
257
- this.tags = new api.Tags(this.#adapter);
258
- this.tax_calculators = new api.TaxCalculators(this.#adapter);
259
- this.tax_categories = new api.TaxCategories(this.#adapter);
260
- this.tax_rules = new api.TaxRules(this.#adapter);
261
- this.taxjar_accounts = new api.TaxjarAccounts(this.#adapter);
262
- this.transactions = new api.Transactions(this.#adapter);
263
- this.versions = new api.Versions(this.#adapter);
264
- this.voids = new api.Voids(this.#adapter);
265
- this.webhooks = new api.Webhooks(this.#adapter);
266
- this.wire_transfers = new api.WireTransfers(this.#adapter);
267
- // ##__CL_RESOURCES_INIT_STOP__##
136
+ this.#slug = config.organization;
268
137
  }
269
- get currentOrganization() { return this.#organization; }
270
- // get currentAccessToken(): string { return this.#adapter?.clientInstance?.currentAccessToken}
271
- // get environment(): ApiMode { return this.#environment }
138
+ get addresses() { return this.#addresses || (this.#addresses = new api.Addresses(this.#adapter)); }
139
+ get adjustments() { return this.#adjustments || (this.#adjustments = new api.Adjustments(this.#adapter)); }
140
+ get adyen_gateways() { return this.#adyen_gateways || (this.#adyen_gateways = new api.AdyenGateways(this.#adapter)); }
141
+ get adyen_payments() { return this.#adyen_payments || (this.#adyen_payments = new api.AdyenPayments(this.#adapter)); }
142
+ get application() { return this.#application || (this.#application = new api.Applications(this.#adapter)); }
143
+ get attachments() { return this.#attachments || (this.#attachments = new api.Attachments(this.#adapter)); }
144
+ get authorizations() { return this.#authorizations || (this.#authorizations = new api.Authorizations(this.#adapter)); }
145
+ get avalara_accounts() { return this.#avalara_accounts || (this.#avalara_accounts = new api.AvalaraAccounts(this.#adapter)); }
146
+ get axerve_gateways() { return this.#axerve_gateways || (this.#axerve_gateways = new api.AxerveGateways(this.#adapter)); }
147
+ get axerve_payments() { return this.#axerve_payments || (this.#axerve_payments = new api.AxervePayments(this.#adapter)); }
148
+ get billing_info_validation_rules() { return this.#billing_info_validation_rules || (this.#billing_info_validation_rules = new api.BillingInfoValidationRules(this.#adapter)); }
149
+ get bing_geocoders() { return this.#bing_geocoders || (this.#bing_geocoders = new api.BingGeocoders(this.#adapter)); }
150
+ get braintree_gateways() { return this.#braintree_gateways || (this.#braintree_gateways = new api.BraintreeGateways(this.#adapter)); }
151
+ get braintree_payments() { return this.#braintree_payments || (this.#braintree_payments = new api.BraintreePayments(this.#adapter)); }
152
+ get bundles() { return this.#bundles || (this.#bundles = new api.Bundles(this.#adapter)); }
153
+ get buy_x_pay_y_promotions() { return this.#buy_x_pay_y_promotions || (this.#buy_x_pay_y_promotions = new api.BuyXPayYPromotions(this.#adapter)); }
154
+ get captures() { return this.#captures || (this.#captures = new api.Captures(this.#adapter)); }
155
+ get carrier_accounts() { return this.#carrier_accounts || (this.#carrier_accounts = new api.CarrierAccounts(this.#adapter)); }
156
+ get checkout_com_gateways() { return this.#checkout_com_gateways || (this.#checkout_com_gateways = new api.CheckoutComGateways(this.#adapter)); }
157
+ get checkout_com_payments() { return this.#checkout_com_payments || (this.#checkout_com_payments = new api.CheckoutComPayments(this.#adapter)); }
158
+ get cleanups() { return this.#cleanups || (this.#cleanups = new api.Cleanups(this.#adapter)); }
159
+ get coupon_codes_promotion_rules() { return this.#coupon_codes_promotion_rules || (this.#coupon_codes_promotion_rules = new api.CouponCodesPromotionRules(this.#adapter)); }
160
+ get coupon_recipients() { return this.#coupon_recipients || (this.#coupon_recipients = new api.CouponRecipients(this.#adapter)); }
161
+ get coupons() { return this.#coupons || (this.#coupons = new api.Coupons(this.#adapter)); }
162
+ get custom_promotion_rules() { return this.#custom_promotion_rules || (this.#custom_promotion_rules = new api.CustomPromotionRules(this.#adapter)); }
163
+ get customer_addresses() { return this.#customer_addresses || (this.#customer_addresses = new api.CustomerAddresses(this.#adapter)); }
164
+ get customer_groups() { return this.#customer_groups || (this.#customer_groups = new api.CustomerGroups(this.#adapter)); }
165
+ get customer_password_resets() { return this.#customer_password_resets || (this.#customer_password_resets = new api.CustomerPasswordResets(this.#adapter)); }
166
+ get customer_payment_sources() { return this.#customer_payment_sources || (this.#customer_payment_sources = new api.CustomerPaymentSources(this.#adapter)); }
167
+ get customer_subscriptions() { return this.#customer_subscriptions || (this.#customer_subscriptions = new api.CustomerSubscriptions(this.#adapter)); }
168
+ get customers() { return this.#customers || (this.#customers = new api.Customers(this.#adapter)); }
169
+ get delivery_lead_times() { return this.#delivery_lead_times || (this.#delivery_lead_times = new api.DeliveryLeadTimes(this.#adapter)); }
170
+ get event_callbacks() { return this.#event_callbacks || (this.#event_callbacks = new api.EventCallbacks(this.#adapter)); }
171
+ get events() { return this.#events || (this.#events = new api.Events(this.#adapter)); }
172
+ get exports() { return this.#exports || (this.#exports = new api.Exports(this.#adapter)); }
173
+ get external_gateways() { return this.#external_gateways || (this.#external_gateways = new api.ExternalGateways(this.#adapter)); }
174
+ get external_payments() { return this.#external_payments || (this.#external_payments = new api.ExternalPayments(this.#adapter)); }
175
+ get external_promotions() { return this.#external_promotions || (this.#external_promotions = new api.ExternalPromotions(this.#adapter)); }
176
+ get external_tax_calculators() { return this.#external_tax_calculators || (this.#external_tax_calculators = new api.ExternalTaxCalculators(this.#adapter)); }
177
+ get fixed_amount_promotions() { return this.#fixed_amount_promotions || (this.#fixed_amount_promotions = new api.FixedAmountPromotions(this.#adapter)); }
178
+ get fixed_price_promotions() { return this.#fixed_price_promotions || (this.#fixed_price_promotions = new api.FixedPricePromotions(this.#adapter)); }
179
+ get free_gift_promotions() { return this.#free_gift_promotions || (this.#free_gift_promotions = new api.FreeGiftPromotions(this.#adapter)); }
180
+ get free_shipping_promotions() { return this.#free_shipping_promotions || (this.#free_shipping_promotions = new api.FreeShippingPromotions(this.#adapter)); }
181
+ get geocoders() { return this.#geocoders || (this.#geocoders = new api.Geocoders(this.#adapter)); }
182
+ get gift_card_recipients() { return this.#gift_card_recipients || (this.#gift_card_recipients = new api.GiftCardRecipients(this.#adapter)); }
183
+ get gift_cards() { return this.#gift_cards || (this.#gift_cards = new api.GiftCards(this.#adapter)); }
184
+ get google_geocoders() { return this.#google_geocoders || (this.#google_geocoders = new api.GoogleGeocoders(this.#adapter)); }
185
+ get imports() { return this.#imports || (this.#imports = new api.Imports(this.#adapter)); }
186
+ get in_stock_subscriptions() { return this.#in_stock_subscriptions || (this.#in_stock_subscriptions = new api.InStockSubscriptions(this.#adapter)); }
187
+ get inventory_models() { return this.#inventory_models || (this.#inventory_models = new api.InventoryModels(this.#adapter)); }
188
+ get inventory_return_locations() { return this.#inventory_return_locations || (this.#inventory_return_locations = new api.InventoryReturnLocations(this.#adapter)); }
189
+ get inventory_stock_locations() { return this.#inventory_stock_locations || (this.#inventory_stock_locations = new api.InventoryStockLocations(this.#adapter)); }
190
+ get klarna_gateways() { return this.#klarna_gateways || (this.#klarna_gateways = new api.KlarnaGateways(this.#adapter)); }
191
+ get klarna_payments() { return this.#klarna_payments || (this.#klarna_payments = new api.KlarnaPayments(this.#adapter)); }
192
+ get line_item_options() { return this.#line_item_options || (this.#line_item_options = new api.LineItemOptions(this.#adapter)); }
193
+ get line_items() { return this.#line_items || (this.#line_items = new api.LineItems(this.#adapter)); }
194
+ get manual_gateways() { return this.#manual_gateways || (this.#manual_gateways = new api.ManualGateways(this.#adapter)); }
195
+ get manual_tax_calculators() { return this.#manual_tax_calculators || (this.#manual_tax_calculators = new api.ManualTaxCalculators(this.#adapter)); }
196
+ get markets() { return this.#markets || (this.#markets = new api.Markets(this.#adapter)); }
197
+ get merchants() { return this.#merchants || (this.#merchants = new api.Merchants(this.#adapter)); }
198
+ get order_amount_promotion_rules() { return this.#order_amount_promotion_rules || (this.#order_amount_promotion_rules = new api.OrderAmountPromotionRules(this.#adapter)); }
199
+ get order_copies() { return this.#order_copies || (this.#order_copies = new api.OrderCopies(this.#adapter)); }
200
+ get order_factories() { return this.#order_factories || (this.#order_factories = new api.OrderFactories(this.#adapter)); }
201
+ get order_subscription_items() { return this.#order_subscription_items || (this.#order_subscription_items = new api.OrderSubscriptionItems(this.#adapter)); }
202
+ get order_subscriptions() { return this.#order_subscriptions || (this.#order_subscriptions = new api.OrderSubscriptions(this.#adapter)); }
203
+ get order_validation_rules() { return this.#order_validation_rules || (this.#order_validation_rules = new api.OrderValidationRules(this.#adapter)); }
204
+ get orders() { return this.#orders || (this.#orders = new api.Orders(this.#adapter)); }
205
+ get organization() { return this.#organization || (this.#organization = new api.Organizations(this.#adapter)); }
206
+ get packages() { return this.#packages || (this.#packages = new api.Packages(this.#adapter)); }
207
+ get parcel_line_items() { return this.#parcel_line_items || (this.#parcel_line_items = new api.ParcelLineItems(this.#adapter)); }
208
+ get parcels() { return this.#parcels || (this.#parcels = new api.Parcels(this.#adapter)); }
209
+ get payment_gateways() { return this.#payment_gateways || (this.#payment_gateways = new api.PaymentGateways(this.#adapter)); }
210
+ get payment_methods() { return this.#payment_methods || (this.#payment_methods = new api.PaymentMethods(this.#adapter)); }
211
+ get payment_options() { return this.#payment_options || (this.#payment_options = new api.PaymentOptions(this.#adapter)); }
212
+ get paypal_gateways() { return this.#paypal_gateways || (this.#paypal_gateways = new api.PaypalGateways(this.#adapter)); }
213
+ get paypal_payments() { return this.#paypal_payments || (this.#paypal_payments = new api.PaypalPayments(this.#adapter)); }
214
+ get percentage_discount_promotions() { return this.#percentage_discount_promotions || (this.#percentage_discount_promotions = new api.PercentageDiscountPromotions(this.#adapter)); }
215
+ get price_frequency_tiers() { return this.#price_frequency_tiers || (this.#price_frequency_tiers = new api.PriceFrequencyTiers(this.#adapter)); }
216
+ get price_lists() { return this.#price_lists || (this.#price_lists = new api.PriceLists(this.#adapter)); }
217
+ get price_tiers() { return this.#price_tiers || (this.#price_tiers = new api.PriceTiers(this.#adapter)); }
218
+ get price_volume_tiers() { return this.#price_volume_tiers || (this.#price_volume_tiers = new api.PriceVolumeTiers(this.#adapter)); }
219
+ get prices() { return this.#prices || (this.#prices = new api.Prices(this.#adapter)); }
220
+ get promotion_rules() { return this.#promotion_rules || (this.#promotion_rules = new api.PromotionRules(this.#adapter)); }
221
+ get promotions() { return this.#promotions || (this.#promotions = new api.Promotions(this.#adapter)); }
222
+ get recurring_order_copies() { return this.#recurring_order_copies || (this.#recurring_order_copies = new api.RecurringOrderCopies(this.#adapter)); }
223
+ get refunds() { return this.#refunds || (this.#refunds = new api.Refunds(this.#adapter)); }
224
+ get reserved_stocks() { return this.#reserved_stocks || (this.#reserved_stocks = new api.ReservedStocks(this.#adapter)); }
225
+ get resource_errors() { return this.#resource_errors || (this.#resource_errors = new api.ResourceErrors(this.#adapter)); }
226
+ get return_line_items() { return this.#return_line_items || (this.#return_line_items = new api.ReturnLineItems(this.#adapter)); }
227
+ get returns() { return this.#returns || (this.#returns = new api.Returns(this.#adapter)); }
228
+ get satispay_gateways() { return this.#satispay_gateways || (this.#satispay_gateways = new api.SatispayGateways(this.#adapter)); }
229
+ get satispay_payments() { return this.#satispay_payments || (this.#satispay_payments = new api.SatispayPayments(this.#adapter)); }
230
+ get shipments() { return this.#shipments || (this.#shipments = new api.Shipments(this.#adapter)); }
231
+ get shipping_categories() { return this.#shipping_categories || (this.#shipping_categories = new api.ShippingCategories(this.#adapter)); }
232
+ get shipping_method_tiers() { return this.#shipping_method_tiers || (this.#shipping_method_tiers = new api.ShippingMethodTiers(this.#adapter)); }
233
+ get shipping_methods() { return this.#shipping_methods || (this.#shipping_methods = new api.ShippingMethods(this.#adapter)); }
234
+ get shipping_weight_tiers() { return this.#shipping_weight_tiers || (this.#shipping_weight_tiers = new api.ShippingWeightTiers(this.#adapter)); }
235
+ get shipping_zones() { return this.#shipping_zones || (this.#shipping_zones = new api.ShippingZones(this.#adapter)); }
236
+ get sku_list_items() { return this.#sku_list_items || (this.#sku_list_items = new api.SkuListItems(this.#adapter)); }
237
+ get sku_list_promotion_rules() { return this.#sku_list_promotion_rules || (this.#sku_list_promotion_rules = new api.SkuListPromotionRules(this.#adapter)); }
238
+ get sku_lists() { return this.#sku_lists || (this.#sku_lists = new api.SkuLists(this.#adapter)); }
239
+ get sku_options() { return this.#sku_options || (this.#sku_options = new api.SkuOptions(this.#adapter)); }
240
+ get skus() { return this.#skus || (this.#skus = new api.Skus(this.#adapter)); }
241
+ get stock_items() { return this.#stock_items || (this.#stock_items = new api.StockItems(this.#adapter)); }
242
+ get stock_line_items() { return this.#stock_line_items || (this.#stock_line_items = new api.StockLineItems(this.#adapter)); }
243
+ get stock_locations() { return this.#stock_locations || (this.#stock_locations = new api.StockLocations(this.#adapter)); }
244
+ get stock_reservations() { return this.#stock_reservations || (this.#stock_reservations = new api.StockReservations(this.#adapter)); }
245
+ get stock_transfers() { return this.#stock_transfers || (this.#stock_transfers = new api.StockTransfers(this.#adapter)); }
246
+ get stripe_gateways() { return this.#stripe_gateways || (this.#stripe_gateways = new api.StripeGateways(this.#adapter)); }
247
+ get stripe_payments() { return this.#stripe_payments || (this.#stripe_payments = new api.StripePayments(this.#adapter)); }
248
+ get subscription_models() { return this.#subscription_models || (this.#subscription_models = new api.SubscriptionModels(this.#adapter)); }
249
+ get tags() { return this.#tags || (this.#tags = new api.Tags(this.#adapter)); }
250
+ get tax_calculators() { return this.#tax_calculators || (this.#tax_calculators = new api.TaxCalculators(this.#adapter)); }
251
+ get tax_categories() { return this.#tax_categories || (this.#tax_categories = new api.TaxCategories(this.#adapter)); }
252
+ get tax_rules() { return this.#tax_rules || (this.#tax_rules = new api.TaxRules(this.#adapter)); }
253
+ get taxjar_accounts() { return this.#taxjar_accounts || (this.#taxjar_accounts = new api.TaxjarAccounts(this.#adapter)); }
254
+ get transactions() { return this.#transactions || (this.#transactions = new api.Transactions(this.#adapter)); }
255
+ get versions() { return this.#versions || (this.#versions = new api.Versions(this.#adapter)); }
256
+ get voids() { return this.#voids || (this.#voids = new api.Voids(this.#adapter)); }
257
+ get webhooks() { return this.#webhooks || (this.#webhooks = new api.Webhooks(this.#adapter)); }
258
+ get wire_transfers() { return this.#wire_transfers || (this.#wire_transfers = new api.WireTransfers(this.#adapter)); }
259
+ get currentOrganization() { return this.#slug; }
260
+ get interceptors() { return this.#adapter.client.interceptors; }
272
261
  localConfig(config) {
273
262
  if (config.organization)
274
- this.#organization = config.organization;
263
+ this.#slug = config.organization;
275
264
  }
276
265
  config(config) {
277
266
  debug('config %o', config);
278
- // CommerceLayer config
279
267
  this.localConfig(config);
280
- // ResourceAdapter config
281
- // To rebuild baseUrl in client in case only the domain is defined
282
268
  if (!config.organization)
283
269
  config.organization = this.currentOrganization;
284
270
  this.#adapter.config(config);
@@ -293,39 +279,41 @@ class CommerceLayerClient {
293
279
  isSingleton(resource) {
294
280
  return CommerceLayerStatic.isSingleton(resource);
295
281
  }
296
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
297
282
  isApiError(error) {
298
283
  return CommerceLayerStatic.isApiError(error);
299
284
  }
300
- addRequestInterceptor(onFulfilled, onRejected) {
301
- return this.#adapter.interceptors.request.use(onFulfilled, onRejected);
285
+ addRequestInterceptor(onSuccess, onFailure) {
286
+ this.interceptors.request = { onSuccess, onFailure };
302
287
  }
303
- addResponseInterceptor(onFulfilled, onRejected) {
304
- return this.#adapter.interceptors.response.use(onFulfilled, onRejected);
288
+ addResponseInterceptor(onSuccess, onFailure) {
289
+ this.interceptors.response = { onSuccess, onFailure };
305
290
  }
306
- removeInterceptor(type, id) {
307
- this.#adapter.interceptors[type].eject(id);
291
+ removeInterceptor(type, id = 1) {
292
+ this.interceptors[type] = undefined;
308
293
  }
309
294
  addRawResponseReader(options) {
310
295
  const reader = {
311
296
  id: undefined,
312
297
  rawResponse: undefined,
313
298
  headers: undefined,
299
+ ok: true
314
300
  };
315
- function rawResponseInterceptor(response) {
316
- reader.rawResponse = response?.data;
317
- if (options?.headers)
318
- reader.headers = response.headers;
301
+ async function rawResponseInterceptor(response) {
302
+ reader.rawResponse = await response?.clone().json().catch(() => { });
303
+ reader.ok = response.ok;
304
+ if (options?.headers) {
305
+ const ho = {};
306
+ response.headers.forEach((value, key) => { ho[key] = value; });
307
+ reader.headers = ho;
308
+ }
319
309
  return response;
320
310
  }
321
- const interceptor = this.addResponseInterceptor(rawResponseInterceptor);
322
- reader.id = interceptor;
311
+ this.interceptors.rawReader = { onSuccess: rawResponseInterceptor, onFailure: rawResponseInterceptor };
312
+ reader.id = 1;
323
313
  return reader;
324
314
  }
325
- removeRawResponseReader(reader) {
326
- const id = (typeof reader === 'number') ? reader : reader?.id;
327
- if (id && (id >= 0))
328
- this.removeInterceptor('response', id);
315
+ removeRawResponseReader() {
316
+ this.interceptors.rawReader = undefined;
329
317
  }
330
318
  }
331
319
  const CommerceLayer = (config) => {
package/lib/esm/common.js CHANGED
@@ -6,14 +6,3 @@ const isResourceType = (resource) => {
6
6
  return resource && (typeof resource.type !== 'undefined') && resource.type && resourceList.includes(resource.type);
7
7
  };
8
8
  export { isResourceId, isResourceType };
9
- /*
10
- // Nullable types
11
- type StringNullable = string | null
12
- type NumberNullable = number | null
13
- type BooleanNullable = boolean | null
14
- type ResourceNullable<R extends Resource> = R | null
15
- type ResourceArrayNullable<R extends Resource> = R[] | null
16
-
17
-
18
- export type { StringNullable, NumberNullable, BooleanNullable, ResourceNullable, ResourceArrayNullable }
19
- */
@@ -8,5 +8,8 @@ declare const config: {
8
8
  readonly timeout: 15000;
9
9
  readonly requiredAttributes: readonly ["organization", "accessToken"];
10
10
  };
11
+ readonly jsonapi: {
12
+ readonly maxResourceIncluded: 2;
13
+ };
11
14
  };
12
15
  export default config;
package/lib/esm/config.js CHANGED
@@ -1,7 +1,5 @@
1
- // export type ApiMode = 'test' | 'live'
2
1
  const config = {
3
2
  default: {
4
- // environment: 'test',
5
3
  domain: 'commercelayer.io',
6
4
  pageNumber: 1,
7
5
  pageSize: 10,
@@ -9,6 +7,9 @@ const config = {
9
7
  client: {
10
8
  timeout: 15000,
11
9
  requiredAttributes: ['organization', 'accessToken'],
10
+ },
11
+ jsonapi: {
12
+ maxResourceIncluded: 2
12
13
  }
13
14
  };
14
15
  export default config;