@commercelayer/sdk 4.39.0 → 4.41.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 (531) hide show
  1. package/lib/cjs/api.d.ts +1 -38
  2. package/lib/cjs/api.js +14 -1
  3. package/lib/cjs/client.d.ts +8 -15
  4. package/lib/cjs/client.js +40 -40
  5. package/lib/cjs/commercelayer.d.ts +6 -5
  6. package/lib/cjs/commercelayer.js +4 -8
  7. package/lib/cjs/common.d.ts +0 -1
  8. package/lib/cjs/common.js +2 -11
  9. package/lib/cjs/config.d.ts +0 -1
  10. package/lib/cjs/config.js +0 -3
  11. package/lib/cjs/debug.js +4 -0
  12. package/lib/cjs/error.d.ts +3 -6
  13. package/lib/cjs/error.js +8 -42
  14. package/lib/cjs/index.d.ts +1 -1
  15. package/lib/cjs/index.js +16 -0
  16. package/lib/cjs/interceptor.d.ts +2 -6
  17. package/lib/cjs/jsonapi.js +2 -9
  18. package/lib/cjs/model.d.ts +1 -1
  19. package/lib/cjs/query.d.ts +15 -9
  20. package/lib/cjs/query.js +2 -3
  21. package/lib/cjs/resource.d.ts +20 -31
  22. package/lib/cjs/resource.js +9 -56
  23. package/lib/cjs/resources/addresses.d.ts +73 -74
  24. package/lib/cjs/resources/addresses.js +11 -3
  25. package/lib/cjs/resources/adjustments.d.ts +19 -20
  26. package/lib/cjs/resources/adjustments.js +11 -3
  27. package/lib/cjs/resources/adyen_gateways.d.ts +34 -35
  28. package/lib/cjs/resources/adyen_gateways.js +11 -3
  29. package/lib/cjs/resources/adyen_payments.d.ts +27 -29
  30. package/lib/cjs/resources/adyen_payments.js +11 -6
  31. package/lib/cjs/resources/application.d.ts +13 -14
  32. package/lib/cjs/resources/application.js +6 -1
  33. package/lib/cjs/resources/attachments.d.ts +80 -81
  34. package/lib/cjs/resources/attachments.js +11 -3
  35. package/lib/cjs/resources/authorizations.d.ts +45 -49
  36. package/lib/cjs/resources/authorizations.js +13 -14
  37. package/lib/cjs/resources/avalara_accounts.d.ts +31 -32
  38. package/lib/cjs/resources/avalara_accounts.js +11 -3
  39. package/lib/cjs/resources/axerve_gateways.d.ts +23 -24
  40. package/lib/cjs/resources/axerve_gateways.js +11 -3
  41. package/lib/cjs/resources/axerve_payments.d.ts +32 -32
  42. package/lib/cjs/resources/axerve_payments.js +11 -6
  43. package/lib/cjs/resources/billing_info_validation_rules.d.ts +16 -17
  44. package/lib/cjs/resources/billing_info_validation_rules.js +11 -3
  45. package/lib/cjs/resources/bing_geocoders.d.ts +15 -16
  46. package/lib/cjs/resources/bing_geocoders.js +11 -3
  47. package/lib/cjs/resources/braintree_gateways.d.ts +33 -34
  48. package/lib/cjs/resources/braintree_gateways.js +11 -3
  49. package/lib/cjs/resources/braintree_payments.d.ts +29 -30
  50. package/lib/cjs/resources/braintree_payments.js +11 -3
  51. package/lib/cjs/resources/bundles.d.ts +56 -59
  52. package/lib/cjs/resources/bundles.js +11 -9
  53. package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +85 -86
  54. package/lib/cjs/resources/buy_x_pay_y_promotions.js +11 -9
  55. package/lib/cjs/resources/captures.d.ts +36 -39
  56. package/lib/cjs/resources/captures.js +13 -11
  57. package/lib/cjs/resources/carrier_accounts.d.ts +15 -16
  58. package/lib/cjs/resources/carrier_accounts.js +8 -0
  59. package/lib/cjs/resources/checkout_com_gateways.d.ts +24 -25
  60. package/lib/cjs/resources/checkout_com_gateways.js +11 -3
  61. package/lib/cjs/resources/checkout_com_payments.d.ts +38 -41
  62. package/lib/cjs/resources/checkout_com_payments.js +11 -9
  63. package/lib/cjs/resources/cleanups.d.ts +23 -24
  64. package/lib/cjs/resources/cleanups.js +10 -2
  65. package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +32 -33
  66. package/lib/cjs/resources/coupon_codes_promotion_rules.js +11 -3
  67. package/lib/cjs/resources/coupon_recipients.d.ts +25 -26
  68. package/lib/cjs/resources/coupon_recipients.js +11 -3
  69. package/lib/cjs/resources/coupons.d.ts +41 -42
  70. package/lib/cjs/resources/coupons.js +11 -3
  71. package/lib/cjs/resources/custom_promotion_rules.d.ts +30 -31
  72. package/lib/cjs/resources/custom_promotion_rules.js +11 -3
  73. package/lib/cjs/resources/customer_addresses.d.ts +22 -23
  74. package/lib/cjs/resources/customer_addresses.js +11 -3
  75. package/lib/cjs/resources/customer_groups.d.ts +16 -17
  76. package/lib/cjs/resources/customer_groups.js +11 -3
  77. package/lib/cjs/resources/customer_password_resets.d.ts +17 -19
  78. package/lib/cjs/resources/customer_password_resets.js +11 -6
  79. package/lib/cjs/resources/customer_payment_sources.d.ts +49 -38
  80. package/lib/cjs/resources/customer_payment_sources.js +15 -3
  81. package/lib/cjs/resources/customer_subscriptions.d.ts +14 -15
  82. package/lib/cjs/resources/customer_subscriptions.js +11 -3
  83. package/lib/cjs/resources/customers.d.ts +36 -37
  84. package/lib/cjs/resources/customers.js +11 -3
  85. package/lib/cjs/resources/delivery_lead_times.d.ts +26 -27
  86. package/lib/cjs/resources/delivery_lead_times.js +11 -3
  87. package/lib/cjs/resources/event_callbacks.d.ts +14 -15
  88. package/lib/cjs/resources/event_callbacks.js +8 -0
  89. package/lib/cjs/resources/events.d.ts +12 -13
  90. package/lib/cjs/resources/events.js +8 -0
  91. package/lib/cjs/resources/exports.d.ts +26 -27
  92. package/lib/cjs/resources/exports.js +10 -2
  93. package/lib/cjs/resources/external_gateways.d.ts +31 -32
  94. package/lib/cjs/resources/external_gateways.js +11 -3
  95. package/lib/cjs/resources/external_payments.d.ts +22 -23
  96. package/lib/cjs/resources/external_payments.js +11 -3
  97. package/lib/cjs/resources/external_promotions.d.ts +82 -83
  98. package/lib/cjs/resources/external_promotions.js +11 -9
  99. package/lib/cjs/resources/external_tax_calculators.d.ts +18 -19
  100. package/lib/cjs/resources/external_tax_calculators.js +11 -3
  101. package/lib/cjs/resources/fixed_amount_promotions.d.ts +83 -84
  102. package/lib/cjs/resources/fixed_amount_promotions.js +11 -9
  103. package/lib/cjs/resources/fixed_price_promotions.d.ts +82 -83
  104. package/lib/cjs/resources/fixed_price_promotions.js +11 -9
  105. package/lib/cjs/resources/free_gift_promotions.d.ts +81 -82
  106. package/lib/cjs/resources/free_gift_promotions.js +11 -9
  107. package/lib/cjs/resources/free_shipping_promotions.d.ts +74 -75
  108. package/lib/cjs/resources/free_shipping_promotions.js +11 -9
  109. package/lib/cjs/resources/geocoders.d.ts +12 -13
  110. package/lib/cjs/resources/geocoders.js +8 -0
  111. package/lib/cjs/resources/gift_card_recipients.d.ts +25 -26
  112. package/lib/cjs/resources/gift_card_recipients.js +11 -3
  113. package/lib/cjs/resources/gift_cards.d.ts +66 -71
  114. package/lib/cjs/resources/gift_cards.js +11 -15
  115. package/lib/cjs/resources/google_geocoders.d.ts +15 -16
  116. package/lib/cjs/resources/google_geocoders.js +11 -3
  117. package/lib/cjs/resources/imports.d.ts +29 -32
  118. package/lib/cjs/resources/imports.js +10 -2
  119. package/lib/cjs/resources/in_stock_subscriptions.d.ts +35 -38
  120. package/lib/cjs/resources/in_stock_subscriptions.js +11 -9
  121. package/lib/cjs/resources/inventory_models.d.ts +28 -29
  122. package/lib/cjs/resources/inventory_models.js +11 -3
  123. package/lib/cjs/resources/inventory_return_locations.d.ts +21 -22
  124. package/lib/cjs/resources/inventory_return_locations.js +11 -3
  125. package/lib/cjs/resources/inventory_stock_locations.d.ts +24 -25
  126. package/lib/cjs/resources/inventory_stock_locations.js +11 -3
  127. package/lib/cjs/resources/klarna_gateways.d.ts +22 -23
  128. package/lib/cjs/resources/klarna_gateways.js +11 -3
  129. package/lib/cjs/resources/klarna_payments.d.ts +27 -29
  130. package/lib/cjs/resources/klarna_payments.js +11 -6
  131. package/lib/cjs/resources/line_item_options.d.ts +40 -41
  132. package/lib/cjs/resources/line_item_options.js +11 -3
  133. package/lib/cjs/resources/line_items.d.ts +100 -97
  134. package/lib/cjs/resources/line_items.js +11 -9
  135. package/lib/cjs/resources/manual_gateways.d.ts +14 -15
  136. package/lib/cjs/resources/manual_gateways.js +11 -3
  137. package/lib/cjs/resources/manual_tax_calculators.d.ts +20 -21
  138. package/lib/cjs/resources/manual_tax_calculators.js +11 -3
  139. package/lib/cjs/resources/markets.d.ts +64 -62
  140. package/lib/cjs/resources/markets.js +11 -9
  141. package/lib/cjs/resources/merchants.d.ts +18 -19
  142. package/lib/cjs/resources/merchants.js +11 -3
  143. package/lib/cjs/resources/order_amount_promotion_rules.d.ts +35 -36
  144. package/lib/cjs/resources/order_amount_promotion_rules.js +11 -3
  145. package/lib/cjs/resources/order_copies.d.ts +28 -29
  146. package/lib/cjs/resources/order_copies.js +11 -3
  147. package/lib/cjs/resources/order_factories.d.ts +20 -21
  148. package/lib/cjs/resources/order_factories.js +8 -0
  149. package/lib/cjs/resources/order_subscription_items.d.ts +39 -40
  150. package/lib/cjs/resources/order_subscription_items.js +11 -3
  151. package/lib/cjs/resources/order_subscriptions.d.ts +51 -55
  152. package/lib/cjs/resources/order_subscriptions.js +11 -12
  153. package/lib/cjs/resources/order_validation_rules.d.ts +12 -13
  154. package/lib/cjs/resources/order_validation_rules.js +8 -0
  155. package/lib/cjs/resources/orders.d.ts +251 -277
  156. package/lib/cjs/resources/orders.js +11 -84
  157. package/lib/cjs/resources/organization.d.ts +24 -25
  158. package/lib/cjs/resources/organization.js +6 -1
  159. package/lib/cjs/resources/packages.d.ts +30 -31
  160. package/lib/cjs/resources/packages.js +11 -3
  161. package/lib/cjs/resources/parcel_line_items.d.ts +22 -23
  162. package/lib/cjs/resources/parcel_line_items.js +11 -3
  163. package/lib/cjs/resources/parcels.d.ts +93 -94
  164. package/lib/cjs/resources/parcels.js +11 -3
  165. package/lib/cjs/resources/payment_gateways.d.ts +12 -13
  166. package/lib/cjs/resources/payment_gateways.js +8 -0
  167. package/lib/cjs/resources/payment_methods.d.ts +51 -52
  168. package/lib/cjs/resources/payment_methods.js +11 -9
  169. package/lib/cjs/resources/payment_options.d.ts +23 -24
  170. package/lib/cjs/resources/payment_options.js +11 -3
  171. package/lib/cjs/resources/paypal_gateways.d.ts +17 -18
  172. package/lib/cjs/resources/paypal_gateways.js +11 -3
  173. package/lib/cjs/resources/paypal_payments.d.ts +31 -32
  174. package/lib/cjs/resources/paypal_payments.js +11 -3
  175. package/lib/cjs/resources/percentage_discount_promotions.d.ts +81 -82
  176. package/lib/cjs/resources/percentage_discount_promotions.js +11 -9
  177. package/lib/cjs/resources/price_frequency_tiers.d.ts +26 -27
  178. package/lib/cjs/resources/price_frequency_tiers.js +11 -3
  179. package/lib/cjs/resources/price_lists.d.ts +23 -21
  180. package/lib/cjs/resources/price_lists.js +11 -3
  181. package/lib/cjs/resources/price_tiers.d.ts +17 -18
  182. package/lib/cjs/resources/price_tiers.js +8 -0
  183. package/lib/cjs/resources/price_volume_tiers.d.ts +26 -27
  184. package/lib/cjs/resources/price_volume_tiers.js +11 -3
  185. package/lib/cjs/resources/prices.d.ts +40 -41
  186. package/lib/cjs/resources/prices.js +11 -3
  187. package/lib/cjs/resources/promotion_rules.d.ts +11 -12
  188. package/lib/cjs/resources/promotion_rules.js +8 -0
  189. package/lib/cjs/resources/promotions.d.ts +30 -31
  190. package/lib/cjs/resources/promotions.js +8 -0
  191. package/lib/cjs/resources/recurring_order_copies.d.ts +28 -29
  192. package/lib/cjs/resources/recurring_order_copies.js +11 -3
  193. package/lib/cjs/resources/refunds.d.ts +27 -28
  194. package/lib/cjs/resources/refunds.js +12 -4
  195. package/lib/cjs/resources/reserved_stocks.d.ts +13 -14
  196. package/lib/cjs/resources/reserved_stocks.js +8 -0
  197. package/lib/cjs/resources/return_line_items.d.ts +27 -29
  198. package/lib/cjs/resources/return_line_items.js +11 -6
  199. package/lib/cjs/resources/returns.d.ts +49 -59
  200. package/lib/cjs/resources/returns.js +11 -30
  201. package/lib/cjs/resources/satispay_gateways.d.ts +22 -23
  202. package/lib/cjs/resources/satispay_gateways.js +11 -3
  203. package/lib/cjs/resources/satispay_payments.d.ts +29 -31
  204. package/lib/cjs/resources/satispay_payments.js +11 -6
  205. package/lib/cjs/resources/shipments.d.ts +86 -88
  206. package/lib/cjs/resources/shipments.js +15 -33
  207. package/lib/cjs/resources/shipping_categories.d.ts +18 -16
  208. package/lib/cjs/resources/shipping_categories.js +11 -3
  209. package/lib/cjs/resources/shipping_method_tiers.d.ts +17 -18
  210. package/lib/cjs/resources/shipping_method_tiers.js +8 -0
  211. package/lib/cjs/resources/shipping_methods.d.ts +79 -80
  212. package/lib/cjs/resources/shipping_methods.js +11 -9
  213. package/lib/cjs/resources/shipping_weight_tiers.d.ts +25 -26
  214. package/lib/cjs/resources/shipping_weight_tiers.js +11 -3
  215. package/lib/cjs/resources/shipping_zones.d.ts +32 -33
  216. package/lib/cjs/resources/shipping_zones.js +11 -3
  217. package/lib/cjs/resources/sku_list_items.d.ts +26 -27
  218. package/lib/cjs/resources/sku_list_items.js +11 -3
  219. package/lib/cjs/resources/sku_list_promotion_rules.d.ts +39 -40
  220. package/lib/cjs/resources/sku_list_promotion_rules.js +11 -3
  221. package/lib/cjs/resources/sku_lists.d.ts +35 -36
  222. package/lib/cjs/resources/sku_lists.js +11 -3
  223. package/lib/cjs/resources/sku_options.d.ts +43 -44
  224. package/lib/cjs/resources/sku_options.js +11 -3
  225. package/lib/cjs/resources/skus.d.ts +56 -57
  226. package/lib/cjs/resources/skus.js +11 -3
  227. package/lib/cjs/resources/stock_items.d.ts +28 -29
  228. package/lib/cjs/resources/stock_items.js +11 -3
  229. package/lib/cjs/resources/stock_line_items.d.ts +37 -37
  230. package/lib/cjs/resources/stock_line_items.js +11 -3
  231. package/lib/cjs/resources/stock_locations.d.ts +32 -30
  232. package/lib/cjs/resources/stock_locations.js +11 -3
  233. package/lib/cjs/resources/stock_reservations.d.ts +23 -25
  234. package/lib/cjs/resources/stock_reservations.js +11 -6
  235. package/lib/cjs/resources/stock_transfers.d.ts +44 -50
  236. package/lib/cjs/resources/stock_transfers.js +11 -21
  237. package/lib/cjs/resources/stripe_gateways.d.ts +22 -23
  238. package/lib/cjs/resources/stripe_gateways.js +11 -3
  239. package/lib/cjs/resources/stripe_payments.d.ts +34 -35
  240. package/lib/cjs/resources/stripe_payments.js +11 -9
  241. package/lib/cjs/resources/subscription_models.d.ts +26 -27
  242. package/lib/cjs/resources/subscription_models.js +11 -3
  243. package/lib/cjs/resources/tags.d.ts +12 -13
  244. package/lib/cjs/resources/tags.js +11 -3
  245. package/lib/cjs/resources/tax_calculators.d.ts +13 -14
  246. package/lib/cjs/resources/tax_calculators.js +8 -0
  247. package/lib/cjs/resources/tax_categories.d.ts +30 -31
  248. package/lib/cjs/resources/tax_categories.js +11 -3
  249. package/lib/cjs/resources/tax_rules.d.ts +51 -52
  250. package/lib/cjs/resources/tax_rules.js +11 -3
  251. package/lib/cjs/resources/taxjar_accounts.d.ts +21 -22
  252. package/lib/cjs/resources/taxjar_accounts.js +11 -3
  253. package/lib/cjs/resources/transactions.d.ts +26 -24
  254. package/lib/cjs/resources/transactions.js +12 -0
  255. package/lib/cjs/resources/versions.d.ts +14 -14
  256. package/lib/cjs/resources/versions.js +8 -0
  257. package/lib/cjs/resources/voids.d.ts +27 -28
  258. package/lib/cjs/resources/voids.js +12 -4
  259. package/lib/cjs/resources/webhooks.d.ts +31 -28
  260. package/lib/cjs/resources/webhooks.js +11 -6
  261. package/lib/cjs/resources/wire_transfers.d.ts +16 -17
  262. package/lib/cjs/resources/wire_transfers.js +11 -3
  263. package/lib/cjs/static.d.ts +1 -1
  264. package/lib/cjs/util.d.ts +8 -1
  265. package/lib/esm/api.d.ts +1 -38
  266. package/lib/esm/api.js +14 -1
  267. package/lib/esm/client.d.ts +8 -15
  268. package/lib/esm/client.js +40 -40
  269. package/lib/esm/commercelayer.d.ts +6 -5
  270. package/lib/esm/commercelayer.js +4 -8
  271. package/lib/esm/common.d.ts +0 -1
  272. package/lib/esm/common.js +2 -11
  273. package/lib/esm/config.d.ts +0 -1
  274. package/lib/esm/config.js +0 -3
  275. package/lib/esm/debug.js +4 -0
  276. package/lib/esm/error.d.ts +3 -6
  277. package/lib/esm/error.js +6 -37
  278. package/lib/esm/index.d.ts +1 -1
  279. package/lib/esm/index.js +2 -0
  280. package/lib/esm/interceptor.d.ts +2 -6
  281. package/lib/esm/jsonapi.js +2 -9
  282. package/lib/esm/model.d.ts +1 -1
  283. package/lib/esm/query.d.ts +15 -9
  284. package/lib/esm/query.js +2 -2
  285. package/lib/esm/resource.d.ts +20 -31
  286. package/lib/esm/resource.js +10 -56
  287. package/lib/esm/resources/addresses.d.ts +73 -74
  288. package/lib/esm/resources/addresses.js +11 -3
  289. package/lib/esm/resources/adjustments.d.ts +19 -20
  290. package/lib/esm/resources/adjustments.js +11 -3
  291. package/lib/esm/resources/adyen_gateways.d.ts +34 -35
  292. package/lib/esm/resources/adyen_gateways.js +11 -3
  293. package/lib/esm/resources/adyen_payments.d.ts +27 -29
  294. package/lib/esm/resources/adyen_payments.js +11 -6
  295. package/lib/esm/resources/application.d.ts +13 -14
  296. package/lib/esm/resources/application.js +7 -2
  297. package/lib/esm/resources/attachments.d.ts +80 -81
  298. package/lib/esm/resources/attachments.js +11 -3
  299. package/lib/esm/resources/authorizations.d.ts +45 -49
  300. package/lib/esm/resources/authorizations.js +13 -14
  301. package/lib/esm/resources/avalara_accounts.d.ts +31 -32
  302. package/lib/esm/resources/avalara_accounts.js +11 -3
  303. package/lib/esm/resources/axerve_gateways.d.ts +23 -24
  304. package/lib/esm/resources/axerve_gateways.js +11 -3
  305. package/lib/esm/resources/axerve_payments.d.ts +32 -32
  306. package/lib/esm/resources/axerve_payments.js +11 -6
  307. package/lib/esm/resources/billing_info_validation_rules.d.ts +16 -17
  308. package/lib/esm/resources/billing_info_validation_rules.js +11 -3
  309. package/lib/esm/resources/bing_geocoders.d.ts +15 -16
  310. package/lib/esm/resources/bing_geocoders.js +11 -3
  311. package/lib/esm/resources/braintree_gateways.d.ts +33 -34
  312. package/lib/esm/resources/braintree_gateways.js +11 -3
  313. package/lib/esm/resources/braintree_payments.d.ts +29 -30
  314. package/lib/esm/resources/braintree_payments.js +11 -3
  315. package/lib/esm/resources/bundles.d.ts +56 -59
  316. package/lib/esm/resources/bundles.js +11 -9
  317. package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +85 -86
  318. package/lib/esm/resources/buy_x_pay_y_promotions.js +11 -9
  319. package/lib/esm/resources/captures.d.ts +36 -39
  320. package/lib/esm/resources/captures.js +13 -11
  321. package/lib/esm/resources/carrier_accounts.d.ts +15 -16
  322. package/lib/esm/resources/carrier_accounts.js +8 -0
  323. package/lib/esm/resources/checkout_com_gateways.d.ts +24 -25
  324. package/lib/esm/resources/checkout_com_gateways.js +11 -3
  325. package/lib/esm/resources/checkout_com_payments.d.ts +38 -41
  326. package/lib/esm/resources/checkout_com_payments.js +11 -9
  327. package/lib/esm/resources/cleanups.d.ts +23 -24
  328. package/lib/esm/resources/cleanups.js +10 -2
  329. package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +32 -33
  330. package/lib/esm/resources/coupon_codes_promotion_rules.js +11 -3
  331. package/lib/esm/resources/coupon_recipients.d.ts +25 -26
  332. package/lib/esm/resources/coupon_recipients.js +11 -3
  333. package/lib/esm/resources/coupons.d.ts +41 -42
  334. package/lib/esm/resources/coupons.js +11 -3
  335. package/lib/esm/resources/custom_promotion_rules.d.ts +30 -31
  336. package/lib/esm/resources/custom_promotion_rules.js +11 -3
  337. package/lib/esm/resources/customer_addresses.d.ts +22 -23
  338. package/lib/esm/resources/customer_addresses.js +11 -3
  339. package/lib/esm/resources/customer_groups.d.ts +16 -17
  340. package/lib/esm/resources/customer_groups.js +11 -3
  341. package/lib/esm/resources/customer_password_resets.d.ts +17 -19
  342. package/lib/esm/resources/customer_password_resets.js +11 -6
  343. package/lib/esm/resources/customer_payment_sources.d.ts +49 -38
  344. package/lib/esm/resources/customer_payment_sources.js +15 -3
  345. package/lib/esm/resources/customer_subscriptions.d.ts +14 -15
  346. package/lib/esm/resources/customer_subscriptions.js +11 -3
  347. package/lib/esm/resources/customers.d.ts +36 -37
  348. package/lib/esm/resources/customers.js +11 -3
  349. package/lib/esm/resources/delivery_lead_times.d.ts +26 -27
  350. package/lib/esm/resources/delivery_lead_times.js +11 -3
  351. package/lib/esm/resources/event_callbacks.d.ts +14 -15
  352. package/lib/esm/resources/event_callbacks.js +8 -0
  353. package/lib/esm/resources/events.d.ts +12 -13
  354. package/lib/esm/resources/events.js +8 -0
  355. package/lib/esm/resources/exports.d.ts +26 -27
  356. package/lib/esm/resources/exports.js +10 -2
  357. package/lib/esm/resources/external_gateways.d.ts +31 -32
  358. package/lib/esm/resources/external_gateways.js +11 -3
  359. package/lib/esm/resources/external_payments.d.ts +22 -23
  360. package/lib/esm/resources/external_payments.js +11 -3
  361. package/lib/esm/resources/external_promotions.d.ts +82 -83
  362. package/lib/esm/resources/external_promotions.js +11 -9
  363. package/lib/esm/resources/external_tax_calculators.d.ts +18 -19
  364. package/lib/esm/resources/external_tax_calculators.js +11 -3
  365. package/lib/esm/resources/fixed_amount_promotions.d.ts +83 -84
  366. package/lib/esm/resources/fixed_amount_promotions.js +11 -9
  367. package/lib/esm/resources/fixed_price_promotions.d.ts +82 -83
  368. package/lib/esm/resources/fixed_price_promotions.js +11 -9
  369. package/lib/esm/resources/free_gift_promotions.d.ts +81 -82
  370. package/lib/esm/resources/free_gift_promotions.js +11 -9
  371. package/lib/esm/resources/free_shipping_promotions.d.ts +74 -75
  372. package/lib/esm/resources/free_shipping_promotions.js +11 -9
  373. package/lib/esm/resources/geocoders.d.ts +12 -13
  374. package/lib/esm/resources/geocoders.js +8 -0
  375. package/lib/esm/resources/gift_card_recipients.d.ts +25 -26
  376. package/lib/esm/resources/gift_card_recipients.js +11 -3
  377. package/lib/esm/resources/gift_cards.d.ts +66 -71
  378. package/lib/esm/resources/gift_cards.js +11 -15
  379. package/lib/esm/resources/google_geocoders.d.ts +15 -16
  380. package/lib/esm/resources/google_geocoders.js +11 -3
  381. package/lib/esm/resources/imports.d.ts +29 -32
  382. package/lib/esm/resources/imports.js +10 -2
  383. package/lib/esm/resources/in_stock_subscriptions.d.ts +35 -38
  384. package/lib/esm/resources/in_stock_subscriptions.js +11 -9
  385. package/lib/esm/resources/inventory_models.d.ts +28 -29
  386. package/lib/esm/resources/inventory_models.js +11 -3
  387. package/lib/esm/resources/inventory_return_locations.d.ts +21 -22
  388. package/lib/esm/resources/inventory_return_locations.js +11 -3
  389. package/lib/esm/resources/inventory_stock_locations.d.ts +24 -25
  390. package/lib/esm/resources/inventory_stock_locations.js +11 -3
  391. package/lib/esm/resources/klarna_gateways.d.ts +22 -23
  392. package/lib/esm/resources/klarna_gateways.js +11 -3
  393. package/lib/esm/resources/klarna_payments.d.ts +27 -29
  394. package/lib/esm/resources/klarna_payments.js +11 -6
  395. package/lib/esm/resources/line_item_options.d.ts +40 -41
  396. package/lib/esm/resources/line_item_options.js +11 -3
  397. package/lib/esm/resources/line_items.d.ts +100 -97
  398. package/lib/esm/resources/line_items.js +11 -9
  399. package/lib/esm/resources/manual_gateways.d.ts +14 -15
  400. package/lib/esm/resources/manual_gateways.js +11 -3
  401. package/lib/esm/resources/manual_tax_calculators.d.ts +20 -21
  402. package/lib/esm/resources/manual_tax_calculators.js +11 -3
  403. package/lib/esm/resources/markets.d.ts +64 -62
  404. package/lib/esm/resources/markets.js +11 -9
  405. package/lib/esm/resources/merchants.d.ts +18 -19
  406. package/lib/esm/resources/merchants.js +11 -3
  407. package/lib/esm/resources/order_amount_promotion_rules.d.ts +35 -36
  408. package/lib/esm/resources/order_amount_promotion_rules.js +11 -3
  409. package/lib/esm/resources/order_copies.d.ts +28 -29
  410. package/lib/esm/resources/order_copies.js +11 -3
  411. package/lib/esm/resources/order_factories.d.ts +20 -21
  412. package/lib/esm/resources/order_factories.js +8 -0
  413. package/lib/esm/resources/order_subscription_items.d.ts +39 -40
  414. package/lib/esm/resources/order_subscription_items.js +11 -3
  415. package/lib/esm/resources/order_subscriptions.d.ts +51 -55
  416. package/lib/esm/resources/order_subscriptions.js +11 -12
  417. package/lib/esm/resources/order_validation_rules.d.ts +12 -13
  418. package/lib/esm/resources/order_validation_rules.js +8 -0
  419. package/lib/esm/resources/orders.d.ts +251 -277
  420. package/lib/esm/resources/orders.js +11 -84
  421. package/lib/esm/resources/organization.d.ts +24 -25
  422. package/lib/esm/resources/organization.js +7 -2
  423. package/lib/esm/resources/packages.d.ts +30 -31
  424. package/lib/esm/resources/packages.js +11 -3
  425. package/lib/esm/resources/parcel_line_items.d.ts +22 -23
  426. package/lib/esm/resources/parcel_line_items.js +11 -3
  427. package/lib/esm/resources/parcels.d.ts +93 -94
  428. package/lib/esm/resources/parcels.js +11 -3
  429. package/lib/esm/resources/payment_gateways.d.ts +12 -13
  430. package/lib/esm/resources/payment_gateways.js +8 -0
  431. package/lib/esm/resources/payment_methods.d.ts +51 -52
  432. package/lib/esm/resources/payment_methods.js +11 -9
  433. package/lib/esm/resources/payment_options.d.ts +23 -24
  434. package/lib/esm/resources/payment_options.js +11 -3
  435. package/lib/esm/resources/paypal_gateways.d.ts +17 -18
  436. package/lib/esm/resources/paypal_gateways.js +11 -3
  437. package/lib/esm/resources/paypal_payments.d.ts +31 -32
  438. package/lib/esm/resources/paypal_payments.js +11 -3
  439. package/lib/esm/resources/percentage_discount_promotions.d.ts +81 -82
  440. package/lib/esm/resources/percentage_discount_promotions.js +11 -9
  441. package/lib/esm/resources/price_frequency_tiers.d.ts +26 -27
  442. package/lib/esm/resources/price_frequency_tiers.js +11 -3
  443. package/lib/esm/resources/price_lists.d.ts +23 -21
  444. package/lib/esm/resources/price_lists.js +11 -3
  445. package/lib/esm/resources/price_tiers.d.ts +17 -18
  446. package/lib/esm/resources/price_tiers.js +8 -0
  447. package/lib/esm/resources/price_volume_tiers.d.ts +26 -27
  448. package/lib/esm/resources/price_volume_tiers.js +11 -3
  449. package/lib/esm/resources/prices.d.ts +40 -41
  450. package/lib/esm/resources/prices.js +11 -3
  451. package/lib/esm/resources/promotion_rules.d.ts +11 -12
  452. package/lib/esm/resources/promotion_rules.js +8 -0
  453. package/lib/esm/resources/promotions.d.ts +30 -31
  454. package/lib/esm/resources/promotions.js +8 -0
  455. package/lib/esm/resources/recurring_order_copies.d.ts +28 -29
  456. package/lib/esm/resources/recurring_order_copies.js +11 -3
  457. package/lib/esm/resources/refunds.d.ts +27 -28
  458. package/lib/esm/resources/refunds.js +12 -4
  459. package/lib/esm/resources/reserved_stocks.d.ts +13 -14
  460. package/lib/esm/resources/reserved_stocks.js +8 -0
  461. package/lib/esm/resources/return_line_items.d.ts +27 -29
  462. package/lib/esm/resources/return_line_items.js +11 -6
  463. package/lib/esm/resources/returns.d.ts +49 -59
  464. package/lib/esm/resources/returns.js +11 -30
  465. package/lib/esm/resources/satispay_gateways.d.ts +22 -23
  466. package/lib/esm/resources/satispay_gateways.js +11 -3
  467. package/lib/esm/resources/satispay_payments.d.ts +29 -31
  468. package/lib/esm/resources/satispay_payments.js +11 -6
  469. package/lib/esm/resources/shipments.d.ts +86 -88
  470. package/lib/esm/resources/shipments.js +15 -33
  471. package/lib/esm/resources/shipping_categories.d.ts +18 -16
  472. package/lib/esm/resources/shipping_categories.js +11 -3
  473. package/lib/esm/resources/shipping_method_tiers.d.ts +17 -18
  474. package/lib/esm/resources/shipping_method_tiers.js +8 -0
  475. package/lib/esm/resources/shipping_methods.d.ts +79 -80
  476. package/lib/esm/resources/shipping_methods.js +11 -9
  477. package/lib/esm/resources/shipping_weight_tiers.d.ts +25 -26
  478. package/lib/esm/resources/shipping_weight_tiers.js +11 -3
  479. package/lib/esm/resources/shipping_zones.d.ts +32 -33
  480. package/lib/esm/resources/shipping_zones.js +11 -3
  481. package/lib/esm/resources/sku_list_items.d.ts +26 -27
  482. package/lib/esm/resources/sku_list_items.js +11 -3
  483. package/lib/esm/resources/sku_list_promotion_rules.d.ts +39 -40
  484. package/lib/esm/resources/sku_list_promotion_rules.js +11 -3
  485. package/lib/esm/resources/sku_lists.d.ts +35 -36
  486. package/lib/esm/resources/sku_lists.js +11 -3
  487. package/lib/esm/resources/sku_options.d.ts +43 -44
  488. package/lib/esm/resources/sku_options.js +11 -3
  489. package/lib/esm/resources/skus.d.ts +56 -57
  490. package/lib/esm/resources/skus.js +11 -3
  491. package/lib/esm/resources/stock_items.d.ts +28 -29
  492. package/lib/esm/resources/stock_items.js +11 -3
  493. package/lib/esm/resources/stock_line_items.d.ts +37 -37
  494. package/lib/esm/resources/stock_line_items.js +11 -3
  495. package/lib/esm/resources/stock_locations.d.ts +32 -30
  496. package/lib/esm/resources/stock_locations.js +11 -3
  497. package/lib/esm/resources/stock_reservations.d.ts +23 -25
  498. package/lib/esm/resources/stock_reservations.js +11 -6
  499. package/lib/esm/resources/stock_transfers.d.ts +44 -50
  500. package/lib/esm/resources/stock_transfers.js +11 -21
  501. package/lib/esm/resources/stripe_gateways.d.ts +22 -23
  502. package/lib/esm/resources/stripe_gateways.js +11 -3
  503. package/lib/esm/resources/stripe_payments.d.ts +34 -35
  504. package/lib/esm/resources/stripe_payments.js +11 -9
  505. package/lib/esm/resources/subscription_models.d.ts +26 -27
  506. package/lib/esm/resources/subscription_models.js +11 -3
  507. package/lib/esm/resources/tags.d.ts +12 -13
  508. package/lib/esm/resources/tags.js +11 -3
  509. package/lib/esm/resources/tax_calculators.d.ts +13 -14
  510. package/lib/esm/resources/tax_calculators.js +8 -0
  511. package/lib/esm/resources/tax_categories.d.ts +30 -31
  512. package/lib/esm/resources/tax_categories.js +11 -3
  513. package/lib/esm/resources/tax_rules.d.ts +51 -52
  514. package/lib/esm/resources/tax_rules.js +11 -3
  515. package/lib/esm/resources/taxjar_accounts.d.ts +21 -22
  516. package/lib/esm/resources/taxjar_accounts.js +11 -3
  517. package/lib/esm/resources/transactions.d.ts +26 -24
  518. package/lib/esm/resources/transactions.js +12 -0
  519. package/lib/esm/resources/versions.d.ts +14 -14
  520. package/lib/esm/resources/versions.js +8 -0
  521. package/lib/esm/resources/voids.d.ts +27 -28
  522. package/lib/esm/resources/voids.js +12 -4
  523. package/lib/esm/resources/webhooks.d.ts +31 -28
  524. package/lib/esm/resources/webhooks.js +11 -6
  525. package/lib/esm/resources/wire_transfers.d.ts +16 -17
  526. package/lib/esm/resources/wire_transfers.js +11 -3
  527. package/lib/esm/static.d.ts +1 -1
  528. package/lib/esm/util.d.ts +8 -1
  529. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  530. package/lib/tsconfig.tsbuildinfo +1 -1
  531. package/package.json +9 -9
