@commercelayer/sdk 4.22.0 → 4.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (479) hide show
  1. package/lib/cjs/api.d.ts +109 -1
  2. package/lib/cjs/api.js +343 -1
  3. package/lib/cjs/client.d.ts +31 -1
  4. package/lib/cjs/client.js +123 -1
  5. package/lib/cjs/commercelayer.d.ts +135 -1
  6. package/lib/cjs/commercelayer.js +226 -1
  7. package/lib/cjs/common.d.ts +4 -1
  8. package/lib/cjs/common.js +14 -1
  9. package/lib/cjs/config.d.ts +11 -1
  10. package/lib/cjs/config.js +13 -1
  11. package/lib/cjs/debug.d.ts +3 -1
  12. package/lib/cjs/debug.js +42 -1
  13. package/lib/cjs/error.d.ts +28 -1
  14. package/lib/cjs/error.js +43 -1
  15. package/lib/cjs/index.d.ts +7 -1
  16. package/lib/cjs/index.js +29 -1
  17. package/lib/cjs/interceptor.d.ts +21 -1
  18. package/lib/cjs/interceptor.js +2 -1
  19. package/lib/cjs/jsonapi.d.ts +5 -1
  20. package/lib/cjs/jsonapi.js +82 -1
  21. package/lib/cjs/model.d.ts +107 -1
  22. package/lib/cjs/model.js +3 -1
  23. package/lib/cjs/query.d.ts +23 -1
  24. package/lib/cjs/query.js +51 -1
  25. package/lib/cjs/resource.d.ts +77 -1
  26. package/lib/cjs/resource.js +145 -1
  27. package/lib/cjs/resources/addresses.d.ts +88 -1
  28. package/lib/cjs/resources/addresses.js +37 -1
  29. package/lib/cjs/resources/adjustments.d.ts +35 -1
  30. package/lib/cjs/resources/adjustments.js +33 -1
  31. package/lib/cjs/resources/adyen_gateways.d.ts +56 -1
  32. package/lib/cjs/resources/adyen_gateways.js +41 -1
  33. package/lib/cjs/resources/adyen_payments.d.ts +46 -1
  34. package/lib/cjs/resources/adyen_payments.js +41 -1
  35. package/lib/cjs/resources/application.d.ts +21 -1
  36. package/lib/cjs/resources/application.js +21 -1
  37. package/lib/cjs/resources/attachments.d.ts +156 -1
  38. package/lib/cjs/resources/attachments.js +33 -1
  39. package/lib/cjs/resources/authorizations.d.ts +60 -1
  40. package/lib/cjs/resources/authorizations.js +43 -1
  41. package/lib/cjs/resources/avalara_accounts.d.ts +55 -1
  42. package/lib/cjs/resources/avalara_accounts.js +45 -1
  43. package/lib/cjs/resources/billing_info_validation_rules.d.ts +35 -1
  44. package/lib/cjs/resources/billing_info_validation_rules.js +41 -1
  45. package/lib/cjs/resources/bing_geocoders.d.ts +35 -1
  46. package/lib/cjs/resources/bing_geocoders.js +41 -1
  47. package/lib/cjs/resources/braintree_gateways.d.ts +56 -1
  48. package/lib/cjs/resources/braintree_gateways.js +41 -1
  49. package/lib/cjs/resources/braintree_payments.d.ts +48 -1
  50. package/lib/cjs/resources/braintree_payments.js +41 -1
  51. package/lib/cjs/resources/bundles.d.ts +76 -1
  52. package/lib/cjs/resources/bundles.js +49 -1
  53. package/lib/cjs/resources/captures.d.ts +51 -1
  54. package/lib/cjs/resources/captures.js +43 -1
  55. package/lib/cjs/resources/carrier_accounts.d.ts +26 -1
  56. package/lib/cjs/resources/carrier_accounts.js +32 -1
  57. package/lib/cjs/resources/checkout_com_gateways.d.ts +45 -1
  58. package/lib/cjs/resources/checkout_com_gateways.js +41 -1
  59. package/lib/cjs/resources/checkout_com_payments.d.ts +59 -1
  60. package/lib/cjs/resources/checkout_com_payments.js +41 -1
  61. package/lib/cjs/resources/cleanups.d.ts +36 -1
  62. package/lib/cjs/resources/cleanups.js +34 -1
  63. package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +59 -1
  64. package/lib/cjs/resources/coupon_codes_promotion_rules.js +37 -1
  65. package/lib/cjs/resources/coupon_recipients.d.ts +44 -1
  66. package/lib/cjs/resources/coupon_recipients.js +41 -1
  67. package/lib/cjs/resources/coupons.d.ts +45 -1
  68. package/lib/cjs/resources/coupons.js +37 -1
  69. package/lib/cjs/resources/customer_addresses.d.ts +44 -1
  70. package/lib/cjs/resources/customer_addresses.js +45 -1
  71. package/lib/cjs/resources/customer_groups.d.ts +36 -1
  72. package/lib/cjs/resources/customer_groups.js +45 -1
  73. package/lib/cjs/resources/customer_password_resets.d.ts +36 -1
  74. package/lib/cjs/resources/customer_password_resets.js +41 -1
  75. package/lib/cjs/resources/customer_payment_sources.d.ts +70 -1
  76. package/lib/cjs/resources/customer_payment_sources.js +37 -1
  77. package/lib/cjs/resources/customer_subscriptions.d.ts +31 -1
  78. package/lib/cjs/resources/customer_subscriptions.js +41 -1
  79. package/lib/cjs/resources/customers.d.ts +66 -1
  80. package/lib/cjs/resources/customers.js +73 -1
  81. package/lib/cjs/resources/delivery_lead_times.d.ts +51 -1
  82. package/lib/cjs/resources/delivery_lead_times.js +45 -1
  83. package/lib/cjs/resources/event_callbacks.d.ts +24 -1
  84. package/lib/cjs/resources/event_callbacks.js +28 -1
  85. package/lib/cjs/resources/events.d.ts +24 -1
  86. package/lib/cjs/resources/events.js +32 -1
  87. package/lib/cjs/resources/exports.d.ts +40 -1
  88. package/lib/cjs/resources/exports.js +34 -1
  89. package/lib/cjs/resources/external_gateways.d.ts +49 -1
  90. package/lib/cjs/resources/external_gateways.js +41 -1
  91. package/lib/cjs/resources/external_payments.d.ts +44 -1
  92. package/lib/cjs/resources/external_payments.js +45 -1
  93. package/lib/cjs/resources/external_promotions.d.ts +90 -1
  94. package/lib/cjs/resources/external_promotions.js +57 -1
  95. package/lib/cjs/resources/external_tax_calculators.d.ts +37 -1
  96. package/lib/cjs/resources/external_tax_calculators.js +41 -1
  97. package/lib/cjs/resources/fixed_amount_promotions.d.ts +91 -1
  98. package/lib/cjs/resources/fixed_amount_promotions.js +57 -1
  99. package/lib/cjs/resources/fixed_price_promotions.d.ts +102 -1
  100. package/lib/cjs/resources/fixed_price_promotions.js +65 -1
  101. package/lib/cjs/resources/free_gift_promotions.d.ts +100 -1
  102. package/lib/cjs/resources/free_gift_promotions.js +65 -1
  103. package/lib/cjs/resources/free_shipping_promotions.d.ts +83 -1
  104. package/lib/cjs/resources/free_shipping_promotions.js +53 -1
  105. package/lib/cjs/resources/geocoders.d.ts +24 -1
  106. package/lib/cjs/resources/geocoders.js +32 -1
  107. package/lib/cjs/resources/gift_card_recipients.d.ts +44 -1
  108. package/lib/cjs/resources/gift_card_recipients.js +41 -1
  109. package/lib/cjs/resources/gift_cards.d.ts +85 -1
  110. package/lib/cjs/resources/gift_cards.js +49 -1
  111. package/lib/cjs/resources/google_geocoders.d.ts +35 -1
  112. package/lib/cjs/resources/google_geocoders.js +41 -1
  113. package/lib/cjs/resources/imports.d.ts +45 -1
  114. package/lib/cjs/resources/imports.js +34 -1
  115. package/lib/cjs/resources/in_stock_subscriptions.d.ts +62 -1
  116. package/lib/cjs/resources/in_stock_subscriptions.js +49 -1
  117. package/lib/cjs/resources/inventory_models.d.ts +42 -1
  118. package/lib/cjs/resources/inventory_models.js +45 -1
  119. package/lib/cjs/resources/inventory_return_locations.d.ts +43 -1
  120. package/lib/cjs/resources/inventory_return_locations.js +41 -1
  121. package/lib/cjs/resources/inventory_stock_locations.d.ts +46 -1
  122. package/lib/cjs/resources/inventory_stock_locations.js +41 -1
  123. package/lib/cjs/resources/klarna_gateways.d.ts +44 -1
  124. package/lib/cjs/resources/klarna_gateways.js +41 -1
  125. package/lib/cjs/resources/klarna_payments.d.ts +46 -1
  126. package/lib/cjs/resources/klarna_payments.js +41 -1
  127. package/lib/cjs/resources/line_item_options.d.ts +57 -1
  128. package/lib/cjs/resources/line_item_options.js +41 -1
  129. package/lib/cjs/resources/line_items.d.ts +126 -1
  130. package/lib/cjs/resources/line_items.js +49 -1
  131. package/lib/cjs/resources/manual_gateways.d.ts +33 -1
  132. package/lib/cjs/resources/manual_gateways.js +37 -1
  133. package/lib/cjs/resources/manual_tax_calculators.d.ts +41 -1
  134. package/lib/cjs/resources/manual_tax_calculators.js +45 -1
  135. package/lib/cjs/resources/markets.d.ts +88 -1
  136. package/lib/cjs/resources/markets.js +57 -1
  137. package/lib/cjs/resources/merchants.d.ts +38 -1
  138. package/lib/cjs/resources/merchants.js +41 -1
  139. package/lib/cjs/resources/order_amount_promotion_rules.d.ts +56 -1
  140. package/lib/cjs/resources/order_amount_promotion_rules.js +33 -1
  141. package/lib/cjs/resources/order_copies.d.ts +48 -1
  142. package/lib/cjs/resources/order_copies.js +46 -1
  143. package/lib/cjs/resources/order_subscriptions.d.ts +70 -1
  144. package/lib/cjs/resources/order_subscriptions.js +57 -1
  145. package/lib/cjs/resources/order_validation_rules.d.ts +23 -1
  146. package/lib/cjs/resources/order_validation_rules.js +32 -1
  147. package/lib/cjs/resources/orders.d.ts +288 -1
  148. package/lib/cjs/resources/orders.js +113 -1
  149. package/lib/cjs/resources/organization.d.ts +32 -1
  150. package/lib/cjs/resources/organization.js +21 -1
  151. package/lib/cjs/resources/packages.d.ts +56 -1
  152. package/lib/cjs/resources/packages.js +45 -1
  153. package/lib/cjs/resources/parcel_line_items.d.ts +51 -1
  154. package/lib/cjs/resources/parcel_line_items.js +41 -1
  155. package/lib/cjs/resources/parcels.d.ts +119 -1
  156. package/lib/cjs/resources/parcels.js +53 -1
  157. package/lib/cjs/resources/payment_gateways.d.ts +21 -1
  158. package/lib/cjs/resources/payment_gateways.js +28 -1
  159. package/lib/cjs/resources/payment_methods.d.ts +61 -1
  160. package/lib/cjs/resources/payment_methods.js +45 -1
  161. package/lib/cjs/resources/paypal_gateways.d.ts +37 -1
  162. package/lib/cjs/resources/paypal_gateways.js +41 -1
  163. package/lib/cjs/resources/paypal_payments.d.ts +52 -1
  164. package/lib/cjs/resources/paypal_payments.js +41 -1
  165. package/lib/cjs/resources/percentage_discount_promotions.d.ts +100 -1
  166. package/lib/cjs/resources/percentage_discount_promotions.js +65 -1
  167. package/lib/cjs/resources/price_lists.d.ts +39 -1
  168. package/lib/cjs/resources/price_lists.js +41 -1
  169. package/lib/cjs/resources/price_tiers.d.ts +28 -1
  170. package/lib/cjs/resources/price_tiers.js +32 -1
  171. package/lib/cjs/resources/price_volume_tiers.d.ts +46 -1
  172. package/lib/cjs/resources/price_volume_tiers.js +41 -1
  173. package/lib/cjs/resources/prices.d.ts +68 -1
  174. package/lib/cjs/resources/prices.js +53 -1
  175. package/lib/cjs/resources/promotion_rules.d.ts +24 -1
  176. package/lib/cjs/resources/promotion_rules.js +24 -1
  177. package/lib/cjs/resources/promotions.d.ts +41 -1
  178. package/lib/cjs/resources/promotions.js +44 -1
  179. package/lib/cjs/resources/refunds.d.ts +37 -1
  180. package/lib/cjs/resources/refunds.js +36 -1
  181. package/lib/cjs/resources/return_line_items.d.ts +49 -1
  182. package/lib/cjs/resources/return_line_items.js +41 -1
  183. package/lib/cjs/resources/returns.d.ts +75 -1
  184. package/lib/cjs/resources/returns.js +65 -1
  185. package/lib/cjs/resources/shipments.d.ts +93 -1
  186. package/lib/cjs/resources/shipments.js +83 -1
  187. package/lib/cjs/resources/shipping_categories.d.ts +33 -1
  188. package/lib/cjs/resources/shipping_categories.js +41 -1
  189. package/lib/cjs/resources/shipping_method_tiers.d.ts +28 -1
  190. package/lib/cjs/resources/shipping_method_tiers.js +32 -1
  191. package/lib/cjs/resources/shipping_methods.d.ts +107 -1
  192. package/lib/cjs/resources/shipping_methods.js +65 -1
  193. package/lib/cjs/resources/shipping_weight_tiers.d.ts +46 -1
  194. package/lib/cjs/resources/shipping_weight_tiers.js +41 -1
  195. package/lib/cjs/resources/shipping_zones.d.ts +48 -1
  196. package/lib/cjs/resources/shipping_zones.js +37 -1
  197. package/lib/cjs/resources/sku_list_items.d.ts +47 -1
  198. package/lib/cjs/resources/sku_list_items.js +41 -1
  199. package/lib/cjs/resources/sku_list_promotion_rules.d.ts +68 -1
  200. package/lib/cjs/resources/sku_list_promotion_rules.js +41 -1
  201. package/lib/cjs/resources/sku_lists.d.ts +60 -1
  202. package/lib/cjs/resources/sku_lists.js +53 -1
  203. package/lib/cjs/resources/sku_options.d.ts +56 -1
  204. package/lib/cjs/resources/sku_options.js +41 -1
  205. package/lib/cjs/resources/skus.d.ts +78 -1
  206. package/lib/cjs/resources/skus.js +57 -1
  207. package/lib/cjs/resources/stock_items.d.ts +49 -1
  208. package/lib/cjs/resources/stock_items.js +45 -1
  209. package/lib/cjs/resources/stock_line_items.d.ts +29 -1
  210. package/lib/cjs/resources/stock_line_items.js +36 -1
  211. package/lib/cjs/resources/stock_locations.d.ts +57 -1
  212. package/lib/cjs/resources/stock_locations.js +57 -1
  213. package/lib/cjs/resources/stock_transfers.d.ts +74 -1
  214. package/lib/cjs/resources/stock_transfers.js +57 -1
  215. package/lib/cjs/resources/stripe_gateways.d.ts +41 -1
  216. package/lib/cjs/resources/stripe_gateways.js +41 -1
  217. package/lib/cjs/resources/stripe_payments.d.ts +47 -1
  218. package/lib/cjs/resources/stripe_payments.js +41 -1
  219. package/lib/cjs/resources/tax_calculators.d.ts +24 -1
  220. package/lib/cjs/resources/tax_calculators.js +32 -1
  221. package/lib/cjs/resources/tax_categories.d.ts +59 -1
  222. package/lib/cjs/resources/tax_categories.js +41 -1
  223. package/lib/cjs/resources/tax_rules.d.ts +69 -1
  224. package/lib/cjs/resources/tax_rules.js +37 -1
  225. package/lib/cjs/resources/taxjar_accounts.d.ts +43 -1
  226. package/lib/cjs/resources/taxjar_accounts.js +45 -1
  227. package/lib/cjs/resources/transactions.d.ts +31 -1
  228. package/lib/cjs/resources/transactions.js +28 -1
  229. package/lib/cjs/resources/voids.d.ts +37 -1
  230. package/lib/cjs/resources/voids.js +36 -1
  231. package/lib/cjs/resources/webhooks.d.ts +43 -1
  232. package/lib/cjs/resources/webhooks.js +37 -1
  233. package/lib/cjs/resources/wire_transfers.d.ts +33 -1
  234. package/lib/cjs/resources/wire_transfers.js +37 -1
  235. package/lib/cjs/static.d.ts +9 -1
  236. package/lib/cjs/static.js +45 -1
  237. package/lib/cjs/util.d.ts +6 -1
  238. package/lib/cjs/util.js +15 -1
  239. package/lib/esm/api.d.ts +109 -1
  240. package/lib/esm/api.js +231 -1
  241. package/lib/esm/client.d.ts +31 -1
  242. package/lib/esm/client.js +118 -1
  243. package/lib/esm/commercelayer.d.ts +135 -1
  244. package/lib/esm/commercelayer.js +197 -1
  245. package/lib/esm/common.d.ts +4 -1
  246. package/lib/esm/common.js +10 -1
  247. package/lib/esm/config.d.ts +11 -1
  248. package/lib/esm/config.js +11 -1
  249. package/lib/esm/debug.d.ts +3 -1
  250. package/lib/esm/debug.js +40 -1
  251. package/lib/esm/error.d.ts +28 -1
  252. package/lib/esm/error.js +38 -1
  253. package/lib/esm/index.d.ts +7 -1
  254. package/lib/esm/index.js +6 -1
  255. package/lib/esm/interceptor.d.ts +21 -1
  256. package/lib/esm/interceptor.js +1 -1
  257. package/lib/esm/jsonapi.d.ts +5 -1
  258. package/lib/esm/jsonapi.js +75 -1
  259. package/lib/esm/model.d.ts +107 -1
  260. package/lib/esm/model.js +2 -1
  261. package/lib/esm/query.d.ts +23 -1
  262. package/lib/esm/query.js +45 -1
  263. package/lib/esm/resource.d.ts +77 -1
  264. package/lib/esm/resource.js +139 -1
  265. package/lib/esm/resources/addresses.d.ts +88 -1
  266. package/lib/esm/resources/addresses.js +35 -1
  267. package/lib/esm/resources/adjustments.d.ts +35 -1
  268. package/lib/esm/resources/adjustments.js +31 -1
  269. package/lib/esm/resources/adyen_gateways.d.ts +56 -1
  270. package/lib/esm/resources/adyen_gateways.js +39 -1
  271. package/lib/esm/resources/adyen_payments.d.ts +46 -1
  272. package/lib/esm/resources/adyen_payments.js +39 -1
  273. package/lib/esm/resources/application.d.ts +21 -1
  274. package/lib/esm/resources/application.js +19 -1
  275. package/lib/esm/resources/attachments.d.ts +156 -1
  276. package/lib/esm/resources/attachments.js +31 -1
  277. package/lib/esm/resources/authorizations.d.ts +60 -1
  278. package/lib/esm/resources/authorizations.js +41 -1
  279. package/lib/esm/resources/avalara_accounts.d.ts +55 -1
  280. package/lib/esm/resources/avalara_accounts.js +43 -1
  281. package/lib/esm/resources/billing_info_validation_rules.d.ts +35 -1
  282. package/lib/esm/resources/billing_info_validation_rules.js +39 -1
  283. package/lib/esm/resources/bing_geocoders.d.ts +35 -1
  284. package/lib/esm/resources/bing_geocoders.js +39 -1
  285. package/lib/esm/resources/braintree_gateways.d.ts +56 -1
  286. package/lib/esm/resources/braintree_gateways.js +39 -1
  287. package/lib/esm/resources/braintree_payments.d.ts +48 -1
  288. package/lib/esm/resources/braintree_payments.js +39 -1
  289. package/lib/esm/resources/bundles.d.ts +76 -1
  290. package/lib/esm/resources/bundles.js +47 -1
  291. package/lib/esm/resources/captures.d.ts +51 -1
  292. package/lib/esm/resources/captures.js +41 -1
  293. package/lib/esm/resources/carrier_accounts.d.ts +26 -1
  294. package/lib/esm/resources/carrier_accounts.js +30 -1
  295. package/lib/esm/resources/checkout_com_gateways.d.ts +45 -1
  296. package/lib/esm/resources/checkout_com_gateways.js +39 -1
  297. package/lib/esm/resources/checkout_com_payments.d.ts +59 -1
  298. package/lib/esm/resources/checkout_com_payments.js +39 -1
  299. package/lib/esm/resources/cleanups.d.ts +36 -1
  300. package/lib/esm/resources/cleanups.js +32 -1
  301. package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +59 -1
  302. package/lib/esm/resources/coupon_codes_promotion_rules.js +35 -1
  303. package/lib/esm/resources/coupon_recipients.d.ts +44 -1
  304. package/lib/esm/resources/coupon_recipients.js +39 -1
  305. package/lib/esm/resources/coupons.d.ts +45 -1
  306. package/lib/esm/resources/coupons.js +35 -1
  307. package/lib/esm/resources/customer_addresses.d.ts +44 -1
  308. package/lib/esm/resources/customer_addresses.js +43 -1
  309. package/lib/esm/resources/customer_groups.d.ts +36 -1
  310. package/lib/esm/resources/customer_groups.js +43 -1
  311. package/lib/esm/resources/customer_password_resets.d.ts +36 -1
  312. package/lib/esm/resources/customer_password_resets.js +39 -1
  313. package/lib/esm/resources/customer_payment_sources.d.ts +70 -1
  314. package/lib/esm/resources/customer_payment_sources.js +35 -1
  315. package/lib/esm/resources/customer_subscriptions.d.ts +31 -1
  316. package/lib/esm/resources/customer_subscriptions.js +39 -1
  317. package/lib/esm/resources/customers.d.ts +66 -1
  318. package/lib/esm/resources/customers.js +71 -1
  319. package/lib/esm/resources/delivery_lead_times.d.ts +51 -1
  320. package/lib/esm/resources/delivery_lead_times.js +43 -1
  321. package/lib/esm/resources/event_callbacks.d.ts +24 -1
  322. package/lib/esm/resources/event_callbacks.js +26 -1
  323. package/lib/esm/resources/events.d.ts +24 -1
  324. package/lib/esm/resources/events.js +30 -1
  325. package/lib/esm/resources/exports.d.ts +40 -1
  326. package/lib/esm/resources/exports.js +32 -1
  327. package/lib/esm/resources/external_gateways.d.ts +49 -1
  328. package/lib/esm/resources/external_gateways.js +39 -1
  329. package/lib/esm/resources/external_payments.d.ts +44 -1
  330. package/lib/esm/resources/external_payments.js +43 -1
  331. package/lib/esm/resources/external_promotions.d.ts +90 -1
  332. package/lib/esm/resources/external_promotions.js +55 -1
  333. package/lib/esm/resources/external_tax_calculators.d.ts +37 -1
  334. package/lib/esm/resources/external_tax_calculators.js +39 -1
  335. package/lib/esm/resources/fixed_amount_promotions.d.ts +91 -1
  336. package/lib/esm/resources/fixed_amount_promotions.js +55 -1
  337. package/lib/esm/resources/fixed_price_promotions.d.ts +102 -1
  338. package/lib/esm/resources/fixed_price_promotions.js +63 -1
  339. package/lib/esm/resources/free_gift_promotions.d.ts +100 -1
  340. package/lib/esm/resources/free_gift_promotions.js +63 -1
  341. package/lib/esm/resources/free_shipping_promotions.d.ts +83 -1
  342. package/lib/esm/resources/free_shipping_promotions.js +51 -1
  343. package/lib/esm/resources/geocoders.d.ts +24 -1
  344. package/lib/esm/resources/geocoders.js +30 -1
  345. package/lib/esm/resources/gift_card_recipients.d.ts +44 -1
  346. package/lib/esm/resources/gift_card_recipients.js +39 -1
  347. package/lib/esm/resources/gift_cards.d.ts +85 -1
  348. package/lib/esm/resources/gift_cards.js +47 -1
  349. package/lib/esm/resources/google_geocoders.d.ts +35 -1
  350. package/lib/esm/resources/google_geocoders.js +39 -1
  351. package/lib/esm/resources/imports.d.ts +45 -1
  352. package/lib/esm/resources/imports.js +32 -1
  353. package/lib/esm/resources/in_stock_subscriptions.d.ts +62 -1
  354. package/lib/esm/resources/in_stock_subscriptions.js +47 -1
  355. package/lib/esm/resources/inventory_models.d.ts +42 -1
  356. package/lib/esm/resources/inventory_models.js +43 -1
  357. package/lib/esm/resources/inventory_return_locations.d.ts +43 -1
  358. package/lib/esm/resources/inventory_return_locations.js +39 -1
  359. package/lib/esm/resources/inventory_stock_locations.d.ts +46 -1
  360. package/lib/esm/resources/inventory_stock_locations.js +39 -1
  361. package/lib/esm/resources/klarna_gateways.d.ts +44 -1
  362. package/lib/esm/resources/klarna_gateways.js +39 -1
  363. package/lib/esm/resources/klarna_payments.d.ts +46 -1
  364. package/lib/esm/resources/klarna_payments.js +39 -1
  365. package/lib/esm/resources/line_item_options.d.ts +57 -1
  366. package/lib/esm/resources/line_item_options.js +39 -1
  367. package/lib/esm/resources/line_items.d.ts +126 -1
  368. package/lib/esm/resources/line_items.js +47 -1
  369. package/lib/esm/resources/manual_gateways.d.ts +33 -1
  370. package/lib/esm/resources/manual_gateways.js +35 -1
  371. package/lib/esm/resources/manual_tax_calculators.d.ts +41 -1
  372. package/lib/esm/resources/manual_tax_calculators.js +43 -1
  373. package/lib/esm/resources/markets.d.ts +88 -1
  374. package/lib/esm/resources/markets.js +55 -1
  375. package/lib/esm/resources/merchants.d.ts +38 -1
  376. package/lib/esm/resources/merchants.js +39 -1
  377. package/lib/esm/resources/order_amount_promotion_rules.d.ts +56 -1
  378. package/lib/esm/resources/order_amount_promotion_rules.js +31 -1
  379. package/lib/esm/resources/order_copies.d.ts +48 -1
  380. package/lib/esm/resources/order_copies.js +44 -1
  381. package/lib/esm/resources/order_subscriptions.d.ts +70 -1
  382. package/lib/esm/resources/order_subscriptions.js +55 -1
  383. package/lib/esm/resources/order_validation_rules.d.ts +23 -1
  384. package/lib/esm/resources/order_validation_rules.js +30 -1
  385. package/lib/esm/resources/orders.d.ts +288 -1
  386. package/lib/esm/resources/orders.js +111 -1
  387. package/lib/esm/resources/organization.d.ts +32 -1
  388. package/lib/esm/resources/organization.js +19 -1
  389. package/lib/esm/resources/packages.d.ts +56 -1
  390. package/lib/esm/resources/packages.js +43 -1
  391. package/lib/esm/resources/parcel_line_items.d.ts +51 -1
  392. package/lib/esm/resources/parcel_line_items.js +39 -1
  393. package/lib/esm/resources/parcels.d.ts +119 -1
  394. package/lib/esm/resources/parcels.js +51 -1
  395. package/lib/esm/resources/payment_gateways.d.ts +21 -1
  396. package/lib/esm/resources/payment_gateways.js +26 -1
  397. package/lib/esm/resources/payment_methods.d.ts +61 -1
  398. package/lib/esm/resources/payment_methods.js +43 -1
  399. package/lib/esm/resources/paypal_gateways.d.ts +37 -1
  400. package/lib/esm/resources/paypal_gateways.js +39 -1
  401. package/lib/esm/resources/paypal_payments.d.ts +52 -1
  402. package/lib/esm/resources/paypal_payments.js +39 -1
  403. package/lib/esm/resources/percentage_discount_promotions.d.ts +100 -1
  404. package/lib/esm/resources/percentage_discount_promotions.js +63 -1
  405. package/lib/esm/resources/price_lists.d.ts +39 -1
  406. package/lib/esm/resources/price_lists.js +39 -1
  407. package/lib/esm/resources/price_tiers.d.ts +28 -1
  408. package/lib/esm/resources/price_tiers.js +30 -1
  409. package/lib/esm/resources/price_volume_tiers.d.ts +46 -1
  410. package/lib/esm/resources/price_volume_tiers.js +39 -1
  411. package/lib/esm/resources/prices.d.ts +68 -1
  412. package/lib/esm/resources/prices.js +51 -1
  413. package/lib/esm/resources/promotion_rules.d.ts +24 -1
  414. package/lib/esm/resources/promotion_rules.js +22 -1
  415. package/lib/esm/resources/promotions.d.ts +41 -1
  416. package/lib/esm/resources/promotions.js +42 -1
  417. package/lib/esm/resources/refunds.d.ts +37 -1
  418. package/lib/esm/resources/refunds.js +34 -1
  419. package/lib/esm/resources/return_line_items.d.ts +49 -1
  420. package/lib/esm/resources/return_line_items.js +39 -1
  421. package/lib/esm/resources/returns.d.ts +75 -1
  422. package/lib/esm/resources/returns.js +63 -1
  423. package/lib/esm/resources/shipments.d.ts +93 -1
  424. package/lib/esm/resources/shipments.js +81 -1
  425. package/lib/esm/resources/shipping_categories.d.ts +33 -1
  426. package/lib/esm/resources/shipping_categories.js +39 -1
  427. package/lib/esm/resources/shipping_method_tiers.d.ts +28 -1
  428. package/lib/esm/resources/shipping_method_tiers.js +30 -1
  429. package/lib/esm/resources/shipping_methods.d.ts +107 -1
  430. package/lib/esm/resources/shipping_methods.js +63 -1
  431. package/lib/esm/resources/shipping_weight_tiers.d.ts +46 -1
  432. package/lib/esm/resources/shipping_weight_tiers.js +39 -1
  433. package/lib/esm/resources/shipping_zones.d.ts +48 -1
  434. package/lib/esm/resources/shipping_zones.js +35 -1
  435. package/lib/esm/resources/sku_list_items.d.ts +47 -1
  436. package/lib/esm/resources/sku_list_items.js +39 -1
  437. package/lib/esm/resources/sku_list_promotion_rules.d.ts +68 -1
  438. package/lib/esm/resources/sku_list_promotion_rules.js +39 -1
  439. package/lib/esm/resources/sku_lists.d.ts +60 -1
  440. package/lib/esm/resources/sku_lists.js +51 -1
  441. package/lib/esm/resources/sku_options.d.ts +56 -1
  442. package/lib/esm/resources/sku_options.js +39 -1
  443. package/lib/esm/resources/skus.d.ts +78 -1
  444. package/lib/esm/resources/skus.js +55 -1
  445. package/lib/esm/resources/stock_items.d.ts +49 -1
  446. package/lib/esm/resources/stock_items.js +43 -1
  447. package/lib/esm/resources/stock_line_items.d.ts +29 -1
  448. package/lib/esm/resources/stock_line_items.js +34 -1
  449. package/lib/esm/resources/stock_locations.d.ts +57 -1
  450. package/lib/esm/resources/stock_locations.js +55 -1
  451. package/lib/esm/resources/stock_transfers.d.ts +74 -1
  452. package/lib/esm/resources/stock_transfers.js +55 -1
  453. package/lib/esm/resources/stripe_gateways.d.ts +41 -1
  454. package/lib/esm/resources/stripe_gateways.js +39 -1
  455. package/lib/esm/resources/stripe_payments.d.ts +47 -1
  456. package/lib/esm/resources/stripe_payments.js +39 -1
  457. package/lib/esm/resources/tax_calculators.d.ts +24 -1
  458. package/lib/esm/resources/tax_calculators.js +30 -1
  459. package/lib/esm/resources/tax_categories.d.ts +59 -1
  460. package/lib/esm/resources/tax_categories.js +39 -1
  461. package/lib/esm/resources/tax_rules.d.ts +69 -1
  462. package/lib/esm/resources/tax_rules.js +35 -1
  463. package/lib/esm/resources/taxjar_accounts.d.ts +43 -1
  464. package/lib/esm/resources/taxjar_accounts.js +43 -1
  465. package/lib/esm/resources/transactions.d.ts +31 -1
  466. package/lib/esm/resources/transactions.js +26 -1
  467. package/lib/esm/resources/voids.d.ts +37 -1
  468. package/lib/esm/resources/voids.js +34 -1
  469. package/lib/esm/resources/webhooks.d.ts +43 -1
  470. package/lib/esm/resources/webhooks.js +35 -1
  471. package/lib/esm/resources/wire_transfers.d.ts +33 -1
  472. package/lib/esm/resources/wire_transfers.js +35 -1
  473. package/lib/esm/static.d.ts +9 -1
  474. package/lib/esm/static.js +19 -1
  475. package/lib/esm/util.d.ts +6 -1
  476. package/lib/esm/util.js +11 -1
  477. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  478. package/lib/tsconfig.tsbuildinfo +1 -1
  479. package/package.json +13 -15
