@commercelayer/sdk 5.0.0-alpha.3 → 5.0.0-alpha.4

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 (219) hide show
  1. package/README.md +67 -33
  2. package/lib/api.d.ts +1 -103
  3. package/lib/client.d.ts +1 -31
  4. package/lib/client.js +1 -1
  5. package/lib/commercelayer.d.ts +1 -122
  6. package/lib/commercelayer.js +1 -1
  7. package/lib/common.d.ts +1 -4
  8. package/lib/config.d.ts +1 -11
  9. package/lib/debug.d.ts +1 -3
  10. package/lib/debug.js +1 -1
  11. package/lib/error.d.ts +1 -26
  12. package/lib/error.js +1 -1
  13. package/lib/index.d.ts +1 -7
  14. package/lib/interceptor.d.ts +1 -19
  15. package/lib/jsonapi.d.ts +1 -5
  16. package/lib/jsonapi.js +1 -1
  17. package/lib/model.d.ts +1 -101
  18. package/lib/query.d.ts +1 -23
  19. package/lib/query.js +1 -1
  20. package/lib/resource.d.ts +1 -76
  21. package/lib/resource.js +1 -1
  22. package/lib/resources/addresses.d.ts +1 -88
  23. package/lib/resources/addresses.js +1 -1
  24. package/lib/resources/adjustments.d.ts +1 -35
  25. package/lib/resources/adjustments.js +1 -1
  26. package/lib/resources/adyen_gateways.d.ts +1 -47
  27. package/lib/resources/adyen_gateways.js +1 -1
  28. package/lib/resources/adyen_payments.d.ts +1 -44
  29. package/lib/resources/adyen_payments.js +1 -1
  30. package/lib/resources/application.d.ts +1 -21
  31. package/lib/resources/application.js +1 -1
  32. package/lib/resources/attachments.d.ts +1 -156
  33. package/lib/resources/attachments.js +1 -1
  34. package/lib/resources/authorizations.d.ts +1 -57
  35. package/lib/resources/authorizations.js +1 -1
  36. package/lib/resources/avalara_accounts.d.ts +1 -52
  37. package/lib/resources/avalara_accounts.js +1 -1
  38. package/lib/resources/billing_info_validation_rules.d.ts +1 -32
  39. package/lib/resources/billing_info_validation_rules.js +1 -1
  40. package/lib/resources/bing_geocoders.d.ts +1 -35
  41. package/lib/resources/bing_geocoders.js +1 -1
  42. package/lib/resources/braintree_gateways.d.ts +1 -56
  43. package/lib/resources/braintree_gateways.js +1 -1
  44. package/lib/resources/braintree_payments.d.ts +1 -47
  45. package/lib/resources/braintree_payments.js +1 -1
  46. package/lib/resources/bundles.d.ts +1 -74
  47. package/lib/resources/bundles.js +1 -1
  48. package/lib/resources/captures.d.ts +1 -48
  49. package/lib/resources/captures.js +1 -1
  50. package/lib/resources/carrier_accounts.d.ts +1 -26
  51. package/lib/resources/carrier_accounts.js +1 -1
  52. package/lib/resources/checkout_com_gateways.d.ts +1 -45
  53. package/lib/resources/checkout_com_gateways.js +1 -1
  54. package/lib/resources/checkout_com_payments.d.ts +1 -50
  55. package/lib/resources/checkout_com_payments.js +1 -1
  56. package/lib/resources/coupon_codes_promotion_rules.d.ts +1 -59
  57. package/lib/resources/coupon_codes_promotion_rules.js +1 -1
  58. package/lib/resources/coupon_recipients.d.ts +1 -44
  59. package/lib/resources/coupon_recipients.js +1 -1
  60. package/lib/resources/coupons.d.ts +1 -45
  61. package/lib/resources/coupons.js +1 -1
  62. package/lib/resources/customer_addresses.d.ts +1 -41
  63. package/lib/resources/customer_addresses.js +1 -1
  64. package/lib/resources/customer_groups.d.ts +1 -36
  65. package/lib/resources/customer_groups.js +1 -1
  66. package/lib/resources/customer_password_resets.d.ts +1 -33
  67. package/lib/resources/customer_password_resets.js +1 -1
  68. package/lib/resources/customer_payment_sources.d.ts +1 -70
  69. package/lib/resources/customer_payment_sources.js +1 -1
  70. package/lib/resources/customer_subscriptions.d.ts +1 -28
  71. package/lib/resources/customer_subscriptions.js +1 -1
  72. package/lib/resources/customers.d.ts +1 -60
  73. package/lib/resources/customers.js +1 -1
  74. package/lib/resources/delivery_lead_times.d.ts +1 -51
  75. package/lib/resources/delivery_lead_times.js +1 -1
  76. package/lib/resources/event_callbacks.d.ts +1 -24
  77. package/lib/resources/event_callbacks.js +1 -1
  78. package/lib/resources/external_gateways.d.ts +1 -49
  79. package/lib/resources/external_gateways.js +1 -1
  80. package/lib/resources/external_payments.d.ts +1 -43
  81. package/lib/resources/external_payments.js +1 -1
  82. package/lib/resources/external_promotions.d.ts +1 -86
  83. package/lib/resources/external_promotions.js +1 -1
  84. package/lib/resources/external_tax_calculators.d.ts +1 -44
  85. package/lib/resources/external_tax_calculators.js +1 -1
  86. package/lib/resources/fixed_amount_promotions.d.ts +1 -88
  87. package/lib/resources/fixed_amount_promotions.js +1 -1
  88. package/lib/resources/fixed_price_promotions.d.ts +1 -99
  89. package/lib/resources/fixed_price_promotions.js +1 -1
  90. package/lib/resources/free_gift_promotions.d.ts +1 -97
  91. package/lib/resources/free_gift_promotions.js +1 -1
  92. package/lib/resources/free_shipping_promotions.d.ts +1 -83
  93. package/lib/resources/free_shipping_promotions.js +1 -1
  94. package/lib/resources/geocoders.d.ts +1 -24
  95. package/lib/resources/geocoders.js +1 -1
  96. package/lib/resources/gift_card_recipients.d.ts +1 -44
  97. package/lib/resources/gift_card_recipients.js +1 -1
  98. package/lib/resources/gift_cards.d.ts +1 -82
  99. package/lib/resources/gift_cards.js +1 -1
  100. package/lib/resources/google_geocoders.d.ts +1 -35
  101. package/lib/resources/google_geocoders.js +1 -1
  102. package/lib/resources/imports.d.ts +1 -40
  103. package/lib/resources/imports.js +1 -1
  104. package/lib/resources/in_stock_subscriptions.d.ts +1 -59
  105. package/lib/resources/in_stock_subscriptions.js +1 -1
  106. package/lib/resources/inventory_models.d.ts +1 -42
  107. package/lib/resources/inventory_models.js +1 -1
  108. package/lib/resources/inventory_return_locations.d.ts +1 -43
  109. package/lib/resources/inventory_return_locations.js +1 -1
  110. package/lib/resources/inventory_stock_locations.d.ts +1 -46
  111. package/lib/resources/inventory_stock_locations.js +1 -1
  112. package/lib/resources/klarna_gateways.d.ts +1 -44
  113. package/lib/resources/klarna_gateways.js +1 -1
  114. package/lib/resources/klarna_payments.d.ts +1 -41
  115. package/lib/resources/klarna_payments.js +1 -1
  116. package/lib/resources/line_item_options.d.ts +1 -57
  117. package/lib/resources/line_item_options.js +1 -1
  118. package/lib/resources/line_items.d.ts +1 -125
  119. package/lib/resources/line_items.js +1 -1
  120. package/lib/resources/manual_gateways.d.ts +1 -33
  121. package/lib/resources/manual_gateways.js +1 -1
  122. package/lib/resources/manual_tax_calculators.d.ts +1 -49
  123. package/lib/resources/manual_tax_calculators.js +1 -1
  124. package/lib/resources/markets.d.ts +1 -81
  125. package/lib/resources/markets.js +1 -1
  126. package/lib/resources/merchants.d.ts +1 -38
  127. package/lib/resources/merchants.js +1 -1
  128. package/lib/resources/order_amount_promotion_rules.d.ts +1 -56
  129. package/lib/resources/order_amount_promotion_rules.js +1 -1
  130. package/lib/resources/order_copies.d.ts +1 -45
  131. package/lib/resources/order_copies.js +1 -1
  132. package/lib/resources/order_subscriptions.d.ts +1 -67
  133. package/lib/resources/order_subscriptions.js +1 -1
  134. package/lib/resources/order_validation_rules.d.ts +1 -20
  135. package/lib/resources/order_validation_rules.js +1 -1
  136. package/lib/resources/orders.d.ts +1 -271
  137. package/lib/resources/orders.js +1 -1
  138. package/lib/resources/organization.d.ts +1 -32
  139. package/lib/resources/organization.js +1 -1
  140. package/lib/resources/packages.d.ts +1 -56
  141. package/lib/resources/packages.js +1 -1
  142. package/lib/resources/parcel_line_items.d.ts +1 -49
  143. package/lib/resources/parcel_line_items.js +1 -1
  144. package/lib/resources/parcels.d.ts +1 -108
  145. package/lib/resources/parcels.js +1 -1
  146. package/lib/resources/payment_gateways.d.ts +1 -21
  147. package/lib/resources/payment_gateways.js +1 -1
  148. package/lib/resources/payment_methods.d.ts +1 -59
  149. package/lib/resources/payment_methods.js +1 -1
  150. package/lib/resources/paypal_gateways.d.ts +1 -39
  151. package/lib/resources/paypal_gateways.js +1 -1
  152. package/lib/resources/paypal_payments.d.ts +1 -47
  153. package/lib/resources/paypal_payments.js +1 -1
  154. package/lib/resources/percentage_discount_promotions.d.ts +1 -97
  155. package/lib/resources/percentage_discount_promotions.js +1 -1
  156. package/lib/resources/price_lists.d.ts +1 -39
  157. package/lib/resources/price_lists.js +1 -1
  158. package/lib/resources/prices.d.ts +1 -57
  159. package/lib/resources/prices.js +1 -1
  160. package/lib/resources/promotion_rules.d.ts +1 -24
  161. package/lib/resources/promotion_rules.js +1 -1
  162. package/lib/resources/promotions.d.ts +1 -41
  163. package/lib/resources/promotions.js +1 -1
  164. package/lib/resources/refunds.d.ts +1 -34
  165. package/lib/resources/refunds.js +1 -1
  166. package/lib/resources/return_line_items.d.ts +1 -49
  167. package/lib/resources/return_line_items.js +1 -1
  168. package/lib/resources/returns.d.ts +1 -72
  169. package/lib/resources/returns.js +1 -1
  170. package/lib/resources/shipments.d.ts +1 -89
  171. package/lib/resources/shipments.js +1 -1
  172. package/lib/resources/shipping_categories.d.ts +1 -33
  173. package/lib/resources/shipping_categories.js +1 -1
  174. package/lib/resources/shipping_methods.d.ts +1 -74
  175. package/lib/resources/shipping_methods.js +1 -1
  176. package/lib/resources/shipping_zones.d.ts +1 -48
  177. package/lib/resources/shipping_zones.js +1 -1
  178. package/lib/resources/sku_list_items.d.ts +1 -47
  179. package/lib/resources/sku_list_items.js +1 -1
  180. package/lib/resources/sku_list_promotion_rules.d.ts +1 -68
  181. package/lib/resources/sku_list_promotion_rules.js +1 -1
  182. package/lib/resources/sku_lists.d.ts +1 -49
  183. package/lib/resources/sku_lists.js +1 -1
  184. package/lib/resources/sku_options.d.ts +1 -56
  185. package/lib/resources/sku_options.js +1 -1
  186. package/lib/resources/skus.d.ts +1 -78
  187. package/lib/resources/skus.js +1 -1
  188. package/lib/resources/stock_items.d.ts +1 -49
  189. package/lib/resources/stock_items.js +1 -1
  190. package/lib/resources/stock_line_items.d.ts +1 -29
  191. package/lib/resources/stock_line_items.js +1 -1
  192. package/lib/resources/stock_locations.d.ts +1 -57
  193. package/lib/resources/stock_locations.js +1 -1
  194. package/lib/resources/stock_transfers.d.ts +1 -71
  195. package/lib/resources/stock_transfers.js +1 -1
  196. package/lib/resources/stripe_gateways.d.ts +1 -38
  197. package/lib/resources/stripe_gateways.js +1 -1
  198. package/lib/resources/stripe_payments.d.ts +1 -42
  199. package/lib/resources/stripe_payments.js +1 -1
  200. package/lib/resources/tax_calculators.d.ts +1 -27
  201. package/lib/resources/tax_calculators.js +1 -1
  202. package/lib/resources/tax_categories.d.ts +1 -59
  203. package/lib/resources/tax_categories.js +1 -1
  204. package/lib/resources/tax_rules.d.ts +1 -69
  205. package/lib/resources/tax_rules.js +1 -1
  206. package/lib/resources/taxjar_accounts.d.ts +1 -43
  207. package/lib/resources/taxjar_accounts.js +1 -1
  208. package/lib/resources/transactions.d.ts +1 -31
  209. package/lib/resources/transactions.js +1 -1
  210. package/lib/resources/voids.d.ts +1 -34
  211. package/lib/resources/voids.js +1 -1
  212. package/lib/resources/webhooks.d.ts +1 -42
  213. package/lib/resources/webhooks.js +1 -1
  214. package/lib/resources/wire_transfers.d.ts +1 -32
  215. package/lib/resources/wire_transfers.js +1 -1
  216. package/lib/static.d.ts +1 -6
  217. package/lib/static.js +1 -1
  218. package/lib/util.d.ts +1 -2
  219. package/package.json +17 -21