package/lib/cjs/api.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- import type { Resource, ResourceRel } from './resource';
2
- import type { TagType } from './resources/tags';
3
- import type { VersionType } from './resources/versions';
4
1
  /**
5
- * ©2023 Commerce Layer Inc.
2
+ * ©2024 Commerce Layer Inc.
6
3
  **/
7
4
  export { default as Addresses } from './resources/addresses';
8
5
  export { default as Adjustments } from './resources/adjustments';
@@ -126,37 +123,3 @@ export { default as Webhooks } from './resources/webhooks';
126
123
  export { default as WireTransfers } from './resources/wire_transfers';
127
124
  export type ResourceTypeLock = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'application' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'buy_x_pay_y_promotions' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'event_callbacks' | 'events' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'geocoders' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_factories' | 'order_subscription_items' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'organization' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'payment_options' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_tiers' | 'price_volume_tiers' | 'prices' | 'promotion_rules' | 'promotions' | 'recurring_order_copies' | 'refunds' | 'reserved_stocks' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_method_tiers' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'versions' | 'voids' | 'webhooks' | 'wire_transfers';
128
125
  export declare const resourceList: readonly ["addresses", "adjustments", "adyen_gateways", "adyen_payments", "application", "attachments", "authorizations", "avalara_accounts", "axerve_gateways", "axerve_payments", "billing_info_validation_rules", "bing_geocoders", "braintree_gateways", "braintree_payments", "bundles", "buy_x_pay_y_promotions", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "cleanups", "coupon_codes_promotion_rules", "coupon_recipients", "coupons", "custom_promotion_rules", "customer_addresses", "customer_groups", "customer_password_resets", "customer_payment_sources", "customer_subscriptions", "customers", "delivery_lead_times", "event_callbacks", "events", "exports", "external_gateways", "external_payments", "external_promotions", "external_tax_calculators", "fixed_amount_promotions", "fixed_price_promotions", "free_gift_promotions", "free_shipping_promotions", "geocoders", "gift_card_recipients", "gift_cards", "google_geocoders", "imports", "in_stock_subscriptions", "inventory_models", "inventory_return_locations", "inventory_stock_locations", "klarna_gateways", "klarna_payments", "line_item_options", "line_items", "manual_gateways", "manual_tax_calculators", "markets", "merchants", "order_amount_promotion_rules", "order_copies", "order_factories", "order_subscription_items", "order_subscriptions", "order_validation_rules", "orders", "organization", "packages", "parcel_line_items", "parcels", "payment_gateways", "payment_methods", "payment_options", "paypal_gateways", "paypal_payments", "percentage_discount_promotions", "price_frequency_tiers", "price_lists", "price_tiers", "price_volume_tiers", "prices", "promotion_rules", "promotions", "recurring_order_copies", "refunds", "reserved_stocks", "return_line_items", "returns", "satispay_gateways", "satispay_payments", "shipments", "shipping_categories", "shipping_method_tiers", "shipping_methods", "shipping_weight_tiers", "shipping_zones", "sku_list_items", "sku_list_promotion_rules", "sku_lists", "sku_options", "skus", "stock_items", "stock_line_items", "stock_locations", "stock_reservations", "stock_transfers", "stripe_gateways", "stripe_payments", "subscription_models", "tags", "tax_calculators", "tax_categories", "tax_rules", "taxjar_accounts", "transactions", "versions", "voids", "webhooks", "wire_transfers"];
