@commercelayer/sdk 4.48.0 → 4.50.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 (551) hide show
  1. package/lib/cjs/api.d.ts +1 -126
  2. package/lib/cjs/api.js +1 -394
  3. package/lib/cjs/client.d.ts +1 -31
  4. package/lib/cjs/client.js +1 -123
  5. package/lib/cjs/commercelayer.d.ts +1 -152
  6. package/lib/cjs/commercelayer.js +1 -243
  7. package/lib/cjs/common.d.ts +1 -4
  8. package/lib/cjs/common.js +1 -14
  9. package/lib/cjs/config.d.ts +1 -11
  10. package/lib/cjs/config.js +1 -13
  11. package/lib/cjs/debug.d.ts +1 -3
  12. package/lib/cjs/debug.js +1 -42
  13. package/lib/cjs/error.d.ts +1 -28
  14. package/lib/cjs/error.js +1 -43
  15. package/lib/cjs/index.d.ts +1 -7
  16. package/lib/cjs/index.js +1 -29
  17. package/lib/cjs/interceptor.d.ts +1 -21
  18. package/lib/cjs/interceptor.js +1 -2
  19. package/lib/cjs/jsonapi.d.ts +1 -5
  20. package/lib/cjs/jsonapi.js +1 -82
  21. package/lib/cjs/model.d.ts +1 -124
  22. package/lib/cjs/model.js +1 -3
  23. package/lib/cjs/query.d.ts +1 -23
  24. package/lib/cjs/query.js +1 -51
  25. package/lib/cjs/resource.d.ts +1 -75
  26. package/lib/cjs/resource.js +1 -145
  27. package/lib/cjs/resources/addresses.d.ts +1 -102
  28. package/lib/cjs/resources/addresses.js +1 -49
  29. package/lib/cjs/resources/adjustments.d.ts +1 -41
  30. package/lib/cjs/resources/adjustments.js +1 -37
  31. package/lib/cjs/resources/adyen_gateways.d.ts +1 -59
  32. package/lib/cjs/resources/adyen_gateways.js +1 -45
  33. package/lib/cjs/resources/adyen_payments.d.ts +1 -49
  34. package/lib/cjs/resources/adyen_payments.js +1 -45
  35. package/lib/cjs/resources/application.d.ts +1 -21
  36. package/lib/cjs/resources/application.js +1 -21
  37. package/lib/cjs/resources/attachments.d.ts +1 -156
  38. package/lib/cjs/resources/attachments.js +1 -33
  39. package/lib/cjs/resources/authorizations.d.ts +1 -66
  40. package/lib/cjs/resources/authorizations.js +1 -51
  41. package/lib/cjs/resources/avalara_accounts.d.ts +1 -58
  42. package/lib/cjs/resources/avalara_accounts.js +1 -49
  43. package/lib/cjs/resources/axerve_gateways.d.ts +1 -47
  44. package/lib/cjs/resources/axerve_gateways.js +1 -45
  45. package/lib/cjs/resources/axerve_payments.d.ts +1 -52
  46. package/lib/cjs/resources/axerve_payments.js +1 -45
  47. package/lib/cjs/resources/billing_info_validation_rules.d.ts +1 -38
  48. package/lib/cjs/resources/billing_info_validation_rules.js +1 -45
  49. package/lib/cjs/resources/bing_geocoders.d.ts +1 -35
  50. package/lib/cjs/resources/bing_geocoders.js +1 -41
  51. package/lib/cjs/resources/braintree_gateways.d.ts +1 -59
  52. package/lib/cjs/resources/braintree_gateways.js +1 -45
  53. package/lib/cjs/resources/braintree_payments.d.ts +1 -51
  54. package/lib/cjs/resources/braintree_payments.js +1 -45
  55. package/lib/cjs/resources/bundles.d.ts +1 -90
  56. package/lib/cjs/resources/bundles.js +1 -61
  57. package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +1 -134
  58. package/lib/cjs/resources/buy_x_pay_y_promotions.js +1 -81
  59. package/lib/cjs/resources/captures.d.ts +1 -57
  60. package/lib/cjs/resources/captures.js +1 -51
  61. package/lib/cjs/resources/carrier_accounts.d.ts +1 -29
  62. package/lib/cjs/resources/carrier_accounts.js +1 -36
  63. package/lib/cjs/resources/checkout_com_gateways.d.ts +1 -48
  64. package/lib/cjs/resources/checkout_com_gateways.js +1 -45
  65. package/lib/cjs/resources/checkout_com_payments.d.ts +1 -62
  66. package/lib/cjs/resources/checkout_com_payments.js +1 -45
  67. package/lib/cjs/resources/cleanups.d.ts +1 -39
  68. package/lib/cjs/resources/cleanups.js +1 -38
  69. package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +1 -66
  70. package/lib/cjs/resources/coupon_codes_promotion_rules.js +1 -41
  71. package/lib/cjs/resources/coupon_recipients.d.ts +1 -47
  72. package/lib/cjs/resources/coupon_recipients.js +1 -45
  73. package/lib/cjs/resources/coupons.d.ts +1 -70
  74. package/lib/cjs/resources/coupons.js +1 -53
  75. package/lib/cjs/resources/custom_promotion_rules.d.ts +1 -61
  76. package/lib/cjs/resources/custom_promotion_rules.js +1 -37
  77. package/lib/cjs/resources/customer_addresses.d.ts +1 -49
  78. package/lib/cjs/resources/customer_addresses.js +1 -49
  79. package/lib/cjs/resources/customer_groups.d.ts +1 -39
  80. package/lib/cjs/resources/customer_groups.js +1 -49
  81. package/lib/cjs/resources/customer_password_resets.d.ts +1 -36
  82. package/lib/cjs/resources/customer_password_resets.js +1 -41
  83. package/lib/cjs/resources/customer_payment_sources.d.ts +1 -85
  84. package/lib/cjs/resources/customer_payment_sources.js +1 -45
  85. package/lib/cjs/resources/customer_subscriptions.d.ts +1 -34
  86. package/lib/cjs/resources/customer_subscriptions.js +1 -45
  87. package/lib/cjs/resources/customers.d.ts +1 -75
  88. package/lib/cjs/resources/customers.js +1 -77
  89. package/lib/cjs/resources/delivery_lead_times.d.ts +1 -54
  90. package/lib/cjs/resources/delivery_lead_times.js +1 -49
  91. package/lib/cjs/resources/event_callbacks.d.ts +1 -24
  92. package/lib/cjs/resources/event_callbacks.js +1 -28
  93. package/lib/cjs/resources/events.d.ts +1 -24
  94. package/lib/cjs/resources/events.js +1 -32
  95. package/lib/cjs/resources/exports.d.ts +1 -40
  96. package/lib/cjs/resources/exports.js +1 -34
  97. package/lib/cjs/resources/external_gateways.d.ts +1 -55
  98. package/lib/cjs/resources/external_gateways.js +1 -45
  99. package/lib/cjs/resources/external_payments.d.ts +1 -47
  100. package/lib/cjs/resources/external_payments.js +1 -49
  101. package/lib/cjs/resources/external_promotions.d.ts +1 -132
  102. package/lib/cjs/resources/external_promotions.js +1 -81
  103. package/lib/cjs/resources/external_tax_calculators.d.ts +1 -43
  104. package/lib/cjs/resources/external_tax_calculators.js +1 -45
  105. package/lib/cjs/resources/fixed_amount_promotions.d.ts +1 -130
  106. package/lib/cjs/resources/fixed_amount_promotions.js +1 -81
  107. package/lib/cjs/resources/fixed_price_promotions.d.ts +1 -130
  108. package/lib/cjs/resources/fixed_price_promotions.js +1 -81
  109. package/lib/cjs/resources/free_gift_promotions.d.ts +1 -128
  110. package/lib/cjs/resources/free_gift_promotions.js +1 -81
  111. package/lib/cjs/resources/free_shipping_promotions.d.ts +1 -122
  112. package/lib/cjs/resources/free_shipping_promotions.js +1 -77
  113. package/lib/cjs/resources/geocoders.d.ts +1 -24
  114. package/lib/cjs/resources/geocoders.js +1 -32
  115. package/lib/cjs/resources/gift_card_recipients.d.ts +1 -47
  116. package/lib/cjs/resources/gift_card_recipients.js +1 -45
  117. package/lib/cjs/resources/gift_cards.d.ts +1 -99
  118. package/lib/cjs/resources/gift_cards.js +1 -57
  119. package/lib/cjs/resources/google_geocoders.d.ts +1 -35
  120. package/lib/cjs/resources/google_geocoders.js +1 -41
  121. package/lib/cjs/resources/imports.d.ts +1 -43
  122. package/lib/cjs/resources/imports.js +1 -34
  123. package/lib/cjs/resources/in_stock_subscriptions.d.ts +1 -65
  124. package/lib/cjs/resources/in_stock_subscriptions.js +1 -53
  125. package/lib/cjs/resources/inventory_models.d.ts +1 -54
  126. package/lib/cjs/resources/inventory_models.js +1 -49
  127. package/lib/cjs/resources/inventory_return_locations.d.ts +1 -46
  128. package/lib/cjs/resources/inventory_return_locations.js +1 -45
  129. package/lib/cjs/resources/inventory_stock_locations.d.ts +1 -49
  130. package/lib/cjs/resources/inventory_stock_locations.js +1 -45
  131. package/lib/cjs/resources/klarna_gateways.d.ts +1 -47
  132. package/lib/cjs/resources/klarna_gateways.js +1 -45
  133. package/lib/cjs/resources/klarna_payments.d.ts +1 -46
  134. package/lib/cjs/resources/klarna_payments.js +1 -45
  135. package/lib/cjs/resources/line_item_options.d.ts +1 -68
  136. package/lib/cjs/resources/line_item_options.js +1 -49
  137. package/lib/cjs/resources/line_items.d.ts +1 -166
  138. package/lib/cjs/resources/line_items.js +1 -65
  139. package/lib/cjs/resources/manual_gateways.d.ts +1 -33
  140. package/lib/cjs/resources/manual_gateways.js +1 -41
  141. package/lib/cjs/resources/manual_tax_calculators.d.ts +1 -44
  142. package/lib/cjs/resources/manual_tax_calculators.js +1 -49
  143. package/lib/cjs/resources/markets.d.ts +1 -104
  144. package/lib/cjs/resources/markets.js +1 -65
  145. package/lib/cjs/resources/merchants.d.ts +1 -41
  146. package/lib/cjs/resources/merchants.js +1 -45
  147. package/lib/cjs/resources/order_amount_promotion_rules.d.ts +1 -66
  148. package/lib/cjs/resources/order_amount_promotion_rules.js +1 -37
  149. package/lib/cjs/resources/order_copies.d.ts +1 -50
  150. package/lib/cjs/resources/order_copies.js +1 -49
  151. package/lib/cjs/resources/order_factories.d.ts +1 -33
  152. package/lib/cjs/resources/order_factories.js +1 -36
  153. package/lib/cjs/resources/order_subscription_items.d.ts +1 -71
  154. package/lib/cjs/resources/order_subscription_items.js +1 -41
  155. package/lib/cjs/resources/order_subscriptions.d.ts +1 -94
  156. package/lib/cjs/resources/order_subscriptions.js +1 -77
  157. package/lib/cjs/resources/order_validation_rules.d.ts +1 -26
  158. package/lib/cjs/resources/order_validation_rules.js +1 -36
  159. package/lib/cjs/resources/orders.d.ts +1 -359
  160. package/lib/cjs/resources/orders.js +1 -157
  161. package/lib/cjs/resources/organization.d.ts +1 -33
  162. package/lib/cjs/resources/organization.js +1 -21
  163. package/lib/cjs/resources/packages.d.ts +1 -59
  164. package/lib/cjs/resources/packages.js +1 -49
  165. package/lib/cjs/resources/parcel_line_items.d.ts +1 -46
  166. package/lib/cjs/resources/parcel_line_items.js +1 -45
  167. package/lib/cjs/resources/parcels.d.ts +1 -125
  168. package/lib/cjs/resources/parcels.js +1 -57
  169. package/lib/cjs/resources/payment_gateways.d.ts +1 -24
  170. package/lib/cjs/resources/payment_gateways.js +1 -32
  171. package/lib/cjs/resources/payment_methods.d.ts +1 -80
  172. package/lib/cjs/resources/payment_methods.js +1 -49
  173. package/lib/cjs/resources/payment_options.d.ts +1 -43
  174. package/lib/cjs/resources/payment_options.js +1 -41
  175. package/lib/cjs/resources/paypal_gateways.d.ts +1 -40
  176. package/lib/cjs/resources/paypal_gateways.js +1 -45
  177. package/lib/cjs/resources/paypal_payments.d.ts +1 -52
  178. package/lib/cjs/resources/paypal_payments.js +1 -45
  179. package/lib/cjs/resources/percentage_discount_promotions.d.ts +1 -128
  180. package/lib/cjs/resources/percentage_discount_promotions.js +1 -81
  181. package/lib/cjs/resources/price_frequency_tiers.d.ts +1 -52
  182. package/lib/cjs/resources/price_frequency_tiers.js +1 -49
  183. package/lib/cjs/resources/price_list_schedulers.d.ts +1 -0
  184. package/lib/cjs/resources/price_list_schedulers.js +1 -0
  185. package/lib/cjs/resources/price_lists.d.ts +1 -45
  186. package/lib/cjs/resources/price_lists.js +1 -45
  187. package/lib/cjs/resources/price_tiers.d.ts +1 -31
  188. package/lib/cjs/resources/price_tiers.js +1 -36
  189. package/lib/cjs/resources/price_volume_tiers.d.ts +1 -52
  190. package/lib/cjs/resources/price_volume_tiers.js +1 -49
  191. package/lib/cjs/resources/prices.d.ts +1 -83
  192. package/lib/cjs/resources/prices.js +1 -73
  193. package/lib/cjs/resources/promotion_rules.d.ts +1 -28
  194. package/lib/cjs/resources/promotion_rules.js +1 -28
  195. package/lib/cjs/resources/promotions.d.ts +1 -62
  196. package/lib/cjs/resources/promotions.js +1 -68
  197. package/lib/cjs/resources/recurring_order_copies.d.ts +1 -52
  198. package/lib/cjs/resources/recurring_order_copies.js +1 -49
  199. package/lib/cjs/resources/refunds.d.ts +1 -43
  200. package/lib/cjs/resources/refunds.js +1 -44
  201. package/lib/cjs/resources/reserved_stocks.d.ts +1 -27
  202. package/lib/cjs/resources/reserved_stocks.js +1 -36
  203. package/lib/cjs/resources/resource_errors.d.ts +1 -22
  204. package/lib/cjs/resources/resource_errors.js +1 -24
  205. package/lib/cjs/resources/return_line_items.d.ts +1 -50
  206. package/lib/cjs/resources/return_line_items.js +1 -41
  207. package/lib/cjs/resources/returns.d.ts +1 -86
  208. package/lib/cjs/resources/returns.js +1 -73
  209. package/lib/cjs/resources/satispay_gateways.d.ts +1 -45
  210. package/lib/cjs/resources/satispay_gateways.js +1 -45
  211. package/lib/cjs/resources/satispay_payments.d.ts +1 -48
  212. package/lib/cjs/resources/satispay_payments.js +1 -45
  213. package/lib/cjs/resources/shipments.d.ts +1 -139
  214. package/lib/cjs/resources/shipments.js +1 -105
  215. package/lib/cjs/resources/shipping_categories.d.ts +1 -39
  216. package/lib/cjs/resources/shipping_categories.js +1 -45
  217. package/lib/cjs/resources/shipping_method_tiers.d.ts +1 -31
  218. package/lib/cjs/resources/shipping_method_tiers.js +1 -36
  219. package/lib/cjs/resources/shipping_methods.d.ts +1 -121
  220. package/lib/cjs/resources/shipping_methods.js +1 -69
  221. package/lib/cjs/resources/shipping_weight_tiers.d.ts +1 -49
  222. package/lib/cjs/resources/shipping_weight_tiers.js +1 -45
  223. package/lib/cjs/resources/shipping_zones.d.ts +1 -51
  224. package/lib/cjs/resources/shipping_zones.js +1 -41
  225. package/lib/cjs/resources/sku_list_items.d.ts +1 -50
  226. package/lib/cjs/resources/sku_list_items.js +1 -45
  227. package/lib/cjs/resources/sku_list_promotion_rules.d.ts +1 -75
  228. package/lib/cjs/resources/sku_list_promotion_rules.js +1 -45
  229. package/lib/cjs/resources/sku_lists.d.ts +1 -63
  230. package/lib/cjs/resources/sku_lists.js +1 -57
  231. package/lib/cjs/resources/sku_options.d.ts +1 -70
  232. package/lib/cjs/resources/sku_options.js +1 -53
  233. package/lib/cjs/resources/skus.d.ts +1 -95
  234. package/lib/cjs/resources/skus.js +1 -73
  235. package/lib/cjs/resources/stock_items.d.ts +1 -59
  236. package/lib/cjs/resources/stock_items.js +1 -57
  237. package/lib/cjs/resources/stock_line_items.d.ts +1 -69
  238. package/lib/cjs/resources/stock_line_items.js +1 -53
  239. package/lib/cjs/resources/stock_locations.d.ts +1 -63
  240. package/lib/cjs/resources/stock_locations.js +1 -61
  241. package/lib/cjs/resources/stock_reservations.d.ts +1 -49
  242. package/lib/cjs/resources/stock_reservations.js +1 -53
  243. package/lib/cjs/resources/stock_transfers.d.ts +1 -79
  244. package/lib/cjs/resources/stock_transfers.js +1 -61
  245. package/lib/cjs/resources/stripe_gateways.d.ts +1 -44
  246. package/lib/cjs/resources/stripe_gateways.js +1 -45
  247. package/lib/cjs/resources/stripe_payments.d.ts +1 -56
  248. package/lib/cjs/resources/stripe_payments.js +1 -45
  249. package/lib/cjs/resources/subscription_models.d.ts +1 -48
  250. package/lib/cjs/resources/subscription_models.js +1 -45
  251. package/lib/cjs/resources/tags.d.ts +1 -27
  252. package/lib/cjs/resources/tags.js +1 -33
  253. package/lib/cjs/resources/tax_calculators.d.ts +1 -27
  254. package/lib/cjs/resources/tax_calculators.js +1 -36
  255. package/lib/cjs/resources/tax_categories.d.ts +1 -62
  256. package/lib/cjs/resources/tax_categories.js +1 -45
  257. package/lib/cjs/resources/tax_rules.d.ts +1 -72
  258. package/lib/cjs/resources/tax_rules.js +1 -41
  259. package/lib/cjs/resources/taxjar_accounts.d.ts +1 -46
  260. package/lib/cjs/resources/taxjar_accounts.js +1 -49
  261. package/lib/cjs/resources/transactions.d.ts +1 -40
  262. package/lib/cjs/resources/transactions.js +1 -40
  263. package/lib/cjs/resources/versions.d.ts +1 -22
  264. package/lib/cjs/resources/versions.js +1 -24
  265. package/lib/cjs/resources/voids.d.ts +1 -43
  266. package/lib/cjs/resources/voids.js +1 -44
  267. package/lib/cjs/resources/webhooks.d.ts +1 -51
  268. package/lib/cjs/resources/webhooks.js +1 -41
  269. package/lib/cjs/resources/wire_transfers.d.ts +1 -36
  270. package/lib/cjs/resources/wire_transfers.js +1 -41
  271. package/lib/cjs/static.d.ts +1 -9
  272. package/lib/cjs/static.js +1 -45
  273. package/lib/cjs/util.d.ts +1 -6
  274. package/lib/cjs/util.js +1 -15
  275. package/lib/esm/api.d.ts +1 -126
  276. package/lib/esm/api.js +1 -265
  277. package/lib/esm/client.d.ts +1 -31
  278. package/lib/esm/client.js +1 -118
  279. package/lib/esm/commercelayer.d.ts +1 -152
  280. package/lib/esm/commercelayer.js +1 -214
  281. package/lib/esm/common.d.ts +1 -4
  282. package/lib/esm/common.js +1 -10
  283. package/lib/esm/config.d.ts +1 -11
  284. package/lib/esm/config.js +1 -11
  285. package/lib/esm/debug.d.ts +1 -3
  286. package/lib/esm/debug.js +1 -40
  287. package/lib/esm/error.d.ts +1 -28
  288. package/lib/esm/error.js +1 -38
  289. package/lib/esm/index.d.ts +1 -7
  290. package/lib/esm/index.js +1 -6
  291. package/lib/esm/interceptor.d.ts +1 -21
  292. package/lib/esm/interceptor.js +1 -1
  293. package/lib/esm/jsonapi.d.ts +1 -5
  294. package/lib/esm/jsonapi.js +1 -75
  295. package/lib/esm/model.d.ts +1 -124
  296. package/lib/esm/model.js +1 -2
  297. package/lib/esm/query.d.ts +1 -23
  298. package/lib/esm/query.js +1 -45
  299. package/lib/esm/resource.d.ts +1 -75
  300. package/lib/esm/resource.js +1 -139
  301. package/lib/esm/resources/addresses.d.ts +1 -102
  302. package/lib/esm/resources/addresses.js +1 -47
  303. package/lib/esm/resources/adjustments.d.ts +1 -41
  304. package/lib/esm/resources/adjustments.js +1 -35
  305. package/lib/esm/resources/adyen_gateways.d.ts +1 -59
  306. package/lib/esm/resources/adyen_gateways.js +1 -43
  307. package/lib/esm/resources/adyen_payments.d.ts +1 -49
  308. package/lib/esm/resources/adyen_payments.js +1 -43
  309. package/lib/esm/resources/application.d.ts +1 -21
  310. package/lib/esm/resources/application.js +1 -19
  311. package/lib/esm/resources/attachments.d.ts +1 -156
  312. package/lib/esm/resources/attachments.js +1 -31
  313. package/lib/esm/resources/authorizations.d.ts +1 -66
  314. package/lib/esm/resources/authorizations.js +1 -49
  315. package/lib/esm/resources/avalara_accounts.d.ts +1 -58
  316. package/lib/esm/resources/avalara_accounts.js +1 -47
  317. package/lib/esm/resources/axerve_gateways.d.ts +1 -47
  318. package/lib/esm/resources/axerve_gateways.js +1 -43
  319. package/lib/esm/resources/axerve_payments.d.ts +1 -52
  320. package/lib/esm/resources/axerve_payments.js +1 -43
  321. package/lib/esm/resources/billing_info_validation_rules.d.ts +1 -38
  322. package/lib/esm/resources/billing_info_validation_rules.js +1 -43
  323. package/lib/esm/resources/bing_geocoders.d.ts +1 -35
  324. package/lib/esm/resources/bing_geocoders.js +1 -39
  325. package/lib/esm/resources/braintree_gateways.d.ts +1 -59
  326. package/lib/esm/resources/braintree_gateways.js +1 -43
  327. package/lib/esm/resources/braintree_payments.d.ts +1 -51
  328. package/lib/esm/resources/braintree_payments.js +1 -43
  329. package/lib/esm/resources/bundles.d.ts +1 -90
  330. package/lib/esm/resources/bundles.js +1 -59
  331. package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +1 -134
  332. package/lib/esm/resources/buy_x_pay_y_promotions.js +1 -79
  333. package/lib/esm/resources/captures.d.ts +1 -57
  334. package/lib/esm/resources/captures.js +1 -49
  335. package/lib/esm/resources/carrier_accounts.d.ts +1 -29
  336. package/lib/esm/resources/carrier_accounts.js +1 -34
  337. package/lib/esm/resources/checkout_com_gateways.d.ts +1 -48
  338. package/lib/esm/resources/checkout_com_gateways.js +1 -43
  339. package/lib/esm/resources/checkout_com_payments.d.ts +1 -62
  340. package/lib/esm/resources/checkout_com_payments.js +1 -43
  341. package/lib/esm/resources/cleanups.d.ts +1 -39
  342. package/lib/esm/resources/cleanups.js +1 -36
  343. package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +1 -66
  344. package/lib/esm/resources/coupon_codes_promotion_rules.js +1 -39
  345. package/lib/esm/resources/coupon_recipients.d.ts +1 -47
  346. package/lib/esm/resources/coupon_recipients.js +1 -43
  347. package/lib/esm/resources/coupons.d.ts +1 -70
  348. package/lib/esm/resources/coupons.js +1 -51
  349. package/lib/esm/resources/custom_promotion_rules.d.ts +1 -61
  350. package/lib/esm/resources/custom_promotion_rules.js +1 -35
  351. package/lib/esm/resources/customer_addresses.d.ts +1 -49
  352. package/lib/esm/resources/customer_addresses.js +1 -47
  353. package/lib/esm/resources/customer_groups.d.ts +1 -39
  354. package/lib/esm/resources/customer_groups.js +1 -47
  355. package/lib/esm/resources/customer_password_resets.d.ts +1 -36
  356. package/lib/esm/resources/customer_password_resets.js +1 -39
  357. package/lib/esm/resources/customer_payment_sources.d.ts +1 -85
  358. package/lib/esm/resources/customer_payment_sources.js +1 -43
  359. package/lib/esm/resources/customer_subscriptions.d.ts +1 -34
  360. package/lib/esm/resources/customer_subscriptions.js +1 -43
  361. package/lib/esm/resources/customers.d.ts +1 -75
  362. package/lib/esm/resources/customers.js +1 -75
  363. package/lib/esm/resources/delivery_lead_times.d.ts +1 -54
  364. package/lib/esm/resources/delivery_lead_times.js +1 -47
  365. package/lib/esm/resources/event_callbacks.d.ts +1 -24
  366. package/lib/esm/resources/event_callbacks.js +1 -26
  367. package/lib/esm/resources/events.d.ts +1 -24
  368. package/lib/esm/resources/events.js +1 -30
  369. package/lib/esm/resources/exports.d.ts +1 -40
  370. package/lib/esm/resources/exports.js +1 -32
  371. package/lib/esm/resources/external_gateways.d.ts +1 -55
  372. package/lib/esm/resources/external_gateways.js +1 -43
  373. package/lib/esm/resources/external_payments.d.ts +1 -47
  374. package/lib/esm/resources/external_payments.js +1 -47
  375. package/lib/esm/resources/external_promotions.d.ts +1 -132
  376. package/lib/esm/resources/external_promotions.js +1 -79
  377. package/lib/esm/resources/external_tax_calculators.d.ts +1 -43
  378. package/lib/esm/resources/external_tax_calculators.js +1 -43
  379. package/lib/esm/resources/fixed_amount_promotions.d.ts +1 -130
  380. package/lib/esm/resources/fixed_amount_promotions.js +1 -79
  381. package/lib/esm/resources/fixed_price_promotions.d.ts +1 -130
  382. package/lib/esm/resources/fixed_price_promotions.js +1 -79
  383. package/lib/esm/resources/free_gift_promotions.d.ts +1 -128
  384. package/lib/esm/resources/free_gift_promotions.js +1 -79
  385. package/lib/esm/resources/free_shipping_promotions.d.ts +1 -122
  386. package/lib/esm/resources/free_shipping_promotions.js +1 -75
  387. package/lib/esm/resources/geocoders.d.ts +1 -24
  388. package/lib/esm/resources/geocoders.js +1 -30
  389. package/lib/esm/resources/gift_card_recipients.d.ts +1 -47
  390. package/lib/esm/resources/gift_card_recipients.js +1 -43
  391. package/lib/esm/resources/gift_cards.d.ts +1 -99
  392. package/lib/esm/resources/gift_cards.js +1 -55
  393. package/lib/esm/resources/google_geocoders.d.ts +1 -35
  394. package/lib/esm/resources/google_geocoders.js +1 -39
  395. package/lib/esm/resources/imports.d.ts +1 -43
  396. package/lib/esm/resources/imports.js +1 -32
  397. package/lib/esm/resources/in_stock_subscriptions.d.ts +1 -65
  398. package/lib/esm/resources/in_stock_subscriptions.js +1 -51
  399. package/lib/esm/resources/inventory_models.d.ts +1 -54
  400. package/lib/esm/resources/inventory_models.js +1 -47
  401. package/lib/esm/resources/inventory_return_locations.d.ts +1 -46
  402. package/lib/esm/resources/inventory_return_locations.js +1 -43
  403. package/lib/esm/resources/inventory_stock_locations.d.ts +1 -49
  404. package/lib/esm/resources/inventory_stock_locations.js +1 -43
  405. package/lib/esm/resources/klarna_gateways.d.ts +1 -47
  406. package/lib/esm/resources/klarna_gateways.js +1 -43
  407. package/lib/esm/resources/klarna_payments.d.ts +1 -46
  408. package/lib/esm/resources/klarna_payments.js +1 -43
  409. package/lib/esm/resources/line_item_options.d.ts +1 -68
  410. package/lib/esm/resources/line_item_options.js +1 -47
  411. package/lib/esm/resources/line_items.d.ts +1 -166
  412. package/lib/esm/resources/line_items.js +1 -63
  413. package/lib/esm/resources/manual_gateways.d.ts +1 -33
  414. package/lib/esm/resources/manual_gateways.js +1 -39
  415. package/lib/esm/resources/manual_tax_calculators.d.ts +1 -44
  416. package/lib/esm/resources/manual_tax_calculators.js +1 -47
  417. package/lib/esm/resources/markets.d.ts +1 -104
  418. package/lib/esm/resources/markets.js +1 -63
  419. package/lib/esm/resources/merchants.d.ts +1 -41
  420. package/lib/esm/resources/merchants.js +1 -43
  421. package/lib/esm/resources/order_amount_promotion_rules.d.ts +1 -66
  422. package/lib/esm/resources/order_amount_promotion_rules.js +1 -35
  423. package/lib/esm/resources/order_copies.d.ts +1 -50
  424. package/lib/esm/resources/order_copies.js +1 -47
  425. package/lib/esm/resources/order_factories.d.ts +1 -33
  426. package/lib/esm/resources/order_factories.js +1 -34
  427. package/lib/esm/resources/order_subscription_items.d.ts +1 -71
  428. package/lib/esm/resources/order_subscription_items.js +1 -39
  429. package/lib/esm/resources/order_subscriptions.d.ts +1 -94
  430. package/lib/esm/resources/order_subscriptions.js +1 -75
  431. package/lib/esm/resources/order_validation_rules.d.ts +1 -26
  432. package/lib/esm/resources/order_validation_rules.js +1 -34
  433. package/lib/esm/resources/orders.d.ts +1 -359
  434. package/lib/esm/resources/orders.js +1 -155
  435. package/lib/esm/resources/organization.d.ts +1 -33
  436. package/lib/esm/resources/organization.js +1 -19
  437. package/lib/esm/resources/packages.d.ts +1 -59
  438. package/lib/esm/resources/packages.js +1 -47
  439. package/lib/esm/resources/parcel_line_items.d.ts +1 -46
  440. package/lib/esm/resources/parcel_line_items.js +1 -43
  441. package/lib/esm/resources/parcels.d.ts +1 -125
  442. package/lib/esm/resources/parcels.js +1 -55
  443. package/lib/esm/resources/payment_gateways.d.ts +1 -24
  444. package/lib/esm/resources/payment_gateways.js +1 -30
  445. package/lib/esm/resources/payment_methods.d.ts +1 -80
  446. package/lib/esm/resources/payment_methods.js +1 -47
  447. package/lib/esm/resources/payment_options.d.ts +1 -43
  448. package/lib/esm/resources/payment_options.js +1 -39
  449. package/lib/esm/resources/paypal_gateways.d.ts +1 -40
  450. package/lib/esm/resources/paypal_gateways.js +1 -43
  451. package/lib/esm/resources/paypal_payments.d.ts +1 -52
  452. package/lib/esm/resources/paypal_payments.js +1 -43
  453. package/lib/esm/resources/percentage_discount_promotions.d.ts +1 -128
  454. package/lib/esm/resources/percentage_discount_promotions.js +1 -79
  455. package/lib/esm/resources/price_frequency_tiers.d.ts +1 -52
  456. package/lib/esm/resources/price_frequency_tiers.js +1 -47
  457. package/lib/esm/resources/price_list_schedulers.d.ts +1 -0
  458. package/lib/esm/resources/price_list_schedulers.js +1 -0
  459. package/lib/esm/resources/price_lists.d.ts +1 -45
  460. package/lib/esm/resources/price_lists.js +1 -43
  461. package/lib/esm/resources/price_tiers.d.ts +1 -31
  462. package/lib/esm/resources/price_tiers.js +1 -34
  463. package/lib/esm/resources/price_volume_tiers.d.ts +1 -52
  464. package/lib/esm/resources/price_volume_tiers.js +1 -47
  465. package/lib/esm/resources/prices.d.ts +1 -83
  466. package/lib/esm/resources/prices.js +1 -71
  467. package/lib/esm/resources/promotion_rules.d.ts +1 -28
  468. package/lib/esm/resources/promotion_rules.js +1 -26
  469. package/lib/esm/resources/promotions.d.ts +1 -62
  470. package/lib/esm/resources/promotions.js +1 -66
  471. package/lib/esm/resources/recurring_order_copies.d.ts +1 -52
  472. package/lib/esm/resources/recurring_order_copies.js +1 -47
  473. package/lib/esm/resources/refunds.d.ts +1 -43
  474. package/lib/esm/resources/refunds.js +1 -42
  475. package/lib/esm/resources/reserved_stocks.d.ts +1 -27
  476. package/lib/esm/resources/reserved_stocks.js +1 -34
  477. package/lib/esm/resources/resource_errors.d.ts +1 -22
  478. package/lib/esm/resources/resource_errors.js +1 -22
  479. package/lib/esm/resources/return_line_items.d.ts +1 -50
  480. package/lib/esm/resources/return_line_items.js +1 -39
  481. package/lib/esm/resources/returns.d.ts +1 -86
  482. package/lib/esm/resources/returns.js +1 -71
  483. package/lib/esm/resources/satispay_gateways.d.ts +1 -45
  484. package/lib/esm/resources/satispay_gateways.js +1 -43
  485. package/lib/esm/resources/satispay_payments.d.ts +1 -48
  486. package/lib/esm/resources/satispay_payments.js +1 -43
  487. package/lib/esm/resources/shipments.d.ts +1 -139
  488. package/lib/esm/resources/shipments.js +1 -103
  489. package/lib/esm/resources/shipping_categories.d.ts +1 -39
  490. package/lib/esm/resources/shipping_categories.js +1 -43
  491. package/lib/esm/resources/shipping_method_tiers.d.ts +1 -31
  492. package/lib/esm/resources/shipping_method_tiers.js +1 -34
  493. package/lib/esm/resources/shipping_methods.d.ts +1 -121
  494. package/lib/esm/resources/shipping_methods.js +1 -67
  495. package/lib/esm/resources/shipping_weight_tiers.d.ts +1 -49
  496. package/lib/esm/resources/shipping_weight_tiers.js +1 -43
  497. package/lib/esm/resources/shipping_zones.d.ts +1 -51
  498. package/lib/esm/resources/shipping_zones.js +1 -39
  499. package/lib/esm/resources/sku_list_items.d.ts +1 -50
  500. package/lib/esm/resources/sku_list_items.js +1 -43
  501. package/lib/esm/resources/sku_list_promotion_rules.d.ts +1 -75
  502. package/lib/esm/resources/sku_list_promotion_rules.js +1 -43
  503. package/lib/esm/resources/sku_lists.d.ts +1 -63
  504. package/lib/esm/resources/sku_lists.js +1 -55
  505. package/lib/esm/resources/sku_options.d.ts +1 -70
  506. package/lib/esm/resources/sku_options.js +1 -51
  507. package/lib/esm/resources/skus.d.ts +1 -95
  508. package/lib/esm/resources/skus.js +1 -71
  509. package/lib/esm/resources/stock_items.d.ts +1 -59
  510. package/lib/esm/resources/stock_items.js +1 -55
  511. package/lib/esm/resources/stock_line_items.d.ts +1 -69
  512. package/lib/esm/resources/stock_line_items.js +1 -51
  513. package/lib/esm/resources/stock_locations.d.ts +1 -63
  514. package/lib/esm/resources/stock_locations.js +1 -59
  515. package/lib/esm/resources/stock_reservations.d.ts +1 -49
  516. package/lib/esm/resources/stock_reservations.js +1 -51
  517. package/lib/esm/resources/stock_transfers.d.ts +1 -79
  518. package/lib/esm/resources/stock_transfers.js +1 -59
  519. package/lib/esm/resources/stripe_gateways.d.ts +1 -44
  520. package/lib/esm/resources/stripe_gateways.js +1 -43
  521. package/lib/esm/resources/stripe_payments.d.ts +1 -56
  522. package/lib/esm/resources/stripe_payments.js +1 -43
  523. package/lib/esm/resources/subscription_models.d.ts +1 -48
  524. package/lib/esm/resources/subscription_models.js +1 -43
  525. package/lib/esm/resources/tags.d.ts +1 -27
  526. package/lib/esm/resources/tags.js +1 -31
  527. package/lib/esm/resources/tax_calculators.d.ts +1 -27
  528. package/lib/esm/resources/tax_calculators.js +1 -34
  529. package/lib/esm/resources/tax_categories.d.ts +1 -62
  530. package/lib/esm/resources/tax_categories.js +1 -43
  531. package/lib/esm/resources/tax_rules.d.ts +1 -72
  532. package/lib/esm/resources/tax_rules.js +1 -39
  533. package/lib/esm/resources/taxjar_accounts.d.ts +1 -46
  534. package/lib/esm/resources/taxjar_accounts.js +1 -47
  535. package/lib/esm/resources/transactions.d.ts +1 -40
  536. package/lib/esm/resources/transactions.js +1 -38
  537. package/lib/esm/resources/versions.d.ts +1 -22
  538. package/lib/esm/resources/versions.js +1 -22
  539. package/lib/esm/resources/voids.d.ts +1 -43
  540. package/lib/esm/resources/voids.js +1 -42
  541. package/lib/esm/resources/webhooks.d.ts +1 -51
  542. package/lib/esm/resources/webhooks.js +1 -39
  543. package/lib/esm/resources/wire_transfers.d.ts +1 -36
  544. package/lib/esm/resources/wire_transfers.js +1 -39
  545. package/lib/esm/static.d.ts +1 -9
  546. package/lib/esm/static.js +1 -19
  547. package/lib/esm/util.d.ts +1 -6
  548. package/lib/esm/util.js +1 -11
  549. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  550. package/lib/tsconfig.tsbuildinfo +1 -1
  551. package/package.json +4 -4
