@commercelayer/sdk 4.35.0 → 4.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/api.d.ts +37 -0
- package/lib/cjs/api.js +0 -13
- package/lib/cjs/client.d.ts +15 -8
- package/lib/cjs/client.js +40 -40
- package/lib/cjs/commercelayer.d.ts +3 -4
- package/lib/cjs/commercelayer.js +7 -3
- package/lib/cjs/common.d.ts +1 -0
- package/lib/cjs/common.js +11 -2
- package/lib/cjs/config.d.ts +1 -0
- package/lib/cjs/config.js +3 -0
- package/lib/cjs/debug.js +0 -4
- package/lib/cjs/error.d.ts +3 -1
- package/lib/cjs/error.js +40 -7
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +0 -16
- package/lib/cjs/interceptor.d.ts +6 -2
- package/lib/cjs/jsonapi.js +9 -2
- package/lib/cjs/query.d.ts +9 -15
- package/lib/cjs/query.js +3 -2
- package/lib/cjs/resource.d.ts +30 -20
- package/lib/cjs/resource.js +40 -9
- package/lib/cjs/resources/addresses.d.ts +74 -73
- package/lib/cjs/resources/addresses.js +3 -11
- package/lib/cjs/resources/adjustments.d.ts +20 -19
- package/lib/cjs/resources/adjustments.js +3 -11
- package/lib/cjs/resources/adyen_gateways.d.ts +35 -34
- package/lib/cjs/resources/adyen_gateways.js +3 -11
- package/lib/cjs/resources/adyen_payments.d.ts +29 -27
- package/lib/cjs/resources/adyen_payments.js +6 -11
- package/lib/cjs/resources/application.d.ts +14 -13
- package/lib/cjs/resources/application.js +1 -6
- package/lib/cjs/resources/attachments.d.ts +81 -80
- package/lib/cjs/resources/attachments.js +3 -11
- package/lib/cjs/resources/authorizations.d.ts +47 -43
- package/lib/cjs/resources/authorizations.js +10 -9
- package/lib/cjs/resources/avalara_accounts.d.ts +32 -31
- package/lib/cjs/resources/avalara_accounts.js +3 -11
- package/lib/cjs/resources/axerve_gateways.d.ts +24 -23
- package/lib/cjs/resources/axerve_gateways.js +3 -11
- package/lib/cjs/resources/axerve_payments.d.ts +28 -26
- package/lib/cjs/resources/axerve_payments.js +6 -11
- package/lib/cjs/resources/billing_info_validation_rules.d.ts +17 -16
- package/lib/cjs/resources/billing_info_validation_rules.js +3 -11
- package/lib/cjs/resources/bing_geocoders.d.ts +16 -15
- package/lib/cjs/resources/bing_geocoders.js +3 -11
- package/lib/cjs/resources/braintree_gateways.d.ts +34 -33
- package/lib/cjs/resources/braintree_gateways.js +3 -11
- package/lib/cjs/resources/braintree_payments.d.ts +30 -29
- package/lib/cjs/resources/braintree_payments.js +3 -11
- package/lib/cjs/resources/bundles.d.ts +57 -54
- package/lib/cjs/resources/bundles.js +9 -11
- package/lib/cjs/resources/captures.d.ts +37 -34
- package/lib/cjs/resources/captures.js +7 -9
- package/lib/cjs/resources/carrier_accounts.d.ts +16 -15
- package/lib/cjs/resources/carrier_accounts.js +0 -8
- package/lib/cjs/resources/checkout_com_gateways.d.ts +25 -24
- package/lib/cjs/resources/checkout_com_gateways.js +3 -11
- package/lib/cjs/resources/checkout_com_payments.d.ts +41 -38
- package/lib/cjs/resources/checkout_com_payments.js +9 -11
- package/lib/cjs/resources/cleanups.d.ts +24 -23
- package/lib/cjs/resources/cleanups.js +2 -10
- package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +31 -30
- package/lib/cjs/resources/coupon_codes_promotion_rules.js +3 -11
- package/lib/cjs/resources/coupon_recipients.d.ts +26 -25
- package/lib/cjs/resources/coupon_recipients.js +3 -11
- package/lib/cjs/resources/coupons.d.ts +39 -38
- package/lib/cjs/resources/coupons.js +3 -11
- package/lib/cjs/resources/customer_addresses.d.ts +23 -22
- package/lib/cjs/resources/customer_addresses.js +3 -11
- package/lib/cjs/resources/customer_groups.d.ts +17 -16
- package/lib/cjs/resources/customer_groups.js +3 -11
- package/lib/cjs/resources/customer_password_resets.d.ts +19 -17
- package/lib/cjs/resources/customer_password_resets.js +6 -11
- package/lib/cjs/resources/customer_payment_sources.d.ts +37 -36
- package/lib/cjs/resources/customer_payment_sources.js +3 -11
- package/lib/cjs/resources/customer_subscriptions.d.ts +15 -14
- package/lib/cjs/resources/customer_subscriptions.js +3 -11
- package/lib/cjs/resources/customers.d.ts +37 -36
- package/lib/cjs/resources/customers.js +3 -11
- package/lib/cjs/resources/delivery_lead_times.d.ts +27 -26
- package/lib/cjs/resources/delivery_lead_times.js +3 -11
- package/lib/cjs/resources/event_callbacks.d.ts +15 -14
- package/lib/cjs/resources/event_callbacks.js +0 -8
- package/lib/cjs/resources/events.d.ts +13 -12
- package/lib/cjs/resources/events.js +0 -8
- package/lib/cjs/resources/exports.d.ts +27 -26
- package/lib/cjs/resources/exports.js +2 -10
- package/lib/cjs/resources/external_gateways.d.ts +32 -31
- package/lib/cjs/resources/external_gateways.js +3 -11
- package/lib/cjs/resources/external_payments.d.ts +23 -22
- package/lib/cjs/resources/external_payments.js +3 -11
- package/lib/cjs/resources/external_promotions.d.ts +66 -65
- package/lib/cjs/resources/external_promotions.js +3 -11
- package/lib/cjs/resources/external_tax_calculators.d.ts +19 -18
- package/lib/cjs/resources/external_tax_calculators.js +3 -11
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +67 -66
- package/lib/cjs/resources/fixed_amount_promotions.js +3 -11
- package/lib/cjs/resources/fixed_price_promotions.d.ts +71 -70
- package/lib/cjs/resources/fixed_price_promotions.js +3 -11
- package/lib/cjs/resources/free_gift_promotions.d.ts +70 -69
- package/lib/cjs/resources/free_gift_promotions.js +3 -11
- package/lib/cjs/resources/free_shipping_promotions.d.ts +63 -62
- package/lib/cjs/resources/free_shipping_promotions.js +3 -11
- package/lib/cjs/resources/geocoders.d.ts +13 -12
- package/lib/cjs/resources/geocoders.js +0 -8
- package/lib/cjs/resources/gift_card_recipients.d.ts +26 -25
- package/lib/cjs/resources/gift_card_recipients.js +3 -11
- package/lib/cjs/resources/gift_cards.d.ts +71 -66
- package/lib/cjs/resources/gift_cards.js +15 -11
- package/lib/cjs/resources/google_geocoders.d.ts +16 -15
- package/lib/cjs/resources/google_geocoders.js +3 -11
- package/lib/cjs/resources/imports.d.ts +32 -31
- package/lib/cjs/resources/imports.js +2 -10
- package/lib/cjs/resources/in_stock_subscriptions.d.ts +38 -35
- package/lib/cjs/resources/in_stock_subscriptions.js +9 -11
- package/lib/cjs/resources/inventory_models.d.ts +26 -25
- package/lib/cjs/resources/inventory_models.js +3 -11
- package/lib/cjs/resources/inventory_return_locations.d.ts +22 -21
- package/lib/cjs/resources/inventory_return_locations.js +3 -11
- package/lib/cjs/resources/inventory_stock_locations.d.ts +25 -24
- package/lib/cjs/resources/inventory_stock_locations.js +3 -11
- package/lib/cjs/resources/klarna_gateways.d.ts +23 -22
- package/lib/cjs/resources/klarna_gateways.js +3 -11
- package/lib/cjs/resources/klarna_payments.d.ts +29 -27
- package/lib/cjs/resources/klarna_payments.js +6 -11
- package/lib/cjs/resources/line_item_options.d.ts +41 -40
- package/lib/cjs/resources/line_item_options.js +3 -11
- package/lib/cjs/resources/line_items.d.ts +96 -93
- package/lib/cjs/resources/line_items.js +9 -11
- package/lib/cjs/resources/manual_gateways.d.ts +15 -14
- package/lib/cjs/resources/manual_gateways.js +3 -11
- package/lib/cjs/resources/manual_tax_calculators.d.ts +21 -20
- package/lib/cjs/resources/manual_tax_calculators.js +3 -11
- package/lib/cjs/resources/markets.d.ts +62 -59
- package/lib/cjs/resources/markets.js +9 -11
- package/lib/cjs/resources/merchants.d.ts +19 -18
- package/lib/cjs/resources/merchants.js +3 -11
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +34 -33
- package/lib/cjs/resources/order_amount_promotion_rules.js +3 -11
- package/lib/cjs/resources/order_copies.d.ts +29 -28
- package/lib/cjs/resources/order_copies.js +3 -11
- package/lib/cjs/resources/order_factories.d.ts +21 -20
- package/lib/cjs/resources/order_factories.js +0 -8
- package/lib/cjs/resources/order_subscription_items.d.ts +40 -39
- package/lib/cjs/resources/order_subscription_items.js +3 -11
- package/lib/cjs/resources/order_subscriptions.d.ts +55 -51
- package/lib/cjs/resources/order_subscriptions.js +12 -11
- package/lib/cjs/resources/order_validation_rules.d.ts +13 -12
- package/lib/cjs/resources/order_validation_rules.js +0 -8
- package/lib/cjs/resources/orders.d.ts +263 -235
- package/lib/cjs/resources/orders.js +84 -11
- package/lib/cjs/resources/organization.d.ts +25 -24
- package/lib/cjs/resources/organization.js +1 -6
- package/lib/cjs/resources/packages.d.ts +31 -30
- package/lib/cjs/resources/packages.js +3 -11
- package/lib/cjs/resources/parcel_line_items.d.ts +23 -22
- package/lib/cjs/resources/parcel_line_items.js +3 -11
- package/lib/cjs/resources/parcels.d.ts +94 -93
- package/lib/cjs/resources/parcels.js +3 -11
- package/lib/cjs/resources/payment_gateways.d.ts +13 -12
- package/lib/cjs/resources/payment_gateways.js +0 -8
- package/lib/cjs/resources/payment_methods.d.ts +51 -48
- package/lib/cjs/resources/payment_methods.js +9 -11
- package/lib/cjs/resources/paypal_gateways.d.ts +18 -17
- package/lib/cjs/resources/paypal_gateways.js +3 -11
- package/lib/cjs/resources/paypal_payments.d.ts +32 -31
- package/lib/cjs/resources/paypal_payments.js +3 -11
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +70 -69
- package/lib/cjs/resources/percentage_discount_promotions.js +3 -11
- package/lib/cjs/resources/price_frequency_tiers.d.ts +27 -26
- package/lib/cjs/resources/price_frequency_tiers.js +3 -11
- package/lib/cjs/resources/price_lists.d.ts +21 -20
- package/lib/cjs/resources/price_lists.js +3 -11
- package/lib/cjs/resources/price_tiers.d.ts +18 -17
- package/lib/cjs/resources/price_tiers.js +0 -8
- package/lib/cjs/resources/price_volume_tiers.d.ts +27 -26
- package/lib/cjs/resources/price_volume_tiers.js +3 -11
- package/lib/cjs/resources/prices.d.ts +40 -39
- package/lib/cjs/resources/prices.js +3 -11
- package/lib/cjs/resources/promotion_rules.d.ts +12 -11
- package/lib/cjs/resources/promotion_rules.js +0 -8
- package/lib/cjs/resources/promotions.d.ts +28 -27
- package/lib/cjs/resources/promotions.js +0 -8
- package/lib/cjs/resources/recurring_order_copies.d.ts +29 -28
- package/lib/cjs/resources/recurring_order_copies.js +3 -11
- package/lib/cjs/resources/refunds.d.ts +26 -25
- package/lib/cjs/resources/refunds.js +0 -8
- package/lib/cjs/resources/reserved_stocks.d.ts +14 -13
- package/lib/cjs/resources/reserved_stocks.js +0 -8
- package/lib/cjs/resources/return_line_items.d.ts +29 -27
- package/lib/cjs/resources/return_line_items.js +6 -11
- package/lib/cjs/resources/returns.d.ts +59 -49
- package/lib/cjs/resources/returns.js +30 -11
- package/lib/cjs/resources/satispay_gateways.d.ts +23 -22
- package/lib/cjs/resources/satispay_gateways.js +3 -11
- package/lib/cjs/resources/satispay_payments.d.ts +31 -29
- package/lib/cjs/resources/satispay_payments.js +6 -11
- package/lib/cjs/resources/shipments.d.ts +65 -57
- package/lib/cjs/resources/shipments.js +22 -9
- package/lib/cjs/resources/shipping_categories.d.ts +16 -15
- package/lib/cjs/resources/shipping_categories.js +3 -11
- package/lib/cjs/resources/shipping_method_tiers.d.ts +18 -17
- package/lib/cjs/resources/shipping_method_tiers.js +0 -8
- package/lib/cjs/resources/shipping_methods.d.ts +80 -77
- package/lib/cjs/resources/shipping_methods.js +9 -11
- package/lib/cjs/resources/shipping_weight_tiers.d.ts +26 -25
- package/lib/cjs/resources/shipping_weight_tiers.js +3 -11
- package/lib/cjs/resources/shipping_zones.d.ts +33 -32
- package/lib/cjs/resources/shipping_zones.js +3 -11
- package/lib/cjs/resources/sku_list_items.d.ts +27 -26
- package/lib/cjs/resources/sku_list_items.js +3 -11
- package/lib/cjs/resources/sku_list_promotion_rules.d.ts +38 -37
- package/lib/cjs/resources/sku_list_promotion_rules.js +3 -11
- package/lib/cjs/resources/sku_lists.d.ts +36 -35
- package/lib/cjs/resources/sku_lists.js +3 -11
- package/lib/cjs/resources/sku_options.d.ts +44 -43
- package/lib/cjs/resources/sku_options.js +3 -11
- package/lib/cjs/resources/skus.d.ts +57 -56
- package/lib/cjs/resources/skus.js +3 -11
- package/lib/cjs/resources/stock_items.d.ts +29 -28
- package/lib/cjs/resources/stock_items.js +3 -11
- package/lib/cjs/resources/stock_line_items.d.ts +18 -17
- package/lib/cjs/resources/stock_line_items.js +0 -8
- package/lib/cjs/resources/stock_locations.d.ts +30 -29
- package/lib/cjs/resources/stock_locations.js +3 -11
- package/lib/cjs/resources/stock_reservations.d.ts +18 -17
- package/lib/cjs/resources/stock_reservations.js +0 -8
- package/lib/cjs/resources/stock_transfers.d.ts +48 -42
- package/lib/cjs/resources/stock_transfers.js +18 -11
- package/lib/cjs/resources/stripe_gateways.d.ts +23 -22
- package/lib/cjs/resources/stripe_gateways.js +3 -11
- package/lib/cjs/resources/stripe_payments.d.ts +35 -32
- package/lib/cjs/resources/stripe_payments.js +9 -11
- package/lib/cjs/resources/subscription_models.d.ts +27 -26
- package/lib/cjs/resources/subscription_models.js +3 -11
- package/lib/cjs/resources/tags.d.ts +13 -12
- package/lib/cjs/resources/tags.js +3 -11
- package/lib/cjs/resources/tax_calculators.d.ts +14 -13
- package/lib/cjs/resources/tax_calculators.js +0 -8
- package/lib/cjs/resources/tax_categories.d.ts +31 -30
- package/lib/cjs/resources/tax_categories.js +3 -11
- package/lib/cjs/resources/tax_rules.d.ts +52 -51
- package/lib/cjs/resources/tax_rules.js +3 -11
- package/lib/cjs/resources/taxjar_accounts.d.ts +22 -21
- package/lib/cjs/resources/taxjar_accounts.js +3 -11
- package/lib/cjs/resources/transactions.d.ts +24 -23
- package/lib/cjs/resources/transactions.js +0 -8
- package/lib/cjs/resources/versions.d.ts +14 -14
- package/lib/cjs/resources/versions.js +0 -8
- package/lib/cjs/resources/voids.d.ts +26 -25
- package/lib/cjs/resources/voids.js +0 -8
- package/lib/cjs/resources/webhooks.d.ts +28 -26
- package/lib/cjs/resources/webhooks.js +6 -11
- package/lib/cjs/resources/wire_transfers.d.ts +17 -16
- package/lib/cjs/resources/wire_transfers.js +3 -11
- package/lib/cjs/static.d.ts +1 -1
- package/lib/cjs/util.d.ts +1 -3
- package/lib/esm/api.d.ts +37 -0
- package/lib/esm/api.js +0 -13
- package/lib/esm/client.d.ts +15 -8
- package/lib/esm/client.js +40 -40
- package/lib/esm/commercelayer.d.ts +3 -4
- package/lib/esm/commercelayer.js +7 -3
- package/lib/esm/common.d.ts +1 -0
- package/lib/esm/common.js +11 -2
- package/lib/esm/config.d.ts +1 -0
- package/lib/esm/config.js +3 -0
- package/lib/esm/debug.js +0 -4
- package/lib/esm/error.d.ts +3 -1
- package/lib/esm/error.js +35 -5
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +0 -2
- package/lib/esm/interceptor.d.ts +6 -2
- package/lib/esm/jsonapi.js +9 -2
- package/lib/esm/query.d.ts +9 -15
- package/lib/esm/query.js +2 -2
- package/lib/esm/resource.d.ts +30 -20
- package/lib/esm/resource.js +40 -10
- package/lib/esm/resources/addresses.d.ts +74 -73
- package/lib/esm/resources/addresses.js +3 -11
- package/lib/esm/resources/adjustments.d.ts +20 -19
- package/lib/esm/resources/adjustments.js +3 -11
- package/lib/esm/resources/adyen_gateways.d.ts +35 -34
- package/lib/esm/resources/adyen_gateways.js +3 -11
- package/lib/esm/resources/adyen_payments.d.ts +29 -27
- package/lib/esm/resources/adyen_payments.js +6 -11
- package/lib/esm/resources/application.d.ts +14 -13
- package/lib/esm/resources/application.js +2 -7
- package/lib/esm/resources/attachments.d.ts +81 -80
- package/lib/esm/resources/attachments.js +3 -11
- package/lib/esm/resources/authorizations.d.ts +47 -43
- package/lib/esm/resources/authorizations.js +10 -9
- package/lib/esm/resources/avalara_accounts.d.ts +32 -31
- package/lib/esm/resources/avalara_accounts.js +3 -11
- package/lib/esm/resources/axerve_gateways.d.ts +24 -23
- package/lib/esm/resources/axerve_gateways.js +3 -11
- package/lib/esm/resources/axerve_payments.d.ts +28 -26
- package/lib/esm/resources/axerve_payments.js +6 -11
- package/lib/esm/resources/billing_info_validation_rules.d.ts +17 -16
- package/lib/esm/resources/billing_info_validation_rules.js +3 -11
- package/lib/esm/resources/bing_geocoders.d.ts +16 -15
- package/lib/esm/resources/bing_geocoders.js +3 -11
- package/lib/esm/resources/braintree_gateways.d.ts +34 -33
- package/lib/esm/resources/braintree_gateways.js +3 -11
- package/lib/esm/resources/braintree_payments.d.ts +30 -29
- package/lib/esm/resources/braintree_payments.js +3 -11
- package/lib/esm/resources/bundles.d.ts +57 -54
- package/lib/esm/resources/bundles.js +9 -11
- package/lib/esm/resources/captures.d.ts +37 -34
- package/lib/esm/resources/captures.js +7 -9
- package/lib/esm/resources/carrier_accounts.d.ts +16 -15
- package/lib/esm/resources/carrier_accounts.js +0 -8
- package/lib/esm/resources/checkout_com_gateways.d.ts +25 -24
- package/lib/esm/resources/checkout_com_gateways.js +3 -11
- package/lib/esm/resources/checkout_com_payments.d.ts +41 -38
- package/lib/esm/resources/checkout_com_payments.js +9 -11
- package/lib/esm/resources/cleanups.d.ts +24 -23
- package/lib/esm/resources/cleanups.js +2 -10
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +31 -30
- package/lib/esm/resources/coupon_codes_promotion_rules.js +3 -11
- package/lib/esm/resources/coupon_recipients.d.ts +26 -25
- package/lib/esm/resources/coupon_recipients.js +3 -11
- package/lib/esm/resources/coupons.d.ts +39 -38
- package/lib/esm/resources/coupons.js +3 -11
- package/lib/esm/resources/customer_addresses.d.ts +23 -22
- package/lib/esm/resources/customer_addresses.js +3 -11
- package/lib/esm/resources/customer_groups.d.ts +17 -16
- package/lib/esm/resources/customer_groups.js +3 -11
- package/lib/esm/resources/customer_password_resets.d.ts +19 -17
- package/lib/esm/resources/customer_password_resets.js +6 -11
- package/lib/esm/resources/customer_payment_sources.d.ts +37 -36
- package/lib/esm/resources/customer_payment_sources.js +3 -11
- package/lib/esm/resources/customer_subscriptions.d.ts +15 -14
- package/lib/esm/resources/customer_subscriptions.js +3 -11
- package/lib/esm/resources/customers.d.ts +37 -36
- package/lib/esm/resources/customers.js +3 -11
- package/lib/esm/resources/delivery_lead_times.d.ts +27 -26
- package/lib/esm/resources/delivery_lead_times.js +3 -11
- package/lib/esm/resources/event_callbacks.d.ts +15 -14
- package/lib/esm/resources/event_callbacks.js +0 -8
- package/lib/esm/resources/events.d.ts +13 -12
- package/lib/esm/resources/events.js +0 -8
- package/lib/esm/resources/exports.d.ts +27 -26
- package/lib/esm/resources/exports.js +2 -10
- package/lib/esm/resources/external_gateways.d.ts +32 -31
- package/lib/esm/resources/external_gateways.js +3 -11
- package/lib/esm/resources/external_payments.d.ts +23 -22
- package/lib/esm/resources/external_payments.js +3 -11
- package/lib/esm/resources/external_promotions.d.ts +66 -65
- package/lib/esm/resources/external_promotions.js +3 -11
- package/lib/esm/resources/external_tax_calculators.d.ts +19 -18
- package/lib/esm/resources/external_tax_calculators.js +3 -11
- package/lib/esm/resources/fixed_amount_promotions.d.ts +67 -66
- package/lib/esm/resources/fixed_amount_promotions.js +3 -11
- package/lib/esm/resources/fixed_price_promotions.d.ts +71 -70
- package/lib/esm/resources/fixed_price_promotions.js +3 -11
- package/lib/esm/resources/free_gift_promotions.d.ts +70 -69
- package/lib/esm/resources/free_gift_promotions.js +3 -11
- package/lib/esm/resources/free_shipping_promotions.d.ts +63 -62
- package/lib/esm/resources/free_shipping_promotions.js +3 -11
- package/lib/esm/resources/geocoders.d.ts +13 -12
- package/lib/esm/resources/geocoders.js +0 -8
- package/lib/esm/resources/gift_card_recipients.d.ts +26 -25
- package/lib/esm/resources/gift_card_recipients.js +3 -11
- package/lib/esm/resources/gift_cards.d.ts +71 -66
- package/lib/esm/resources/gift_cards.js +15 -11
- package/lib/esm/resources/google_geocoders.d.ts +16 -15
- package/lib/esm/resources/google_geocoders.js +3 -11
- package/lib/esm/resources/imports.d.ts +32 -31
- package/lib/esm/resources/imports.js +2 -10
- package/lib/esm/resources/in_stock_subscriptions.d.ts +38 -35
- package/lib/esm/resources/in_stock_subscriptions.js +9 -11
- package/lib/esm/resources/inventory_models.d.ts +26 -25
- package/lib/esm/resources/inventory_models.js +3 -11
- package/lib/esm/resources/inventory_return_locations.d.ts +22 -21
- package/lib/esm/resources/inventory_return_locations.js +3 -11
- package/lib/esm/resources/inventory_stock_locations.d.ts +25 -24
- package/lib/esm/resources/inventory_stock_locations.js +3 -11
- package/lib/esm/resources/klarna_gateways.d.ts +23 -22
- package/lib/esm/resources/klarna_gateways.js +3 -11
- package/lib/esm/resources/klarna_payments.d.ts +29 -27
- package/lib/esm/resources/klarna_payments.js +6 -11
- package/lib/esm/resources/line_item_options.d.ts +41 -40
- package/lib/esm/resources/line_item_options.js +3 -11
- package/lib/esm/resources/line_items.d.ts +96 -93
- package/lib/esm/resources/line_items.js +9 -11
- package/lib/esm/resources/manual_gateways.d.ts +15 -14
- package/lib/esm/resources/manual_gateways.js +3 -11
- package/lib/esm/resources/manual_tax_calculators.d.ts +21 -20
- package/lib/esm/resources/manual_tax_calculators.js +3 -11
- package/lib/esm/resources/markets.d.ts +62 -59
- package/lib/esm/resources/markets.js +9 -11
- package/lib/esm/resources/merchants.d.ts +19 -18
- package/lib/esm/resources/merchants.js +3 -11
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +34 -33
- package/lib/esm/resources/order_amount_promotion_rules.js +3 -11
- package/lib/esm/resources/order_copies.d.ts +29 -28
- package/lib/esm/resources/order_copies.js +3 -11
- package/lib/esm/resources/order_factories.d.ts +21 -20
- package/lib/esm/resources/order_factories.js +0 -8
- package/lib/esm/resources/order_subscription_items.d.ts +40 -39
- package/lib/esm/resources/order_subscription_items.js +3 -11
- package/lib/esm/resources/order_subscriptions.d.ts +55 -51
- package/lib/esm/resources/order_subscriptions.js +12 -11
- package/lib/esm/resources/order_validation_rules.d.ts +13 -12
- package/lib/esm/resources/order_validation_rules.js +0 -8
- package/lib/esm/resources/orders.d.ts +263 -235
- package/lib/esm/resources/orders.js +84 -11
- package/lib/esm/resources/organization.d.ts +25 -24
- package/lib/esm/resources/organization.js +2 -7
- package/lib/esm/resources/packages.d.ts +31 -30
- package/lib/esm/resources/packages.js +3 -11
- package/lib/esm/resources/parcel_line_items.d.ts +23 -22
- package/lib/esm/resources/parcel_line_items.js +3 -11
- package/lib/esm/resources/parcels.d.ts +94 -93
- package/lib/esm/resources/parcels.js +3 -11
- package/lib/esm/resources/payment_gateways.d.ts +13 -12
- package/lib/esm/resources/payment_gateways.js +0 -8
- package/lib/esm/resources/payment_methods.d.ts +51 -48
- package/lib/esm/resources/payment_methods.js +9 -11
- package/lib/esm/resources/paypal_gateways.d.ts +18 -17
- package/lib/esm/resources/paypal_gateways.js +3 -11
- package/lib/esm/resources/paypal_payments.d.ts +32 -31
- package/lib/esm/resources/paypal_payments.js +3 -11
- package/lib/esm/resources/percentage_discount_promotions.d.ts +70 -69
- package/lib/esm/resources/percentage_discount_promotions.js +3 -11
- package/lib/esm/resources/price_frequency_tiers.d.ts +27 -26
- package/lib/esm/resources/price_frequency_tiers.js +3 -11
- package/lib/esm/resources/price_lists.d.ts +21 -20
- package/lib/esm/resources/price_lists.js +3 -11
- package/lib/esm/resources/price_tiers.d.ts +18 -17
- package/lib/esm/resources/price_tiers.js +0 -8
- package/lib/esm/resources/price_volume_tiers.d.ts +27 -26
- package/lib/esm/resources/price_volume_tiers.js +3 -11
- package/lib/esm/resources/prices.d.ts +40 -39
- package/lib/esm/resources/prices.js +3 -11
- package/lib/esm/resources/promotion_rules.d.ts +12 -11
- package/lib/esm/resources/promotion_rules.js +0 -8
- package/lib/esm/resources/promotions.d.ts +28 -27
- package/lib/esm/resources/promotions.js +0 -8
- package/lib/esm/resources/recurring_order_copies.d.ts +29 -28
- package/lib/esm/resources/recurring_order_copies.js +3 -11
- package/lib/esm/resources/refunds.d.ts +26 -25
- package/lib/esm/resources/refunds.js +0 -8
- package/lib/esm/resources/reserved_stocks.d.ts +14 -13
- package/lib/esm/resources/reserved_stocks.js +0 -8
- package/lib/esm/resources/return_line_items.d.ts +29 -27
- package/lib/esm/resources/return_line_items.js +6 -11
- package/lib/esm/resources/returns.d.ts +59 -49
- package/lib/esm/resources/returns.js +30 -11
- package/lib/esm/resources/satispay_gateways.d.ts +23 -22
- package/lib/esm/resources/satispay_gateways.js +3 -11
- package/lib/esm/resources/satispay_payments.d.ts +31 -29
- package/lib/esm/resources/satispay_payments.js +6 -11
- package/lib/esm/resources/shipments.d.ts +65 -57
- package/lib/esm/resources/shipments.js +22 -9
- package/lib/esm/resources/shipping_categories.d.ts +16 -15
- package/lib/esm/resources/shipping_categories.js +3 -11
- package/lib/esm/resources/shipping_method_tiers.d.ts +18 -17
- package/lib/esm/resources/shipping_method_tiers.js +0 -8
- package/lib/esm/resources/shipping_methods.d.ts +80 -77
- package/lib/esm/resources/shipping_methods.js +9 -11
- package/lib/esm/resources/shipping_weight_tiers.d.ts +26 -25
- package/lib/esm/resources/shipping_weight_tiers.js +3 -11
- package/lib/esm/resources/shipping_zones.d.ts +33 -32
- package/lib/esm/resources/shipping_zones.js +3 -11
- package/lib/esm/resources/sku_list_items.d.ts +27 -26
- package/lib/esm/resources/sku_list_items.js +3 -11
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +38 -37
- package/lib/esm/resources/sku_list_promotion_rules.js +3 -11
- package/lib/esm/resources/sku_lists.d.ts +36 -35
- package/lib/esm/resources/sku_lists.js +3 -11
- package/lib/esm/resources/sku_options.d.ts +44 -43
- package/lib/esm/resources/sku_options.js +3 -11
- package/lib/esm/resources/skus.d.ts +57 -56
- package/lib/esm/resources/skus.js +3 -11
- package/lib/esm/resources/stock_items.d.ts +29 -28
- package/lib/esm/resources/stock_items.js +3 -11
- package/lib/esm/resources/stock_line_items.d.ts +18 -17
- package/lib/esm/resources/stock_line_items.js +0 -8
- package/lib/esm/resources/stock_locations.d.ts +30 -29
- package/lib/esm/resources/stock_locations.js +3 -11
- package/lib/esm/resources/stock_reservations.d.ts +18 -17
- package/lib/esm/resources/stock_reservations.js +0 -8
- package/lib/esm/resources/stock_transfers.d.ts +48 -42
- package/lib/esm/resources/stock_transfers.js +18 -11
- package/lib/esm/resources/stripe_gateways.d.ts +23 -22
- package/lib/esm/resources/stripe_gateways.js +3 -11
- package/lib/esm/resources/stripe_payments.d.ts +35 -32
- package/lib/esm/resources/stripe_payments.js +9 -11
- package/lib/esm/resources/subscription_models.d.ts +27 -26
- package/lib/esm/resources/subscription_models.js +3 -11
- package/lib/esm/resources/tags.d.ts +13 -12
- package/lib/esm/resources/tags.js +3 -11
- package/lib/esm/resources/tax_calculators.d.ts +14 -13
- package/lib/esm/resources/tax_calculators.js +0 -8
- package/lib/esm/resources/tax_categories.d.ts +31 -30
- package/lib/esm/resources/tax_categories.js +3 -11
- package/lib/esm/resources/tax_rules.d.ts +52 -51
- package/lib/esm/resources/tax_rules.js +3 -11
- package/lib/esm/resources/taxjar_accounts.d.ts +22 -21
- package/lib/esm/resources/taxjar_accounts.js +3 -11
- package/lib/esm/resources/transactions.d.ts +24 -23
- package/lib/esm/resources/transactions.js +0 -8
- package/lib/esm/resources/versions.d.ts +14 -14
- package/lib/esm/resources/versions.js +0 -8
- package/lib/esm/resources/voids.d.ts +26 -25
- package/lib/esm/resources/voids.js +0 -8
- package/lib/esm/resources/webhooks.d.ts +28 -26
- package/lib/esm/resources/webhooks.js +6 -11
- package/lib/esm/resources/wire_transfers.d.ts +17 -16
- package/lib/esm/resources/wire_transfers.js +3 -11
- package/lib/esm/static.d.ts +1 -1
- package/lib/esm/util.d.ts +1 -3
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/lib/cjs/micro.d.ts +0 -4
- package/lib/cjs/micro.js +0 -13
- package/lib/esm/micro.d.ts +0 -4
- package/lib/esm/micro.js +0 -7
@@ -1,22 +1,22 @@
|
|
1
|
-
import { ApiResource
|
2
|
-
import type {
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceId, ResourceRel } from '../resource';
|
3
|
+
type VersionType = 'versions';
|
3
4
|
type VersionRel = ResourceRel & {
|
4
|
-
type:
|
5
|
+
type: VersionType;
|
5
6
|
};
|
6
7
|
interface Version extends Resource {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
readonly type: VersionType;
|
9
|
+
resource_type?: string | null;
|
10
|
+
resource_id?: string | null;
|
11
|
+
event?: string | null;
|
12
|
+
changes?: Record<string, any> | null;
|
13
|
+
who?: Record<string, any> | null;
|
12
14
|
}
|
13
|
-
declare class Versions extends ApiResource {
|
14
|
-
static readonly TYPE:
|
15
|
-
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
16
|
-
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Version>;
|
15
|
+
declare class Versions extends ApiResource<Version> {
|
16
|
+
static readonly TYPE: VersionType;
|
17
17
|
isVersion(resource: any): resource is Version;
|
18
18
|
relationship(id: string | ResourceId | null): VersionRel;
|
19
|
-
type():
|
19
|
+
type(): VersionType;
|
20
20
|
}
|
21
21
|
export default Versions;
|
22
|
-
export { Version };
|
22
|
+
export type { Version, VersionType };
|
@@ -2,14 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const resource_1 = require("../resource");
|
4
4
|
class Versions extends resource_1.ApiResource {
|
5
|
-
// static readonly PATH = 'versions'
|
6
|
-
async list(params, options) {
|
7
|
-
return this.resources.list({ type: Versions.TYPE }, params, options);
|
8
|
-
}
|
9
|
-
async retrieve(id, params, options) {
|
10
|
-
return this.resources.retrieve({ type: Versions.TYPE, id }, params, options);
|
11
|
-
}
|
12
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
13
5
|
isVersion(resource) {
|
14
6
|
return resource.type && (resource.type === Versions.TYPE);
|
15
7
|
}
|
@@ -1,35 +1,36 @@
|
|
1
|
-
import { ApiResource
|
2
|
-
import type {
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
|
+
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
3
4
|
import type { Order } from './orders';
|
4
5
|
import type { Attachment } from './attachments';
|
5
6
|
import type { Version } from './versions';
|
6
7
|
import type { Authorization } from './authorizations';
|
7
8
|
import type { Event } from './events';
|
9
|
+
type VoidType = 'voids';
|
8
10
|
type VoidRel = ResourceRel & {
|
9
|
-
type:
|
11
|
+
type: VoidType;
|
10
12
|
};
|
11
13
|
interface Void extends Resource {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
14
|
+
readonly type: VoidType;
|
15
|
+
number: string;
|
16
|
+
currency_code: string;
|
17
|
+
amount_cents: number;
|
18
|
+
amount_float: number;
|
19
|
+
formatted_amount: string;
|
20
|
+
succeeded: boolean;
|
21
|
+
message?: string | null;
|
22
|
+
error_code?: string | null;
|
23
|
+
error_detail?: string | null;
|
24
|
+
token?: string | null;
|
25
|
+
gateway_transaction_id?: string | null;
|
26
|
+
order?: Order | null;
|
27
|
+
attachments?: Attachment[] | null;
|
28
|
+
versions?: Version[] | null;
|
29
|
+
reference_authorization?: Authorization | null;
|
30
|
+
events?: Event[] | null;
|
28
31
|
}
|
29
|
-
declare class Voids extends ApiResource {
|
30
|
-
static readonly TYPE:
|
31
|
-
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Void>>;
|
32
|
-
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Void>;
|
32
|
+
declare class Voids extends ApiResource<Void> {
|
33
|
+
static readonly TYPE: VoidType;
|
33
34
|
order(voidId: string | Void, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
34
35
|
attachments(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
35
36
|
versions(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
@@ -37,7 +38,7 @@ declare class Voids extends ApiResource {
|
|
37
38
|
events(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
38
39
|
isVoid(resource: any): resource is Void;
|
39
40
|
relationship(id: string | ResourceId | null): VoidRel;
|
40
|
-
type():
|
41
|
+
type(): VoidType;
|
41
42
|
}
|
42
43
|
export default Voids;
|
43
|
-
export { Void };
|
44
|
+
export type { Void, VoidType };
|
@@ -2,13 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const resource_1 = require("../resource");
|
4
4
|
class Voids extends resource_1.ApiResource {
|
5
|
-
// static readonly PATH = 'voids'
|
6
|
-
async list(params, options) {
|
7
|
-
return this.resources.list({ type: Voids.TYPE }, params, options);
|
8
|
-
}
|
9
|
-
async retrieve(id, params, options) {
|
10
|
-
return this.resources.retrieve({ type: Voids.TYPE, id }, params, options);
|
11
|
-
}
|
12
5
|
async order(voidId, params, options) {
|
13
6
|
const _voidId = voidId.id || voidId;
|
14
7
|
return this.resources.fetch({ type: 'orders' }, `voids/${_voidId}/order`, params, options);
|
@@ -29,7 +22,6 @@ class Voids extends resource_1.ApiResource {
|
|
29
22
|
const _voidId = voidId.id || voidId;
|
30
23
|
return this.resources.fetch({ type: 'events' }, `voids/${_voidId}/events`, params, options);
|
31
24
|
}
|
32
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
33
25
|
isVoid(resource) {
|
34
26
|
return resource.type && (resource.type === Voids.TYPE);
|
35
27
|
}
|
@@ -1,46 +1,48 @@
|
|
1
|
-
import { ApiResource
|
2
|
-
import type {
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
|
+
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
3
4
|
import type { EventCallback } from './event_callbacks';
|
4
5
|
import type { Version } from './versions';
|
6
|
+
type WebhookType = 'webhooks';
|
5
7
|
type WebhookRel = ResourceRel & {
|
6
|
-
type:
|
8
|
+
type: WebhookType;
|
7
9
|
};
|
8
10
|
interface Webhook extends Resource {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
readonly type: WebhookType;
|
12
|
+
name?: string | null;
|
13
|
+
topic: string;
|
14
|
+
callback_url: string;
|
15
|
+
include_resources?: string[] | null;
|
16
|
+
circuit_state?: string | null;
|
17
|
+
circuit_failure_count?: number | null;
|
18
|
+
shared_secret: string;
|
19
|
+
last_event_callbacks?: EventCallback[] | null;
|
20
|
+
versions?: Version[] | null;
|
18
21
|
}
|
19
22
|
interface WebhookCreate extends ResourceCreate {
|
20
|
-
name?: string;
|
23
|
+
name?: string | null;
|
21
24
|
topic: string;
|
22
25
|
callback_url: string;
|
23
|
-
include_resources?: string[];
|
26
|
+
include_resources?: string[] | null;
|
24
27
|
}
|
25
28
|
interface WebhookUpdate extends ResourceUpdate {
|
26
|
-
name?: string;
|
27
|
-
topic?: string;
|
28
|
-
callback_url?: string;
|
29
|
-
include_resources?: string[];
|
30
|
-
_reset_circuit?: boolean;
|
29
|
+
name?: string | null;
|
30
|
+
topic?: string | null;
|
31
|
+
callback_url?: string | null;
|
32
|
+
include_resources?: string[] | null;
|
33
|
+
_reset_circuit?: boolean | null;
|
31
34
|
}
|
32
|
-
declare class Webhooks extends ApiResource {
|
33
|
-
static readonly TYPE:
|
34
|
-
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Webhook>>;
|
35
|
+
declare class Webhooks extends ApiResource<Webhook> {
|
36
|
+
static readonly TYPE: WebhookType;
|
35
37
|
create(resource: WebhookCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
36
|
-
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
37
38
|
update(resource: WebhookUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
38
|
-
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
39
|
+
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
39
40
|
last_event_callbacks(webhookId: string | Webhook, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<EventCallback>>;
|
40
41
|
versions(webhookId: string | Webhook, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
42
|
+
_reset_circuit(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
41
43
|
isWebhook(resource: any): resource is Webhook;
|
42
44
|
relationship(id: string | ResourceId | null): WebhookRel;
|
43
|
-
type():
|
45
|
+
type(): WebhookType;
|
44
46
|
}
|
45
47
|
export default Webhooks;
|
46
|
-
export { Webhook, WebhookCreate, WebhookUpdate };
|
48
|
+
export type { Webhook, WebhookCreate, WebhookUpdate, WebhookType };
|
@@ -2,21 +2,14 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const resource_1 = require("../resource");
|
4
4
|
class Webhooks extends resource_1.ApiResource {
|
5
|
-
// static readonly PATH = 'webhooks'
|
6
|
-
async list(params, options) {
|
7
|
-
return this.resources.list({ type: Webhooks.TYPE }, params, options);
|
8
|
-
}
|
9
5
|
async create(resource, params, options) {
|
10
|
-
return this.resources.create(
|
11
|
-
}
|
12
|
-
async retrieve(id, params, options) {
|
13
|
-
return this.resources.retrieve({ type: Webhooks.TYPE, id }, params, options);
|
6
|
+
return this.resources.create({ ...resource, type: Webhooks.TYPE }, params, options);
|
14
7
|
}
|
15
8
|
async update(resource, params, options) {
|
16
|
-
return this.resources.update(
|
9
|
+
return this.resources.update({ ...resource, type: Webhooks.TYPE }, params, options);
|
17
10
|
}
|
18
11
|
async delete(id, options) {
|
19
|
-
await this.resources.delete({ type: Webhooks.TYPE
|
12
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: Webhooks.TYPE } : id, options);
|
20
13
|
}
|
21
14
|
async last_event_callbacks(webhookId, params, options) {
|
22
15
|
const _webhookId = webhookId.id || webhookId;
|
@@ -26,7 +19,9 @@ class Webhooks extends resource_1.ApiResource {
|
|
26
19
|
const _webhookId = webhookId.id || webhookId;
|
27
20
|
return this.resources.fetch({ type: 'versions' }, `webhooks/${_webhookId}/versions`, params, options);
|
28
21
|
}
|
29
|
-
|
22
|
+
async _reset_circuit(id, params, options) {
|
23
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _reset_circuit: true }, params, options);
|
24
|
+
}
|
30
25
|
isWebhook(resource) {
|
31
26
|
return resource.type && (resource.type === Webhooks.TYPE);
|
32
27
|
}
|
@@ -1,36 +1,37 @@
|
|
1
|
-
import { ApiResource
|
2
|
-
import type {
|
3
|
-
import type {
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
|
+
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
|
+
import type { Order, OrderType } from './orders';
|
4
5
|
import type { Version } from './versions';
|
6
|
+
type WireTransferType = 'wire_transfers';
|
5
7
|
type WireTransferRel = ResourceRel & {
|
6
|
-
type:
|
8
|
+
type: WireTransferType;
|
7
9
|
};
|
8
10
|
type OrderRel = ResourceRel & {
|
9
|
-
type:
|
11
|
+
type: OrderType;
|
10
12
|
};
|
11
13
|
interface WireTransfer extends Resource {
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
readonly type: WireTransferType;
|
15
|
+
payment_instrument?: Record<string, any> | null;
|
16
|
+
order?: Order | null;
|
17
|
+
versions?: Version[] | null;
|
15
18
|
}
|
16
19
|
interface WireTransferCreate extends ResourceCreate {
|
17
20
|
order: OrderRel;
|
18
21
|
}
|
19
22
|
interface WireTransferUpdate extends ResourceUpdate {
|
20
|
-
order?: OrderRel;
|
23
|
+
order?: OrderRel | null;
|
21
24
|
}
|
22
|
-
declare class WireTransfers extends ApiResource {
|
23
|
-
static readonly TYPE:
|
24
|
-
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<WireTransfer>>;
|
25
|
+
declare class WireTransfers extends ApiResource<WireTransfer> {
|
26
|
+
static readonly TYPE: WireTransferType;
|
25
27
|
create(resource: WireTransferCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<WireTransfer>;
|
26
|
-
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<WireTransfer>;
|
27
28
|
update(resource: WireTransferUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<WireTransfer>;
|
28
|
-
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
29
|
+
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
29
30
|
order(wireTransferId: string | WireTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
30
31
|
versions(wireTransferId: string | WireTransfer, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
31
32
|
isWireTransfer(resource: any): resource is WireTransfer;
|
32
33
|
relationship(id: string | ResourceId | null): WireTransferRel;
|
33
|
-
type():
|
34
|
+
type(): WireTransferType;
|
34
35
|
}
|
35
36
|
export default WireTransfers;
|
36
|
-
export { WireTransfer, WireTransferCreate, WireTransferUpdate };
|
37
|
+
export type { WireTransfer, WireTransferCreate, WireTransferUpdate, WireTransferType };
|
@@ -2,21 +2,14 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const resource_1 = require("../resource");
|
4
4
|
class WireTransfers extends resource_1.ApiResource {
|
5
|
-
// static readonly PATH = 'wire_transfers'
|
6
|
-
async list(params, options) {
|
7
|
-
return this.resources.list({ type: WireTransfers.TYPE }, params, options);
|
8
|
-
}
|
9
5
|
async create(resource, params, options) {
|
10
|
-
return this.resources.create(
|
11
|
-
}
|
12
|
-
async retrieve(id, params, options) {
|
13
|
-
return this.resources.retrieve({ type: WireTransfers.TYPE, id }, params, options);
|
6
|
+
return this.resources.create({ ...resource, type: WireTransfers.TYPE }, params, options);
|
14
7
|
}
|
15
8
|
async update(resource, params, options) {
|
16
|
-
return this.resources.update(
|
9
|
+
return this.resources.update({ ...resource, type: WireTransfers.TYPE }, params, options);
|
17
10
|
}
|
18
11
|
async delete(id, options) {
|
19
|
-
await this.resources.delete({ type: WireTransfers.TYPE
|
12
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: WireTransfers.TYPE } : id, options);
|
20
13
|
}
|
21
14
|
async order(wireTransferId, params, options) {
|
22
15
|
const _wireTransferId = wireTransferId.id || wireTransferId;
|
@@ -26,7 +19,6 @@ class WireTransfers extends resource_1.ApiResource {
|
|
26
19
|
const _wireTransferId = wireTransferId.id || wireTransferId;
|
27
20
|
return this.resources.fetch({ type: 'versions' }, `wire_transfers/${_wireTransferId}/versions`, params, options);
|
28
21
|
}
|
29
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
30
22
|
isWireTransfer(resource) {
|
31
23
|
return resource.type && (resource.type === WireTransfers.TYPE);
|
32
24
|
}
|
package/lib/cjs/static.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { SdkError, ApiError } from './error';
|
2
|
-
import { CommerceLayerClient, CommerceLayerInitConfig } from './commercelayer';
|
2
|
+
import type { CommerceLayerClient, CommerceLayerInitConfig } from './commercelayer';
|
3
3
|
export declare const CommerceLayerStatic: {
|
4
4
|
resources: () => readonly string[];
|
5
5
|
isSdkError: (error: unknown) => error is SdkError;
|
package/lib/cjs/util.d.ts
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
/// <reference types="node" />
|
4
4
|
/// <reference types="node" />
|
5
5
|
/// <reference types="node" />
|
6
|
-
type ObjectType
|
7
|
-
[key: string]: any;
|
8
|
-
};
|
6
|
+
import type { ObjectType } from "../src/common";
|
9
7
|
declare const sleep: (ms: number) => Promise<NodeJS.Timeout>;
|
10
8
|
declare const sortObjectFields: (obj: ObjectType) => ObjectType;
|
11
9
|
export { sleep, sortObjectFields };
|
package/lib/esm/api.d.ts
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
import type { Resource, ResourceRel } from './resource';
|
2
|
+
import type { TagType } from './resources/tags';
|
3
|
+
import type { VersionType } from './resources/versions';
|
1
4
|
/**
|
2
5
|
* ©2023 Commerce Layer Inc.
|
3
6
|
**/
|
@@ -120,3 +123,37 @@ export { default as Webhooks } from './resources/webhooks';
|
|
120
123
|
export { default as WireTransfers } from './resources/wire_transfers';
|
121
124
|
export type ResourceTypeLock = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'application' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | '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' | 'events' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'geocoders' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_factories' | 'order_subscription_items' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'organization' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_tiers' | 'price_volume_tiers' | 'prices' | 'promotion_rules' | 'promotions' | 'recurring_order_copies' | 'refunds' | 'reserved_stocks' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_method_tiers' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'versions' | 'voids' | 'webhooks' | 'wire_transfers';
|
122
125
|
export declare const resourceList: readonly ["addresses", "adjustments", "adyen_gateways", "adyen_payments", "application", "attachments", "authorizations", "avalara_accounts", "axerve_gateways", "axerve_payments", "billing_info_validation_rules", "bing_geocoders", "braintree_gateways", "braintree_payments", "bundles", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "cleanups", "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", "events", "exports", "external_gateways", "external_payments", "external_promotions", "external_tax_calculators", "fixed_amount_promotions", "fixed_price_promotions", "free_gift_promotions", "free_shipping_promotions", "geocoders", "gift_card_recipients", "gift_cards", "google_geocoders", "imports", "in_stock_subscriptions", "inventory_models", "inventory_return_locations", "inventory_stock_locations", "klarna_gateways", "klarna_payments", "line_item_options", "line_items", "manual_gateways", "manual_tax_calculators", "markets", "merchants", "order_amount_promotion_rules", "order_copies", "order_factories", "order_subscription_items", "order_subscriptions", "order_validation_rules", "orders", "organization", "packages", "parcel_line_items", "parcels", "payment_gateways", "payment_methods", "paypal_gateways", "paypal_payments", "percentage_discount_promotions", "price_frequency_tiers", "price_lists", "price_tiers", "price_volume_tiers", "prices", "promotion_rules", "promotions", "recurring_order_copies", "refunds", "reserved_stocks", "return_line_items", "returns", "satispay_gateways", "satispay_payments", "shipments", "shipping_categories", "shipping_method_tiers", "shipping_methods", "shipping_weight_tiers", "shipping_zones", "sku_list_items", "sku_list_promotion_rules", "sku_lists", "sku_options", "skus", "stock_items", "stock_line_items", "stock_locations", "stock_reservations", "stock_transfers", "stripe_gateways", "stripe_payments", "subscription_models", "tags", "tax_calculators", "tax_categories", "tax_rules", "taxjar_accounts", "transactions", "versions", "voids", "webhooks", "wire_transfers"];
|
126
|
+
export type RetrievableResourceType = ResourceTypeLock;
|
127
|
+
export type RetrievableResource = Resource & {
|
128
|
+
type: RetrievableResourceType;
|
129
|
+
};
|
130
|
+
export type ListableResourceType = Exclude<ResourceTypeLock, 'application' | 'organization'>;
|
131
|
+
export type ListableResource = Resource & {
|
132
|
+
type: ListableResourceType;
|
133
|
+
};
|
134
|
+
export type CreatableResourceType = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'attachments' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_subscription_items' | 'order_subscriptions' | 'orders' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_volume_tiers' | 'prices' | 'recurring_order_copies' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipping_categories' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_locations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
|
135
|
+
export type CreatableResource = Resource & {
|
136
|
+
type: CreatableResourceType;
|
137
|
+
};
|
138
|
+
export type UpdatableResourceType = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | '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' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_subscription_items' | 'order_subscriptions' | 'orders' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_volume_tiers' | 'prices' | 'recurring_order_copies' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_locations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
|
139
|
+
export type UpdatableResource = Resource & {
|
140
|
+
type: UpdatableResourceType;
|
141
|
+
};
|
142
|
+
export type DeletableResourceType = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'attachments' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_subscription_items' | 'order_subscriptions' | 'orders' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_volume_tiers' | 'prices' | 'recurring_order_copies' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipping_categories' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_locations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
|
143
|
+
export type DeletableResource = Resource & {
|
144
|
+
type: DeletableResourceType;
|
145
|
+
};
|
146
|
+
export type TaggableResourceType = 'addresses' | 'bundles' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'sku_options' | 'skus';
|
147
|
+
export type TaggableResource = Resource & {
|
148
|
+
type: TaggableResourceType;
|
149
|
+
tags?: Array<ResourceRel & {
|
150
|
+
type: TagType;
|
151
|
+
}> | null;
|
152
|
+
};
|
153
|
+
export type VersionableResourceType = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'customer_addresses' | 'customer_groups' | 'customer_payment_sources' | 'customer_subscriptions' | 'delivery_lead_times' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_card_recipients' | 'gift_cards' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_tiers' | 'price_volume_tiers' | 'prices' | 'promotion_rules' | 'promotions' | 'refunds' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_method_tiers' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'voids' | 'webhooks' | 'wire_transfers';
|
154
|
+
export type VersionableResource = Resource & {
|
155
|
+
type: VersionableResourceType;
|
156
|
+
versions?: Array<ResourceRel & {
|
157
|
+
type: VersionType;
|
158
|
+
}> | null;
|
159
|
+
};
|
package/lib/esm/api.js
CHANGED
@@ -242,16 +242,3 @@ export const resourceList = [
|
|
242
242
|
'wire_transfers'
|
243
243
|
// ##__API_RESOURCE_LIST_STOP__##
|
244
244
|
];
|
245
|
-
/*
|
246
|
-
type ResourceInfo = {
|
247
|
-
name: string;
|
248
|
-
type: string;
|
249
|
-
api: string;
|
250
|
-
}
|
251
|
-
|
252
|
-
|
253
|
-
export const resourceMap: { [res: string]: ResourceInfo } = {
|
254
|
-
// ##__API_RESOURCE_MAP_START__##
|
255
|
-
// ##__API_RESOURCE_MAP_STOP__##
|
256
|
-
} as const
|
257
|
-
*/
|
package/lib/esm/client.d.ts
CHANGED
@@ -1,24 +1,29 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
/// <reference types="node" />
|
3
|
-
import { AxiosProxyConfig, Method } from 'axios';
|
3
|
+
import type { AxiosAdapter, AxiosProxyConfig, Method } from 'axios';
|
4
4
|
import type { InterceptorManager } from './interceptor';
|
5
5
|
import type { Agent as HttpAgent } from 'http';
|
6
6
|
import type { Agent as HttpsAgent } from 'https';
|
7
7
|
type ProxyConfig = AxiosProxyConfig | false;
|
8
|
+
type Adapter = AxiosAdapter;
|
9
|
+
type RequestParams = Record<string, string | number | boolean>;
|
10
|
+
type RequestHeaders = Record<string, string>;
|
8
11
|
type RequestConfig = {
|
9
12
|
timeout?: number;
|
10
|
-
params?:
|
11
|
-
[key: string]: string | number | boolean;
|
12
|
-
};
|
13
|
+
params?: RequestParams;
|
13
14
|
httpAgent?: HttpAgent;
|
14
15
|
httpsAgent?: HttpsAgent;
|
15
16
|
proxy?: ProxyConfig;
|
17
|
+
headers?: RequestHeaders;
|
16
18
|
};
|
17
|
-
type
|
19
|
+
type ApiConfig = {
|
18
20
|
organization: string;
|
19
21
|
domain?: string;
|
20
22
|
accessToken: string;
|
21
|
-
}
|
23
|
+
};
|
24
|
+
type ApiClientInitConfig = ApiConfig & RequestConfig & {
|
25
|
+
adapter?: Adapter;
|
26
|
+
};
|
22
27
|
type ApiClientConfig = Partial<ApiClientInitConfig>;
|
23
28
|
declare class ApiClient {
|
24
29
|
#private;
|
@@ -26,8 +31,10 @@ declare class ApiClient {
|
|
26
31
|
baseUrl: string;
|
27
32
|
interceptors: InterceptorManager;
|
28
33
|
private constructor();
|
29
|
-
config(config: ApiClientConfig):
|
34
|
+
config(config: ApiClientConfig): ApiClient;
|
35
|
+
adapter(adapter: Adapter): ApiClient;
|
30
36
|
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
|
37
|
+
private customHeaders;
|
31
38
|
}
|
32
39
|
export default ApiClient;
|
33
|
-
export { ApiClientInitConfig, ApiClientConfig, RequestConfig };
|
40
|
+
export type { ApiClientInitConfig, ApiClientConfig, RequestConfig };
|
package/lib/esm/client.js
CHANGED
@@ -10,50 +10,19 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
11
|
};
|
12
12
|
var _ApiClient_accessToken, _ApiClient_client;
|
13
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
14
13
|
import axios from 'axios';
|
15
|
-
import { SdkError,
|
14
|
+
import { SdkError, handleError } from './error';
|
16
15
|
import config from './config';
|
17
16
|
import Debug from './debug';
|
18
17
|
const debug = Debug('client');
|
19
18
|
const baseURL = (organization, domain) => {
|
20
19
|
return `https://${organization.toLowerCase()}.${domain || config.default.domain}/api`;
|
21
20
|
};
|
22
|
-
const handleError = (error) => {
|
23
|
-
let sdkError = new SdkError({ message: error.message });
|
24
|
-
if (axios.isAxiosError(error)) {
|
25
|
-
if (error.response) {
|
26
|
-
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
27
|
-
const apiError = new ApiError(sdkError);
|
28
|
-
apiError.type = ErrorType.RESPONSE;
|
29
|
-
apiError.status = error.response.status;
|
30
|
-
apiError.code = String(apiError.status);
|
31
|
-
apiError.errors = error.response.data.errors;
|
32
|
-
sdkError = apiError;
|
33
|
-
}
|
34
|
-
else if (error.request) {
|
35
|
-
// The request was made but no response was received
|
36
|
-
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
|
37
|
-
sdkError.type = ErrorType.REQUEST;
|
38
|
-
sdkError.request = error.request;
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
// Something happened in setting up the request that triggered an Error
|
42
|
-
sdkError.type = ErrorType.CLIENT;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
else if (axios.isCancel(error))
|
46
|
-
sdkError.type = ErrorType.CANCEL;
|
47
|
-
else
|
48
|
-
sdkError.source = error;
|
49
|
-
throw sdkError;
|
50
|
-
};
|
51
21
|
class ApiClient {
|
52
22
|
static create(options) {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
throw new Error("Undefined 'accessToken' parameter");
|
23
|
+
for (const attr of config.client.requiredAttributes)
|
24
|
+
if (!options || !options[attr])
|
25
|
+
throw new SdkError({ message: `Undefined '${attr}' parameter` });
|
57
26
|
return new ApiClient(options);
|
58
27
|
}
|
59
28
|
constructor(options) {
|
@@ -68,11 +37,21 @@ class ApiClient {
|
|
68
37
|
httpAgent: options.httpAgent,
|
69
38
|
httpsAgent: options.httpsAgent,
|
70
39
|
};
|
71
|
-
|
40
|
+
// Set custom headers
|
41
|
+
const customHeaders = this.customHeaders(options.headers);
|
42
|
+
const axiosOptions = {
|
43
|
+
baseURL: this.baseUrl,
|
44
|
+
timeout: config.client.timeout,
|
45
|
+
headers: {
|
46
|
+
...customHeaders,
|
72
47
|
'Accept': 'application/vnd.api+json',
|
73
48
|
'Content-Type': 'application/vnd.api+json',
|
74
|
-
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
75
|
-
}
|
49
|
+
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
50
|
+
},
|
51
|
+
...axiosConfig
|
52
|
+
};
|
53
|
+
if (options.adapter)
|
54
|
+
axiosOptions.adapter = options.adapter;
|
76
55
|
debug('axios options: %O', axiosOptions);
|
77
56
|
__classPrivateFieldSet(this, _ApiClient_client, axios.create(axiosOptions), "f");
|
78
57
|
this.interceptors = __classPrivateFieldGet(this, _ApiClient_client, "f").interceptors;
|
@@ -96,6 +75,16 @@ class ApiClient {
|
|
96
75
|
__classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
|
97
76
|
def.headers.common.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
98
77
|
}
|
78
|
+
if (config.headers)
|
79
|
+
def.headers.common = this.customHeaders(config.headers);
|
80
|
+
if (config.adapter)
|
81
|
+
this.adapter(config.adapter);
|
82
|
+
return this;
|
83
|
+
}
|
84
|
+
adapter(adapter) {
|
85
|
+
if (adapter)
|
86
|
+
__classPrivateFieldGet(this, _ApiClient_client, "f").defaults.adapter = adapter;
|
87
|
+
return this;
|
99
88
|
}
|
100
89
|
async request(method, path, body, options) {
|
101
90
|
debug('request %s %s, %O, %O', method, path, body || {}, options || {});
|
@@ -104,8 +93,10 @@ class ApiClient {
|
|
104
93
|
// Runtime request parameters
|
105
94
|
const baseUrl = (options === null || options === void 0 ? void 0 : options.organization) ? baseURL(options.organization, options.domain) : undefined;
|
106
95
|
const accessToken = (options === null || options === void 0 ? void 0 : options.accessToken) || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
107
|
-
const headers =
|
108
|
-
|
96
|
+
const headers = this.customHeaders(options === null || options === void 0 ? void 0 : options.headers);
|
97
|
+
if (accessToken)
|
98
|
+
headers.Authorization = 'Bearer ' + accessToken;
|
99
|
+
const requestParams = { method, baseURL: baseUrl, url, data, ...options, headers };
|
109
100
|
debug('request params: %O', requestParams);
|
110
101
|
// const start = Date.now()
|
111
102
|
return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
|
@@ -113,6 +104,15 @@ class ApiClient {
|
|
113
104
|
.catch(error => handleError(error));
|
114
105
|
// .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
|
115
106
|
}
|
107
|
+
customHeaders(headers) {
|
108
|
+
const customHeaders = {};
|
109
|
+
if (headers) {
|
110
|
+
for (const [name, value] of Object.entries(headers))
|
111
|
+
if (!['accept', 'content-type', 'authorization'].includes(name.toLowerCase()))
|
112
|
+
customHeaders[name] = value;
|
113
|
+
}
|
114
|
+
return customHeaders;
|
115
|
+
}
|
116
116
|
}
|
117
117
|
_ApiClient_accessToken = new WeakMap(), _ApiClient_client = new WeakMap();
|
118
118
|
export default ApiClient;
|