@@ -1 +1,135 @@
1
- import*as api from'./api';import{ApiError}from'./error';import type{ErrorInterceptor,InterceptorType,RawResponseReader,RequestInterceptor,ResponseInterceptor}from'./interceptor';import{ResourcesInitConfig}from'./resource';type SdkConfig={};type CommerceLayerInitConfig=SdkConfig&ResourcesInitConfig;type CommerceLayerConfig=Partial<CommerceLayerInitConfig>;declare class CommerceLayerClient{#private;static get openApiSchemaVersion():string;readonly openApiSchemaVersion="3.0.4";addresses:api.Addresses;adjustments:api.Adjustments;adyen_gateways:api.AdyenGateways;adyen_payments:api.AdyenPayments;application:api.Applications;attachments:api.Attachments;authorizations:api.Authorizations;avalara_accounts:api.AvalaraAccounts;billing_info_validation_rules:api.BillingInfoValidationRules;bing_geocoders:api.BingGeocoders;braintree_gateways:api.BraintreeGateways;braintree_payments:api.BraintreePayments;bundles:api.Bundles;captures:api.Captures;carrier_accounts:api.CarrierAccounts;checkout_com_gateways:api.CheckoutComGateways;checkout_com_payments:api.CheckoutComPayments;cleanups:api.Cleanups;coupon_codes_promotion_rules:api.CouponCodesPromotionRules;coupon_recipients:api.CouponRecipients;coupons:api.Coupons;customer_addresses:api.CustomerAddresses;customer_groups:api.CustomerGroups;customer_password_resets:api.CustomerPasswordResets;customer_payment_sources:api.CustomerPaymentSources;customer_subscriptions:api.CustomerSubscriptions;customers:api.Customers;delivery_lead_times:api.DeliveryLeadTimes;event_callbacks:api.EventCallbacks;events:api.Events;exports:api.Exports;external_gateways:api.ExternalGateways;external_payments:api.ExternalPayments;external_promotions:api.ExternalPromotions;external_tax_calculators:api.ExternalTaxCalculators;fixed_amount_promotions:api.FixedAmountPromotions;fixed_price_promotions:api.FixedPricePromotions;free_gift_promotions:api.FreeGiftPromotions;free_shipping_promotions:api.FreeShippingPromotions;geocoders:api.Geocoders;gift_card_recipients:api.GiftCardRecipients;gift_cards:api.GiftCards;google_geocoders:api.GoogleGeocoders;imports:api.Imports;in_stock_subscriptions:api.InStockSubscriptions;inventory_models:api.InventoryModels;inventory_return_locations:api.InventoryReturnLocations;inventory_stock_locations:api.InventoryStockLocations;klarna_gateways:api.KlarnaGateways;klarna_payments:api.KlarnaPayments;line_item_options:api.LineItemOptions;line_items:api.LineItems;manual_gateways:api.ManualGateways;manual_tax_calculators:api.ManualTaxCalculators;markets:api.Markets;merchants:api.Merchants;order_amount_promotion_rules:api.OrderAmountPromotionRules;order_copies:api.OrderCopies;order_subscriptions:api.OrderSubscriptions;order_validation_rules:api.OrderValidationRules;orders:api.Orders;organization:api.Organizations;packages:api.Packages;parcel_line_items:api.ParcelLineItems;parcels:api.Parcels;payment_gateways:api.PaymentGateways;payment_methods:api.PaymentMethods;paypal_gateways:api.PaypalGateways;paypal_payments:api.PaypalPayments;percentage_discount_promotions:api.PercentageDiscountPromotions;price_lists:api.PriceLists;price_tiers:api.PriceTiers;price_volume_tiers:api.PriceVolumeTiers;prices:api.Prices;promotion_rules:api.PromotionRules;promotions:api.Promotions;refunds:api.Refunds;return_line_items:api.ReturnLineItems;returns:api.Returns;shipments:api.Shipments;shipping_categories:api.ShippingCategories;shipping_method_tiers:api.ShippingMethodTiers;shipping_methods:api.ShippingMethods;shipping_weight_tiers:api.ShippingWeightTiers;shipping_zones:api.ShippingZones;sku_list_items:api.SkuListItems;sku_list_promotion_rules:api.SkuListPromotionRules;sku_lists:api.SkuLists;sku_options:api.SkuOptions;skus:api.Skus;stock_items:api.StockItems;stock_line_items:api.StockLineItems;stock_locations:api.StockLocations;stock_transfers:api.StockTransfers;stripe_gateways:api.StripeGateways;stripe_payments:api.StripePayments;tax_calculators:api.TaxCalculators;tax_categories:api.TaxCategories;tax_rules:api.TaxRules;taxjar_accounts:api.TaxjarAccounts;transactions:api.Transactions;voids:api.Voids;webhooks:api.Webhooks;wire_transfers:api.WireTransfers;constructor(config:CommerceLayerInitConfig);get currentOrganization():string;private localConfig;config(config:CommerceLayerConfig):void;resources():readonly string[];isApiError(error:any):error is ApiError;addRequestInterceptor(onFulfilled?:RequestInterceptor,onRejected?:ErrorInterceptor):number;addResponseInterceptor(onFulfilled?:ResponseInterceptor,onRejected?:ErrorInterceptor):number;removeInterceptor(type:InterceptorType,id:number):void;addRawResponseReader(options?:{headers:boolean;}):RawResponseReader;removeRawResponseReader(reader:number|RawResponseReader):void;}declare const CommerceLayer:(config:CommerceLayerInitConfig)=>CommerceLayerClient;export default CommerceLayer;export{CommerceLayer};export type{CommerceLayerClient,CommerceLayerConfig,CommerceLayerInitConfig};
1
+ import * as api from './api';
2
+ import { ApiError } from './error';
3
+ import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
+ import { ResourcesInitConfig } from './resource';
5
+ declare const OPEN_API_SCHEMA_VERSION = "3.5.0";
6
+ export { OPEN_API_SCHEMA_VERSION };
7
+ type SdkConfig = {};
8
+ type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
9
+ type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
10
+ declare class CommerceLayerClient {
11
+ #private;
12
+ static get openApiSchemaVersion(): string;
13
+ readonly openApiSchemaVersion = "3.5.0";
14
+ addresses: api.Addresses;
15
+ adjustments: api.Adjustments;
16
+ adyen_gateways: api.AdyenGateways;
17
+ adyen_payments: api.AdyenPayments;
18
+ application: api.Applications;
19
+ attachments: api.Attachments;
20
+ authorizations: api.Authorizations;
21
+ avalara_accounts: api.AvalaraAccounts;
22
+ billing_info_validation_rules: api.BillingInfoValidationRules;
23
+ bing_geocoders: api.BingGeocoders;
24
+ braintree_gateways: api.BraintreeGateways;
25
+ braintree_payments: api.BraintreePayments;
26
+ bundles: api.Bundles;
27
+ captures: api.Captures;
28
+ carrier_accounts: api.CarrierAccounts;
29
+ checkout_com_gateways: api.CheckoutComGateways;
30
+ checkout_com_payments: api.CheckoutComPayments;
31
+ cleanups: api.Cleanups;
32
+ coupon_codes_promotion_rules: api.CouponCodesPromotionRules;
33
+ coupon_recipients: api.CouponRecipients;
34
+ coupons: api.Coupons;
35
+ customer_addresses: api.CustomerAddresses;
36
+ customer_groups: api.CustomerGroups;
37
+ customer_password_resets: api.CustomerPasswordResets;
38
+ customer_payment_sources: api.CustomerPaymentSources;
39
+ customer_subscriptions: api.CustomerSubscriptions;
40
+ customers: api.Customers;
41
+ delivery_lead_times: api.DeliveryLeadTimes;
42
+ event_callbacks: api.EventCallbacks;
43
+ events: api.Events;
44
+ exports: api.Exports;
45
+ external_gateways: api.ExternalGateways;
46
+ external_payments: api.ExternalPayments;
47
+ external_promotions: api.ExternalPromotions;
48
+ external_tax_calculators: api.ExternalTaxCalculators;
49
+ fixed_amount_promotions: api.FixedAmountPromotions;
50
+ fixed_price_promotions: api.FixedPricePromotions;
51
+ free_gift_promotions: api.FreeGiftPromotions;
52
+ free_shipping_promotions: api.FreeShippingPromotions;
53
+ geocoders: api.Geocoders;
54
+ gift_card_recipients: api.GiftCardRecipients;
55
+ gift_cards: api.GiftCards;
56
+ google_geocoders: api.GoogleGeocoders;
57
+ imports: api.Imports;
58
+ in_stock_subscriptions: api.InStockSubscriptions;
59
+ inventory_models: api.InventoryModels;
60
+ inventory_return_locations: api.InventoryReturnLocations;
61
+ inventory_stock_locations: api.InventoryStockLocations;
62
+ klarna_gateways: api.KlarnaGateways;
63
+ klarna_payments: api.KlarnaPayments;
64
+ line_item_options: api.LineItemOptions;
65
+ line_items: api.LineItems;
66
+ manual_gateways: api.ManualGateways;
67
+ manual_tax_calculators: api.ManualTaxCalculators;
68
+ markets: api.Markets;
69
+ merchants: api.Merchants;
70
+ order_amount_promotion_rules: api.OrderAmountPromotionRules;
71
+ order_copies: api.OrderCopies;
72
+ order_subscriptions: api.OrderSubscriptions;
73
+ order_validation_rules: api.OrderValidationRules;
74
+ orders: api.Orders;
75
+ organization: api.Organizations;
76
+ packages: api.Packages;
77
+ parcel_line_items: api.ParcelLineItems;
78
+ parcels: api.Parcels;
79
+ payment_gateways: api.PaymentGateways;
80
+ payment_methods: api.PaymentMethods;
81
+ paypal_gateways: api.PaypalGateways;
82
+ paypal_payments: api.PaypalPayments;
83
+ percentage_discount_promotions: api.PercentageDiscountPromotions;
84
+ price_lists: api.PriceLists;
85
+ price_tiers: api.PriceTiers;
86
+ price_volume_tiers: api.PriceVolumeTiers;
87
+ prices: api.Prices;
88
+ promotion_rules: api.PromotionRules;
89
+ promotions: api.Promotions;
90
+ refunds: api.Refunds;
91
+ return_line_items: api.ReturnLineItems;
92
+ returns: api.Returns;
93
+ shipments: api.Shipments;
94
+ shipping_categories: api.ShippingCategories;
95
+ shipping_method_tiers: api.ShippingMethodTiers;
96
+ shipping_methods: api.ShippingMethods;
97
+ shipping_weight_tiers: api.ShippingWeightTiers;
98
+ shipping_zones: api.ShippingZones;
99
+ sku_list_items: api.SkuListItems;
100
+ sku_list_promotion_rules: api.SkuListPromotionRules;
101
+ sku_lists: api.SkuLists;
102
+ sku_options: api.SkuOptions;
103
+ skus: api.Skus;
104
+ stock_items: api.StockItems;
105
+ stock_line_items: api.StockLineItems;
106
+ stock_locations: api.StockLocations;
107
+ stock_transfers: api.StockTransfers;
108
+ stripe_gateways: api.StripeGateways;
109
+ stripe_payments: api.StripePayments;
110
+ tax_calculators: api.TaxCalculators;
111
+ tax_categories: api.TaxCategories;
112
+ tax_rules: api.TaxRules;
113
+ taxjar_accounts: api.TaxjarAccounts;
114
+ transactions: api.Transactions;
115
+ voids: api.Voids;
116
+ webhooks: api.Webhooks;
117
+ wire_transfers: api.WireTransfers;
118
+ constructor(config: CommerceLayerInitConfig);
119
+ get currentOrganization(): string;
120
+ private localConfig;
121
+ config(config: CommerceLayerConfig): void;
122
+ resources(): readonly string[];
123
+ isApiError(error: any): error is ApiError;
124
+ addRequestInterceptor(onFulfilled?: RequestInterceptor, onRejected?: ErrorInterceptor): number;
125
+ addResponseInterceptor(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number;
126
+ removeInterceptor(type: InterceptorType, id: number): void;
127
+ addRawResponseReader(options?: {
128
+ headers: boolean;
129
+ }): RawResponseReader;
130
+ removeRawResponseReader(reader: number | RawResponseReader): void;
131
+ }
132
+ declare const CommerceLayer: (config: CommerceLayerInitConfig) => CommerceLayerClient;
133
+ export default CommerceLayer;
134
+ export { CommerceLayer };
135
+ export type { CommerceLayerClient, CommerceLayerConfig, CommerceLayerInitConfig };
@@ -1 +1,197 @@
1
- var f=function(r,i,n,o,a){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?r!==i||!a:!i.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?a.call(r,n):a?a.value=n:i.set(r,n),n},s=function(r,i,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?r!==i||!o:!i.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(r):o?o.value:i.get(r)},t,h;import*as e from"./api";import{CommerceLayerStatic as w}from"./static";import l from"./resource";import _ from"./debug";const p=_("commercelayer"),u="3.0.4";class d{static get openApiSchemaVersion(){return u}constructor(i){this.openApiSchemaVersion=u,t.set(this,void 0),h.set(this,void 0),p("new commercelayer instance %O",i),f(this,t,new l(i),"f"),f(this,h,i.organization,"f"),this.addresses=new e.Addresses(s(this,t,"f")),this.adjustments=new e.Adjustments(s(this,t,"f")),this.adyen_gateways=new e.AdyenGateways(s(this,t,"f")),this.adyen_payments=new e.AdyenPayments(s(this,t,"f")),this.application=new e.Applications(s(this,t,"f")),this.attachments=new e.Attachments(s(this,t,"f")),this.authorizations=new e.Authorizations(s(this,t,"f")),this.avalara_accounts=new e.AvalaraAccounts(s(this,t,"f")),this.billing_info_validation_rules=new e.BillingInfoValidationRules(s(this,t,"f")),this.bing_geocoders=new e.BingGeocoders(s(this,t,"f")),this.braintree_gateways=new e.BraintreeGateways(s(this,t,"f")),this.braintree_payments=new e.BraintreePayments(s(this,t,"f")),this.bundles=new e.Bundles(s(this,t,"f")),this.captures=new e.Captures(s(this,t,"f")),this.carrier_accounts=new e.CarrierAccounts(s(this,t,"f")),this.checkout_com_gateways=new e.CheckoutComGateways(s(this,t,"f")),this.checkout_com_payments=new e.CheckoutComPayments(s(this,t,"f")),this.cleanups=new e.Cleanups(s(this,t,"f")),this.coupon_codes_promotion_rules=new e.CouponCodesPromotionRules(s(this,t,"f")),this.coupon_recipients=new e.CouponRecipients(s(this,t,"f")),this.coupons=new e.Coupons(s(this,t,"f")),this.customer_addresses=new e.CustomerAddresses(s(this,t,"f")),this.customer_groups=new e.CustomerGroups(s(this,t,"f")),this.customer_password_resets=new e.CustomerPasswordResets(s(this,t,"f")),this.customer_payment_sources=new e.CustomerPaymentSources(s(this,t,"f")),this.customer_subscriptions=new e.CustomerSubscriptions(s(this,t,"f")),this.customers=new e.Customers(s(this,t,"f")),this.delivery_lead_times=new e.DeliveryLeadTimes(s(this,t,"f")),this.event_callbacks=new e.EventCallbacks(s(this,t,"f")),this.events=new e.Events(s(this,t,"f")),this.exports=new e.Exports(s(this,t,"f")),this.external_gateways=new e.ExternalGateways(s(this,t,"f")),this.external_payments=new e.ExternalPayments(s(this,t,"f")),this.external_promotions=new e.ExternalPromotions(s(this,t,"f")),this.external_tax_calculators=new e.ExternalTaxCalculators(s(this,t,"f")),this.fixed_amount_promotions=new e.FixedAmountPromotions(s(this,t,"f")),this.fixed_price_promotions=new e.FixedPricePromotions(s(this,t,"f")),this.free_gift_promotions=new e.FreeGiftPromotions(s(this,t,"f")),this.free_shipping_promotions=new e.FreeShippingPromotions(s(this,t,"f")),this.geocoders=new e.Geocoders(s(this,t,"f")),this.gift_card_recipients=new e.GiftCardRecipients(s(this,t,"f")),this.gift_cards=new e.GiftCards(s(this,t,"f")),this.google_geocoders=new e.GoogleGeocoders(s(this,t,"f")),this.imports=new e.Imports(s(this,t,"f")),this.in_stock_subscriptions=new e.InStockSubscriptions(s(this,t,"f")),this.inventory_models=new e.InventoryModels(s(this,t,"f")),this.inventory_return_locations=new e.InventoryReturnLocations(s(this,t,"f")),this.inventory_stock_locations=new e.InventoryStockLocations(s(this,t,"f")),this.klarna_gateways=new e.KlarnaGateways(s(this,t,"f")),this.klarna_payments=new e.KlarnaPayments(s(this,t,"f")),this.line_item_options=new e.LineItemOptions(s(this,t,"f")),this.line_items=new e.LineItems(s(this,t,"f")),this.manual_gateways=new e.ManualGateways(s(this,t,"f")),this.manual_tax_calculators=new e.ManualTaxCalculators(s(this,t,"f")),this.markets=new e.Markets(s(this,t,"f")),this.merchants=new e.Merchants(s(this,t,"f")),this.order_amount_promotion_rules=new e.OrderAmountPromotionRules(s(this,t,"f")),this.order_copies=new e.OrderCopies(s(this,t,"f")),this.order_subscriptions=new e.OrderSubscriptions(s(this,t,"f")),this.order_validation_rules=new e.OrderValidationRules(s(this,t,"f")),this.orders=new e.Orders(s(this,t,"f")),this.organization=new e.Organizations(s(this,t,"f")),this.packages=new e.Packages(s(this,t,"f")),this.parcel_line_items=new e.ParcelLineItems(s(this,t,"f")),this.parcels=new e.Parcels(s(this,t,"f")),this.payment_gateways=new e.PaymentGateways(s(this,t,"f")),this.payment_methods=new e.PaymentMethods(s(this,t,"f")),this.paypal_gateways=new e.PaypalGateways(s(this,t,"f")),this.paypal_payments=new e.PaypalPayments(s(this,t,"f")),this.percentage_discount_promotions=new e.PercentageDiscountPromotions(s(this,t,"f")),this.price_lists=new e.PriceLists(s(this,t,"f")),this.price_tiers=new e.PriceTiers(s(this,t,"f")),this.price_volume_tiers=new e.PriceVolumeTiers(s(this,t,"f")),this.prices=new e.Prices(s(this,t,"f")),this.promotion_rules=new e.PromotionRules(s(this,t,"f")),this.promotions=new e.Promotions(s(this,t,"f")),this.refunds=new e.Refunds(s(this,t,"f")),this.return_line_items=new e.ReturnLineItems(s(this,t,"f")),this.returns=new e.Returns(s(this,t,"f")),this.shipments=new e.Shipments(s(this,t,"f")),this.shipping_categories=new e.ShippingCategories(s(this,t,"f")),this.shipping_method_tiers=new e.ShippingMethodTiers(s(this,t,"f")),this.shipping_methods=new e.ShippingMethods(s(this,t,"f")),this.shipping_weight_tiers=new e.ShippingWeightTiers(s(this,t,"f")),this.shipping_zones=new e.ShippingZones(s(this,t,"f")),this.sku_list_items=new e.SkuListItems(s(this,t,"f")),this.sku_list_promotion_rules=new e.SkuListPromotionRules(s(this,t,"f")),this.sku_lists=new e.SkuLists(s(this,t,"f")),this.sku_options=new e.SkuOptions(s(this,t,"f")),this.skus=new e.Skus(s(this,t,"f")),this.stock_items=new e.StockItems(s(this,t,"f")),this.stock_line_items=new e.StockLineItems(s(this,t,"f")),this.stock_locations=new e.StockLocations(s(this,t,"f")),this.stock_transfers=new e.StockTransfers(s(this,t,"f")),this.stripe_gateways=new e.StripeGateways(s(this,t,"f")),this.stripe_payments=new e.StripePayments(s(this,t,"f")),this.tax_calculators=new e.TaxCalculators(s(this,t,"f")),this.tax_categories=new e.TaxCategories(s(this,t,"f")),this.tax_rules=new e.TaxRules(s(this,t,"f")),this.taxjar_accounts=new e.TaxjarAccounts(s(this,t,"f")),this.transactions=new e.Transactions(s(this,t,"f")),this.voids=new e.Voids(s(this,t,"f")),this.webhooks=new e.Webhooks(s(this,t,"f")),this.wire_transfers=new e.WireTransfers(s(this,t,"f"))}get currentOrganization(){return s(this,h,"f")}localConfig(i){i.organization&&f(this,h,i.organization,"f")}config(i){p("config %o",i),this.localConfig(i),i.organization||(i.organization=this.currentOrganization),s(this,t,"f").config(i)}resources(){return w.resources()}isApiError(i){return w.isApiError(i)}addRequestInterceptor(i,n){return s(this,t,"f").interceptors.request.use(i,n)}addResponseInterceptor(i,n){return s(this,t,"f").interceptors.response.use(i,n)}removeInterceptor(i,n){return s(this,t,"f").interceptors[i].eject(n)}addRawResponseReader(i){const n={id:void 0,rawResponse:void 0,headers:void 0};function o(c){return n.rawResponse=c?.data,i?.headers&&(n.headers=c.headers),c}const a=this.addResponseInterceptor(o);return n.id=a,n}removeRawResponseReader(i){const n=typeof i=="number"?i:i?.id;if(n&&n>=0)return this.removeInterceptor("response",n)}}t=new WeakMap,h=new WeakMap;const m=r=>new d(r);export default m;export{m as CommerceLayer};
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _CommerceLayerClient_adapter, _CommerceLayerClient_organization;
13
+ import * as api from './api';
14
+ import { CommerceLayerStatic } from './static';
15
+ import ResourceAdapter from './resource';
16
+ import Debug from './debug';
17
+ const debug = Debug('commercelayer');
18
+ // Autogenerated schema version number, do not remove this line
19
+ const OPEN_API_SCHEMA_VERSION = '3.5.0';
20
+ export { OPEN_API_SCHEMA_VERSION };
21
+ class CommerceLayerClient {
22
+ static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
23
+ // ##__CL_RESOURCES_DEF_STOP__##
24
+ constructor(config) {
25
+ this.openApiSchemaVersion = OPEN_API_SCHEMA_VERSION;
26
+ _CommerceLayerClient_adapter.set(this, void 0);
27
+ _CommerceLayerClient_organization.set(this, void 0);
28
+ debug('new commercelayer instance %O', config);
29
+ __classPrivateFieldSet(this, _CommerceLayerClient_adapter, new ResourceAdapter(config), "f");
30
+ __classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
31
+ // ##__CL_RESOURCES_INIT_START__##
32
+ // ##__CL_RESOURCES_INIT_TEMPLATE:: ##__TAB__####__TAB__##this.##__RESOURCE_TYPE__## = new api.##__RESOURCE_CLASS__##(this.#adapter)
33
+ this.addresses = new api.Addresses(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
34
+ this.adjustments = new api.Adjustments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
35
+ this.adyen_gateways = new api.AdyenGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
36
+ this.adyen_payments = new api.AdyenPayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
37
+ this.application = new api.Applications(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
38
+ this.attachments = new api.Attachments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
39
+ this.authorizations = new api.Authorizations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
40
+ this.avalara_accounts = new api.AvalaraAccounts(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
41
+ this.billing_info_validation_rules = new api.BillingInfoValidationRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
42
+ this.bing_geocoders = new api.BingGeocoders(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
43
+ this.braintree_gateways = new api.BraintreeGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
44
+ this.braintree_payments = new api.BraintreePayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
45
+ this.bundles = new api.Bundles(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
46
+ this.captures = new api.Captures(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
47
+ this.carrier_accounts = new api.CarrierAccounts(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
48
+ this.checkout_com_gateways = new api.CheckoutComGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
49
+ this.checkout_com_payments = new api.CheckoutComPayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
50
+ this.cleanups = new api.Cleanups(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
51
+ this.coupon_codes_promotion_rules = new api.CouponCodesPromotionRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
52
+ this.coupon_recipients = new api.CouponRecipients(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
53
+ this.coupons = new api.Coupons(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
54
+ this.customer_addresses = new api.CustomerAddresses(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
55
+ this.customer_groups = new api.CustomerGroups(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
56
+ this.customer_password_resets = new api.CustomerPasswordResets(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
57
+ this.customer_payment_sources = new api.CustomerPaymentSources(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
58
+ this.customer_subscriptions = new api.CustomerSubscriptions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
59
+ this.customers = new api.Customers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
60
+ this.delivery_lead_times = new api.DeliveryLeadTimes(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
61
+ this.event_callbacks = new api.EventCallbacks(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
62
+ this.events = new api.Events(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
63
+ this.exports = new api.Exports(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
64
+ this.external_gateways = new api.ExternalGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
65
+ this.external_payments = new api.ExternalPayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
66
+ this.external_promotions = new api.ExternalPromotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
67
+ this.external_tax_calculators = new api.ExternalTaxCalculators(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
68
+ this.fixed_amount_promotions = new api.FixedAmountPromotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
69
+ this.fixed_price_promotions = new api.FixedPricePromotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
70
+ this.free_gift_promotions = new api.FreeGiftPromotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
71
+ this.free_shipping_promotions = new api.FreeShippingPromotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
72
+ this.geocoders = new api.Geocoders(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
73
+ this.gift_card_recipients = new api.GiftCardRecipients(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
74
+ this.gift_cards = new api.GiftCards(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
75
+ this.google_geocoders = new api.GoogleGeocoders(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
76
+ this.imports = new api.Imports(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
77
+ this.in_stock_subscriptions = new api.InStockSubscriptions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
78
+ this.inventory_models = new api.InventoryModels(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
79
+ this.inventory_return_locations = new api.InventoryReturnLocations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
80
+ this.inventory_stock_locations = new api.InventoryStockLocations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
81
+ this.klarna_gateways = new api.KlarnaGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
82
+ this.klarna_payments = new api.KlarnaPayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
83
+ this.line_item_options = new api.LineItemOptions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
84
+ this.line_items = new api.LineItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
85
+ this.manual_gateways = new api.ManualGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
86
+ this.manual_tax_calculators = new api.ManualTaxCalculators(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
87
+ this.markets = new api.Markets(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
88
+ this.merchants = new api.Merchants(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
89
+ this.order_amount_promotion_rules = new api.OrderAmountPromotionRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
90
+ this.order_copies = new api.OrderCopies(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
91
+ this.order_subscriptions = new api.OrderSubscriptions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
92
+ this.order_validation_rules = new api.OrderValidationRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
93
+ this.orders = new api.Orders(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
94
+ this.organization = new api.Organizations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
95
+ this.packages = new api.Packages(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
96
+ this.parcel_line_items = new api.ParcelLineItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
97
+ this.parcels = new api.Parcels(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
98
+ this.payment_gateways = new api.PaymentGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
99
+ this.payment_methods = new api.PaymentMethods(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
100
+ this.paypal_gateways = new api.PaypalGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
101
+ this.paypal_payments = new api.PaypalPayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
102
+ this.percentage_discount_promotions = new api.PercentageDiscountPromotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
103
+ this.price_lists = new api.PriceLists(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
104
+ this.price_tiers = new api.PriceTiers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
105
+ this.price_volume_tiers = new api.PriceVolumeTiers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
106
+ this.prices = new api.Prices(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
107
+ this.promotion_rules = new api.PromotionRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
108
+ this.promotions = new api.Promotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
109
+ this.refunds = new api.Refunds(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
110
+ this.return_line_items = new api.ReturnLineItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
111
+ this.returns = new api.Returns(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
112
+ this.shipments = new api.Shipments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
113
+ this.shipping_categories = new api.ShippingCategories(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
114
+ this.shipping_method_tiers = new api.ShippingMethodTiers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
115
+ this.shipping_methods = new api.ShippingMethods(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
116
+ this.shipping_weight_tiers = new api.ShippingWeightTiers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
117
+ this.shipping_zones = new api.ShippingZones(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
118
+ this.sku_list_items = new api.SkuListItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
119
+ this.sku_list_promotion_rules = new api.SkuListPromotionRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
120
+ this.sku_lists = new api.SkuLists(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
121
+ this.sku_options = new api.SkuOptions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
122
+ this.skus = new api.Skus(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
123
+ this.stock_items = new api.StockItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
124
+ this.stock_line_items = new api.StockLineItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
125
+ this.stock_locations = new api.StockLocations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
126
+ this.stock_transfers = new api.StockTransfers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
127
+ this.stripe_gateways = new api.StripeGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
128
+ this.stripe_payments = new api.StripePayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
129
+ this.tax_calculators = new api.TaxCalculators(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
130
+ this.tax_categories = new api.TaxCategories(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
131
+ this.tax_rules = new api.TaxRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
132
+ this.taxjar_accounts = new api.TaxjarAccounts(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
133
+ this.transactions = new api.Transactions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
134
+ this.voids = new api.Voids(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
135
+ this.webhooks = new api.Webhooks(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
136
+ this.wire_transfers = new api.WireTransfers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
137
+ // ##__CL_RESOURCES_INIT_STOP__##
138
+ }
139
+ get currentOrganization() { return __classPrivateFieldGet(this, _CommerceLayerClient_organization, "f"); }
140
+ localConfig(config) {
141
+ if (config.organization)
142
+ __classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
143
+ }
144
+ config(config) {
145
+ debug('config %o', config);
146
+ // CommerceLayer config
147
+ this.localConfig(config);
148
+ // ResourceAdapter config
149
+ // To rebuild baseUrl in client in case only the domain is defined
150
+ if (!config.organization)
151
+ config.organization = this.currentOrganization;
152
+ __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").config(config);
153
+ }
154
+ resources() {
155
+ return CommerceLayerStatic.resources();
156
+ }
157
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
158
+ isApiError(error) {
159
+ return CommerceLayerStatic.isApiError(error);
160
+ }
161
+ addRequestInterceptor(onFulfilled, onRejected) {
162
+ return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors.request.use(onFulfilled, onRejected);
163
+ }
164
+ addResponseInterceptor(onFulfilled, onRejected) {
165
+ return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors.response.use(onFulfilled, onRejected);
166
+ }
167
+ removeInterceptor(type, id) {
168
+ return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors[type].eject(id);
169
+ }
170
+ addRawResponseReader(options) {
171
+ const reader = {
172
+ id: undefined,
173
+ rawResponse: undefined,
174
+ headers: undefined,
175
+ };
176
+ function rawResponseInterceptor(response) {
177
+ reader.rawResponse = response === null || response === void 0 ? void 0 : response.data;
178
+ if (options === null || options === void 0 ? void 0 : options.headers)
179
+ reader.headers = response.headers;
180
+ return response;
181
+ }
182
+ const interceptor = this.addResponseInterceptor(rawResponseInterceptor);
183
+ reader.id = interceptor;
184
+ return reader;
185
+ }
186
+ removeRawResponseReader(reader) {
187
+ const id = (typeof reader === 'number') ? reader : reader === null || reader === void 0 ? void 0 : reader.id;
188
+ if (id && (id >= 0))
189
+ return this.removeInterceptor('response', id);
190
+ }
191
+ }
192
+ _CommerceLayerClient_adapter = new WeakMap(), _CommerceLayerClient_organization = new WeakMap();
193
+ const CommerceLayer = (config) => {
194
+ return new CommerceLayerClient(config);
195
+ };
196
+ export default CommerceLayer;
197
+ export { CommerceLayer };
@@ -1 +1,4 @@
1
- import type{ResourceId,ResourceType}from'./resource';declare const isResourceId:(resource:any)=>resource is ResourceId;declare const isResourceType:(resource:any)=>resource is ResourceType;export{isResourceId,isResourceType};
1
+ import type { ResourceId, ResourceType } from './resource';
2
+ declare const isResourceId: (resource: any) => resource is ResourceId;
3
+ declare const isResourceType: (resource: any) => resource is ResourceType;
4
+ export { isResourceId, isResourceType };
package/lib/esm/common.js CHANGED
@@ -1 +1,10 @@
1
- import{resourceList as e}from"./api";const p=s=>s?.type&&s.id&&e.includes(s.type),t=s=>s&&typeof s.type<"u"&&s.type&&e.includes(s.type);export{p as isResourceId,t as isResourceType};
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
3
+ import { resourceList } from './api';
4
+ const isResourceId = (resource) => {
5
+ return ((resource === null || resource === void 0 ? void 0 : resource.type) && resource.id) && resourceList.includes(resource.type);
6
+ };
7
+ const isResourceType = (resource) => {
8
+ return resource && (typeof resource.type !== 'undefined') && resource.type && resourceList.includes(resource.type);
9
+ };
10
+ export { isResourceId, isResourceType };
@@ -1 +1,11 @@
1
- declare const config:{readonly default:{readonly domain:"commercelayer.io";readonly pageNumber:1;readonly pageSize:10;};readonly client:{readonly timeout:15000;};};export default config;
1
+ declare const config: {
2
+ readonly default: {
3
+ readonly domain: "commercelayer.io";
4
+ readonly pageNumber: 1;
5
+ readonly pageSize: 10;
6
+ };
7
+ readonly client: {
8
+ readonly timeout: 15000;
9
+ };
10
+ };
11
+ export default config;
package/lib/esm/config.js CHANGED
@@ -1 +1,11 @@
1
- const e={default:{domain:"commercelayer.io",pageNumber:1,pageSize:10},client:{timeout:15e3}};export default e;
1
+ const config = {
2
+ default: {
3
+ domain: 'commercelayer.io',
4
+ pageNumber: 1,
5
+ pageSize: 10,
6
+ },
7
+ client: {
8
+ timeout: 15000,
9
+ }
10
+ };
11
+ export default config;
@@ -1 +1,3 @@
1
- type Debugger=(pattern:string,...args:any[])=>void;declare const debug:(namespace:string)=>Debugger;export default debug;
1
+ type Debugger = (pattern: string, ...args: any[]) => void;
2
+ declare const debug: (namespace: string) => Debugger;
3
+ export default debug;
package/lib/esm/debug.js CHANGED
@@ -1 +1,40 @@
1
- const e=(t,...r)=>{};let c=t=>e;try{const t=require("debug");t&&typeof t=="function"&&(c=t)}catch{}const o="clsdk",n=t=>c(`${o}:${t}`);export default n;
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable @typescript-eslint/no-unused-vars */
3
+ // import Debug from 'debug'
4
+ /* Nope debugger */
5
+ const debuggerFunction = (_pattern, ..._args) => {
6
+ // console.log(_pattern)
7
+ };
8
+ let debuggerFactory = (_namespace) => debuggerFunction;
9
+ /* Try loading 'debug' module */
10
+ try {
11
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
12
+ const debugModule = require('debug');
13
+ if (debugModule && (typeof debugModule === 'function'))
14
+ debuggerFactory = debugModule;
15
+ }
16
+ catch (error) {
17
+ //
18
+ }
19
+ const debugPrefix = 'clsdk';
20
+ /* Retrieve the name of the caller 'module' */
21
+ /*
22
+ const caller = (): string => {
23
+
24
+ const err = new Error()
25
+
26
+ Error.prepareStackTrace = (_, stack) => stack
27
+ const stack = err.stack as unknown as NodeJS.CallSite[]
28
+ Error.prepareStackTrace = undefined
29
+
30
+ const fileName = stack[2].getFileName() || '/'
31
+
32
+ return fileName.replace(/^.*[\\/]/, '').replace('.ts', '')
33
+
34
+ }
35
+ */
36
+ /* Return a debugger for the defined namespace */
37
+ const debug = (namespace) => {
38
+ return debuggerFactory(`${debugPrefix}:${namespace}`);
39
+ };
40
+ export default debug;
@@ -1 +1,28 @@
1
- declare enum ErrorType{CLIENT="client",REQUEST="request",RESPONSE="response",GENERIC="generic",CANCEL="cancel"}declare class SdkError extends Error{static NAME:string;static isSdkError(error:any):error is ApiError;type:string;code?:string;source?:Error;request?:any;constructor(error:{message:string;type?:ErrorType;});}declare class ApiError extends SdkError{static NAME:string;static isApiError(error:any):error is ApiError;errors:any[];status?:number;constructor(error:SdkError);first():any;}export{SdkError,ApiError,ErrorType};
1
+ declare enum ErrorType {
2
+ CLIENT = "client",
3
+ REQUEST = "request",
4
+ RESPONSE = "response",
5
+ GENERIC = "generic",
6
+ CANCEL = "cancel"
7
+ }
8
+ declare class SdkError extends Error {
9
+ static NAME: string;
10
+ static isSdkError(error: any): error is ApiError;
11
+ type: string;
12
+ code?: string;
13
+ source?: Error;
14
+ request?: any;
15
+ constructor(error: {
16
+ message: string;
17
+ type?: ErrorType;
18
+ });
19
+ }
20
+ declare class ApiError extends SdkError {
21
+ static NAME: string;
22
+ static isApiError(error: any): error is ApiError;
23
+ errors: any[];
24
+ status?: number;
25
+ constructor(error: SdkError);
26
+ first(): any;
27
+ }
28
+ export { SdkError, ApiError, ErrorType };
package/lib/esm/error.js CHANGED
@@ -1 +1,38 @@
1
- var e;(function(E){E.CLIENT="client",E.REQUEST="request",E.RESPONSE="response",E.GENERIC="generic",E.CANCEL="cancel"})(e||(e={}));class s extends Error{static isSdkError(r){return r&&[s.NAME,t.NAME].includes(r.name)&&Object.values(e).includes(r.type)}constructor(r){super(r.message),this.name=s.NAME,this.type=r.type||e.GENERIC}}s.NAME="SdkError";class t extends s{static isApiError(r){return s.isSdkError(r)&&r.name===t.NAME&&r.type===e.RESPONSE}constructor(r){super(Object.assign(Object.assign({},r),{type:e.RESPONSE})),this.errors=[],this.name=t.NAME}first(){var r;return((r=this.errors)===null||r===void 0?void 0:r.length)>0?this.errors[0]:void 0}}t.NAME="ApiError";export{s as SdkError,t as ApiError,e as ErrorType};
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ var ErrorType;
3
+ (function (ErrorType) {
4
+ ErrorType["CLIENT"] = "client";
5
+ ErrorType["REQUEST"] = "request";
6
+ ErrorType["RESPONSE"] = "response";
7
+ ErrorType["GENERIC"] = "generic";
8
+ ErrorType["CANCEL"] = "cancel";
9
+ })(ErrorType || (ErrorType = {}));
10
+ class SdkError extends Error {
11
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
12
+ static isSdkError(error) {
13
+ return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
14
+ }
15
+ constructor(error) {
16
+ super(error.message);
17
+ this.name = SdkError.NAME; // this.constructor.name
18
+ this.type = error.type || ErrorType.GENERIC;
19
+ }
20
+ }
21
+ SdkError.NAME = 'SdkError';
22
+ class ApiError extends SdkError {
23
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
24
+ static isApiError(error) {
25
+ return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
26
+ }
27
+ constructor(error) {
28
+ super(Object.assign(Object.assign({}, error), { type: ErrorType.RESPONSE }));
29
+ this.errors = [];
30
+ this.name = ApiError.NAME; // this.constructor.name
31
+ }
32
+ first() {
33
+ var _a;
34
+ return (((_a = this.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) ? this.errors[0] : undefined;
35
+ }
36
+ }
37
+ ApiError.NAME = 'ApiError';
38
+ export { SdkError, ApiError, ErrorType };
@@ -1 +1,7 @@
1
- export{default,CommerceLayer}from'./commercelayer';export type{CommerceLayerClient}from'./commercelayer';export{CommerceLayerStatic}from'./static';export type{QueryParamsRetrieve,QueryParamsList,QueryParams}from'./query';export*from'./model';export type{RequestObj,ResponseObj,ErrorObj,HeadersObj}from'./interceptor';export type{SdkError,ApiError,ErrorType}from'./error';
1
+ export { default, CommerceLayer } from './commercelayer';
2
+ export type { CommerceLayerClient } from './commercelayer';
3
+ export { CommerceLayerStatic } from './static';
4
+ export type { QueryParamsRetrieve, QueryParamsList, QueryParams } from './query';
5
+ export * from './model';
6
+ export type { RequestObj, ResponseObj, ErrorObj, HeadersObj } from './interceptor';
7
+ export type { SdkError, ApiError, ErrorType } from './error';
package/lib/esm/index.js CHANGED
@@ -1 +1,6 @@
1
- export{default,CommerceLayer}from"./commercelayer";export{CommerceLayerStatic}from"./static";export*from"./model";
1
+ // SDK
2
+ export { default, CommerceLayer } from './commercelayer';
3
+ // Commerce Layer static functions
4
+ export { CommerceLayerStatic } from './static';
5
+ // Resource model types
6
+ export * from './model';
@@ -1 +1,21 @@
1
- import{AxiosError,AxiosInterceptorManager,AxiosRequestConfig,AxiosResponse,AxiosResponseHeaders,RawAxiosResponseHeaders}from'axios';type InterceptorManager={request:AxiosInterceptorManager<AxiosRequestConfig>;response:AxiosInterceptorManager<any>;};type RequestObj=AxiosRequestConfig;type RequestInterceptor=(request:RequestObj)=>RequestObj|Promise<RequestObj>;type ResponseObj=AxiosResponse;type ResponseInterceptor=(response:ResponseObj)=>ResponseObj;type HeadersObj=AxiosResponseHeaders|RawAxiosResponseHeaders;type ErrorObj=AxiosError;type ErrorInterceptor=(error:ErrorObj)=>ErrorObj;type InterceptorType='request'|'response';export type{InterceptorManager,RequestInterceptor,ResponseInterceptor,ErrorInterceptor,InterceptorType};export type{RequestObj,ResponseObj,ErrorObj,HeadersObj};type RawResponseReader={id:number|undefined;rawResponse:ResponseObj|undefined;headers:HeadersObj|undefined;};export type{RawResponseReader};
1
+ import { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders, RawAxiosResponseHeaders } from 'axios';
2
+ type InterceptorManager = {
3
+ request: AxiosInterceptorManager<AxiosRequestConfig>;
4
+ response: AxiosInterceptorManager<any>;
5
+ };
6
+ type RequestObj = AxiosRequestConfig;
7
+ type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
8
+ type ResponseObj = AxiosResponse;
9
+ type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
10
+ type HeadersObj = AxiosResponseHeaders | RawAxiosResponseHeaders;
11
+ type ErrorObj = AxiosError;
12
+ type ErrorInterceptor = (error: ErrorObj) => ErrorObj;
13
+ type InterceptorType = 'request' | 'response';
14
+ export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType };
15
+ export type { RequestObj, ResponseObj, ErrorObj, HeadersObj };
16
+ type RawResponseReader = {
17
+ id: number | undefined;
18
+ rawResponse: ResponseObj | undefined;
19
+ headers: HeadersObj | undefined;
20
+ };
21
+ export type { RawResponseReader };
@@ -1 +1 @@
1
- export{};
1
+ export {};
@@ -1 +1,5 @@
1
- import type{DocWithData,ResourceObject as JSONAPIObject}from'jsonapi-typescript';import type{ResourceCreate,ResourceUpdate,ResourceId,ResourceType,Resource}from'./resource';declare const denormalize:<R extends Resource>(response:DocWithData)=>R|R[];declare const normalize:(resource:(ResourceCreate&ResourceType)|(ResourceUpdate&ResourceId))=>JSONAPIObject;export{denormalize,normalize};
1
+ import type { DocWithData, ResourceObject as JSONAPIObject } from 'jsonapi-typescript';
2
+ import type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource } from './resource';
3
+ declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
4
+ declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => JSONAPIObject;
5
+ export { denormalize, normalize };