@commercelayer/sdk 4.42.0 → 4.44.1
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 -38
- package/lib/cjs/api.js +14 -7
- package/lib/cjs/client.d.ts +14 -20
- package/lib/cjs/client.js +43 -74
- package/lib/cjs/commercelayer.d.ts +6 -7
- package/lib/cjs/commercelayer.js +4 -14
- package/lib/cjs/common.d.ts +0 -1
- package/lib/cjs/common.js +2 -11
- package/lib/cjs/config.d.ts +0 -1
- package/lib/cjs/config.js +0 -3
- package/lib/cjs/debug.js +4 -0
- package/lib/cjs/error.d.ts +8 -11
- package/lib/cjs/error.js +8 -42
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +16 -0
- package/lib/cjs/interceptor.d.ts +2 -6
- package/lib/cjs/jsonapi.d.ts +0 -1
- package/lib/cjs/jsonapi.js +3 -10
- package/lib/cjs/query.d.ts +15 -9
- package/lib/cjs/query.js +2 -3
- package/lib/cjs/resource.d.ts +20 -31
- package/lib/cjs/resource.js +10 -56
- package/lib/cjs/resources/addresses.d.ts +73 -74
- package/lib/cjs/resources/addresses.js +11 -3
- package/lib/cjs/resources/adjustments.d.ts +19 -20
- package/lib/cjs/resources/adjustments.js +11 -3
- package/lib/cjs/resources/adyen_gateways.d.ts +34 -35
- package/lib/cjs/resources/adyen_gateways.js +11 -3
- package/lib/cjs/resources/adyen_payments.d.ts +27 -29
- package/lib/cjs/resources/adyen_payments.js +11 -6
- package/lib/cjs/resources/application.d.ts +13 -14
- package/lib/cjs/resources/application.js +6 -1
- package/lib/cjs/resources/attachments.d.ts +80 -81
- package/lib/cjs/resources/attachments.js +11 -3
- package/lib/cjs/resources/authorizations.d.ts +43 -47
- package/lib/cjs/resources/authorizations.js +9 -10
- package/lib/cjs/resources/avalara_accounts.d.ts +31 -32
- package/lib/cjs/resources/avalara_accounts.js +11 -3
- package/lib/cjs/resources/axerve_gateways.d.ts +23 -24
- package/lib/cjs/resources/axerve_gateways.js +11 -3
- package/lib/cjs/resources/axerve_payments.d.ts +32 -34
- package/lib/cjs/resources/axerve_payments.js +11 -6
- package/lib/cjs/resources/billing_info_validation_rules.d.ts +16 -17
- package/lib/cjs/resources/billing_info_validation_rules.js +11 -3
- package/lib/cjs/resources/bing_geocoders.d.ts +15 -16
- package/lib/cjs/resources/bing_geocoders.js +11 -3
- package/lib/cjs/resources/braintree_gateways.d.ts +33 -34
- package/lib/cjs/resources/braintree_gateways.js +11 -3
- package/lib/cjs/resources/braintree_payments.d.ts +29 -30
- package/lib/cjs/resources/braintree_payments.js +11 -3
- package/lib/cjs/resources/bundles.d.ts +56 -59
- package/lib/cjs/resources/bundles.js +11 -9
- package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +85 -98
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +15 -13
- package/lib/cjs/resources/captures.d.ts +34 -37
- package/lib/cjs/resources/captures.js +9 -7
- package/lib/cjs/resources/carrier_accounts.d.ts +15 -16
- package/lib/cjs/resources/carrier_accounts.js +8 -0
- package/lib/cjs/resources/checkout_com_gateways.d.ts +24 -25
- package/lib/cjs/resources/checkout_com_gateways.js +11 -3
- package/lib/cjs/resources/checkout_com_payments.d.ts +38 -41
- package/lib/cjs/resources/checkout_com_payments.js +11 -9
- package/lib/cjs/resources/cleanups.d.ts +23 -24
- package/lib/cjs/resources/cleanups.js +10 -2
- package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +32 -33
- package/lib/cjs/resources/coupon_codes_promotion_rules.js +11 -3
- package/lib/cjs/resources/coupon_recipients.d.ts +25 -26
- package/lib/cjs/resources/coupon_recipients.js +11 -3
- package/lib/cjs/resources/coupons.d.ts +41 -42
- package/lib/cjs/resources/coupons.js +11 -3
- package/lib/cjs/resources/custom_promotion_rules.d.ts +30 -31
- package/lib/cjs/resources/custom_promotion_rules.js +11 -3
- package/lib/cjs/resources/customer_addresses.d.ts +22 -23
- package/lib/cjs/resources/customer_addresses.js +11 -3
- package/lib/cjs/resources/customer_groups.d.ts +16 -17
- package/lib/cjs/resources/customer_groups.js +11 -3
- package/lib/cjs/resources/customer_password_resets.d.ts +17 -19
- package/lib/cjs/resources/customer_password_resets.js +11 -6
- package/lib/cjs/resources/customer_payment_sources.d.ts +46 -47
- package/lib/cjs/resources/customer_payment_sources.js +11 -3
- package/lib/cjs/resources/customer_subscriptions.d.ts +14 -15
- package/lib/cjs/resources/customer_subscriptions.js +11 -3
- package/lib/cjs/resources/customers.d.ts +36 -37
- package/lib/cjs/resources/customers.js +11 -3
- package/lib/cjs/resources/delivery_lead_times.d.ts +26 -27
- package/lib/cjs/resources/delivery_lead_times.js +11 -3
- package/lib/cjs/resources/event_callbacks.d.ts +14 -15
- package/lib/cjs/resources/event_callbacks.js +8 -0
- package/lib/cjs/resources/events.d.ts +12 -13
- package/lib/cjs/resources/events.js +8 -0
- package/lib/cjs/resources/exports.d.ts +26 -27
- package/lib/cjs/resources/exports.js +10 -2
- package/lib/cjs/resources/external_gateways.d.ts +31 -32
- package/lib/cjs/resources/external_gateways.js +11 -3
- package/lib/cjs/resources/external_payments.d.ts +22 -23
- package/lib/cjs/resources/external_payments.js +11 -3
- package/lib/cjs/resources/external_promotions.d.ts +82 -95
- package/lib/cjs/resources/external_promotions.js +15 -13
- package/lib/cjs/resources/external_tax_calculators.d.ts +18 -19
- package/lib/cjs/resources/external_tax_calculators.js +11 -3
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +83 -96
- package/lib/cjs/resources/fixed_amount_promotions.js +15 -13
- package/lib/cjs/resources/fixed_price_promotions.d.ts +82 -95
- package/lib/cjs/resources/fixed_price_promotions.js +15 -13
- package/lib/cjs/resources/free_gift_promotions.d.ts +81 -94
- package/lib/cjs/resources/free_gift_promotions.js +15 -13
- package/lib/cjs/resources/free_shipping_promotions.d.ts +78 -86
- package/lib/cjs/resources/free_shipping_promotions.js +15 -13
- package/lib/cjs/resources/geocoders.d.ts +12 -13
- package/lib/cjs/resources/geocoders.js +8 -0
- package/lib/cjs/resources/gift_card_recipients.d.ts +25 -26
- package/lib/cjs/resources/gift_card_recipients.js +11 -3
- package/lib/cjs/resources/gift_cards.d.ts +66 -71
- package/lib/cjs/resources/gift_cards.js +11 -15
- package/lib/cjs/resources/google_geocoders.d.ts +15 -16
- package/lib/cjs/resources/google_geocoders.js +11 -3
- package/lib/cjs/resources/imports.d.ts +29 -30
- package/lib/cjs/resources/imports.js +10 -2
- package/lib/cjs/resources/in_stock_subscriptions.d.ts +35 -38
- package/lib/cjs/resources/in_stock_subscriptions.js +11 -9
- package/lib/cjs/resources/inventory_models.d.ts +31 -32
- package/lib/cjs/resources/inventory_models.js +11 -3
- package/lib/cjs/resources/inventory_return_locations.d.ts +21 -22
- package/lib/cjs/resources/inventory_return_locations.js +11 -3
- package/lib/cjs/resources/inventory_stock_locations.d.ts +24 -25
- package/lib/cjs/resources/inventory_stock_locations.js +11 -3
- package/lib/cjs/resources/klarna_gateways.d.ts +22 -23
- package/lib/cjs/resources/klarna_gateways.js +11 -3
- package/lib/cjs/resources/klarna_payments.d.ts +27 -29
- package/lib/cjs/resources/klarna_payments.js +11 -6
- package/lib/cjs/resources/line_item_options.d.ts +40 -41
- package/lib/cjs/resources/line_item_options.js +11 -3
- package/lib/cjs/resources/line_items.d.ts +101 -104
- package/lib/cjs/resources/line_items.js +11 -9
- package/lib/cjs/resources/manual_gateways.d.ts +14 -15
- package/lib/cjs/resources/manual_gateways.js +11 -3
- package/lib/cjs/resources/manual_tax_calculators.d.ts +20 -21
- package/lib/cjs/resources/manual_tax_calculators.js +11 -3
- package/lib/cjs/resources/markets.d.ts +64 -67
- package/lib/cjs/resources/markets.js +11 -9
- package/lib/cjs/resources/merchants.d.ts +18 -19
- package/lib/cjs/resources/merchants.js +11 -3
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +35 -36
- package/lib/cjs/resources/order_amount_promotion_rules.js +11 -3
- package/lib/cjs/resources/order_copies.d.ts +28 -29
- package/lib/cjs/resources/order_copies.js +11 -3
- package/lib/cjs/resources/order_factories.d.ts +20 -21
- package/lib/cjs/resources/order_factories.js +8 -0
- package/lib/cjs/resources/order_subscription_items.d.ts +39 -40
- package/lib/cjs/resources/order_subscription_items.js +11 -3
- package/lib/cjs/resources/order_subscriptions.d.ts +52 -55
- package/lib/cjs/resources/order_subscriptions.js +11 -12
- package/lib/cjs/resources/order_validation_rules.d.ts +12 -13
- package/lib/cjs/resources/order_validation_rules.js +8 -0
- package/lib/cjs/resources/orders.d.ts +252 -280
- package/lib/cjs/resources/orders.js +11 -84
- package/lib/cjs/resources/organization.d.ts +24 -25
- package/lib/cjs/resources/organization.js +6 -1
- package/lib/cjs/resources/packages.d.ts +30 -31
- package/lib/cjs/resources/packages.js +11 -3
- package/lib/cjs/resources/parcel_line_items.d.ts +22 -23
- package/lib/cjs/resources/parcel_line_items.js +11 -3
- package/lib/cjs/resources/parcels.d.ts +93 -94
- package/lib/cjs/resources/parcels.js +11 -3
- package/lib/cjs/resources/payment_gateways.d.ts +12 -13
- package/lib/cjs/resources/payment_gateways.js +8 -0
- package/lib/cjs/resources/payment_methods.d.ts +54 -54
- package/lib/cjs/resources/payment_methods.js +11 -9
- package/lib/cjs/resources/payment_options.d.ts +23 -24
- package/lib/cjs/resources/payment_options.js +11 -3
- package/lib/cjs/resources/paypal_gateways.d.ts +17 -18
- package/lib/cjs/resources/paypal_gateways.js +11 -3
- package/lib/cjs/resources/paypal_payments.d.ts +31 -32
- package/lib/cjs/resources/paypal_payments.js +11 -3
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +81 -94
- package/lib/cjs/resources/percentage_discount_promotions.js +15 -13
- package/lib/cjs/resources/price_frequency_tiers.d.ts +26 -27
- package/lib/cjs/resources/price_frequency_tiers.js +11 -3
- package/lib/cjs/resources/price_lists.d.ts +23 -24
- package/lib/cjs/resources/price_lists.js +11 -3
- package/lib/cjs/resources/price_tiers.d.ts +17 -18
- package/lib/cjs/resources/price_tiers.js +8 -0
- package/lib/cjs/resources/price_volume_tiers.d.ts +26 -27
- package/lib/cjs/resources/price_volume_tiers.js +11 -3
- package/lib/cjs/resources/prices.d.ts +40 -41
- package/lib/cjs/resources/prices.js +11 -3
- package/lib/cjs/resources/promotion_rules.d.ts +11 -12
- package/lib/cjs/resources/promotion_rules.js +8 -0
- package/lib/cjs/resources/promotions.d.ts +33 -34
- package/lib/cjs/resources/promotions.js +12 -4
- package/lib/cjs/resources/recurring_order_copies.d.ts +28 -29
- package/lib/cjs/resources/recurring_order_copies.js +11 -3
- package/lib/cjs/resources/refunds.d.ts +25 -26
- package/lib/cjs/resources/refunds.js +8 -0
- package/lib/cjs/resources/reserved_stocks.d.ts +13 -14
- package/lib/cjs/resources/reserved_stocks.js +8 -0
- package/lib/cjs/resources/return_line_items.d.ts +27 -29
- package/lib/cjs/resources/return_line_items.js +11 -6
- package/lib/cjs/resources/returns.d.ts +49 -59
- package/lib/cjs/resources/returns.js +11 -30
- package/lib/cjs/resources/satispay_gateways.d.ts +22 -23
- package/lib/cjs/resources/satispay_gateways.js +11 -3
- package/lib/cjs/resources/satispay_payments.d.ts +29 -31
- package/lib/cjs/resources/satispay_payments.js +11 -6
- package/lib/cjs/resources/shipments.d.ts +82 -94
- package/lib/cjs/resources/shipments.js +11 -36
- package/lib/cjs/resources/shipping_categories.d.ts +18 -19
- package/lib/cjs/resources/shipping_categories.js +11 -3
- package/lib/cjs/resources/shipping_method_tiers.d.ts +17 -18
- package/lib/cjs/resources/shipping_method_tiers.js +8 -0
- package/lib/cjs/resources/shipping_methods.d.ts +79 -82
- package/lib/cjs/resources/shipping_methods.js +11 -9
- package/lib/cjs/resources/shipping_weight_tiers.d.ts +25 -26
- package/lib/cjs/resources/shipping_weight_tiers.js +11 -3
- package/lib/cjs/resources/shipping_zones.d.ts +32 -33
- package/lib/cjs/resources/shipping_zones.js +11 -3
- package/lib/cjs/resources/sku_list_items.d.ts +26 -27
- package/lib/cjs/resources/sku_list_items.js +11 -3
- package/lib/cjs/resources/sku_list_promotion_rules.d.ts +39 -40
- package/lib/cjs/resources/sku_list_promotion_rules.js +11 -3
- package/lib/cjs/resources/sku_lists.d.ts +35 -36
- package/lib/cjs/resources/sku_lists.js +11 -3
- package/lib/cjs/resources/sku_options.d.ts +43 -44
- package/lib/cjs/resources/sku_options.js +11 -3
- package/lib/cjs/resources/skus.d.ts +56 -57
- package/lib/cjs/resources/skus.js +11 -3
- package/lib/cjs/resources/stock_items.d.ts +28 -29
- package/lib/cjs/resources/stock_items.js +11 -3
- package/lib/cjs/resources/stock_line_items.d.ts +40 -44
- package/lib/cjs/resources/stock_line_items.js +11 -12
- package/lib/cjs/resources/stock_locations.d.ts +32 -33
- package/lib/cjs/resources/stock_locations.js +11 -3
- package/lib/cjs/resources/stock_reservations.d.ts +22 -24
- package/lib/cjs/resources/stock_reservations.js +11 -6
- package/lib/cjs/resources/stock_transfers.d.ts +44 -51
- package/lib/cjs/resources/stock_transfers.js +11 -21
- package/lib/cjs/resources/stripe_gateways.d.ts +22 -23
- package/lib/cjs/resources/stripe_gateways.js +11 -3
- package/lib/cjs/resources/stripe_payments.d.ts +37 -37
- package/lib/cjs/resources/stripe_payments.js +11 -9
- package/lib/cjs/resources/subscription_models.d.ts +26 -27
- package/lib/cjs/resources/subscription_models.js +11 -3
- package/lib/cjs/resources/tags.d.ts +12 -13
- package/lib/cjs/resources/tags.js +11 -3
- package/lib/cjs/resources/tax_calculators.d.ts +13 -14
- package/lib/cjs/resources/tax_calculators.js +8 -0
- package/lib/cjs/resources/tax_categories.d.ts +30 -31
- package/lib/cjs/resources/tax_categories.js +11 -3
- package/lib/cjs/resources/tax_rules.d.ts +51 -52
- package/lib/cjs/resources/tax_rules.js +11 -3
- package/lib/cjs/resources/taxjar_accounts.d.ts +21 -22
- package/lib/cjs/resources/taxjar_accounts.js +11 -3
- package/lib/cjs/resources/transactions.d.ts +24 -25
- package/lib/cjs/resources/transactions.js +8 -0
- package/lib/cjs/resources/versions.d.ts +14 -14
- package/lib/cjs/resources/versions.js +8 -0
- package/lib/cjs/resources/voids.d.ts +25 -26
- package/lib/cjs/resources/voids.js +8 -0
- package/lib/cjs/resources/webhooks.d.ts +31 -35
- package/lib/cjs/resources/webhooks.js +11 -12
- package/lib/cjs/resources/wire_transfers.d.ts +16 -17
- package/lib/cjs/resources/wire_transfers.js +11 -3
- package/lib/cjs/static.d.ts +2 -5
- package/lib/cjs/static.js +2 -8
- package/lib/cjs/util.d.ts +4 -2
- package/lib/cjs/util.js +0 -1
- package/lib/esm/api.d.ts +0 -38
- package/lib/esm/api.js +13 -6
- package/lib/esm/client.d.ts +14 -20
- package/lib/esm/client.js +44 -75
- package/lib/esm/commercelayer.d.ts +6 -7
- package/lib/esm/commercelayer.js +4 -14
- package/lib/esm/common.d.ts +0 -1
- package/lib/esm/common.js +2 -11
- package/lib/esm/config.d.ts +0 -1
- package/lib/esm/config.js +0 -3
- package/lib/esm/debug.js +4 -0
- package/lib/esm/error.d.ts +8 -11
- package/lib/esm/error.js +6 -37
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +2 -0
- package/lib/esm/interceptor.d.ts +2 -6
- package/lib/esm/jsonapi.d.ts +0 -1
- package/lib/esm/jsonapi.js +3 -10
- package/lib/esm/query.d.ts +15 -9
- package/lib/esm/query.js +2 -2
- package/lib/esm/resource.d.ts +20 -31
- package/lib/esm/resource.js +11 -56
- package/lib/esm/resources/addresses.d.ts +73 -74
- package/lib/esm/resources/addresses.js +11 -3
- package/lib/esm/resources/adjustments.d.ts +19 -20
- package/lib/esm/resources/adjustments.js +11 -3
- package/lib/esm/resources/adyen_gateways.d.ts +34 -35
- package/lib/esm/resources/adyen_gateways.js +11 -3
- package/lib/esm/resources/adyen_payments.d.ts +27 -29
- package/lib/esm/resources/adyen_payments.js +11 -6
- package/lib/esm/resources/application.d.ts +13 -14
- package/lib/esm/resources/application.js +7 -2
- package/lib/esm/resources/attachments.d.ts +80 -81
- package/lib/esm/resources/attachments.js +11 -3
- package/lib/esm/resources/authorizations.d.ts +43 -47
- package/lib/esm/resources/authorizations.js +9 -10
- package/lib/esm/resources/avalara_accounts.d.ts +31 -32
- package/lib/esm/resources/avalara_accounts.js +11 -3
- package/lib/esm/resources/axerve_gateways.d.ts +23 -24
- package/lib/esm/resources/axerve_gateways.js +11 -3
- package/lib/esm/resources/axerve_payments.d.ts +32 -34
- package/lib/esm/resources/axerve_payments.js +11 -6
- package/lib/esm/resources/billing_info_validation_rules.d.ts +16 -17
- package/lib/esm/resources/billing_info_validation_rules.js +11 -3
- package/lib/esm/resources/bing_geocoders.d.ts +15 -16
- package/lib/esm/resources/bing_geocoders.js +11 -3
- package/lib/esm/resources/braintree_gateways.d.ts +33 -34
- package/lib/esm/resources/braintree_gateways.js +11 -3
- package/lib/esm/resources/braintree_payments.d.ts +29 -30
- package/lib/esm/resources/braintree_payments.js +11 -3
- package/lib/esm/resources/bundles.d.ts +56 -59
- package/lib/esm/resources/bundles.js +11 -9
- package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +85 -98
- package/lib/esm/resources/buy_x_pay_y_promotions.js +15 -13
- package/lib/esm/resources/captures.d.ts +34 -37
- package/lib/esm/resources/captures.js +9 -7
- package/lib/esm/resources/carrier_accounts.d.ts +15 -16
- package/lib/esm/resources/carrier_accounts.js +8 -0
- package/lib/esm/resources/checkout_com_gateways.d.ts +24 -25
- package/lib/esm/resources/checkout_com_gateways.js +11 -3
- package/lib/esm/resources/checkout_com_payments.d.ts +38 -41
- package/lib/esm/resources/checkout_com_payments.js +11 -9
- package/lib/esm/resources/cleanups.d.ts +23 -24
- package/lib/esm/resources/cleanups.js +10 -2
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +32 -33
- package/lib/esm/resources/coupon_codes_promotion_rules.js +11 -3
- package/lib/esm/resources/coupon_recipients.d.ts +25 -26
- package/lib/esm/resources/coupon_recipients.js +11 -3
- package/lib/esm/resources/coupons.d.ts +41 -42
- package/lib/esm/resources/coupons.js +11 -3
- package/lib/esm/resources/custom_promotion_rules.d.ts +30 -31
- package/lib/esm/resources/custom_promotion_rules.js +11 -3
- package/lib/esm/resources/customer_addresses.d.ts +22 -23
- package/lib/esm/resources/customer_addresses.js +11 -3
- package/lib/esm/resources/customer_groups.d.ts +16 -17
- package/lib/esm/resources/customer_groups.js +11 -3
- package/lib/esm/resources/customer_password_resets.d.ts +17 -19
- package/lib/esm/resources/customer_password_resets.js +11 -6
- package/lib/esm/resources/customer_payment_sources.d.ts +46 -47
- package/lib/esm/resources/customer_payment_sources.js +11 -3
- package/lib/esm/resources/customer_subscriptions.d.ts +14 -15
- package/lib/esm/resources/customer_subscriptions.js +11 -3
- package/lib/esm/resources/customers.d.ts +36 -37
- package/lib/esm/resources/customers.js +11 -3
- package/lib/esm/resources/delivery_lead_times.d.ts +26 -27
- package/lib/esm/resources/delivery_lead_times.js +11 -3
- package/lib/esm/resources/event_callbacks.d.ts +14 -15
- package/lib/esm/resources/event_callbacks.js +8 -0
- package/lib/esm/resources/events.d.ts +12 -13
- package/lib/esm/resources/events.js +8 -0
- package/lib/esm/resources/exports.d.ts +26 -27
- package/lib/esm/resources/exports.js +10 -2
- package/lib/esm/resources/external_gateways.d.ts +31 -32
- package/lib/esm/resources/external_gateways.js +11 -3
- package/lib/esm/resources/external_payments.d.ts +22 -23
- package/lib/esm/resources/external_payments.js +11 -3
- package/lib/esm/resources/external_promotions.d.ts +82 -95
- package/lib/esm/resources/external_promotions.js +15 -13
- package/lib/esm/resources/external_tax_calculators.d.ts +18 -19
- package/lib/esm/resources/external_tax_calculators.js +11 -3
- package/lib/esm/resources/fixed_amount_promotions.d.ts +83 -96
- package/lib/esm/resources/fixed_amount_promotions.js +15 -13
- package/lib/esm/resources/fixed_price_promotions.d.ts +82 -95
- package/lib/esm/resources/fixed_price_promotions.js +15 -13
- package/lib/esm/resources/free_gift_promotions.d.ts +81 -94
- package/lib/esm/resources/free_gift_promotions.js +15 -13
- package/lib/esm/resources/free_shipping_promotions.d.ts +78 -86
- package/lib/esm/resources/free_shipping_promotions.js +15 -13
- package/lib/esm/resources/geocoders.d.ts +12 -13
- package/lib/esm/resources/geocoders.js +8 -0
- package/lib/esm/resources/gift_card_recipients.d.ts +25 -26
- package/lib/esm/resources/gift_card_recipients.js +11 -3
- package/lib/esm/resources/gift_cards.d.ts +66 -71
- package/lib/esm/resources/gift_cards.js +11 -15
- package/lib/esm/resources/google_geocoders.d.ts +15 -16
- package/lib/esm/resources/google_geocoders.js +11 -3
- package/lib/esm/resources/imports.d.ts +29 -30
- package/lib/esm/resources/imports.js +10 -2
- package/lib/esm/resources/in_stock_subscriptions.d.ts +35 -38
- package/lib/esm/resources/in_stock_subscriptions.js +11 -9
- package/lib/esm/resources/inventory_models.d.ts +31 -32
- package/lib/esm/resources/inventory_models.js +11 -3
- package/lib/esm/resources/inventory_return_locations.d.ts +21 -22
- package/lib/esm/resources/inventory_return_locations.js +11 -3
- package/lib/esm/resources/inventory_stock_locations.d.ts +24 -25
- package/lib/esm/resources/inventory_stock_locations.js +11 -3
- package/lib/esm/resources/klarna_gateways.d.ts +22 -23
- package/lib/esm/resources/klarna_gateways.js +11 -3
- package/lib/esm/resources/klarna_payments.d.ts +27 -29
- package/lib/esm/resources/klarna_payments.js +11 -6
- package/lib/esm/resources/line_item_options.d.ts +40 -41
- package/lib/esm/resources/line_item_options.js +11 -3
- package/lib/esm/resources/line_items.d.ts +101 -104
- package/lib/esm/resources/line_items.js +11 -9
- package/lib/esm/resources/manual_gateways.d.ts +14 -15
- package/lib/esm/resources/manual_gateways.js +11 -3
- package/lib/esm/resources/manual_tax_calculators.d.ts +20 -21
- package/lib/esm/resources/manual_tax_calculators.js +11 -3
- package/lib/esm/resources/markets.d.ts +64 -67
- package/lib/esm/resources/markets.js +11 -9
- package/lib/esm/resources/merchants.d.ts +18 -19
- package/lib/esm/resources/merchants.js +11 -3
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +35 -36
- package/lib/esm/resources/order_amount_promotion_rules.js +11 -3
- package/lib/esm/resources/order_copies.d.ts +28 -29
- package/lib/esm/resources/order_copies.js +11 -3
- package/lib/esm/resources/order_factories.d.ts +20 -21
- package/lib/esm/resources/order_factories.js +8 -0
- package/lib/esm/resources/order_subscription_items.d.ts +39 -40
- package/lib/esm/resources/order_subscription_items.js +11 -3
- package/lib/esm/resources/order_subscriptions.d.ts +52 -55
- package/lib/esm/resources/order_subscriptions.js +11 -12
- package/lib/esm/resources/order_validation_rules.d.ts +12 -13
- package/lib/esm/resources/order_validation_rules.js +8 -0
- package/lib/esm/resources/orders.d.ts +252 -280
- package/lib/esm/resources/orders.js +11 -84
- package/lib/esm/resources/organization.d.ts +24 -25
- package/lib/esm/resources/organization.js +7 -2
- package/lib/esm/resources/packages.d.ts +30 -31
- package/lib/esm/resources/packages.js +11 -3
- package/lib/esm/resources/parcel_line_items.d.ts +22 -23
- package/lib/esm/resources/parcel_line_items.js +11 -3
- package/lib/esm/resources/parcels.d.ts +93 -94
- package/lib/esm/resources/parcels.js +11 -3
- package/lib/esm/resources/payment_gateways.d.ts +12 -13
- package/lib/esm/resources/payment_gateways.js +8 -0
- package/lib/esm/resources/payment_methods.d.ts +54 -54
- package/lib/esm/resources/payment_methods.js +11 -9
- package/lib/esm/resources/payment_options.d.ts +23 -24
- package/lib/esm/resources/payment_options.js +11 -3
- package/lib/esm/resources/paypal_gateways.d.ts +17 -18
- package/lib/esm/resources/paypal_gateways.js +11 -3
- package/lib/esm/resources/paypal_payments.d.ts +31 -32
- package/lib/esm/resources/paypal_payments.js +11 -3
- package/lib/esm/resources/percentage_discount_promotions.d.ts +81 -94
- package/lib/esm/resources/percentage_discount_promotions.js +15 -13
- package/lib/esm/resources/price_frequency_tiers.d.ts +26 -27
- package/lib/esm/resources/price_frequency_tiers.js +11 -3
- package/lib/esm/resources/price_lists.d.ts +23 -24
- package/lib/esm/resources/price_lists.js +11 -3
- package/lib/esm/resources/price_tiers.d.ts +17 -18
- package/lib/esm/resources/price_tiers.js +8 -0
- package/lib/esm/resources/price_volume_tiers.d.ts +26 -27
- package/lib/esm/resources/price_volume_tiers.js +11 -3
- package/lib/esm/resources/prices.d.ts +40 -41
- package/lib/esm/resources/prices.js +11 -3
- package/lib/esm/resources/promotion_rules.d.ts +11 -12
- package/lib/esm/resources/promotion_rules.js +8 -0
- package/lib/esm/resources/promotions.d.ts +33 -34
- package/lib/esm/resources/promotions.js +12 -4
- package/lib/esm/resources/recurring_order_copies.d.ts +28 -29
- package/lib/esm/resources/recurring_order_copies.js +11 -3
- package/lib/esm/resources/refunds.d.ts +25 -26
- package/lib/esm/resources/refunds.js +8 -0
- package/lib/esm/resources/reserved_stocks.d.ts +13 -14
- package/lib/esm/resources/reserved_stocks.js +8 -0
- package/lib/esm/resources/return_line_items.d.ts +27 -29
- package/lib/esm/resources/return_line_items.js +11 -6
- package/lib/esm/resources/returns.d.ts +49 -59
- package/lib/esm/resources/returns.js +11 -30
- package/lib/esm/resources/satispay_gateways.d.ts +22 -23
- package/lib/esm/resources/satispay_gateways.js +11 -3
- package/lib/esm/resources/satispay_payments.d.ts +29 -31
- package/lib/esm/resources/satispay_payments.js +11 -6
- package/lib/esm/resources/shipments.d.ts +82 -94
- package/lib/esm/resources/shipments.js +11 -36
- package/lib/esm/resources/shipping_categories.d.ts +18 -19
- package/lib/esm/resources/shipping_categories.js +11 -3
- package/lib/esm/resources/shipping_method_tiers.d.ts +17 -18
- package/lib/esm/resources/shipping_method_tiers.js +8 -0
- package/lib/esm/resources/shipping_methods.d.ts +79 -82
- package/lib/esm/resources/shipping_methods.js +11 -9
- package/lib/esm/resources/shipping_weight_tiers.d.ts +25 -26
- package/lib/esm/resources/shipping_weight_tiers.js +11 -3
- package/lib/esm/resources/shipping_zones.d.ts +32 -33
- package/lib/esm/resources/shipping_zones.js +11 -3
- package/lib/esm/resources/sku_list_items.d.ts +26 -27
- package/lib/esm/resources/sku_list_items.js +11 -3
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +39 -40
- package/lib/esm/resources/sku_list_promotion_rules.js +11 -3
- package/lib/esm/resources/sku_lists.d.ts +35 -36
- package/lib/esm/resources/sku_lists.js +11 -3
- package/lib/esm/resources/sku_options.d.ts +43 -44
- package/lib/esm/resources/sku_options.js +11 -3
- package/lib/esm/resources/skus.d.ts +56 -57
- package/lib/esm/resources/skus.js +11 -3
- package/lib/esm/resources/stock_items.d.ts +28 -29
- package/lib/esm/resources/stock_items.js +11 -3
- package/lib/esm/resources/stock_line_items.d.ts +40 -44
- package/lib/esm/resources/stock_line_items.js +11 -12
- package/lib/esm/resources/stock_locations.d.ts +32 -33
- package/lib/esm/resources/stock_locations.js +11 -3
- package/lib/esm/resources/stock_reservations.d.ts +22 -24
- package/lib/esm/resources/stock_reservations.js +11 -6
- package/lib/esm/resources/stock_transfers.d.ts +44 -51
- package/lib/esm/resources/stock_transfers.js +11 -21
- package/lib/esm/resources/stripe_gateways.d.ts +22 -23
- package/lib/esm/resources/stripe_gateways.js +11 -3
- package/lib/esm/resources/stripe_payments.d.ts +37 -37
- package/lib/esm/resources/stripe_payments.js +11 -9
- package/lib/esm/resources/subscription_models.d.ts +26 -27
- package/lib/esm/resources/subscription_models.js +11 -3
- package/lib/esm/resources/tags.d.ts +12 -13
- package/lib/esm/resources/tags.js +11 -3
- package/lib/esm/resources/tax_calculators.d.ts +13 -14
- package/lib/esm/resources/tax_calculators.js +8 -0
- package/lib/esm/resources/tax_categories.d.ts +30 -31
- package/lib/esm/resources/tax_categories.js +11 -3
- package/lib/esm/resources/tax_rules.d.ts +51 -52
- package/lib/esm/resources/tax_rules.js +11 -3
- package/lib/esm/resources/taxjar_accounts.d.ts +21 -22
- package/lib/esm/resources/taxjar_accounts.js +11 -3
- package/lib/esm/resources/transactions.d.ts +24 -25
- package/lib/esm/resources/transactions.js +8 -0
- package/lib/esm/resources/versions.d.ts +14 -14
- package/lib/esm/resources/versions.js +8 -0
- package/lib/esm/resources/voids.d.ts +25 -26
- package/lib/esm/resources/voids.js +8 -0
- package/lib/esm/resources/webhooks.d.ts +31 -35
- package/lib/esm/resources/webhooks.js +11 -12
- package/lib/esm/resources/wire_transfers.d.ts +16 -17
- package/lib/esm/resources/wire_transfers.js +11 -3
- package/lib/esm/static.d.ts +2 -5
- package/lib/esm/static.js +2 -8
- package/lib/esm/util.d.ts +4 -2
- package/lib/esm/util.js +1 -27
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
package/lib/cjs/api.d.ts
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
import type { Resource, ResourceRel } from './resource';
|
2
|
-
import type { TagType } from './resources/tags';
|
3
|
-
import type { VersionType } from './resources/versions';
|
4
1
|
/**
|
5
2
|
* ©2024 Commerce Layer Inc.
|
6
3
|
**/
|
@@ -126,38 +123,3 @@ export { default as Webhooks } from './resources/webhooks';
|
|
126
123
|
export { default as WireTransfers } from './resources/wire_transfers';
|
127
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' | 'buy_x_pay_y_promotions' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | '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' | 'payment_options' | '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';
|
128
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", "buy_x_pay_y_promotions", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "cleanups", "coupon_codes_promotion_rules", "coupon_recipients", "coupons", "custom_promotion_rules", "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", "payment_options", "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"];
|
129
|
-
export declare const singletonList: readonly ["application", "organization"];
|
130
|
-
export type RetrievableResourceType = ResourceTypeLock;
|
131
|
-
export type RetrievableResource = Resource & {
|
132
|
-
type: RetrievableResourceType;
|
133
|
-
};
|
134
|
-
export type ListableResourceType = Exclude<ResourceTypeLock, 'application' | 'organization'>;
|
135
|
-
export type ListableResource = Resource & {
|
136
|
-
type: ListableResourceType;
|
137
|
-
};
|
138
|
-
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' | 'buy_x_pay_y_promotions' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | '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' | 'payment_options' | '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_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
|
139
|
-
export type CreatableResource = Resource & {
|
140
|
-
type: CreatableResourceType;
|
141
|
-
};
|
142
|
-
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' | 'buy_x_pay_y_promotions' | 'captures' | 'checkout_com_gateways' | 'checkout_com_payments' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | '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' | 'payment_options' | '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_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
|
143
|
-
export type UpdatableResource = Resource & {
|
144
|
-
type: UpdatableResourceType;
|
145
|
-
};
|
146
|
-
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' | 'buy_x_pay_y_promotions' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | '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' | 'payment_options' | '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_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'webhooks' | 'wire_transfers';
|
147
|
-
export type DeletableResource = Resource & {
|
148
|
-
type: DeletableResourceType;
|
149
|
-
};
|
150
|
-
export type TaggableResourceType = 'addresses' | 'bundles' | 'buy_x_pay_y_promotions' | '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' | 'shipments' | 'sku_options' | 'skus';
|
151
|
-
export type TaggableResource = Resource & {
|
152
|
-
type: TaggableResourceType;
|
153
|
-
tags?: Array<ResourceRel & {
|
154
|
-
type: TagType;
|
155
|
-
}> | null;
|
156
|
-
};
|
157
|
-
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' | 'buy_x_pay_y_promotions' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | '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';
|
158
|
-
export type VersionableResource = Resource & {
|
159
|
-
type: VersionableResourceType;
|
160
|
-
versions?: Array<ResourceRel & {
|
161
|
-
type: VersionType;
|
162
|
-
}> | null;
|
163
|
-
};
|
package/lib/cjs/api.js
CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
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.SkuLists = 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.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
|
-
exports.
|
8
|
+
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 = void 0;
|
9
9
|
// ##__API_RESOURCES_START__##
|
10
10
|
// ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
|
11
11
|
/**
|
@@ -376,9 +376,16 @@ exports.resourceList = [
|
|
376
376
|
'wire_transfers'
|
377
377
|
// ##__API_RESOURCE_LIST_STOP__##
|
378
378
|
];
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
379
|
+
/*
|
380
|
+
type ResourceInfo = {
|
381
|
+
name: string;
|
382
|
+
type: string;
|
383
|
+
api: string;
|
384
|
+
}
|
385
|
+
|
386
|
+
|
387
|
+
export const resourceMap: { [res: string]: ResourceInfo } = {
|
388
|
+
// ##__API_RESOURCE_MAP_START__##
|
389
|
+
// ##__API_RESOURCE_MAP_STOP__##
|
390
|
+
} as const
|
391
|
+
*/
|
package/lib/cjs/client.d.ts
CHANGED
@@ -1,27 +1,24 @@
|
|
1
|
-
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import { AxiosProxyConfig, Method } from 'axios';
|
2
4
|
import type { InterceptorManager } from './interceptor';
|
5
|
+
import type { Agent as HttpAgent } from 'http';
|
6
|
+
import type { Agent as HttpsAgent } from 'https';
|
3
7
|
type ProxyConfig = AxiosProxyConfig | false;
|
4
|
-
type Adapter = AxiosAdapter;
|
5
|
-
type RequestParams = Record<string, string | number | boolean>;
|
6
|
-
type RequestHeaders = Record<string, string>;
|
7
8
|
type RequestConfig = {
|
8
9
|
timeout?: number;
|
9
|
-
params?:
|
10
|
-
|
11
|
-
|
10
|
+
params?: {
|
11
|
+
[key: string]: string | number | boolean;
|
12
|
+
};
|
13
|
+
httpAgent?: HttpAgent;
|
14
|
+
httpsAgent?: HttpsAgent;
|
12
15
|
proxy?: ProxyConfig;
|
13
|
-
headers?: RequestHeaders;
|
14
16
|
};
|
15
|
-
type
|
16
|
-
adapter?: Adapter;
|
17
|
-
userAgent?: string;
|
18
|
-
};
|
19
|
-
type ApiConfig = {
|
17
|
+
type ApiClientInitConfig = {
|
20
18
|
organization: string;
|
21
19
|
domain?: string;
|
22
20
|
accessToken: string;
|
23
|
-
};
|
24
|
-
type ApiClientInitConfig = ApiConfig & RequestConfig & RequestConfigExtra;
|
21
|
+
} & RequestConfig;
|
25
22
|
type ApiClientConfig = Partial<ApiClientInitConfig>;
|
26
23
|
declare class ApiClient {
|
27
24
|
#private;
|
@@ -29,11 +26,8 @@ declare class ApiClient {
|
|
29
26
|
baseUrl: string;
|
30
27
|
interceptors: InterceptorManager;
|
31
28
|
private constructor();
|
32
|
-
config(config: ApiClientConfig):
|
33
|
-
userAgent(userAgent: string): ApiClient;
|
34
|
-
adapter(adapter: Adapter): ApiClient;
|
29
|
+
config(config: ApiClientConfig): void;
|
35
30
|
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
|
36
|
-
private customHeaders;
|
37
31
|
}
|
38
32
|
export default ApiClient;
|
39
|
-
export
|
33
|
+
export { ApiClientInitConfig, ApiClientConfig, RequestConfig };
|
package/lib/cjs/client.js
CHANGED
@@ -15,22 +15,50 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
15
|
};
|
16
16
|
var _ApiClient_accessToken, _ApiClient_client;
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
18
19
|
const axios_1 = __importDefault(require("axios"));
|
19
20
|
const error_1 = require("./error");
|
20
21
|
const config_1 = __importDefault(require("./config"));
|
21
|
-
// import type { Agent as HttpAgent } from 'http'
|
22
|
-
// import type { Agent as HttpsAgent } from 'https'
|
23
|
-
// import { packageInfo } from './util'
|
24
22
|
const debug_1 = __importDefault(require("./debug"));
|
25
23
|
const debug = (0, debug_1.default)('client');
|
26
24
|
const baseURL = (organization, domain) => {
|
27
25
|
return `https://${organization.toLowerCase()}.${domain || config_1.default.default.domain}/api`;
|
28
26
|
};
|
27
|
+
const handleError = (error) => {
|
28
|
+
let sdkError = new error_1.SdkError({ message: error.message });
|
29
|
+
if (axios_1.default.isAxiosError(error)) {
|
30
|
+
if (error.response) {
|
31
|
+
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
32
|
+
const apiError = new error_1.ApiError(sdkError);
|
33
|
+
apiError.type = error_1.ErrorType.RESPONSE;
|
34
|
+
apiError.status = error.response.status;
|
35
|
+
apiError.code = String(apiError.status);
|
36
|
+
apiError.errors = error.response.data.errors;
|
37
|
+
sdkError = apiError;
|
38
|
+
}
|
39
|
+
else if (error.request) {
|
40
|
+
// The request was made but no response was received
|
41
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
|
42
|
+
sdkError.type = error_1.ErrorType.REQUEST;
|
43
|
+
sdkError.request = error.request;
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
// Something happened in setting up the request that triggered an Error
|
47
|
+
sdkError.type = error_1.ErrorType.CLIENT;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
else if (axios_1.default.isCancel(error))
|
51
|
+
sdkError.type = error_1.ErrorType.CANCEL;
|
52
|
+
else
|
53
|
+
sdkError.source = error;
|
54
|
+
throw sdkError;
|
55
|
+
};
|
29
56
|
class ApiClient {
|
30
57
|
static create(options) {
|
31
|
-
|
32
|
-
|
33
|
-
|
58
|
+
if (!(options === null || options === void 0 ? void 0 : options.organization))
|
59
|
+
throw new Error("Undefined 'organization' parameter");
|
60
|
+
if (!(options === null || options === void 0 ? void 0 : options.accessToken))
|
61
|
+
throw new Error("Undefined 'accessToken' parameter");
|
34
62
|
return new ApiClient(options);
|
35
63
|
}
|
36
64
|
constructor(options) {
|
@@ -43,32 +71,13 @@ class ApiClient {
|
|
43
71
|
timeout: options.timeout || config_1.default.client.timeout,
|
44
72
|
proxy: options.proxy,
|
45
73
|
httpAgent: options.httpAgent,
|
46
|
-
httpsAgent: options.httpsAgent
|
47
|
-
};
|
48
|
-
// Set custom headers
|
49
|
-
const customHeaders = this.customHeaders(options.headers);
|
50
|
-
// Set headers
|
51
|
-
const headers = {
|
52
|
-
...customHeaders,
|
53
|
-
'Accept': 'application/vnd.api+json',
|
54
|
-
'Content-Type': 'application/vnd.api+json',
|
55
|
-
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
74
|
+
httpsAgent: options.httpsAgent,
|
56
75
|
};
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
headers['User-Agent'] = userAgent;
|
63
|
-
}
|
64
|
-
const axiosOptions = {
|
65
|
-
baseURL: this.baseUrl,
|
66
|
-
timeout: config_1.default.client.timeout,
|
67
|
-
headers,
|
68
|
-
...axiosConfig
|
69
|
-
};
|
70
|
-
if (options.adapter)
|
71
|
-
axiosOptions.adapter = options.adapter;
|
76
|
+
const axiosOptions = Object.assign({ baseURL: this.baseUrl, timeout: config_1.default.client.timeout, headers: {
|
77
|
+
'Accept': 'application/vnd.api+json',
|
78
|
+
'Content-Type': 'application/vnd.api+json',
|
79
|
+
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f"),
|
80
|
+
} }, axiosConfig);
|
72
81
|
debug('axios options: %O', axiosOptions);
|
73
82
|
__classPrivateFieldSet(this, _ApiClient_client, axios_1.default.create(axiosOptions), "f");
|
74
83
|
this.interceptors = __classPrivateFieldGet(this, _ApiClient_client, "f").interceptors;
|
@@ -85,10 +94,6 @@ class ApiClient {
|
|
85
94
|
def.httpAgent = config.httpAgent;
|
86
95
|
if (config.httpsAgent)
|
87
96
|
def.httpsAgent = config.httpsAgent;
|
88
|
-
if (config.adapter)
|
89
|
-
this.adapter(config.adapter);
|
90
|
-
if (config.userAgent)
|
91
|
-
this.userAgent(config.userAgent);
|
92
97
|
// API Client config
|
93
98
|
if (config.organization)
|
94
99
|
this.baseUrl = baseURL(config.organization, config.domain);
|
@@ -96,59 +101,23 @@ class ApiClient {
|
|
96
101
|
__classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
|
97
102
|
def.headers.common.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
98
103
|
}
|
99
|
-
if (config.headers)
|
100
|
-
def.headers.common = this.customHeaders(config.headers);
|
101
|
-
return this;
|
102
|
-
}
|
103
|
-
userAgent(userAgent) {
|
104
|
-
if (userAgent) {
|
105
|
-
let ua = userAgent;
|
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;
|
118
|
-
return this;
|
119
104
|
}
|
120
105
|
async request(method, path, body, options) {
|
121
106
|
debug('request %s %s, %O, %O', method, path, body || {}, options || {});
|
122
|
-
// Ignored params alerts (in debug mode)
|
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)
|
126
|
-
debug('User-Agent header ignored in request config');
|
127
107
|
const data = body ? { data: body } : undefined;
|
128
108
|
const url = path;
|
129
109
|
// Runtime request parameters
|
130
110
|
const baseUrl = (options === null || options === void 0 ? void 0 : options.organization) ? baseURL(options.organization, options.domain) : undefined;
|
131
111
|
const accessToken = (options === null || options === void 0 ? void 0 : options.accessToken) || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
132
|
-
const headers =
|
133
|
-
|
134
|
-
headers.Authorization = 'Bearer ' + accessToken;
|
135
|
-
const requestParams = { method, baseURL: baseUrl, url, data, ...options, headers };
|
112
|
+
const headers = accessToken ? { 'Authorization': 'Bearer ' + accessToken } : undefined;
|
113
|
+
const requestParams = Object.assign({ method, baseURL: baseUrl, url, data, headers }, options);
|
136
114
|
debug('request params: %O', requestParams);
|
137
115
|
// const start = Date.now()
|
138
116
|
return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
|
139
117
|
.then(response => response.data)
|
140
|
-
.catch(
|
118
|
+
.catch(error => handleError(error));
|
141
119
|
// .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
|
142
120
|
}
|
143
|
-
customHeaders(headers) {
|
144
|
-
const customHeaders = {};
|
145
|
-
if (headers) {
|
146
|
-
for (const [name, value] of Object.entries(headers))
|
147
|
-
if (!['accept', 'content-type', 'authorization', 'user-agent'].includes(name.toLowerCase()))
|
148
|
-
customHeaders[name] = value;
|
149
|
-
}
|
150
|
-
return customHeaders;
|
151
|
-
}
|
152
121
|
}
|
153
122
|
_ApiClient_accessToken = new WeakMap(), _ApiClient_client = new WeakMap();
|
154
123
|
exports.default = ApiClient;
|
@@ -1,15 +1,16 @@
|
|
1
1
|
import * as api from './api';
|
2
|
-
import
|
2
|
+
import { ApiError } from './error';
|
3
3
|
import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
|
4
|
-
import {
|
5
|
-
declare const OPEN_API_SCHEMA_VERSION = "4.
|
4
|
+
import { ResourcesInitConfig } from './resource';
|
5
|
+
declare const OPEN_API_SCHEMA_VERSION = "4.26.0";
|
6
6
|
export { OPEN_API_SCHEMA_VERSION };
|
7
7
|
type SdkConfig = {};
|
8
8
|
type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
|
9
9
|
type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
|
10
10
|
declare class CommerceLayerClient {
|
11
11
|
#private;
|
12
|
-
|
12
|
+
static get openApiSchemaVersion(): string;
|
13
|
+
readonly openApiSchemaVersion = "4.26.0";
|
13
14
|
addresses: api.Addresses;
|
14
15
|
adjustments: api.Adjustments;
|
15
16
|
adyen_gateways: api.AdyenGateways;
|
@@ -133,10 +134,8 @@ declare class CommerceLayerClient {
|
|
133
134
|
constructor(config: CommerceLayerInitConfig);
|
134
135
|
get currentOrganization(): string;
|
135
136
|
private localConfig;
|
136
|
-
config(config: CommerceLayerConfig):
|
137
|
+
config(config: CommerceLayerConfig): void;
|
137
138
|
resources(): readonly string[];
|
138
|
-
singletons(): readonly string[];
|
139
|
-
isSingleton(resource: api.ResourceTypeLock): boolean;
|
140
139
|
isApiError(error: any): error is ApiError;
|
141
140
|
addRequestInterceptor(onFulfilled?: RequestInterceptor, onRejected?: ErrorInterceptor): number;
|
142
141
|
addResponseInterceptor(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number;
|
package/lib/cjs/commercelayer.js
CHANGED
@@ -45,19 +45,18 @@ const resource_1 = __importDefault(require("./resource"));
|
|
45
45
|
const debug_1 = __importDefault(require("./debug"));
|
46
46
|
const debug = (0, debug_1.default)('commercelayer');
|
47
47
|
// Autogenerated schema version number, do not remove this line
|
48
|
-
const OPEN_API_SCHEMA_VERSION = '4.
|
48
|
+
const OPEN_API_SCHEMA_VERSION = '4.26.0';
|
49
49
|
exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
|
50
50
|
class CommerceLayerClient {
|
51
|
+
static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
|
51
52
|
// ##__CL_RESOURCES_DEF_STOP__##
|
52
53
|
constructor(config) {
|
53
|
-
// static get openApiSchemaVersion(): string { return OPEN_API_SCHEMA_VERSION }
|
54
54
|
this.openApiSchemaVersion = OPEN_API_SCHEMA_VERSION;
|
55
55
|
_CommerceLayerClient_adapter.set(this, void 0);
|
56
56
|
_CommerceLayerClient_organization.set(this, void 0);
|
57
57
|
debug('new commercelayer instance %O', config);
|
58
58
|
__classPrivateFieldSet(this, _CommerceLayerClient_adapter, new resource_1.default(config), "f");
|
59
59
|
__classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
|
60
|
-
// this.#environment = 'test'
|
61
60
|
// ##__CL_RESOURCES_INIT_START__##
|
62
61
|
// ##__CL_RESOURCES_INIT_TEMPLATE:: ##__TAB__####__TAB__##this.##__RESOURCE_TYPE__## = new api.##__RESOURCE_CLASS__##(this.#adapter)
|
63
62
|
this.addresses = new api.Addresses(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
@@ -183,8 +182,6 @@ class CommerceLayerClient {
|
|
183
182
|
// ##__CL_RESOURCES_INIT_STOP__##
|
184
183
|
}
|
185
184
|
get currentOrganization() { return __classPrivateFieldGet(this, _CommerceLayerClient_organization, "f"); }
|
186
|
-
// get currentAccessToken(): string { return this.#adapter?.clientInstance?.currentAccessToken}
|
187
|
-
// get environment(): ApiMode { return this.#environment }
|
188
185
|
localConfig(config) {
|
189
186
|
if (config.organization)
|
190
187
|
__classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
|
@@ -198,17 +195,10 @@ class CommerceLayerClient {
|
|
198
195
|
if (!config.organization)
|
199
196
|
config.organization = this.currentOrganization;
|
200
197
|
__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").config(config);
|
201
|
-
return this;
|
202
198
|
}
|
203
199
|
resources() {
|
204
200
|
return static_1.CommerceLayerStatic.resources();
|
205
201
|
}
|
206
|
-
singletons() {
|
207
|
-
return static_1.CommerceLayerStatic.singletons();
|
208
|
-
}
|
209
|
-
isSingleton(resource) {
|
210
|
-
return static_1.CommerceLayerStatic.isSingleton(resource);
|
211
|
-
}
|
212
202
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
213
203
|
isApiError(error) {
|
214
204
|
return static_1.CommerceLayerStatic.isApiError(error);
|
@@ -220,7 +210,7 @@ class CommerceLayerClient {
|
|
220
210
|
return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors.response.use(onFulfilled, onRejected);
|
221
211
|
}
|
222
212
|
removeInterceptor(type, id) {
|
223
|
-
__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors[type].eject(id);
|
213
|
+
return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors[type].eject(id);
|
224
214
|
}
|
225
215
|
addRawResponseReader(options) {
|
226
216
|
const reader = {
|
@@ -241,7 +231,7 @@ class CommerceLayerClient {
|
|
241
231
|
removeRawResponseReader(reader) {
|
242
232
|
const id = (typeof reader === 'number') ? reader : reader === null || reader === void 0 ? void 0 : reader.id;
|
243
233
|
if (id && (id >= 0))
|
244
|
-
this.removeInterceptor('response', id);
|
234
|
+
return this.removeInterceptor('response', id);
|
245
235
|
}
|
246
236
|
}
|
247
237
|
_CommerceLayerClient_adapter = new WeakMap(), _CommerceLayerClient_organization = new WeakMap();
|
package/lib/cjs/common.d.ts
CHANGED
@@ -2,4 +2,3 @@ import type { ResourceId, ResourceType } from './resource';
|
|
2
2
|
declare const isResourceId: (resource: any) => resource is ResourceId;
|
3
3
|
declare const isResourceType: (resource: any) => resource is ResourceType;
|
4
4
|
export { isResourceId, isResourceType };
|
5
|
-
export type ObjectType = Record<string, any>;
|
package/lib/cjs/common.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
2
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
5
|
exports.isResourceType = exports.isResourceId = void 0;
|
4
6
|
const api_1 = require("./api");
|
@@ -10,14 +12,3 @@ const isResourceType = (resource) => {
|
|
10
12
|
return resource && (typeof resource.type !== 'undefined') && resource.type && api_1.resourceList.includes(resource.type);
|
11
13
|
};
|
12
14
|
exports.isResourceType = isResourceType;
|
13
|
-
/*
|
14
|
-
// Nullable types
|
15
|
-
type StringNullable = string | null
|
16
|
-
type NumberNullable = number | null
|
17
|
-
type BooleanNullable = boolean | null
|
18
|
-
type ResourceNullable<R extends Resource> = R | null
|
19
|
-
type ResourceArrayNullable<R extends Resource> = R[] | null
|
20
|
-
|
21
|
-
|
22
|
-
export type { StringNullable, NumberNullable, BooleanNullable, ResourceNullable, ResourceArrayNullable }
|
23
|
-
*/
|
package/lib/cjs/config.d.ts
CHANGED
package/lib/cjs/config.js
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
"use strict";
|
2
|
-
// export type ApiMode = 'test' | 'live'
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
3
|
const config = {
|
5
4
|
default: {
|
6
|
-
// environment: 'test',
|
7
5
|
domain: 'commercelayer.io',
|
8
6
|
pageNumber: 1,
|
9
7
|
pageSize: 10,
|
10
8
|
},
|
11
9
|
client: {
|
12
10
|
timeout: 15000,
|
13
|
-
requiredAttributes: ['organization', 'accessToken'],
|
14
11
|
}
|
15
12
|
};
|
16
13
|
exports.default = config;
|
package/lib/cjs/debug.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
4
|
+
// import Debug from 'debug'
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
/* Nope debugger */
|
4
7
|
const debuggerFunction = (_pattern, ..._args) => {
|
@@ -7,6 +10,7 @@ const debuggerFunction = (_pattern, ..._args) => {
|
|
7
10
|
let debuggerFactory = (_namespace) => debuggerFunction;
|
8
11
|
/* Try loading 'debug' module */
|
9
12
|
try {
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
10
14
|
const debugModule = require('debug');
|
11
15
|
if (debugModule && (typeof debugModule === 'function'))
|
12
16
|
debuggerFactory = debugModule;
|
package/lib/cjs/error.d.ts
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
declare enum ErrorType {
|
2
|
-
CLIENT = "client"
|
3
|
-
REQUEST = "request"
|
4
|
-
RESPONSE = "response"
|
5
|
-
|
6
|
-
|
7
|
-
GENERIC = "generic"
|
2
|
+
CLIENT = "client",
|
3
|
+
REQUEST = "request",
|
4
|
+
RESPONSE = "response",
|
5
|
+
GENERIC = "generic",
|
6
|
+
CANCEL = "cancel"
|
8
7
|
}
|
9
8
|
declare class SdkError extends Error {
|
10
9
|
static NAME: string;
|
11
|
-
static isSdkError(error: any): error is
|
12
|
-
type:
|
10
|
+
static isSdkError(error: any): error is ApiError;
|
11
|
+
type: string;
|
13
12
|
code?: string;
|
14
13
|
source?: Error;
|
15
14
|
request?: any;
|
@@ -23,9 +22,7 @@ declare class ApiError extends SdkError {
|
|
23
22
|
static isApiError(error: any): error is ApiError;
|
24
23
|
errors: any[];
|
25
24
|
status?: number;
|
26
|
-
statusText?: string;
|
27
25
|
constructor(error: SdkError);
|
28
26
|
first(): any;
|
29
27
|
}
|
30
|
-
|
31
|
-
export { SdkError, ApiError, ErrorType, handleError };
|
28
|
+
export { SdkError, ApiError, ErrorType };
|
package/lib/cjs/error.js
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
4
|
+
exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
|
8
5
|
var ErrorType;
|
9
6
|
(function (ErrorType) {
|
10
7
|
ErrorType["CLIENT"] = "client";
|
11
8
|
ErrorType["REQUEST"] = "request";
|
12
9
|
ErrorType["RESPONSE"] = "response";
|
13
|
-
ErrorType["CANCEL"] = "cancel";
|
14
|
-
ErrorType["PARSE"] = "parse";
|
15
10
|
ErrorType["GENERIC"] = "generic";
|
16
|
-
|
11
|
+
ErrorType["CANCEL"] = "cancel";
|
12
|
+
})(ErrorType || (ErrorType = {}));
|
13
|
+
exports.ErrorType = ErrorType;
|
17
14
|
class SdkError extends Error {
|
15
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
18
16
|
static isSdkError(error) {
|
19
17
|
return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
20
18
|
}
|
@@ -27,11 +25,12 @@ class SdkError extends Error {
|
|
27
25
|
exports.SdkError = SdkError;
|
28
26
|
SdkError.NAME = 'SdkError';
|
29
27
|
class ApiError extends SdkError {
|
28
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
30
29
|
static isApiError(error) {
|
31
30
|
return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
|
32
31
|
}
|
33
32
|
constructor(error) {
|
34
|
-
super({
|
33
|
+
super(Object.assign(Object.assign({}, error), { type: ErrorType.RESPONSE }));
|
35
34
|
this.errors = [];
|
36
35
|
this.name = ApiError.NAME; // this.constructor.name
|
37
36
|
}
|
@@ -42,36 +41,3 @@ class ApiError extends SdkError {
|
|
42
41
|
}
|
43
42
|
exports.ApiError = ApiError;
|
44
43
|
ApiError.NAME = 'ApiError';
|
45
|
-
const handleError = (error) => {
|
46
|
-
let sdkError = new SdkError({ message: error.message });
|
47
|
-
if (axios_1.default.isAxiosError(error)) {
|
48
|
-
if (error.response) {
|
49
|
-
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
50
|
-
const apiError = new ApiError(sdkError);
|
51
|
-
apiError.type = ErrorType.RESPONSE;
|
52
|
-
apiError.status = error.response.status;
|
53
|
-
apiError.statusText = error.response.statusText;
|
54
|
-
apiError.code = String(apiError.status);
|
55
|
-
apiError.errors = error.response.data.errors;
|
56
|
-
if (!apiError.message && apiError.statusText)
|
57
|
-
apiError.message = apiError.statusText;
|
58
|
-
sdkError = apiError;
|
59
|
-
}
|
60
|
-
else if (error.request) {
|
61
|
-
// The request was made but no response was received
|
62
|
-
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
|
63
|
-
sdkError.type = ErrorType.REQUEST;
|
64
|
-
sdkError.request = error.request;
|
65
|
-
}
|
66
|
-
else {
|
67
|
-
// Something happened in setting up the request that triggered an Error
|
68
|
-
sdkError.type = ErrorType.CLIENT;
|
69
|
-
}
|
70
|
-
}
|
71
|
-
else if (axios_1.default.isCancel(error))
|
72
|
-
sdkError.type = ErrorType.CANCEL;
|
73
|
-
else
|
74
|
-
sdkError.source = error;
|
75
|
-
throw sdkError;
|
76
|
-
};
|
77
|
-
exports.handleError = handleError;
|
package/lib/cjs/index.d.ts
CHANGED
@@ -2,6 +2,6 @@ export { default, CommerceLayer } from './commercelayer';
|
|
2
2
|
export type { CommerceLayerClient } from './commercelayer';
|
3
3
|
export { CommerceLayerStatic } from './static';
|
4
4
|
export type { QueryParamsRetrieve, QueryParamsList, QueryParams } from './query';
|
5
|
-
export
|
5
|
+
export * from './model';
|
6
6
|
export type { RequestObj, ResponseObj, ErrorObj, HeadersObj } from './interceptor';
|
7
7
|
export type { SdkError, ApiError, ErrorType } from './error';
|