@commercelayer/sdk 4.40.0 → 4.41.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 +1 -38
- package/lib/cjs/api.js +14 -1
- package/lib/cjs/client.d.ts +8 -15
- package/lib/cjs/client.js +40 -40
- package/lib/cjs/commercelayer.d.ts +6 -5
- package/lib/cjs/commercelayer.js +4 -8
- 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 +3 -6
- 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.js +2 -9
- package/lib/cjs/model.d.ts +1 -1
- 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 +9 -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 +45 -49
- package/lib/cjs/resources/authorizations.js +13 -14
- 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 -32
- 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 -86
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +11 -9
- package/lib/cjs/resources/captures.d.ts +36 -39
- package/lib/cjs/resources/captures.js +13 -11
- 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 +49 -38
- package/lib/cjs/resources/customer_payment_sources.js +15 -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 -83
- package/lib/cjs/resources/external_promotions.js +11 -9
- 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 -84
- package/lib/cjs/resources/fixed_amount_promotions.js +11 -9
- package/lib/cjs/resources/fixed_price_promotions.d.ts +82 -83
- package/lib/cjs/resources/fixed_price_promotions.js +11 -9
- package/lib/cjs/resources/free_gift_promotions.d.ts +81 -82
- package/lib/cjs/resources/free_gift_promotions.js +11 -9
- package/lib/cjs/resources/free_shipping_promotions.d.ts +74 -75
- package/lib/cjs/resources/free_shipping_promotions.js +11 -9
- 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 -32
- 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 +28 -29
- 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 +100 -97
- 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 -62
- 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 +51 -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 +251 -277
- 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 +51 -52
- 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 -82
- package/lib/cjs/resources/percentage_discount_promotions.js +11 -9
- 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 -21
- 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 +30 -31
- package/lib/cjs/resources/promotions.js +8 -0
- 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 +27 -28
- package/lib/cjs/resources/refunds.js +12 -4
- 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 +86 -88
- package/lib/cjs/resources/shipments.js +15 -33
- package/lib/cjs/resources/shipping_categories.d.ts +18 -16
- 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 -80
- 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 +37 -37
- package/lib/cjs/resources/stock_line_items.js +11 -3
- package/lib/cjs/resources/stock_locations.d.ts +32 -30
- package/lib/cjs/resources/stock_locations.js +11 -3
- package/lib/cjs/resources/stock_reservations.d.ts +23 -25
- package/lib/cjs/resources/stock_reservations.js +11 -6
- package/lib/cjs/resources/stock_transfers.d.ts +44 -50
- 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 +34 -35
- 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 +26 -24
- package/lib/cjs/resources/transactions.js +12 -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 +27 -28
- package/lib/cjs/resources/voids.js +12 -4
- package/lib/cjs/resources/webhooks.d.ts +31 -28
- package/lib/cjs/resources/webhooks.js +11 -6
- 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 +1 -1
- package/lib/cjs/util.d.ts +8 -1
- package/lib/esm/api.d.ts +1 -38
- package/lib/esm/api.js +14 -1
- package/lib/esm/client.d.ts +8 -15
- package/lib/esm/client.js +40 -40
- package/lib/esm/commercelayer.d.ts +6 -5
- package/lib/esm/commercelayer.js +4 -8
- 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 +3 -6
- 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.js +2 -9
- package/lib/esm/model.d.ts +1 -1
- 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 +10 -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 +45 -49
- package/lib/esm/resources/authorizations.js +13 -14
- 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 -32
- 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 -86
- package/lib/esm/resources/buy_x_pay_y_promotions.js +11 -9
- package/lib/esm/resources/captures.d.ts +36 -39
- package/lib/esm/resources/captures.js +13 -11
- 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 +49 -38
- package/lib/esm/resources/customer_payment_sources.js +15 -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 -83
- package/lib/esm/resources/external_promotions.js +11 -9
- 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 -84
- package/lib/esm/resources/fixed_amount_promotions.js +11 -9
- package/lib/esm/resources/fixed_price_promotions.d.ts +82 -83
- package/lib/esm/resources/fixed_price_promotions.js +11 -9
- package/lib/esm/resources/free_gift_promotions.d.ts +81 -82
- package/lib/esm/resources/free_gift_promotions.js +11 -9
- package/lib/esm/resources/free_shipping_promotions.d.ts +74 -75
- package/lib/esm/resources/free_shipping_promotions.js +11 -9
- 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 -32
- 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 +28 -29
- 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 +100 -97
- 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 -62
- 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 +51 -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 +251 -277
- 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 +51 -52
- 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 -82
- package/lib/esm/resources/percentage_discount_promotions.js +11 -9
- 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 -21
- 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 +30 -31
- package/lib/esm/resources/promotions.js +8 -0
- 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 +27 -28
- package/lib/esm/resources/refunds.js +12 -4
- 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 +86 -88
- package/lib/esm/resources/shipments.js +15 -33
- package/lib/esm/resources/shipping_categories.d.ts +18 -16
- 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 -80
- 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 +37 -37
- package/lib/esm/resources/stock_line_items.js +11 -3
- package/lib/esm/resources/stock_locations.d.ts +32 -30
- package/lib/esm/resources/stock_locations.js +11 -3
- package/lib/esm/resources/stock_reservations.d.ts +23 -25
- package/lib/esm/resources/stock_reservations.js +11 -6
- package/lib/esm/resources/stock_transfers.d.ts +44 -50
- 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 +34 -35
- 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 +26 -24
- package/lib/esm/resources/transactions.js +12 -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 +27 -28
- package/lib/esm/resources/voids.js +12 -4
- package/lib/esm/resources/webhooks.d.ts +31 -28
- package/lib/esm/resources/webhooks.js +11 -6
- 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 +1 -1
- package/lib/esm/util.d.ts +8 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
@@ -2,14 +2,21 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const resource_1 = require("../resource");
|
4
4
|
class Webhooks extends resource_1.ApiResource {
|
5
|
+
// static readonly PATH = 'webhooks'
|
6
|
+
async list(params, options) {
|
7
|
+
return this.resources.list({ type: Webhooks.TYPE }, params, options);
|
8
|
+
}
|
5
9
|
async create(resource, params, options) {
|
6
|
-
return this.resources.create({
|
10
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: Webhooks.TYPE }), params, options);
|
11
|
+
}
|
12
|
+
async retrieve(id, params, options) {
|
13
|
+
return this.resources.retrieve({ type: Webhooks.TYPE, id }, params, options);
|
7
14
|
}
|
8
15
|
async update(resource, params, options) {
|
9
|
-
return this.resources.update({
|
16
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: Webhooks.TYPE }), params, options);
|
10
17
|
}
|
11
18
|
async delete(id, options) {
|
12
|
-
await this.resources.delete(
|
19
|
+
await this.resources.delete({ type: Webhooks.TYPE, id }, options);
|
13
20
|
}
|
14
21
|
async last_event_callbacks(webhookId, params, options) {
|
15
22
|
const _webhookId = webhookId.id || webhookId;
|
@@ -19,9 +26,7 @@ class Webhooks extends resource_1.ApiResource {
|
|
19
26
|
const _webhookId = webhookId.id || webhookId;
|
20
27
|
return this.resources.fetch({ type: 'versions' }, `webhooks/${_webhookId}/versions`, params, options);
|
21
28
|
}
|
22
|
-
|
23
|
-
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _reset_circuit: true }, params, options);
|
24
|
-
}
|
29
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
25
30
|
isWebhook(resource) {
|
26
31
|
return resource.type && (resource.type === Webhooks.TYPE);
|
27
32
|
}
|
@@ -1,37 +1,36 @@
|
|
1
|
-
import { ApiResource } from '../resource';
|
2
|
-
import type {
|
3
|
-
import type {
|
4
|
-
import type { Order, OrderType } from './orders';
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
|
2
|
+
import type { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
|
+
import type { Order } from './orders';
|
5
4
|
import type { Version } from './versions';
|
6
|
-
type WireTransferType = 'wire_transfers';
|
7
5
|
type WireTransferRel = ResourceRel & {
|
8
|
-
type:
|
6
|
+
type: typeof WireTransfers.TYPE;
|
9
7
|
};
|
10
8
|
type OrderRel = ResourceRel & {
|
11
|
-
type:
|
9
|
+
type: 'orders';
|
12
10
|
};
|
13
11
|
interface WireTransfer extends Resource {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
versions?: Version[] | null;
|
12
|
+
payment_instrument?: object;
|
13
|
+
order?: Order;
|
14
|
+
versions?: Version[];
|
18
15
|
}
|
19
16
|
interface WireTransferCreate extends ResourceCreate {
|
20
17
|
order: OrderRel;
|
21
18
|
}
|
22
19
|
interface WireTransferUpdate extends ResourceUpdate {
|
23
|
-
order?: OrderRel
|
20
|
+
order?: OrderRel;
|
24
21
|
}
|
25
|
-
declare class WireTransfers extends ApiResource
|
26
|
-
static readonly TYPE:
|
22
|
+
declare class WireTransfers extends ApiResource {
|
23
|
+
static readonly TYPE: 'wire_transfers';
|
24
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<WireTransfer>>;
|
27
25
|
create(resource: WireTransferCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<WireTransfer>;
|
26
|
+
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<WireTransfer>;
|
28
27
|
update(resource: WireTransferUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<WireTransfer>;
|
29
|
-
delete(id: string
|
28
|
+
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
30
29
|
order(wireTransferId: string | WireTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
31
30
|
versions(wireTransferId: string | WireTransfer, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
32
31
|
isWireTransfer(resource: any): resource is WireTransfer;
|
33
32
|
relationship(id: string | ResourceId | null): WireTransferRel;
|
34
|
-
type():
|
33
|
+
type(): string;
|
35
34
|
}
|
36
35
|
export default WireTransfers;
|
37
|
-
export
|
36
|
+
export { WireTransfer, WireTransferCreate, WireTransferUpdate };
|
@@ -2,14 +2,21 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const resource_1 = require("../resource");
|
4
4
|
class WireTransfers extends resource_1.ApiResource {
|
5
|
+
// static readonly PATH = 'wire_transfers'
|
6
|
+
async list(params, options) {
|
7
|
+
return this.resources.list({ type: WireTransfers.TYPE }, params, options);
|
8
|
+
}
|
5
9
|
async create(resource, params, options) {
|
6
|
-
return this.resources.create({
|
10
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: WireTransfers.TYPE }), params, options);
|
11
|
+
}
|
12
|
+
async retrieve(id, params, options) {
|
13
|
+
return this.resources.retrieve({ type: WireTransfers.TYPE, id }, params, options);
|
7
14
|
}
|
8
15
|
async update(resource, params, options) {
|
9
|
-
return this.resources.update({
|
16
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: WireTransfers.TYPE }), params, options);
|
10
17
|
}
|
11
18
|
async delete(id, options) {
|
12
|
-
await this.resources.delete(
|
19
|
+
await this.resources.delete({ type: WireTransfers.TYPE, id }, options);
|
13
20
|
}
|
14
21
|
async order(wireTransferId, params, options) {
|
15
22
|
const _wireTransferId = wireTransferId.id || wireTransferId;
|
@@ -19,6 +26,7 @@ class WireTransfers extends resource_1.ApiResource {
|
|
19
26
|
const _wireTransferId = wireTransferId.id || wireTransferId;
|
20
27
|
return this.resources.fetch({ type: 'versions' }, `wire_transfers/${_wireTransferId}/versions`, params, options);
|
21
28
|
}
|
29
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
22
30
|
isWireTransfer(resource) {
|
23
31
|
return resource.type && (resource.type === WireTransfers.TYPE);
|
24
32
|
}
|
package/lib/cjs/static.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { SdkError, ApiError } from './error';
|
2
|
-
import
|
2
|
+
import { CommerceLayerClient, CommerceLayerInitConfig } from './commercelayer';
|
3
3
|
export declare const CommerceLayerStatic: {
|
4
4
|
resources: () => readonly string[];
|
5
5
|
isSdkError: (error: unknown) => error is SdkError;
|
package/lib/cjs/util.d.ts
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
/// <reference types="node" />
|
4
|
+
/// <reference types="node" />
|
5
|
+
/// <reference types="node" />
|
6
|
+
type ObjectType = {
|
7
|
+
[key: string]: any;
|
8
|
+
};
|
2
9
|
declare const sleep: (ms: number) => Promise<NodeJS.Timeout>;
|
3
10
|
declare const sortObjectFields: (obj: ObjectType) => ObjectType;
|
4
11
|
export { sleep, sortObjectFields };
|
package/lib/esm/api.d.ts
CHANGED
@@ -1,8 +1,5 @@
|
|
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
|
**/
|
7
4
|
export { default as Addresses } from './resources/addresses';
|
8
5
|
export { default as Adjustments } from './resources/adjustments';
|
@@ -126,37 +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 type RetrievableResourceType = ResourceTypeLock;
|
130
|
-
export type RetrievableResource = Resource & {
|
131
|
-
type: RetrievableResourceType;
|
132
|
-
};
|
133
|
-
export type ListableResourceType = Exclude<ResourceTypeLock, 'application' | 'organization'>;
|
134
|
-
export type ListableResource = Resource & {
|
135
|
-
type: ListableResourceType;
|
136
|
-
};
|
137
|
-
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';
|
138
|
-
export type CreatableResource = Resource & {
|
139
|
-
type: CreatableResourceType;
|
140
|
-
};
|
141
|
-
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';
|
142
|
-
export type UpdatableResource = Resource & {
|
143
|
-
type: UpdatableResourceType;
|
144
|
-
};
|
145
|
-
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';
|
146
|
-
export type DeletableResource = Resource & {
|
147
|
-
type: DeletableResourceType;
|
148
|
-
};
|
149
|
-
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' | 'sku_options' | 'skus';
|
150
|
-
export type TaggableResource = Resource & {
|
151
|
-
type: TaggableResourceType;
|
152
|
-
tags?: Array<ResourceRel & {
|
153
|
-
type: TagType;
|
154
|
-
}> | null;
|
155
|
-
};
|
156
|
-
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';
|
157
|
-
export type VersionableResource = Resource & {
|
158
|
-
type: VersionableResourceType;
|
159
|
-
versions?: Array<ResourceRel & {
|
160
|
-
type: VersionType;
|
161
|
-
}> | null;
|
162
|
-
};
|
package/lib/esm/api.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
// ##__API_RESOURCES_START__##
|
2
2
|
// ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
|
3
3
|
/**
|
4
|
-
* ©
|
4
|
+
* ©2024 Commerce Layer Inc.
|
5
5
|
**/
|
6
6
|
export { default as Addresses } from './resources/addresses';
|
7
7
|
export { default as Adjustments } from './resources/adjustments';
|
@@ -248,3 +248,16 @@ export const resourceList = [
|
|
248
248
|
'wire_transfers'
|
249
249
|
// ##__API_RESOURCE_LIST_STOP__##
|
250
250
|
];
|
251
|
+
/*
|
252
|
+
type ResourceInfo = {
|
253
|
+
name: string;
|
254
|
+
type: string;
|
255
|
+
api: string;
|
256
|
+
}
|
257
|
+
|
258
|
+
|
259
|
+
export const resourceMap: { [res: string]: ResourceInfo } = {
|
260
|
+
// ##__API_RESOURCE_MAP_START__##
|
261
|
+
// ##__API_RESOURCE_MAP_STOP__##
|
262
|
+
} as const
|
263
|
+
*/
|
package/lib/esm/client.d.ts
CHANGED
@@ -1,29 +1,24 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
/// <reference types="node" />
|
3
|
-
import
|
3
|
+
import { AxiosProxyConfig, Method } from 'axios';
|
4
4
|
import type { InterceptorManager } from './interceptor';
|
5
5
|
import type { Agent as HttpAgent } from 'http';
|
6
6
|
import type { Agent as HttpsAgent } from 'https';
|
7
7
|
type ProxyConfig = AxiosProxyConfig | false;
|
8
|
-
type Adapter = AxiosAdapter;
|
9
|
-
type RequestParams = Record<string, string | number | boolean>;
|
10
|
-
type RequestHeaders = Record<string, string>;
|
11
8
|
type RequestConfig = {
|
12
9
|
timeout?: number;
|
13
|
-
params?:
|
10
|
+
params?: {
|
11
|
+
[key: string]: string | number | boolean;
|
12
|
+
};
|
14
13
|
httpAgent?: HttpAgent;
|
15
14
|
httpsAgent?: HttpsAgent;
|
16
15
|
proxy?: ProxyConfig;
|
17
|
-
headers?: RequestHeaders;
|
18
16
|
};
|
19
|
-
type
|
17
|
+
type ApiClientInitConfig = {
|
20
18
|
organization: string;
|
21
19
|
domain?: string;
|
22
20
|
accessToken: string;
|
23
|
-
};
|
24
|
-
type ApiClientInitConfig = ApiConfig & RequestConfig & {
|
25
|
-
adapter?: Adapter;
|
26
|
-
};
|
21
|
+
} & RequestConfig;
|
27
22
|
type ApiClientConfig = Partial<ApiClientInitConfig>;
|
28
23
|
declare class ApiClient {
|
29
24
|
#private;
|
@@ -31,10 +26,8 @@ declare class ApiClient {
|
|
31
26
|
baseUrl: string;
|
32
27
|
interceptors: InterceptorManager;
|
33
28
|
private constructor();
|
34
|
-
config(config: ApiClientConfig):
|
35
|
-
adapter(adapter: Adapter): ApiClient;
|
29
|
+
config(config: ApiClientConfig): void;
|
36
30
|
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
|
37
|
-
private customHeaders;
|
38
31
|
}
|
39
32
|
export default ApiClient;
|
40
|
-
export
|
33
|
+
export { ApiClientInitConfig, ApiClientConfig, RequestConfig };
|
package/lib/esm/client.js
CHANGED
@@ -10,19 +10,50 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
11
|
};
|
12
12
|
var _ApiClient_accessToken, _ApiClient_client;
|
13
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
13
14
|
import axios from 'axios';
|
14
|
-
import { SdkError,
|
15
|
+
import { SdkError, ApiError, ErrorType } from './error';
|
15
16
|
import config from './config';
|
16
17
|
import Debug from './debug';
|
17
18
|
const debug = Debug('client');
|
18
19
|
const baseURL = (organization, domain) => {
|
19
20
|
return `https://${organization.toLowerCase()}.${domain || config.default.domain}/api`;
|
20
21
|
};
|
22
|
+
const handleError = (error) => {
|
23
|
+
let sdkError = new SdkError({ message: error.message });
|
24
|
+
if (axios.isAxiosError(error)) {
|
25
|
+
if (error.response) {
|
26
|
+
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
27
|
+
const apiError = new ApiError(sdkError);
|
28
|
+
apiError.type = ErrorType.RESPONSE;
|
29
|
+
apiError.status = error.response.status;
|
30
|
+
apiError.code = String(apiError.status);
|
31
|
+
apiError.errors = error.response.data.errors;
|
32
|
+
sdkError = apiError;
|
33
|
+
}
|
34
|
+
else if (error.request) {
|
35
|
+
// The request was made but no response was received
|
36
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
|
37
|
+
sdkError.type = ErrorType.REQUEST;
|
38
|
+
sdkError.request = error.request;
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
// Something happened in setting up the request that triggered an Error
|
42
|
+
sdkError.type = ErrorType.CLIENT;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
else if (axios.isCancel(error))
|
46
|
+
sdkError.type = ErrorType.CANCEL;
|
47
|
+
else
|
48
|
+
sdkError.source = error;
|
49
|
+
throw sdkError;
|
50
|
+
};
|
21
51
|
class ApiClient {
|
22
52
|
static create(options) {
|
23
|
-
|
24
|
-
|
25
|
-
|
53
|
+
if (!(options === null || options === void 0 ? void 0 : options.organization))
|
54
|
+
throw new Error("Undefined 'organization' parameter");
|
55
|
+
if (!(options === null || options === void 0 ? void 0 : options.accessToken))
|
56
|
+
throw new Error("Undefined 'accessToken' parameter");
|
26
57
|
return new ApiClient(options);
|
27
58
|
}
|
28
59
|
constructor(options) {
|
@@ -37,21 +68,11 @@ class ApiClient {
|
|
37
68
|
httpAgent: options.httpAgent,
|
38
69
|
httpsAgent: options.httpsAgent,
|
39
70
|
};
|
40
|
-
|
41
|
-
const customHeaders = this.customHeaders(options.headers);
|
42
|
-
const axiosOptions = {
|
43
|
-
baseURL: this.baseUrl,
|
44
|
-
timeout: config.client.timeout,
|
45
|
-
headers: {
|
46
|
-
...customHeaders,
|
71
|
+
const axiosOptions = Object.assign({ baseURL: this.baseUrl, timeout: config.client.timeout, headers: {
|
47
72
|
'Accept': 'application/vnd.api+json',
|
48
73
|
'Content-Type': 'application/vnd.api+json',
|
49
|
-
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
50
|
-
},
|
51
|
-
...axiosConfig
|
52
|
-
};
|
53
|
-
if (options.adapter)
|
54
|
-
axiosOptions.adapter = options.adapter;
|
74
|
+
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f"),
|
75
|
+
} }, axiosConfig);
|
55
76
|
debug('axios options: %O', axiosOptions);
|
56
77
|
__classPrivateFieldSet(this, _ApiClient_client, axios.create(axiosOptions), "f");
|
57
78
|
this.interceptors = __classPrivateFieldGet(this, _ApiClient_client, "f").interceptors;
|
@@ -75,16 +96,6 @@ class ApiClient {
|
|
75
96
|
__classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
|
76
97
|
def.headers.common.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
77
98
|
}
|
78
|
-
if (config.headers)
|
79
|
-
def.headers.common = this.customHeaders(config.headers);
|
80
|
-
if (config.adapter)
|
81
|
-
this.adapter(config.adapter);
|
82
|
-
return this;
|
83
|
-
}
|
84
|
-
adapter(adapter) {
|
85
|
-
if (adapter)
|
86
|
-
__classPrivateFieldGet(this, _ApiClient_client, "f").defaults.adapter = adapter;
|
87
|
-
return this;
|
88
99
|
}
|
89
100
|
async request(method, path, body, options) {
|
90
101
|
debug('request %s %s, %O, %O', method, path, body || {}, options || {});
|
@@ -93,10 +104,8 @@ class ApiClient {
|
|
93
104
|
// Runtime request parameters
|
94
105
|
const baseUrl = (options === null || options === void 0 ? void 0 : options.organization) ? baseURL(options.organization, options.domain) : undefined;
|
95
106
|
const accessToken = (options === null || options === void 0 ? void 0 : options.accessToken) || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
96
|
-
const headers =
|
97
|
-
|
98
|
-
headers.Authorization = 'Bearer ' + accessToken;
|
99
|
-
const requestParams = { method, baseURL: baseUrl, url, data, ...options, headers };
|
107
|
+
const headers = accessToken ? { 'Authorization': 'Bearer ' + accessToken } : undefined;
|
108
|
+
const requestParams = Object.assign({ method, baseURL: baseUrl, url, data, headers }, options);
|
100
109
|
debug('request params: %O', requestParams);
|
101
110
|
// const start = Date.now()
|
102
111
|
return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
|
@@ -104,15 +113,6 @@ class ApiClient {
|
|
104
113
|
.catch(error => handleError(error));
|
105
114
|
// .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
|
106
115
|
}
|
107
|
-
customHeaders(headers) {
|
108
|
-
const customHeaders = {};
|
109
|
-
if (headers) {
|
110
|
-
for (const [name, value] of Object.entries(headers))
|
111
|
-
if (!['accept', 'content-type', 'authorization'].includes(name.toLowerCase()))
|
112
|
-
customHeaders[name] = value;
|
113
|
-
}
|
114
|
-
return customHeaders;
|
115
|
-
}
|
116
116
|
}
|
117
117
|
_ApiClient_accessToken = new WeakMap(), _ApiClient_client = new WeakMap();
|
118
118
|
export default ApiClient;
|
@@ -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.23.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.23.0";
|
13
14
|
addresses: api.Addresses;
|
14
15
|
adjustments: api.Adjustments;
|
15
16
|
adyen_gateways: api.AdyenGateways;
|
@@ -133,7 +134,7 @@ 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
139
|
isApiError(error: any): error is ApiError;
|
139
140
|
addRequestInterceptor(onFulfilled?: RequestInterceptor, onRejected?: ErrorInterceptor): number;
|
package/lib/esm/commercelayer.js
CHANGED
@@ -16,19 +16,18 @@ import ResourceAdapter from './resource';
|
|
16
16
|
import Debug from './debug';
|
17
17
|
const debug = Debug('commercelayer');
|
18
18
|
// Autogenerated schema version number, do not remove this line
|
19
|
-
const OPEN_API_SCHEMA_VERSION = '4.
|
19
|
+
const OPEN_API_SCHEMA_VERSION = '4.23.0';
|
20
20
|
export { OPEN_API_SCHEMA_VERSION };
|
21
21
|
class CommerceLayerClient {
|
22
|
+
static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
|
22
23
|
// ##__CL_RESOURCES_DEF_STOP__##
|
23
24
|
constructor(config) {
|
24
|
-
// static get openApiSchemaVersion(): string { return OPEN_API_SCHEMA_VERSION }
|
25
25
|
this.openApiSchemaVersion = OPEN_API_SCHEMA_VERSION;
|
26
26
|
_CommerceLayerClient_adapter.set(this, void 0);
|
27
27
|
_CommerceLayerClient_organization.set(this, void 0);
|
28
28
|
debug('new commercelayer instance %O', config);
|
29
29
|
__classPrivateFieldSet(this, _CommerceLayerClient_adapter, new ResourceAdapter(config), "f");
|
30
30
|
__classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
|
31
|
-
// this.#environment = 'test'
|
32
31
|
// ##__CL_RESOURCES_INIT_START__##
|
33
32
|
// ##__CL_RESOURCES_INIT_TEMPLATE:: ##__TAB__####__TAB__##this.##__RESOURCE_TYPE__## = new api.##__RESOURCE_CLASS__##(this.#adapter)
|
34
33
|
this.addresses = new api.Addresses(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
@@ -154,8 +153,6 @@ class CommerceLayerClient {
|
|
154
153
|
// ##__CL_RESOURCES_INIT_STOP__##
|
155
154
|
}
|
156
155
|
get currentOrganization() { return __classPrivateFieldGet(this, _CommerceLayerClient_organization, "f"); }
|
157
|
-
// get currentAccessToken(): string { return this.#adapter?.clientInstance?.currentAccessToken}
|
158
|
-
// get environment(): ApiMode { return this.#environment }
|
159
156
|
localConfig(config) {
|
160
157
|
if (config.organization)
|
161
158
|
__classPrivateFieldSet(this, _CommerceLayerClient_organization, config.organization, "f");
|
@@ -169,7 +166,6 @@ class CommerceLayerClient {
|
|
169
166
|
if (!config.organization)
|
170
167
|
config.organization = this.currentOrganization;
|
171
168
|
__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").config(config);
|
172
|
-
return this;
|
173
169
|
}
|
174
170
|
resources() {
|
175
171
|
return CommerceLayerStatic.resources();
|
@@ -185,7 +181,7 @@ class CommerceLayerClient {
|
|
185
181
|
return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors.response.use(onFulfilled, onRejected);
|
186
182
|
}
|
187
183
|
removeInterceptor(type, id) {
|
188
|
-
__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors[type].eject(id);
|
184
|
+
return __classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f").interceptors[type].eject(id);
|
189
185
|
}
|
190
186
|
addRawResponseReader(options) {
|
191
187
|
const reader = {
|
@@ -206,7 +202,7 @@ class CommerceLayerClient {
|
|
206
202
|
removeRawResponseReader(reader) {
|
207
203
|
const id = (typeof reader === 'number') ? reader : reader === null || reader === void 0 ? void 0 : reader.id;
|
208
204
|
if (id && (id >= 0))
|
209
|
-
this.removeInterceptor('response', id);
|
205
|
+
return this.removeInterceptor('response', id);
|
210
206
|
}
|
211
207
|
}
|
212
208
|
_CommerceLayerClient_adapter = new WeakMap(), _CommerceLayerClient_organization = new WeakMap();
|
package/lib/esm/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/esm/common.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
1
3
|
import { resourceList } from './api';
|
2
4
|
const isResourceId = (resource) => {
|
3
5
|
return ((resource === null || resource === void 0 ? void 0 : resource.type) && resource.id) && resourceList.includes(resource.type);
|
@@ -6,14 +8,3 @@ const isResourceType = (resource) => {
|
|
6
8
|
return resource && (typeof resource.type !== 'undefined') && resource.type && resourceList.includes(resource.type);
|
7
9
|
};
|
8
10
|
export { isResourceId, isResourceType };
|
9
|
-
/*
|
10
|
-
// Nullable types
|
11
|
-
type StringNullable = string | null
|
12
|
-
type NumberNullable = number | null
|
13
|
-
type BooleanNullable = boolean | null
|
14
|
-
type ResourceNullable<R extends Resource> = R | null
|
15
|
-
type ResourceArrayNullable<R extends Resource> = R[] | null
|
16
|
-
|
17
|
-
|
18
|
-
export type { StringNullable, NumberNullable, BooleanNullable, ResourceNullable, ResourceArrayNullable }
|
19
|
-
*/
|
package/lib/esm/config.d.ts
CHANGED
package/lib/esm/config.js
CHANGED
@@ -1,14 +1,11 @@
|
|
1
|
-
// export type ApiMode = 'test' | 'live'
|
2
1
|
const config = {
|
3
2
|
default: {
|
4
|
-
// environment: 'test',
|
5
3
|
domain: 'commercelayer.io',
|
6
4
|
pageNumber: 1,
|
7
5
|
pageSize: 10,
|
8
6
|
},
|
9
7
|
client: {
|
10
8
|
timeout: 15000,
|
11
|
-
requiredAttributes: ['organization', 'accessToken'],
|
12
9
|
}
|
13
10
|
};
|
14
11
|
export default config;
|
package/lib/esm/debug.js
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
3
|
+
// import Debug from 'debug'
|
1
4
|
/* Nope debugger */
|
2
5
|
const debuggerFunction = (_pattern, ..._args) => {
|
3
6
|
// console.log(_pattern)
|
@@ -5,6 +8,7 @@ const debuggerFunction = (_pattern, ..._args) => {
|
|
5
8
|
let debuggerFactory = (_namespace) => debuggerFunction;
|
6
9
|
/* Try loading 'debug' module */
|
7
10
|
try {
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
8
12
|
const debugModule = require('debug');
|
9
13
|
if (debugModule && (typeof debugModule === 'function'))
|
10
14
|
debuggerFactory = debugModule;
|
package/lib/esm/error.d.ts
CHANGED
@@ -2,9 +2,8 @@ declare enum ErrorType {
|
|
2
2
|
CLIENT = "client",
|
3
3
|
REQUEST = "request",
|
4
4
|
RESPONSE = "response",
|
5
|
-
|
6
|
-
|
7
|
-
GENERIC = "generic"
|
5
|
+
GENERIC = "generic",
|
6
|
+
CANCEL = "cancel"
|
8
7
|
}
|
9
8
|
declare class SdkError extends Error {
|
10
9
|
static NAME: string;
|
@@ -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 };
|