@@ -1 +1 @@
1
- var c=this&&this.__classPrivateFieldSet||function(o,i,n,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?o!==i||!a:!i.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(o,n):a?a.value=n:i.set(o,n),n},s=this&&this.__classPrivateFieldGet||function(o,i,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?o!==i||!r:!i.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(o):r?r.value:i.get(o)},t,h;import*as e from"./api";import{CommerceLayerStatic as f}from"./static";import p from"./resource";import u from"./debug";const w=u(),m="2.8.1";class l{constructor(i){t.set(this,void 0),h.set(this,void 0),w("new commercelayer instance %O",i),c(this,t,new p(i),"f"),c(this,h,i.organization,"f"),this.addresses=new e.Addresses(s(this,t,"f")),this.adjustments=new e.Adjustments(s(this,t,"f")),this.adyen_gateways=new e.AdyenGateways(s(this,t,"f")),this.adyen_payments=new e.AdyenPayments(s(this,t,"f")),this.application=new e.Applications(s(this,t,"f")),this.attachments=new e.Attachments(s(this,t,"f")),this.authorizations=new e.Authorizations(s(this,t,"f")),this.avalara_accounts=new e.AvalaraAccounts(s(this,t,"f")),this.billing_info_validation_rules=new e.BillingInfoValidationRules(s(this,t,"f")),this.bing_geocoders=new e.BingGeocoders(s(this,t,"f")),this.braintree_gateways=new e.BraintreeGateways(s(this,t,"f")),this.braintree_payments=new e.BraintreePayments(s(this,t,"f")),this.bundles=new e.Bundles(s(this,t,"f")),this.captures=new e.Captures(s(this,t,"f")),this.carrier_accounts=new e.CarrierAccounts(s(this,t,"f")),this.checkout_com_gateways=new e.CheckoutComGateways(s(this,t,"f")),this.checkout_com_payments=new e.CheckoutComPayments(s(this,t,"f")),this.coupon_codes_promotion_rules=new e.CouponCodesPromotionRules(s(this,t,"f")),this.coupon_recipients=new e.CouponRecipients(s(this,t,"f")),this.coupons=new e.Coupons(s(this,t,"f")),this.customer_addresses=new e.CustomerAddresses(s(this,t,"f")),this.customer_groups=new e.CustomerGroups(s(this,t,"f")),this.customer_password_resets=new e.CustomerPasswordResets(s(this,t,"f")),this.customer_payment_sources=new e.CustomerPaymentSources(s(this,t,"f")),this.customer_subscriptions=new e.CustomerSubscriptions(s(this,t,"f")),this.customers=new e.Customers(s(this,t,"f")),this.delivery_lead_times=new e.DeliveryLeadTimes(s(this,t,"f")),this.event_callbacks=new e.EventCallbacks(s(this,t,"f")),this.external_gateways=new e.ExternalGateways(s(this,t,"f")),this.external_payments=new e.ExternalPayments(s(this,t,"f")),this.external_promotions=new e.ExternalPromotions(s(this,t,"f")),this.external_tax_calculators=new e.ExternalTaxCalculators(s(this,t,"f")),this.fixed_amount_promotions=new e.FixedAmountPromotions(s(this,t,"f")),this.fixed_price_promotions=new e.FixedPricePromotions(s(this,t,"f")),this.free_gift_promotions=new e.FreeGiftPromotions(s(this,t,"f")),this.free_shipping_promotions=new e.FreeShippingPromotions(s(this,t,"f")),this.geocoders=new e.Geocoders(s(this,t,"f")),this.gift_card_recipients=new e.GiftCardRecipients(s(this,t,"f")),this.gift_cards=new e.GiftCards(s(this,t,"f")),this.google_geocoders=new e.GoogleGeocoders(s(this,t,"f")),this.imports=new e.Imports(s(this,t,"f")),this.in_stock_subscriptions=new e.InStockSubscriptions(s(this,t,"f")),this.inventory_models=new e.InventoryModels(s(this,t,"f")),this.inventory_return_locations=new e.InventoryReturnLocations(s(this,t,"f")),this.inventory_stock_locations=new e.InventoryStockLocations(s(this,t,"f")),this.klarna_gateways=new e.KlarnaGateways(s(this,t,"f")),this.klarna_payments=new e.KlarnaPayments(s(this,t,"f")),this.line_item_options=new e.LineItemOptions(s(this,t,"f")),this.line_items=new e.LineItems(s(this,t,"f")),this.manual_gateways=new e.ManualGateways(s(this,t,"f")),this.manual_tax_calculators=new e.ManualTaxCalculators(s(this,t,"f")),this.markets=new e.Markets(s(this,t,"f")),this.merchants=new e.Merchants(s(this,t,"f")),this.order_amount_promotion_rules=new e.OrderAmountPromotionRules(s(this,t,"f")),this.order_copies=new e.OrderCopies(s(this,t,"f")),this.order_subscriptions=new e.OrderSubscriptions(s(this,t,"f")),this.order_validation_rules=new e.OrderValidationRules(s(this,t,"f")),this.orders=new e.Orders(s(this,t,"f")),this.organization=new e.Organizations(s(this,t,"f")),this.packages=new e.Packages(s(this,t,"f")),this.parcel_line_items=new e.ParcelLineItems(s(this,t,"f")),this.parcels=new e.Parcels(s(this,t,"f")),this.payment_gateways=new e.PaymentGateways(s(this,t,"f")),this.payment_methods=new e.PaymentMethods(s(this,t,"f")),this.paypal_gateways=new e.PaypalGateways(s(this,t,"f")),this.paypal_payments=new e.PaypalPayments(s(this,t,"f")),this.percentage_discount_promotions=new e.PercentageDiscountPromotions(s(this,t,"f")),this.price_lists=new e.PriceLists(s(this,t,"f")),this.prices=new e.Prices(s(this,t,"f")),this.promotion_rules=new e.PromotionRules(s(this,t,"f")),this.promotions=new e.Promotions(s(this,t,"f")),this.refunds=new e.Refunds(s(this,t,"f")),this.return_line_items=new e.ReturnLineItems(s(this,t,"f")),this.returns=new e.Returns(s(this,t,"f")),this.shipments=new e.Shipments(s(this,t,"f")),this.shipping_categories=new e.ShippingCategories(s(this,t,"f")),this.shipping_methods=new e.ShippingMethods(s(this,t,"f")),this.shipping_zones=new e.ShippingZones(s(this,t,"f")),this.sku_list_items=new e.SkuListItems(s(this,t,"f")),this.sku_list_promotion_rules=new e.SkuListPromotionRules(s(this,t,"f")),this.sku_lists=new e.SkuLists(s(this,t,"f")),this.sku_options=new e.SkuOptions(s(this,t,"f")),this.skus=new e.Skus(s(this,t,"f")),this.stock_items=new e.StockItems(s(this,t,"f")),this.stock_line_items=new e.StockLineItems(s(this,t,"f")),this.stock_locations=new e.StockLocations(s(this,t,"f")),this.stock_transfers=new e.StockTransfers(s(this,t,"f")),this.stripe_gateways=new e.StripeGateways(s(this,t,"f")),this.stripe_payments=new e.StripePayments(s(this,t,"f")),this.tax_calculators=new e.TaxCalculators(s(this,t,"f")),this.tax_categories=new e.TaxCategories(s(this,t,"f")),this.tax_rules=new e.TaxRules(s(this,t,"f")),this.taxjar_accounts=new e.TaxjarAccounts(s(this,t,"f")),this.transactions=new e.Transactions(s(this,t,"f")),this.voids=new e.Voids(s(this,t,"f")),this.webhooks=new e.Webhooks(s(this,t,"f")),this.wire_transfers=new e.WireTransfers(s(this,t,"f"))}static get openApiSchemaVersion(){return m}get currentOrganization(){return s(this,h,"f")}localConfig(i){i.organization&&c(this,h,i.organization,"f")}config(i){w("config %o",i),this.localConfig(i),s(this,t,"f").config(i)}resources(){return f.resources()}isApiError(i){return f.isApiError(i)}addRequestInterceptor(i,n){return s(this,t,"f").interceptors.request.use(i,n)}addResponseInterceptor(i,n){return s(this,t,"f").interceptors.response.use(i,n)}removeInterceptor(i,n){return s(this,t,"f").interceptors[i].eject(n)}addRawResponseReader(){const i={id:void 0,rawResponse:void 0};function n(a){return i.rawResponse=a?.data,a}const r=this.addResponseInterceptor(n);return i.id=r,i}removeRawResponseReader(i){const n=typeof i=="number"?i:i.id;if(n)return this.removeInterceptor("response",n)}}t=new WeakMap,h=new WeakMap;const _=o=>new l(o);export default _;
1
+ import*as s from"./api";import{CommerceLayerStatic as o}from"./static";import h from"./resource";import c from"./debug";const r=c("commercelayer"),_="2.9.1";class p{static get openApiSchemaVersion(){return _}#s;#t;addresses;adjustments;adyen_gateways;adyen_payments;application;attachments;authorizations;avalara_accounts;billing_info_validation_rules;bing_geocoders;braintree_gateways;braintree_payments;bundles;captures;carrier_accounts;checkout_com_gateways;checkout_com_payments;coupon_codes_promotion_rules;coupon_recipients;coupons;customer_addresses;customer_groups;customer_password_resets;customer_payment_sources;customer_subscriptions;customers;delivery_lead_times;event_callbacks;external_gateways;external_payments;external_promotions;external_tax_calculators;fixed_amount_promotions;fixed_price_promotions;free_gift_promotions;free_shipping_promotions;geocoders;gift_card_recipients;gift_cards;google_geocoders;imports;in_stock_subscriptions;inventory_models;inventory_return_locations;inventory_stock_locations;klarna_gateways;klarna_payments;line_item_options;line_items;manual_gateways;manual_tax_calculators;markets;merchants;order_amount_promotion_rules;order_copies;order_subscriptions;order_validation_rules;orders;organization;packages;parcel_line_items;parcels;payment_gateways;payment_methods;paypal_gateways;paypal_payments;percentage_discount_promotions;price_lists;prices;promotion_rules;promotions;refunds;return_line_items;returns;shipments;shipping_categories;shipping_methods;shipping_zones;sku_list_items;sku_list_promotion_rules;sku_lists;sku_options;skus;stock_items;stock_line_items;stock_locations;stock_transfers;stripe_gateways;stripe_payments;tax_calculators;tax_categories;tax_rules;taxjar_accounts;transactions;voids;webhooks;wire_transfers;constructor(t){r("new commercelayer instance %O",t),this.#s=new h(t),this.#t=t.organization,this.addresses=new s.Addresses(this.#s),this.adjustments=new s.Adjustments(this.#s),this.adyen_gateways=new s.AdyenGateways(this.#s),this.adyen_payments=new s.AdyenPayments(this.#s),this.application=new s.Applications(this.#s),this.attachments=new s.Attachments(this.#s),this.authorizations=new s.Authorizations(this.#s),this.avalara_accounts=new s.AvalaraAccounts(this.#s),this.billing_info_validation_rules=new s.BillingInfoValidationRules(this.#s),this.bing_geocoders=new s.BingGeocoders(this.#s),this.braintree_gateways=new s.BraintreeGateways(this.#s),this.braintree_payments=new s.BraintreePayments(this.#s),this.bundles=new s.Bundles(this.#s),this.captures=new s.Captures(this.#s),this.carrier_accounts=new s.CarrierAccounts(this.#s),this.checkout_com_gateways=new s.CheckoutComGateways(this.#s),this.checkout_com_payments=new s.CheckoutComPayments(this.#s),this.coupon_codes_promotion_rules=new s.CouponCodesPromotionRules(this.#s),this.coupon_recipients=new s.CouponRecipients(this.#s),this.coupons=new s.Coupons(this.#s),this.customer_addresses=new s.CustomerAddresses(this.#s),this.customer_groups=new s.CustomerGroups(this.#s),this.customer_password_resets=new s.CustomerPasswordResets(this.#s),this.customer_payment_sources=new s.CustomerPaymentSources(this.#s),this.customer_subscriptions=new s.CustomerSubscriptions(this.#s),this.customers=new s.Customers(this.#s),this.delivery_lead_times=new s.DeliveryLeadTimes(this.#s),this.event_callbacks=new s.EventCallbacks(this.#s),this.external_gateways=new s.ExternalGateways(this.#s),this.external_payments=new s.ExternalPayments(this.#s),this.external_promotions=new s.ExternalPromotions(this.#s),this.external_tax_calculators=new s.ExternalTaxCalculators(this.#s),this.fixed_amount_promotions=new s.FixedAmountPromotions(this.#s),this.fixed_price_promotions=new s.FixedPricePromotions(this.#s),this.free_gift_promotions=new s.FreeGiftPromotions(this.#s),this.free_shipping_promotions=new s.FreeShippingPromotions(this.#s),this.geocoders=new s.Geocoders(this.#s),this.gift_card_recipients=new s.GiftCardRecipients(this.#s),this.gift_cards=new s.GiftCards(this.#s),this.google_geocoders=new s.GoogleGeocoders(this.#s),this.imports=new s.Imports(this.#s),this.in_stock_subscriptions=new s.InStockSubscriptions(this.#s),this.inventory_models=new s.InventoryModels(this.#s),this.inventory_return_locations=new s.InventoryReturnLocations(this.#s),this.inventory_stock_locations=new s.InventoryStockLocations(this.#s),this.klarna_gateways=new s.KlarnaGateways(this.#s),this.klarna_payments=new s.KlarnaPayments(this.#s),this.line_item_options=new s.LineItemOptions(this.#s),this.line_items=new s.LineItems(this.#s),this.manual_gateways=new s.ManualGateways(this.#s),this.manual_tax_calculators=new s.ManualTaxCalculators(this.#s),this.markets=new s.Markets(this.#s),this.merchants=new s.Merchants(this.#s),this.order_amount_promotion_rules=new s.OrderAmountPromotionRules(this.#s),this.order_copies=new s.OrderCopies(this.#s),this.order_subscriptions=new s.OrderSubscriptions(this.#s),this.order_validation_rules=new s.OrderValidationRules(this.#s),this.orders=new s.Orders(this.#s),this.organization=new s.Organizations(this.#s),this.packages=new s.Packages(this.#s),this.parcel_line_items=new s.ParcelLineItems(this.#s),this.parcels=new s.Parcels(this.#s),this.payment_gateways=new s.PaymentGateways(this.#s),this.payment_methods=new s.PaymentMethods(this.#s),this.paypal_gateways=new s.PaypalGateways(this.#s),this.paypal_payments=new s.PaypalPayments(this.#s),this.percentage_discount_promotions=new s.PercentageDiscountPromotions(this.#s),this.price_lists=new s.PriceLists(this.#s),this.prices=new s.Prices(this.#s),this.promotion_rules=new s.PromotionRules(this.#s),this.promotions=new s.Promotions(this.#s),this.refunds=new s.Refunds(this.#s),this.return_line_items=new s.ReturnLineItems(this.#s),this.returns=new s.Returns(this.#s),this.shipments=new s.Shipments(this.#s),this.shipping_categories=new s.ShippingCategories(this.#s),this.shipping_methods=new s.ShippingMethods(this.#s),this.shipping_zones=new s.ShippingZones(this.#s),this.sku_list_items=new s.SkuListItems(this.#s),this.sku_list_promotion_rules=new s.SkuListPromotionRules(this.#s),this.sku_lists=new s.SkuLists(this.#s),this.sku_options=new s.SkuOptions(this.#s),this.skus=new s.Skus(this.#s),this.stock_items=new s.StockItems(this.#s),this.stock_line_items=new s.StockLineItems(this.#s),this.stock_locations=new s.StockLocations(this.#s),this.stock_transfers=new s.StockTransfers(this.#s),this.stripe_gateways=new s.StripeGateways(this.#s),this.stripe_payments=new s.StripePayments(this.#s),this.tax_calculators=new s.TaxCalculators(this.#s),this.tax_categories=new s.TaxCategories(this.#s),this.tax_rules=new s.TaxRules(this.#s),this.taxjar_accounts=new s.TaxjarAccounts(this.#s),this.transactions=new s.Transactions(this.#s),this.voids=new s.Voids(this.#s),this.webhooks=new s.Webhooks(this.#s),this.wire_transfers=new s.WireTransfers(this.#s)}get currentOrganization(){return this.#t}localConfig(t){t.organization&&(this.#t=t.organization)}config(t){r("config %o",t),this.localConfig(t),this.#s.config(t)}resources(){return o.resources()}isApiError(t){return o.isApiError(t)}addRequestInterceptor(t,e){return this.#s.interceptors.request.use(t,e)}addResponseInterceptor(t,e){return this.#s.interceptors.response.use(t,e)}removeInterceptor(t,e){return this.#s.interceptors[t].eject(e)}addRawResponseReader(){const t={id:void 0,rawResponse:void 0};function e(n){return t.rawResponse=n?.data,n}const a=this.addResponseInterceptor(e);return t.id=a,t}removeRawResponseReader(t){const e=typeof t=="number"?t:t.id;if(e)return this.removeInterceptor("response",e)}}const u=i=>new p(i);export default u;
package/lib/common.d.ts CHANGED
@@ -1,4 +1 @@
1
- import type { ResourceId, ResourceType } from './resource';
2
- declare const isResourceId: (resource: any) => resource is ResourceId;
3
- declare const isResourceType: (resource: any) => resource is ResourceType;
4
- export { isResourceId, isResourceType };
1
+ import type{ResourceId,ResourceType}from'./resource';declare const isResourceId:(resource:any)=>resource is ResourceId;declare const isResourceType:(resource:any)=>resource is ResourceType;export{isResourceId,isResourceType};
package/lib/config.d.ts CHANGED
@@ -1,11 +1 @@
1
- declare const config: {
2
- readonly default: {
3
- readonly domain: "commercelayer.io";
4
- readonly pageNumber: 1;
5
- readonly pageSize: 10;
6
- };
7
- readonly client: {
8
- readonly timeout: 15000;
9
- };
10
- };
11
- export default config;
1
+ declare const config:{readonly default:{readonly domain:"commercelayer.io";readonly pageNumber:1;readonly pageSize:10;};readonly client:{readonly timeout:15000;};};export default config;
package/lib/debug.d.ts CHANGED
@@ -1,3 +1 @@
1
- declare type Debugger = (pattern: string, ...args: any[]) => void;
2
- declare const debug: (namespace?: string | undefined) => Debugger;
3
- export default debug;
1
+ declare type Debugger=(pattern:string,...args:any[])=>void;declare const debug:(namespace:string)=>Debugger;export default debug;
package/lib/debug.js CHANGED
@@ -1 +1 @@
1
- const a=(e,...r)=>{};let t=e=>a;try{const e=require("debug");e&&typeof e=="function"&&(t=e)}catch{}const o="clsdk",n=()=>{const e=new Error;Error.prepareStackTrace=(s,c)=>c;const r=e.stack;return Error.prepareStackTrace=void 0,(r[2].getFileName()||"/").replace(/^.*[\\/]/,"").replace(".ts","")},p=e=>t(`${o}:${e||n()}`);export default p;
1
+ const e=(t,...r)=>{};let c=t=>e;try{const t=require("debug");t&&typeof t=="function"&&(c=t)}catch{}const o="clsdk",n=t=>c(`${o}:${t}`);export default n;
package/lib/error.d.ts CHANGED
@@ -1,26 +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 isSdkError(error: any): error is ApiError;
10
- type: string;
11
- code?: string;
12
- source?: Error;
13
- request?: any;
14
- constructor(error: {
15
- message: string;
16
- type?: ErrorType;
17
- });
18
- }
19
- declare class ApiError extends SdkError {
20
- static isApiError(error: any): error is ApiError;
21
- errors: any[];
22
- status?: number;
23
- constructor(error: SdkError);
24
- first(): any;
25
- }
26
- export { SdkError, ApiError, ErrorType };
1
+ declare enum ErrorType{CLIENT="client",REQUEST="request",RESPONSE="response",GENERIC="generic",CANCEL="cancel"}declare class SdkError extends Error{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 isApiError(error:any):error is ApiError;errors:any[];status?:number;constructor(error:SdkError);first():any;}export{SdkError,ApiError,ErrorType};
package/lib/error.js CHANGED
@@ -1 +1 @@
1
- var t;(function(s){s.CLIENT="client",s.REQUEST="request",s.RESPONSE="response",s.GENERIC="generic",s.CANCEL="cancel"})(t||(t={}));class e extends Error{constructor(r){super(r.message);this.name=this.constructor.name,this.type=r.type||t.GENERIC}static isSdkError(r){return r&&["SdkError","ApiError"].includes(r.name)&&Object.values(t).includes(r.type)}}class n extends e{constructor(r){super({...r,type:t.RESPONSE});this.errors=[],this.name=this.constructor.name}static isApiError(r){return e.isSdkError(r)&&r.name==="ApiError"&&r.type===t.RESPONSE}first(){return this.errors?.length>0?this.errors[0]:void 0}}export{e as SdkError,n as ApiError,t as ErrorType};
1
+ var e;(function(s){s.CLIENT="client",s.REQUEST="request",s.RESPONSE="response",s.GENERIC="generic",s.CANCEL="cancel"})(e||(e={}));class t extends Error{static isSdkError(r){return r&&["SdkError","ApiError"].includes(r.name)&&Object.values(e).includes(r.type)}type;code;source;request;constructor(r){super(r.message);this.name=this.constructor.name,this.type=r.type||e.GENERIC}}class o extends t{static isApiError(r){return t.isSdkError(r)&&r.name==="ApiError"&&r.type===e.RESPONSE}errors=[];status;constructor(r){super({...r,type:e.RESPONSE});this.name=this.constructor.name}first(){return this.errors?.length>0?this.errors[0]:void 0}}export{t as SdkError,o as ApiError,e as ErrorType};
package/lib/index.d.ts CHANGED
@@ -1,7 +1 @@
1
- export { default } 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 } from './interceptor';
7
- export type { SdkError, ApiError, ErrorType } from './error';
1
+ export{default}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}from'./interceptor';export type{SdkError,ApiError,ErrorType}from'./error';
@@ -1,19 +1 @@
1
- import { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from "axios";
2
- declare type InterceptorManager = {
3
- request: AxiosInterceptorManager<AxiosRequestConfig>;
4
- response: AxiosInterceptorManager<any>;
5
- };
6
- declare type RequestObj = AxiosRequestConfig;
7
- declare type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
8
- declare type ResponseObj = AxiosResponse;
9
- declare type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
10
- declare type ErrorObj = AxiosError;
11
- declare type ErrorInterceptor = (error: ErrorObj) => ErrorObj;
12
- declare type InterceptorType = 'request' | 'response';
13
- export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType };
14
- export type { RequestObj, ResponseObj, ErrorObj };
15
- declare type RawResponseReader = {
16
- id: number | undefined;
17
- rawResponse: ResponseObj | undefined;
18
- };
19
- export type { RawResponseReader };
1
+ import{AxiosError,AxiosInterceptorManager,AxiosRequestConfig,AxiosResponse}from"axios";declare type InterceptorManager={request:AxiosInterceptorManager<AxiosRequestConfig>;response:AxiosInterceptorManager<any>;};declare type RequestObj=AxiosRequestConfig;declare type RequestInterceptor=(request:RequestObj)=>RequestObj|Promise<RequestObj>;declare type ResponseObj=AxiosResponse;declare type ResponseInterceptor=(response:ResponseObj)=>ResponseObj;declare type ErrorObj=AxiosError;declare type ErrorInterceptor=(error:ErrorObj)=>ErrorObj;declare type InterceptorType='request'|'response';export type{InterceptorManager,RequestInterceptor,ResponseInterceptor,ErrorInterceptor,InterceptorType};export type{RequestObj,ResponseObj,ErrorObj};declare type RawResponseReader={id:number|undefined;rawResponse:ResponseObj|undefined;};export type{RawResponseReader};
package/lib/jsonapi.d.ts CHANGED
@@ -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};
package/lib/jsonapi.js CHANGED
@@ -1 +1 @@
1
- import{isResourceId as l,isResourceType as c}from"./common";import u from"./debug";const e=u(),p=r=>{let i;r.links&&delete r.links;const t=r.data,a=r.included;return Array.isArray(t)?i=t.map(s=>o(s,a)):i=o(t,a),i},d=(r,i=[])=>i.find(t=>r.id===t.id&&r.type===t.type)||r,o=(r,i)=>{e("denormalize resource: %O, %o",r,i||{});const t={id:r.id,type:r.type,...r.attributes};return r.relationships&&Object.keys(r.relationships).forEach(a=>{const s=r.relationships[a].data;s?Array.isArray(s)?t[a]=s.map(n=>o(d(n,i),i)):t[a]=o(d(s,i),i):s===null&&(t[a]=null)}),e("denormalized resource: %O",t),t},y=r=>{e("normalize resource: %O",r);const i={},t={};for(const s in r){if(["type","id"].includes(s))continue;const n=r[s];n&&c(n)&&n.id===null?t[s]={data:null}:n&&(l(n)||Array.isArray(n)&&l(n[0]))?t[s]={data:n}:i[s]=n}const a={type:r.type,attributes:i,relationships:t};return l(r)&&(a.id=r.id),e("normalized resource: %O",a),a};export{p as denormalize,y as normalize};
1
+ import{isResourceId as l,isResourceType as c}from"./common";import u from"./debug";const o=u("jsonapi"),p=e=>{let s;e.links&&delete e.links;const i=e.data,n=e.included;return i?Array.isArray(i)?s=i.map(t=>r(t,n)):s=r(i,n):s=i,s},d=(e,s=[])=>s.find(i=>e.id===i.id&&e.type===i.type)||e,r=(e,s)=>{if(o("denormalize resource: %O, %o",e,s||{}),!e)return e;const i={id:e.id,type:e.type,...e.attributes};return e.relationships&&Object.keys(e.relationships).forEach(n=>{const t=e.relationships[n].data;t?Array.isArray(t)?i[n]=t.map(a=>r(d(a,s),s)):i[n]=r(d(t,s),s):t===null&&(i[n]=null)}),o("denormalized resource: %O",i),i},y=e=>{o("normalize resource: %O",e);const s={},i={};for(const t in e){if(["type","id"].includes(t))continue;const a=e[t];a&&c(a)&&a.id===null?i[t]={data:null}:a&&(l(a)||Array.isArray(a)&&l(a[0]))?i[t]={data:a}:s[t]=a}const n={type:e.type,attributes:s,relationships:i};return l(e)&&(n.id=e.id),o("normalized resource: %O",n),n};export{p as denormalize,y as normalize};
package/lib/model.d.ts CHANGED
@@ -1,101 +1 @@
1
- /**
2
- * ©2022 Commerce Layer Inc.
3
- * OpenAPI schema, version 2.8.1
4
- **/
5
- export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
6
- export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
7
- export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate } from './resources/adyen_gateways';
8
- export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate } from './resources/adyen_payments';
9
- export type { Application } from './resources/application';
10
- export type { Attachment, AttachmentCreate, AttachmentUpdate } from './resources/attachments';
11
- export type { Authorization, AuthorizationUpdate } from './resources/authorizations';
12
- export type { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate } from './resources/avalara_accounts';
13
- export type { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate } from './resources/billing_info_validation_rules';
14
- export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './resources/bing_geocoders';
15
- export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways';
16
- export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments';
17
- export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles';
18
- export type { Capture, CaptureUpdate } from './resources/captures';
19
- export type { CarrierAccount } from './resources/carrier_accounts';
20
- export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways';
21
- export type { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate } from './resources/checkout_com_payments';
22
- export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules';
23
- export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients';
24
- export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons';
25
- export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses';
26
- export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups';
27
- export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets';
28
- export type { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate } from './resources/customer_payment_sources';
29
- export type { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate } from './resources/customer_subscriptions';
30
- export type { Customer, CustomerCreate, CustomerUpdate } from './resources/customers';
31
- export type { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate } from './resources/delivery_lead_times';
32
- export type { EventCallback } from './resources/event_callbacks';
33
- export type { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate } from './resources/external_gateways';
34
- export type { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate } from './resources/external_payments';
35
- export type { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate } from './resources/external_promotions';
36
- export type { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate } from './resources/external_tax_calculators';
37
- export type { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate } from './resources/fixed_amount_promotions';
38
- export type { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate } from './resources/fixed_price_promotions';
39
- export type { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate } from './resources/free_gift_promotions';
40
- export type { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate } from './resources/free_shipping_promotions';
41
- export type { Geocoder } from './resources/geocoders';
42
- export type { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate } from './resources/gift_card_recipients';
43
- export type { GiftCard, GiftCardCreate, GiftCardUpdate } from './resources/gift_cards';
44
- export type { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate } from './resources/google_geocoders';
45
- export type { Import, ImportCreate } from './resources/imports';
46
- export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate } from './resources/in_stock_subscriptions';
47
- export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models';
48
- export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations';
49
- export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations';
50
- export type { KlarnaGateway, KlarnaGatewayCreate, KlarnaGatewayUpdate } from './resources/klarna_gateways';
51
- export type { KlarnaPayment, KlarnaPaymentCreate, KlarnaPaymentUpdate } from './resources/klarna_payments';
52
- export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options';
53
- export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items';
54
- export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways';
55
- export type { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate } from './resources/manual_tax_calculators';
56
- export type { Market, MarketCreate, MarketUpdate } from './resources/markets';
57
- export type { Merchant, MerchantCreate, MerchantUpdate } from './resources/merchants';
58
- export type { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate } from './resources/order_amount_promotion_rules';
59
- export type { OrderCopy, OrderCopyCreate } from './resources/order_copies';
60
- export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions';
61
- export type { OrderValidationRule } from './resources/order_validation_rules';
62
- export type { Order, OrderCreate, OrderUpdate } from './resources/orders';
63
- export type { Organization } from './resources/organization';
64
- export type { Package, PackageCreate, PackageUpdate } from './resources/packages';
65
- export type { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate } from './resources/parcel_line_items';
66
- export type { Parcel, ParcelCreate, ParcelUpdate } from './resources/parcels';
67
- export type { PaymentGateway } from './resources/payment_gateways';
68
- export type { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate } from './resources/payment_methods';
69
- export type { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate } from './resources/paypal_gateways';
70
- export type { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate } from './resources/paypal_payments';
71
- export type { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate } from './resources/percentage_discount_promotions';
72
- export type { PriceList, PriceListCreate, PriceListUpdate } from './resources/price_lists';
73
- export type { Price, PriceCreate, PriceUpdate } from './resources/prices';
74
- export type { PromotionRule } from './resources/promotion_rules';
75
- export type { Promotion } from './resources/promotions';
76
- export type { Refund } from './resources/refunds';
77
- export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items';
78
- export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns';
79
- export type { Shipment, ShipmentUpdate } from './resources/shipments';
80
- export type { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate } from './resources/shipping_categories';
81
- export type { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate } from './resources/shipping_methods';
82
- export type { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate } from './resources/shipping_zones';
83
- export type { SkuListItem, SkuListItemCreate, SkuListItemUpdate } from './resources/sku_list_items';
84
- export type { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate } from './resources/sku_list_promotion_rules';
85
- export type { SkuList, SkuListCreate, SkuListUpdate } from './resources/sku_lists';
86
- export type { SkuOption, SkuOptionCreate, SkuOptionUpdate } from './resources/sku_options';
87
- export type { Sku, SkuCreate, SkuUpdate } from './resources/skus';
88
- export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items';
89
- export type { StockLineItem } from './resources/stock_line_items';
90
- export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations';
91
- export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers';
92
- export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways';
93
- export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments';
94
- export type { TaxCalculator } from './resources/tax_calculators';
95
- export type { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate } from './resources/tax_categories';
96
- export type { TaxRule, TaxRuleCreate, TaxRuleUpdate } from './resources/tax_rules';
97
- export type { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate } from './resources/taxjar_accounts';
98
- export type { Transaction } from './resources/transactions';
99
- export type { Void } from './resources/voids';
100
- export type { Webhook, WebhookCreate, WebhookUpdate } from './resources/webhooks';
101
- 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{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{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{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{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{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}from'./resources/order_copies';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{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{PriceList,PriceListCreate,PriceListUpdate}from'./resources/price_lists';export type{Price,PriceCreate,PriceUpdate}from'./resources/prices';export type{PromotionRule}from'./resources/promotion_rules';export type{Promotion}from'./resources/promotions';export type{Refund}from'./resources/refunds';export type{ReturnLineItem,ReturnLineItemCreate,ReturnLineItemUpdate}from'./resources/return_line_items';export type{Return,ReturnCreate,ReturnUpdate}from'./resources/returns';export type{Shipment,ShipmentUpdate}from'./resources/shipments';export type{ShippingCategory,ShippingCategoryCreate,ShippingCategoryUpdate}from'./resources/shipping_categories';export type{ShippingMethod,ShippingMethodCreate,ShippingMethodUpdate}from'./resources/shipping_methods';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}from'./resources/stock_line_items';export type{StockLocation,StockLocationCreate,StockLocationUpdate}from'./resources/stock_locations';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{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{Void}from'./resources/voids';export type{Webhook,WebhookCreate,WebhookUpdate}from'./resources/webhooks';export type{WireTransfer,WireTransferCreate,WireTransferUpdate}from'./resources/wire_transfers';
package/lib/query.d.ts CHANGED
@@ -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
- declare type QueryParams = QueryParamsRetrieve | QueryParamsList;
19
- export { QueryParamsRetrieve, QueryParamsList, QueryParams };
20
- declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined, res: 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;}declare 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/query.js CHANGED
@@ -1 +1 @@
1
- import n from"./debug";const r=n(),o=e=>e.filters||e.pageNumber||e.pageSize||e.sort,g=(e,a)=>{r("generate query string params: %O, %O",e,a);const i={};return e&&(e.include&&(i.include=e.include.join(",")),e.fields&&(Array.isArray(e.fields)&&(e.fields={[a.type]:e.fields}),Object.entries(e.fields).forEach(([s,t])=>{i[`fields[${s}]`]=t.join(",")})),o(e)&&(e.sort&&(Array.isArray(e.sort)?i.sort=e.sort.join(","):i.sort=Object.entries(e.sort).map(([s,t])=>`${t==="desc"?"-":""}${s}`).join(",")),e.pageNumber&&(i["page[number]"]=String(e.pageNumber)),e.pageSize&&(i["page[size]"]=String(e.pageSize)),e.filters&&Object.entries(e.filters).forEach(([s,t])=>{i[`filter[q][${s}]`]=String(t)})),r("query string params: %O",i)),i};export{g as generateQueryStringParams};
1
+ import n from"./debug";const a=n("query"),o=e=>e.filters||e.pageNumber||e.pageSize||e.sort,g=(e,r)=>{a("generate query string params: %O, %O",e,r);const i={};return e&&(e.include&&(i.include=e.include.join(",")),e.fields&&(Array.isArray(e.fields)&&(e.fields={[r.type||r]:e.fields}),Object.entries(e.fields).forEach(([s,t])=>{i[`fields[${s}]`]=t.join(",")})),o(e)&&(e.sort&&(Array.isArray(e.sort)?i.sort=e.sort.join(","):i.sort=Object.entries(e.sort).map(([s,t])=>`${t==="desc"?"-":""}${s}`).join(",")),e.pageNumber&&(i["page[number]"]=String(e.pageNumber)),e.pageSize&&(i["page[size]"]=String(e.pageSize)),e.filters&&Object.entries(e.filters).forEach(([s,t])=>{i[`filter[q][${s}]`]=String(t)})),a("query string params: %O",i)),i};export{g as generateQueryStringParams};
package/lib/resource.d.ts CHANGED
@@ -1,76 +1 @@
1
- import { ApiClientInitConfig } from './client';
2
- import { QueryParamsRetrieve, QueryParamsList } from './query';
3
- import { ResourceTypeLock } from './api';
4
- import { InterceptorManager } from './interceptor';
5
- import { QueryParams } from '.';
6
- declare type ResourceNull = {
7
- id: null;
8
- } & ResourceType;
9
- declare type ResourceRel = ResourceId | ResourceNull;
10
- declare type Metadata = {
11
- [key: string]: any;
12
- };
13
- interface ResourceType {
14
- readonly type: ResourceTypeLock;
15
- }
16
- interface ResourceId extends ResourceType {
17
- readonly id: string;
18
- }
19
- interface Resource extends ResourceId {
20
- reference?: string;
21
- reference_origin?: string;
22
- metadata?: Metadata;
23
- readonly created_at: string;
24
- readonly updated_at: string;
25
- }
26
- interface ResourceCreate {
27
- reference?: string;
28
- reference_origin?: string;
29
- metadata?: Metadata;
30
- }
31
- interface ResourceUpdate {
32
- readonly id: string;
33
- reference?: string;
34
- reference_origin?: string;
35
- metadata?: Metadata;
36
- }
37
- declare type ListMeta = {
38
- readonly pageCount: number;
39
- readonly recordCount: number;
40
- readonly currentPage: number;
41
- readonly recordsPerPage: number;
42
- };
43
- declare class ListResponse<R> extends Array<R> {
44
- readonly meta: ListMeta;
45
- constructor(meta: ListMeta, data: Array<R>);
46
- first(): R | undefined;
47
- last(): R | undefined;
48
- get(index: number): R | undefined;
49
- }
50
- export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse, ResourceRel };
51
- declare type ResourceAdapterConfig = {};
52
- declare type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig;
53
- declare type ResourcesConfig = Partial<ResourcesInitConfig>;
54
- declare class ResourceAdapter {
55
- #private;
56
- constructor(config: ResourcesInitConfig);
57
- get interceptors(): InterceptorManager;
58
- private localConfig;
59
- config(config: ResourcesConfig): void;
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: ResourceType, path: string, params?: QueryParams, options?: ResourcesConfig): Promise<R | ListResponse<R>>;
67
- }
68
- declare abstract class ApiResource {
69
- static readonly TYPE: ResourceTypeLock;
70
- protected resources: ResourceAdapter;
71
- constructor(adapter: ResourceAdapter);
72
- abstract relationship(id: string | ResourceId | null): ResourceRel;
73
- abstract type(): string;
74
- }
75
- export default ResourceAdapter;
76
- export { ApiResource, ResourcesConfig, ResourcesInitConfig };
1
+ import{ApiClientInitConfig}from'./client';import{QueryParamsRetrieve,QueryParamsList}from'./query';import{ResourceTypeLock}from'./api';import{InterceptorManager}from'./interceptor';import{QueryParams}from'.';declare type ResourceNull={id:null;}&ResourceType;declare type ResourceRel=ResourceId|ResourceNull;declare type Metadata={[key:string]:any;};interface ResourceType{readonly type:ResourceTypeLock;}interface ResourceId extends ResourceType{readonly id:string;}interface Resource extends ResourceId{reference?:string;reference_origin?:string;metadata?:Metadata;readonly created_at:string;readonly updated_at:string;}interface ResourceCreate{reference?:string;reference_origin?:string;metadata?:Metadata;}interface ResourceUpdate{readonly id:string;reference?:string;reference_origin?:string;metadata?:Metadata;}declare 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:Array<R>);first():R|undefined;last():R|undefined;get(index:number):R|undefined;}export type{Metadata,ResourceType,ResourceId,Resource,ResourceCreate,ResourceUpdate,ListResponse,ResourceRel};declare type ResourceAdapterConfig={};declare type ResourcesInitConfig=ResourceAdapterConfig&ApiClientInitConfig;declare type ResourcesConfig=Partial<ResourcesInitConfig>;declare class ResourceAdapter{#private;constructor(config:ResourcesInitConfig);get interceptors():InterceptorManager;private localConfig;config(config:ResourcesConfig):void;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 ApiResource{static readonly TYPE:ResourceTypeLock;protected resources:ResourceAdapter;constructor(adapter:ResourceAdapter);abstract relationship(id:string|ResourceId|null):ResourceRel;abstract type():string;}export default ResourceAdapter;export{ApiResource,ResourcesConfig,ResourcesInitConfig};
package/lib/resource.js CHANGED
@@ -1 +1 @@
1
- var v=this&&this.__classPrivateFieldSet||function(i,e,a,t,r){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?r.call(i,a):r?r.value=a:e.set(i,a),a},c=this&&this.__classPrivateFieldGet||function(i,e,a,t){if(a==="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 a==="m"?t:a==="a"?t.call(i):t?t.value:e.get(i)},n,g;import b from"./client";import{denormalize as u,normalize as l}from"./jsonapi";import{generateQueryStringParams as m}from"./query";import d from"./config";import O from"./debug";const p=O();class w extends Array{constructor(e,a){super(...a||[]);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}}class P{constructor(e){n.set(this,void 0),g.set(this,{}),v(this,n,b.create(e),"f"),this.localConfig(e)}get interceptors(){return c(this,n,"f").interceptors}localConfig(e){}config(e){p("config %o",e),this.localConfig(e),c(this,n,"f").config(e)}async singleton(e,a,t){p("singleton: %o, %O, %O",e,a||{},t||{});const r=m(a,e);t?.params&&Object.assign(r,t?.params);const s=await c(this,n,"f").request("get",`${e.type}`,void 0,{...t,params:r});return u(s)}async retrieve(e,a,t){p("retrieve: %o, %O, %O",e,a||{},t||{});const r=m(a,e);t?.params&&Object.assign(r,t?.params);const s=await c(this,n,"f").request("get",`${e.type}/${e.id}`,void 0,{...t,params:r});return u(s)}async list(e,a,t){p("list: %o, %O, %O",e,a||{},t||{});const r=m(a,e);t?.params&&Object.assign(r,t?.params);const s=await c(this,n,"f").request("get",`${e.type}`,void 0,{...t,params:r}),o=u(s),h={pageCount:Number(s.meta?.page_count),recordCount:Number(s.meta?.record_count),currentPage:a?.pageNumber||d.default.pageNumber,recordsPerPage:a?.pageSize||d.default.pageSize};return new w(h,o)}async create(e,a,t){p("create: %o, %O, %O",e,a||{},t||{});const r=m(a,e);t?.params&&Object.assign(r,t?.params);const s=l(e),o=await c(this,n,"f").request("post",e.type,s,{...t,params:r});return u(o)}async update(e,a,t){p("update: %o, %O, %O",e,a||{},t||{});const r=m(a,e);t?.params&&Object.assign(r,t?.params);const s=l(e),o=await c(this,n,"f").request("patch",`${e.type}/${e.id}`,s,{...t,params:r});return u(o)}async delete(e,a){p("delete: %o, %O",e,a||{}),await c(this,n,"f").request("delete",`${e.type}/${e.id}`,void 0,a)}async fetch(e,a,t,r){p("fetch: %o, %O, %O",a,t||{},r||{});const s=m(t,e);r?.params&&Object.assign(s,r?.params);const o=await c(this,n,"f").request("get",a,void 0,{...r,params:s}),h=u(o);if(Array.isArray(h)){const f=t,y={pageCount:Number(o.meta?.page_count),recordCount:Number(o.meta?.record_count),currentPage:f?.pageNumber||d.default.pageNumber,recordsPerPage:f?.pageSize||d.default.pageSize};return new w(y,h)}else return h}}n=new WeakMap,g=new WeakMap;class C{constructor(e){p("new resource instance: %s",this.type()),this.resources=e}}export default P;export{C as ApiResource};
1
+ import f from"./client";import{denormalize as n,normalize as d}from"./jsonapi";import{generateQueryStringParams as c}from"./query";import p from"./config";import O from"./debug";const i=O("resource");class h extends Array{meta;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}}class y{#e;#t={};constructor(e){this.#e=f.create(e),this.localConfig(e)}get interceptors(){return this.#e.interceptors}localConfig(e){}config(e){i("config %o",e),this.localConfig(e),this.#e.config(e)}async singleton(e,r,t){i("singleton: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=await this.#e.request("get",`${e.type}`,void 0,{...t,params:a});return n(s)}async retrieve(e,r,t){i("retrieve: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=await this.#e.request("get",`${e.type}/${e.id}`,void 0,{...t,params:a});return n(s)}async list(e,r,t){i("list: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=await this.#e.request("get",`${e.type}`,void 0,{...t,params:a}),o=n(s),u={pageCount:Number(s.meta?.page_count),recordCount:Number(s.meta?.record_count),currentPage:r?.pageNumber||p.default.pageNumber,recordsPerPage:r?.pageSize||p.default.pageSize};return new h(u,o)}async create(e,r,t){i("create: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=d(e),o=await this.#e.request("post",e.type,s,{...t,params:a});return n(o)}async update(e,r,t){i("update: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=d(e),o=await this.#e.request("patch",`${e.type}/${e.id}`,s,{...t,params:a});return n(o)}async delete(e,r){i("delete: %o, %O",e,r||{}),await this.#e.request("delete",`${e.type}/${e.id}`,void 0,r)}async fetch(e,r,t,a){i("fetch: %o, %O, %O",r,t||{},a||{});const s=c(t,e);a?.params&&Object.assign(s,a?.params);const o=await this.#e.request("get",r,void 0,{...a,params:s}),u=n(o);if(Array.isArray(u)){const g=t,l={pageCount:Number(o.meta?.page_count),recordCount:Number(o.meta?.record_count),currentPage:g?.pageNumber||p.default.pageNumber,recordsPerPage:g?.pageSize||p.default.pageSize};return new h(l,u)}else return u}}class b{static TYPE;resources;constructor(e){i("new resource instance: %s",this.type()),this.resources=e}}export default y;export{b as ApiResource};
@@ -1,88 +1 @@
1
- import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
2
- import { QueryParamsList, QueryParamsRetrieve } from '../query';
3
- import { Geocoder } from './geocoders';
4
- declare type AddressRel = ResourceRel & {
5
- type: typeof Addresses.TYPE;
6
- };
7
- declare type GeocoderRel = ResourceRel & {
8
- type: 'geocoders';
9
- };
10
- interface Address extends Resource {
11
- business?: boolean;
12
- first_name?: string;
13
- last_name?: string;
14
- company?: string;
15
- full_name?: string;
16
- line_1?: string;
17
- line_2?: string;
18
- city?: string;
19
- zip_code?: string;
20
- state_code?: string;
21
- country_code?: string;
22
- phone?: string;
23
- full_address?: string;
24
- name?: string;
25
- email?: string;
26
- notes?: string;
27
- lat?: number;
28
- lng?: number;
29
- is_localized?: boolean;
30
- is_geocoded?: boolean;
31
- provider_name?: string;
32
- map_url?: string;
33
- static_map_url?: string;
34
- billing_info?: string;
35
- geocoder?: Geocoder;
36
- }
37
- interface AddressCreate extends ResourceCreate {
38
- business?: boolean;
39
- first_name?: string;
40
- last_name?: string;
41
- company?: string;
42
- line_1: string;
43
- line_2?: string;
44
- city: string;
45
- zip_code?: string;
46
- state_code: string;
47
- country_code: string;
48
- phone: string;
49
- email?: string;
50
- notes?: string;
51
- lat?: number;
52
- lng?: number;
53
- billing_info?: string;
54
- geocoder?: GeocoderRel;
55
- }
56
- interface AddressUpdate extends ResourceUpdate {
57
- business?: boolean;
58
- first_name?: string;
59
- last_name?: string;
60
- company?: string;
61
- line_1?: string;
62
- line_2?: string;
63
- city?: string;
64
- zip_code?: string;
65
- state_code?: string;
66
- country_code?: string;
67
- phone?: string;
68
- email?: string;
69
- notes?: string;
70
- lat?: number;
71
- lng?: number;
72
- billing_info?: string;
73
- geocoder?: GeocoderRel;
74
- }
75
- declare class Addresses extends ApiResource {
76
- static readonly TYPE: 'addresses';
77
- list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Address>>;
78
- create(resource: AddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
79
- retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
80
- update(resource: AddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
81
- delete(id: string, options?: ResourcesConfig): Promise<void>;
82
- geocoder(addressId: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Geocoder>;
83
- isAddress(resource: any): resource is Address;
84
- relationship(id: string | ResourceId | null): AddressRel;
85
- type(): string;
86
- }
87
- export default Addresses;
88
- export { Address, AddressCreate, AddressUpdate };
1
+ import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import type{QueryParamsList,QueryParamsRetrieve}from'../query';import type{Geocoder}from'./geocoders';declare type AddressRel=ResourceRel&{type:typeof Addresses.TYPE;};declare type GeocoderRel=ResourceRel&{type:'geocoders';};interface Address extends Resource{business?:boolean;first_name?:string;last_name?:string;company?:string;full_name?:string;line_1?:string;line_2?:string;city?:string;zip_code?:string;state_code?:string;country_code?:string;phone?:string;full_address?:string;name?:string;email?:string;notes?:string;lat?:number;lng?:number;is_localized?:boolean;is_geocoded?:boolean;provider_name?:string;map_url?:string;static_map_url?:string;billing_info?:string;geocoder?:Geocoder;}interface AddressCreate extends ResourceCreate{business?:boolean;first_name?:string;last_name?:string;company?:string;line_1:string;line_2?:string;city:string;zip_code?:string;state_code:string;country_code:string;phone:string;email?:string;notes?:string;lat?:number;lng?:number;billing_info?:string;geocoder?:GeocoderRel;}interface AddressUpdate extends ResourceUpdate{business?:boolean;first_name?:string;last_name?:string;company?:string;line_1?:string;line_2?:string;city?:string;zip_code?:string;state_code?:string;country_code?:string;phone?:string;email?:string;notes?:string;lat?:number;lng?:number;billing_info?:string;geocoder?:GeocoderRel;}declare class Addresses extends ApiResource{static readonly TYPE:'addresses';list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Address>>;create(resource:AddressCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Address>;retrieve(id:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Address>;update(resource:AddressUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Address>;delete(id:string,options?:ResourcesConfig):Promise<void>;geocoder(addressId:string|Address,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Geocoder>;isAddress(resource:any):resource is Address;relationship(id:string|ResourceId|null):AddressRel;type():string;}export default Addresses;export{Address,AddressCreate,AddressUpdate};
@@ -1 +1 @@
1
- import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create({...e,type:t.TYPE},s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update({...e,type:t.TYPE},s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}async geocoder(e,s,r){return this.resources.fetch({type:"geocoders"},`addresses/${e}/geocoder`,s,r)}isAddress(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="addresses";export default t;
1
+ import{ApiResource as c}from"../resource";class r extends c{static TYPE="addresses";async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create({...e,type:r.TYPE},t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},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({type:r.TYPE,id:e},t)}async geocoder(e,t,s){const i=e.id||e;return this.resources.fetch({type:"geocoders"},`addresses/${i}/geocoder`,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}}export default r;
@@ -1,35 +1 @@
1
- import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
2
- import { QueryParamsList, QueryParamsRetrieve } from '../query';
3
- declare type AdjustmentRel = ResourceRel & {
4
- type: typeof Adjustments.TYPE;
5
- };
6
- interface Adjustment extends Resource {
7
- name?: string;
8
- currency_code?: string;
9
- amount_cents?: number;
10
- amount_float?: number;
11
- formatted_amount?: string;
12
- }
13
- interface AdjustmentCreate extends ResourceCreate {
14
- name: string;
15
- currency_code: string;
16
- amount_cents: number;
17
- }
18
- interface AdjustmentUpdate extends ResourceUpdate {
19
- name?: string;
20
- currency_code?: string;
21
- amount_cents?: number;
22
- }
23
- declare class Adjustments extends ApiResource {
24
- static readonly TYPE: 'adjustments';
25
- list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Adjustment>>;
26
- create(resource: AdjustmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
27
- retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
28
- update(resource: AdjustmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
29
- delete(id: string, options?: ResourcesConfig): Promise<void>;
30
- isAdjustment(resource: any): resource is Adjustment;
31
- relationship(id: string | ResourceId | null): AdjustmentRel;
32
- type(): string;
33
- }
34
- export default Adjustments;
35
- export { Adjustment, AdjustmentCreate, AdjustmentUpdate };
1
+ import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import type{QueryParamsList,QueryParamsRetrieve}from'../query';declare type AdjustmentRel=ResourceRel&{type:typeof Adjustments.TYPE;};interface Adjustment extends Resource{name?:string;currency_code?:string;amount_cents?:number;amount_float?:number;formatted_amount?:string;}interface AdjustmentCreate extends ResourceCreate{name:string;currency_code:string;amount_cents:number;}interface AdjustmentUpdate extends ResourceUpdate{name?:string;currency_code?:string;amount_cents?:number;}declare class Adjustments extends ApiResource{static readonly TYPE:'adjustments';list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Adjustment>>;create(resource:AdjustmentCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Adjustment>;retrieve(id:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Adjustment>;update(resource:AdjustmentUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Adjustment>;delete(id:string,options?:ResourcesConfig):Promise<void>;isAdjustment(resource:any):resource is Adjustment;relationship(id:string|ResourceId|null):AdjustmentRel;type():string;}export default Adjustments;export{Adjustment,AdjustmentCreate,AdjustmentUpdate};
@@ -1 +1 @@
1
- import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create({...e,type:r.TYPE},t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},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({type:r.TYPE,id:e},t)}isAdjustment(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="adjustments";export default r;
1
+ import{ApiResource as i}from"../resource";class t extends i{static TYPE="adjustments";async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async create(e,r,s){return this.resources.create({...e,type:t.TYPE},r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},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({type:t.TYPE,id:e},r)}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}}export default t;