129
- export type RetrievableResourceType = ResourceTypeLock;
130
- export type RetrievableResource = Resource & {
131
- type: RetrievableResourceType;
132
- };
133
- export type ListableResourceType = Exclude<ResourceTypeLock, 'application' | 'organization'>;
134
- export type ListableResource = Resource & {
135
- type: ListableResourceType;
136
- };
137
- export type CreatableResourceType = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'attachments' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'buy_x_pay_y_promotions' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_subscription_items' | 'order_subscriptions' | 'orders' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_methods' | 'payment_options' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_volume_tiers' | 'prices' | 'recurring_order_copies' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
138
- export type CreatableResource = Resource & {
139
- type: CreatableResourceType;
140
- };
141
- export type UpdatableResourceType = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'buy_x_pay_y_promotions' | 'captures' | 'checkout_com_gateways' | 'checkout_com_payments' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_subscription_items' | 'order_subscriptions' | 'orders' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_methods' | 'payment_options' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_volume_tiers' | 'prices' | 'recurring_order_copies' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
142
- export type UpdatableResource = Resource & {
143
- type: UpdatableResourceType;
144
- };
145
- export type DeletableResourceType = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'attachments' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'buy_x_pay_y_promotions' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_subscription_items' | 'order_subscriptions' | 'orders' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_methods' | 'payment_options' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_volume_tiers' | 'prices' | 'recurring_order_copies' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
146
- export type DeletableResource = Resource & {
147
- type: DeletableResourceType;
148
- };
149
- export type TaggableResourceType = 'addresses' | 'bundles' | 'buy_x_pay_y_promotions' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'sku_options' | 'skus';
150
- export type TaggableResource = Resource & {
151
- type: TaggableResourceType;
152
- tags?: Array<ResourceRel & {
153
- type: TagType;
154
- }> | null;
155
- };
156
- export type VersionableResourceType = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'buy_x_pay_y_promotions' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | 'customer_addresses' | 'customer_groups' | 'customer_payment_sources' | 'customer_subscriptions' | 'delivery_lead_times' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_card_recipients' | 'gift_cards' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_tiers' | 'price_volume_tiers' | 'prices' | 'promotion_rules' | 'promotions' | 'refunds' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_method_tiers' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'voids' | 'webhooks' | 'wire_transfers';
157
- export type VersionableResource = Resource & {
158
- type: VersionableResourceType;
159
- versions?: Array<ResourceRel & {
160
- type: VersionType;
161
- }> | null;
162
- };
package/lib/cjs/api.js CHANGED
@@ -9,7 +9,7 @@ exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids
9
9
  // ##__API_RESOURCES_START__##
