@commercelayer/sdk 5.37.0 → 5.38.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 (547) hide show
  1. package/lib/cjs/api.d.ts +1 -164
  2. package/lib/cjs/api.js +1 -387
  3. package/lib/cjs/client.d.ts +1 -39
  4. package/lib/cjs/client.js +1 -154
  5. package/lib/cjs/commercelayer.d.ts +1 -153
  6. package/lib/cjs/commercelayer.js +1 -253
  7. package/lib/cjs/common.d.ts +1 -5
  8. package/lib/cjs/common.js +1 -23
  9. package/lib/cjs/config.d.ts +1 -15
  10. package/lib/cjs/config.js +1 -19
  11. package/lib/cjs/debug.d.ts +1 -3
  12. package/lib/cjs/debug.js +1 -38
  13. package/lib/cjs/error.d.ts +1 -31
  14. package/lib/cjs/error.js +1 -77
  15. package/lib/cjs/index.d.ts +1 -7
  16. package/lib/cjs/index.js +1 -13
  17. package/lib/cjs/interceptor.d.ts +1 -25
  18. package/lib/cjs/interceptor.js +1 -2
  19. package/lib/cjs/jsonapi.d.ts +1 -6
  20. package/lib/cjs/jsonapi.js +1 -94
  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 -17
  24. package/lib/cjs/query.js +1 -69
  25. package/lib/cjs/resource.d.ts +1 -89
  26. package/lib/cjs/resource.js +1 -198
  27. package/lib/cjs/resources/addresses.d.ts +1 -103
  28. package/lib/cjs/resources/addresses.js +1 -41
  29. package/lib/cjs/resources/adjustments.d.ts +1 -42
  30. package/lib/cjs/resources/adjustments.js +1 -29
  31. package/lib/cjs/resources/adyen_gateways.d.ts +1 -60
  32. package/lib/cjs/resources/adyen_gateways.js +1 -37
  33. package/lib/cjs/resources/adyen_payments.d.ts +1 -51
  34. package/lib/cjs/resources/adyen_payments.js +1 -40
  35. package/lib/cjs/resources/application.d.ts +1 -22
  36. package/lib/cjs/resources/application.js +1 -16
  37. package/lib/cjs/resources/attachments.d.ts +1 -157
  38. package/lib/cjs/resources/attachments.js +1 -25
  39. package/lib/cjs/resources/authorizations.d.ts +1 -70
  40. package/lib/cjs/resources/authorizations.js +1 -52
  41. package/lib/cjs/resources/avalara_accounts.d.ts +1 -59
  42. package/lib/cjs/resources/avalara_accounts.js +1 -41
  43. package/lib/cjs/resources/axerve_gateways.d.ts +1 -48
  44. package/lib/cjs/resources/axerve_gateways.js +1 -37
  45. package/lib/cjs/resources/axerve_payments.d.ts +1 -54
  46. package/lib/cjs/resources/axerve_payments.js +1 -40
  47. package/lib/cjs/resources/billing_info_validation_rules.d.ts +1 -39
  48. package/lib/cjs/resources/billing_info_validation_rules.js +1 -37
  49. package/lib/cjs/resources/bing_geocoders.d.ts +1 -36
  50. package/lib/cjs/resources/bing_geocoders.js +1 -33
  51. package/lib/cjs/resources/braintree_gateways.d.ts +1 -60
  52. package/lib/cjs/resources/braintree_gateways.js +1 -37
  53. package/lib/cjs/resources/braintree_payments.d.ts +1 -52
  54. package/lib/cjs/resources/braintree_payments.js +1 -37
  55. package/lib/cjs/resources/bundles.d.ts +1 -93
  56. package/lib/cjs/resources/bundles.js +1 -59
  57. package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +1 -137
  58. package/lib/cjs/resources/buy_x_pay_y_promotions.js +1 -79
  59. package/lib/cjs/resources/captures.d.ts +1 -60
  60. package/lib/cjs/resources/captures.js +1 -49
  61. package/lib/cjs/resources/carrier_accounts.d.ts +1 -30
  62. package/lib/cjs/resources/carrier_accounts.js +1 -28
  63. package/lib/cjs/resources/checkout_com_gateways.d.ts +1 -49
  64. package/lib/cjs/resources/checkout_com_gateways.js +1 -37
  65. package/lib/cjs/resources/checkout_com_payments.d.ts +1 -65
  66. package/lib/cjs/resources/checkout_com_payments.js +1 -43
  67. package/lib/cjs/resources/cleanups.d.ts +1 -40
  68. package/lib/cjs/resources/cleanups.js +1 -30
  69. package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +1 -67
  70. package/lib/cjs/resources/coupon_codes_promotion_rules.js +1 -33
  71. package/lib/cjs/resources/coupon_recipients.d.ts +1 -48
  72. package/lib/cjs/resources/coupon_recipients.js +1 -37
  73. package/lib/cjs/resources/coupons.d.ts +1 -71
  74. package/lib/cjs/resources/coupons.js +1 -45
  75. package/lib/cjs/resources/custom_promotion_rules.d.ts +1 -62
  76. package/lib/cjs/resources/custom_promotion_rules.js +1 -29
  77. package/lib/cjs/resources/customer_addresses.d.ts +1 -50
  78. package/lib/cjs/resources/customer_addresses.js +1 -41
  79. package/lib/cjs/resources/customer_groups.d.ts +1 -40
  80. package/lib/cjs/resources/customer_groups.js +1 -41
  81. package/lib/cjs/resources/customer_password_resets.d.ts +1 -38
  82. package/lib/cjs/resources/customer_password_resets.js +1 -36
  83. package/lib/cjs/resources/customer_payment_sources.d.ts +1 -86
  84. package/lib/cjs/resources/customer_payment_sources.js +1 -37
  85. package/lib/cjs/resources/customer_subscriptions.d.ts +1 -35
  86. package/lib/cjs/resources/customer_subscriptions.js +1 -37
  87. package/lib/cjs/resources/customers.d.ts +1 -76
  88. package/lib/cjs/resources/customers.js +1 -69
  89. package/lib/cjs/resources/delivery_lead_times.d.ts +1 -55
  90. package/lib/cjs/resources/delivery_lead_times.js +1 -41
  91. package/lib/cjs/resources/event_callbacks.d.ts +1 -25
  92. package/lib/cjs/resources/event_callbacks.js +1 -20
  93. package/lib/cjs/resources/events.d.ts +1 -25
  94. package/lib/cjs/resources/events.js +1 -24
  95. package/lib/cjs/resources/exports.d.ts +1 -41
  96. package/lib/cjs/resources/exports.js +1 -26
  97. package/lib/cjs/resources/external_gateways.d.ts +1 -57
  98. package/lib/cjs/resources/external_gateways.js +1 -40
  99. package/lib/cjs/resources/external_payments.d.ts +1 -48
  100. package/lib/cjs/resources/external_payments.js +1 -41
  101. package/lib/cjs/resources/external_promotions.d.ts +1 -136
  102. package/lib/cjs/resources/external_promotions.js +1 -82
  103. package/lib/cjs/resources/external_tax_calculators.d.ts +1 -45
  104. package/lib/cjs/resources/external_tax_calculators.js +1 -40
  105. package/lib/cjs/resources/fixed_amount_promotions.d.ts +1 -133
  106. package/lib/cjs/resources/fixed_amount_promotions.js +1 -79
  107. package/lib/cjs/resources/fixed_price_promotions.d.ts +1 -133
  108. package/lib/cjs/resources/fixed_price_promotions.js +1 -79
  109. package/lib/cjs/resources/free_gift_promotions.d.ts +1 -131
  110. package/lib/cjs/resources/free_gift_promotions.js +1 -79
  111. package/lib/cjs/resources/free_shipping_promotions.d.ts +1 -125
  112. package/lib/cjs/resources/free_shipping_promotions.js +1 -75
  113. package/lib/cjs/resources/geocoders.d.ts +1 -25
  114. package/lib/cjs/resources/geocoders.js +1 -24
  115. package/lib/cjs/resources/gift_card_recipients.d.ts +1 -48
  116. package/lib/cjs/resources/gift_card_recipients.js +1 -37
  117. package/lib/cjs/resources/gift_cards.d.ts +1 -104
  118. package/lib/cjs/resources/gift_cards.js +1 -61
  119. package/lib/cjs/resources/google_geocoders.d.ts +1 -36
  120. package/lib/cjs/resources/google_geocoders.js +1 -33
  121. package/lib/cjs/resources/imports.d.ts +1 -44
  122. package/lib/cjs/resources/imports.js +1 -26
  123. package/lib/cjs/resources/in_stock_subscriptions.d.ts +1 -68
  124. package/lib/cjs/resources/in_stock_subscriptions.js +1 -51
  125. package/lib/cjs/resources/inventory_models.d.ts +1 -55
  126. package/lib/cjs/resources/inventory_models.js +1 -41
  127. package/lib/cjs/resources/inventory_return_locations.d.ts +1 -47
  128. package/lib/cjs/resources/inventory_return_locations.js +1 -37
  129. package/lib/cjs/resources/inventory_stock_locations.d.ts +1 -50
  130. package/lib/cjs/resources/inventory_stock_locations.js +1 -37
  131. package/lib/cjs/resources/klarna_gateways.d.ts +1 -48
  132. package/lib/cjs/resources/klarna_gateways.js +1 -37
  133. package/lib/cjs/resources/klarna_payments.d.ts +1 -48
  134. package/lib/cjs/resources/klarna_payments.js +1 -40
  135. package/lib/cjs/resources/line_item_options.d.ts +1 -69
  136. package/lib/cjs/resources/line_item_options.js +1 -41
  137. package/lib/cjs/resources/line_items.d.ts +1 -170
  138. package/lib/cjs/resources/line_items.js +1 -66
  139. package/lib/cjs/resources/manual_gateways.d.ts +1 -34
  140. package/lib/cjs/resources/manual_gateways.js +1 -33
  141. package/lib/cjs/resources/manual_tax_calculators.d.ts +1 -45
  142. package/lib/cjs/resources/manual_tax_calculators.js +1 -41
  143. package/lib/cjs/resources/markets.d.ts +1 -107
  144. package/lib/cjs/resources/markets.js +1 -63
  145. package/lib/cjs/resources/merchants.d.ts +1 -42
  146. package/lib/cjs/resources/merchants.js +1 -37
  147. package/lib/cjs/resources/order_amount_promotion_rules.d.ts +1 -67
  148. package/lib/cjs/resources/order_amount_promotion_rules.js +1 -29
  149. package/lib/cjs/resources/order_copies.d.ts +1 -51
  150. package/lib/cjs/resources/order_copies.js +1 -41
  151. package/lib/cjs/resources/order_factories.d.ts +1 -34
  152. package/lib/cjs/resources/order_factories.js +1 -28
  153. package/lib/cjs/resources/order_subscription_items.d.ts +1 -72
  154. package/lib/cjs/resources/order_subscription_items.js +1 -33
  155. package/lib/cjs/resources/order_subscriptions.d.ts +1 -98
  156. package/lib/cjs/resources/order_subscriptions.js +1 -78
  157. package/lib/cjs/resources/order_validation_rules.d.ts +1 -27
  158. package/lib/cjs/resources/order_validation_rules.js +1 -28
  159. package/lib/cjs/resources/orders.d.ts +1 -389
  160. package/lib/cjs/resources/orders.js +1 -236
  161. package/lib/cjs/resources/organization.d.ts +1 -34
  162. package/lib/cjs/resources/organization.js +1 -16
  163. package/lib/cjs/resources/packages.d.ts +1 -60
  164. package/lib/cjs/resources/packages.js +1 -41
  165. package/lib/cjs/resources/parcel_line_items.d.ts +1 -47
  166. package/lib/cjs/resources/parcel_line_items.js +1 -37
  167. package/lib/cjs/resources/parcels.d.ts +1 -126
  168. package/lib/cjs/resources/parcels.js +1 -49
  169. package/lib/cjs/resources/payment_gateways.d.ts +1 -25
  170. package/lib/cjs/resources/payment_gateways.js +1 -24
  171. package/lib/cjs/resources/payment_methods.d.ts +1 -83
  172. package/lib/cjs/resources/payment_methods.js +1 -47
  173. package/lib/cjs/resources/payment_options.d.ts +1 -44
  174. package/lib/cjs/resources/payment_options.js +1 -33
  175. package/lib/cjs/resources/paypal_gateways.d.ts +1 -41
  176. package/lib/cjs/resources/paypal_gateways.js +1 -37
  177. package/lib/cjs/resources/paypal_payments.d.ts +1 -53
  178. package/lib/cjs/resources/paypal_payments.js +1 -37
  179. package/lib/cjs/resources/percentage_discount_promotions.d.ts +1 -131
  180. package/lib/cjs/resources/percentage_discount_promotions.js +1 -79
  181. package/lib/cjs/resources/price_frequency_tiers.d.ts +1 -53
  182. package/lib/cjs/resources/price_frequency_tiers.js +1 -41
  183. package/lib/cjs/resources/price_lists.d.ts +1 -46
  184. package/lib/cjs/resources/price_lists.js +1 -37
  185. package/lib/cjs/resources/price_tiers.d.ts +1 -32
  186. package/lib/cjs/resources/price_tiers.js +1 -28
  187. package/lib/cjs/resources/price_volume_tiers.d.ts +1 -53
  188. package/lib/cjs/resources/price_volume_tiers.js +1 -41
  189. package/lib/cjs/resources/prices.d.ts +1 -84
  190. package/lib/cjs/resources/prices.js +1 -65
  191. package/lib/cjs/resources/promotion_rules.d.ts +1 -29
  192. package/lib/cjs/resources/promotion_rules.js +1 -20
  193. package/lib/cjs/resources/promotions.d.ts +1 -63
  194. package/lib/cjs/resources/promotions.js +1 -60
  195. package/lib/cjs/resources/recurring_order_copies.d.ts +1 -53
  196. package/lib/cjs/resources/recurring_order_copies.js +1 -41
  197. package/lib/cjs/resources/refunds.d.ts +1 -44
  198. package/lib/cjs/resources/refunds.js +1 -36
  199. package/lib/cjs/resources/reserved_stocks.d.ts +1 -28
  200. package/lib/cjs/resources/reserved_stocks.js +1 -28
  201. package/lib/cjs/resources/resource_errors.d.ts +1 -22
  202. package/lib/cjs/resources/resource_errors.js +1 -16
  203. package/lib/cjs/resources/return_line_items.d.ts +1 -52
  204. package/lib/cjs/resources/return_line_items.js +1 -36
  205. package/lib/cjs/resources/returns.d.ts +1 -96
  206. package/lib/cjs/resources/returns.js +1 -92
  207. package/lib/cjs/resources/satispay_gateways.d.ts +1 -46
  208. package/lib/cjs/resources/satispay_gateways.js +1 -37
  209. package/lib/cjs/resources/satispay_payments.d.ts +1 -50
  210. package/lib/cjs/resources/satispay_payments.js +1 -40
  211. package/lib/cjs/resources/shipments.d.ts +1 -151
  212. package/lib/cjs/resources/shipments.js +1 -130
  213. package/lib/cjs/resources/shipping_categories.d.ts +1 -40
  214. package/lib/cjs/resources/shipping_categories.js +1 -37
  215. package/lib/cjs/resources/shipping_method_tiers.d.ts +1 -32
  216. package/lib/cjs/resources/shipping_method_tiers.js +1 -28
  217. package/lib/cjs/resources/shipping_methods.d.ts +1 -125
  218. package/lib/cjs/resources/shipping_methods.js +1 -70
  219. package/lib/cjs/resources/shipping_weight_tiers.d.ts +1 -50
  220. package/lib/cjs/resources/shipping_weight_tiers.js +1 -37
  221. package/lib/cjs/resources/shipping_zones.d.ts +1 -52
  222. package/lib/cjs/resources/shipping_zones.js +1 -33
  223. package/lib/cjs/resources/sku_list_items.d.ts +1 -51
  224. package/lib/cjs/resources/sku_list_items.js +1 -37
  225. package/lib/cjs/resources/sku_list_promotion_rules.d.ts +1 -76
  226. package/lib/cjs/resources/sku_list_promotion_rules.js +1 -37
  227. package/lib/cjs/resources/sku_lists.d.ts +1 -64
  228. package/lib/cjs/resources/sku_lists.js +1 -49
  229. package/lib/cjs/resources/sku_options.d.ts +1 -71
  230. package/lib/cjs/resources/sku_options.js +1 -45
  231. package/lib/cjs/resources/skus.d.ts +1 -96
  232. package/lib/cjs/resources/skus.js +1 -65
  233. package/lib/cjs/resources/stock_items.d.ts +1 -61
  234. package/lib/cjs/resources/stock_items.js +1 -52
  235. package/lib/cjs/resources/stock_line_items.d.ts +1 -73
  236. package/lib/cjs/resources/stock_line_items.js +1 -54
  237. package/lib/cjs/resources/stock_locations.d.ts +1 -64
  238. package/lib/cjs/resources/stock_locations.js +1 -53
  239. package/lib/cjs/resources/stock_reservations.d.ts +1 -51
  240. package/lib/cjs/resources/stock_reservations.js +1 -48
  241. package/lib/cjs/resources/stock_transfers.d.ts +1 -86
  242. package/lib/cjs/resources/stock_transfers.js +1 -71
  243. package/lib/cjs/resources/stripe_gateways.d.ts +1 -45
  244. package/lib/cjs/resources/stripe_gateways.js +1 -37
  245. package/lib/cjs/resources/stripe_payments.d.ts +1 -59
  246. package/lib/cjs/resources/stripe_payments.js +1 -43
  247. package/lib/cjs/resources/subscription_models.d.ts +1 -49
  248. package/lib/cjs/resources/subscription_models.js +1 -37
  249. package/lib/cjs/resources/tags.d.ts +1 -28
  250. package/lib/cjs/resources/tags.js +1 -25
  251. package/lib/cjs/resources/tax_calculators.d.ts +1 -28
  252. package/lib/cjs/resources/tax_calculators.js +1 -28
  253. package/lib/cjs/resources/tax_categories.d.ts +1 -63
  254. package/lib/cjs/resources/tax_categories.js +1 -37
  255. package/lib/cjs/resources/tax_rules.d.ts +1 -73
  256. package/lib/cjs/resources/tax_rules.js +1 -33
  257. package/lib/cjs/resources/taxjar_accounts.d.ts +1 -47
  258. package/lib/cjs/resources/taxjar_accounts.js +1 -41
  259. package/lib/cjs/resources/transactions.d.ts +1 -41
  260. package/lib/cjs/resources/transactions.js +1 -32
  261. package/lib/cjs/resources/versions.d.ts +1 -22
  262. package/lib/cjs/resources/versions.js +1 -16
  263. package/lib/cjs/resources/voids.d.ts +1 -44
  264. package/lib/cjs/resources/voids.js +1 -36
  265. package/lib/cjs/resources/webhooks.d.ts +1 -55
  266. package/lib/cjs/resources/webhooks.js +1 -42
  267. package/lib/cjs/resources/wire_transfers.d.ts +1 -37
  268. package/lib/cjs/resources/wire_transfers.js +1 -33
  269. package/lib/cjs/static.d.ts +1 -12
  270. package/lib/cjs/static.js +1 -51
  271. package/lib/cjs/util.d.ts +1 -4
  272. package/lib/cjs/util.js +1 -16
  273. package/lib/esm/api.d.ts +1 -164
  274. package/lib/esm/api.js +1 -258
  275. package/lib/esm/client.d.ts +1 -39
  276. package/lib/esm/client.js +1 -149
  277. package/lib/esm/commercelayer.d.ts +1 -153
  278. package/lib/esm/commercelayer.js +1 -224
  279. package/lib/esm/common.d.ts +1 -5
  280. package/lib/esm/common.js +1 -19
  281. package/lib/esm/config.d.ts +1 -15
  282. package/lib/esm/config.js +1 -17
  283. package/lib/esm/debug.d.ts +1 -3
  284. package/lib/esm/debug.js +1 -36
  285. package/lib/esm/error.d.ts +1 -31
  286. package/lib/esm/error.js +1 -69
  287. package/lib/esm/index.d.ts +1 -7
  288. package/lib/esm/index.js +1 -4
  289. package/lib/esm/interceptor.d.ts +1 -25
  290. package/lib/esm/interceptor.js +1 -1
  291. package/lib/esm/jsonapi.d.ts +1 -6
  292. package/lib/esm/jsonapi.js +1 -87
  293. package/lib/esm/model.d.ts +1 -124
  294. package/lib/esm/model.js +1 -2
  295. package/lib/esm/query.d.ts +1 -17
  296. package/lib/esm/query.js +1 -62
  297. package/lib/esm/resource.d.ts +1 -89
  298. package/lib/esm/resource.js +1 -191
  299. package/lib/esm/resources/addresses.d.ts +1 -103
  300. package/lib/esm/resources/addresses.js +1 -39
  301. package/lib/esm/resources/adjustments.d.ts +1 -42
  302. package/lib/esm/resources/adjustments.js +1 -27
  303. package/lib/esm/resources/adyen_gateways.d.ts +1 -60
  304. package/lib/esm/resources/adyen_gateways.js +1 -35
  305. package/lib/esm/resources/adyen_payments.d.ts +1 -51
  306. package/lib/esm/resources/adyen_payments.js +1 -38
  307. package/lib/esm/resources/application.d.ts +1 -22
  308. package/lib/esm/resources/application.js +1 -14
  309. package/lib/esm/resources/attachments.d.ts +1 -157
  310. package/lib/esm/resources/attachments.js +1 -23
  311. package/lib/esm/resources/authorizations.d.ts +1 -70
  312. package/lib/esm/resources/authorizations.js +1 -50
  313. package/lib/esm/resources/avalara_accounts.d.ts +1 -59
  314. package/lib/esm/resources/avalara_accounts.js +1 -39
  315. package/lib/esm/resources/axerve_gateways.d.ts +1 -48
  316. package/lib/esm/resources/axerve_gateways.js +1 -35
  317. package/lib/esm/resources/axerve_payments.d.ts +1 -54
  318. package/lib/esm/resources/axerve_payments.js +1 -38
  319. package/lib/esm/resources/billing_info_validation_rules.d.ts +1 -39
  320. package/lib/esm/resources/billing_info_validation_rules.js +1 -35
  321. package/lib/esm/resources/bing_geocoders.d.ts +1 -36
  322. package/lib/esm/resources/bing_geocoders.js +1 -31
  323. package/lib/esm/resources/braintree_gateways.d.ts +1 -60
  324. package/lib/esm/resources/braintree_gateways.js +1 -35
  325. package/lib/esm/resources/braintree_payments.d.ts +1 -52
  326. package/lib/esm/resources/braintree_payments.js +1 -35
  327. package/lib/esm/resources/bundles.d.ts +1 -93
  328. package/lib/esm/resources/bundles.js +1 -57
  329. package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +1 -137
  330. package/lib/esm/resources/buy_x_pay_y_promotions.js +1 -77
  331. package/lib/esm/resources/captures.d.ts +1 -60
  332. package/lib/esm/resources/captures.js +1 -47
  333. package/lib/esm/resources/carrier_accounts.d.ts +1 -30
  334. package/lib/esm/resources/carrier_accounts.js +1 -26
  335. package/lib/esm/resources/checkout_com_gateways.d.ts +1 -49
  336. package/lib/esm/resources/checkout_com_gateways.js +1 -35
  337. package/lib/esm/resources/checkout_com_payments.d.ts +1 -65
  338. package/lib/esm/resources/checkout_com_payments.js +1 -41
  339. package/lib/esm/resources/cleanups.d.ts +1 -40
  340. package/lib/esm/resources/cleanups.js +1 -28
  341. package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +1 -67
  342. package/lib/esm/resources/coupon_codes_promotion_rules.js +1 -31
  343. package/lib/esm/resources/coupon_recipients.d.ts +1 -48
  344. package/lib/esm/resources/coupon_recipients.js +1 -35
  345. package/lib/esm/resources/coupons.d.ts +1 -71
  346. package/lib/esm/resources/coupons.js +1 -43
  347. package/lib/esm/resources/custom_promotion_rules.d.ts +1 -62
  348. package/lib/esm/resources/custom_promotion_rules.js +1 -27
  349. package/lib/esm/resources/customer_addresses.d.ts +1 -50
  350. package/lib/esm/resources/customer_addresses.js +1 -39
  351. package/lib/esm/resources/customer_groups.d.ts +1 -40
  352. package/lib/esm/resources/customer_groups.js +1 -39
  353. package/lib/esm/resources/customer_password_resets.d.ts +1 -38
  354. package/lib/esm/resources/customer_password_resets.js +1 -34
  355. package/lib/esm/resources/customer_payment_sources.d.ts +1 -86
  356. package/lib/esm/resources/customer_payment_sources.js +1 -35
  357. package/lib/esm/resources/customer_subscriptions.d.ts +1 -35
  358. package/lib/esm/resources/customer_subscriptions.js +1 -35
  359. package/lib/esm/resources/customers.d.ts +1 -76
  360. package/lib/esm/resources/customers.js +1 -67
  361. package/lib/esm/resources/delivery_lead_times.d.ts +1 -55
  362. package/lib/esm/resources/delivery_lead_times.js +1 -39
  363. package/lib/esm/resources/event_callbacks.d.ts +1 -25
  364. package/lib/esm/resources/event_callbacks.js +1 -18
  365. package/lib/esm/resources/events.d.ts +1 -25
  366. package/lib/esm/resources/events.js +1 -22
  367. package/lib/esm/resources/exports.d.ts +1 -41
  368. package/lib/esm/resources/exports.js +1 -24
  369. package/lib/esm/resources/external_gateways.d.ts +1 -57
  370. package/lib/esm/resources/external_gateways.js +1 -38
  371. package/lib/esm/resources/external_payments.d.ts +1 -48
  372. package/lib/esm/resources/external_payments.js +1 -39
  373. package/lib/esm/resources/external_promotions.d.ts +1 -136
  374. package/lib/esm/resources/external_promotions.js +1 -80
  375. package/lib/esm/resources/external_tax_calculators.d.ts +1 -45
  376. package/lib/esm/resources/external_tax_calculators.js +1 -38
  377. package/lib/esm/resources/fixed_amount_promotions.d.ts +1 -133
  378. package/lib/esm/resources/fixed_amount_promotions.js +1 -77
  379. package/lib/esm/resources/fixed_price_promotions.d.ts +1 -133
  380. package/lib/esm/resources/fixed_price_promotions.js +1 -77
  381. package/lib/esm/resources/free_gift_promotions.d.ts +1 -131
  382. package/lib/esm/resources/free_gift_promotions.js +1 -77
  383. package/lib/esm/resources/free_shipping_promotions.d.ts +1 -125
  384. package/lib/esm/resources/free_shipping_promotions.js +1 -73
  385. package/lib/esm/resources/geocoders.d.ts +1 -25
  386. package/lib/esm/resources/geocoders.js +1 -22
  387. package/lib/esm/resources/gift_card_recipients.d.ts +1 -48
  388. package/lib/esm/resources/gift_card_recipients.js +1 -35
  389. package/lib/esm/resources/gift_cards.d.ts +1 -104
  390. package/lib/esm/resources/gift_cards.js +1 -59
  391. package/lib/esm/resources/google_geocoders.d.ts +1 -36
  392. package/lib/esm/resources/google_geocoders.js +1 -31
  393. package/lib/esm/resources/imports.d.ts +1 -44
  394. package/lib/esm/resources/imports.js +1 -24
  395. package/lib/esm/resources/in_stock_subscriptions.d.ts +1 -68
  396. package/lib/esm/resources/in_stock_subscriptions.js +1 -49
  397. package/lib/esm/resources/inventory_models.d.ts +1 -55
  398. package/lib/esm/resources/inventory_models.js +1 -39
  399. package/lib/esm/resources/inventory_return_locations.d.ts +1 -47
  400. package/lib/esm/resources/inventory_return_locations.js +1 -35
  401. package/lib/esm/resources/inventory_stock_locations.d.ts +1 -50
  402. package/lib/esm/resources/inventory_stock_locations.js +1 -35
  403. package/lib/esm/resources/klarna_gateways.d.ts +1 -48
  404. package/lib/esm/resources/klarna_gateways.js +1 -35
  405. package/lib/esm/resources/klarna_payments.d.ts +1 -48
  406. package/lib/esm/resources/klarna_payments.js +1 -38
  407. package/lib/esm/resources/line_item_options.d.ts +1 -69
  408. package/lib/esm/resources/line_item_options.js +1 -39
  409. package/lib/esm/resources/line_items.d.ts +1 -170
  410. package/lib/esm/resources/line_items.js +1 -64
  411. package/lib/esm/resources/manual_gateways.d.ts +1 -34
  412. package/lib/esm/resources/manual_gateways.js +1 -31
  413. package/lib/esm/resources/manual_tax_calculators.d.ts +1 -45
  414. package/lib/esm/resources/manual_tax_calculators.js +1 -39
  415. package/lib/esm/resources/markets.d.ts +1 -107
  416. package/lib/esm/resources/markets.js +1 -61
  417. package/lib/esm/resources/merchants.d.ts +1 -42
  418. package/lib/esm/resources/merchants.js +1 -35
  419. package/lib/esm/resources/order_amount_promotion_rules.d.ts +1 -67
  420. package/lib/esm/resources/order_amount_promotion_rules.js +1 -27
  421. package/lib/esm/resources/order_copies.d.ts +1 -51
  422. package/lib/esm/resources/order_copies.js +1 -39
  423. package/lib/esm/resources/order_factories.d.ts +1 -34
  424. package/lib/esm/resources/order_factories.js +1 -26
  425. package/lib/esm/resources/order_subscription_items.d.ts +1 -72
  426. package/lib/esm/resources/order_subscription_items.js +1 -31
  427. package/lib/esm/resources/order_subscriptions.d.ts +1 -98
  428. package/lib/esm/resources/order_subscriptions.js +1 -76
  429. package/lib/esm/resources/order_validation_rules.d.ts +1 -27
  430. package/lib/esm/resources/order_validation_rules.js +1 -26
  431. package/lib/esm/resources/orders.d.ts +1 -389
  432. package/lib/esm/resources/orders.js +1 -234
  433. package/lib/esm/resources/organization.d.ts +1 -34
  434. package/lib/esm/resources/organization.js +1 -14
  435. package/lib/esm/resources/packages.d.ts +1 -60
  436. package/lib/esm/resources/packages.js +1 -39
  437. package/lib/esm/resources/parcel_line_items.d.ts +1 -47
  438. package/lib/esm/resources/parcel_line_items.js +1 -35
  439. package/lib/esm/resources/parcels.d.ts +1 -126
  440. package/lib/esm/resources/parcels.js +1 -47
  441. package/lib/esm/resources/payment_gateways.d.ts +1 -25
  442. package/lib/esm/resources/payment_gateways.js +1 -22
  443. package/lib/esm/resources/payment_methods.d.ts +1 -83
  444. package/lib/esm/resources/payment_methods.js +1 -45
  445. package/lib/esm/resources/payment_options.d.ts +1 -44
  446. package/lib/esm/resources/payment_options.js +1 -31
  447. package/lib/esm/resources/paypal_gateways.d.ts +1 -41
  448. package/lib/esm/resources/paypal_gateways.js +1 -35
  449. package/lib/esm/resources/paypal_payments.d.ts +1 -53
  450. package/lib/esm/resources/paypal_payments.js +1 -35
  451. package/lib/esm/resources/percentage_discount_promotions.d.ts +1 -131
  452. package/lib/esm/resources/percentage_discount_promotions.js +1 -77
  453. package/lib/esm/resources/price_frequency_tiers.d.ts +1 -53
  454. package/lib/esm/resources/price_frequency_tiers.js +1 -39
  455. package/lib/esm/resources/price_lists.d.ts +1 -46
  456. package/lib/esm/resources/price_lists.js +1 -35
  457. package/lib/esm/resources/price_tiers.d.ts +1 -32
  458. package/lib/esm/resources/price_tiers.js +1 -26
  459. package/lib/esm/resources/price_volume_tiers.d.ts +1 -53
  460. package/lib/esm/resources/price_volume_tiers.js +1 -39
  461. package/lib/esm/resources/prices.d.ts +1 -84
  462. package/lib/esm/resources/prices.js +1 -63
  463. package/lib/esm/resources/promotion_rules.d.ts +1 -29
  464. package/lib/esm/resources/promotion_rules.js +1 -18
  465. package/lib/esm/resources/promotions.d.ts +1 -63
  466. package/lib/esm/resources/promotions.js +1 -58
  467. package/lib/esm/resources/recurring_order_copies.d.ts +1 -53
  468. package/lib/esm/resources/recurring_order_copies.js +1 -39
  469. package/lib/esm/resources/refunds.d.ts +1 -44
  470. package/lib/esm/resources/refunds.js +1 -34
  471. package/lib/esm/resources/reserved_stocks.d.ts +1 -28
  472. package/lib/esm/resources/reserved_stocks.js +1 -26
  473. package/lib/esm/resources/resource_errors.d.ts +1 -22
  474. package/lib/esm/resources/resource_errors.js +1 -14
  475. package/lib/esm/resources/return_line_items.d.ts +1 -52
  476. package/lib/esm/resources/return_line_items.js +1 -34
  477. package/lib/esm/resources/returns.d.ts +1 -96
  478. package/lib/esm/resources/returns.js +1 -90
  479. package/lib/esm/resources/satispay_gateways.d.ts +1 -46
  480. package/lib/esm/resources/satispay_gateways.js +1 -35
  481. package/lib/esm/resources/satispay_payments.d.ts +1 -50
  482. package/lib/esm/resources/satispay_payments.js +1 -38
  483. package/lib/esm/resources/shipments.d.ts +1 -151
  484. package/lib/esm/resources/shipments.js +1 -128
  485. package/lib/esm/resources/shipping_categories.d.ts +1 -40
  486. package/lib/esm/resources/shipping_categories.js +1 -35
  487. package/lib/esm/resources/shipping_method_tiers.d.ts +1 -32
  488. package/lib/esm/resources/shipping_method_tiers.js +1 -26
  489. package/lib/esm/resources/shipping_methods.d.ts +1 -125
  490. package/lib/esm/resources/shipping_methods.js +1 -68
  491. package/lib/esm/resources/shipping_weight_tiers.d.ts +1 -50
  492. package/lib/esm/resources/shipping_weight_tiers.js +1 -35
  493. package/lib/esm/resources/shipping_zones.d.ts +1 -52
  494. package/lib/esm/resources/shipping_zones.js +1 -31
  495. package/lib/esm/resources/sku_list_items.d.ts +1 -51
  496. package/lib/esm/resources/sku_list_items.js +1 -35
  497. package/lib/esm/resources/sku_list_promotion_rules.d.ts +1 -76
  498. package/lib/esm/resources/sku_list_promotion_rules.js +1 -35
  499. package/lib/esm/resources/sku_lists.d.ts +1 -64
  500. package/lib/esm/resources/sku_lists.js +1 -47
  501. package/lib/esm/resources/sku_options.d.ts +1 -71
  502. package/lib/esm/resources/sku_options.js +1 -43
  503. package/lib/esm/resources/skus.d.ts +1 -96
  504. package/lib/esm/resources/skus.js +1 -63
  505. package/lib/esm/resources/stock_items.d.ts +1 -61
  506. package/lib/esm/resources/stock_items.js +1 -50
  507. package/lib/esm/resources/stock_line_items.d.ts +1 -73
  508. package/lib/esm/resources/stock_line_items.js +1 -52
  509. package/lib/esm/resources/stock_locations.d.ts +1 -64
  510. package/lib/esm/resources/stock_locations.js +1 -51
  511. package/lib/esm/resources/stock_reservations.d.ts +1 -51
  512. package/lib/esm/resources/stock_reservations.js +1 -46
  513. package/lib/esm/resources/stock_transfers.d.ts +1 -86
  514. package/lib/esm/resources/stock_transfers.js +1 -69
  515. package/lib/esm/resources/stripe_gateways.d.ts +1 -45
  516. package/lib/esm/resources/stripe_gateways.js +1 -35
  517. package/lib/esm/resources/stripe_payments.d.ts +1 -59
  518. package/lib/esm/resources/stripe_payments.js +1 -41
  519. package/lib/esm/resources/subscription_models.d.ts +1 -49
  520. package/lib/esm/resources/subscription_models.js +1 -35
  521. package/lib/esm/resources/tags.d.ts +1 -28
  522. package/lib/esm/resources/tags.js +1 -23
  523. package/lib/esm/resources/tax_calculators.d.ts +1 -28
  524. package/lib/esm/resources/tax_calculators.js +1 -26
  525. package/lib/esm/resources/tax_categories.d.ts +1 -63
  526. package/lib/esm/resources/tax_categories.js +1 -35
  527. package/lib/esm/resources/tax_rules.d.ts +1 -73
  528. package/lib/esm/resources/tax_rules.js +1 -31
  529. package/lib/esm/resources/taxjar_accounts.d.ts +1 -47
  530. package/lib/esm/resources/taxjar_accounts.js +1 -39
  531. package/lib/esm/resources/transactions.d.ts +1 -41
  532. package/lib/esm/resources/transactions.js +1 -30
  533. package/lib/esm/resources/versions.d.ts +1 -22
  534. package/lib/esm/resources/versions.js +1 -14
  535. package/lib/esm/resources/voids.d.ts +1 -44
  536. package/lib/esm/resources/voids.js +1 -34
  537. package/lib/esm/resources/webhooks.d.ts +1 -55
  538. package/lib/esm/resources/webhooks.js +1 -40
  539. package/lib/esm/resources/wire_transfers.d.ts +1 -37
  540. package/lib/esm/resources/wire_transfers.js +1 -31
  541. package/lib/esm/static.d.ts +1 -12
  542. package/lib/esm/static.js +1 -25
  543. package/lib/esm/util.d.ts +1 -4
  544. package/lib/esm/util.js +1 -37
  545. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  546. package/lib/tsconfig.tsbuildinfo +1 -1
  547. package/package.json +2 -2
