@commercelayer/sdk 4.41.0 → 4.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/api.d.ts +38 -0
- package/lib/cjs/api.js +7 -14
- package/lib/cjs/client.d.ts +20 -14
- package/lib/cjs/client.js +74 -43
- package/lib/cjs/commercelayer.d.ts +7 -6
- package/lib/cjs/commercelayer.js +14 -4
- package/lib/cjs/common.d.ts +1 -0
- package/lib/cjs/common.js +11 -2
- package/lib/cjs/config.d.ts +1 -0
- package/lib/cjs/config.js +3 -0
- package/lib/cjs/debug.js +0 -4
- package/lib/cjs/error.d.ts +11 -8
- package/lib/cjs/error.js +42 -8
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +0 -16
- package/lib/cjs/interceptor.d.ts +6 -2
- package/lib/cjs/jsonapi.d.ts +1 -0
- package/lib/cjs/jsonapi.js +10 -3
- package/lib/cjs/query.d.ts +9 -15
- package/lib/cjs/query.js +3 -2
- package/lib/cjs/resource.d.ts +31 -20
- package/lib/cjs/resource.js +56 -10
- package/lib/cjs/resources/addresses.d.ts +74 -73
- package/lib/cjs/resources/addresses.js +3 -11
- package/lib/cjs/resources/adjustments.d.ts +20 -19
- package/lib/cjs/resources/adjustments.js +3 -11
- package/lib/cjs/resources/adyen_gateways.d.ts +35 -34
- package/lib/cjs/resources/adyen_gateways.js +3 -11
- package/lib/cjs/resources/adyen_payments.d.ts +29 -27
- package/lib/cjs/resources/adyen_payments.js +6 -11
- package/lib/cjs/resources/application.d.ts +14 -13
- package/lib/cjs/resources/application.js +1 -6
- package/lib/cjs/resources/attachments.d.ts +81 -80
- package/lib/cjs/resources/attachments.js +3 -11
- package/lib/cjs/resources/authorizations.d.ts +47 -43
- package/lib/cjs/resources/authorizations.js +10 -9
- package/lib/cjs/resources/avalara_accounts.d.ts +32 -31
- package/lib/cjs/resources/avalara_accounts.js +3 -11
- package/lib/cjs/resources/axerve_gateways.d.ts +24 -23
- package/lib/cjs/resources/axerve_gateways.js +3 -11
- package/lib/cjs/resources/axerve_payments.d.ts +34 -32
- package/lib/cjs/resources/axerve_payments.js +6 -11
- package/lib/cjs/resources/billing_info_validation_rules.d.ts +17 -16
- package/lib/cjs/resources/billing_info_validation_rules.js +3 -11
- package/lib/cjs/resources/bing_geocoders.d.ts +16 -15
- package/lib/cjs/resources/bing_geocoders.js +3 -11
- package/lib/cjs/resources/braintree_gateways.d.ts +34 -33
- package/lib/cjs/resources/braintree_gateways.js +3 -11
- package/lib/cjs/resources/braintree_payments.d.ts +30 -29
- package/lib/cjs/resources/braintree_payments.js +3 -11
- package/lib/cjs/resources/bundles.d.ts +59 -56
- package/lib/cjs/resources/bundles.js +9 -11
- package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +96 -85
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +13 -11
- package/lib/cjs/resources/captures.d.ts +37 -34
- package/lib/cjs/resources/captures.js +7 -9
- package/lib/cjs/resources/carrier_accounts.d.ts +16 -15
- package/lib/cjs/resources/carrier_accounts.js +0 -8
- package/lib/cjs/resources/checkout_com_gateways.d.ts +25 -24
- package/lib/cjs/resources/checkout_com_gateways.js +3 -11
- package/lib/cjs/resources/checkout_com_payments.d.ts +41 -38
- package/lib/cjs/resources/checkout_com_payments.js +9 -11
- package/lib/cjs/resources/cleanups.d.ts +24 -23
- package/lib/cjs/resources/cleanups.js +2 -10
- package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +33 -32
- package/lib/cjs/resources/coupon_codes_promotion_rules.js +3 -11
- package/lib/cjs/resources/coupon_recipients.d.ts +26 -25
- package/lib/cjs/resources/coupon_recipients.js +3 -11
- package/lib/cjs/resources/coupons.d.ts +42 -41
- package/lib/cjs/resources/coupons.js +3 -11
- package/lib/cjs/resources/custom_promotion_rules.d.ts +31 -30
- package/lib/cjs/resources/custom_promotion_rules.js +3 -11
- package/lib/cjs/resources/customer_addresses.d.ts +23 -22
- package/lib/cjs/resources/customer_addresses.js +3 -11
- package/lib/cjs/resources/customer_groups.d.ts +17 -16
- package/lib/cjs/resources/customer_groups.js +3 -11
- package/lib/cjs/resources/customer_password_resets.d.ts +19 -17
- package/lib/cjs/resources/customer_password_resets.js +6 -11
- package/lib/cjs/resources/customer_payment_sources.d.ts +47 -46
- package/lib/cjs/resources/customer_payment_sources.js +3 -11
- package/lib/cjs/resources/customer_subscriptions.d.ts +15 -14
- package/lib/cjs/resources/customer_subscriptions.js +3 -11
- package/lib/cjs/resources/customers.d.ts +37 -36
- package/lib/cjs/resources/customers.js +3 -11
- package/lib/cjs/resources/delivery_lead_times.d.ts +27 -26
- package/lib/cjs/resources/delivery_lead_times.js +3 -11
- package/lib/cjs/resources/event_callbacks.d.ts +15 -14
- package/lib/cjs/resources/event_callbacks.js +0 -8
- package/lib/cjs/resources/events.d.ts +13 -12
- package/lib/cjs/resources/events.js +0 -8
- package/lib/cjs/resources/exports.d.ts +27 -26
- package/lib/cjs/resources/exports.js +2 -10
- package/lib/cjs/resources/external_gateways.d.ts +32 -31
- package/lib/cjs/resources/external_gateways.js +3 -11
- package/lib/cjs/resources/external_payments.d.ts +23 -22
- package/lib/cjs/resources/external_payments.js +3 -11
- package/lib/cjs/resources/external_promotions.d.ts +93 -82
- package/lib/cjs/resources/external_promotions.js +13 -11
- package/lib/cjs/resources/external_tax_calculators.d.ts +19 -18
- package/lib/cjs/resources/external_tax_calculators.js +3 -11
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +94 -83
- package/lib/cjs/resources/fixed_amount_promotions.js +13 -11
- package/lib/cjs/resources/fixed_price_promotions.d.ts +93 -82
- package/lib/cjs/resources/fixed_price_promotions.js +13 -11
- package/lib/cjs/resources/free_gift_promotions.d.ts +92 -81
- package/lib/cjs/resources/free_gift_promotions.js +13 -11
- package/lib/cjs/resources/free_shipping_promotions.d.ts +85 -74
- package/lib/cjs/resources/free_shipping_promotions.js +13 -11
- package/lib/cjs/resources/geocoders.d.ts +13 -12
- package/lib/cjs/resources/geocoders.js +0 -8
- package/lib/cjs/resources/gift_card_recipients.d.ts +26 -25
- package/lib/cjs/resources/gift_card_recipients.js +3 -11
- package/lib/cjs/resources/gift_cards.d.ts +71 -66
- package/lib/cjs/resources/gift_cards.js +15 -11
- package/lib/cjs/resources/google_geocoders.d.ts +16 -15
- package/lib/cjs/resources/google_geocoders.js +3 -11
- package/lib/cjs/resources/imports.d.ts +30 -29
- package/lib/cjs/resources/imports.js +2 -10
- package/lib/cjs/resources/in_stock_subscriptions.d.ts +38 -35
- package/lib/cjs/resources/in_stock_subscriptions.js +9 -11
- package/lib/cjs/resources/inventory_models.d.ts +32 -28
- package/lib/cjs/resources/inventory_models.js +3 -11
- package/lib/cjs/resources/inventory_return_locations.d.ts +22 -21
- package/lib/cjs/resources/inventory_return_locations.js +3 -11
- package/lib/cjs/resources/inventory_stock_locations.d.ts +25 -24
- package/lib/cjs/resources/inventory_stock_locations.js +3 -11
- package/lib/cjs/resources/klarna_gateways.d.ts +23 -22
- package/lib/cjs/resources/klarna_gateways.js +3 -11
- package/lib/cjs/resources/klarna_payments.d.ts +29 -27
- package/lib/cjs/resources/klarna_payments.js +6 -11
- package/lib/cjs/resources/line_item_options.d.ts +41 -40
- package/lib/cjs/resources/line_item_options.js +3 -11
- package/lib/cjs/resources/line_items.d.ts +106 -100
- package/lib/cjs/resources/line_items.js +13 -11
- package/lib/cjs/resources/manual_gateways.d.ts +15 -14
- package/lib/cjs/resources/manual_gateways.js +3 -11
- package/lib/cjs/resources/manual_tax_calculators.d.ts +21 -20
- package/lib/cjs/resources/manual_tax_calculators.js +3 -11
- package/lib/cjs/resources/markets.d.ts +67 -64
- package/lib/cjs/resources/markets.js +9 -11
- package/lib/cjs/resources/merchants.d.ts +19 -18
- package/lib/cjs/resources/merchants.js +3 -11
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +36 -35
- package/lib/cjs/resources/order_amount_promotion_rules.js +3 -11
- package/lib/cjs/resources/order_copies.d.ts +29 -28
- package/lib/cjs/resources/order_copies.js +3 -11
- package/lib/cjs/resources/order_factories.d.ts +21 -20
- package/lib/cjs/resources/order_factories.js +0 -8
- package/lib/cjs/resources/order_subscription_items.d.ts +40 -39
- package/lib/cjs/resources/order_subscription_items.js +3 -11
- package/lib/cjs/resources/order_subscriptions.d.ts +55 -51
- package/lib/cjs/resources/order_subscriptions.js +12 -11
- package/lib/cjs/resources/order_validation_rules.d.ts +13 -12
- package/lib/cjs/resources/order_validation_rules.js +0 -8
- package/lib/cjs/resources/orders.d.ts +281 -251
- package/lib/cjs/resources/orders.js +88 -11
- package/lib/cjs/resources/organization.d.ts +25 -24
- package/lib/cjs/resources/organization.js +1 -6
- package/lib/cjs/resources/packages.d.ts +31 -30
- package/lib/cjs/resources/packages.js +3 -11
- package/lib/cjs/resources/parcel_line_items.d.ts +23 -22
- package/lib/cjs/resources/parcel_line_items.js +3 -11
- package/lib/cjs/resources/parcels.d.ts +94 -93
- package/lib/cjs/resources/parcels.js +3 -11
- package/lib/cjs/resources/payment_gateways.d.ts +13 -12
- package/lib/cjs/resources/payment_gateways.js +0 -8
- package/lib/cjs/resources/payment_methods.d.ts +54 -51
- package/lib/cjs/resources/payment_methods.js +9 -11
- package/lib/cjs/resources/payment_options.d.ts +24 -23
- package/lib/cjs/resources/payment_options.js +3 -11
- package/lib/cjs/resources/paypal_gateways.d.ts +18 -17
- package/lib/cjs/resources/paypal_gateways.js +3 -11
- package/lib/cjs/resources/paypal_payments.d.ts +32 -31
- package/lib/cjs/resources/paypal_payments.js +3 -11
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +92 -81
- package/lib/cjs/resources/percentage_discount_promotions.js +13 -11
- package/lib/cjs/resources/price_frequency_tiers.d.ts +27 -26
- package/lib/cjs/resources/price_frequency_tiers.js +3 -11
- package/lib/cjs/resources/price_lists.d.ts +24 -23
- package/lib/cjs/resources/price_lists.js +3 -11
- package/lib/cjs/resources/price_tiers.d.ts +18 -17
- package/lib/cjs/resources/price_tiers.js +0 -8
- package/lib/cjs/resources/price_volume_tiers.d.ts +27 -26
- package/lib/cjs/resources/price_volume_tiers.js +3 -11
- package/lib/cjs/resources/prices.d.ts +41 -40
- package/lib/cjs/resources/prices.js +3 -11
- package/lib/cjs/resources/promotion_rules.d.ts +12 -11
- package/lib/cjs/resources/promotion_rules.js +0 -8
- package/lib/cjs/resources/promotions.d.ts +34 -30
- package/lib/cjs/resources/promotions.js +4 -8
- package/lib/cjs/resources/recurring_order_copies.d.ts +29 -28
- package/lib/cjs/resources/recurring_order_copies.js +3 -11
- package/lib/cjs/resources/refunds.d.ts +26 -25
- package/lib/cjs/resources/refunds.js +0 -8
- package/lib/cjs/resources/reserved_stocks.d.ts +14 -13
- package/lib/cjs/resources/reserved_stocks.js +0 -8
- package/lib/cjs/resources/return_line_items.d.ts +29 -27
- package/lib/cjs/resources/return_line_items.js +6 -11
- package/lib/cjs/resources/returns.d.ts +59 -49
- package/lib/cjs/resources/returns.js +30 -11
- package/lib/cjs/resources/satispay_gateways.d.ts +23 -22
- package/lib/cjs/resources/satispay_gateways.js +3 -11
- package/lib/cjs/resources/satispay_payments.d.ts +31 -29
- package/lib/cjs/resources/satispay_payments.js +6 -11
- package/lib/cjs/resources/shipments.d.ts +94 -82
- package/lib/cjs/resources/shipments.js +36 -11
- package/lib/cjs/resources/shipping_categories.d.ts +19 -18
- package/lib/cjs/resources/shipping_categories.js +3 -11
- package/lib/cjs/resources/shipping_method_tiers.d.ts +18 -17
- package/lib/cjs/resources/shipping_method_tiers.js +0 -8
- package/lib/cjs/resources/shipping_methods.d.ts +82 -79
- package/lib/cjs/resources/shipping_methods.js +9 -11
- package/lib/cjs/resources/shipping_weight_tiers.d.ts +26 -25
- package/lib/cjs/resources/shipping_weight_tiers.js +3 -11
- package/lib/cjs/resources/shipping_zones.d.ts +33 -32
- package/lib/cjs/resources/shipping_zones.js +3 -11
- package/lib/cjs/resources/sku_list_items.d.ts +27 -26
- package/lib/cjs/resources/sku_list_items.js +3 -11
- package/lib/cjs/resources/sku_list_promotion_rules.d.ts +40 -39
- package/lib/cjs/resources/sku_list_promotion_rules.js +3 -11
- package/lib/cjs/resources/sku_lists.d.ts +36 -35
- package/lib/cjs/resources/sku_lists.js +3 -11
- package/lib/cjs/resources/sku_options.d.ts +44 -43
- package/lib/cjs/resources/sku_options.js +3 -11
- package/lib/cjs/resources/skus.d.ts +57 -56
- package/lib/cjs/resources/skus.js +3 -11
- package/lib/cjs/resources/stock_items.d.ts +29 -28
- package/lib/cjs/resources/stock_items.js +3 -11
- package/lib/cjs/resources/stock_line_items.d.ts +44 -37
- package/lib/cjs/resources/stock_line_items.js +12 -11
- package/lib/cjs/resources/stock_locations.d.ts +33 -32
- package/lib/cjs/resources/stock_locations.js +3 -11
- package/lib/cjs/resources/stock_reservations.d.ts +24 -23
- package/lib/cjs/resources/stock_reservations.js +6 -11
- package/lib/cjs/resources/stock_transfers.d.ts +51 -44
- package/lib/cjs/resources/stock_transfers.js +21 -11
- package/lib/cjs/resources/stripe_gateways.d.ts +23 -22
- package/lib/cjs/resources/stripe_gateways.js +3 -11
- package/lib/cjs/resources/stripe_payments.d.ts +37 -34
- package/lib/cjs/resources/stripe_payments.js +9 -11
- package/lib/cjs/resources/subscription_models.d.ts +27 -26
- package/lib/cjs/resources/subscription_models.js +3 -11
- package/lib/cjs/resources/tags.d.ts +13 -12
- package/lib/cjs/resources/tags.js +3 -11
- package/lib/cjs/resources/tax_calculators.d.ts +14 -13
- package/lib/cjs/resources/tax_calculators.js +0 -8
- package/lib/cjs/resources/tax_categories.d.ts +31 -30
- package/lib/cjs/resources/tax_categories.js +3 -11
- package/lib/cjs/resources/tax_rules.d.ts +52 -51
- package/lib/cjs/resources/tax_rules.js +3 -11
- package/lib/cjs/resources/taxjar_accounts.d.ts +22 -21
- package/lib/cjs/resources/taxjar_accounts.js +3 -11
- package/lib/cjs/resources/transactions.d.ts +25 -24
- package/lib/cjs/resources/transactions.js +0 -8
- package/lib/cjs/resources/versions.d.ts +14 -14
- package/lib/cjs/resources/versions.js +0 -8
- package/lib/cjs/resources/voids.d.ts +26 -25
- package/lib/cjs/resources/voids.js +0 -8
- package/lib/cjs/resources/webhooks.d.ts +35 -31
- package/lib/cjs/resources/webhooks.js +12 -11
- package/lib/cjs/resources/wire_transfers.d.ts +17 -16
- package/lib/cjs/resources/wire_transfers.js +3 -11
- package/lib/cjs/static.d.ts +5 -2
- package/lib/cjs/static.js +8 -2
- package/lib/cjs/util.d.ts +2 -4
- package/lib/cjs/util.js +1 -0
- package/lib/esm/api.d.ts +38 -0
- package/lib/esm/api.js +6 -13
- package/lib/esm/client.d.ts +20 -14
- package/lib/esm/client.js +75 -44
- package/lib/esm/commercelayer.d.ts +7 -6
- package/lib/esm/commercelayer.js +14 -4
- package/lib/esm/common.d.ts +1 -0
- package/lib/esm/common.js +11 -2
- package/lib/esm/config.d.ts +1 -0
- package/lib/esm/config.js +3 -0
- package/lib/esm/debug.js +0 -4
- package/lib/esm/error.d.ts +11 -8
- package/lib/esm/error.js +37 -6
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +0 -2
- package/lib/esm/interceptor.d.ts +6 -2
- package/lib/esm/jsonapi.d.ts +1 -0
- package/lib/esm/jsonapi.js +10 -3
- package/lib/esm/query.d.ts +9 -15
- package/lib/esm/query.js +2 -2
- package/lib/esm/resource.d.ts +31 -20
- package/lib/esm/resource.js +56 -11
- package/lib/esm/resources/addresses.d.ts +74 -73
- package/lib/esm/resources/addresses.js +3 -11
- package/lib/esm/resources/adjustments.d.ts +20 -19
- package/lib/esm/resources/adjustments.js +3 -11
- package/lib/esm/resources/adyen_gateways.d.ts +35 -34
- package/lib/esm/resources/adyen_gateways.js +3 -11
- package/lib/esm/resources/adyen_payments.d.ts +29 -27
- package/lib/esm/resources/adyen_payments.js +6 -11
- package/lib/esm/resources/application.d.ts +14 -13
- package/lib/esm/resources/application.js +2 -7
- package/lib/esm/resources/attachments.d.ts +81 -80
- package/lib/esm/resources/attachments.js +3 -11
- package/lib/esm/resources/authorizations.d.ts +47 -43
- package/lib/esm/resources/authorizations.js +10 -9
- package/lib/esm/resources/avalara_accounts.d.ts +32 -31
- package/lib/esm/resources/avalara_accounts.js +3 -11
- package/lib/esm/resources/axerve_gateways.d.ts +24 -23
- package/lib/esm/resources/axerve_gateways.js +3 -11
- package/lib/esm/resources/axerve_payments.d.ts +34 -32
- package/lib/esm/resources/axerve_payments.js +6 -11
- package/lib/esm/resources/billing_info_validation_rules.d.ts +17 -16
- package/lib/esm/resources/billing_info_validation_rules.js +3 -11
- package/lib/esm/resources/bing_geocoders.d.ts +16 -15
- package/lib/esm/resources/bing_geocoders.js +3 -11
- package/lib/esm/resources/braintree_gateways.d.ts +34 -33
- package/lib/esm/resources/braintree_gateways.js +3 -11
- package/lib/esm/resources/braintree_payments.d.ts +30 -29
- package/lib/esm/resources/braintree_payments.js +3 -11
- package/lib/esm/resources/bundles.d.ts +59 -56
- package/lib/esm/resources/bundles.js +9 -11
- package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +96 -85
- package/lib/esm/resources/buy_x_pay_y_promotions.js +13 -11
- package/lib/esm/resources/captures.d.ts +37 -34
- package/lib/esm/resources/captures.js +7 -9
- package/lib/esm/resources/carrier_accounts.d.ts +16 -15
- package/lib/esm/resources/carrier_accounts.js +0 -8
- package/lib/esm/resources/checkout_com_gateways.d.ts +25 -24
- package/lib/esm/resources/checkout_com_gateways.js +3 -11
- package/lib/esm/resources/checkout_com_payments.d.ts +41 -38
- package/lib/esm/resources/checkout_com_payments.js +9 -11
- package/lib/esm/resources/cleanups.d.ts +24 -23
- package/lib/esm/resources/cleanups.js +2 -10
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +33 -32
- package/lib/esm/resources/coupon_codes_promotion_rules.js +3 -11
- package/lib/esm/resources/coupon_recipients.d.ts +26 -25
- package/lib/esm/resources/coupon_recipients.js +3 -11
- package/lib/esm/resources/coupons.d.ts +42 -41
- package/lib/esm/resources/coupons.js +3 -11
- package/lib/esm/resources/custom_promotion_rules.d.ts +31 -30
- package/lib/esm/resources/custom_promotion_rules.js +3 -11
- package/lib/esm/resources/customer_addresses.d.ts +23 -22
- package/lib/esm/resources/customer_addresses.js +3 -11
- package/lib/esm/resources/customer_groups.d.ts +17 -16
- package/lib/esm/resources/customer_groups.js +3 -11
- package/lib/esm/resources/customer_password_resets.d.ts +19 -17
- package/lib/esm/resources/customer_password_resets.js +6 -11
- package/lib/esm/resources/customer_payment_sources.d.ts +47 -46
- package/lib/esm/resources/customer_payment_sources.js +3 -11
- package/lib/esm/resources/customer_subscriptions.d.ts +15 -14
- package/lib/esm/resources/customer_subscriptions.js +3 -11
- package/lib/esm/resources/customers.d.ts +37 -36
- package/lib/esm/resources/customers.js +3 -11
- package/lib/esm/resources/delivery_lead_times.d.ts +27 -26
- package/lib/esm/resources/delivery_lead_times.js +3 -11
- package/lib/esm/resources/event_callbacks.d.ts +15 -14
- package/lib/esm/resources/event_callbacks.js +0 -8
- package/lib/esm/resources/events.d.ts +13 -12
- package/lib/esm/resources/events.js +0 -8
- package/lib/esm/resources/exports.d.ts +27 -26
- package/lib/esm/resources/exports.js +2 -10
- package/lib/esm/resources/external_gateways.d.ts +32 -31
- package/lib/esm/resources/external_gateways.js +3 -11
- package/lib/esm/resources/external_payments.d.ts +23 -22
- package/lib/esm/resources/external_payments.js +3 -11
- package/lib/esm/resources/external_promotions.d.ts +93 -82
- package/lib/esm/resources/external_promotions.js +13 -11
- package/lib/esm/resources/external_tax_calculators.d.ts +19 -18
- package/lib/esm/resources/external_tax_calculators.js +3 -11
- package/lib/esm/resources/fixed_amount_promotions.d.ts +94 -83
- package/lib/esm/resources/fixed_amount_promotions.js +13 -11
- package/lib/esm/resources/fixed_price_promotions.d.ts +93 -82
- package/lib/esm/resources/fixed_price_promotions.js +13 -11
- package/lib/esm/resources/free_gift_promotions.d.ts +92 -81
- package/lib/esm/resources/free_gift_promotions.js +13 -11
- package/lib/esm/resources/free_shipping_promotions.d.ts +85 -74
- package/lib/esm/resources/free_shipping_promotions.js +13 -11
- package/lib/esm/resources/geocoders.d.ts +13 -12
- package/lib/esm/resources/geocoders.js +0 -8
- package/lib/esm/resources/gift_card_recipients.d.ts +26 -25
- package/lib/esm/resources/gift_card_recipients.js +3 -11
- package/lib/esm/resources/gift_cards.d.ts +71 -66
- package/lib/esm/resources/gift_cards.js +15 -11
- package/lib/esm/resources/google_geocoders.d.ts +16 -15
- package/lib/esm/resources/google_geocoders.js +3 -11
- package/lib/esm/resources/imports.d.ts +30 -29
- package/lib/esm/resources/imports.js +2 -10
- package/lib/esm/resources/in_stock_subscriptions.d.ts +38 -35
- package/lib/esm/resources/in_stock_subscriptions.js +9 -11
- package/lib/esm/resources/inventory_models.d.ts +32 -28
- package/lib/esm/resources/inventory_models.js +3 -11
- package/lib/esm/resources/inventory_return_locations.d.ts +22 -21
- package/lib/esm/resources/inventory_return_locations.js +3 -11
- package/lib/esm/resources/inventory_stock_locations.d.ts +25 -24
- package/lib/esm/resources/inventory_stock_locations.js +3 -11
- package/lib/esm/resources/klarna_gateways.d.ts +23 -22
- package/lib/esm/resources/klarna_gateways.js +3 -11
- package/lib/esm/resources/klarna_payments.d.ts +29 -27
- package/lib/esm/resources/klarna_payments.js +6 -11
- package/lib/esm/resources/line_item_options.d.ts +41 -40
- package/lib/esm/resources/line_item_options.js +3 -11
- package/lib/esm/resources/line_items.d.ts +106 -100
- package/lib/esm/resources/line_items.js +13 -11
- package/lib/esm/resources/manual_gateways.d.ts +15 -14
- package/lib/esm/resources/manual_gateways.js +3 -11
- package/lib/esm/resources/manual_tax_calculators.d.ts +21 -20
- package/lib/esm/resources/manual_tax_calculators.js +3 -11
- package/lib/esm/resources/markets.d.ts +67 -64
- package/lib/esm/resources/markets.js +9 -11
- package/lib/esm/resources/merchants.d.ts +19 -18
- package/lib/esm/resources/merchants.js +3 -11
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +36 -35
- package/lib/esm/resources/order_amount_promotion_rules.js +3 -11
- package/lib/esm/resources/order_copies.d.ts +29 -28
- package/lib/esm/resources/order_copies.js +3 -11
- package/lib/esm/resources/order_factories.d.ts +21 -20
- package/lib/esm/resources/order_factories.js +0 -8
- package/lib/esm/resources/order_subscription_items.d.ts +40 -39
- package/lib/esm/resources/order_subscription_items.js +3 -11
- package/lib/esm/resources/order_subscriptions.d.ts +55 -51
- package/lib/esm/resources/order_subscriptions.js +12 -11
- package/lib/esm/resources/order_validation_rules.d.ts +13 -12
- package/lib/esm/resources/order_validation_rules.js +0 -8
- package/lib/esm/resources/orders.d.ts +281 -251
- package/lib/esm/resources/orders.js +88 -11
- package/lib/esm/resources/organization.d.ts +25 -24
- package/lib/esm/resources/organization.js +2 -7
- package/lib/esm/resources/packages.d.ts +31 -30
- package/lib/esm/resources/packages.js +3 -11
- package/lib/esm/resources/parcel_line_items.d.ts +23 -22
- package/lib/esm/resources/parcel_line_items.js +3 -11
- package/lib/esm/resources/parcels.d.ts +94 -93
- package/lib/esm/resources/parcels.js +3 -11
- package/lib/esm/resources/payment_gateways.d.ts +13 -12
- package/lib/esm/resources/payment_gateways.js +0 -8
- package/lib/esm/resources/payment_methods.d.ts +54 -51
- package/lib/esm/resources/payment_methods.js +9 -11
- package/lib/esm/resources/payment_options.d.ts +24 -23
- package/lib/esm/resources/payment_options.js +3 -11
- package/lib/esm/resources/paypal_gateways.d.ts +18 -17
- package/lib/esm/resources/paypal_gateways.js +3 -11
- package/lib/esm/resources/paypal_payments.d.ts +32 -31
- package/lib/esm/resources/paypal_payments.js +3 -11
- package/lib/esm/resources/percentage_discount_promotions.d.ts +92 -81
- package/lib/esm/resources/percentage_discount_promotions.js +13 -11
- package/lib/esm/resources/price_frequency_tiers.d.ts +27 -26
- package/lib/esm/resources/price_frequency_tiers.js +3 -11
- package/lib/esm/resources/price_lists.d.ts +24 -23
- package/lib/esm/resources/price_lists.js +3 -11
- package/lib/esm/resources/price_tiers.d.ts +18 -17
- package/lib/esm/resources/price_tiers.js +0 -8
- package/lib/esm/resources/price_volume_tiers.d.ts +27 -26
- package/lib/esm/resources/price_volume_tiers.js +3 -11
- package/lib/esm/resources/prices.d.ts +41 -40
- package/lib/esm/resources/prices.js +3 -11
- package/lib/esm/resources/promotion_rules.d.ts +12 -11
- package/lib/esm/resources/promotion_rules.js +0 -8
- package/lib/esm/resources/promotions.d.ts +34 -30
- package/lib/esm/resources/promotions.js +4 -8
- package/lib/esm/resources/recurring_order_copies.d.ts +29 -28
- package/lib/esm/resources/recurring_order_copies.js +3 -11
- package/lib/esm/resources/refunds.d.ts +26 -25
- package/lib/esm/resources/refunds.js +0 -8
- package/lib/esm/resources/reserved_stocks.d.ts +14 -13
- package/lib/esm/resources/reserved_stocks.js +0 -8
- package/lib/esm/resources/return_line_items.d.ts +29 -27
- package/lib/esm/resources/return_line_items.js +6 -11
- package/lib/esm/resources/returns.d.ts +59 -49
- package/lib/esm/resources/returns.js +30 -11
- package/lib/esm/resources/satispay_gateways.d.ts +23 -22
- package/lib/esm/resources/satispay_gateways.js +3 -11
- package/lib/esm/resources/satispay_payments.d.ts +31 -29
- package/lib/esm/resources/satispay_payments.js +6 -11
- package/lib/esm/resources/shipments.d.ts +94 -82
- package/lib/esm/resources/shipments.js +36 -11
- package/lib/esm/resources/shipping_categories.d.ts +19 -18
- package/lib/esm/resources/shipping_categories.js +3 -11
- package/lib/esm/resources/shipping_method_tiers.d.ts +18 -17
- package/lib/esm/resources/shipping_method_tiers.js +0 -8
- package/lib/esm/resources/shipping_methods.d.ts +82 -79
- package/lib/esm/resources/shipping_methods.js +9 -11
- package/lib/esm/resources/shipping_weight_tiers.d.ts +26 -25
- package/lib/esm/resources/shipping_weight_tiers.js +3 -11
- package/lib/esm/resources/shipping_zones.d.ts +33 -32
- package/lib/esm/resources/shipping_zones.js +3 -11
- package/lib/esm/resources/sku_list_items.d.ts +27 -26
- package/lib/esm/resources/sku_list_items.js +3 -11
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +40 -39
- package/lib/esm/resources/sku_list_promotion_rules.js +3 -11
- package/lib/esm/resources/sku_lists.d.ts +36 -35
- package/lib/esm/resources/sku_lists.js +3 -11
- package/lib/esm/resources/sku_options.d.ts +44 -43
- package/lib/esm/resources/sku_options.js +3 -11
- package/lib/esm/resources/skus.d.ts +57 -56
- package/lib/esm/resources/skus.js +3 -11
- package/lib/esm/resources/stock_items.d.ts +29 -28
- package/lib/esm/resources/stock_items.js +3 -11
- package/lib/esm/resources/stock_line_items.d.ts +44 -37
- package/lib/esm/resources/stock_line_items.js +12 -11
- package/lib/esm/resources/stock_locations.d.ts +33 -32
- package/lib/esm/resources/stock_locations.js +3 -11
- package/lib/esm/resources/stock_reservations.d.ts +24 -23
- package/lib/esm/resources/stock_reservations.js +6 -11
- package/lib/esm/resources/stock_transfers.d.ts +51 -44
- package/lib/esm/resources/stock_transfers.js +21 -11
- package/lib/esm/resources/stripe_gateways.d.ts +23 -22
- package/lib/esm/resources/stripe_gateways.js +3 -11
- package/lib/esm/resources/stripe_payments.d.ts +37 -34
- package/lib/esm/resources/stripe_payments.js +9 -11
- package/lib/esm/resources/subscription_models.d.ts +27 -26
- package/lib/esm/resources/subscription_models.js +3 -11
- package/lib/esm/resources/tags.d.ts +13 -12
- package/lib/esm/resources/tags.js +3 -11
- package/lib/esm/resources/tax_calculators.d.ts +14 -13
- package/lib/esm/resources/tax_calculators.js +0 -8
- package/lib/esm/resources/tax_categories.d.ts +31 -30
- package/lib/esm/resources/tax_categories.js +3 -11
- package/lib/esm/resources/tax_rules.d.ts +52 -51
- package/lib/esm/resources/tax_rules.js +3 -11
- package/lib/esm/resources/taxjar_accounts.d.ts +22 -21
- package/lib/esm/resources/taxjar_accounts.js +3 -11
- package/lib/esm/resources/transactions.d.ts +25 -24
- package/lib/esm/resources/transactions.js +0 -8
- package/lib/esm/resources/versions.d.ts +14 -14
- package/lib/esm/resources/versions.js +0 -8
- package/lib/esm/resources/voids.d.ts +26 -25
- package/lib/esm/resources/voids.js +0 -8
- package/lib/esm/resources/webhooks.d.ts +35 -31
- package/lib/esm/resources/webhooks.js +12 -11
- package/lib/esm/resources/wire_transfers.d.ts +17 -16
- package/lib/esm/resources/wire_transfers.js +3 -11
- package/lib/esm/static.d.ts +5 -2
- package/lib/esm/static.js +8 -2
- package/lib/esm/util.d.ts +2 -4
- package/lib/esm/util.js +27 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/lib/cjs/api.d.ts
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
import type { Resource, ResourceRel } from './resource';
|
2
|
+
import type { TagType } from './resources/tags';
|
3
|
+
import type { VersionType } from './resources/versions';
|
1
4
|
/**
|
2
5
|
* ©2024 Commerce Layer Inc.
|
3
6
|
**/
|
@@ -123,3 +126,38 @@ export { default as Webhooks } from './resources/webhooks';
|
|
123
126
|
export { default as WireTransfers } from './resources/wire_transfers';
|
124
127
|
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';
|
125
128
|
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.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;
|
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 = void 0;
|
9
9
|
// ##__API_RESOURCES_START__##
|
10
10
|
// ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
|
11
11
|
/**
|
@@ -376,16 +376,9 @@ exports.resourceList = [
|
|
376
376
|
'wire_transfers'
|
377
377
|
// ##__API_RESOURCE_LIST_STOP__##
|
378
378
|
];
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
export const resourceMap: { [res: string]: ResourceInfo } = {
|
388
|
-
// ##__API_RESOURCE_MAP_START__##
|
389
|
-
// ##__API_RESOURCE_MAP_STOP__##
|
390
|
-
} as const
|
391
|
-
*/
|
379
|
+
exports.singletonList = [
|
380
|
+
// ##__API_RESOURCE_SINGLETON_START__##
|
381
|
+
'application',
|
382
|
+
'organization'
|
383
|
+
// ##__API_RESOURCE_SINGLETON_STOP__##
|
384
|
+
];
|
package/lib/cjs/client.d.ts
CHANGED
@@ -1,24 +1,27 @@
|
|
1
|
-
|
2
|
-
/// <reference types="node" />
|
3
|
-
import { AxiosProxyConfig, Method } from 'axios';
|
1
|
+
import type { AxiosAdapter, AxiosProxyConfig, Method } from 'axios';
|
4
2
|
import type { InterceptorManager } from './interceptor';
|
5
|
-
import type { Agent as HttpAgent } from 'http';
|
6
|
-
import type { Agent as HttpsAgent } from 'https';
|
7
3
|
type ProxyConfig = AxiosProxyConfig | false;
|
4
|
+
type Adapter = AxiosAdapter;
|
5
|
+
type RequestParams = Record<string, string | number | boolean>;
|
6
|
+
type RequestHeaders = Record<string, string>;
|
8
7
|
type RequestConfig = {
|
9
8
|
timeout?: number;
|
10
|
-
params?:
|
11
|
-
|
12
|
-
|
13
|
-
httpAgent?: HttpAgent;
|
14
|
-
httpsAgent?: HttpsAgent;
|
9
|
+
params?: RequestParams;
|
10
|
+
httpAgent?: any;
|
11
|
+
httpsAgent?: any;
|
15
12
|
proxy?: ProxyConfig;
|
13
|
+
headers?: RequestHeaders;
|
16
14
|
};
|
17
|
-
type
|
15
|
+
type RequestConfigExtra = {
|
16
|
+
adapter?: Adapter;
|
17
|
+
userAgent?: string;
|
18
|
+
};
|
19
|
+
type ApiConfig = {
|
18
20
|
organization: string;
|
19
21
|
domain?: string;
|
20
22
|
accessToken: string;
|
21
|
-
}
|
23
|
+
};
|
24
|
+
type ApiClientInitConfig = ApiConfig & RequestConfig & RequestConfigExtra;
|
22
25
|
type ApiClientConfig = Partial<ApiClientInitConfig>;
|
23
26
|
declare class ApiClient {
|
24
27
|
#private;
|
@@ -26,8 +29,11 @@ declare class ApiClient {
|
|
26
29
|
baseUrl: string;
|
27
30
|
interceptors: InterceptorManager;
|
28
31
|
private constructor();
|
29
|
-
config(config: ApiClientConfig):
|
32
|
+
config(config: ApiClientConfig): ApiClient;
|
33
|
+
userAgent(userAgent: string): ApiClient;
|
34
|
+
adapter(adapter: Adapter): ApiClient;
|
30
35
|
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
|
36
|
+
private customHeaders;
|
31
37
|
}
|
32
38
|
export default ApiClient;
|
33
|
-
export { ApiClientInitConfig, ApiClientConfig, RequestConfig };
|
39
|
+
export type { ApiClientInitConfig, ApiClientConfig, RequestConfig };
|
package/lib/cjs/client.js
CHANGED
@@ -15,50 +15,22 @@ 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 */
|
19
18
|
const axios_1 = __importDefault(require("axios"));
|
20
19
|
const error_1 = require("./error");
|
21
20
|
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'
|
22
24
|
const debug_1 = __importDefault(require("./debug"));
|
23
25
|
const debug = (0, debug_1.default)('client');
|
24
26
|
const baseURL = (organization, domain) => {
|
25
27
|
return `https://${organization.toLowerCase()}.${domain || config_1.default.default.domain}/api`;
|
26
28
|
};
|
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
|
-
};
|
56
29
|
class ApiClient {
|
57
30
|
static create(options) {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
throw new Error("Undefined 'accessToken' parameter");
|
31
|
+
for (const attr of config_1.default.client.requiredAttributes)
|
32
|
+
if (!options || !options[attr])
|
33
|
+
throw new error_1.SdkError({ message: `Undefined '${attr}' parameter` });
|
62
34
|
return new ApiClient(options);
|
63
35
|
}
|
64
36
|
constructor(options) {
|
@@ -71,13 +43,32 @@ class ApiClient {
|
|
71
43
|
timeout: options.timeout || config_1.default.client.timeout,
|
72
44
|
proxy: options.proxy,
|
73
45
|
httpAgent: options.httpAgent,
|
74
|
-
httpsAgent: options.httpsAgent
|
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")
|
75
56
|
};
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
57
|
+
// Set User-Agent
|
58
|
+
let userAgent = options.userAgent; // || `SDK-core axios/${axios.VERSION}`
|
59
|
+
if (userAgent) {
|
60
|
+
if (!userAgent.includes('axios/'))
|
61
|
+
userAgent += ` axios/${axios_1.default.VERSION}`;
|
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;
|
81
72
|
debug('axios options: %O', axiosOptions);
|
82
73
|
__classPrivateFieldSet(this, _ApiClient_client, axios_1.default.create(axiosOptions), "f");
|
83
74
|
this.interceptors = __classPrivateFieldGet(this, _ApiClient_client, "f").interceptors;
|
@@ -94,6 +85,10 @@ class ApiClient {
|
|
94
85
|
def.httpAgent = config.httpAgent;
|
95
86
|
if (config.httpsAgent)
|
96
87
|
def.httpsAgent = config.httpsAgent;
|
88
|
+
if (config.adapter)
|
89
|
+
this.adapter(config.adapter);
|
90
|
+
if (config.userAgent)
|
91
|
+
this.userAgent(config.userAgent);
|
97
92
|
// API Client config
|
98
93
|
if (config.organization)
|
99
94
|
this.baseUrl = baseURL(config.organization, config.domain);
|
@@ -101,23 +96,59 @@ class ApiClient {
|
|
101
96
|
__classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
|
102
97
|
def.headers.common.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
103
98
|
}
|
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;
|
104
119
|
}
|
105
120
|
async request(method, path, body, options) {
|
106
121
|
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');
|
107
127
|
const data = body ? { data: body } : undefined;
|
108
128
|
const url = path;
|
109
129
|
// Runtime request parameters
|
110
130
|
const baseUrl = (options === null || options === void 0 ? void 0 : options.organization) ? baseURL(options.organization, options.domain) : undefined;
|
111
131
|
const accessToken = (options === null || options === void 0 ? void 0 : options.accessToken) || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
112
|
-
const headers =
|
113
|
-
|
132
|
+
const headers = this.customHeaders(options === null || options === void 0 ? void 0 : options.headers);
|
133
|
+
if (accessToken)
|
134
|
+
headers.Authorization = 'Bearer ' + accessToken;
|
135
|
+
const requestParams = { method, baseURL: baseUrl, url, data, ...options, headers };
|
114
136
|
debug('request params: %O', requestParams);
|
115
137
|
// const start = Date.now()
|
116
138
|
return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
|
117
139
|
.then(response => response.data)
|
118
|
-
.catch(error => handleError(error));
|
140
|
+
.catch((error) => (0, error_1.handleError)(error));
|
119
141
|
// .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
|
120
142
|
}
|
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
|
+
}
|
121
152
|
}
|
122
153
|
_ApiClient_accessToken = new WeakMap(), _ApiClient_client = new WeakMap();
|
123
154
|
exports.default = ApiClient;
|
@@ -1,16 +1,15 @@
|
|
1
1
|
import * as api from './api';
|
2
|
-
import { ApiError } from './error';
|
2
|
+
import type { ApiError } from './error';
|
3
3
|
import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
|
4
|
-
import { ResourcesInitConfig } from './resource';
|
5
|
-
declare const OPEN_API_SCHEMA_VERSION = "4.
|
4
|
+
import { type ResourcesInitConfig } from './resource';
|
5
|
+
declare const OPEN_API_SCHEMA_VERSION = "4.24.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
|
-
|
13
|
-
readonly openApiSchemaVersion = "4.23.0";
|
12
|
+
readonly openApiSchemaVersion = "4.24.0";
|
14
13
|
addresses: api.Addresses;
|
15
14
|
adjustments: api.Adjustments;
|
16
15
|
adyen_gateways: api.AdyenGateways;
|
@@ -134,8 +133,10 @@ declare class CommerceLayerClient {
|
|
134
133
|
constructor(config: CommerceLayerInitConfig);
|
135
134
|
get currentOrganization(): string;
|
136
135
|
private localConfig;
|
137
|
-
config(config: CommerceLayerConfig):
|
136
|
+
config(config: CommerceLayerConfig): CommerceLayerClient;
|
138
137
|
resources(): readonly string[];
|
138
|
+
singletons(): readonly string[];
|
139
|
+
isSingleton(resource: api.ResourceTypeLock): boolean;
|
139
140
|
isApiError(error: any): error is ApiError;
|
140
141
|
addRequestInterceptor(onFulfilled?: RequestInterceptor, onRejected?: ErrorInterceptor): number;
|
141
142
|
addResponseInterceptor(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number;
|
package/lib/cjs/commercelayer.js
CHANGED
@@ -45,18 +45,19 @@ 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.24.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; }
|
52
51
|
// ##__CL_RESOURCES_DEF_STOP__##
|
53
52
|
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'
|
60
61
|
// ##__CL_RESOURCES_INIT_START__##
|
61
62
|
// ##__CL_RESOURCES_INIT_TEMPLATE:: ##__TAB__####__TAB__##this.##__RESOURCE_TYPE__## = new api.##__RESOURCE_CLASS__##(this.#adapter)
|
62
63
|
this.addresses = new api.Addresses(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
@@ -182,6 +183,8 @@ class CommerceLayerClient {
|
|
182
183
|
// ##__CL_RESOURCES_INIT_STOP__##
|
183
184
|
}
|
184
185
|
get currentOrganization() { return __classPrivateFieldGet(this, _CommerceLayerClient_organization, "f"); }
|
186
|
+
// get currentAccessToken(): string { return this.#adapter?.clientInstance?.currentAccessToken}
|
187
|
+
// get environment(): ApiMode { return this.#environment }
|
185
188
|
localConfig(config) {
|
186
189
|
if (config.organization)
|
187
190
|
__classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
|
@@ -195,10 +198,17 @@ class CommerceLayerClient {
|
|
195
198
|
if (!config.organization)
|
196
199
|
config.organization = this.currentOrganization;
|
197
200
|
__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").config(config);
|
201
|
+
return this;
|
198
202
|
}
|
199
203
|
resources() {
|
200
204
|
return static_1.CommerceLayerStatic.resources();
|
201
205
|
}
|
206
|
+
singletons() {
|
207
|
+
return static_1.CommerceLayerStatic.singletons();
|
208
|
+
}
|
209
|
+
isSingleton(resource) {
|
210
|
+
return static_1.CommerceLayerStatic.isSingleton(resource);
|
211
|
+
}
|
202
212
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
203
213
|
isApiError(error) {
|
204
214
|
return static_1.CommerceLayerStatic.isApiError(error);
|
@@ -210,7 +220,7 @@ class CommerceLayerClient {
|
|
210
220
|
return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors.response.use(onFulfilled, onRejected);
|
211
221
|
}
|
212
222
|
removeInterceptor(type, id) {
|
213
|
-
|
223
|
+
__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors[type].eject(id);
|
214
224
|
}
|
215
225
|
addRawResponseReader(options) {
|
216
226
|
const reader = {
|
@@ -231,7 +241,7 @@ class CommerceLayerClient {
|
|
231
241
|
removeRawResponseReader(reader) {
|
232
242
|
const id = (typeof reader === 'number') ? reader : reader === null || reader === void 0 ? void 0 : reader.id;
|
233
243
|
if (id && (id >= 0))
|
234
|
-
|
244
|
+
this.removeInterceptor('response', id);
|
235
245
|
}
|
236
246
|
}
|
237
247
|
_CommerceLayerClient_adapter = new WeakMap(), _CommerceLayerClient_organization = new WeakMap();
|
package/lib/cjs/common.d.ts
CHANGED
@@ -2,3 +2,4 @@ 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,6 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
5
3
|
exports.isResourceType = exports.isResourceId = void 0;
|
6
4
|
const api_1 = require("./api");
|
@@ -12,3 +10,14 @@ const isResourceType = (resource) => {
|
|
12
10
|
return resource && (typeof resource.type !== 'undefined') && resource.type && api_1.resourceList.includes(resource.type);
|
13
11
|
};
|
14
12
|
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,13 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
+
// export type ApiMode = 'test' | 'live'
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
4
|
const config = {
|
4
5
|
default: {
|
6
|
+
// environment: 'test',
|
5
7
|
domain: 'commercelayer.io',
|
6
8
|
pageNumber: 1,
|
7
9
|
pageSize: 10,
|
8
10
|
},
|
9
11
|
client: {
|
10
12
|
timeout: 15000,
|
13
|
+
requiredAttributes: ['organization', 'accessToken'],
|
11
14
|
}
|
12
15
|
};
|
13
16
|
exports.default = config;
|
package/lib/cjs/debug.js
CHANGED
@@ -1,7 +1,4 @@
|
|
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'
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
/* Nope debugger */
|
7
4
|
const debuggerFunction = (_pattern, ..._args) => {
|
@@ -10,7 +7,6 @@ const debuggerFunction = (_pattern, ..._args) => {
|
|
10
7
|
let debuggerFactory = (_namespace) => debuggerFunction;
|
11
8
|
/* Try loading 'debug' module */
|
12
9
|
try {
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
14
10
|
const debugModule = require('debug');
|
15
11
|
if (debugModule && (typeof debugModule === 'function'))
|
16
12
|
debuggerFactory = debugModule;
|
package/lib/cjs/error.d.ts
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
declare enum ErrorType {
|
2
|
-
CLIENT = "client"
|
3
|
-
REQUEST = "request"
|
4
|
-
RESPONSE = "response"
|
5
|
-
|
6
|
-
|
2
|
+
CLIENT = "client",// Error instantiating the client
|
3
|
+
REQUEST = "request",// Error preparing API request
|
4
|
+
RESPONSE = "response",// Error response from API
|
5
|
+
CANCEL = "cancel",// Forced request abort using interceptor
|
6
|
+
PARSE = "parse",// Error parsing API resource
|
7
|
+
GENERIC = "generic"
|
7
8
|
}
|
8
9
|
declare class SdkError extends Error {
|
9
10
|
static NAME: string;
|
10
|
-
static isSdkError(error: any): error is
|
11
|
-
type:
|
11
|
+
static isSdkError(error: any): error is SdkError;
|
12
|
+
type: ErrorType;
|
12
13
|
code?: string;
|
13
14
|
source?: Error;
|
14
15
|
request?: any;
|
@@ -22,7 +23,9 @@ declare class ApiError extends SdkError {
|
|
22
23
|
static isApiError(error: any): error is ApiError;
|
23
24
|
errors: any[];
|
24
25
|
status?: number;
|
26
|
+
statusText?: string;
|
25
27
|
constructor(error: SdkError);
|
26
28
|
first(): any;
|
27
29
|
}
|
28
|
-
|
30
|
+
declare const handleError: (error: Error) => never;
|
31
|
+
export { SdkError, ApiError, ErrorType, handleError };
|
package/lib/cjs/error.js
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
3
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
|
6
|
+
exports.handleError = exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
5
8
|
var ErrorType;
|
6
9
|
(function (ErrorType) {
|
7
10
|
ErrorType["CLIENT"] = "client";
|
8
11
|
ErrorType["REQUEST"] = "request";
|
9
12
|
ErrorType["RESPONSE"] = "response";
|
10
|
-
ErrorType["GENERIC"] = "generic";
|
11
13
|
ErrorType["CANCEL"] = "cancel";
|
12
|
-
|
13
|
-
|
14
|
+
ErrorType["PARSE"] = "parse";
|
15
|
+
ErrorType["GENERIC"] = "generic";
|
16
|
+
})(ErrorType || (exports.ErrorType = ErrorType = {}));
|
14
17
|
class SdkError extends Error {
|
15
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
16
18
|
static isSdkError(error) {
|
17
19
|
return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
18
20
|
}
|
@@ -25,12 +27,11 @@ class SdkError extends Error {
|
|
25
27
|
exports.SdkError = SdkError;
|
26
28
|
SdkError.NAME = 'SdkError';
|
27
29
|
class ApiError extends SdkError {
|
28
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
29
30
|
static isApiError(error) {
|
30
31
|
return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
|
31
32
|
}
|
32
33
|
constructor(error) {
|
33
|
-
super(
|
34
|
+
super({ ...error, type: ErrorType.RESPONSE });
|
34
35
|
this.errors = [];
|
35
36
|
this.name = ApiError.NAME; // this.constructor.name
|
36
37
|
}
|
@@ -41,3 +42,36 @@ class ApiError extends SdkError {
|
|
41
42
|
}
|
42
43
|
exports.ApiError = ApiError;
|
43
44
|
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 * from './model';
|
5
|
+
export type * from './model';
|
6
6
|
export type { RequestObj, ResponseObj, ErrorObj, HeadersObj } from './interceptor';
|
7
7
|
export type { SdkError, ApiError, ErrorType } from './error';
|