10
10
  // ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
11
11
  /**
12
- * ©2023 Commerce Layer Inc.
12
+ * ©2024 Commerce Layer Inc.
13
13
  **/
14
14
  var addresses_1 = require("./resources/addresses");
15
15
  Object.defineProperty(exports, "Addresses", { enumerable: true, get: function () { return __importDefault(addresses_1).default; } });
@@ -376,3 +376,16 @@ exports.resourceList = [
376
376
  'wire_transfers'
377
377
  // ##__API_RESOURCE_LIST_STOP__##
378
378
  ];
379
+ /*
380
+ type ResourceInfo = {
381
+ name: string;
382
+ type: string;
383
+ api: string;
384
+ }
385
+
386
+
387
+ export const resourceMap: { [res: string]: ResourceInfo } = {
388
+ // ##__API_RESOURCE_MAP_START__##
389
+ // ##__API_RESOURCE_MAP_STOP__##
390
+ } as const
391
+ */
@@ -1,29 +1,24 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import type { AxiosAdapter, AxiosProxyConfig, Method } from 'axios';
3
+ import { AxiosProxyConfig, Method } from 'axios';
4
4
  import type { InterceptorManager } from './interceptor';
5
5
  import type { Agent as HttpAgent } from 'http';
6
6
  import type { Agent as HttpsAgent } from 'https';
