@commercelayer/sdk 5.0.0-beta.3 → 5.0.0-beta.5

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 (199) hide show
  1. package/lib/cjs/client.js +11 -7
  2. package/lib/cjs/config.d.ts +1 -0
  3. package/lib/cjs/config.js +1 -0
  4. package/lib/cjs/debug.js +0 -1
  5. package/lib/cjs/error.js +1 -3
  6. package/lib/cjs/jsonapi.js +5 -1
  7. package/lib/cjs/resource.js +7 -7
  8. package/lib/cjs/resources/addresses.js +2 -2
  9. package/lib/cjs/resources/adjustments.js +2 -2
  10. package/lib/cjs/resources/adyen_gateways.js +2 -2
  11. package/lib/cjs/resources/adyen_payments.js +2 -2
  12. package/lib/cjs/resources/attachments.js +2 -2
  13. package/lib/cjs/resources/authorizations.js +1 -1
  14. package/lib/cjs/resources/avalara_accounts.js +2 -2
  15. package/lib/cjs/resources/axerve_gateways.js +2 -2
  16. package/lib/cjs/resources/axerve_payments.js +2 -2
  17. package/lib/cjs/resources/billing_info_validation_rules.js +2 -2
  18. package/lib/cjs/resources/bing_geocoders.js +2 -2
  19. package/lib/cjs/resources/braintree_gateways.js +2 -2
  20. package/lib/cjs/resources/braintree_payments.js +2 -2
  21. package/lib/cjs/resources/bundles.js +2 -2
  22. package/lib/cjs/resources/captures.js +1 -1
  23. package/lib/cjs/resources/checkout_com_gateways.js +2 -2
  24. package/lib/cjs/resources/checkout_com_payments.js +2 -2
  25. package/lib/cjs/resources/cleanups.js +1 -1
  26. package/lib/cjs/resources/coupon_codes_promotion_rules.js +2 -2
  27. package/lib/cjs/resources/coupon_recipients.js +2 -2
  28. package/lib/cjs/resources/coupons.js +2 -2
  29. package/lib/cjs/resources/customer_addresses.js +2 -2
  30. package/lib/cjs/resources/customer_groups.js +2 -2
  31. package/lib/cjs/resources/customer_password_resets.js +2 -2
  32. package/lib/cjs/resources/customer_payment_sources.js +2 -2
  33. package/lib/cjs/resources/customer_subscriptions.js +2 -2
  34. package/lib/cjs/resources/customers.js +2 -2
  35. package/lib/cjs/resources/delivery_lead_times.js +2 -2
  36. package/lib/cjs/resources/exports.js +1 -1
  37. package/lib/cjs/resources/external_gateways.js +2 -2
  38. package/lib/cjs/resources/external_payments.js +2 -2
  39. package/lib/cjs/resources/external_promotions.js +2 -2
  40. package/lib/cjs/resources/external_tax_calculators.js +2 -2
  41. package/lib/cjs/resources/fixed_amount_promotions.js +2 -2
  42. package/lib/cjs/resources/fixed_price_promotions.js +2 -2
  43. package/lib/cjs/resources/free_gift_promotions.js +2 -2
  44. package/lib/cjs/resources/free_shipping_promotions.js +2 -2
  45. package/lib/cjs/resources/gift_card_recipients.js +2 -2
  46. package/lib/cjs/resources/gift_cards.js +2 -2
  47. package/lib/cjs/resources/google_geocoders.js +2 -2
  48. package/lib/cjs/resources/imports.js +1 -1
  49. package/lib/cjs/resources/in_stock_subscriptions.js +2 -2
  50. package/lib/cjs/resources/inventory_models.js +2 -2
  51. package/lib/cjs/resources/inventory_return_locations.js +2 -2
  52. package/lib/cjs/resources/inventory_stock_locations.js +2 -2
  53. package/lib/cjs/resources/klarna_gateways.js +2 -2
  54. package/lib/cjs/resources/klarna_payments.js +2 -2
  55. package/lib/cjs/resources/line_item_options.js +2 -2
  56. package/lib/cjs/resources/line_items.js +2 -2
  57. package/lib/cjs/resources/manual_gateways.js +2 -2
  58. package/lib/cjs/resources/manual_tax_calculators.js +2 -2
  59. package/lib/cjs/resources/markets.js +2 -2
  60. package/lib/cjs/resources/merchants.js +2 -2
  61. package/lib/cjs/resources/order_amount_promotion_rules.js +2 -2
  62. package/lib/cjs/resources/order_copies.js +1 -1
  63. package/lib/cjs/resources/order_subscriptions.js +2 -2
  64. package/lib/cjs/resources/orders.js +2 -2
  65. package/lib/cjs/resources/packages.js +2 -2
  66. package/lib/cjs/resources/parcel_line_items.js +2 -2
  67. package/lib/cjs/resources/parcels.js +2 -2
  68. package/lib/cjs/resources/payment_methods.js +2 -2
  69. package/lib/cjs/resources/paypal_gateways.js +2 -2
  70. package/lib/cjs/resources/paypal_payments.js +2 -2
  71. package/lib/cjs/resources/percentage_discount_promotions.js +2 -2
  72. package/lib/cjs/resources/price_lists.js +2 -2
  73. package/lib/cjs/resources/price_volume_tiers.js +2 -2
  74. package/lib/cjs/resources/prices.js +2 -2
  75. package/lib/cjs/resources/return_line_items.js +2 -2
  76. package/lib/cjs/resources/returns.js +2 -2
  77. package/lib/cjs/resources/satispay_gateways.js +2 -2
  78. package/lib/cjs/resources/satispay_payments.js +2 -2
  79. package/lib/cjs/resources/shipments.js +1 -1
  80. package/lib/cjs/resources/shipping_categories.js +2 -2
  81. package/lib/cjs/resources/shipping_methods.js +2 -2
  82. package/lib/cjs/resources/shipping_weight_tiers.js +2 -2
  83. package/lib/cjs/resources/shipping_zones.js +2 -2
  84. package/lib/cjs/resources/sku_list_items.js +2 -2
  85. package/lib/cjs/resources/sku_list_promotion_rules.js +2 -2
  86. package/lib/cjs/resources/sku_lists.js +2 -2
  87. package/lib/cjs/resources/sku_options.js +2 -2
  88. package/lib/cjs/resources/skus.js +2 -2
  89. package/lib/cjs/resources/stock_items.js +2 -2
  90. package/lib/cjs/resources/stock_locations.js +2 -2
  91. package/lib/cjs/resources/stock_transfers.js +2 -2
  92. package/lib/cjs/resources/stripe_gateways.js +2 -2
  93. package/lib/cjs/resources/stripe_payments.js +2 -2
  94. package/lib/cjs/resources/tax_categories.js +2 -2
  95. package/lib/cjs/resources/tax_rules.js +2 -2
  96. package/lib/cjs/resources/taxjar_accounts.js +2 -2
  97. package/lib/cjs/resources/webhooks.js +2 -2
  98. package/lib/cjs/resources/wire_transfers.js +2 -2
  99. package/lib/esm/client.js +11 -7
  100. package/lib/esm/config.d.ts +1 -0
  101. package/lib/esm/config.js +1 -0
  102. package/lib/esm/debug.js +0 -1
  103. package/lib/esm/error.js +1 -3
  104. package/lib/esm/jsonapi.js +5 -1
  105. package/lib/esm/resource.js +7 -7
  106. package/lib/esm/resources/addresses.js +2 -2
  107. package/lib/esm/resources/adjustments.js +2 -2
  108. package/lib/esm/resources/adyen_gateways.js +2 -2
  109. package/lib/esm/resources/adyen_payments.js +2 -2
  110. package/lib/esm/resources/attachments.js +2 -2
  111. package/lib/esm/resources/authorizations.js +1 -1
  112. package/lib/esm/resources/avalara_accounts.js +2 -2
  113. package/lib/esm/resources/axerve_gateways.js +2 -2
  114. package/lib/esm/resources/axerve_payments.js +2 -2
  115. package/lib/esm/resources/billing_info_validation_rules.js +2 -2
  116. package/lib/esm/resources/bing_geocoders.js +2 -2
  117. package/lib/esm/resources/braintree_gateways.js +2 -2
  118. package/lib/esm/resources/braintree_payments.js +2 -2
  119. package/lib/esm/resources/bundles.js +2 -2
  120. package/lib/esm/resources/captures.js +1 -1
  121. package/lib/esm/resources/checkout_com_gateways.js +2 -2
  122. package/lib/esm/resources/checkout_com_payments.js +2 -2
  123. package/lib/esm/resources/cleanups.js +1 -1
  124. package/lib/esm/resources/coupon_codes_promotion_rules.js +2 -2
  125. package/lib/esm/resources/coupon_recipients.js +2 -2
  126. package/lib/esm/resources/coupons.js +2 -2
  127. package/lib/esm/resources/customer_addresses.js +2 -2
  128. package/lib/esm/resources/customer_groups.js +2 -2
  129. package/lib/esm/resources/customer_password_resets.js +2 -2
  130. package/lib/esm/resources/customer_payment_sources.js +2 -2
  131. package/lib/esm/resources/customer_subscriptions.js +2 -2
  132. package/lib/esm/resources/customers.js +2 -2
  133. package/lib/esm/resources/delivery_lead_times.js +2 -2
  134. package/lib/esm/resources/exports.js +1 -1
  135. package/lib/esm/resources/external_gateways.js +2 -2
  136. package/lib/esm/resources/external_payments.js +2 -2
  137. package/lib/esm/resources/external_promotions.js +2 -2
  138. package/lib/esm/resources/external_tax_calculators.js +2 -2
  139. package/lib/esm/resources/fixed_amount_promotions.js +2 -2
  140. package/lib/esm/resources/fixed_price_promotions.js +2 -2
  141. package/lib/esm/resources/free_gift_promotions.js +2 -2
  142. package/lib/esm/resources/free_shipping_promotions.js +2 -2
  143. package/lib/esm/resources/gift_card_recipients.js +2 -2
  144. package/lib/esm/resources/gift_cards.js +2 -2
  145. package/lib/esm/resources/google_geocoders.js +2 -2
  146. package/lib/esm/resources/imports.js +1 -1
  147. package/lib/esm/resources/in_stock_subscriptions.js +2 -2
  148. package/lib/esm/resources/inventory_models.js +2 -2
  149. package/lib/esm/resources/inventory_return_locations.js +2 -2
  150. package/lib/esm/resources/inventory_stock_locations.js +2 -2
  151. package/lib/esm/resources/klarna_gateways.js +2 -2
  152. package/lib/esm/resources/klarna_payments.js +2 -2
  153. package/lib/esm/resources/line_item_options.js +2 -2
  154. package/lib/esm/resources/line_items.js +2 -2
  155. package/lib/esm/resources/manual_gateways.js +2 -2
  156. package/lib/esm/resources/manual_tax_calculators.js +2 -2
  157. package/lib/esm/resources/markets.js +2 -2
  158. package/lib/esm/resources/merchants.js +2 -2
  159. package/lib/esm/resources/order_amount_promotion_rules.js +2 -2
  160. package/lib/esm/resources/order_copies.js +1 -1
  161. package/lib/esm/resources/order_subscriptions.js +2 -2
  162. package/lib/esm/resources/orders.js +2 -2
  163. package/lib/esm/resources/packages.js +2 -2
  164. package/lib/esm/resources/parcel_line_items.js +2 -2
  165. package/lib/esm/resources/parcels.js +2 -2
  166. package/lib/esm/resources/payment_methods.js +2 -2
  167. package/lib/esm/resources/paypal_gateways.js +2 -2
  168. package/lib/esm/resources/paypal_payments.js +2 -2
  169. package/lib/esm/resources/percentage_discount_promotions.js +2 -2
  170. package/lib/esm/resources/price_lists.js +2 -2
  171. package/lib/esm/resources/price_volume_tiers.js +2 -2
  172. package/lib/esm/resources/prices.js +2 -2
  173. package/lib/esm/resources/return_line_items.js +2 -2
  174. package/lib/esm/resources/returns.js +2 -2
  175. package/lib/esm/resources/satispay_gateways.js +2 -2
  176. package/lib/esm/resources/satispay_payments.js +2 -2
  177. package/lib/esm/resources/shipments.js +1 -1
  178. package/lib/esm/resources/shipping_categories.js +2 -2
  179. package/lib/esm/resources/shipping_methods.js +2 -2
  180. package/lib/esm/resources/shipping_weight_tiers.js +2 -2
  181. package/lib/esm/resources/shipping_zones.js +2 -2
  182. package/lib/esm/resources/sku_list_items.js +2 -2
  183. package/lib/esm/resources/sku_list_promotion_rules.js +2 -2
  184. package/lib/esm/resources/sku_lists.js +2 -2
  185. package/lib/esm/resources/sku_options.js +2 -2
  186. package/lib/esm/resources/skus.js +2 -2
  187. package/lib/esm/resources/stock_items.js +2 -2
  188. package/lib/esm/resources/stock_locations.js +2 -2
  189. package/lib/esm/resources/stock_transfers.js +2 -2
  190. package/lib/esm/resources/stripe_gateways.js +2 -2
  191. package/lib/esm/resources/stripe_payments.js +2 -2
  192. package/lib/esm/resources/tax_categories.js +2 -2
  193. package/lib/esm/resources/tax_rules.js +2 -2
  194. package/lib/esm/resources/taxjar_accounts.js +2 -2
  195. package/lib/esm/resources/webhooks.js +2 -2
  196. package/lib/esm/resources/wire_transfers.js +2 -2
  197. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  198. package/lib/tsconfig.tsbuildinfo +1 -1
  199. package/package.json +3 -3
