@commercelayer/sdk 5.35.0 → 6.0.0-alfa.10
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 +0 -3
- package/lib/cjs/api.js +0 -10
- package/lib/cjs/client.d.ts +6 -14
- package/lib/cjs/client.js +41 -75
- package/lib/cjs/commercelayer.d.ts +126 -125
- package/lib/cjs/commercelayer.js +267 -155
- package/lib/cjs/common.js +1 -12
- package/lib/cjs/config.js +0 -2
- package/lib/cjs/debug.js +0 -21
- package/lib/cjs/error.d.ts +6 -7
- package/lib/cjs/error.js +36 -35
- package/lib/cjs/fetch.d.ts +13 -0
- package/lib/cjs/fetch.js +67 -0
- package/lib/cjs/index.js +0 -2
- package/lib/cjs/interceptor.d.ts +22 -10
- package/lib/cjs/jsonapi.js +0 -2
- package/lib/cjs/model.d.ts +0 -3
- package/lib/cjs/model.js +0 -1
- package/lib/cjs/query.d.ts +2 -1
- package/lib/cjs/query.js +8 -7
- package/lib/cjs/resource.d.ts +2 -5
- package/lib/cjs/resource.js +32 -58
- package/lib/cjs/resources/addresses.d.ts +1 -0
- package/lib/cjs/resources/addresses.js +4 -1
- package/lib/cjs/resources/adjustments.d.ts +1 -0
- package/lib/cjs/resources/adjustments.js +4 -1
- package/lib/cjs/resources/adyen_gateways.d.ts +1 -0
- package/lib/cjs/resources/adyen_gateways.js +4 -1
- package/lib/cjs/resources/adyen_payments.d.ts +1 -0
- package/lib/cjs/resources/adyen_payments.js +4 -1
- package/lib/cjs/resources/application.d.ts +1 -0
- package/lib/cjs/resources/application.js +4 -1
- package/lib/cjs/resources/attachments.d.ts +1 -0
- package/lib/cjs/resources/attachments.js +4 -1
- package/lib/cjs/resources/authorizations.d.ts +1 -0
- package/lib/cjs/resources/authorizations.js +4 -1
- package/lib/cjs/resources/avalara_accounts.d.ts +1 -0
- package/lib/cjs/resources/avalara_accounts.js +4 -1
- package/lib/cjs/resources/axerve_gateways.d.ts +1 -0
- package/lib/cjs/resources/axerve_gateways.js +4 -1
- package/lib/cjs/resources/axerve_payments.d.ts +1 -0
- package/lib/cjs/resources/axerve_payments.js +4 -1
- package/lib/cjs/resources/billing_info_validation_rules.d.ts +1 -0
- package/lib/cjs/resources/billing_info_validation_rules.js +4 -1
- package/lib/cjs/resources/bing_geocoders.d.ts +1 -0
- package/lib/cjs/resources/bing_geocoders.js +4 -1
- package/lib/cjs/resources/braintree_gateways.d.ts +1 -0
- package/lib/cjs/resources/braintree_gateways.js +4 -1
- package/lib/cjs/resources/braintree_payments.d.ts +1 -0
- package/lib/cjs/resources/braintree_payments.js +4 -1
- package/lib/cjs/resources/bundles.d.ts +1 -0
- package/lib/cjs/resources/bundles.js +4 -1
- package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +1 -0
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +4 -1
- package/lib/cjs/resources/captures.d.ts +1 -0
- package/lib/cjs/resources/captures.js +4 -1
- package/lib/cjs/resources/carrier_accounts.d.ts +1 -0
- package/lib/cjs/resources/carrier_accounts.js +4 -1
- package/lib/cjs/resources/checkout_com_gateways.d.ts +1 -0
- package/lib/cjs/resources/checkout_com_gateways.js +4 -1
- package/lib/cjs/resources/checkout_com_payments.d.ts +1 -0
- package/lib/cjs/resources/checkout_com_payments.js +4 -1
- package/lib/cjs/resources/cleanups.d.ts +1 -0
- package/lib/cjs/resources/cleanups.js +4 -1
- package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +1 -0
- package/lib/cjs/resources/coupon_codes_promotion_rules.js +4 -1
- package/lib/cjs/resources/coupon_recipients.d.ts +1 -0
- package/lib/cjs/resources/coupon_recipients.js +4 -1
- package/lib/cjs/resources/coupons.d.ts +1 -0
- package/lib/cjs/resources/coupons.js +4 -1
- package/lib/cjs/resources/custom_promotion_rules.d.ts +1 -0
- package/lib/cjs/resources/custom_promotion_rules.js +4 -1
- package/lib/cjs/resources/customer_addresses.d.ts +1 -0
- package/lib/cjs/resources/customer_addresses.js +4 -1
- package/lib/cjs/resources/customer_groups.d.ts +1 -0
- package/lib/cjs/resources/customer_groups.js +4 -1
- package/lib/cjs/resources/customer_password_resets.d.ts +1 -0
- package/lib/cjs/resources/customer_password_resets.js +4 -1
- package/lib/cjs/resources/customer_payment_sources.d.ts +1 -0
- package/lib/cjs/resources/customer_payment_sources.js +4 -1
- package/lib/cjs/resources/customer_subscriptions.d.ts +1 -0
- package/lib/cjs/resources/customer_subscriptions.js +4 -1
- package/lib/cjs/resources/customers.d.ts +1 -0
- package/lib/cjs/resources/customers.js +4 -1
- package/lib/cjs/resources/delivery_lead_times.d.ts +1 -0
- package/lib/cjs/resources/delivery_lead_times.js +4 -1
- package/lib/cjs/resources/event_callbacks.d.ts +1 -0
- package/lib/cjs/resources/event_callbacks.js +4 -1
- package/lib/cjs/resources/events.d.ts +1 -0
- package/lib/cjs/resources/events.js +4 -1
- package/lib/cjs/resources/exports.d.ts +1 -0
- package/lib/cjs/resources/exports.js +4 -1
- package/lib/cjs/resources/external_gateways.d.ts +1 -0
- package/lib/cjs/resources/external_gateways.js +4 -1
- package/lib/cjs/resources/external_payments.d.ts +1 -0
- package/lib/cjs/resources/external_payments.js +4 -1
- package/lib/cjs/resources/external_promotions.d.ts +1 -0
- package/lib/cjs/resources/external_promotions.js +4 -1
- package/lib/cjs/resources/external_tax_calculators.d.ts +1 -0
- package/lib/cjs/resources/external_tax_calculators.js +4 -1
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +1 -0
- package/lib/cjs/resources/fixed_amount_promotions.js +4 -1
- package/lib/cjs/resources/fixed_price_promotions.d.ts +1 -0
- package/lib/cjs/resources/fixed_price_promotions.js +4 -1
- package/lib/cjs/resources/free_gift_promotions.d.ts +1 -0
- package/lib/cjs/resources/free_gift_promotions.js +4 -1
- package/lib/cjs/resources/free_shipping_promotions.d.ts +1 -0
- package/lib/cjs/resources/free_shipping_promotions.js +4 -1
- package/lib/cjs/resources/geocoders.d.ts +1 -0
- package/lib/cjs/resources/geocoders.js +4 -1
- package/lib/cjs/resources/gift_card_recipients.d.ts +1 -0
- package/lib/cjs/resources/gift_card_recipients.js +4 -1
- package/lib/cjs/resources/gift_cards.d.ts +1 -0
- package/lib/cjs/resources/gift_cards.js +4 -1
- package/lib/cjs/resources/google_geocoders.d.ts +1 -0
- package/lib/cjs/resources/google_geocoders.js +4 -1
- package/lib/cjs/resources/imports.d.ts +1 -0
- package/lib/cjs/resources/imports.js +4 -1
- package/lib/cjs/resources/in_stock_subscriptions.d.ts +1 -0
- package/lib/cjs/resources/in_stock_subscriptions.js +4 -1
- package/lib/cjs/resources/inventory_models.d.ts +1 -0
- package/lib/cjs/resources/inventory_models.js +4 -1
- package/lib/cjs/resources/inventory_return_locations.d.ts +1 -0
- package/lib/cjs/resources/inventory_return_locations.js +4 -1
- package/lib/cjs/resources/inventory_stock_locations.d.ts +1 -0
- package/lib/cjs/resources/inventory_stock_locations.js +4 -1
- package/lib/cjs/resources/klarna_gateways.d.ts +1 -0
- package/lib/cjs/resources/klarna_gateways.js +4 -1
- package/lib/cjs/resources/klarna_payments.d.ts +1 -0
- package/lib/cjs/resources/klarna_payments.js +4 -1
- package/lib/cjs/resources/line_item_options.d.ts +1 -0
- package/lib/cjs/resources/line_item_options.js +4 -1
- package/lib/cjs/resources/line_items.d.ts +1 -0
- package/lib/cjs/resources/line_items.js +4 -1
- package/lib/cjs/resources/manual_gateways.d.ts +1 -0
- package/lib/cjs/resources/manual_gateways.js +4 -1
- package/lib/cjs/resources/manual_tax_calculators.d.ts +1 -0
- package/lib/cjs/resources/manual_tax_calculators.js +4 -1
- package/lib/cjs/resources/markets.d.ts +1 -0
- package/lib/cjs/resources/markets.js +4 -1
- package/lib/cjs/resources/merchants.d.ts +1 -0
- package/lib/cjs/resources/merchants.js +4 -1
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +1 -0
- package/lib/cjs/resources/order_amount_promotion_rules.js +4 -1
- package/lib/cjs/resources/order_copies.d.ts +1 -0
- package/lib/cjs/resources/order_copies.js +4 -1
- package/lib/cjs/resources/order_factories.d.ts +1 -0
- package/lib/cjs/resources/order_factories.js +4 -1
- package/lib/cjs/resources/order_subscription_items.d.ts +1 -0
- package/lib/cjs/resources/order_subscription_items.js +4 -1
- package/lib/cjs/resources/order_subscriptions.d.ts +1 -0
- package/lib/cjs/resources/order_subscriptions.js +4 -1
- package/lib/cjs/resources/order_validation_rules.d.ts +1 -0
- package/lib/cjs/resources/order_validation_rules.js +4 -1
- package/lib/cjs/resources/orders.d.ts +1 -0
- package/lib/cjs/resources/orders.js +4 -1
- package/lib/cjs/resources/organization.d.ts +1 -0
- package/lib/cjs/resources/organization.js +4 -1
- package/lib/cjs/resources/packages.d.ts +1 -0
- package/lib/cjs/resources/packages.js +4 -1
- package/lib/cjs/resources/parcel_line_items.d.ts +1 -0
- package/lib/cjs/resources/parcel_line_items.js +4 -1
- package/lib/cjs/resources/parcels.d.ts +1 -0
- package/lib/cjs/resources/parcels.js +4 -1
- package/lib/cjs/resources/payment_gateways.d.ts +1 -0
- package/lib/cjs/resources/payment_gateways.js +4 -1
- package/lib/cjs/resources/payment_methods.d.ts +1 -0
- package/lib/cjs/resources/payment_methods.js +4 -1
- package/lib/cjs/resources/payment_options.d.ts +1 -0
- package/lib/cjs/resources/payment_options.js +4 -1
- package/lib/cjs/resources/paypal_gateways.d.ts +1 -0
- package/lib/cjs/resources/paypal_gateways.js +4 -1
- package/lib/cjs/resources/paypal_payments.d.ts +1 -0
- package/lib/cjs/resources/paypal_payments.js +4 -1
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +1 -0
- package/lib/cjs/resources/percentage_discount_promotions.js +4 -1
- package/lib/cjs/resources/price_frequency_tiers.d.ts +1 -0
- package/lib/cjs/resources/price_frequency_tiers.js +4 -1
- package/lib/cjs/resources/price_lists.d.ts +1 -0
- package/lib/cjs/resources/price_lists.js +4 -1
- package/lib/cjs/resources/price_tiers.d.ts +1 -0
- package/lib/cjs/resources/price_tiers.js +4 -1
- package/lib/cjs/resources/price_volume_tiers.d.ts +1 -0
- package/lib/cjs/resources/price_volume_tiers.js +4 -1
- package/lib/cjs/resources/prices.d.ts +1 -0
- package/lib/cjs/resources/prices.js +4 -1
- package/lib/cjs/resources/promotion_rules.d.ts +1 -0
- package/lib/cjs/resources/promotion_rules.js +4 -1
- package/lib/cjs/resources/promotions.d.ts +1 -0
- package/lib/cjs/resources/promotions.js +4 -1
- package/lib/cjs/resources/recurring_order_copies.d.ts +1 -0
- package/lib/cjs/resources/recurring_order_copies.js +4 -1
- package/lib/cjs/resources/refunds.d.ts +1 -0
- package/lib/cjs/resources/refunds.js +4 -1
- package/lib/cjs/resources/reserved_stocks.d.ts +1 -0
- package/lib/cjs/resources/reserved_stocks.js +4 -1
- package/lib/cjs/resources/resource_errors.d.ts +1 -0
- package/lib/cjs/resources/resource_errors.js +4 -1
- package/lib/cjs/resources/return_line_items.d.ts +1 -0
- package/lib/cjs/resources/return_line_items.js +4 -1
- package/lib/cjs/resources/returns.d.ts +1 -0
- package/lib/cjs/resources/returns.js +4 -1
- package/lib/cjs/resources/satispay_gateways.d.ts +1 -0
- package/lib/cjs/resources/satispay_gateways.js +4 -1
- package/lib/cjs/resources/satispay_payments.d.ts +1 -0
- package/lib/cjs/resources/satispay_payments.js +4 -1
- package/lib/cjs/resources/shipments.d.ts +1 -0
- package/lib/cjs/resources/shipments.js +4 -1
- package/lib/cjs/resources/shipping_categories.d.ts +1 -0
- package/lib/cjs/resources/shipping_categories.js +4 -1
- package/lib/cjs/resources/shipping_method_tiers.d.ts +1 -0
- package/lib/cjs/resources/shipping_method_tiers.js +4 -1
- package/lib/cjs/resources/shipping_methods.d.ts +1 -0
- package/lib/cjs/resources/shipping_methods.js +4 -1
- package/lib/cjs/resources/shipping_weight_tiers.d.ts +1 -0
- package/lib/cjs/resources/shipping_weight_tiers.js +4 -1
- package/lib/cjs/resources/shipping_zones.d.ts +1 -0
- package/lib/cjs/resources/shipping_zones.js +4 -1
- package/lib/cjs/resources/sku_list_items.d.ts +1 -0
- package/lib/cjs/resources/sku_list_items.js +4 -1
- package/lib/cjs/resources/sku_list_promotion_rules.d.ts +1 -0
- package/lib/cjs/resources/sku_list_promotion_rules.js +4 -1
- package/lib/cjs/resources/sku_lists.d.ts +1 -0
- package/lib/cjs/resources/sku_lists.js +4 -1
- package/lib/cjs/resources/sku_options.d.ts +1 -0
- package/lib/cjs/resources/sku_options.js +4 -1
- package/lib/cjs/resources/skus.d.ts +1 -0
- package/lib/cjs/resources/skus.js +4 -1
- package/lib/cjs/resources/stock_items.d.ts +1 -0
- package/lib/cjs/resources/stock_items.js +4 -1
- package/lib/cjs/resources/stock_line_items.d.ts +1 -0
- package/lib/cjs/resources/stock_line_items.js +4 -1
- package/lib/cjs/resources/stock_locations.d.ts +1 -0
- package/lib/cjs/resources/stock_locations.js +4 -1
- package/lib/cjs/resources/stock_reservations.d.ts +1 -0
- package/lib/cjs/resources/stock_reservations.js +4 -1
- package/lib/cjs/resources/stock_transfers.d.ts +1 -0
- package/lib/cjs/resources/stock_transfers.js +4 -1
- package/lib/cjs/resources/stripe_gateways.d.ts +1 -0
- package/lib/cjs/resources/stripe_gateways.js +4 -1
- package/lib/cjs/resources/stripe_payments.d.ts +1 -0
- package/lib/cjs/resources/stripe_payments.js +4 -1
- package/lib/cjs/resources/subscription_models.d.ts +1 -0
- package/lib/cjs/resources/subscription_models.js +4 -1
- package/lib/cjs/resources/tags.d.ts +1 -0
- package/lib/cjs/resources/tags.js +4 -1
- package/lib/cjs/resources/tax_calculators.d.ts +1 -0
- package/lib/cjs/resources/tax_calculators.js +4 -1
- package/lib/cjs/resources/tax_categories.d.ts +1 -0
- package/lib/cjs/resources/tax_categories.js +4 -1
- package/lib/cjs/resources/tax_rules.d.ts +1 -0
- package/lib/cjs/resources/tax_rules.js +4 -1
- package/lib/cjs/resources/taxjar_accounts.d.ts +1 -0
- package/lib/cjs/resources/taxjar_accounts.js +4 -1
- package/lib/cjs/resources/transactions.d.ts +1 -0
- package/lib/cjs/resources/transactions.js +4 -1
- package/lib/cjs/resources/versions.d.ts +1 -0
- package/lib/cjs/resources/versions.js +4 -1
- package/lib/cjs/resources/voids.d.ts +1 -0
- package/lib/cjs/resources/voids.js +4 -1
- package/lib/cjs/resources/webhooks.d.ts +1 -0
- package/lib/cjs/resources/webhooks.js +4 -1
- package/lib/cjs/resources/wire_transfers.d.ts +1 -0
- package/lib/cjs/resources/wire_transfers.js +4 -1
- package/lib/cjs/static.js +0 -1
- package/lib/cjs/util.js +0 -1
- package/lib/esm/api.d.ts +0 -3
- package/lib/esm/api.js +0 -10
- package/lib/esm/client.d.ts +6 -14
- package/lib/esm/client.js +43 -90
- package/lib/esm/commercelayer.d.ts +126 -125
- package/lib/esm/commercelayer.js +270 -171
- package/lib/esm/common.js +1 -12
- package/lib/esm/config.js +0 -2
- package/lib/esm/debug.js +0 -21
- package/lib/esm/error.d.ts +6 -7
- package/lib/esm/error.js +44 -35
- package/lib/esm/fetch.d.ts +13 -0
- package/lib/esm/fetch.js +46 -0
- package/lib/esm/index.js +0 -2
- package/lib/esm/interceptor.d.ts +22 -10
- package/lib/esm/jsonapi.js +0 -2
- package/lib/esm/model.d.ts +0 -3
- package/lib/esm/model.js +0 -1
- package/lib/esm/query.d.ts +2 -1
- package/lib/esm/query.js +7 -7
- package/lib/esm/resource.d.ts +2 -5
- package/lib/esm/resource.js +40 -76
- package/lib/esm/resources/addresses.d.ts +1 -0
- package/lib/esm/resources/addresses.js +5 -2
- package/lib/esm/resources/adjustments.d.ts +1 -0
- package/lib/esm/resources/adjustments.js +5 -2
- package/lib/esm/resources/adyen_gateways.d.ts +1 -0
- package/lib/esm/resources/adyen_gateways.js +5 -2
- package/lib/esm/resources/adyen_payments.d.ts +1 -0
- package/lib/esm/resources/adyen_payments.js +5 -2
- package/lib/esm/resources/application.d.ts +1 -0
- package/lib/esm/resources/application.js +5 -2
- package/lib/esm/resources/attachments.d.ts +1 -0
- package/lib/esm/resources/attachments.js +5 -2
- package/lib/esm/resources/authorizations.d.ts +1 -0
- package/lib/esm/resources/authorizations.js +5 -2
- package/lib/esm/resources/avalara_accounts.d.ts +1 -0
- package/lib/esm/resources/avalara_accounts.js +5 -2
- package/lib/esm/resources/axerve_gateways.d.ts +1 -0
- package/lib/esm/resources/axerve_gateways.js +5 -2
- package/lib/esm/resources/axerve_payments.d.ts +1 -0
- package/lib/esm/resources/axerve_payments.js +5 -2
- package/lib/esm/resources/billing_info_validation_rules.d.ts +1 -0
- package/lib/esm/resources/billing_info_validation_rules.js +5 -2
- package/lib/esm/resources/bing_geocoders.d.ts +1 -0
- package/lib/esm/resources/bing_geocoders.js +5 -2
- package/lib/esm/resources/braintree_gateways.d.ts +1 -0
- package/lib/esm/resources/braintree_gateways.js +5 -2
- package/lib/esm/resources/braintree_payments.d.ts +1 -0
- package/lib/esm/resources/braintree_payments.js +5 -2
- package/lib/esm/resources/bundles.d.ts +1 -0
- package/lib/esm/resources/bundles.js +5 -2
- package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +1 -0
- package/lib/esm/resources/buy_x_pay_y_promotions.js +5 -2
- package/lib/esm/resources/captures.d.ts +1 -0
- package/lib/esm/resources/captures.js +5 -2
- package/lib/esm/resources/carrier_accounts.d.ts +1 -0
- package/lib/esm/resources/carrier_accounts.js +5 -2
- package/lib/esm/resources/checkout_com_gateways.d.ts +1 -0
- package/lib/esm/resources/checkout_com_gateways.js +5 -2
- package/lib/esm/resources/checkout_com_payments.d.ts +1 -0
- package/lib/esm/resources/checkout_com_payments.js +5 -2
- package/lib/esm/resources/cleanups.d.ts +1 -0
- package/lib/esm/resources/cleanups.js +5 -2
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +1 -0
- package/lib/esm/resources/coupon_codes_promotion_rules.js +5 -2
- package/lib/esm/resources/coupon_recipients.d.ts +1 -0
- package/lib/esm/resources/coupon_recipients.js +5 -2
- package/lib/esm/resources/coupons.d.ts +1 -0
- package/lib/esm/resources/coupons.js +5 -2
- package/lib/esm/resources/custom_promotion_rules.d.ts +1 -0
- package/lib/esm/resources/custom_promotion_rules.js +5 -2
- package/lib/esm/resources/customer_addresses.d.ts +1 -0
- package/lib/esm/resources/customer_addresses.js +5 -2
- package/lib/esm/resources/customer_groups.d.ts +1 -0
- package/lib/esm/resources/customer_groups.js +5 -2
- package/lib/esm/resources/customer_password_resets.d.ts +1 -0
- package/lib/esm/resources/customer_password_resets.js +5 -2
- package/lib/esm/resources/customer_payment_sources.d.ts +1 -0
- package/lib/esm/resources/customer_payment_sources.js +5 -2
- package/lib/esm/resources/customer_subscriptions.d.ts +1 -0
- package/lib/esm/resources/customer_subscriptions.js +5 -2
- package/lib/esm/resources/customers.d.ts +1 -0
- package/lib/esm/resources/customers.js +5 -2
- package/lib/esm/resources/delivery_lead_times.d.ts +1 -0
- package/lib/esm/resources/delivery_lead_times.js +5 -2
- package/lib/esm/resources/event_callbacks.d.ts +1 -0
- package/lib/esm/resources/event_callbacks.js +5 -2
- package/lib/esm/resources/events.d.ts +1 -0
- package/lib/esm/resources/events.js +5 -2
- package/lib/esm/resources/exports.d.ts +1 -0
- package/lib/esm/resources/exports.js +5 -2
- package/lib/esm/resources/external_gateways.d.ts +1 -0
- package/lib/esm/resources/external_gateways.js +5 -2
- package/lib/esm/resources/external_payments.d.ts +1 -0
- package/lib/esm/resources/external_payments.js +5 -2
- package/lib/esm/resources/external_promotions.d.ts +1 -0
- package/lib/esm/resources/external_promotions.js +5 -2
- package/lib/esm/resources/external_tax_calculators.d.ts +1 -0
- package/lib/esm/resources/external_tax_calculators.js +5 -2
- package/lib/esm/resources/fixed_amount_promotions.d.ts +1 -0
- package/lib/esm/resources/fixed_amount_promotions.js +5 -2
- package/lib/esm/resources/fixed_price_promotions.d.ts +1 -0
- package/lib/esm/resources/fixed_price_promotions.js +5 -2
- package/lib/esm/resources/free_gift_promotions.d.ts +1 -0
- package/lib/esm/resources/free_gift_promotions.js +5 -2
- package/lib/esm/resources/free_shipping_promotions.d.ts +1 -0
- package/lib/esm/resources/free_shipping_promotions.js +5 -2
- package/lib/esm/resources/geocoders.d.ts +1 -0
- package/lib/esm/resources/geocoders.js +5 -2
- package/lib/esm/resources/gift_card_recipients.d.ts +1 -0
- package/lib/esm/resources/gift_card_recipients.js +5 -2
- package/lib/esm/resources/gift_cards.d.ts +1 -0
- package/lib/esm/resources/gift_cards.js +5 -2
- package/lib/esm/resources/google_geocoders.d.ts +1 -0
- package/lib/esm/resources/google_geocoders.js +5 -2
- package/lib/esm/resources/imports.d.ts +1 -0
- package/lib/esm/resources/imports.js +5 -2
- package/lib/esm/resources/in_stock_subscriptions.d.ts +1 -0
- package/lib/esm/resources/in_stock_subscriptions.js +5 -2
- package/lib/esm/resources/inventory_models.d.ts +1 -0
- package/lib/esm/resources/inventory_models.js +5 -2
- package/lib/esm/resources/inventory_return_locations.d.ts +1 -0
- package/lib/esm/resources/inventory_return_locations.js +5 -2
- package/lib/esm/resources/inventory_stock_locations.d.ts +1 -0
- package/lib/esm/resources/inventory_stock_locations.js +5 -2
- package/lib/esm/resources/klarna_gateways.d.ts +1 -0
- package/lib/esm/resources/klarna_gateways.js +5 -2
- package/lib/esm/resources/klarna_payments.d.ts +1 -0
- package/lib/esm/resources/klarna_payments.js +5 -2
- package/lib/esm/resources/line_item_options.d.ts +1 -0
- package/lib/esm/resources/line_item_options.js +5 -2
- package/lib/esm/resources/line_items.d.ts +1 -0
- package/lib/esm/resources/line_items.js +5 -2
- package/lib/esm/resources/manual_gateways.d.ts +1 -0
- package/lib/esm/resources/manual_gateways.js +5 -2
- package/lib/esm/resources/manual_tax_calculators.d.ts +1 -0
- package/lib/esm/resources/manual_tax_calculators.js +5 -2
- package/lib/esm/resources/markets.d.ts +1 -0
- package/lib/esm/resources/markets.js +5 -2
- package/lib/esm/resources/merchants.d.ts +1 -0
- package/lib/esm/resources/merchants.js +5 -2
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +1 -0
- package/lib/esm/resources/order_amount_promotion_rules.js +5 -2
- package/lib/esm/resources/order_copies.d.ts +1 -0
- package/lib/esm/resources/order_copies.js +5 -2
- package/lib/esm/resources/order_factories.d.ts +1 -0
- package/lib/esm/resources/order_factories.js +5 -2
- package/lib/esm/resources/order_subscription_items.d.ts +1 -0
- package/lib/esm/resources/order_subscription_items.js +5 -2
- package/lib/esm/resources/order_subscriptions.d.ts +1 -0
- package/lib/esm/resources/order_subscriptions.js +5 -2
- package/lib/esm/resources/order_validation_rules.d.ts +1 -0
- package/lib/esm/resources/order_validation_rules.js +5 -2
- package/lib/esm/resources/orders.d.ts +1 -0
- package/lib/esm/resources/orders.js +5 -2
- package/lib/esm/resources/organization.d.ts +1 -0
- package/lib/esm/resources/organization.js +5 -2
- package/lib/esm/resources/packages.d.ts +1 -0
- package/lib/esm/resources/packages.js +5 -2
- package/lib/esm/resources/parcel_line_items.d.ts +1 -0
- package/lib/esm/resources/parcel_line_items.js +5 -2
- package/lib/esm/resources/parcels.d.ts +1 -0
- package/lib/esm/resources/parcels.js +5 -2
- package/lib/esm/resources/payment_gateways.d.ts +1 -0
- package/lib/esm/resources/payment_gateways.js +5 -2
- package/lib/esm/resources/payment_methods.d.ts +1 -0
- package/lib/esm/resources/payment_methods.js +5 -2
- package/lib/esm/resources/payment_options.d.ts +1 -0
- package/lib/esm/resources/payment_options.js +5 -2
- package/lib/esm/resources/paypal_gateways.d.ts +1 -0
- package/lib/esm/resources/paypal_gateways.js +5 -2
- package/lib/esm/resources/paypal_payments.d.ts +1 -0
- package/lib/esm/resources/paypal_payments.js +5 -2
- package/lib/esm/resources/percentage_discount_promotions.d.ts +1 -0
- package/lib/esm/resources/percentage_discount_promotions.js +5 -2
- package/lib/esm/resources/price_frequency_tiers.d.ts +1 -0
- package/lib/esm/resources/price_frequency_tiers.js +5 -2
- package/lib/esm/resources/price_lists.d.ts +1 -0
- package/lib/esm/resources/price_lists.js +5 -2
- package/lib/esm/resources/price_tiers.d.ts +1 -0
- package/lib/esm/resources/price_tiers.js +5 -2
- package/lib/esm/resources/price_volume_tiers.d.ts +1 -0
- package/lib/esm/resources/price_volume_tiers.js +5 -2
- package/lib/esm/resources/prices.d.ts +1 -0
- package/lib/esm/resources/prices.js +5 -2
- package/lib/esm/resources/promotion_rules.d.ts +1 -0
- package/lib/esm/resources/promotion_rules.js +5 -2
- package/lib/esm/resources/promotions.d.ts +1 -0
- package/lib/esm/resources/promotions.js +5 -2
- package/lib/esm/resources/recurring_order_copies.d.ts +1 -0
- package/lib/esm/resources/recurring_order_copies.js +5 -2
- package/lib/esm/resources/refunds.d.ts +1 -0
- package/lib/esm/resources/refunds.js +5 -2
- package/lib/esm/resources/reserved_stocks.d.ts +1 -0
- package/lib/esm/resources/reserved_stocks.js +5 -2
- package/lib/esm/resources/resource_errors.d.ts +1 -0
- package/lib/esm/resources/resource_errors.js +5 -2
- package/lib/esm/resources/return_line_items.d.ts +1 -0
- package/lib/esm/resources/return_line_items.js +5 -2
- package/lib/esm/resources/returns.d.ts +1 -0
- package/lib/esm/resources/returns.js +5 -2
- package/lib/esm/resources/satispay_gateways.d.ts +1 -0
- package/lib/esm/resources/satispay_gateways.js +5 -2
- package/lib/esm/resources/satispay_payments.d.ts +1 -0
- package/lib/esm/resources/satispay_payments.js +5 -2
- package/lib/esm/resources/shipments.d.ts +1 -0
- package/lib/esm/resources/shipments.js +5 -2
- package/lib/esm/resources/shipping_categories.d.ts +1 -0
- package/lib/esm/resources/shipping_categories.js +5 -2
- package/lib/esm/resources/shipping_method_tiers.d.ts +1 -0
- package/lib/esm/resources/shipping_method_tiers.js +5 -2
- package/lib/esm/resources/shipping_methods.d.ts +1 -0
- package/lib/esm/resources/shipping_methods.js +5 -2
- package/lib/esm/resources/shipping_weight_tiers.d.ts +1 -0
- package/lib/esm/resources/shipping_weight_tiers.js +5 -2
- package/lib/esm/resources/shipping_zones.d.ts +1 -0
- package/lib/esm/resources/shipping_zones.js +5 -2
- package/lib/esm/resources/sku_list_items.d.ts +1 -0
- package/lib/esm/resources/sku_list_items.js +5 -2
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +1 -0
- package/lib/esm/resources/sku_list_promotion_rules.js +5 -2
- package/lib/esm/resources/sku_lists.d.ts +1 -0
- package/lib/esm/resources/sku_lists.js +5 -2
- package/lib/esm/resources/sku_options.d.ts +1 -0
- package/lib/esm/resources/sku_options.js +5 -2
- package/lib/esm/resources/skus.d.ts +1 -0
- package/lib/esm/resources/skus.js +5 -2
- package/lib/esm/resources/stock_items.d.ts +1 -0
- package/lib/esm/resources/stock_items.js +5 -2
- package/lib/esm/resources/stock_line_items.d.ts +1 -0
- package/lib/esm/resources/stock_line_items.js +5 -2
- package/lib/esm/resources/stock_locations.d.ts +1 -0
- package/lib/esm/resources/stock_locations.js +5 -2
- package/lib/esm/resources/stock_reservations.d.ts +1 -0
- package/lib/esm/resources/stock_reservations.js +5 -2
- package/lib/esm/resources/stock_transfers.d.ts +1 -0
- package/lib/esm/resources/stock_transfers.js +5 -2
- package/lib/esm/resources/stripe_gateways.d.ts +1 -0
- package/lib/esm/resources/stripe_gateways.js +5 -2
- package/lib/esm/resources/stripe_payments.d.ts +1 -0
- package/lib/esm/resources/stripe_payments.js +5 -2
- package/lib/esm/resources/subscription_models.d.ts +1 -0
- package/lib/esm/resources/subscription_models.js +5 -2
- package/lib/esm/resources/tags.d.ts +1 -0
- package/lib/esm/resources/tags.js +5 -2
- package/lib/esm/resources/tax_calculators.d.ts +1 -0
- package/lib/esm/resources/tax_calculators.js +5 -2
- package/lib/esm/resources/tax_categories.d.ts +1 -0
- package/lib/esm/resources/tax_categories.js +5 -2
- package/lib/esm/resources/tax_rules.d.ts +1 -0
- package/lib/esm/resources/tax_rules.js +5 -2
- package/lib/esm/resources/taxjar_accounts.d.ts +1 -0
- package/lib/esm/resources/taxjar_accounts.js +5 -2
- package/lib/esm/resources/transactions.d.ts +1 -0
- package/lib/esm/resources/transactions.js +5 -2
- package/lib/esm/resources/versions.d.ts +1 -0
- package/lib/esm/resources/versions.js +5 -2
- package/lib/esm/resources/voids.d.ts +1 -0
- package/lib/esm/resources/voids.js +5 -2
- package/lib/esm/resources/webhooks.d.ts +1 -0
- package/lib/esm/resources/webhooks.js +5 -2
- package/lib/esm/resources/wire_transfers.d.ts +1 -0
- package/lib/esm/resources/wire_transfers.js +5 -2
- package/lib/esm/static.js +0 -1
- package/lib/esm/util.js +1 -27
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -17
package/lib/cjs/api.d.ts
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
import type { Resource, ResourceRel } from './resource';
|
2
2
|
import type { TagType } from './resources/tags';
|
3
3
|
import type { VersionType } from './resources/versions';
|
4
|
-
/**
|
5
|
-
* ©2024 Commerce Layer Inc.
|
6
|
-
**/
|
7
4
|
export { default as Addresses } from './resources/addresses';
|
8
5
|
export { default as Adjustments } from './resources/adjustments';
|
9
6
|
export { default as AdyenGateways } from './resources/adyen_gateways';
|
package/lib/cjs/api.js
CHANGED
@@ -6,11 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.InventoryModels = exports.InStockSubscriptions = exports.Imports = exports.GoogleGeocoders = exports.GiftCards = exports.GiftCardRecipients = exports.Geocoders = exports.FreeShippingPromotions = exports.FreeGiftPromotions = exports.FixedPricePromotions = exports.FixedAmountPromotions = exports.ExternalTaxCalculators = exports.ExternalPromotions = exports.ExternalPayments = exports.ExternalGateways = exports.Exports = exports.Events = exports.EventCallbacks = exports.DeliveryLeadTimes = exports.Customers = exports.CustomerSubscriptions = exports.CustomerPaymentSources = exports.CustomerPasswordResets = exports.CustomerGroups = exports.CustomerAddresses = exports.CustomPromotionRules = exports.Coupons = exports.CouponRecipients = exports.CouponCodesPromotionRules = exports.Cleanups = exports.CheckoutComPayments = exports.CheckoutComGateways = exports.CarrierAccounts = exports.Captures = exports.BuyXPayYPromotions = exports.Bundles = exports.BraintreePayments = exports.BraintreeGateways = exports.BingGeocoders = exports.BillingInfoValidationRules = exports.AxervePayments = exports.AxerveGateways = exports.AvalaraAccounts = exports.Authorizations = exports.Attachments = exports.Applications = exports.AdyenPayments = exports.AdyenGateways = exports.Adjustments = exports.Addresses = void 0;
|
7
7
|
exports.SkuListPromotionRules = exports.SkuListItems = exports.ShippingZones = exports.ShippingWeightTiers = exports.ShippingMethods = exports.ShippingMethodTiers = exports.ShippingCategories = exports.Shipments = exports.SatispayPayments = exports.SatispayGateways = exports.Returns = exports.ReturnLineItems = exports.ResourceErrors = exports.ReservedStocks = exports.Refunds = exports.RecurringOrderCopies = exports.Promotions = exports.PromotionRules = exports.Prices = exports.PriceVolumeTiers = exports.PriceTiers = exports.PriceLists = exports.PriceFrequencyTiers = exports.PercentageDiscountPromotions = exports.PaypalPayments = exports.PaypalGateways = exports.PaymentOptions = exports.PaymentMethods = exports.PaymentGateways = exports.Parcels = exports.ParcelLineItems = exports.Packages = exports.Organizations = exports.Orders = exports.OrderValidationRules = exports.OrderSubscriptions = exports.OrderSubscriptionItems = exports.OrderFactories = exports.OrderCopies = exports.OrderAmountPromotionRules = exports.Merchants = exports.Markets = exports.ManualTaxCalculators = exports.ManualGateways = exports.LineItems = exports.LineItemOptions = exports.KlarnaPayments = exports.KlarnaGateways = exports.InventoryStockLocations = exports.InventoryReturnLocations = void 0;
|
8
8
|
exports.singletonList = exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids = exports.Versions = exports.Transactions = exports.TaxjarAccounts = exports.TaxRules = exports.TaxCategories = exports.TaxCalculators = exports.Tags = exports.SubscriptionModels = exports.StripePayments = exports.StripeGateways = exports.StockTransfers = exports.StockReservations = exports.StockLocations = exports.StockLineItems = exports.StockItems = exports.Skus = exports.SkuOptions = exports.SkuLists = void 0;
|
9
|
-
// ##__API_RESOURCES_START__##
|
10
|
-
// ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
|
11
|
-
/**
|
12
|
-
* ©2024 Commerce Layer Inc.
|
13
|
-
**/
|
14
9
|
var addresses_1 = require("./resources/addresses");
|
15
10
|
Object.defineProperty(exports, "Addresses", { enumerable: true, get: function () { return __importDefault(addresses_1).default; } });
|
16
11
|
var adjustments_1 = require("./resources/adjustments");
|
@@ -253,9 +248,7 @@ var webhooks_1 = require("./resources/webhooks");
|
|
253
248
|
Object.defineProperty(exports, "Webhooks", { enumerable: true, get: function () { return __importDefault(webhooks_1).default; } });
|
254
249
|
var wire_transfers_1 = require("./resources/wire_transfers");
|
255
250
|
Object.defineProperty(exports, "WireTransfers", { enumerable: true, get: function () { return __importDefault(wire_transfers_1).default; } });
|
256
|
-
// ##__API_RESOURCE_TYPES_STOP__##
|
257
251
|
exports.resourceList = [
|
258
|
-
// ##__API_RESOURCE_LIST_START__##
|
259
252
|
'addresses',
|
260
253
|
'adjustments',
|
261
254
|
'adyen_gateways',
|
@@ -377,11 +370,8 @@ exports.resourceList = [
|
|
377
370
|
'voids',
|
378
371
|
'webhooks',
|
379
372
|
'wire_transfers'
|
380
|
-
// ##__API_RESOURCE_LIST_STOP__##
|
381
373
|
];
|
382
374
|
exports.singletonList = [
|
383
|
-
// ##__API_RESOURCE_SINGLETON_START__##
|
384
375
|
'application',
|
385
376
|
'organization'
|
386
|
-
// ##__API_RESOURCE_SINGLETON_STOP__##
|
387
377
|
];
|
package/lib/cjs/client.d.ts
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
import type { AxiosAdapter, AxiosProxyConfig, Method } from 'axios';
|
2
1
|
import type { InterceptorManager } from './interceptor';
|
3
|
-
type
|
4
|
-
type Adapter = AxiosAdapter;
|
2
|
+
import { type FetchResponse } from './fetch';
|
5
3
|
type RequestParams = Record<string, string | number | boolean>;
|
6
4
|
type RequestHeaders = Record<string, string>;
|
7
5
|
type RequestConfig = {
|
8
6
|
timeout?: number;
|
9
7
|
params?: RequestParams;
|
10
|
-
httpAgent?: any;
|
11
|
-
httpsAgent?: any;
|
12
|
-
proxy?: ProxyConfig;
|
13
8
|
headers?: RequestHeaders;
|
14
|
-
};
|
15
|
-
type RequestConfigExtra = {
|
16
|
-
adapter?: Adapter;
|
17
9
|
userAgent?: string;
|
18
10
|
};
|
19
11
|
type ApiConfig = {
|
@@ -21,18 +13,18 @@ type ApiConfig = {
|
|
21
13
|
domain?: string;
|
22
14
|
accessToken: string;
|
23
15
|
};
|
24
|
-
type ApiClientInitConfig = ApiConfig & RequestConfig
|
16
|
+
type ApiClientInitConfig = ApiConfig & RequestConfig;
|
25
17
|
type ApiClientConfig = Partial<ApiClientInitConfig>;
|
18
|
+
export type Method = 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH';
|
26
19
|
declare class ApiClient {
|
27
20
|
#private;
|
28
21
|
static create(options: ApiClientInitConfig): ApiClient;
|
29
|
-
baseUrl: string;
|
30
|
-
interceptors: InterceptorManager;
|
31
22
|
private constructor();
|
23
|
+
get interceptors(): InterceptorManager;
|
24
|
+
get requestHeaders(): RequestHeaders;
|
32
25
|
config(config: ApiClientConfig): ApiClient;
|
33
26
|
userAgent(userAgent: string): ApiClient;
|
34
|
-
|
35
|
-
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
|
27
|
+
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<FetchResponse>;
|
36
28
|
private customHeaders;
|
37
29
|
}
|
38
30
|
export default ApiClient;
|
package/lib/cjs/client.js
CHANGED
@@ -13,14 +13,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
15
|
};
|
16
|
-
var _ApiClient_accessToken,
|
16
|
+
var _ApiClient_baseUrl, _ApiClient_accessToken, _ApiClient_clientConfig, _ApiClient_interceptors;
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
const axios_1 = __importDefault(require("axios"));
|
19
18
|
const error_1 = require("./error");
|
20
19
|
const config_1 = __importDefault(require("./config"));
|
21
|
-
|
22
|
-
// import type { Agent as HttpsAgent } from 'https'
|
23
|
-
// import { packageInfo } from './util'
|
20
|
+
const fetch_1 = require("./fetch");
|
24
21
|
const debug_1 = __importDefault(require("./debug"));
|
25
22
|
const debug = (0, debug_1.default)('client');
|
26
23
|
const baseURL = (organization, domain) => {
|
@@ -34,111 +31,80 @@ class ApiClient {
|
|
34
31
|
return new ApiClient(options);
|
35
32
|
}
|
36
33
|
constructor(options) {
|
34
|
+
_ApiClient_baseUrl.set(this, void 0);
|
37
35
|
_ApiClient_accessToken.set(this, void 0);
|
38
|
-
|
36
|
+
_ApiClient_clientConfig.set(this, void 0);
|
37
|
+
_ApiClient_interceptors.set(this, void 0);
|
39
38
|
debug('new client instance %O', options);
|
40
|
-
this
|
39
|
+
__classPrivateFieldSet(this, _ApiClient_baseUrl, baseURL(options.organization, options.domain), "f");
|
41
40
|
__classPrivateFieldSet(this, _ApiClient_accessToken, options.accessToken, "f");
|
42
|
-
const
|
41
|
+
const fetchConfig = {
|
43
42
|
timeout: options.timeout || config_1.default.client.timeout,
|
44
|
-
proxy: options.proxy,
|
45
|
-
httpAgent: options.httpAgent,
|
46
|
-
httpsAgent: options.httpsAgent
|
47
43
|
};
|
48
|
-
// Set custom headers
|
49
44
|
const customHeaders = this.customHeaders(options.headers);
|
50
|
-
// Set headers
|
51
45
|
const headers = {
|
52
46
|
...customHeaders,
|
53
47
|
'Accept': 'application/vnd.api+json',
|
54
48
|
'Content-Type': 'application/vnd.api+json',
|
55
49
|
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
56
50
|
};
|
57
|
-
|
58
|
-
|
59
|
-
if (userAgent) {
|
60
|
-
if (!userAgent.includes('axios/'))
|
61
|
-
userAgent += ` axios/${axios_1.default.VERSION}`;
|
51
|
+
const userAgent = options.userAgent;
|
52
|
+
if (userAgent)
|
62
53
|
headers['User-Agent'] = userAgent;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
if (
|
71
|
-
|
72
|
-
|
73
|
-
__classPrivateFieldSet(this, _ApiClient_client, axios_1.default.create(axiosOptions), "f");
|
74
|
-
this.interceptors = __classPrivateFieldGet(this, _ApiClient_client, "f").interceptors;
|
54
|
+
fetchConfig.headers = headers;
|
55
|
+
__classPrivateFieldSet(this, _ApiClient_clientConfig, fetchConfig, "f");
|
56
|
+
debug('fetch config: %O', fetchConfig);
|
57
|
+
__classPrivateFieldSet(this, _ApiClient_interceptors, {}, "f");
|
58
|
+
}
|
59
|
+
get interceptors() { return __classPrivateFieldGet(this, _ApiClient_interceptors, "f"); }
|
60
|
+
get requestHeaders() {
|
61
|
+
if (!__classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers)
|
62
|
+
__classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers = {};
|
63
|
+
return __classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers;
|
75
64
|
}
|
76
65
|
config(config) {
|
77
66
|
debug('config %o', config);
|
78
|
-
const def = __classPrivateFieldGet(this,
|
79
|
-
|
67
|
+
const def = __classPrivateFieldGet(this, _ApiClient_clientConfig, "f");
|
68
|
+
if (!def.headers)
|
69
|
+
def.headers = {};
|
80
70
|
if (config.timeout)
|
81
71
|
def.timeout = config.timeout;
|
82
|
-
if (config.proxy)
|
83
|
-
def.proxy = config.proxy;
|
84
|
-
if (config.httpAgent)
|
85
|
-
def.httpAgent = config.httpAgent;
|
86
|
-
if (config.httpsAgent)
|
87
|
-
def.httpsAgent = config.httpsAgent;
|
88
|
-
if (config.adapter)
|
89
|
-
this.adapter(config.adapter);
|
90
72
|
if (config.userAgent)
|
91
73
|
this.userAgent(config.userAgent);
|
92
|
-
// API Client config
|
93
74
|
if (config.organization)
|
94
|
-
this
|
75
|
+
__classPrivateFieldSet(this, _ApiClient_baseUrl, baseURL(config.organization, config.domain), "f");
|
95
76
|
if (config.accessToken) {
|
96
77
|
__classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
|
97
|
-
def.headers.
|
78
|
+
def.headers.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
98
79
|
}
|
99
80
|
if (config.headers)
|
100
|
-
def.headers
|
81
|
+
def.headers = { ...def.headers, ...this.customHeaders(config.headers) };
|
101
82
|
return this;
|
102
83
|
}
|
103
84
|
userAgent(userAgent) {
|
104
|
-
if (userAgent)
|
105
|
-
|
106
|
-
if (!ua.includes('axios/')) {
|
107
|
-
// const axiosVer = packageInfo(['dependencies.axios'], { nestedName: true })
|
108
|
-
if (axios_1.default.VERSION)
|
109
|
-
ua += ` axios/${axios_1.default.VERSION}`;
|
110
|
-
}
|
111
|
-
__classPrivateFieldGet(this, _ApiClient_client, "f").defaults.headers['User-Agent'] = ua;
|
112
|
-
}
|
113
|
-
return this;
|
114
|
-
}
|
115
|
-
adapter(adapter) {
|
116
|
-
if (adapter)
|
117
|
-
__classPrivateFieldGet(this, _ApiClient_client, "f").defaults.adapter = adapter;
|
85
|
+
if (userAgent)
|
86
|
+
this.requestHeaders['User-Agent'] = userAgent;
|
118
87
|
return this;
|
119
88
|
}
|
120
89
|
async request(method, path, body, options) {
|
121
90
|
debug('request %s %s, %O, %O', method, path, body || {}, options || {});
|
122
|
-
|
123
|
-
if (options === null || options === void 0 ? void 0 : options.adapter)
|
124
|
-
debug('Adapter ignored in request config');
|
125
|
-
if (options === null || options === void 0 ? void 0 : options.userAgent)
|
91
|
+
if (options?.userAgent)
|
126
92
|
debug('User-Agent header ignored in request config');
|
127
|
-
const
|
128
|
-
const url = path;
|
129
|
-
|
130
|
-
const
|
131
|
-
const accessToken =
|
132
|
-
const headers = this.customHeaders(options === null || options === void 0 ? void 0 : options.headers);
|
93
|
+
const baseUrl = options?.organization ? baseURL(options.organization, options.domain) : __classPrivateFieldGet(this, _ApiClient_baseUrl, "f");
|
94
|
+
const url = new URL(`${baseUrl}/${path}`);
|
95
|
+
const bodyData = body ? JSON.stringify({ data: body }) : undefined;
|
96
|
+
const headers = { ...this.requestHeaders, ...this.customHeaders(options?.headers) };
|
97
|
+
const accessToken = options?.accessToken || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
133
98
|
if (accessToken)
|
134
99
|
headers.Authorization = 'Bearer ' + accessToken;
|
135
|
-
const
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
100
|
+
const fetchOptions = { method, body: bodyData, headers };
|
101
|
+
const timeout = options?.timeout || __classPrivateFieldGet(this, _ApiClient_clientConfig, "f").timeout;
|
102
|
+
if (timeout)
|
103
|
+
fetchOptions.signal = AbortSignal.timeout(timeout);
|
104
|
+
if (options?.params)
|
105
|
+
Object.entries(options?.params).forEach(([name, value]) => { url.searchParams.append(name, String(value)); });
|
106
|
+
return await (0, fetch_1.fetchURL)(url, fetchOptions, this.interceptors)
|
140
107
|
.catch((error) => (0, error_1.handleError)(error));
|
141
|
-
// .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
|
142
108
|
}
|
143
109
|
customHeaders(headers) {
|
144
110
|
const customHeaders = {};
|
@@ -150,5 +116,5 @@ class ApiClient {
|
|
150
116
|
return customHeaders;
|
151
117
|
}
|
152
118
|
}
|
153
|
-
_ApiClient_accessToken = new WeakMap(),
|
119
|
+
_ApiClient_baseUrl = new WeakMap(), _ApiClient_accessToken = new WeakMap(), _ApiClient_clientConfig = new WeakMap(), _ApiClient_interceptors = new WeakMap();
|
154
120
|
exports.default = ApiClient;
|
@@ -10,142 +10,143 @@ type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
|
|
10
10
|
declare class CommerceLayerClient {
|
11
11
|
#private;
|
12
12
|
readonly openApiSchemaVersion = "5.1.0";
|
13
|
-
addresses: api.Addresses;
|
14
|
-
adjustments: api.Adjustments;
|
15
|
-
adyen_gateways: api.AdyenGateways;
|
16
|
-
adyen_payments: api.AdyenPayments;
|
17
|
-
application: api.Applications;
|
18
|
-
attachments: api.Attachments;
|
19
|
-
authorizations: api.Authorizations;
|
20
|
-
avalara_accounts: api.AvalaraAccounts;
|
21
|
-
axerve_gateways: api.AxerveGateways;
|
22
|
-
axerve_payments: api.AxervePayments;
|
23
|
-
billing_info_validation_rules: api.BillingInfoValidationRules;
|
24
|
-
bing_geocoders: api.BingGeocoders;
|
25
|
-
braintree_gateways: api.BraintreeGateways;
|
26
|
-
braintree_payments: api.BraintreePayments;
|
27
|
-
bundles: api.Bundles;
|
28
|
-
buy_x_pay_y_promotions: api.BuyXPayYPromotions;
|
29
|
-
captures: api.Captures;
|
30
|
-
carrier_accounts: api.CarrierAccounts;
|
31
|
-
checkout_com_gateways: api.CheckoutComGateways;
|
32
|
-
checkout_com_payments: api.CheckoutComPayments;
|
33
|
-
cleanups: api.Cleanups;
|
34
|
-
coupon_codes_promotion_rules: api.CouponCodesPromotionRules;
|
35
|
-
coupon_recipients: api.CouponRecipients;
|
36
|
-
coupons: api.Coupons;
|
37
|
-
custom_promotion_rules: api.CustomPromotionRules;
|
38
|
-
customer_addresses: api.CustomerAddresses;
|
39
|
-
customer_groups: api.CustomerGroups;
|
40
|
-
customer_password_resets: api.CustomerPasswordResets;
|
41
|
-
customer_payment_sources: api.CustomerPaymentSources;
|
42
|
-
customer_subscriptions: api.CustomerSubscriptions;
|
43
|
-
customers: api.Customers;
|
44
|
-
delivery_lead_times: api.DeliveryLeadTimes;
|
45
|
-
event_callbacks: api.EventCallbacks;
|
46
|
-
events: api.Events;
|
47
|
-
exports: api.Exports;
|
48
|
-
external_gateways: api.ExternalGateways;
|
49
|
-
external_payments: api.ExternalPayments;
|
50
|
-
external_promotions: api.ExternalPromotions;
|
51
|
-
external_tax_calculators: api.ExternalTaxCalculators;
|
52
|
-
fixed_amount_promotions: api.FixedAmountPromotions;
|
53
|
-
fixed_price_promotions: api.FixedPricePromotions;
|
54
|
-
free_gift_promotions: api.FreeGiftPromotions;
|
55
|
-
free_shipping_promotions: api.FreeShippingPromotions;
|
56
|
-
geocoders: api.Geocoders;
|
57
|
-
gift_card_recipients: api.GiftCardRecipients;
|
58
|
-
gift_cards: api.GiftCards;
|
59
|
-
google_geocoders: api.GoogleGeocoders;
|
60
|
-
imports: api.Imports;
|
61
|
-
in_stock_subscriptions: api.InStockSubscriptions;
|
62
|
-
inventory_models: api.InventoryModels;
|
63
|
-
inventory_return_locations: api.InventoryReturnLocations;
|
64
|
-
inventory_stock_locations: api.InventoryStockLocations;
|
65
|
-
klarna_gateways: api.KlarnaGateways;
|
66
|
-
klarna_payments: api.KlarnaPayments;
|
67
|
-
line_item_options: api.LineItemOptions;
|
68
|
-
line_items: api.LineItems;
|
69
|
-
manual_gateways: api.ManualGateways;
|
70
|
-
manual_tax_calculators: api.ManualTaxCalculators;
|
71
|
-
markets: api.Markets;
|
72
|
-
merchants: api.Merchants;
|
73
|
-
order_amount_promotion_rules: api.OrderAmountPromotionRules;
|
74
|
-
order_copies: api.OrderCopies;
|
75
|
-
order_factories: api.OrderFactories;
|
76
|
-
order_subscription_items: api.OrderSubscriptionItems;
|
77
|
-
order_subscriptions: api.OrderSubscriptions;
|
78
|
-
order_validation_rules: api.OrderValidationRules;
|
79
|
-
orders: api.Orders;
|
80
|
-
organization: api.Organizations;
|
81
|
-
packages: api.Packages;
|
82
|
-
parcel_line_items: api.ParcelLineItems;
|
83
|
-
parcels: api.Parcels;
|
84
|
-
payment_gateways: api.PaymentGateways;
|
85
|
-
payment_methods: api.PaymentMethods;
|
86
|
-
payment_options: api.PaymentOptions;
|
87
|
-
paypal_gateways: api.PaypalGateways;
|
88
|
-
paypal_payments: api.PaypalPayments;
|
89
|
-
percentage_discount_promotions: api.PercentageDiscountPromotions;
|
90
|
-
price_frequency_tiers: api.PriceFrequencyTiers;
|
91
|
-
price_lists: api.PriceLists;
|
92
|
-
price_tiers: api.PriceTiers;
|
93
|
-
price_volume_tiers: api.PriceVolumeTiers;
|
94
|
-
prices: api.Prices;
|
95
|
-
promotion_rules: api.PromotionRules;
|
96
|
-
promotions: api.Promotions;
|
97
|
-
recurring_order_copies: api.RecurringOrderCopies;
|
98
|
-
refunds: api.Refunds;
|
99
|
-
reserved_stocks: api.ReservedStocks;
|
100
|
-
resource_errors: api.ResourceErrors;
|
101
|
-
return_line_items: api.ReturnLineItems;
|
102
|
-
returns: api.Returns;
|
103
|
-
satispay_gateways: api.SatispayGateways;
|
104
|
-
satispay_payments: api.SatispayPayments;
|
105
|
-
shipments: api.Shipments;
|
106
|
-
shipping_categories: api.ShippingCategories;
|
107
|
-
shipping_method_tiers: api.ShippingMethodTiers;
|
108
|
-
shipping_methods: api.ShippingMethods;
|
109
|
-
shipping_weight_tiers: api.ShippingWeightTiers;
|
110
|
-
shipping_zones: api.ShippingZones;
|
111
|
-
sku_list_items: api.SkuListItems;
|
112
|
-
sku_list_promotion_rules: api.SkuListPromotionRules;
|
113
|
-
sku_lists: api.SkuLists;
|
114
|
-
sku_options: api.SkuOptions;
|
115
|
-
skus: api.Skus;
|
116
|
-
stock_items: api.StockItems;
|
117
|
-
stock_line_items: api.StockLineItems;
|
118
|
-
stock_locations: api.StockLocations;
|
119
|
-
stock_reservations: api.StockReservations;
|
120
|
-
stock_transfers: api.StockTransfers;
|
121
|
-
stripe_gateways: api.StripeGateways;
|
122
|
-
stripe_payments: api.StripePayments;
|
123
|
-
subscription_models: api.SubscriptionModels;
|
124
|
-
tags: api.Tags;
|
125
|
-
tax_calculators: api.TaxCalculators;
|
126
|
-
tax_categories: api.TaxCategories;
|
127
|
-
tax_rules: api.TaxRules;
|
128
|
-
taxjar_accounts: api.TaxjarAccounts;
|
129
|
-
transactions: api.Transactions;
|
130
|
-
versions: api.Versions;
|
131
|
-
voids: api.Voids;
|
132
|
-
webhooks: api.Webhooks;
|
133
|
-
wire_transfers: api.WireTransfers;
|
134
13
|
constructor(config: CommerceLayerInitConfig);
|
14
|
+
get addresses(): api.Addresses;
|
15
|
+
get adjustments(): api.Adjustments;
|
16
|
+
get adyen_gateways(): api.AdyenGateways;
|
17
|
+
get adyen_payments(): api.AdyenPayments;
|
18
|
+
get application(): api.Applications;
|
19
|
+
get attachments(): api.Attachments;
|
20
|
+
get authorizations(): api.Authorizations;
|
21
|
+
get avalara_accounts(): api.AvalaraAccounts;
|
22
|
+
get axerve_gateways(): api.AxerveGateways;
|
23
|
+
get axerve_payments(): api.AxervePayments;
|
24
|
+
get billing_info_validation_rules(): api.BillingInfoValidationRules;
|
25
|
+
get bing_geocoders(): api.BingGeocoders;
|
26
|
+
get braintree_gateways(): api.BraintreeGateways;
|
27
|
+
get braintree_payments(): api.BraintreePayments;
|
28
|
+
get bundles(): api.Bundles;
|
29
|
+
get buy_x_pay_y_promotions(): api.BuyXPayYPromotions;
|
30
|
+
get captures(): api.Captures;
|
31
|
+
get carrier_accounts(): api.CarrierAccounts;
|
32
|
+
get checkout_com_gateways(): api.CheckoutComGateways;
|
33
|
+
get checkout_com_payments(): api.CheckoutComPayments;
|
34
|
+
get cleanups(): api.Cleanups;
|
35
|
+
get coupon_codes_promotion_rules(): api.CouponCodesPromotionRules;
|
36
|
+
get coupon_recipients(): api.CouponRecipients;
|
37
|
+
get coupons(): api.Coupons;
|
38
|
+
get custom_promotion_rules(): api.CustomPromotionRules;
|
39
|
+
get customer_addresses(): api.CustomerAddresses;
|
40
|
+
get customer_groups(): api.CustomerGroups;
|
41
|
+
get customer_password_resets(): api.CustomerPasswordResets;
|
42
|
+
get customer_payment_sources(): api.CustomerPaymentSources;
|
43
|
+
get customer_subscriptions(): api.CustomerSubscriptions;
|
44
|
+
get customers(): api.Customers;
|
45
|
+
get delivery_lead_times(): api.DeliveryLeadTimes;
|
46
|
+
get event_callbacks(): api.EventCallbacks;
|
47
|
+
get events(): api.Events;
|
48
|
+
get exports(): api.Exports;
|
49
|
+
get external_gateways(): api.ExternalGateways;
|
50
|
+
get external_payments(): api.ExternalPayments;
|
51
|
+
get external_promotions(): api.ExternalPromotions;
|
52
|
+
get external_tax_calculators(): api.ExternalTaxCalculators;
|
53
|
+
get fixed_amount_promotions(): api.FixedAmountPromotions;
|
54
|
+
get fixed_price_promotions(): api.FixedPricePromotions;
|
55
|
+
get free_gift_promotions(): api.FreeGiftPromotions;
|
56
|
+
get free_shipping_promotions(): api.FreeShippingPromotions;
|
57
|
+
get geocoders(): api.Geocoders;
|
58
|
+
get gift_card_recipients(): api.GiftCardRecipients;
|
59
|
+
get gift_cards(): api.GiftCards;
|
60
|
+
get google_geocoders(): api.GoogleGeocoders;
|
61
|
+
get imports(): api.Imports;
|
62
|
+
get in_stock_subscriptions(): api.InStockSubscriptions;
|
63
|
+
get inventory_models(): api.InventoryModels;
|
64
|
+
get inventory_return_locations(): api.InventoryReturnLocations;
|
65
|
+
get inventory_stock_locations(): api.InventoryStockLocations;
|
66
|
+
get klarna_gateways(): api.KlarnaGateways;
|
67
|
+
get klarna_payments(): api.KlarnaPayments;
|
68
|
+
get line_item_options(): api.LineItemOptions;
|
69
|
+
get line_items(): api.LineItems;
|
70
|
+
get manual_gateways(): api.ManualGateways;
|
71
|
+
get manual_tax_calculators(): api.ManualTaxCalculators;
|
72
|
+
get markets(): api.Markets;
|
73
|
+
get merchants(): api.Merchants;
|
74
|
+
get order_amount_promotion_rules(): api.OrderAmountPromotionRules;
|
75
|
+
get order_copies(): api.OrderCopies;
|
76
|
+
get order_factories(): api.OrderFactories;
|
77
|
+
get order_subscription_items(): api.OrderSubscriptionItems;
|
78
|
+
get order_subscriptions(): api.OrderSubscriptions;
|
79
|
+
get order_validation_rules(): api.OrderValidationRules;
|
80
|
+
get orders(): api.Orders;
|
81
|
+
get organization(): api.Organizations;
|
82
|
+
get packages(): api.Packages;
|
83
|
+
get parcel_line_items(): api.ParcelLineItems;
|
84
|
+
get parcels(): api.Parcels;
|
85
|
+
get payment_gateways(): api.PaymentGateways;
|
86
|
+
get payment_methods(): api.PaymentMethods;
|
87
|
+
get payment_options(): api.PaymentOptions;
|
88
|
+
get paypal_gateways(): api.PaypalGateways;
|
89
|
+
get paypal_payments(): api.PaypalPayments;
|
90
|
+
get percentage_discount_promotions(): api.PercentageDiscountPromotions;
|
91
|
+
get price_frequency_tiers(): api.PriceFrequencyTiers;
|
92
|
+
get price_lists(): api.PriceLists;
|
93
|
+
get price_tiers(): api.PriceTiers;
|
94
|
+
get price_volume_tiers(): api.PriceVolumeTiers;
|
95
|
+
get prices(): api.Prices;
|
96
|
+
get promotion_rules(): api.PromotionRules;
|
97
|
+
get promotions(): api.Promotions;
|
98
|
+
get recurring_order_copies(): api.RecurringOrderCopies;
|
99
|
+
get refunds(): api.Refunds;
|
100
|
+
get reserved_stocks(): api.ReservedStocks;
|
101
|
+
get resource_errors(): api.ResourceErrors;
|
102
|
+
get return_line_items(): api.ReturnLineItems;
|
103
|
+
get returns(): api.Returns;
|
104
|
+
get satispay_gateways(): api.SatispayGateways;
|
105
|
+
get satispay_payments(): api.SatispayPayments;
|
106
|
+
get shipments(): api.Shipments;
|
107
|
+
get shipping_categories(): api.ShippingCategories;
|
108
|
+
get shipping_method_tiers(): api.ShippingMethodTiers;
|
109
|
+
get shipping_methods(): api.ShippingMethods;
|
110
|
+
get shipping_weight_tiers(): api.ShippingWeightTiers;
|
111
|
+
get shipping_zones(): api.ShippingZones;
|
112
|
+
get sku_list_items(): api.SkuListItems;
|
113
|
+
get sku_list_promotion_rules(): api.SkuListPromotionRules;
|
114
|
+
get sku_lists(): api.SkuLists;
|
115
|
+
get sku_options(): api.SkuOptions;
|
116
|
+
get skus(): api.Skus;
|
117
|
+
get stock_items(): api.StockItems;
|
118
|
+
get stock_line_items(): api.StockLineItems;
|
119
|
+
get stock_locations(): api.StockLocations;
|
120
|
+
get stock_reservations(): api.StockReservations;
|
121
|
+
get stock_transfers(): api.StockTransfers;
|
122
|
+
get stripe_gateways(): api.StripeGateways;
|
123
|
+
get stripe_payments(): api.StripePayments;
|
124
|
+
get subscription_models(): api.SubscriptionModels;
|
125
|
+
get tags(): api.Tags;
|
126
|
+
get tax_calculators(): api.TaxCalculators;
|
127
|
+
get tax_categories(): api.TaxCategories;
|
128
|
+
get tax_rules(): api.TaxRules;
|
129
|
+
get taxjar_accounts(): api.TaxjarAccounts;
|
130
|
+
get transactions(): api.Transactions;
|
131
|
+
get versions(): api.Versions;
|
132
|
+
get voids(): api.Voids;
|
133
|
+
get webhooks(): api.Webhooks;
|
134
|
+
get wire_transfers(): api.WireTransfers;
|
135
135
|
get currentOrganization(): string;
|
136
|
+
private get interceptors();
|
136
137
|
private localConfig;
|
137
138
|
config(config: CommerceLayerConfig): CommerceLayerClient;
|
138
139
|
resources(): readonly string[];
|
139
140
|
singletons(): readonly string[];
|
140
141
|
isSingleton(resource: api.ResourceTypeLock): boolean;
|
141
142
|
isApiError(error: any): error is ApiError;
|
142
|
-
addRequestInterceptor(
|
143
|
-
addResponseInterceptor(
|
144
|
-
removeInterceptor(type: InterceptorType, id
|
143
|
+
addRequestInterceptor(onSuccess?: RequestInterceptor, onFailure?: ErrorInterceptor): void;
|
144
|
+
addResponseInterceptor(onSuccess?: ResponseInterceptor, onFailure?: ErrorInterceptor): void;
|
145
|
+
removeInterceptor(type: InterceptorType, id?: number): void;
|
145
146
|
addRawResponseReader(options?: {
|
146
147
|
headers: boolean;
|
147
148
|
}): RawResponseReader;
|
148
|
-
removeRawResponseReader(
|
149
|
+
removeRawResponseReader(): void;
|
149
150
|
}
|
150
151
|
declare const CommerceLayer: (config: CommerceLayerInitConfig) => CommerceLayerClient;
|
151
152
|
export default CommerceLayer;
|