@@ -1,89 +1 @@
1
- import ApiClient, { type ApiClientInitConfig } from './client';
2
- import type { QueryParamsRetrieve, QueryParamsList, QueryFilter, QueryParams } from './query';
3
- import type { ResourceTypeLock } from './api';
4
- import type { InterceptorManager } from './interceptor';
5
- type ResourceNull = {
6
- id: null;
7
- } & ResourceType;
8
- type ResourceRel = ResourceId | ResourceNull;
9
- type Metadata = Record<string, any>;
10
- interface ResourceType {
11
- readonly type: ResourceTypeLock;
12
- }
13
- interface ResourceId extends ResourceType {
14
- readonly id: string;
15
- }
16
- interface ResourceBase {
17
- reference?: string | null;
18
- reference_origin?: string | null;
19
- metadata?: Metadata;
20
- }
21
- interface Resource extends ResourceBase, ResourceId {
22
- readonly created_at: string;
23
- readonly updated_at: string;
24
- }
25
- interface ResourceCreate extends ResourceBase {
26
- }
27
- interface ResourceUpdate extends ResourceBase {
28
- readonly id: string;
29
- }
30
- type ListMeta = {
31
- readonly pageCount: number;
32
- readonly recordCount: number;
33
- readonly currentPage: number;
34
- readonly recordsPerPage: number;
35
- };
36
- declare class ListResponse<R> extends Array<R> {
37
- readonly meta: ListMeta;
38
- constructor(meta: ListMeta, data: R[]);
39
- first(): R | undefined;
40
- last(): R | undefined;
41
- get(index: number): R | undefined;
42
- hasNextPage(): boolean;
43
- hasPrevPage(): boolean;
44
- getRecordCount(): number;
45
- getPageCount(): number;
46
- get recordCount(): number;
47
- get pageCount(): number;
48
- }
49
- export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse, ListMeta, ResourceRel };
50
- type ResourceAdapterConfig = {};
51
- type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig;
52
- type ResourcesConfig = Partial<ResourcesInitConfig>;
53
- declare class ResourceAdapter {
54
- #private;
55
- constructor(config: ResourcesInitConfig);
56
- get interceptors(): InterceptorManager;
57
- private localConfig;
58
- config(config: ResourcesConfig): ResourceAdapter;
59
- get client(): Readonly<ApiClient>;
60
- singleton<R extends Resource>(resource: ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
61
- retrieve<R extends Resource>(resource: ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
62
- list<R extends Resource>(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
63
- create<C extends ResourceCreate, R extends Resource>(resource: C & ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
64
- update<U extends ResourceUpdate, R extends Resource>(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
65
- delete(resource: ResourceId, options?: ResourcesConfig): Promise<void>;
66
- fetch<R extends Resource>(resource: string | ResourceType, path: string, params?: QueryParams, options?: ResourcesConfig): Promise<R | ListResponse<R>>;
67
- }
68
- declare abstract class ApiResourceBase<R extends Resource> {
69
- static readonly TYPE: ResourceTypeLock;
70
- protected readonly resources: ResourceAdapter;
71
- constructor(adapter: ResourceAdapter);
72
- abstract relationship(id: string | ResourceId | null): ResourceRel;
73
- abstract type(): ResourceTypeLock;
74
- parse(resource: string, options?: {
75
- ignoreSlug?: boolean;
76
- }): R | R[];
77
- update(resource: ResourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
78
- }
79
- declare abstract class ApiResource<R extends Resource> extends ApiResourceBase<R> {
80
- retrieve(id: string | ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
81
- list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
82
- count(filter?: QueryFilter | QueryParamsList, options?: ResourcesConfig): Promise<number>;
83
- }
84
- declare abstract class ApiSingleton<R extends Resource> extends ApiResourceBase<R> {
85
- retrieve(params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
86
- }
87
- export default ResourceAdapter;
88
- export { ApiResource, ApiSingleton };
89
- export type { ResourcesConfig, ResourcesInitConfig };
1
+ import ApiClient,{type ApiClientInitConfig}from'./client';import type{QueryParamsRetrieve,QueryParamsList,QueryFilter,QueryParams}from'./query';import type{ResourceTypeLock}from'./api';import type{InterceptorManager}from'./interceptor';type ResourceNull={id:null;}&ResourceType;type ResourceRel=ResourceId|ResourceNull;type Metadata=Record<string,any>;interface ResourceType{readonly type:ResourceTypeLock;}interface ResourceId extends ResourceType{readonly id:string;}interface ResourceBase{reference?:string|null;reference_origin?:string|null;metadata?:Metadata;}interface Resource extends ResourceBase,ResourceId{readonly created_at:string;readonly updated_at:string;}interface ResourceCreate extends ResourceBase{}interface ResourceUpdate extends ResourceBase{readonly id:string;}type ListMeta={readonly pageCount:number;readonly recordCount:number;readonly currentPage:number;readonly recordsPerPage:number;};declare class ListResponse<R>extends Array<R>{readonly meta:ListMeta;constructor(meta:ListMeta,data:R[]);first():R|undefined;last():R|undefined;get(index:number):R|undefined;hasNextPage():boolean;hasPrevPage():boolean;getRecordCount():number;getPageCount():number;get recordCount():number;get pageCount():number;}export type{Metadata,ResourceType,ResourceId,Resource,ResourceCreate,ResourceUpdate,ListResponse,ListMeta,ResourceRel};type ResourceAdapterConfig={};type ResourcesInitConfig=ResourceAdapterConfig&ApiClientInitConfig;type ResourcesConfig=Partial<ResourcesInitConfig>;declare class ResourceAdapter{#private;constructor(config:ResourcesInitConfig);get interceptors():InterceptorManager;private localConfig;config(config:ResourcesConfig):ResourceAdapter;get client():Readonly<ApiClient>;singleton<R extends Resource>(resource:ResourceType,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<R>;retrieve<R extends Resource>(resource:ResourceId,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<R>;list<R extends Resource>(resource:ResourceType,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<R>>;create<C extends ResourceCreate,R extends Resource>(resource:C&ResourceType,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<R>;update<U extends ResourceUpdate,R extends Resource>(resource:U&ResourceId,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<R>;delete(resource:ResourceId,options?:ResourcesConfig):Promise<void>;fetch<R extends Resource>(resource:string|ResourceType,path:string,params?:QueryParams,options?:ResourcesConfig):Promise<R|ListResponse<R>>;}declare abstract class ApiResourceBase<R extends Resource>{static readonly TYPE:ResourceTypeLock;protected readonly resources:ResourceAdapter;constructor(adapter:ResourceAdapter);abstract relationship(id:string|ResourceId|null):ResourceRel;abstract type():ResourceTypeLock;parse(resource:string,options?:{ignoreSlug?:boolean;}):R|R[];update(resource:ResourceUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<R>;}declare abstract class ApiResource<R extends Resource>extends ApiResourceBase<R>{retrieve(id:string|ResourceId,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<R>;list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<R>>;count(filter?:QueryFilter|QueryParamsList,options?:ResourcesConfig):Promise<number>;}declare abstract class ApiSingleton<R extends Resource>extends ApiResourceBase<R>{retrieve(params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<R>;}export default ResourceAdapter;export{ApiResource,ApiSingleton};export type{ResourcesConfig,ResourcesInitConfig};
@@ -1,191 +1 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _ResourceAdapter_client, _ResourceAdapter_config;
13
- import ApiClient from './client';
14
- import { denormalize, normalize } from './jsonapi';
15
- import { generateQueryStringParams, isParamsList } from './query';
16
- import config from './config';
17
- import { ErrorType, SdkError } from './error';
18
- import Debug from './debug';
19
- const debug = Debug('resource');
20
- class ListResponse extends Array {
21
- constructor(meta, data) {
22
- super(...(data || []));
23
- this.meta = meta;
24
- }
25
- first() { return this.length ? this[0] : undefined; }
26
- last() { return this.length ? this[this.length - 1] : undefined; }
27
- get(index) { return (this.length && (index >= 0)) ? this[index] : undefined; }
28
- hasNextPage() { return (this.meta.currentPage < this.meta.pageCount); }
29
- hasPrevPage() { return (this.meta.currentPage > 1); }
30
- getRecordCount() { return this.meta.recordCount; }
31
- getPageCount() { return this.meta.pageCount; }
32
- get recordCount() { return this.meta.recordCount; }
33
- get pageCount() { return this.meta.pageCount; }
34
- }
35
- class ResourceAdapter {
36
- constructor(config) {
37
- _ResourceAdapter_client.set(this, void 0);
38
- _ResourceAdapter_config.set(this, {});
39
- __classPrivateFieldSet(this, _ResourceAdapter_client, ApiClient.create(config), "f");
40
- this.localConfig(config);
41
- }
42
- get interceptors() { return __classPrivateFieldGet(this, _ResourceAdapter_client, "f").interceptors; }
43
- localConfig(config) {
44
- // if (typeof config.xyz !== 'undefined') this.#config.xyz = config.xyz
45
- }
46
- config(config) {
47
- debug('config %o', config);
48
- // ResourceAdapter config
49
- this.localConfig(config);
50
- // Client config
51
- __classPrivateFieldGet(this, _ResourceAdapter_client, "f").config(config);
52
- return this;
53
- }
54
- get client() {
55
- return __classPrivateFieldGet(this, _ResourceAdapter_client, "f");
56
- }
57
- async singleton(resource, params, options) {
58
- debug('singleton: %o, %O, %O', resource, params || {}, options || {});
59
- const queryParams = generateQueryStringParams(params, resource);
60
- if (options === null || options === void 0 ? void 0 : options.params)
61
- Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
62
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
63
- const r = denormalize(res);
64
- return r;
65
- }
66
- async retrieve(resource, params, options) {
67
- debug('retrieve: %o, %O, %O', resource, params || {}, options || {});
68
- const queryParams = generateQueryStringParams(params, resource);
69
- if (options === null || options === void 0 ? void 0 : options.params)
70
- Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
71
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}/${resource.id}`, undefined, { ...options, params: queryParams });
72
- const r = denormalize(res);
73
- return r;
74
- }
75
- async list(resource, params, options) {
76
- var _a, _b;
77
- debug('list: %o, %O, %O', resource, params || {}, options || {});
78
- const queryParams = generateQueryStringParams(params, resource);
79
- if (options === null || options === void 0 ? void 0 : options.params)
80
- Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
81
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
82
- const r = denormalize(res);
83
- const meta = {
84
- pageCount: Number((_a = res.meta) === null || _a === void 0 ? void 0 : _a.page_count),
85
- recordCount: Number((_b = res.meta) === null || _b === void 0 ? void 0 : _b.record_count),
86
- currentPage: (params === null || params === void 0 ? void 0 : params.pageNumber) || config.default.pageNumber,
87
- recordsPerPage: (params === null || params === void 0 ? void 0 : params.pageSize) || config.default.pageSize
88
- };
89
- return new ListResponse(meta, r);
90
- }
91
- async create(resource, params, options) {
92
- debug('create: %o, %O, %O', resource, params || {}, options || {});
93
- const queryParams = generateQueryStringParams(params, resource);
94
- if (options === null || options === void 0 ? void 0 : options.params)
95
- Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
96
- const data = normalize(resource);
97
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('post', resource.type, data, { ...options, params: queryParams });
98
- const r = denormalize(res);
99
- return r;
100
- }
101
- async update(resource, params, options) {
102
- debug('update: %o, %O, %O', resource, params || {}, options || {});
103
- const queryParams = generateQueryStringParams(params, resource);
104
- if (options === null || options === void 0 ? void 0 : options.params)
105
- Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
106
- const data = normalize(resource);
107
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('patch', `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
108
- const r = denormalize(res);
109
- return r;
110
- }
111
- async delete(resource, options) {
112
- debug('delete: %o, %O', resource, options || {});
113
- await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('delete', `${resource.type}/${resource.id}`, undefined, options);
114
- }
115
- async fetch(resource, path, params, options) {
116
- var _a, _b;
117
- debug('fetch: %o, %O, %O', path, params || {}, options || {});
118
- const queryParams = generateQueryStringParams(params, resource);
119
- if (options === null || options === void 0 ? void 0 : options.params)
120
- Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
121
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', path, undefined, { ...options, params: queryParams });
122
- const r = denormalize(res);
123
- if (Array.isArray(r)) {
124
- const p = params;
125
- const meta = {
126
- pageCount: Number((_a = res.meta) === null || _a === void 0 ? void 0 : _a.page_count),
127
- recordCount: Number((_b = res.meta) === null || _b === void 0 ? void 0 : _b.record_count),
128
- currentPage: (p === null || p === void 0 ? void 0 : p.pageNumber) || config.default.pageNumber,
129
- recordsPerPage: (p === null || p === void 0 ? void 0 : p.pageSize) || config.default.pageSize
130
- };
131
- return new ListResponse(meta, r);
132
- }
133
- else
134
- return r;
135
- }
136
- }
137
- _ResourceAdapter_client = new WeakMap(), _ResourceAdapter_config = new WeakMap();
138
- class ApiResourceBase {
139
- constructor(adapter) {
140
- debug('new resource instance: %s', this.type());
141
- this.resources = adapter;
142
- }
143
- parse(resource, options) {
144
- var _a;
145
- try {
146
- const res = JSON.parse(resource);
147
- // Resource type always checked
148
- const rtype = (_a = res.data) === null || _a === void 0 ? void 0 : _a.type;
149
- if (rtype !== this.type())
150
- throw new SdkError({ message: `Invalid resource type [${rtype}]`, type: ErrorType.PARSE });
151
- // Parse options
152
- const { ignoreSlug } = options || {};
153
- if (!ignoreSlug) {
154
- const links = res.data.links.self;
155
- if (!links || !String(links).match(`^${this.resources.client.baseUrl}/${this.type()}/*`))
156
- throw new SdkError({ message: `Resource contains invalid links [${links}]`, type: ErrorType.PARSE });
157
- }
158
- return denormalize(res);
159
- }
160
- catch (error) {
161
- if (SdkError.isSdkError(error))
162
- throw error;
163
- else
164
- throw new SdkError({ message: `Payload parse error [${error.message}]`, type: ErrorType.PARSE });
165
- }
166
- }
167
- // reference, reference_origin and metadata attributes are always updatable
168
- async update(resource, params, options) {
169
- return this.resources.update({ ...resource, type: this.type() }, params, options);
170
- }
171
- }
172
- class ApiResource extends ApiResourceBase {
173
- async retrieve(id, params, options) {
174
- return this.resources.retrieve((typeof id === 'string') ? { type: this.type(), id } : id, params, options);
175
- }
176
- async list(params, options) {
177
- return this.resources.list({ type: this.type() }, params, options);
178
- }
179
- async count(filter, options) {
180
- const params = { filters: isParamsList(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
181
- const response = await this.list(params, options);
182
- return Promise.resolve(response.meta.recordCount);
183
- }
184
- }
185
- class ApiSingleton extends ApiResourceBase {
186
- async retrieve(params, options) {
187
- return this.resources.singleton({ type: this.type() }, params, options);
188
- }
189
- }
190
- export default ResourceAdapter;
191
- export { ApiResource, ApiSingleton };
1
+ var O=function(i,e,r,t,a){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!a:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?a.call(i,r):a?a.value=r:e.set(i,r),r},d=function(i,e,r,t){if(r==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!t:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?t:r==="a"?t.call(i):t?t.value:e.get(i)},u,w;import S from"./client";import{denormalize as l,normalize as P}from"./jsonapi";import{generateQueryStringParams as g,isParamsList as q}from"./query";import f from"./config";import{ErrorType as p,SdkError as y}from"./error";import A from"./debug";const o=A("resource");class b extends Array{constructor(e,r){super(...r||[]),this.meta=e}first(){return this.length?this[0]:void 0}last(){return this.length?this[this.length-1]:void 0}get(e){return this.length&&e>=0?this[e]:void 0}hasNextPage(){return this.meta.currentPage<this.meta.pageCount}hasPrevPage(){return this.meta.currentPage>1}getRecordCount(){return this.meta.recordCount}getPageCount(){return this.meta.pageCount}get recordCount(){return this.meta.recordCount}get pageCount(){return this.meta.pageCount}}class ${constructor(e){u.set(this,void 0),w.set(this,{}),O(this,u,S.create(e),"f"),this.localConfig(e)}get interceptors(){return d(this,u,"f").interceptors}localConfig(e){}config(e){return o("config %o",e),this.localConfig(e),d(this,u,"f").config(e),this}get client(){return d(this,u,"f")}async singleton(e,r,t){o("singleton: %o, %O, %O",e,r||{},t||{});const a=g(r,e);t?.params&&Object.assign(a,t?.params);const s=await d(this,u,"f").request("get",`${e.type}`,void 0,{...t,params:a});return l(s)}async retrieve(e,r,t){o("retrieve: %o, %O, %O",e,r||{},t||{});const a=g(r,e);t?.params&&Object.assign(a,t?.params);const s=await d(this,u,"f").request("get",`${e.type}/${e.id}`,void 0,{...t,params:a});return l(s)}async list(e,r,t){var a,s;o("list: %o, %O, %O",e,r||{},t||{});const n=g(r,e);t?.params&&Object.assign(n,t?.params);const c=await d(this,u,"f").request("get",`${e.type}`,void 0,{...t,params:n}),m=l(c),v={pageCount:Number((a=c.meta)===null||a===void 0?void 0:a.page_count),recordCount:Number((s=c.meta)===null||s===void 0?void 0:s.record_count),currentPage:r?.pageNumber||f.default.pageNumber,recordsPerPage:r?.pageSize||f.default.pageSize};return new b(v,m)}async create(e,r,t){o("create: %o, %O, %O",e,r||{},t||{});const a=g(r,e);t?.params&&Object.assign(a,t?.params);const s=P(e),n=await d(this,u,"f").request("post",e.type,s,{...t,params:a});return l(n)}async update(e,r,t){o("update: %o, %O, %O",e,r||{},t||{});const a=g(r,e);t?.params&&Object.assign(a,t?.params);const s=P(e),n=await d(this,u,"f").request("patch",`${e.type}/${e.id}`,s,{...t,params:a});return l(n)}async delete(e,r){o("delete: %o, %O",e,r||{}),await d(this,u,"f").request("delete",`${e.type}/${e.id}`,void 0,r)}async fetch(e,r,t,a){var s,n;o("fetch: %o, %O, %O",r,t||{},a||{});const c=g(t,e);a?.params&&Object.assign(c,a?.params);const m=await d(this,u,"f").request("get",r,void 0,{...a,params:c}),v=l(m);if(Array.isArray(v)){const h=t,C={pageCount:Number((s=m.meta)===null||s===void 0?void 0:s.page_count),recordCount:Number((n=m.meta)===null||n===void 0?void 0:n.record_count),currentPage:h?.pageNumber||f.default.pageNumber,recordsPerPage:h?.pageSize||f.default.pageSize};return new b(C,v)}else return v}}u=new WeakMap,w=new WeakMap;class _{constructor(e){o("new resource instance: %s",this.type()),this.resources=e}parse(e,r){var t;try{const a=JSON.parse(e),s=(t=a.data)===null||t===void 0?void 0:t.type;if(s!==this.type())throw new y({message:`Invalid resource type [${s}]`,type:p.PARSE});const{ignoreSlug:n}=r||{};if(!n){const c=a.data.links.self;if(!c||!String(c).match(`^${this.resources.client.baseUrl}/${this.type()}/*`))throw new y({message:`Resource contains invalid links [${c}]`,type:p.PARSE})}return l(a)}catch(a){throw y.isSdkError(a)?a:new y({message:`Payload parse error [${a.message}]`,type:p.PARSE})}}async update(e,r,t){return this.resources.update({...e,type:this.type()},r,t)}}class E extends _{async retrieve(e,r,t){return this.resources.retrieve(typeof e=="string"?{type:this.type(),id:e}:e,r,t)}async list(e,r){return this.resources.list({type:this.type()},e,r)}async count(e,r){const t={filters:q(e)?e.filters:e,pageNumber:1,pageSize:1},a=await this.list(t,r);return Promise.resolve(a.meta.recordCount)}}class N extends _{async retrieve(e,r){return this.resources.singleton({type:this.type()},e,r)}}export default $;export{E as ApiResource,N as ApiSingleton};
@@ -1,103 +1 @@
1
- import { ApiResource } from '../resource';
2
- import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
3
- import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
- import type { Geocoder, GeocoderType } from './geocoders';
5
- import type { Event } from './events';
6
- import type { Tag, TagType } from './tags';
7
- import type { Version } from './versions';
8
- type AddressType = 'addresses';
9
- type AddressRel = ResourceRel & {
10
- type: AddressType;
11
- };
12
- type GeocoderRel = ResourceRel & {
13
- type: GeocoderType;
14
- };
15
- type TagRel = ResourceRel & {
16
- type: TagType;
17
- };
18
- interface Address extends Resource {
19
- readonly type: AddressType;
20
- business?: boolean | null;
21
- first_name?: string | null;
22
- last_name?: string | null;
23
- company?: string | null;
24
- full_name?: string | null;
25
- line_1: string;
26
- line_2?: string | null;
27
- city: string;
28
- zip_code?: string | null;
29
- state_code: string;
30
- country_code: string;
31
- phone: string;
32
- full_address?: string | null;
33
- name?: string | null;
34
- email?: string | null;
35
- notes?: string | null;
36
- lat?: number | null;
37
- lng?: number | null;
38
- is_localized?: boolean | null;
39
- is_geocoded?: boolean | null;
40
- provider_name?: string | null;
41
- map_url?: string | null;
42
- static_map_url?: string | null;
43
- billing_info?: string | null;
44
- geocoder?: Geocoder | null;
45
- events?: Event[] | null;
46
- tags?: Tag[] | null;
47
- versions?: Version[] | null;
48
- }
49
- interface AddressCreate extends ResourceCreate {
50
- business?: boolean | null;
51
- first_name?: string | null;
52
- last_name?: string | null;
53
- company?: string | null;
54
- line_1: string;
55
- line_2?: string | null;
56
- city: string;
57
- zip_code?: string | null;
58
- state_code: string;
59
- country_code: string;
60
- phone: string;
61
- email?: string | null;
62
- notes?: string | null;
63
- lat?: number | null;
64
- lng?: number | null;
65
- billing_info?: string | null;
66
- geocoder?: GeocoderRel | null;
67
- tags?: TagRel[] | null;
68
- }
69
- interface AddressUpdate extends ResourceUpdate {
70
- business?: boolean | null;
71
- first_name?: string | null;
72
- last_name?: string | null;
73
- company?: string | null;
74
- line_1?: string | null;
75
- line_2?: string | null;
76
- city?: string | null;
77
- zip_code?: string | null;
78
- state_code?: string | null;
79
- country_code?: string | null;
80
- phone?: string | null;
81
- email?: string | null;
82
- notes?: string | null;
83
- lat?: number | null;
84
- lng?: number | null;
85
- billing_info?: string | null;
86
- geocoder?: GeocoderRel | null;
87
- tags?: TagRel[] | null;
88
- }
89
- declare class Addresses extends ApiResource<Address> {
90
- static readonly TYPE: AddressType;
91
- create(resource: AddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
92
- update(resource: AddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
93
- delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
94
- geocoder(addressId: string | Address, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Geocoder>;
95
- events(addressId: string | Address, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
96
- tags(addressId: string | Address, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
97
- versions(addressId: string | Address, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
98
- isAddress(resource: any): resource is Address;
99
- relationship(id: string | ResourceId | null): AddressRel;
100
- type(): AddressType;
101
- }
102
- export default Addresses;
103
- export type { Address, AddressCreate, AddressUpdate, AddressType };
1
+ import{ApiResource}from'../resource';import type{Resource,ResourceCreate,ResourceUpdate,ResourceId,ResourcesConfig,ResourceRel,ListResponse}from'../resource';import type{QueryParamsRetrieve,QueryParamsList}from'../query';import type{Geocoder,GeocoderType}from'./geocoders';import type{Event}from'./events';import type{Tag,TagType}from'./tags';import type{Version}from'./versions';type AddressType='addresses';type AddressRel=ResourceRel&{type:AddressType;};type GeocoderRel=ResourceRel&{type:GeocoderType;};type TagRel=ResourceRel&{type:TagType;};interface Address extends Resource{readonly type:AddressType;business?:boolean|null;first_name?:string|null;last_name?:string|null;company?:string|null;full_name?:string|null;line_1:string;line_2?:string|null;city:string;zip_code?:string|null;state_code:string;country_code:string;phone:string;full_address?:string|null;name?:string|null;email?:string|null;notes?:string|null;lat?:number|null;lng?:number|null;is_localized?:boolean|null;is_geocoded?:boolean|null;provider_name?:string|null;map_url?:string|null;static_map_url?:string|null;billing_info?:string|null;geocoder?:Geocoder|null;events?:Event[]|null;tags?:Tag[]|null;versions?:Version[]|null;}interface AddressCreate extends ResourceCreate{business?:boolean|null;first_name?:string|null;last_name?:string|null;company?:string|null;line_1:string;line_2?:string|null;city:string;zip_code?:string|null;state_code:string;country_code:string;phone:string;email?:string|null;notes?:string|null;lat?:number|null;lng?:number|null;billing_info?:string|null;geocoder?:GeocoderRel|null;tags?:TagRel[]|null;}interface AddressUpdate extends ResourceUpdate{business?:boolean|null;first_name?:string|null;last_name?:string|null;company?:string|null;line_1?:string|null;line_2?:string|null;city?:string|null;zip_code?:string|null;state_code?:string|null;country_code?:string|null;phone?:string|null;email?:string|null;notes?:string|null;lat?:number|null;lng?:number|null;billing_info?:string|null;geocoder?:GeocoderRel|null;tags?:TagRel[]|null;}declare class Addresses extends ApiResource<Address>{static readonly TYPE:AddressType;create(resource:AddressCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Address>;update(resource:AddressUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Address>;delete(id:string|ResourceId,options?:ResourcesConfig):Promise<void>;geocoder(addressId:string|Address,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Geocoder>;events(addressId:string|Address,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Event>>;tags(addressId:string|Address,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Tag>>;versions(addressId:string|Address,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Version>>;isAddress(resource:any):resource is Address;relationship(id:string|ResourceId|null):AddressRel;type():AddressType;}export default Addresses;export type{Address,AddressCreate,AddressUpdate,AddressType};
@@ -1,39 +1 @@
1
- import { ApiResource } from '../resource';
2
- class Addresses extends ApiResource {
3
- async create(resource, params, options) {
4
- return this.resources.create({ ...resource, type: Addresses.TYPE }, params, options);
5
- }
6
- async update(resource, params, options) {
7
- return this.resources.update({ ...resource, type: Addresses.TYPE }, params, options);
8
- }
9
- async delete(id, options) {
10
- await this.resources.delete((typeof id === 'string') ? { id, type: Addresses.TYPE } : id, options);
11
- }
12
- async geocoder(addressId, params, options) {
13
- const _addressId = addressId.id || addressId;
14
- return this.resources.fetch({ type: 'geocoders' }, `addresses/${_addressId}/geocoder`, params, options);
15
- }
16
- async events(addressId, params, options) {
17
- const _addressId = addressId.id || addressId;
18
- return this.resources.fetch({ type: 'events' }, `addresses/${_addressId}/events`, params, options);
19
- }
20
- async tags(addressId, params, options) {
21
- const _addressId = addressId.id || addressId;
22
- return this.resources.fetch({ type: 'tags' }, `addresses/${_addressId}/tags`, params, options);
23
- }
24
- async versions(addressId, params, options) {
25
- const _addressId = addressId.id || addressId;
26
- return this.resources.fetch({ type: 'versions' }, `addresses/${_addressId}/versions`, params, options);
27
- }
28
- isAddress(resource) {
29
- return resource.type && (resource.type === Addresses.TYPE);
30
- }
31
- relationship(id) {
32
- return ((id === null) || (typeof id === 'string')) ? { id, type: Addresses.TYPE } : { id: id.id, type: Addresses.TYPE };
33
- }
34
- type() {
35
- return Addresses.TYPE;
36
- }
37
- }
38
- Addresses.TYPE = 'addresses';
39
- export default Addresses;
1
+ import{ApiResource as c}from"../resource";class r extends c{async create(e,t,s){return this.resources.create({...e,type:r.TYPE},t,s)}async update(e,t,s){return this.resources.update({...e,type:r.TYPE},t,s)}async delete(e,t){await this.resources.delete(typeof e=="string"?{id:e,type:r.TYPE}:e,t)}async geocoder(e,t,s){const n=e.id||e;return this.resources.fetch({type:"geocoders"},`addresses/${n}/geocoder`,t,s)}async events(e,t,s){const n=e.id||e;return this.resources.fetch({type:"events"},`addresses/${n}/events`,t,s)}async tags(e,t,s){const n=e.id||e;return this.resources.fetch({type:"tags"},`addresses/${n}/tags`,t,s)}async versions(e,t,s){const n=e.id||e;return this.resources.fetch({type:"versions"},`addresses/${n}/versions`,t,s)}isAddress(e){return e.type&&e.type===r.TYPE}relationship(e){return e===null||typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="addresses";export default r;
@@ -1,42 +1 @@
1
- import { ApiResource } from '../resource';
2
- import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
3
- import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
- import type { Version } from './versions';
5
- type AdjustmentType = 'adjustments';
6
- type AdjustmentRel = ResourceRel & {
7
- type: AdjustmentType;
8
- };
9
- interface Adjustment extends Resource {
10
- readonly type: AdjustmentType;
11
- name: string;
12
- currency_code: string;
13
- amount_cents: number;
14
- amount_float: number;
15
- formatted_amount: string;
16
- distribute_discount?: boolean | null;
17
- versions?: Version[] | null;
18
- }
19
- interface AdjustmentCreate extends ResourceCreate {
20
- name: string;
21
- currency_code: string;
22
- amount_cents: number;
23
- distribute_discount?: boolean | null;
24
- }
25
- interface AdjustmentUpdate extends ResourceUpdate {
26
- name?: string | null;
27
- currency_code?: string | null;
28
- amount_cents?: number | null;
29
- distribute_discount?: boolean | null;
30
- }
31
- declare class Adjustments extends ApiResource<Adjustment> {
32
- static readonly TYPE: AdjustmentType;
33
- create(resource: AdjustmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
34
- update(resource: AdjustmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
35
- delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
36
- versions(adjustmentId: string | Adjustment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
37
- isAdjustment(resource: any): resource is Adjustment;
38
- relationship(id: string | ResourceId | null): AdjustmentRel;
39
- type(): AdjustmentType;
40
- }
41
- export default Adjustments;
42
- export type { Adjustment, AdjustmentCreate, AdjustmentUpdate, AdjustmentType };
1
+ import{ApiResource}from'../resource';import type{Resource,ResourceCreate,ResourceUpdate,ResourceId,ResourcesConfig,ResourceRel,ListResponse}from'../resource';import type{QueryParamsRetrieve,QueryParamsList}from'../query';import type{Version}from'./versions';type AdjustmentType='adjustments';type AdjustmentRel=ResourceRel&{type:AdjustmentType;};interface Adjustment extends Resource{readonly type:AdjustmentType;name:string;currency_code:string;amount_cents:number;amount_float:number;formatted_amount:string;distribute_discount?:boolean|null;versions?:Version[]|null;}interface AdjustmentCreate extends ResourceCreate{name:string;currency_code:string;amount_cents:number;distribute_discount?:boolean|null;}interface AdjustmentUpdate extends ResourceUpdate{name?:string|null;currency_code?:string|null;amount_cents?:number|null;distribute_discount?:boolean|null;}declare class Adjustments extends ApiResource<Adjustment>{static readonly TYPE:AdjustmentType;create(resource:AdjustmentCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Adjustment>;update(resource:AdjustmentUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Adjustment>;delete(id:string|ResourceId,options?:ResourcesConfig):Promise<void>;versions(adjustmentId:string|Adjustment,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Version>>;isAdjustment(resource:any):resource is Adjustment;relationship(id:string|ResourceId|null):AdjustmentRel;type():AdjustmentType;}export default Adjustments;export type{Adjustment,AdjustmentCreate,AdjustmentUpdate,AdjustmentType};
@@ -1,27 +1 @@
1
- import { ApiResource } from '../resource';
2
- class Adjustments extends ApiResource {
3
- async create(resource, params, options) {
4
- return this.resources.create({ ...resource, type: Adjustments.TYPE }, params, options);
5
- }
6
- async update(resource, params, options) {
7
- return this.resources.update({ ...resource, type: Adjustments.TYPE }, params, options);
8
- }
9
- async delete(id, options) {
10
- await this.resources.delete((typeof id === 'string') ? { id, type: Adjustments.TYPE } : id, options);
11
- }
12
- async versions(adjustmentId, params, options) {
13
- const _adjustmentId = adjustmentId.id || adjustmentId;
14
- return this.resources.fetch({ type: 'versions' }, `adjustments/${_adjustmentId}/versions`, params, options);
15
- }
16
- isAdjustment(resource) {
17
- return resource.type && (resource.type === Adjustments.TYPE);
18
- }
19
- relationship(id) {
20
- return ((id === null) || (typeof id === 'string')) ? { id, type: Adjustments.TYPE } : { id: id.id, type: Adjustments.TYPE };
21
- }
22
- type() {
23
- return Adjustments.TYPE;
24
- }
25
- }
26
- Adjustments.TYPE = 'adjustments';
27
- export default Adjustments;
1
+ import{ApiResource as n}from"../resource";class t extends n{async create(e,r,s){return this.resources.create({...e,type:t.TYPE},r,s)}async update(e,r,s){return this.resources.update({...e,type:t.TYPE},r,s)}async delete(e,r){await this.resources.delete(typeof e=="string"?{id:e,type:t.TYPE}:e,r)}async versions(e,r,s){const p=e.id||e;return this.resources.fetch({type:"versions"},`adjustments/${p}/versions`,r,s)}isAdjustment(e){return e.type&&e.type===t.TYPE}relationship(e){return e===null||typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="adjustments";export default t;
@@ -1,60 +1 @@
1
- import { ApiResource } from '../resource';
2
- import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
3
- import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
- import type { PaymentMethod } from './payment_methods';
5
- import type { Version } from './versions';
6
- import type { AdyenPayment, AdyenPaymentType } from './adyen_payments';
7
- type AdyenGatewayType = 'adyen_gateways';
8
- type AdyenGatewayRel = ResourceRel & {
9
- type: AdyenGatewayType;
10
- };
11
- type AdyenPaymentRel = ResourceRel & {
12
- type: AdyenPaymentType;
13
- };
14
- interface AdyenGateway extends Resource {
15
- readonly type: AdyenGatewayType;
16
- name: string;
17
- live_url_prefix: string;
18
- async_api?: boolean | null;
19
- webhook_endpoint_secret?: string | null;
20
- webhook_endpoint_url?: string | null;
21
- payment_methods?: PaymentMethod[] | null;
22
- versions?: Version[] | null;
23
- adyen_payments?: AdyenPayment[] | null;
24
- }
25
- interface AdyenGatewayCreate extends ResourceCreate {
26
- name: string;
27
- merchant_account: string;
28
- api_key: string;
29
- public_key?: string | null;
30
- live_url_prefix: string;
31
- api_version?: number | null;
32
- async_api?: boolean | null;
33
- webhook_endpoint_secret?: string | null;
34
- adyen_payments?: AdyenPaymentRel[] | null;
35
- }
36
- interface AdyenGatewayUpdate extends ResourceUpdate {
37
- name?: string | null;
38
- merchant_account?: string | null;
39
- api_key?: string | null;
40
- public_key?: string | null;
41
- live_url_prefix?: string | null;
42
- api_version?: number | null;
43
- async_api?: boolean | null;
44
- webhook_endpoint_secret?: string | null;
45
- adyen_payments?: AdyenPaymentRel[] | null;
46
- }
47
- declare class AdyenGateways extends ApiResource<AdyenGateway> {
48
- static readonly TYPE: AdyenGatewayType;
49
- create(resource: AdyenGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenGateway>;
50
- update(resource: AdyenGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenGateway>;
51
- delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
52
- payment_methods(adyenGatewayId: string | AdyenGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PaymentMethod>>;
53
- versions(adyenGatewayId: string | AdyenGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
54
- adyen_payments(adyenGatewayId: string | AdyenGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<AdyenPayment>>;
55
- isAdyenGateway(resource: any): resource is AdyenGateway;
56
- relationship(id: string | ResourceId | null): AdyenGatewayRel;
57
- type(): AdyenGatewayType;
58
- }
59
- export default AdyenGateways;
60
- export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate, AdyenGatewayType };
1
+ import{ApiResource}from'../resource';import type{Resource,ResourceCreate,ResourceUpdate,ResourceId,ResourcesConfig,ResourceRel,ListResponse}from'../resource';import type{QueryParamsRetrieve,QueryParamsList}from'../query';import type{PaymentMethod}from'./payment_methods';import type{Version}from'./versions';import type{AdyenPayment,AdyenPaymentType}from'./adyen_payments';type AdyenGatewayType='adyen_gateways';type AdyenGatewayRel=ResourceRel&{type:AdyenGatewayType;};type AdyenPaymentRel=ResourceRel&{type:AdyenPaymentType;};interface AdyenGateway extends Resource{readonly type:AdyenGatewayType;name:string;live_url_prefix:string;async_api?:boolean|null;webhook_endpoint_secret?:string|null;webhook_endpoint_url?:string|null;payment_methods?:PaymentMethod[]|null;versions?:Version[]|null;adyen_payments?:AdyenPayment[]|null;}interface AdyenGatewayCreate extends ResourceCreate{name:string;merchant_account:string;api_key:string;public_key?:string|null;live_url_prefix:string;api_version?:number|null;async_api?:boolean|null;webhook_endpoint_secret?:string|null;adyen_payments?:AdyenPaymentRel[]|null;}interface AdyenGatewayUpdate extends ResourceUpdate{name?:string|null;merchant_account?:string|null;api_key?:string|null;public_key?:string|null;live_url_prefix?:string|null;api_version?:number|null;async_api?:boolean|null;webhook_endpoint_secret?:string|null;adyen_payments?:AdyenPaymentRel[]|null;}declare class AdyenGateways extends ApiResource<AdyenGateway>{static readonly TYPE:AdyenGatewayType;create(resource:AdyenGatewayCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenGateway>;update(resource:AdyenGatewayUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenGateway>;delete(id:string|ResourceId,options?:ResourcesConfig):Promise<void>;payment_methods(adyenGatewayId:string|AdyenGateway,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<PaymentMethod>>;versions(adyenGatewayId:string|AdyenGateway,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Version>>;adyen_payments(adyenGatewayId:string|AdyenGateway,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<AdyenPayment>>;isAdyenGateway(resource:any):resource is AdyenGateway;relationship(id:string|ResourceId|null):AdyenGatewayRel;type():AdyenGatewayType;}export default AdyenGateways;export type{AdyenGateway,AdyenGatewayCreate,AdyenGatewayUpdate,AdyenGatewayType};
@@ -1,35 +1 @@
1
- import { ApiResource } from '../resource';
2
- class AdyenGateways extends ApiResource {
3
- async create(resource, params, options) {
4
- return this.resources.create({ ...resource, type: AdyenGateways.TYPE }, params, options);
5
- }
6
- async update(resource, params, options) {
7
- return this.resources.update({ ...resource, type: AdyenGateways.TYPE }, params, options);
8
- }
9
- async delete(id, options) {
10
- await this.resources.delete((typeof id === 'string') ? { id, type: AdyenGateways.TYPE } : id, options);
11
- }
12
- async payment_methods(adyenGatewayId, params, options) {
13
- const _adyenGatewayId = adyenGatewayId.id || adyenGatewayId;
14
- return this.resources.fetch({ type: 'payment_methods' }, `adyen_gateways/${_adyenGatewayId}/payment_methods`, params, options);
15
- }
16
- async versions(adyenGatewayId, params, options) {
17
- const _adyenGatewayId = adyenGatewayId.id || adyenGatewayId;
18
- return this.resources.fetch({ type: 'versions' }, `adyen_gateways/${_adyenGatewayId}/versions`, params, options);
19
- }
20
- async adyen_payments(adyenGatewayId, params, options) {
21
- const _adyenGatewayId = adyenGatewayId.id || adyenGatewayId;
22
- return this.resources.fetch({ type: 'adyen_payments' }, `adyen_gateways/${_adyenGatewayId}/adyen_payments`, params, options);
23
- }
24
- isAdyenGateway(resource) {
25
- return resource.type && (resource.type === AdyenGateways.TYPE);
26
- }
27
- relationship(id) {
28
- return ((id === null) || (typeof id === 'string')) ? { id, type: AdyenGateways.TYPE } : { id: id.id, type: AdyenGateways.TYPE };
29
- }
30
- type() {
31
- return AdyenGateways.TYPE;
32
- }
33
- }
34
- AdyenGateways.TYPE = 'adyen_gateways';
35
- export default AdyenGateways;
1
+ import{ApiResource as a}from"../resource";class s extends a{async create(e,t,r){return this.resources.create({...e,type:s.TYPE},t,r)}async update(e,t,r){return this.resources.update({...e,type:s.TYPE},t,r)}async delete(e,t){await this.resources.delete(typeof e=="string"?{id:e,type:s.TYPE}:e,t)}async payment_methods(e,t,r){const n=e.id||e;return this.resources.fetch({type:"payment_methods"},`adyen_gateways/${n}/payment_methods`,t,r)}async versions(e,t,r){const n=e.id||e;return this.resources.fetch({type:"versions"},`adyen_gateways/${n}/versions`,t,r)}async adyen_payments(e,t,r){const n=e.id||e;return this.resources.fetch({type:"adyen_payments"},`adyen_gateways/${n}/adyen_payments`,t,r)}isAdyenGateway(e){return e.type&&e.type===s.TYPE}relationship(e){return e===null||typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="adyen_gateways";export default s;