@@ -7,10 +7,10 @@ class ShippingMethods extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: ShippingMethods.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: ShippingMethods.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: ShippingMethods.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: ShippingMethods.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: ShippingMethods.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: ShippingMethods.TYPE } : id, options);
@@ -7,10 +7,10 @@ class ShippingWeightTiers extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: ShippingWeightTiers.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: ShippingWeightTiers.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: ShippingWeightTiers.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: ShippingWeightTiers.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: ShippingWeightTiers.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: ShippingWeightTiers.TYPE } : id, options);
@@ -7,10 +7,10 @@ class ShippingZones extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: ShippingZones.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: ShippingZones.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: ShippingZones.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: ShippingZones.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: ShippingZones.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: ShippingZones.TYPE } : id, options);
@@ -7,10 +7,10 @@ class SkuListItems extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: SkuListItems.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: SkuListItems.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: SkuListItems.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: SkuListItems.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: SkuListItems.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: SkuListItems.TYPE } : id, options);
@@ -7,10 +7,10 @@ class SkuListPromotionRules extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: SkuListPromotionRules.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: SkuListPromotionRules.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: SkuListPromotionRules.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: SkuListPromotionRules.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: SkuListPromotionRules.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: SkuListPromotionRules.TYPE } : id, options);
@@ -7,10 +7,10 @@ class SkuLists extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: SkuLists.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: SkuLists.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: SkuLists.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: SkuLists.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: SkuLists.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: SkuLists.TYPE } : id, options);
@@ -7,10 +7,10 @@ class SkuOptions extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: SkuOptions.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: SkuOptions.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: SkuOptions.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: SkuOptions.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: SkuOptions.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: SkuOptions.TYPE } : id, options);
@@ -7,10 +7,10 @@ class Skus extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: Skus.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: Skus.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: Skus.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: Skus.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: Skus.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: Skus.TYPE } : id, options);
@@ -7,10 +7,10 @@ class StockItems extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: StockItems.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: StockItems.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: StockItems.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: StockItems.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: StockItems.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: StockItems.TYPE } : id, options);
@@ -7,10 +7,10 @@ class StockLocations extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: StockLocations.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: StockLocations.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: StockLocations.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: StockLocations.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: StockLocations.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: StockLocations.TYPE } : id, options);
@@ -7,10 +7,10 @@ class StockTransfers extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: StockTransfers.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: StockTransfers.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: StockTransfers.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: StockTransfers.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: StockTransfers.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: StockTransfers.TYPE } : id, options);
@@ -7,10 +7,10 @@ class StripeGateways extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: StripeGateways.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: StripeGateways.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: StripeGateways.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: StripeGateways.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: StripeGateways.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: StripeGateways.TYPE } : id, options);
@@ -7,10 +7,10 @@ class StripePayments extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: StripePayments.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: StripePayments.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: StripePayments.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: StripePayments.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: StripePayments.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: StripePayments.TYPE } : id, options);
@@ -7,10 +7,10 @@ class TaxCategories extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: TaxCategories.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: TaxCategories.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: TaxCategories.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: TaxCategories.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: TaxCategories.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: TaxCategories.TYPE } : id, options);
@@ -7,10 +7,10 @@ class TaxRules extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: TaxRules.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: TaxRules.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: TaxRules.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: TaxRules.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: TaxRules.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: TaxRules.TYPE } : id, options);
@@ -7,10 +7,10 @@ class TaxjarAccounts extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: TaxjarAccounts.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: TaxjarAccounts.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: TaxjarAccounts.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: TaxjarAccounts.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: TaxjarAccounts.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: TaxjarAccounts.TYPE } : id, options);
@@ -7,10 +7,10 @@ class Webhooks extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: Webhooks.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: Webhooks.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: Webhooks.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: Webhooks.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: Webhooks.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: Webhooks.TYPE } : id, options);
@@ -7,10 +7,10 @@ class WireTransfers extends resource_1.ApiResource {
7
7
  return this.resources.list({ type: WireTransfers.TYPE }, params, options);
8
8
  }