package/lib/cjs/config.js CHANGED
@@ -1,13 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config = {
4
- default: {
5
- domain: 'commercelayer.io',
6
- pageNumber: 1,
7
- pageSize: 10,
8
- },
9
- client: {
10
- timeout: 15000,
11
- }
12
- };
13
- exports.default = config;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const config={default:{domain:"commercelayer.io",pageNumber:1,pageSize:10},client:{timeout:15e3}};exports.default=config;
@@ -1,3 +1 @@
1
- type Debugger = (pattern: string, ...args: any[]) => void;
2
- declare const debug: (namespace: string) => Debugger;
3
- export default debug;
1
+ type Debugger=(pattern:string,...args:any[])=>void;declare const debug:(namespace:string)=>Debugger;export default debug;
package/lib/cjs/debug.js CHANGED
@@ -1,42 +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'
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /* Nope debugger */
7
- const debuggerFunction = (_pattern, ..._args) => {
8
- // console.log(_pattern)
9
- };
10
- let debuggerFactory = (_namespace) => debuggerFunction;
11
- /* Try loading 'debug' module */
12
- try {
13
- // eslint-disable-next-line @typescript-eslint/no-var-requires
14
- const debugModule = require('debug');
15
- if (debugModule && (typeof debugModule === 'function'))
16
- debuggerFactory = debugModule;
17
- }
18
- catch (error) {
19
- //
20
- }
21
- const debugPrefix = 'clsdk';
22
- /* Retrieve the name of the caller 'module' */
23
- /*
24
- const caller = (): string => {
25
-
26
- const err = new Error()
27
-
28
- Error.prepareStackTrace = (_, stack) => stack
29
- const stack = err.stack as unknown as NodeJS.CallSite[]
30
- Error.prepareStackTrace = undefined
31
-
32
- const fileName = stack[2].getFileName() || '/'
33
-
34
- return fileName.replace(/^.*[\\/]/, '').replace('.ts', '')
35
-
36
- }
37
- */
38
- /* Return a debugger for the defined namespace */
39
- const debug = (namespace) => {
40
- return debuggerFactory(`${debugPrefix}:${namespace}`);
41
- };
42
- exports.default = debug;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const debuggerFunction=(e,...t)=>{};let debuggerFactory=e=>debuggerFunction;try{const e=require("debug");e&&typeof e=="function"&&(debuggerFactory=e)}catch{}const debugPrefix="clsdk",debug=e=>debuggerFactory(`${debugPrefix}:${e}`);exports.default=debug;
@@ -1,28 +1 @@
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 };
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};
package/lib/cjs/error.js CHANGED
@@ -1,43 +1 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
5
- var ErrorType;
6
- (function (ErrorType) {
7
- ErrorType["CLIENT"] = "client";
8
- ErrorType["REQUEST"] = "request";
9
- ErrorType["RESPONSE"] = "response";
10
- ErrorType["GENERIC"] = "generic";
11
- ErrorType["CANCEL"] = "cancel";
12
- })(ErrorType || (ErrorType = {}));
13
- exports.ErrorType = ErrorType;
14
- class SdkError extends Error {
15
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
16
- static isSdkError(error) {
17
- return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
18
- }
19
- constructor(error) {
20
- super(error.message);
21
- this.name = SdkError.NAME; // this.constructor.name
22
- this.type = error.type || ErrorType.GENERIC;
23
- }
24
- }
25
- exports.SdkError = SdkError;
26
- SdkError.NAME = 'SdkError';
27
- class ApiError extends SdkError {
28
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
29
- static isApiError(error) {
30
- return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
31
- }
32
- constructor(error) {
33
- super(Object.assign(Object.assign({}, error), { type: ErrorType.RESPONSE }));
34
- this.errors = [];
35
- this.name = ApiError.NAME; // this.constructor.name
36
- }
37
- first() {
38
- var _a;
39
- return (((_a = this.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) ? this.errors[0] : undefined;
40
- }
41
- }
42
- exports.ApiError = ApiError;
43
- ApiError.NAME = 'ApiError';
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ErrorType=exports.ApiError=exports.SdkError=void 0;var ErrorType;(function(s){s.CLIENT="client",s.REQUEST="request",s.RESPONSE="response",s.GENERIC="generic",s.CANCEL="cancel"})(ErrorType||(ErrorType={})),exports.ErrorType=ErrorType;class SdkError extends Error{static isSdkError(e){return e&&[SdkError.NAME,ApiError.NAME].includes(e.name)&&Object.values(ErrorType).includes(e.type)}constructor(e){super(e.message),this.name=SdkError.NAME,this.type=e.type||ErrorType.GENERIC}}exports.SdkError=SdkError,SdkError.NAME="SdkError";class ApiError extends SdkError{static isApiError(e){return SdkError.isSdkError(e)&&e.name===ApiError.NAME&&e.type===ErrorType.RESPONSE}constructor(e){super(Object.assign(Object.assign({},e),{type:ErrorType.RESPONSE})),this.errors=[],this.name=ApiError.NAME}first(){var e;return((e=this.errors)===null||e===void 0?void 0:e.length)>0?this.errors[0]:void 0}}exports.ApiError=ApiError,ApiError.NAME="ApiError";
@@ -1,7 +1 @@
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';
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';
package/lib/cjs/index.js CHANGED
@@ -1,29 +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
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.CommerceLayerStatic = exports.CommerceLayer = exports.default = void 0;
21
- // SDK
22
- var commercelayer_1 = require("./commercelayer");
23
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(commercelayer_1).default; } });
24
- Object.defineProperty(exports, "CommerceLayer", { enumerable: true, get: function () { return commercelayer_1.CommerceLayer; } });
25
- // Commerce Layer static functions
26
- var static_1 = require("./static");
27
- Object.defineProperty(exports, "CommerceLayerStatic", { enumerable: true, get: function () { return static_1.CommerceLayerStatic; } });
28
- // Resource model types
29
- __exportStar(require("./model"), exports);
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&__createBinding(t,e,r)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommerceLayerStatic=exports.CommerceLayer=exports.default=void 0;var commercelayer_1=require("./commercelayer");Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return __importDefault(commercelayer_1).default}}),Object.defineProperty(exports,"CommerceLayer",{enumerable:!0,get:function(){return commercelayer_1.CommerceLayer}});var static_1=require("./static");Object.defineProperty(exports,"CommerceLayerStatic",{enumerable:!0,get:function(){return static_1.CommerceLayerStatic}}),__exportStar(require("./model"),exports);
@@ -1,21 +1 @@
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
+ 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,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -1,5 +1 @@
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 };
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,82 +1 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.normalize = exports.denormalize = void 0;
7
- const common_1 = require("./common");
8
- const debug_1 = __importDefault(require("./debug"));
9
- const debug = (0, debug_1.default)('jsonapi');
10
- // DENORMALIZATION
11
- const denormalize = (response) => {
12
- let denormalizedResponse;
13
- if (response.links)
14
- delete response.links;
15
- const data = response.data;
16
- const included = response.included;
17
- if (!data)
18
- denormalizedResponse = data;
19
- else {
20
- if (Array.isArray(data))
21
- denormalizedResponse = data.map(res => denormalizeResource(res, included));
22
- else
23
- denormalizedResponse = denormalizeResource(data, included);
24
- }
25
- return denormalizedResponse;
26
- };
27
- exports.denormalize = denormalize;
28
- const findIncluded = (rel, included = []) => {
29
- const inc = included.find(inc => {
30
- return (rel.id === inc.id) && (rel.type === inc.type);
31
- });
32
- return inc || rel;
33
- };
34
- const denormalizeResource = (res, included) => {
35
- debug('denormalize resource: %O, %o', res, included || {});
36
- if (!res)
37
- return res;
38
- const resource = Object.assign({ id: res.id, type: res.type }, res.attributes);
39
- if (res.relationships)
40
- Object.keys(res.relationships).forEach(key => {
41
- const rel = res.relationships[key].data;
42
- if (rel) {
43
- if (Array.isArray(rel))
44
- resource[key] = rel.map(r => denormalizeResource(findIncluded(r, included), included));
45
- else
46
- resource[key] = denormalizeResource(findIncluded(rel, included), included);
47
- }
48
- else if (rel === null)
49
- resource[key] = null;
50
- });
51
- debug('denormalized resource: %O', resource);
52
- return resource;
53
- };
54
- // NORMALIZATION
55
- const normalize = (resource) => {
56
- debug('normalize resource: %O', resource);
57
- const attributes = {};
58
- const relationships = {};
59
- for (const field in resource) {
60
- if (['type', 'id'].includes(field))
61
- continue;
62
- const value = resource[field];
63
- if (value && (0, common_1.isResourceType)(value) && value.id === null) {
64
- relationships[field] = { data: null };
65
- }
66
- else if (value && ((0, common_1.isResourceId)(value) || (Array.isArray(value) && (0, common_1.isResourceId)(value[0])))) {
67
- relationships[field] = { data: value };
68
- }
69
- else
70
- attributes[field] = value;
71
- }
72
- const normalized = {
73
- type: resource.type,
74
- attributes,
75
- relationships
76
- };
77
- if ((0, common_1.isResourceId)(resource))
78
- normalized.id = resource.id;
79
- debug('normalized resource: %O', normalized);
80
- return normalized;
81
- };
82
- exports.normalize = normalize;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalize=exports.denormalize=void 0;const common_1=require("./common"),debug_1=__importDefault(require("./debug")),debug=(0,debug_1.default)("jsonapi"),denormalize=e=>{let i;e.links&&delete e.links;const t=e.data,n=e.included;return t?Array.isArray(t)?i=t.map(r=>denormalizeResource(r,n)):i=denormalizeResource(t,n):i=t,i};exports.denormalize=denormalize;const findIncluded=(e,i=[])=>i.find(n=>e.id===n.id&&e.type===n.type)||e,denormalizeResource=(e,i)=>{if(debug("denormalize resource: %O, %o",e,i||{}),!e)return e;const t=Object.assign({id:e.id,type:e.type},e.attributes);return e.relationships&&Object.keys(e.relationships).forEach(n=>{const r=e.relationships[n].data;r?Array.isArray(r)?t[n]=r.map(o=>denormalizeResource(findIncluded(o,i),i)):t[n]=denormalizeResource(findIncluded(r,i),i):r===null&&(t[n]=null)}),debug("denormalized resource: %O",t),t},normalize=e=>{debug("normalize resource: %O",e);const i={},t={};for(const r in e){if(["type","id"].includes(r))continue;const o=e[r];o&&(0,common_1.isResourceType)(o)&&o.id===null?t[r]={data:null}:o&&((0,common_1.isResourceId)(o)||Array.isArray(o)&&(0,common_1.isResourceId)(o[0]))?t[r]={data:o}:i[r]=o}const n={type:e.type,attributes:i,relationships:t};return(0,common_1.isResourceId)(e)&&(n.id=e.id),debug("normalized resource: %O",n),n};exports.normalize=normalize;
@@ -1,124 +1 @@
1
- /**
2
- * ©2024 Commerce Layer Inc.
3
- **/
4
- export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
5
- export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
6
- export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate } from './resources/adyen_gateways';
7
- export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate } from './resources/adyen_payments';
8
- export type { Application } from './resources/application';
9
- export type { Attachment, AttachmentCreate, AttachmentUpdate } from './resources/attachments';
10
- export type { Authorization, AuthorizationUpdate } from './resources/authorizations';
11
- export type { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate } from './resources/avalara_accounts';
12
- export type { AxerveGateway, AxerveGatewayCreate, AxerveGatewayUpdate } from './resources/axerve_gateways';
13
- export type { AxervePayment, AxervePaymentCreate, AxervePaymentUpdate } from './resources/axerve_payments';
14
- export type { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate } from './resources/billing_info_validation_rules';
15
- export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './resources/bing_geocoders';
16
- export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways';
17
- export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments';
18
- export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles';
19
- export type { BuyXPayYPromotion, BuyXPayYPromotionCreate, BuyXPayYPromotionUpdate } from './resources/buy_x_pay_y_promotions';
20
- export type { Capture, CaptureUpdate } from './resources/captures';
21
- export type { CarrierAccount } from './resources/carrier_accounts';
22
- export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways';
23
- export type { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate } from './resources/checkout_com_payments';
24
- export type { Cleanup, CleanupCreate } from './resources/cleanups';
25
- export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules';
26
- export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients';
27
- export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons';
28
- export type { CustomPromotionRule, CustomPromotionRuleCreate, CustomPromotionRuleUpdate } from './resources/custom_promotion_rules';
29
- export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses';
30
- export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups';
31
- export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets';
32
- export type { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate } from './resources/customer_payment_sources';
33
- export type { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate } from './resources/customer_subscriptions';
34
- export type { Customer, CustomerCreate, CustomerUpdate } from './resources/customers';
35
- export type { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate } from './resources/delivery_lead_times';
36
- export type { EventCallback } from './resources/event_callbacks';
37
- export type { Event } from './resources/events';
38
- export type { Export, ExportCreate } from './resources/exports';
39
- export type { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate } from './resources/external_gateways';
40
- export type { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate } from './resources/external_payments';
41
- export type { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate } from './resources/external_promotions';
42
- export type { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate } from './resources/external_tax_calculators';
43
- export type { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate } from './resources/fixed_amount_promotions';
44
- export type { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate } from './resources/fixed_price_promotions';
45
- export type { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate } from './resources/free_gift_promotions';
46
- export type { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate } from './resources/free_shipping_promotions';
47
- export type { Geocoder } from './resources/geocoders';
48
- export type { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate } from './resources/gift_card_recipients';
49
- export type { GiftCard, GiftCardCreate, GiftCardUpdate } from './resources/gift_cards';
50
- export type { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate } from './resources/google_geocoders';
51
- export type { Import, ImportCreate } from './resources/imports';
52
- export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate } from './resources/in_stock_subscriptions';
53
- export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models';
54
- export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations';
55
- export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations';
56
- export type { KlarnaGateway, KlarnaGatewayCreate, KlarnaGatewayUpdate } from './resources/klarna_gateways';
57
- export type { KlarnaPayment, KlarnaPaymentCreate, KlarnaPaymentUpdate } from './resources/klarna_payments';
58
- export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options';
59
- export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items';
60
- export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways';
61
- export type { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate } from './resources/manual_tax_calculators';
62
- export type { Market, MarketCreate, MarketUpdate } from './resources/markets';
63
- export type { Merchant, MerchantCreate, MerchantUpdate } from './resources/merchants';
64
- export type { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate } from './resources/order_amount_promotion_rules';
65
- export type { OrderCopy, OrderCopyCreate, OrderCopyUpdate } from './resources/order_copies';
66
- export type { OrderFactory } from './resources/order_factories';
67
- export type { OrderSubscriptionItem, OrderSubscriptionItemCreate, OrderSubscriptionItemUpdate } from './resources/order_subscription_items';
68
- export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions';
69
- export type { OrderValidationRule } from './resources/order_validation_rules';
70
- export type { Order, OrderCreate, OrderUpdate } from './resources/orders';
71
- export type { Organization } from './resources/organization';
72
- export type { Package, PackageCreate, PackageUpdate } from './resources/packages';
73
- export type { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate } from './resources/parcel_line_items';
74
- export type { Parcel, ParcelCreate, ParcelUpdate } from './resources/parcels';
75
- export type { PaymentGateway } from './resources/payment_gateways';
76
- export type { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate } from './resources/payment_methods';
77
- export type { PaymentOption, PaymentOptionCreate, PaymentOptionUpdate } from './resources/payment_options';
78
- export type { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate } from './resources/paypal_gateways';
79
- export type { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate } from './resources/paypal_payments';
80
- export type { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate } from './resources/percentage_discount_promotions';
81
- export type { PriceFrequencyTier, PriceFrequencyTierCreate, PriceFrequencyTierUpdate } from './resources/price_frequency_tiers';
82
- export type { PriceList, PriceListCreate, PriceListUpdate } from './resources/price_lists';
83
- export type { PriceTier } from './resources/price_tiers';
84
- export type { PriceVolumeTier, PriceVolumeTierCreate, PriceVolumeTierUpdate } from './resources/price_volume_tiers';
85
- export type { Price, PriceCreate, PriceUpdate } from './resources/prices';
86
- export type { PromotionRule } from './resources/promotion_rules';
87
- export type { Promotion } from './resources/promotions';
88
- export type { RecurringOrderCopy, RecurringOrderCopyCreate, RecurringOrderCopyUpdate } from './resources/recurring_order_copies';
89
- export type { Refund } from './resources/refunds';
90
- export type { ReservedStock } from './resources/reserved_stocks';
91
- export type { ResourceError } from './resources/resource_errors';
92
- export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items';
93
- export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns';
94
- export type { SatispayGateway, SatispayGatewayCreate, SatispayGatewayUpdate } from './resources/satispay_gateways';
95
- export type { SatispayPayment, SatispayPaymentCreate, SatispayPaymentUpdate } from './resources/satispay_payments';
96
- export type { Shipment, ShipmentCreate, ShipmentUpdate } from './resources/shipments';
97
- export type { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate } from './resources/shipping_categories';
98
- export type { ShippingMethodTier } from './resources/shipping_method_tiers';
99
- export type { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate } from './resources/shipping_methods';
100
- export type { ShippingWeightTier, ShippingWeightTierCreate, ShippingWeightTierUpdate } from './resources/shipping_weight_tiers';
101
- export type { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate } from './resources/shipping_zones';
102
- export type { SkuListItem, SkuListItemCreate, SkuListItemUpdate } from './resources/sku_list_items';
103
- export type { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate } from './resources/sku_list_promotion_rules';
104
- export type { SkuList, SkuListCreate, SkuListUpdate } from './resources/sku_lists';
105
- export type { SkuOption, SkuOptionCreate, SkuOptionUpdate } from './resources/sku_options';
106
- export type { Sku, SkuCreate, SkuUpdate } from './resources/skus';
107
- export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items';
108
- export type { StockLineItem, StockLineItemCreate, StockLineItemUpdate } from './resources/stock_line_items';
109
- export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations';
110
- export type { StockReservation, StockReservationCreate, StockReservationUpdate } from './resources/stock_reservations';
111
- export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers';
112
- export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways';
113
- export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments';
114
- export type { SubscriptionModel, SubscriptionModelCreate, SubscriptionModelUpdate } from './resources/subscription_models';
115
- export type { Tag, TagCreate, TagUpdate } from './resources/tags';
116
- export type { TaxCalculator } from './resources/tax_calculators';
117
- export type { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate } from './resources/tax_categories';
118
- export type { TaxRule, TaxRuleCreate, TaxRuleUpdate } from './resources/tax_rules';
119
- export type { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate } from './resources/taxjar_accounts';
120
- export type { Transaction } from './resources/transactions';
121
- export type { Version } from './resources/versions';
122
- export type { Void } from './resources/voids';
123
- export type { Webhook, WebhookCreate, WebhookUpdate } from './resources/webhooks';
124
- export type { WireTransfer, WireTransferCreate, WireTransferUpdate } from './resources/wire_transfers';
1
+ export type{Address,AddressCreate,AddressUpdate}from'./resources/addresses';export type{Adjustment,AdjustmentCreate,AdjustmentUpdate}from'./resources/adjustments';export type{AdyenGateway,AdyenGatewayCreate,AdyenGatewayUpdate}from'./resources/adyen_gateways';export type{AdyenPayment,AdyenPaymentCreate,AdyenPaymentUpdate}from'./resources/adyen_payments';export type{Application}from'./resources/application';export type{Attachment,AttachmentCreate,AttachmentUpdate}from'./resources/attachments';export type{Authorization,AuthorizationUpdate}from'./resources/authorizations';export type{AvalaraAccount,AvalaraAccountCreate,AvalaraAccountUpdate}from'./resources/avalara_accounts';export type{AxerveGateway,AxerveGatewayCreate,AxerveGatewayUpdate}from'./resources/axerve_gateways';export type{AxervePayment,AxervePaymentCreate,AxervePaymentUpdate}from'./resources/axerve_payments';export type{BillingInfoValidationRule,BillingInfoValidationRuleCreate,BillingInfoValidationRuleUpdate}from'./resources/billing_info_validation_rules';export type{BingGeocoder,BingGeocoderCreate,BingGeocoderUpdate}from'./resources/bing_geocoders';export type{BraintreeGateway,BraintreeGatewayCreate,BraintreeGatewayUpdate}from'./resources/braintree_gateways';export type{BraintreePayment,BraintreePaymentCreate,BraintreePaymentUpdate}from'./resources/braintree_payments';export type{Bundle,BundleCreate,BundleUpdate}from'./resources/bundles';export type{BuyXPayYPromotion,BuyXPayYPromotionCreate,BuyXPayYPromotionUpdate}from'./resources/buy_x_pay_y_promotions';export type{Capture,CaptureUpdate}from'./resources/captures';export type{CarrierAccount}from'./resources/carrier_accounts';export type{CheckoutComGateway,CheckoutComGatewayCreate,CheckoutComGatewayUpdate}from'./resources/checkout_com_gateways';export type{CheckoutComPayment,CheckoutComPaymentCreate,CheckoutComPaymentUpdate}from'./resources/checkout_com_payments';export type{Cleanup,CleanupCreate}from'./resources/cleanups';export type{CouponCodesPromotionRule,CouponCodesPromotionRuleCreate,CouponCodesPromotionRuleUpdate}from'./resources/coupon_codes_promotion_rules';export type{CouponRecipient,CouponRecipientCreate,CouponRecipientUpdate}from'./resources/coupon_recipients';export type{Coupon,CouponCreate,CouponUpdate}from'./resources/coupons';export type{CustomPromotionRule,CustomPromotionRuleCreate,CustomPromotionRuleUpdate}from'./resources/custom_promotion_rules';export type{CustomerAddress,CustomerAddressCreate,CustomerAddressUpdate}from'./resources/customer_addresses';export type{CustomerGroup,CustomerGroupCreate,CustomerGroupUpdate}from'./resources/customer_groups';export type{CustomerPasswordReset,CustomerPasswordResetCreate,CustomerPasswordResetUpdate}from'./resources/customer_password_resets';export type{CustomerPaymentSource,CustomerPaymentSourceCreate,CustomerPaymentSourceUpdate}from'./resources/customer_payment_sources';export type{CustomerSubscription,CustomerSubscriptionCreate,CustomerSubscriptionUpdate}from'./resources/customer_subscriptions';export type{Customer,CustomerCreate,CustomerUpdate}from'./resources/customers';export type{DeliveryLeadTime,DeliveryLeadTimeCreate,DeliveryLeadTimeUpdate}from'./resources/delivery_lead_times';export type{EventCallback}from'./resources/event_callbacks';export type{Event}from'./resources/events';export type{Export,ExportCreate}from'./resources/exports';export type{ExternalGateway,ExternalGatewayCreate,ExternalGatewayUpdate}from'./resources/external_gateways';export type{ExternalPayment,ExternalPaymentCreate,ExternalPaymentUpdate}from'./resources/external_payments';export type{ExternalPromotion,ExternalPromotionCreate,ExternalPromotionUpdate}from'./resources/external_promotions';export type{ExternalTaxCalculator,ExternalTaxCalculatorCreate,ExternalTaxCalculatorUpdate}from'./resources/external_tax_calculators';export type{FixedAmountPromotion,FixedAmountPromotionCreate,FixedAmountPromotionUpdate}from'./resources/fixed_amount_promotions';export type{FixedPricePromotion,FixedPricePromotionCreate,FixedPricePromotionUpdate}from'./resources/fixed_price_promotions';export type{FreeGiftPromotion,FreeGiftPromotionCreate,FreeGiftPromotionUpdate}from'./resources/free_gift_promotions';export type{FreeShippingPromotion,FreeShippingPromotionCreate,FreeShippingPromotionUpdate}from'./resources/free_shipping_promotions';export type{Geocoder}from'./resources/geocoders';export type{GiftCardRecipient,GiftCardRecipientCreate,GiftCardRecipientUpdate}from'./resources/gift_card_recipients';export type{GiftCard,GiftCardCreate,GiftCardUpdate}from'./resources/gift_cards';export type{GoogleGeocoder,GoogleGeocoderCreate,GoogleGeocoderUpdate}from'./resources/google_geocoders';export type{Import,ImportCreate}from'./resources/imports';export type{InStockSubscription,InStockSubscriptionCreate,InStockSubscriptionUpdate}from'./resources/in_stock_subscriptions';export type{InventoryModel,InventoryModelCreate,InventoryModelUpdate}from'./resources/inventory_models';export type{InventoryReturnLocation,InventoryReturnLocationCreate,InventoryReturnLocationUpdate}from'./resources/inventory_return_locations';export type{InventoryStockLocation,InventoryStockLocationCreate,InventoryStockLocationUpdate}from'./resources/inventory_stock_locations';export type{KlarnaGateway,KlarnaGatewayCreate,KlarnaGatewayUpdate}from'./resources/klarna_gateways';export type{KlarnaPayment,KlarnaPaymentCreate,KlarnaPaymentUpdate}from'./resources/klarna_payments';export type{LineItemOption,LineItemOptionCreate,LineItemOptionUpdate}from'./resources/line_item_options';export type{LineItem,LineItemCreate,LineItemUpdate}from'./resources/line_items';export type{ManualGateway,ManualGatewayCreate,ManualGatewayUpdate}from'./resources/manual_gateways';export type{ManualTaxCalculator,ManualTaxCalculatorCreate,ManualTaxCalculatorUpdate}from'./resources/manual_tax_calculators';export type{Market,MarketCreate,MarketUpdate}from'./resources/markets';export type{Merchant,MerchantCreate,MerchantUpdate}from'./resources/merchants';export type{OrderAmountPromotionRule,OrderAmountPromotionRuleCreate,OrderAmountPromotionRuleUpdate}from'./resources/order_amount_promotion_rules';export type{OrderCopy,OrderCopyCreate,OrderCopyUpdate}from'./resources/order_copies';export type{OrderFactory}from'./resources/order_factories';export type{OrderSubscriptionItem,OrderSubscriptionItemCreate,OrderSubscriptionItemUpdate}from'./resources/order_subscription_items';export type{OrderSubscription,OrderSubscriptionCreate,OrderSubscriptionUpdate}from'./resources/order_subscriptions';export type{OrderValidationRule}from'./resources/order_validation_rules';export type{Order,OrderCreate,OrderUpdate}from'./resources/orders';export type{Organization}from'./resources/organization';export type{Package,PackageCreate,PackageUpdate}from'./resources/packages';export type{ParcelLineItem,ParcelLineItemCreate,ParcelLineItemUpdate}from'./resources/parcel_line_items';export type{Parcel,ParcelCreate,ParcelUpdate}from'./resources/parcels';export type{PaymentGateway}from'./resources/payment_gateways';export type{PaymentMethod,PaymentMethodCreate,PaymentMethodUpdate}from'./resources/payment_methods';export type{PaymentOption,PaymentOptionCreate,PaymentOptionUpdate}from'./resources/payment_options';export type{PaypalGateway,PaypalGatewayCreate,PaypalGatewayUpdate}from'./resources/paypal_gateways';export type{PaypalPayment,PaypalPaymentCreate,PaypalPaymentUpdate}from'./resources/paypal_payments';export type{PercentageDiscountPromotion,PercentageDiscountPromotionCreate,PercentageDiscountPromotionUpdate}from'./resources/percentage_discount_promotions';export type{PriceFrequencyTier,PriceFrequencyTierCreate,PriceFrequencyTierUpdate}from'./resources/price_frequency_tiers';export type{PriceListScheduler,PriceListSchedulerCreate,PriceListSchedulerUpdate}from'./resources/price_list_schedulers';export type{PriceList,PriceListCreate,PriceListUpdate}from'./resources/price_lists';export type{PriceTier}from'./resources/price_tiers';export type{PriceVolumeTier,PriceVolumeTierCreate,PriceVolumeTierUpdate}from'./resources/price_volume_tiers';export type{Price,PriceCreate,PriceUpdate}from'./resources/prices';export type{PromotionRule}from'./resources/promotion_rules';export type{Promotion}from'./resources/promotions';export type{RecurringOrderCopy,RecurringOrderCopyCreate,RecurringOrderCopyUpdate}from'./resources/recurring_order_copies';export type{Refund}from'./resources/refunds';export type{ReservedStock}from'./resources/reserved_stocks';export type{ResourceError}from'./resources/resource_errors';export type{ReturnLineItem,ReturnLineItemCreate,ReturnLineItemUpdate}from'./resources/return_line_items';export type{Return,ReturnCreate,ReturnUpdate}from'./resources/returns';export type{SatispayGateway,SatispayGatewayCreate,SatispayGatewayUpdate}from'./resources/satispay_gateways';export type{SatispayPayment,SatispayPaymentCreate,SatispayPaymentUpdate}from'./resources/satispay_payments';export type{Shipment,ShipmentCreate,ShipmentUpdate}from'./resources/shipments';export type{ShippingCategory,ShippingCategoryCreate,ShippingCategoryUpdate}from'./resources/shipping_categories';export type{ShippingMethodTier}from'./resources/shipping_method_tiers';export type{ShippingMethod,ShippingMethodCreate,ShippingMethodUpdate}from'./resources/shipping_methods';export type{ShippingWeightTier,ShippingWeightTierCreate,ShippingWeightTierUpdate}from'./resources/shipping_weight_tiers';export type{ShippingZone,ShippingZoneCreate,ShippingZoneUpdate}from'./resources/shipping_zones';export type{SkuListItem,SkuListItemCreate,SkuListItemUpdate}from'./resources/sku_list_items';export type{SkuListPromotionRule,SkuListPromotionRuleCreate,SkuListPromotionRuleUpdate}from'./resources/sku_list_promotion_rules';export type{SkuList,SkuListCreate,SkuListUpdate}from'./resources/sku_lists';export type{SkuOption,SkuOptionCreate,SkuOptionUpdate}from'./resources/sku_options';export type{Sku,SkuCreate,SkuUpdate}from'./resources/skus';export type{StockItem,StockItemCreate,StockItemUpdate}from'./resources/stock_items';export type{StockLineItem,StockLineItemCreate,StockLineItemUpdate}from'./resources/stock_line_items';export type{StockLocation,StockLocationCreate,StockLocationUpdate}from'./resources/stock_locations';export type{StockReservation,StockReservationCreate,StockReservationUpdate}from'./resources/stock_reservations';export type{StockTransfer,StockTransferCreate,StockTransferUpdate}from'./resources/stock_transfers';export type{StripeGateway,StripeGatewayCreate,StripeGatewayUpdate}from'./resources/stripe_gateways';export type{StripePayment,StripePaymentCreate,StripePaymentUpdate}from'./resources/stripe_payments';export type{SubscriptionModel,SubscriptionModelCreate,SubscriptionModelUpdate}from'./resources/subscription_models';export type{Tag,TagCreate,TagUpdate}from'./resources/tags';export type{TaxCalculator}from'./resources/tax_calculators';export type{TaxCategory,TaxCategoryCreate,TaxCategoryUpdate}from'./resources/tax_categories';export type{TaxRule,TaxRuleCreate,TaxRuleUpdate}from'./resources/tax_rules';export type{TaxjarAccount,TaxjarAccountCreate,TaxjarAccountUpdate}from'./resources/taxjar_accounts';export type{Transaction}from'./resources/transactions';export type{Version}from'./resources/versions';export type{Void}from'./resources/voids';export type{Webhook,WebhookCreate,WebhookUpdate}from'./resources/webhooks';export type{WireTransfer,WireTransferCreate,WireTransferUpdate}from'./resources/wire_transfers';
package/lib/cjs/model.js CHANGED
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // ##__MODEL_TYPES_STOP__##
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -1,23 +1 @@
1
- import { ResourceType } from "./resource";
2
- interface QueryParamsRetrieve {
3
- include?: string[];
4
- fields?: string[] | {
5
- [key: string]: string[];
6
- };
7
- }
8
- interface QueryParamsList extends QueryParamsRetrieve {
9
- sort?: string[] | {
10
- [key: string]: 'asc' | 'desc';
11
- };
12
- filters?: {
13
- [key: string]: string | number | boolean;
14
- };
15
- pageNumber?: number;
16
- pageSize?: number;
17
- }
18
- type QueryParams = QueryParamsRetrieve | QueryParamsList;
19
- export { QueryParamsRetrieve, QueryParamsList, QueryParams };
20
- declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined, res: string | ResourceType) => {
21
- [key: string]: string;
22
- };
23
- export { generateQueryStringParams };
1
+ import{ResourceType}from"./resource";interface QueryParamsRetrieve{include?:string[];fields?:string[]|{[key:string]:string[];};}interface QueryParamsList extends QueryParamsRetrieve{sort?:string[]|{[key:string]:'asc'|'desc';};filters?:{[key:string]:string|number|boolean;};pageNumber?:number;pageSize?:number;}type QueryParams=QueryParamsRetrieve|QueryParamsList;export{QueryParamsRetrieve,QueryParamsList,QueryParams};declare const generateQueryStringParams:(params:QueryParamsRetrieve|QueryParamsList|undefined,res:string|ResourceType)=>{[key:string]:string;};export{generateQueryStringParams};
package/lib/cjs/query.js CHANGED
@@ -1,51 +1 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateQueryStringParams = void 0;
7
- const debug_1 = __importDefault(require("./debug"));
8
- const debug = (0, debug_1.default)('query');
9
- const isParamsList = (params) => {
10
- return (params.filters || params.pageNumber || params.pageSize || params.sort);
11
- };
12
- const generateQueryStringParams = (params, res) => {
13
- debug('generate query string params: %O, %O', params, res);
14
- const qp = {};
15
- if (!params)
16
- return qp;
17
- // Include
18
- if (params.include)
19
- qp.include = params.include.join(',');
20
- // Fields
21
- if (params.fields) {
22
- if (Array.isArray(params.fields))
23
- params.fields = { [res.type || res]: params.fields };
24
- Object.entries(params.fields).forEach(([p, v]) => {
25
- qp[`fields[${p}]`] = v.join(',');
26
- });
27
- }
28
- if (isParamsList(params)) {
29
- // Sort
30
- if (params.sort) {
31
- if (Array.isArray(params.sort))
32
- qp.sort = params.sort.join(',');
33
- else
34
- qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',');
35
- }
36
- // Page
37
- if (params.pageNumber)
38
- qp['page[number]'] = String(params.pageNumber);
39
- if (params.pageSize)
40
- qp['page[size]'] = String(params.pageSize);
41
- // Filters
42
- if (params.filters) {
43
- Object.entries(params.filters).forEach(([p, v]) => {
44
- qp[`filter[q][${p}]`] = String(v);
45
- });
46
- }
47
- }
48
- debug('query string params: %O', qp);
49
- return qp;
50
- };
51
- exports.generateQueryStringParams = generateQueryStringParams;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateQueryStringParams=void 0;const debug_1=__importDefault(require("./debug")),debug=(0,debug_1.default)("query"),isParamsList=e=>e.filters||e.pageNumber||e.pageSize||e.sort,generateQueryStringParams=(e,n)=>{debug("generate query string params: %O, %O",e,n);const t={};return e&&(e.include&&(t.include=e.include.join(",")),e.fields&&(Array.isArray(e.fields)&&(e.fields={[n.type||n]:e.fields}),Object.entries(e.fields).forEach(([i,r])=>{t[`fields[${i}]`]=r.join(",")})),isParamsList(e)&&(e.sort&&(Array.isArray(e.sort)?t.sort=e.sort.join(","):t.sort=Object.entries(e.sort).map(([i,r])=>`${r==="desc"?"-":""}${i}`).join(",")),e.pageNumber&&(t["page[number]"]=String(e.pageNumber)),e.pageSize&&(t["page[size]"]=String(e.pageSize)),e.filters&&Object.entries(e.filters).forEach(([i,r])=>{t[`filter[q][${i}]`]=String(r)})),debug("query string params: %O",t)),t};exports.generateQueryStringParams=generateQueryStringParams;