7
7
  type ProxyConfig = AxiosProxyConfig | false;
8
- type Adapter = AxiosAdapter;
9
- type RequestParams = Record<string, string | number | boolean>;
10
- type RequestHeaders = Record<string, string>;
11
8
  type RequestConfig = {
12
9
  timeout?: number;
13
- params?: RequestParams;
10
+ params?: {
11
+ [key: string]: string | number | boolean;
12
+ };
14
13
  httpAgent?: HttpAgent;
15
14
  httpsAgent?: HttpsAgent;
16
15
  proxy?: ProxyConfig;
17
- headers?: RequestHeaders;
18
16
  };
19
- type ApiConfig = {
17
+ type ApiClientInitConfig = {
20
18
  organization: string;
21
19
  domain?: string;
22
20
  accessToken: string;
23
- };
24
- type ApiClientInitConfig = ApiConfig & RequestConfig & {
25
- adapter?: Adapter;
26
- };
21
+ } & RequestConfig;
27
22
  type ApiClientConfig = Partial<ApiClientInitConfig>;
28
23
  declare class ApiClient {
29
24
  #private;
@@ -31,10 +26,8 @@ declare class ApiClient {
31
26
  baseUrl: string;
32
27
  interceptors: InterceptorManager;
33
28
  private constructor();
34
- config(config: ApiClientConfig): ApiClient;
35
- adapter(adapter: Adapter): ApiClient;
29
+ config(config: ApiClientConfig): void;
36
30
  request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
37
- private customHeaders;
38
31
  }
39
32
  export default ApiClient;
40
- export type { ApiClientInitConfig, ApiClientConfig, RequestConfig };
33
+ export { ApiClientInitConfig, ApiClientConfig, RequestConfig };
package/lib/cjs/client.js CHANGED
@@ -15,6 +15,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  var _ApiClient_accessToken, _ApiClient_client;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
19
  const axios_1 = __importDefault(require("axios"));
19
20
  const error_1 = require("./error");
20
21
  const config_1 = __importDefault(require("./config"));
@@ -23,11 +24,41 @@ const debug = (0, debug_1.default)('client');
23
24
  const baseURL = (organization, domain) => {
24
25
  return `https://${organization.toLowerCase()}.${domain || config_1.default.default.domain}/api`;
25
26
  };
27
+ const handleError = (error) => {
28
+ let sdkError = new error_1.SdkError({ message: error.message });
29
+ if (axios_1.default.isAxiosError(error)) {
30
+ if (error.response) {
31
+ // The request was made and the server responded with a status code that falls out of the range of 2xx
32
+ const apiError = new error_1.ApiError(sdkError);
33
+ apiError.type = error_1.ErrorType.RESPONSE;
34
+ apiError.status = error.response.status;
35
+ apiError.code = String(apiError.status);
36
+ apiError.errors = error.response.data.errors;
37
+ sdkError = apiError;
38
+ }
39
+ else if (error.request) {
40
+ // The request was made but no response was received
41
+ // `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
42
+ sdkError.type = error_1.ErrorType.REQUEST;
43
+ sdkError.request = error.request;
44
+ }
45
+ else {
46
+ // Something happened in setting up the request that triggered an Error
47
+ sdkError.type = error_1.ErrorType.CLIENT;
48
+ }
49
+ }
50
+ else if (axios_1.default.isCancel(error))
51
+ sdkError.type = error_1.ErrorType.CANCEL;
52
+ else
53
+ sdkError.source = error;
54
+ throw sdkError;
55
+ };
26
56
  class ApiClient {
27
57
  static create(options) {
28
- for (const attr of config_1.default.client.requiredAttributes)
29
- if (!options || !options[attr])
30
- throw new error_1.SdkError({ message: `Undefined '${attr}' parameter` });
58
+ if (!(options === null || options === void 0 ? void 0 : options.organization))
59
+ throw new Error("Undefined 'organization' parameter");
60
+ if (!(options === null || options === void 0 ? void 0 : options.accessToken))
61
+ throw new Error("Undefined 'accessToken' parameter");
31
62
  return new ApiClient(options);
32
63
  }
33
64
  constructor(options) {
@@ -42,21 +73,11 @@ class ApiClient {
42
73
  httpAgent: options.httpAgent,
43
74
  httpsAgent: options.httpsAgent,
44
75
  };
45
- // Set custom headers
46
- const customHeaders = this.customHeaders(options.headers);
47
- const axiosOptions = {
48
- baseURL: this.baseUrl,
49
- timeout: config_1.default.client.timeout,
50
- headers: {
51
- ...customHeaders,
76
+ const axiosOptions = Object.assign({ baseURL: this.baseUrl, timeout: config_1.default.client.timeout, headers: {
52
77
  'Accept': 'application/vnd.api+json',
53
78
  'Content-Type': 'application/vnd.api+json',
54
- 'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
55
- },
56
- ...axiosConfig
57
- };
58
- if (options.adapter)
59
- axiosOptions.adapter = options.adapter;
79
+ 'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f"),
80
+ } }, axiosConfig);
60
81
  debug('axios options: %O', axiosOptions);
61
82
  __classPrivateFieldSet(this, _ApiClient_client, axios_1.default.create(axiosOptions), "f");
62
83
  this.interceptors = __classPrivateFieldGet(this, _ApiClient_client, "f").interceptors;
@@ -80,16 +101,6 @@ class ApiClient {
80
101
  __classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
81
102
  def.headers.common.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
82
103
  }
83
- if (config.headers)
84
- def.headers.common = this.customHeaders(config.headers);
85
- if (config.adapter)
86
- this.adapter(config.adapter);
87
- return this;
88
- }
89
- adapter(adapter) {
90
- if (adapter)
91
- __classPrivateFieldGet(this, _ApiClient_client, "f").defaults.adapter = adapter;
92
- return this;
93
104
  }
94
105
  async request(method, path, body, options) {
95
106
  debug('request %s %s, %O, %O', method, path, body || {}, options || {});
@@ -98,26 +109,15 @@ class ApiClient {
98
109
  // Runtime request parameters
99
110
  const baseUrl = (options === null || options === void 0 ? void 0 : options.organization) ? baseURL(options.organization, options.domain) : undefined;
100
111
  const accessToken = (options === null || options === void 0 ? void 0 : options.accessToken) || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
101
- const headers = this.customHeaders(options === null || options === void 0 ? void 0 : options.headers);
102
- if (accessToken)
103
- headers.Authorization = 'Bearer ' + accessToken;
104
- const requestParams = { method, baseURL: baseUrl, url, data, ...options, headers };
112
+ const headers = accessToken ? { 'Authorization': 'Bearer ' + accessToken } : undefined;
113
+ const requestParams = Object.assign({ method, baseURL: baseUrl, url, data, headers }, options);
105
114
  debug('request params: %O', requestParams);
106
115
  // const start = Date.now()
107
116
  return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
108
117
  .then(response => response.data)
109
- .catch(error => (0, error_1.handleError)(error));
118
+ .catch(error => handleError(error));
110
119
  // .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
111
120
  }
112
- customHeaders(headers) {
113
- const customHeaders = {};
114
- if (headers) {
115
- for (const [name, value] of Object.entries(headers))
116
- if (!['accept', 'content-type', 'authorization'].includes(name.toLowerCase()))
117
- customHeaders[name] = value;
118
- }
119
- return customHeaders;
120
- }
121
121
  }
122
122
  _ApiClient_accessToken = new WeakMap(), _ApiClient_client = new WeakMap();
123
123
  exports.default = ApiClient;
@@ -1,15 +1,16 @@
1
1
  import * as api from './api';
2
- import type { ApiError } from './error';
2
+ import { ApiError } from './error';
3
3
  import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
- import { type ResourcesInitConfig } from './resource';
5
- declare const OPEN_API_SCHEMA_VERSION = "4.16.0";
4
+ import { ResourcesInitConfig } from './resource';
5
+ declare const OPEN_API_SCHEMA_VERSION = "4.23.0";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = {};
8
8
  type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
9
9
  type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
10
10
  declare class CommerceLayerClient {
11
11
  #private;
12
- readonly openApiSchemaVersion = "4.16.0";
12
+ static get openApiSchemaVersion(): string;
13
+ readonly openApiSchemaVersion = "4.23.0";
13
14
  addresses: api.Addresses;
14
15
  adjustments: api.Adjustments;
15
16
  adyen_gateways: api.AdyenGateways;
@@ -133,7 +134,7 @@ declare class CommerceLayerClient {
133
134
  constructor(config: CommerceLayerInitConfig);
134
135
  get currentOrganization(): string;
135
136
  private localConfig;
136
- config(config: CommerceLayerConfig): CommerceLayerClient;
137
+ config(config: CommerceLayerConfig): void;
137
138
  resources(): readonly string[];
138
139
  isApiError(error: any): error is ApiError;
139
140
  addRequestInterceptor(onFulfilled?: RequestInterceptor, onRejected?: ErrorInterceptor): number;
@@ -45,19 +45,18 @@ const resource_1 = __importDefault(require("./resource"));
45
45
  const debug_1 = __importDefault(require("./debug"));
46
46
  const debug = (0, debug_1.default)('commercelayer');
47
47
  // Autogenerated schema version number, do not remove this line
48
- const OPEN_API_SCHEMA_VERSION = '4.16.0';
48
+ const OPEN_API_SCHEMA_VERSION = '4.23.0';
49
49
  exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
50
50
  class CommerceLayerClient {
51
+ static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
51
52
  // ##__CL_RESOURCES_DEF_STOP__##
52
53
  constructor(config) {
53
- // static get openApiSchemaVersion(): string { return OPEN_API_SCHEMA_VERSION }
54
54
  this.openApiSchemaVersion = OPEN_API_SCHEMA_VERSION;
55
55
  _CommerceLayerClient_adapter.set(this, void 0);
56
56
  _CommerceLayerClient_organization.set(this, void 0);
57
57
  debug('new commercelayer instance %O', config);
58
58
  __classPrivateFieldSet(this, _CommerceLayerClient_adapter, new resource_1.default(config), "f");
59
59
  __classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
60
- // this.#environment = 'test'
61
60
  // ##__CL_RESOURCES_INIT_START__##
62
61
  // ##__CL_RESOURCES_INIT_TEMPLATE:: ##__TAB__####__TAB__##this.##__RESOURCE_TYPE__## = new api.##__RESOURCE_CLASS__##(this.#adapter)
63
62
  this.addresses = new api.Addresses(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
@@ -183,8 +182,6 @@ class CommerceLayerClient {
183
182
  // ##__CL_RESOURCES_INIT_STOP__##
184
183
  }
185
184
  get currentOrganization() { return __classPrivateFieldGet(this, _CommerceLayerClient_organization, "f"); }
186
- // get currentAccessToken(): string { return this.#adapter?.clientInstance?.currentAccessToken}
187
- // get environment(): ApiMode { return this.#environment }
188
185
  localConfig(config) {
189
186
  if (config.organization)
190
187
  __classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
@@ -198,7 +195,6 @@ class CommerceLayerClient {
198
195
  if (!config.organization)
199
196
  config.organization = this.currentOrganization;
200
197
  __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").config(config);
201
- return this;
202
198
  }
203
199
  resources() {
204
200
  return static_1.CommerceLayerStatic.resources();
@@ -214,7 +210,7 @@ class CommerceLayerClient {
214
210
  return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors.response.use(onFulfilled, onRejected);
215
211
  }
216
212
  removeInterceptor(type, id) {
217
- __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors[type].eject(id);
213
+ return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors[type].eject(id);
218
214
  }
219
215
  addRawResponseReader(options) {
220
216
  const reader = {
@@ -235,7 +231,7 @@ class CommerceLayerClient {
235
231
  removeRawResponseReader(reader) {
236
232
  const id = (typeof reader === 'number') ? reader : reader === null || reader === void 0 ? void 0 : reader.id;
237
233
  if (id && (id >= 0))
238
- this.removeInterceptor('response', id);
234
+ return this.removeInterceptor('response', id);
239
235
  }
240
236
  }
241
237
  _CommerceLayerClient_adapter = new WeakMap(), _CommerceLayerClient_organization = new WeakMap();
@@ -2,4 +2,3 @@ import type { ResourceId, ResourceType } from './resource';
2
2
  declare const isResourceId: (resource: any) => resource is ResourceId;
3
3
  declare const isResourceType: (resource: any) => resource is ResourceType;
4
4
  export { isResourceId, isResourceType };
5
- export type ObjectType = Record<string, any>;
package/lib/cjs/common.js CHANGED
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  exports.isResourceType = exports.isResourceId = void 0;
4
6
  const api_1 = require("./api");
@@ -10,14 +12,3 @@ const isResourceType = (resource) => {
10
12
  return resource && (typeof resource.type !== 'undefined') && resource.type && api_1.resourceList.includes(resource.type);
11
13
  };
12
14
  exports.isResourceType = isResourceType;
13
- /*
14
- // Nullable types
15
- type StringNullable = string | null
16
- type NumberNullable = number | null
17
- type BooleanNullable = boolean | null
18
- type ResourceNullable<R extends Resource> = R | null
19
- type ResourceArrayNullable<R extends Resource> = R[] | null
20
-
21
-
22
- export type { StringNullable, NumberNullable, BooleanNullable, ResourceNullable, ResourceArrayNullable }
23
- */
@@ -6,7 +6,6 @@ declare const config: {
6
6
  };
7
7
  readonly client: {
8
8
  readonly timeout: 15000;
9
- readonly requiredAttributes: readonly ["organization", "accessToken"];
10
9
  };
11
10
  };
12
11
  export default config;
package/lib/cjs/config.js CHANGED
@@ -1,16 +1,13 @@
1
1
  "use strict";
2
- // export type ApiMode = 'test' | 'live'
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  const config = {
5
4
  default: {
6
- // environment: 'test',
7
5
  domain: 'commercelayer.io',
8
6
  pageNumber: 1,
9
7
  pageSize: 10,
10
8
  },
11
9
  client: {
12
10
  timeout: 15000,
13
- requiredAttributes: ['organization', 'accessToken'],
14
11
  }
15
12
  };
16
13
  exports.default = config;
package/lib/cjs/debug.js CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ /* eslint-disable @typescript-eslint/no-unused-vars */
4
+ // import Debug from 'debug'
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  /* Nope debugger */
4
7
  const debuggerFunction = (_pattern, ..._args) => {
@@ -7,6 +10,7 @@ const debuggerFunction = (_pattern, ..._args) => {
7
10
  let debuggerFactory = (_namespace) => debuggerFunction;
8
11
  /* Try loading 'debug' module */
9
12
  try {
13
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
10
14
  const debugModule = require('debug');
11
15
  if (debugModule && (typeof debugModule === 'function'))
12
16
  debuggerFactory = debugModule;
@@ -2,9 +2,8 @@ declare enum ErrorType {
2
2
  CLIENT = "client",
3
3
  REQUEST = "request",
4
4
  RESPONSE = "response",
5
- CANCEL = "cancel",
6
- PARSE = "parse",
7
- GENERIC = "generic"
5
+ GENERIC = "generic",
6
+ CANCEL = "cancel"
8
7
  }
9
8
  declare class SdkError extends Error {
10
9
  static NAME: string;
@@ -23,9 +22,7 @@ declare class ApiError extends SdkError {
23
22
  static isApiError(error: any): error is ApiError;
24
23
  errors: any[];
25
24
  status?: number;
26
- statusText?: string;
27
25
  constructor(error: SdkError);
28
26
  first(): any;
29
27
  }
30
- declare const handleError: (error: Error) => never;
31
- export { SdkError, ApiError, ErrorType, handleError };
28
+ export { SdkError, ApiError, ErrorType };
package/lib/cjs/error.js CHANGED
@@ -1,20 +1,18 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5
3
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.handleError = exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
7
- const axios_1 = __importDefault(require("axios"));
4
+ exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
8
5
  var ErrorType;
9
6
  (function (ErrorType) {
10
7
  ErrorType["CLIENT"] = "client";
11
8
  ErrorType["REQUEST"] = "request";
12
9
  ErrorType["RESPONSE"] = "response";
13
- ErrorType["CANCEL"] = "cancel";
14
- ErrorType["PARSE"] = "parse";
15
10
  ErrorType["GENERIC"] = "generic";
16
- })(ErrorType || (exports.ErrorType = ErrorType = {}));
11
+ ErrorType["CANCEL"] = "cancel";
12
+ })(ErrorType || (ErrorType = {}));
13
+ exports.ErrorType = ErrorType;
17
14
  class SdkError extends Error {
15
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
18
16
  static isSdkError(error) {
19
17
  return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
20
18
  }
@@ -27,11 +25,12 @@ class SdkError extends Error {
27
25
  exports.SdkError = SdkError;
28
26
  SdkError.NAME = 'SdkError';
29
27
  class ApiError extends SdkError {
28
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
30
29
  static isApiError(error) {
31
30
  return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
32
31
  }
33
32
  constructor(error) {
34
- super({ ...error, type: ErrorType.RESPONSE });
33
+ super(Object.assign(Object.assign({}, error), { type: ErrorType.RESPONSE }));
35
34
  this.errors = [];
36
35
  this.name = ApiError.NAME; // this.constructor.name
37
36
  }
@@ -42,36 +41,3 @@ class ApiError extends SdkError {
42
41
  }
43
42
  exports.ApiError = ApiError;
44
43
  ApiError.NAME = 'ApiError';
45
- const handleError = (error) => {
46
- let sdkError = new SdkError({ message: error.message });
47
- if (axios_1.default.isAxiosError(error)) {
48
- if (error.response) {
49
- // The request was made and the server responded with a status code that falls out of the range of 2xx
50
- const apiError = new ApiError(sdkError);
51
- apiError.type = ErrorType.RESPONSE;
52
- apiError.status = error.response.status;
53
- apiError.statusText = error.response.statusText;
54
- apiError.code = String(apiError.status);
55
- apiError.errors = error.response.data.errors;
56
- if (!apiError.message && apiError.statusText)
57
- apiError.message = apiError.statusText;
58
- sdkError = apiError;
59
- }
60
- else if (error.request) {
61
- // The request was made but no response was received
62
- // `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
63
- sdkError.type = ErrorType.REQUEST;
64
- sdkError.request = error.request;
65
- }
66
- else {
67
- // Something happened in setting up the request that triggered an Error
68
- sdkError.type = ErrorType.CLIENT;
69
- }
70
- }
71
- else if (axios_1.default.isCancel(error))
72
- sdkError.type = ErrorType.CANCEL;
73
- else
74
- sdkError.source = error;
75
- throw sdkError;
76
- };
77
- exports.handleError = handleError;
@@ -2,6 +2,6 @@ export { default, CommerceLayer } from './commercelayer';
2
2
  export type { CommerceLayerClient } from './commercelayer';
3
3
  export { CommerceLayerStatic } from './static';
4
4
  export type { QueryParamsRetrieve, QueryParamsList, QueryParams } from './query';
5
- export type * from './model';
5
+ export * from './model';
6
6
  export type { RequestObj, ResponseObj, ErrorObj, HeadersObj } from './interceptor';
7
7
  export type { SdkError, ApiError, ErrorType } from './error';
package/lib/cjs/index.js CHANGED
@@ -1,4 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
@@ -11,3 +25,5 @@ Object.defineProperty(exports, "CommerceLayer", { enumerable: true, get: functio
11
25
  // Commerce Layer static functions
12
26
  var static_1 = require("./static");
13
27
  Object.defineProperty(exports, "CommerceLayerStatic", { enumerable: true, get: function () { return static_1.CommerceLayerStatic; } });
28
+ // Resource model types
29
+ __exportStar(require("./model"), exports);
@@ -1,4 +1,4 @@
1
- import type { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders, RawAxiosResponseHeaders } from 'axios';
1
+ import { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders, RawAxiosResponseHeaders } from 'axios';
2
2
  type InterceptorManager = {
3
3
  request: AxiosInterceptorManager<AxiosRequestConfig>;
4
4
  response: AxiosInterceptorManager<any>;
@@ -7,11 +7,7 @@ type RequestObj = AxiosRequestConfig;
7
7
  type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
8
8
  type ResponseObj = AxiosResponse;
9
9
  type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
10
- type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-count' | 'x-ratelimit-period' | 'x-ratelimit-interval' | 'x-ratelimit-remaining';
11
- type ApiHeaders = {
12
- [key in ApiHeadersList]: string | number | boolean;
13
- };
14
- type HeadersObj = (AxiosResponseHeaders | RawAxiosResponseHeaders) & ApiHeaders;
10
+ type HeadersObj = AxiosResponseHeaders | RawAxiosResponseHeaders;
15
11
  type ErrorObj = AxiosError;
16
12
  type ErrorInterceptor = (error: ErrorObj) => ErrorObj;
17
13
  type InterceptorType = 'request' | 'response';
@@ -35,11 +35,7 @@ const denormalizeResource = (res, included) => {
35
35
  debug('denormalize resource: %O, %o', res, included || {});
36
36
  if (!res)
37
37
  return res;
38
- const resource = {
39
- id: res.id,
40
- type: res.type,
41
- ...res.attributes,
42
- };
38
+ const resource = Object.assign({ id: res.id, type: res.type }, res.attributes);
43
39
  if (res.relationships)
44
40
  Object.keys(res.relationships).forEach(key => {
45
41
  const rel = res.relationships[key].data;
@@ -64,10 +60,7 @@ const normalize = (resource) => {
64
60
  if (['type', 'id'].includes(field))
65
61
  continue;
66
62
  const value = resource[field];
67
- if (Array.isArray(value) && (value.length === 1) && (0, common_1.isResourceType)(value[0]) && (value[0].id === null)) {
68
- relationships[field] = { data: [] };
69
- }
70
- else if (value && (0, common_1.isResourceType)(value) && (value.id === null)) {
63
+ if (value && (0, common_1.isResourceType)(value) && value.id === null) {
71
64
  relationships[field] = { data: null };
72
65
  }
73
66
  else if (value && ((0, common_1.isResourceId)(value) || (Array.isArray(value) && (0, common_1.isResourceId)(value[0])))) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * ©2023 Commerce Layer Inc.
2
+ * ©2024 Commerce Layer Inc.
3
3
  **/
4
4
  export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
5
5
  export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';