9
9
  async create(resource, params, options) {
10
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: WireTransfers.TYPE }), params, options);
10
+ return this.resources.create({ ...resource, type: WireTransfers.TYPE }, params, options);
11
11
  }
12
12
  async update(resource, params, options) {
13
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: WireTransfers.TYPE }), params, options);
13
+ return this.resources.update({ ...resource, type: WireTransfers.TYPE }, params, options);
14
14
  }
15
15
  async delete(id, options) {
16
16
  await this.resources.delete((typeof id === 'string') ? { id, type: WireTransfers.TYPE } : id, options);
package/lib/esm/client.js CHANGED
@@ -49,10 +49,9 @@ const handleError = (error) => {
49
49
  };
50
50
  class ApiClient {
51
51
  static create(options) {
52
- if (!(options === null || options === void 0 ? void 0 : options.organization))
53
- throw new Error("Undefined 'organization' parameter");
54
- if (!(options === null || options === void 0 ? void 0 : options.accessToken))
55
- throw new Error("Undefined 'accessToken' parameter");
52
+ for (const attr of config.client.requiredAttributes)
53
+ if (!options || !options[attr])
54
+ throw new SdkError({ message: `Undefined '${attr}' parameter` });
56
55
  return new ApiClient(options);
57
56
  }
58
57
  constructor(options) {
@@ -67,11 +66,16 @@ class ApiClient {
67
66
  httpAgent: options.httpAgent,
68
67
  httpsAgent: options.httpsAgent,
69
68
  };
70
- const axiosOptions = Object.assign({ baseURL: this.baseUrl, timeout: config.client.timeout, headers: {
69
+ const axiosOptions = {
70
+ baseURL: this.baseUrl,
71
+ timeout: config.client.timeout,
72
+ headers: {
71
73
  'Accept': 'application/vnd.api+json',
72
74
  'Content-Type': 'application/vnd.api+json',
73
75
  'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f"),
74
- } }, axiosConfig);
76
+ },
77
+ ...axiosConfig
78
+ };
75
79
  debug('axios options: %O', axiosOptions);
76
80
  __classPrivateFieldSet(this, _ApiClient_client, axios.create(axiosOptions), "f");
77
81
  this.interceptors = __classPrivateFieldGet(this, _ApiClient_client, "f").interceptors;
@@ -104,7 +108,7 @@ class ApiClient {
104
108
  const baseUrl = (options === null || options === void 0 ? void 0 : options.organization) ? baseURL(options.organization, options.domain) : undefined;
105
109
  const accessToken = (options === null || options === void 0 ? void 0 : options.accessToken) || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
106
110
  const headers = accessToken ? { 'Authorization': 'Bearer ' + accessToken } : undefined;
107
- const requestParams = Object.assign({ method, baseURL: baseUrl, url, data, headers }, options);
111
+ const requestParams = { method, baseURL: baseUrl, url, data, headers, ...options };
108
112
  debug('request params: %O', requestParams);
109
113
  // const start = Date.now()
110
114
  return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
@@ -6,6 +6,7 @@ declare const config: {
6
6
  };
7
7
  readonly client: {
8
8
  readonly timeout: 15000;
9
+ readonly requiredAttributes: readonly ["organization", "accessToken"];
9
10
  };
10
11
  };
11
12
  export default config;
package/lib/esm/config.js CHANGED
@@ -6,6 +6,7 @@ const config = {
6
6
  },
7
7
  client: {
8
8
  timeout: 15000,
9
+ requiredAttributes: ['organization', 'accessToken']
9
10
  }
10
11
  };
11
12
  export default config;
package/lib/esm/debug.js CHANGED
@@ -5,7 +5,6 @@ const debuggerFunction = (_pattern, ..._args) => {
5
5
  let debuggerFactory = (_namespace) => debuggerFunction;
6
6
  /* Try loading 'debug' module */
7
7
  try {
8
- // eslint-disable-next-line @typescript-eslint/no-var-requires
9
8
  const debugModule = require('debug');
10
9
  if (debugModule && (typeof debugModule === 'function'))
11
10
  debuggerFactory = debugModule;
package/lib/esm/error.js CHANGED
@@ -7,7 +7,6 @@ var ErrorType;
7
7
  ErrorType["CANCEL"] = "cancel";
8
8
  })(ErrorType || (ErrorType = {}));
9
9
  class SdkError extends Error {
10
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
11
10
  static isSdkError(error) {
12
11
  return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
13
12
  }
@@ -19,12 +18,11 @@ class SdkError extends Error {
19
18
  }
20
19
  SdkError.NAME = 'SdkError';
21
20
  class ApiError extends SdkError {
22
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
23
21
  static isApiError(error) {
24
22
  return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
25
23
  }
26
24
  constructor(error) {
27
- super(Object.assign(Object.assign({}, error), { type: ErrorType.RESPONSE }));
25
+ super({ ...error, type: ErrorType.RESPONSE });
28
26
  this.errors = [];
29
27
  this.name = ApiError.NAME; // this.constructor.name
30
28
  }
@@ -28,7 +28,11 @@ const denormalizeResource = (res, included) => {
28
28
  debug('denormalize resource: %O, %o', res, included || {});
29
29
  if (!res)
30
30
  return res;
31
- const resource = Object.assign({ id: res.id, type: res.type }, res.attributes);
31
+ const resource = {
32
+ id: res.id,
33
+ type: res.type,
34
+ ...res.attributes,
35
+ };
32
36
  if (res.relationships)
33
37
  Object.keys(res.relationships).forEach(key => {
34
38
  const rel = res.relationships[key].data;
@@ -55,7 +55,7 @@ class ResourceAdapter {
55
55
  const queryParams = generateQueryStringParams(params, resource);
56
56
  if (options === null || options === void 0 ? void 0 : options.params)
57
57
  Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
58
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
58
+ const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
59
59
  const r = denormalize(res);
60
60
  return r;
61
61
  }
@@ -64,7 +64,7 @@ class ResourceAdapter {
64
64
  const queryParams = generateQueryStringParams(params, resource);
65
65
  if (options === null || options === void 0 ? void 0 : options.params)
66
66
  Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
67
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}/${resource.id}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
67
+ const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}/${resource.id}`, undefined, { ...options, params: queryParams });
68
68
  const r = denormalize(res);
69
69
  return r;
70
70
  }
@@ -74,7 +74,7 @@ class ResourceAdapter {
74
74
  const queryParams = generateQueryStringParams(params, resource);
75
75
  if (options === null || options === void 0 ? void 0 : options.params)
76
76
  Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
77
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
77
+ const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
78
78
  const r = denormalize(res);
79
79
  const meta = {
80
80
  pageCount: Number((_a = res.meta) === null || _a === void 0 ? void 0 : _a.page_count),
@@ -90,7 +90,7 @@ class ResourceAdapter {
90
90
  if (options === null || options === void 0 ? void 0 : options.params)
91
91
  Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
92
92
  const data = normalize(resource);
93
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('post', resource.type, data, Object.assign(Object.assign({}, options), { params: queryParams }));
93
+ const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('post', resource.type, data, { ...options, params: queryParams });
94
94
  const r = denormalize(res);
95
95
  return r;
96
96
  }
@@ -100,7 +100,7 @@ class ResourceAdapter {
100
100
  if (options === null || options === void 0 ? void 0 : options.params)
101
101
  Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
102
102
  const data = normalize(resource);
103
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('patch', `${resource.type}/${resource.id}`, data, Object.assign(Object.assign({}, options), { params: queryParams }));
103
+ const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('patch', `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
104
104
  const r = denormalize(res);
105
105
  return r;
106
106
  }
@@ -114,7 +114,7 @@ class ResourceAdapter {
114
114
  const queryParams = generateQueryStringParams(params, resource);
115
115
  if (options === null || options === void 0 ? void 0 : options.params)
116
116
  Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
117
- const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', path, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
117
+ const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', path, undefined, { ...options, params: queryParams });
118
118
  const r = denormalize(res);
119
119
  if (Array.isArray(r)) {
120
120
  const p = params;
@@ -138,7 +138,7 @@ class ApiResourceBase {
138
138
  }
139
139
  // reference, reference_origin and metadata attributes are always updatable
140
140
  async update(resource, params, options) {
141
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: this.type() }), params, options);
141
+ return this.resources.update({ ...resource, type: this.type() }, params, options);
142
142
  }
143
143
  async count(filter, options) {
144
144
  const params = { filters: isParamsList(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
@@ -5,10 +5,10 @@ class Addresses extends ApiResource {
5
5
  return this.resources.list({ type: Addresses.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: Addresses.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: Addresses.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: Addresses.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: Addresses.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: Addresses.TYPE } : id, options);
@@ -5,10 +5,10 @@ class Adjustments extends ApiResource {
5
5
  return this.resources.list({ type: Adjustments.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: Adjustments.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: Adjustments.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: Adjustments.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: Adjustments.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: Adjustments.TYPE } : id, options);
@@ -5,10 +5,10 @@ class AdyenGateways extends ApiResource {
5
5
  return this.resources.list({ type: AdyenGateways.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: AdyenGateways.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: AdyenGateways.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: AdyenGateways.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: AdyenGateways.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: AdyenGateways.TYPE } : id, options);
@@ -5,10 +5,10 @@ class AdyenPayments extends ApiResource {
5
5
  return this.resources.list({ type: AdyenPayments.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: AdyenPayments.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: AdyenPayments.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: AdyenPayments.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: AdyenPayments.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: AdyenPayments.TYPE } : id, options);
@@ -5,10 +5,10 @@ class Attachments extends ApiResource {
5
5
  return this.resources.list({ type: Attachments.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: Attachments.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: Attachments.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: Attachments.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: Attachments.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: Attachments.TYPE } : id, options);
@@ -5,7 +5,7 @@ class Authorizations extends ApiResource {
5
5
  return this.resources.list({ type: Authorizations.TYPE }, params, options);
6
6
  }
7
7
  async update(resource, params, options) {
8
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: Authorizations.TYPE }), params, options);
8
+ return this.resources.update({ ...resource, type: Authorizations.TYPE }, params, options);
9
9
  }
10
10
  async order(authorizationId, params, options) {
11
11
  const _authorizationId = authorizationId.id || authorizationId;
@@ -5,10 +5,10 @@ class AvalaraAccounts extends ApiResource {
5
5
  return this.resources.list({ type: AvalaraAccounts.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: AvalaraAccounts.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: AvalaraAccounts.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: AvalaraAccounts.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: AvalaraAccounts.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: AvalaraAccounts.TYPE } : id, options);
@@ -5,10 +5,10 @@ class AxerveGateways extends ApiResource {
5
5
  return this.resources.list({ type: AxerveGateways.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: AxerveGateways.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: AxerveGateways.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: AxerveGateways.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: AxerveGateways.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: AxerveGateways.TYPE } : id, options);
@@ -5,10 +5,10 @@ class AxervePayments extends ApiResource {
5
5
  return this.resources.list({ type: AxervePayments.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: AxervePayments.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: AxervePayments.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: AxervePayments.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: AxervePayments.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: AxervePayments.TYPE } : id, options);
@@ -5,10 +5,10 @@ class BillingInfoValidationRules extends ApiResource {
5
5
  return this.resources.list({ type: BillingInfoValidationRules.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: BillingInfoValidationRules.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: BillingInfoValidationRules.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: BillingInfoValidationRules.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: BillingInfoValidationRules.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: BillingInfoValidationRules.TYPE } : id, options);
@@ -5,10 +5,10 @@ class BingGeocoders extends ApiResource {
5
5
  return this.resources.list({ type: BingGeocoders.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: BingGeocoders.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: BingGeocoders.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: BingGeocoders.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: BingGeocoders.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: BingGeocoders.TYPE } : id, options);
@@ -5,10 +5,10 @@ class BraintreeGateways extends ApiResource {
5
5
  return this.resources.list({ type: BraintreeGateways.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: BraintreeGateways.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: BraintreeGateways.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: BraintreeGateways.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: BraintreeGateways.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: BraintreeGateways.TYPE } : id, options);
@@ -5,10 +5,10 @@ class BraintreePayments extends ApiResource {
5
5
  return this.resources.list({ type: BraintreePayments.TYPE }, params, options);
6
6
  }
7
7
  async create(resource, params, options) {
8
- return this.resources.create(Object.assign(Object.assign({}, resource), { type: BraintreePayments.TYPE }), params, options);
8
+ return this.resources.create({ ...resource, type: BraintreePayments.TYPE }, params, options);
9
9
  }
10
10
  async update(resource, params, options) {
11
- return this.resources.update(Object.assign(Object.assign({}, resource), { type: BraintreePayments.TYPE }), params, options);
11
+ return this.resources.update({ ...resource, type: BraintreePayments.TYPE }, params, options);
12
12
  }
13
13
  async delete(id, options) {
14
14
  await this.resources.delete((typeof id === 'string') ? { id, type: BraintreePayments.TYPE } : id, options);