@commercelayer/sdk 7.0.0-beta.16 → 7.0.0-beta.18
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/{api-Cxxi3g4i.d.cts → api-CRmSToGa.d.cts} +1 -1
- package/lib/{api-CsxHP9zh.d.ts → api-CUXmETkx.d.ts} +1 -1
- package/lib/api.cjs +7460 -792
- package/lib/api.d.cts +1 -1
- package/lib/api.d.ts +1 -1
- package/lib/api.js +7331 -132
- package/lib/client.cjs +253 -78
- package/lib/client.js +252 -72
- package/lib/commercelayer.cjs +778 -34
- package/lib/commercelayer.d.cts +1 -2
- package/lib/commercelayer.d.ts +1 -2
- package/lib/commercelayer.js +777 -29
- package/lib/common.cjs +143 -7
- package/lib/common.d.cts +1 -1
- package/lib/common.d.ts +1 -1
- package/lib/common.js +141 -5
- package/lib/config.cjs +2 -3
- package/lib/config.js +2 -3
- package/lib/debug.cjs +12 -6
- package/lib/debug.js +12 -6
- package/lib/enum.cjs +9 -10
- package/lib/enum.d.cts +1 -1
- package/lib/enum.d.ts +1 -1
- package/lib/enum.js +9 -10
- package/lib/error.cjs +75 -26
- package/lib/error.js +74 -25
- package/lib/fetch.cjs +85 -33
- package/lib/fetch.js +87 -31
- package/lib/index.cjs +8104 -23
- package/lib/index.d.cts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +7977 -4
- package/lib/jsonapi.cjs +188 -21
- package/lib/jsonapi.d.cts +1 -1
- package/lib/jsonapi.d.ts +1 -1
- package/lib/jsonapi.js +186 -14
- package/lib/model.d.cts +1 -1
- package/lib/model.d.ts +1 -1
- package/lib/query.cjs +75 -17
- package/lib/query.d.cts +1 -1
- package/lib/query.d.ts +1 -1
- package/lib/query.js +77 -15
- package/lib/resource.cjs +660 -71
- package/lib/resource.d.cts +1 -1
- package/lib/resource.d.ts +1 -1
- package/lib/resource.js +646 -51
- package/lib/resources/addresses.cjs +794 -6
- package/lib/resources/addresses.d.cts +1 -1
- package/lib/resources/addresses.d.ts +1 -1
- package/lib/resources/addresses.js +794 -6
- package/lib/resources/adjustments.cjs +794 -6
- package/lib/resources/adjustments.d.cts +1 -1
- package/lib/resources/adjustments.d.ts +1 -1
- package/lib/resources/adjustments.js +794 -6
- package/lib/resources/adyen_gateways.cjs +794 -6
- package/lib/resources/adyen_gateways.d.cts +1 -1
- package/lib/resources/adyen_gateways.d.ts +1 -1
- package/lib/resources/adyen_gateways.js +794 -6
- package/lib/resources/adyen_payments.cjs +794 -6
- package/lib/resources/adyen_payments.d.cts +1 -1
- package/lib/resources/adyen_payments.d.ts +1 -1
- package/lib/resources/adyen_payments.js +794 -6
- package/lib/resources/applications.cjs +786 -6
- package/lib/resources/applications.d.cts +1 -1
- package/lib/resources/applications.d.ts +1 -1
- package/lib/resources/applications.js +786 -6
- package/lib/resources/attachments.cjs +794 -6
- package/lib/resources/attachments.d.cts +1 -1
- package/lib/resources/attachments.d.ts +1 -1
- package/lib/resources/attachments.js +794 -6
- package/lib/resources/authorizations.cjs +794 -6
- package/lib/resources/authorizations.d.cts +1 -1
- package/lib/resources/authorizations.d.ts +1 -1
- package/lib/resources/authorizations.js +794 -6
- package/lib/resources/avalara_accounts.cjs +794 -6
- package/lib/resources/avalara_accounts.d.cts +1 -1
- package/lib/resources/avalara_accounts.d.ts +1 -1
- package/lib/resources/avalara_accounts.js +794 -6
- package/lib/resources/axerve_gateways.cjs +794 -6
- package/lib/resources/axerve_gateways.d.cts +1 -1
- package/lib/resources/axerve_gateways.d.ts +1 -1
- package/lib/resources/axerve_gateways.js +794 -6
- package/lib/resources/axerve_payments.cjs +794 -6
- package/lib/resources/axerve_payments.d.cts +1 -1
- package/lib/resources/axerve_payments.d.ts +1 -1
- package/lib/resources/axerve_payments.js +794 -6
- package/lib/resources/bing_geocoders.cjs +794 -6
- package/lib/resources/bing_geocoders.d.cts +1 -1
- package/lib/resources/bing_geocoders.d.ts +1 -1
- package/lib/resources/bing_geocoders.js +794 -6
- package/lib/resources/braintree_gateways.cjs +794 -6
- package/lib/resources/braintree_gateways.d.cts +1 -1
- package/lib/resources/braintree_gateways.d.ts +1 -1
- package/lib/resources/braintree_gateways.js +794 -6
- package/lib/resources/braintree_payments.cjs +794 -6
- package/lib/resources/braintree_payments.d.cts +1 -1
- package/lib/resources/braintree_payments.d.ts +1 -1
- package/lib/resources/braintree_payments.js +794 -6
- package/lib/resources/bundles.cjs +794 -6
- package/lib/resources/bundles.d.cts +1 -1
- package/lib/resources/bundles.d.ts +1 -1
- package/lib/resources/bundles.js +794 -6
- package/lib/resources/buy_x_pay_y_promotions.cjs +794 -6
- package/lib/resources/buy_x_pay_y_promotions.d.cts +1 -1
- package/lib/resources/buy_x_pay_y_promotions.d.ts +1 -1
- package/lib/resources/buy_x_pay_y_promotions.js +794 -6
- package/lib/resources/captures.cjs +794 -6
- package/lib/resources/captures.d.cts +1 -1
- package/lib/resources/captures.d.ts +1 -1
- package/lib/resources/captures.js +794 -6
- package/lib/resources/carrier_accounts.cjs +794 -6
- package/lib/resources/carrier_accounts.d.cts +1 -1
- package/lib/resources/carrier_accounts.d.ts +1 -1
- package/lib/resources/carrier_accounts.js +794 -6
- package/lib/resources/checkout_com_gateways.cjs +794 -6
- package/lib/resources/checkout_com_gateways.d.cts +1 -1
- package/lib/resources/checkout_com_gateways.d.ts +1 -1
- package/lib/resources/checkout_com_gateways.js +794 -6
- package/lib/resources/checkout_com_payments.cjs +794 -6
- package/lib/resources/checkout_com_payments.d.cts +1 -1
- package/lib/resources/checkout_com_payments.d.ts +1 -1
- package/lib/resources/checkout_com_payments.js +794 -6
- package/lib/resources/cleanups.cjs +794 -6
- package/lib/resources/cleanups.d.cts +1 -1
- package/lib/resources/cleanups.d.ts +1 -1
- package/lib/resources/cleanups.js +794 -6
- package/lib/resources/coupon_codes_promotion_rules.cjs +794 -6
- package/lib/resources/coupon_codes_promotion_rules.d.cts +1 -1
- package/lib/resources/coupon_codes_promotion_rules.d.ts +1 -1
- package/lib/resources/coupon_codes_promotion_rules.js +794 -6
- package/lib/resources/coupon_recipients.cjs +794 -6
- package/lib/resources/coupon_recipients.d.cts +1 -1
- package/lib/resources/coupon_recipients.d.ts +1 -1
- package/lib/resources/coupon_recipients.js +794 -6
- package/lib/resources/coupons.cjs +794 -6
- package/lib/resources/coupons.d.cts +1 -1
- package/lib/resources/coupons.d.ts +1 -1
- package/lib/resources/coupons.js +794 -6
- package/lib/resources/custom_promotion_rules.cjs +794 -6
- package/lib/resources/custom_promotion_rules.d.cts +1 -1
- package/lib/resources/custom_promotion_rules.d.ts +1 -1
- package/lib/resources/custom_promotion_rules.js +794 -6
- package/lib/resources/customer_addresses.cjs +794 -6
- package/lib/resources/customer_addresses.d.cts +1 -1
- package/lib/resources/customer_addresses.d.ts +1 -1
- package/lib/resources/customer_addresses.js +794 -6
- package/lib/resources/customer_groups.cjs +794 -6
- package/lib/resources/customer_groups.d.cts +1 -1
- package/lib/resources/customer_groups.d.ts +1 -1
- package/lib/resources/customer_groups.js +794 -6
- package/lib/resources/customer_password_resets.cjs +794 -6
- package/lib/resources/customer_password_resets.d.cts +1 -1
- package/lib/resources/customer_password_resets.d.ts +1 -1
- package/lib/resources/customer_password_resets.js +794 -6
- package/lib/resources/customer_payment_sources.cjs +794 -6
- package/lib/resources/customer_payment_sources.d.cts +1 -1
- package/lib/resources/customer_payment_sources.d.ts +1 -1
- package/lib/resources/customer_payment_sources.js +794 -6
- package/lib/resources/customer_subscriptions.cjs +794 -6
- package/lib/resources/customer_subscriptions.d.cts +1 -1
- package/lib/resources/customer_subscriptions.d.ts +1 -1
- package/lib/resources/customer_subscriptions.js +794 -6
- package/lib/resources/customers.cjs +794 -6
- package/lib/resources/customers.d.cts +1 -1
- package/lib/resources/customers.d.ts +1 -1
- package/lib/resources/customers.js +794 -6
- package/lib/resources/delivery_lead_times.cjs +794 -6
- package/lib/resources/delivery_lead_times.d.cts +1 -1
- package/lib/resources/delivery_lead_times.d.ts +1 -1
- package/lib/resources/delivery_lead_times.js +794 -6
- package/lib/resources/discount_engine_items.cjs +794 -6
- package/lib/resources/discount_engine_items.d.cts +1 -1
- package/lib/resources/discount_engine_items.d.ts +1 -1
- package/lib/resources/discount_engine_items.js +794 -6
- package/lib/resources/discount_engines.cjs +794 -6
- package/lib/resources/discount_engines.d.cts +1 -1
- package/lib/resources/discount_engines.d.ts +1 -1
- package/lib/resources/discount_engines.js +794 -6
- package/lib/resources/easypost_pickups.cjs +794 -6
- package/lib/resources/easypost_pickups.d.cts +1 -1
- package/lib/resources/easypost_pickups.d.ts +1 -1
- package/lib/resources/easypost_pickups.js +794 -6
- package/lib/resources/event_callbacks.cjs +794 -6
- package/lib/resources/event_callbacks.d.cts +1 -1
- package/lib/resources/event_callbacks.d.ts +1 -1
- package/lib/resources/event_callbacks.js +794 -6
- package/lib/resources/events.cjs +794 -6
- package/lib/resources/events.d.cts +1 -1
- package/lib/resources/events.d.ts +1 -1
- package/lib/resources/events.js +794 -6
- package/lib/resources/exports.cjs +794 -6
- package/lib/resources/exports.d.cts +1 -1
- package/lib/resources/exports.d.ts +1 -1
- package/lib/resources/exports.js +794 -6
- package/lib/resources/external_gateways.cjs +794 -6
- package/lib/resources/external_gateways.d.cts +1 -1
- package/lib/resources/external_gateways.d.ts +1 -1
- package/lib/resources/external_gateways.js +794 -6
- package/lib/resources/external_payments.cjs +794 -6
- package/lib/resources/external_payments.d.cts +1 -1
- package/lib/resources/external_payments.d.ts +1 -1
- package/lib/resources/external_payments.js +794 -6
- package/lib/resources/external_promotions.cjs +794 -6
- package/lib/resources/external_promotions.d.cts +1 -1
- package/lib/resources/external_promotions.d.ts +1 -1
- package/lib/resources/external_promotions.js +794 -6
- package/lib/resources/external_tax_calculators.cjs +794 -6
- package/lib/resources/external_tax_calculators.d.cts +1 -1
- package/lib/resources/external_tax_calculators.d.ts +1 -1
- package/lib/resources/external_tax_calculators.js +794 -6
- package/lib/resources/fixed_amount_promotions.cjs +794 -6
- package/lib/resources/fixed_amount_promotions.d.cts +1 -1
- package/lib/resources/fixed_amount_promotions.d.ts +1 -1
- package/lib/resources/fixed_amount_promotions.js +794 -6
- package/lib/resources/fixed_price_promotions.cjs +794 -6
- package/lib/resources/fixed_price_promotions.d.cts +1 -1
- package/lib/resources/fixed_price_promotions.d.ts +1 -1
- package/lib/resources/fixed_price_promotions.js +794 -6
- package/lib/resources/flex_promotions.cjs +794 -6
- package/lib/resources/flex_promotions.d.cts +1 -1
- package/lib/resources/flex_promotions.d.ts +1 -1
- package/lib/resources/flex_promotions.js +794 -6
- package/lib/resources/free_gift_promotions.cjs +794 -6
- package/lib/resources/free_gift_promotions.d.cts +1 -1
- package/lib/resources/free_gift_promotions.d.ts +1 -1
- package/lib/resources/free_gift_promotions.js +794 -6
- package/lib/resources/free_shipping_promotions.cjs +794 -6
- package/lib/resources/free_shipping_promotions.d.cts +1 -1
- package/lib/resources/free_shipping_promotions.d.ts +1 -1
- package/lib/resources/free_shipping_promotions.js +794 -6
- package/lib/resources/geocoders.cjs +794 -6
- package/lib/resources/geocoders.d.cts +1 -1
- package/lib/resources/geocoders.d.ts +1 -1
- package/lib/resources/geocoders.js +794 -6
- package/lib/resources/gift_card_recipients.cjs +794 -6
- package/lib/resources/gift_card_recipients.d.cts +1 -1
- package/lib/resources/gift_card_recipients.d.ts +1 -1
- package/lib/resources/gift_card_recipients.js +794 -6
- package/lib/resources/gift_cards.cjs +794 -6
- package/lib/resources/gift_cards.d.cts +1 -1
- package/lib/resources/gift_cards.d.ts +1 -1
- package/lib/resources/gift_cards.js +794 -6
- package/lib/resources/google_geocoders.cjs +794 -6
- package/lib/resources/google_geocoders.d.cts +1 -1
- package/lib/resources/google_geocoders.d.ts +1 -1
- package/lib/resources/google_geocoders.js +794 -6
- package/lib/resources/imports.cjs +794 -6
- package/lib/resources/imports.d.cts +1 -1
- package/lib/resources/imports.d.ts +1 -1
- package/lib/resources/imports.js +794 -6
- package/lib/resources/in_stock_subscriptions.cjs +794 -6
- package/lib/resources/in_stock_subscriptions.d.cts +1 -1
- package/lib/resources/in_stock_subscriptions.d.ts +1 -1
- package/lib/resources/in_stock_subscriptions.js +794 -6
- package/lib/resources/inventory_models.cjs +794 -6
- package/lib/resources/inventory_models.d.cts +1 -1
- package/lib/resources/inventory_models.d.ts +1 -1
- package/lib/resources/inventory_models.js +794 -6
- package/lib/resources/inventory_return_locations.cjs +794 -6
- package/lib/resources/inventory_return_locations.d.cts +1 -1
- package/lib/resources/inventory_return_locations.d.ts +1 -1
- package/lib/resources/inventory_return_locations.js +794 -6
- package/lib/resources/inventory_stock_locations.cjs +794 -6
- package/lib/resources/inventory_stock_locations.d.cts +1 -1
- package/lib/resources/inventory_stock_locations.d.ts +1 -1
- package/lib/resources/inventory_stock_locations.js +794 -6
- package/lib/resources/klarna_gateways.cjs +794 -6
- package/lib/resources/klarna_gateways.d.cts +1 -1
- package/lib/resources/klarna_gateways.d.ts +1 -1
- package/lib/resources/klarna_gateways.js +794 -6
- package/lib/resources/klarna_payments.cjs +794 -6
- package/lib/resources/klarna_payments.d.cts +1 -1
- package/lib/resources/klarna_payments.d.ts +1 -1
- package/lib/resources/klarna_payments.js +794 -6
- package/lib/resources/line_item_options.cjs +794 -6
- package/lib/resources/line_item_options.d.cts +1 -1
- package/lib/resources/line_item_options.d.ts +1 -1
- package/lib/resources/line_item_options.js +794 -6
- package/lib/resources/line_items.cjs +794 -6
- package/lib/resources/line_items.d.cts +1 -1
- package/lib/resources/line_items.d.ts +1 -1
- package/lib/resources/line_items.js +794 -6
- package/lib/resources/links.cjs +794 -6
- package/lib/resources/links.d.cts +1 -1
- package/lib/resources/links.d.ts +1 -1
- package/lib/resources/links.js +794 -6
- package/lib/resources/manual_gateways.cjs +794 -6
- package/lib/resources/manual_gateways.d.cts +1 -1
- package/lib/resources/manual_gateways.d.ts +1 -1
- package/lib/resources/manual_gateways.js +794 -6
- package/lib/resources/manual_tax_calculators.cjs +794 -6
- package/lib/resources/manual_tax_calculators.d.cts +1 -1
- package/lib/resources/manual_tax_calculators.d.ts +1 -1
- package/lib/resources/manual_tax_calculators.js +794 -6
- package/lib/resources/markets.cjs +794 -6
- package/lib/resources/markets.d.cts +1 -1
- package/lib/resources/markets.d.ts +1 -1
- package/lib/resources/markets.js +794 -6
- package/lib/resources/merchants.cjs +794 -6
- package/lib/resources/merchants.d.cts +1 -1
- package/lib/resources/merchants.d.ts +1 -1
- package/lib/resources/merchants.js +794 -6
- package/lib/resources/notifications.cjs +794 -6
- package/lib/resources/notifications.d.cts +1 -1
- package/lib/resources/notifications.d.ts +1 -1
- package/lib/resources/notifications.js +794 -6
- package/lib/resources/order_amount_promotion_rules.cjs +794 -6
- package/lib/resources/order_amount_promotion_rules.d.cts +1 -1
- package/lib/resources/order_amount_promotion_rules.d.ts +1 -1
- package/lib/resources/order_amount_promotion_rules.js +794 -6
- package/lib/resources/order_copies.cjs +794 -6
- package/lib/resources/order_copies.d.cts +1 -1
- package/lib/resources/order_copies.d.ts +1 -1
- package/lib/resources/order_copies.js +794 -6
- package/lib/resources/order_factories.cjs +794 -6
- package/lib/resources/order_factories.d.cts +1 -1
- package/lib/resources/order_factories.d.ts +1 -1
- package/lib/resources/order_factories.js +794 -6
- package/lib/resources/order_subscription_items.cjs +794 -6
- package/lib/resources/order_subscription_items.d.cts +1 -1
- package/lib/resources/order_subscription_items.d.ts +1 -1
- package/lib/resources/order_subscription_items.js +794 -6
- package/lib/resources/order_subscriptions.cjs +794 -6
- package/lib/resources/order_subscriptions.d.cts +1 -1
- package/lib/resources/order_subscriptions.d.ts +1 -1
- package/lib/resources/order_subscriptions.js +794 -6
- package/lib/resources/orders.cjs +794 -6
- package/lib/resources/orders.d.cts +1 -1
- package/lib/resources/orders.d.ts +1 -1
- package/lib/resources/orders.js +794 -6
- package/lib/resources/organizations.cjs +786 -6
- package/lib/resources/organizations.d.cts +1 -1
- package/lib/resources/organizations.d.ts +1 -1
- package/lib/resources/organizations.js +786 -6
- package/lib/resources/packages.cjs +794 -6
- package/lib/resources/packages.d.cts +1 -1
- package/lib/resources/packages.d.ts +1 -1
- package/lib/resources/packages.js +794 -6
- package/lib/resources/parcel_line_items.cjs +794 -6
- package/lib/resources/parcel_line_items.d.cts +1 -1
- package/lib/resources/parcel_line_items.d.ts +1 -1
- package/lib/resources/parcel_line_items.js +794 -6
- package/lib/resources/parcels.cjs +794 -6
- package/lib/resources/parcels.d.cts +1 -1
- package/lib/resources/parcels.d.ts +1 -1
- package/lib/resources/parcels.js +794 -6
- package/lib/resources/payment_gateways.cjs +794 -6
- package/lib/resources/payment_gateways.d.cts +1 -1
- package/lib/resources/payment_gateways.d.ts +1 -1
- package/lib/resources/payment_gateways.js +794 -6
- package/lib/resources/payment_methods.cjs +794 -6
- package/lib/resources/payment_methods.d.cts +1 -1
- package/lib/resources/payment_methods.d.ts +1 -1
- package/lib/resources/payment_methods.js +794 -6
- package/lib/resources/payment_options.cjs +794 -6
- package/lib/resources/payment_options.d.cts +1 -1
- package/lib/resources/payment_options.d.ts +1 -1
- package/lib/resources/payment_options.js +794 -6
- package/lib/resources/paypal_gateways.cjs +794 -6
- package/lib/resources/paypal_gateways.d.cts +1 -1
- package/lib/resources/paypal_gateways.d.ts +1 -1
- package/lib/resources/paypal_gateways.js +794 -6
- package/lib/resources/paypal_payments.cjs +794 -6
- package/lib/resources/paypal_payments.d.cts +1 -1
- package/lib/resources/paypal_payments.d.ts +1 -1
- package/lib/resources/paypal_payments.js +794 -6
- package/lib/resources/percentage_discount_promotions.cjs +794 -6
- package/lib/resources/percentage_discount_promotions.d.cts +1 -1
- package/lib/resources/percentage_discount_promotions.d.ts +1 -1
- package/lib/resources/percentage_discount_promotions.js +794 -6
- package/lib/resources/pickups.cjs +794 -6
- package/lib/resources/pickups.d.cts +1 -1
- package/lib/resources/pickups.d.ts +1 -1
- package/lib/resources/pickups.js +794 -6
- package/lib/resources/price_frequency_tiers.cjs +794 -6
- package/lib/resources/price_frequency_tiers.d.cts +1 -1
- package/lib/resources/price_frequency_tiers.d.ts +1 -1
- package/lib/resources/price_frequency_tiers.js +794 -6
- package/lib/resources/price_list_schedulers.cjs +794 -6
- package/lib/resources/price_list_schedulers.d.cts +1 -1
- package/lib/resources/price_list_schedulers.d.ts +1 -1
- package/lib/resources/price_list_schedulers.js +794 -6
- package/lib/resources/price_lists.cjs +794 -6
- package/lib/resources/price_lists.d.cts +1 -1
- package/lib/resources/price_lists.d.ts +1 -1
- package/lib/resources/price_lists.js +794 -6
- package/lib/resources/price_tiers.cjs +794 -6
- package/lib/resources/price_tiers.d.cts +1 -1
- package/lib/resources/price_tiers.d.ts +1 -1
- package/lib/resources/price_tiers.js +794 -6
- package/lib/resources/price_volume_tiers.cjs +794 -6
- package/lib/resources/price_volume_tiers.d.cts +1 -1
- package/lib/resources/price_volume_tiers.d.ts +1 -1
- package/lib/resources/price_volume_tiers.js +794 -6
- package/lib/resources/prices.cjs +794 -6
- package/lib/resources/prices.d.cts +1 -1
- package/lib/resources/prices.d.ts +1 -1
- package/lib/resources/prices.js +794 -6
- package/lib/resources/promotion_rules.cjs +794 -6
- package/lib/resources/promotion_rules.d.cts +1 -1
- package/lib/resources/promotion_rules.d.ts +1 -1
- package/lib/resources/promotion_rules.js +794 -6
- package/lib/resources/promotions.cjs +794 -6
- package/lib/resources/promotions.d.cts +1 -1
- package/lib/resources/promotions.d.ts +1 -1
- package/lib/resources/promotions.js +794 -6
- package/lib/resources/recurring_order_copies.cjs +794 -6
- package/lib/resources/recurring_order_copies.d.cts +1 -1
- package/lib/resources/recurring_order_copies.d.ts +1 -1
- package/lib/resources/recurring_order_copies.js +794 -6
- package/lib/resources/refunds.cjs +794 -6
- package/lib/resources/refunds.d.cts +1 -1
- package/lib/resources/refunds.d.ts +1 -1
- package/lib/resources/refunds.js +794 -6
- package/lib/resources/reserved_stocks.cjs +794 -6
- package/lib/resources/reserved_stocks.d.cts +1 -1
- package/lib/resources/reserved_stocks.d.ts +1 -1
- package/lib/resources/reserved_stocks.js +794 -6
- package/lib/resources/resource_errors.cjs +794 -6
- package/lib/resources/resource_errors.d.cts +1 -1
- package/lib/resources/resource_errors.d.ts +1 -1
- package/lib/resources/resource_errors.js +794 -6
- package/lib/resources/return_line_items.cjs +794 -6
- package/lib/resources/return_line_items.d.cts +1 -1
- package/lib/resources/return_line_items.d.ts +1 -1
- package/lib/resources/return_line_items.js +794 -6
- package/lib/resources/returns.cjs +794 -6
- package/lib/resources/returns.d.cts +1 -1
- package/lib/resources/returns.d.ts +1 -1
- package/lib/resources/returns.js +794 -6
- package/lib/resources/satispay_gateways.cjs +794 -6
- package/lib/resources/satispay_gateways.d.cts +1 -1
- package/lib/resources/satispay_gateways.d.ts +1 -1
- package/lib/resources/satispay_gateways.js +794 -6
- package/lib/resources/satispay_payments.cjs +794 -6
- package/lib/resources/satispay_payments.d.cts +1 -1
- package/lib/resources/satispay_payments.d.ts +1 -1
- package/lib/resources/satispay_payments.js +794 -6
- package/lib/resources/shipments.cjs +794 -6
- package/lib/resources/shipments.d.cts +1 -1
- package/lib/resources/shipments.d.ts +1 -1
- package/lib/resources/shipments.js +794 -6
- package/lib/resources/shipping_categories.cjs +794 -6
- package/lib/resources/shipping_categories.d.cts +1 -1
- package/lib/resources/shipping_categories.d.ts +1 -1
- package/lib/resources/shipping_categories.js +794 -6
- package/lib/resources/shipping_method_tiers.cjs +794 -6
- package/lib/resources/shipping_method_tiers.d.cts +1 -1
- package/lib/resources/shipping_method_tiers.d.ts +1 -1
- package/lib/resources/shipping_method_tiers.js +794 -6
- package/lib/resources/shipping_methods.cjs +794 -6
- package/lib/resources/shipping_methods.d.cts +1 -1
- package/lib/resources/shipping_methods.d.ts +1 -1
- package/lib/resources/shipping_methods.js +794 -6
- package/lib/resources/shipping_weight_tiers.cjs +794 -6
- package/lib/resources/shipping_weight_tiers.d.cts +1 -1
- package/lib/resources/shipping_weight_tiers.d.ts +1 -1
- package/lib/resources/shipping_weight_tiers.js +794 -6
- package/lib/resources/shipping_zones.cjs +794 -6
- package/lib/resources/shipping_zones.d.cts +1 -1
- package/lib/resources/shipping_zones.d.ts +1 -1
- package/lib/resources/shipping_zones.js +794 -6
- package/lib/resources/sku_list_items.cjs +794 -6
- package/lib/resources/sku_list_items.d.cts +1 -1
- package/lib/resources/sku_list_items.d.ts +1 -1
- package/lib/resources/sku_list_items.js +794 -6
- package/lib/resources/sku_list_promotion_rules.cjs +794 -6
- package/lib/resources/sku_list_promotion_rules.d.cts +1 -1
- package/lib/resources/sku_list_promotion_rules.d.ts +1 -1
- package/lib/resources/sku_list_promotion_rules.js +794 -6
- package/lib/resources/sku_lists.cjs +794 -6
- package/lib/resources/sku_lists.d.cts +1 -1
- package/lib/resources/sku_lists.d.ts +1 -1
- package/lib/resources/sku_lists.js +794 -6
- package/lib/resources/sku_options.cjs +794 -6
- package/lib/resources/sku_options.d.cts +1 -1
- package/lib/resources/sku_options.d.ts +1 -1
- package/lib/resources/sku_options.js +794 -6
- package/lib/resources/skus.cjs +794 -6
- package/lib/resources/skus.d.cts +1 -1
- package/lib/resources/skus.d.ts +1 -1
- package/lib/resources/skus.js +794 -6
- package/lib/resources/stock_items.cjs +794 -6
- package/lib/resources/stock_items.d.cts +1 -1
- package/lib/resources/stock_items.d.ts +1 -1
- package/lib/resources/stock_items.js +794 -6
- package/lib/resources/stock_line_items.cjs +794 -6
- package/lib/resources/stock_line_items.d.cts +1 -1
- package/lib/resources/stock_line_items.d.ts +1 -1
- package/lib/resources/stock_line_items.js +794 -6
- package/lib/resources/stock_locations.cjs +794 -6
- package/lib/resources/stock_locations.d.cts +1 -1
- package/lib/resources/stock_locations.d.ts +1 -1
- package/lib/resources/stock_locations.js +794 -6
- package/lib/resources/stock_reservations.cjs +794 -6
- package/lib/resources/stock_reservations.d.cts +1 -1
- package/lib/resources/stock_reservations.d.ts +1 -1
- package/lib/resources/stock_reservations.js +794 -6
- package/lib/resources/stock_transfers.cjs +794 -6
- package/lib/resources/stock_transfers.d.cts +1 -1
- package/lib/resources/stock_transfers.d.ts +1 -1
- package/lib/resources/stock_transfers.js +794 -6
- package/lib/resources/stores.cjs +794 -6
- package/lib/resources/stores.d.cts +1 -1
- package/lib/resources/stores.d.ts +1 -1
- package/lib/resources/stores.js +794 -6
- package/lib/resources/stripe_gateways.cjs +794 -6
- package/lib/resources/stripe_gateways.d.cts +1 -1
- package/lib/resources/stripe_gateways.d.ts +1 -1
- package/lib/resources/stripe_gateways.js +794 -6
- package/lib/resources/stripe_payments.cjs +794 -6
- package/lib/resources/stripe_payments.d.cts +1 -1
- package/lib/resources/stripe_payments.d.ts +1 -1
- package/lib/resources/stripe_payments.js +794 -6
- package/lib/resources/stripe_tax_accounts.cjs +794 -6
- package/lib/resources/stripe_tax_accounts.d.cts +1 -1
- package/lib/resources/stripe_tax_accounts.d.ts +1 -1
- package/lib/resources/stripe_tax_accounts.js +794 -6
- package/lib/resources/subscription_models.cjs +794 -6
- package/lib/resources/subscription_models.d.cts +1 -1
- package/lib/resources/subscription_models.d.ts +1 -1
- package/lib/resources/subscription_models.js +794 -6
- package/lib/resources/tags.cjs +794 -6
- package/lib/resources/tags.d.cts +1 -1
- package/lib/resources/tags.d.ts +1 -1
- package/lib/resources/tags.js +794 -6
- package/lib/resources/talon_one_accounts.cjs +794 -6
- package/lib/resources/talon_one_accounts.d.cts +1 -1
- package/lib/resources/talon_one_accounts.d.ts +1 -1
- package/lib/resources/talon_one_accounts.js +794 -6
- package/lib/resources/tax_calculators.cjs +794 -6
- package/lib/resources/tax_calculators.d.cts +1 -1
- package/lib/resources/tax_calculators.d.ts +1 -1
- package/lib/resources/tax_calculators.js +794 -6
- package/lib/resources/tax_categories.cjs +794 -6
- package/lib/resources/tax_categories.d.cts +1 -1
- package/lib/resources/tax_categories.d.ts +1 -1
- package/lib/resources/tax_categories.js +794 -6
- package/lib/resources/tax_rules.cjs +794 -6
- package/lib/resources/tax_rules.d.cts +1 -1
- package/lib/resources/tax_rules.d.ts +1 -1
- package/lib/resources/tax_rules.js +794 -6
- package/lib/resources/taxjar_accounts.cjs +794 -6
- package/lib/resources/taxjar_accounts.d.cts +1 -1
- package/lib/resources/taxjar_accounts.d.ts +1 -1
- package/lib/resources/taxjar_accounts.js +794 -6
- package/lib/resources/transactions.cjs +794 -6
- package/lib/resources/transactions.d.cts +1 -1
- package/lib/resources/transactions.d.ts +1 -1
- package/lib/resources/transactions.js +794 -6
- package/lib/resources/versions.cjs +794 -6
- package/lib/resources/versions.d.cts +1 -1
- package/lib/resources/versions.d.ts +1 -1
- package/lib/resources/versions.js +794 -6
- package/lib/resources/vertex_accounts.cjs +794 -6
- package/lib/resources/vertex_accounts.d.cts +1 -1
- package/lib/resources/vertex_accounts.d.ts +1 -1
- package/lib/resources/vertex_accounts.js +794 -6
- package/lib/resources/voids.cjs +794 -6
- package/lib/resources/voids.d.cts +1 -1
- package/lib/resources/voids.d.ts +1 -1
- package/lib/resources/voids.js +794 -6
- package/lib/resources/webhooks.cjs +794 -6
- package/lib/resources/webhooks.d.cts +1 -1
- package/lib/resources/webhooks.d.ts +1 -1
- package/lib/resources/webhooks.js +794 -6
- package/lib/resources/wire_transfers.cjs +794 -6
- package/lib/resources/wire_transfers.d.cts +1 -1
- package/lib/resources/wire_transfers.d.ts +1 -1
- package/lib/resources/wire_transfers.js +794 -6
- package/lib/static.cjs +753 -20
- package/lib/static.d.cts +1 -1
- package/lib/static.d.ts +1 -1
- package/lib/static.js +739 -6
- package/lib/util.cjs +5 -6
- package/lib/util.js +5 -6
- package/package.json +1 -1
- package/lib/chunk-AQ5VUG5P.js +0 -12
- package/lib/chunk-JE77HYXB.cjs +0 -17
package/lib/error.cjs
CHANGED
@@ -1,8 +1,59 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var
|
4
|
-
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
5
|
+
}) : x)(function(x) {
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
8
|
+
});
|
5
9
|
|
10
|
+
// src/debug.ts
|
11
|
+
var debuggerFunction = (_pattern, ..._args) => {
|
12
|
+
};
|
13
|
+
var debuggerFactory = (_namespace) => debuggerFunction;
|
14
|
+
try {
|
15
|
+
const debugModule = __require("debug");
|
16
|
+
if (debugModule && typeof debugModule === "function") debuggerFactory = debugModule;
|
17
|
+
} catch (error) {
|
18
|
+
}
|
19
|
+
var debugPrefix = "clsdk";
|
20
|
+
var debug = (namespace) => {
|
21
|
+
return debuggerFactory(`${debugPrefix}:${namespace}`);
|
22
|
+
};
|
23
|
+
var debug_default = debug;
|
24
|
+
|
25
|
+
// src/fetch.ts
|
26
|
+
debug_default("fetch");
|
27
|
+
var FetchError = class _FetchError extends Error {
|
28
|
+
static isFetchError = (error) => {
|
29
|
+
return error instanceof _FetchError;
|
30
|
+
};
|
31
|
+
#errors;
|
32
|
+
#status;
|
33
|
+
#statusText;
|
34
|
+
#request;
|
35
|
+
constructor(status, statusText, body, request) {
|
36
|
+
super(statusText);
|
37
|
+
this.#status = status;
|
38
|
+
this.#statusText = statusText;
|
39
|
+
if (body) this.#errors = body.errors;
|
40
|
+
if (request) this.#request = request;
|
41
|
+
}
|
42
|
+
get errors() {
|
43
|
+
return this.#errors;
|
44
|
+
}
|
45
|
+
get status() {
|
46
|
+
return this.#status;
|
47
|
+
}
|
48
|
+
get statusText() {
|
49
|
+
return this.#statusText;
|
50
|
+
}
|
51
|
+
get request() {
|
52
|
+
return this.#request;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
// src/error.ts
|
6
57
|
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
7
58
|
ErrorType2["CLIENT"] = "client";
|
8
59
|
ErrorType2["REQUEST"] = "request";
|
@@ -13,59 +64,57 @@ var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
|
13
64
|
ErrorType2["TOKEN_REFRESH"] = "token-refresh";
|
14
65
|
return ErrorType2;
|
15
66
|
})(ErrorType || {});
|
16
|
-
|
67
|
+
var SdkError = class _SdkError extends Error {
|
68
|
+
static NAME = "SdkError";
|
69
|
+
static isSdkError(error) {
|
70
|
+
return error && [_SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
71
|
+
}
|
72
|
+
type;
|
73
|
+
code;
|
74
|
+
source;
|
17
75
|
constructor(error) {
|
18
76
|
super(error.message);
|
19
|
-
chunkJE77HYXB_cjs.__publicField(this, "type");
|
20
|
-
chunkJE77HYXB_cjs.__publicField(this, "code");
|
21
|
-
chunkJE77HYXB_cjs.__publicField(this, "source");
|
22
77
|
this.name = _SdkError.NAME;
|
23
78
|
this.type = error.type || "client" /* CLIENT */;
|
24
79
|
}
|
25
|
-
static isSdkError(error) {
|
26
|
-
return error && [_SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
27
|
-
}
|
28
80
|
};
|
29
|
-
|
30
|
-
|
31
|
-
|
81
|
+
var ApiError = class _ApiError extends SdkError {
|
82
|
+
static NAME = "ApiError";
|
83
|
+
static isApiError(error) {
|
84
|
+
return SdkError.isSdkError(error) && error.name === _ApiError.NAME && error.type === "response" /* RESPONSE */;
|
85
|
+
}
|
86
|
+
errors = [];
|
87
|
+
status;
|
88
|
+
statusText;
|
32
89
|
// constructor(error: SdkError)
|
33
90
|
constructor(error) {
|
34
91
|
super({ ...error, type: "response" /* RESPONSE */ });
|
35
|
-
chunkJE77HYXB_cjs.__publicField(this, "errors", []);
|
36
|
-
chunkJE77HYXB_cjs.__publicField(this, "status");
|
37
|
-
chunkJE77HYXB_cjs.__publicField(this, "statusText");
|
38
92
|
this.name = _ApiError.NAME;
|
39
93
|
}
|
40
|
-
static isApiError(error) {
|
41
|
-
return SdkError.isSdkError(error) && error.name === _ApiError.NAME && error.type === "response" /* RESPONSE */;
|
42
|
-
}
|
43
94
|
first() {
|
44
95
|
return this.errors?.length > 0 ? this.errors[0] : void 0;
|
45
96
|
}
|
46
97
|
};
|
47
|
-
|
48
|
-
let ApiError = _ApiError;
|
49
|
-
const isRequestError = (error) => {
|
98
|
+
var isRequestError = (error) => {
|
50
99
|
return error instanceof TypeError && error.message !== "fetch failed";
|
51
100
|
};
|
52
|
-
|
101
|
+
var isCancelError = (error) => {
|
53
102
|
return error instanceof DOMException && error.name === "AbortError";
|
54
103
|
};
|
55
|
-
|
104
|
+
var isTimeoutError = (error) => {
|
56
105
|
return error instanceof DOMException && error.name === "TimeoutError";
|
57
106
|
};
|
58
|
-
|
107
|
+
var isExpiredTokenError = (error) => {
|
59
108
|
const invalidTokenCodes = [
|
60
109
|
"INVALID_TOKEN"
|
61
110
|
/*, 'UNAUTHORIZED' */
|
62
111
|
];
|
63
112
|
return ApiError.isApiError(error) && error.status === 401 && (invalidTokenCodes.includes(error.code || "") || error.errors && error.errors.length > 0 && invalidTokenCodes.includes(error.errors[0].code));
|
64
113
|
};
|
65
|
-
|
114
|
+
var handleError = (error) => {
|
66
115
|
if (SdkError.isSdkError(error) || ApiError.isApiError(error)) throw error;
|
67
116
|
let sdkError = new SdkError({ message: error.message });
|
68
|
-
if (
|
117
|
+
if (FetchError.isFetchError(error)) {
|
69
118
|
const apiError = new ApiError(sdkError);
|
70
119
|
apiError.type = "response" /* RESPONSE */;
|
71
120
|
apiError.status = error.status;
|
package/lib/error.js
CHANGED
@@ -1,6 +1,57 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
3
|
+
}) : x)(function(x) {
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
6
|
+
});
|
3
7
|
|
8
|
+
// src/debug.ts
|
9
|
+
var debuggerFunction = (_pattern, ..._args) => {
|
10
|
+
};
|
11
|
+
var debuggerFactory = (_namespace) => debuggerFunction;
|
12
|
+
try {
|
13
|
+
const debugModule = __require("debug");
|
14
|
+
if (debugModule && typeof debugModule === "function") debuggerFactory = debugModule;
|
15
|
+
} catch (error) {
|
16
|
+
}
|
17
|
+
var debugPrefix = "clsdk";
|
18
|
+
var debug = (namespace) => {
|
19
|
+
return debuggerFactory(`${debugPrefix}:${namespace}`);
|
20
|
+
};
|
21
|
+
var debug_default = debug;
|
22
|
+
|
23
|
+
// src/fetch.ts
|
24
|
+
debug_default("fetch");
|
25
|
+
var FetchError = class _FetchError extends Error {
|
26
|
+
static isFetchError = (error) => {
|
27
|
+
return error instanceof _FetchError;
|
28
|
+
};
|
29
|
+
#errors;
|
30
|
+
#status;
|
31
|
+
#statusText;
|
32
|
+
#request;
|
33
|
+
constructor(status, statusText, body, request) {
|
34
|
+
super(statusText);
|
35
|
+
this.#status = status;
|
36
|
+
this.#statusText = statusText;
|
37
|
+
if (body) this.#errors = body.errors;
|
38
|
+
if (request) this.#request = request;
|
39
|
+
}
|
40
|
+
get errors() {
|
41
|
+
return this.#errors;
|
42
|
+
}
|
43
|
+
get status() {
|
44
|
+
return this.#status;
|
45
|
+
}
|
46
|
+
get statusText() {
|
47
|
+
return this.#statusText;
|
48
|
+
}
|
49
|
+
get request() {
|
50
|
+
return this.#request;
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
// src/error.ts
|
4
55
|
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
5
56
|
ErrorType2["CLIENT"] = "client";
|
6
57
|
ErrorType2["REQUEST"] = "request";
|
@@ -11,56 +62,54 @@ var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
|
11
62
|
ErrorType2["TOKEN_REFRESH"] = "token-refresh";
|
12
63
|
return ErrorType2;
|
13
64
|
})(ErrorType || {});
|
14
|
-
|
65
|
+
var SdkError = class _SdkError extends Error {
|
66
|
+
static NAME = "SdkError";
|
67
|
+
static isSdkError(error) {
|
68
|
+
return error && [_SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
69
|
+
}
|
70
|
+
type;
|
71
|
+
code;
|
72
|
+
source;
|
15
73
|
constructor(error) {
|
16
74
|
super(error.message);
|
17
|
-
__publicField(this, "type");
|
18
|
-
__publicField(this, "code");
|
19
|
-
__publicField(this, "source");
|
20
75
|
this.name = _SdkError.NAME;
|
21
76
|
this.type = error.type || "client" /* CLIENT */;
|
22
77
|
}
|
23
|
-
static isSdkError(error) {
|
24
|
-
return error && [_SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
25
|
-
}
|
26
78
|
};
|
27
|
-
|
28
|
-
|
29
|
-
|
79
|
+
var ApiError = class _ApiError extends SdkError {
|
80
|
+
static NAME = "ApiError";
|
81
|
+
static isApiError(error) {
|
82
|
+
return SdkError.isSdkError(error) && error.name === _ApiError.NAME && error.type === "response" /* RESPONSE */;
|
83
|
+
}
|
84
|
+
errors = [];
|
85
|
+
status;
|
86
|
+
statusText;
|
30
87
|
// constructor(error: SdkError)
|
31
88
|
constructor(error) {
|
32
89
|
super({ ...error, type: "response" /* RESPONSE */ });
|
33
|
-
__publicField(this, "errors", []);
|
34
|
-
__publicField(this, "status");
|
35
|
-
__publicField(this, "statusText");
|
36
90
|
this.name = _ApiError.NAME;
|
37
91
|
}
|
38
|
-
static isApiError(error) {
|
39
|
-
return SdkError.isSdkError(error) && error.name === _ApiError.NAME && error.type === "response" /* RESPONSE */;
|
40
|
-
}
|
41
92
|
first() {
|
42
93
|
return this.errors?.length > 0 ? this.errors[0] : void 0;
|
43
94
|
}
|
44
95
|
};
|
45
|
-
|
46
|
-
let ApiError = _ApiError;
|
47
|
-
const isRequestError = (error) => {
|
96
|
+
var isRequestError = (error) => {
|
48
97
|
return error instanceof TypeError && error.message !== "fetch failed";
|
49
98
|
};
|
50
|
-
|
99
|
+
var isCancelError = (error) => {
|
51
100
|
return error instanceof DOMException && error.name === "AbortError";
|
52
101
|
};
|
53
|
-
|
102
|
+
var isTimeoutError = (error) => {
|
54
103
|
return error instanceof DOMException && error.name === "TimeoutError";
|
55
104
|
};
|
56
|
-
|
105
|
+
var isExpiredTokenError = (error) => {
|
57
106
|
const invalidTokenCodes = [
|
58
107
|
"INVALID_TOKEN"
|
59
108
|
/*, 'UNAUTHORIZED' */
|
60
109
|
];
|
61
110
|
return ApiError.isApiError(error) && error.status === 401 && (invalidTokenCodes.includes(error.code || "") || error.errors && error.errors.length > 0 && invalidTokenCodes.includes(error.errors[0].code));
|
62
111
|
};
|
63
|
-
|
112
|
+
var handleError = (error) => {
|
64
113
|
if (SdkError.isSdkError(error) || ApiError.isApiError(error)) throw error;
|
65
114
|
let sdkError = new SdkError({ message: error.message });
|
66
115
|
if (FetchError.isFetchError(error)) {
|
package/lib/fetch.cjs
CHANGED
@@ -1,50 +1,102 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var
|
4
|
-
|
5
|
-
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
5
|
+
}) : x)(function(x) {
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
8
|
+
});
|
6
9
|
|
7
|
-
|
10
|
+
// src/error.ts
|
11
|
+
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
12
|
+
ErrorType2["CLIENT"] = "client";
|
13
|
+
ErrorType2["REQUEST"] = "request";
|
14
|
+
ErrorType2["RESPONSE"] = "response";
|
15
|
+
ErrorType2["CANCEL"] = "cancel";
|
16
|
+
ErrorType2["PARSE"] = "parse";
|
17
|
+
ErrorType2["TIMEOUT"] = "timeout";
|
18
|
+
ErrorType2["TOKEN_REFRESH"] = "token-refresh";
|
19
|
+
return ErrorType2;
|
20
|
+
})(ErrorType || {});
|
21
|
+
var SdkError = class _SdkError extends Error {
|
22
|
+
static NAME = "SdkError";
|
23
|
+
static isSdkError(error) {
|
24
|
+
return error && [_SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
25
|
+
}
|
26
|
+
type;
|
27
|
+
code;
|
28
|
+
source;
|
29
|
+
constructor(error) {
|
30
|
+
super(error.message);
|
31
|
+
this.name = _SdkError.NAME;
|
32
|
+
this.type = error.type || "client" /* CLIENT */;
|
33
|
+
}
|
34
|
+
};
|
35
|
+
var ApiError = class _ApiError extends SdkError {
|
36
|
+
static NAME = "ApiError";
|
37
|
+
static isApiError(error) {
|
38
|
+
return SdkError.isSdkError(error) && error.name === _ApiError.NAME && error.type === "response" /* RESPONSE */;
|
39
|
+
}
|
40
|
+
errors = [];
|
41
|
+
status;
|
42
|
+
statusText;
|
43
|
+
// constructor(error: SdkError)
|
44
|
+
constructor(error) {
|
45
|
+
super({ ...error, type: "response" /* RESPONSE */ });
|
46
|
+
this.name = _ApiError.NAME;
|
47
|
+
}
|
48
|
+
first() {
|
49
|
+
return this.errors?.length > 0 ? this.errors[0] : void 0;
|
50
|
+
}
|
51
|
+
};
|
8
52
|
|
9
|
-
|
53
|
+
// src/debug.ts
|
54
|
+
var debuggerFunction = (_pattern, ..._args) => {
|
55
|
+
};
|
56
|
+
var debuggerFactory = (_namespace) => debuggerFunction;
|
57
|
+
try {
|
58
|
+
const debugModule = __require("debug");
|
59
|
+
if (debugModule && typeof debugModule === "function") debuggerFactory = debugModule;
|
60
|
+
} catch (error) {
|
61
|
+
}
|
62
|
+
var debugPrefix = "clsdk";
|
63
|
+
var debug = (namespace) => {
|
64
|
+
return debuggerFactory(`${debugPrefix}:${namespace}`);
|
65
|
+
};
|
66
|
+
var debug_default = debug;
|
10
67
|
|
11
|
-
|
12
|
-
|
13
|
-
|
68
|
+
// src/fetch.ts
|
69
|
+
var debug2 = debug_default("fetch");
|
70
|
+
var FetchError = class _FetchError extends Error {
|
71
|
+
static isFetchError = (error) => {
|
72
|
+
return error instanceof _FetchError;
|
73
|
+
};
|
74
|
+
#errors;
|
75
|
+
#status;
|
76
|
+
#statusText;
|
77
|
+
#request;
|
14
78
|
constructor(status, statusText, body, request) {
|
15
79
|
super(statusText);
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
chunkJE77HYXB_cjs.__privateSet(this, _status, status);
|
21
|
-
chunkJE77HYXB_cjs.__privateSet(this, _statusText, statusText);
|
22
|
-
if (body) chunkJE77HYXB_cjs.__privateSet(this, _errors, body.errors);
|
23
|
-
if (request) chunkJE77HYXB_cjs.__privateSet(this, _request, request);
|
80
|
+
this.#status = status;
|
81
|
+
this.#statusText = statusText;
|
82
|
+
if (body) this.#errors = body.errors;
|
83
|
+
if (request) this.#request = request;
|
24
84
|
}
|
25
85
|
get errors() {
|
26
|
-
return
|
86
|
+
return this.#errors;
|
27
87
|
}
|
28
88
|
get status() {
|
29
|
-
return
|
89
|
+
return this.#status;
|
30
90
|
}
|
31
91
|
get statusText() {
|
32
|
-
return
|
92
|
+
return this.#statusText;
|
33
93
|
}
|
34
94
|
get request() {
|
35
|
-
return
|
95
|
+
return this.#request;
|
36
96
|
}
|
37
97
|
};
|
38
|
-
|
39
|
-
|
40
|
-
_statusText = new WeakMap();
|
41
|
-
_request = new WeakMap();
|
42
|
-
chunkJE77HYXB_cjs.__publicField(_FetchError, "isFetchError", (error) => {
|
43
|
-
return error instanceof _FetchError;
|
44
|
-
});
|
45
|
-
let FetchError = _FetchError;
|
46
|
-
const fetchURL = async (url, requestOptions, clientOptions) => {
|
47
|
-
debug("fetch: %s, %O, native[%s]", url, requestOptions || {}, clientOptions?.fetch ? "no" : "yes");
|
98
|
+
var fetchURL = async (url, requestOptions, clientOptions) => {
|
99
|
+
debug2("fetch: %s, %O, native[%s]", url, requestOptions || {}, clientOptions?.fetch ? "no" : "yes");
|
48
100
|
const interceptors = clientOptions?.interceptors;
|
49
101
|
if (interceptors?.request?.onSuccess) ({ url, options: requestOptions } = await interceptors.request.onSuccess({ url, options: requestOptions }));
|
50
102
|
const fetchClient = clientOptions?.fetch || fetch;
|
@@ -56,11 +108,11 @@ const fetchURL = async (url, requestOptions, clientOptions) => {
|
|
56
108
|
if (interceptors?.rawReader?.onFailure) await interceptors.rawReader.onFailure(response);
|
57
109
|
}
|
58
110
|
const responseBody = response.body && response.status !== 204 ? await response.json().then((json) => {
|
59
|
-
|
111
|
+
debug2("response: %O", json);
|
60
112
|
return json;
|
61
113
|
}).catch((err) => {
|
62
|
-
|
63
|
-
if (response.ok) throw new
|
114
|
+
debug2("error: %s", err.message);
|
115
|
+
if (response.ok) throw new SdkError({ message: "Error parsing API response body", type: "parse" /* PARSE */ });
|
64
116
|
}) : void 0;
|
65
117
|
if (!response.ok) {
|
66
118
|
let error = new FetchError(response.status, response.statusText, responseBody, requestOptions);
|
package/lib/fetch.js
CHANGED
@@ -1,44 +1,100 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
3
|
+
}) : x)(function(x) {
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
6
|
+
});
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
// src/error.ts
|
9
|
+
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
10
|
+
ErrorType2["CLIENT"] = "client";
|
11
|
+
ErrorType2["REQUEST"] = "request";
|
12
|
+
ErrorType2["RESPONSE"] = "response";
|
13
|
+
ErrorType2["CANCEL"] = "cancel";
|
14
|
+
ErrorType2["PARSE"] = "parse";
|
15
|
+
ErrorType2["TIMEOUT"] = "timeout";
|
16
|
+
ErrorType2["TOKEN_REFRESH"] = "token-refresh";
|
17
|
+
return ErrorType2;
|
18
|
+
})(ErrorType || {});
|
19
|
+
var SdkError = class _SdkError extends Error {
|
20
|
+
static NAME = "SdkError";
|
21
|
+
static isSdkError(error) {
|
22
|
+
return error && [_SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
23
|
+
}
|
24
|
+
type;
|
25
|
+
code;
|
26
|
+
source;
|
27
|
+
constructor(error) {
|
28
|
+
super(error.message);
|
29
|
+
this.name = _SdkError.NAME;
|
30
|
+
this.type = error.type || "client" /* CLIENT */;
|
31
|
+
}
|
32
|
+
};
|
33
|
+
var ApiError = class _ApiError extends SdkError {
|
34
|
+
static NAME = "ApiError";
|
35
|
+
static isApiError(error) {
|
36
|
+
return SdkError.isSdkError(error) && error.name === _ApiError.NAME && error.type === "response" /* RESPONSE */;
|
37
|
+
}
|
38
|
+
errors = [];
|
39
|
+
status;
|
40
|
+
statusText;
|
41
|
+
// constructor(error: SdkError)
|
42
|
+
constructor(error) {
|
43
|
+
super({ ...error, type: "response" /* RESPONSE */ });
|
44
|
+
this.name = _ApiError.NAME;
|
45
|
+
}
|
46
|
+
first() {
|
47
|
+
return this.errors?.length > 0 ? this.errors[0] : void 0;
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
// src/debug.ts
|
52
|
+
var debuggerFunction = (_pattern, ..._args) => {
|
53
|
+
};
|
54
|
+
var debuggerFactory = (_namespace) => debuggerFunction;
|
55
|
+
try {
|
56
|
+
const debugModule = __require("debug");
|
57
|
+
if (debugModule && typeof debugModule === "function") debuggerFactory = debugModule;
|
58
|
+
} catch (error) {
|
59
|
+
}
|
60
|
+
var debugPrefix = "clsdk";
|
61
|
+
var debug = (namespace) => {
|
62
|
+
return debuggerFactory(`${debugPrefix}:${namespace}`);
|
63
|
+
};
|
64
|
+
var debug_default = debug;
|
65
|
+
|
66
|
+
// src/fetch.ts
|
67
|
+
var debug2 = debug_default("fetch");
|
68
|
+
var FetchError = class _FetchError extends Error {
|
69
|
+
static isFetchError = (error) => {
|
70
|
+
return error instanceof _FetchError;
|
71
|
+
};
|
72
|
+
#errors;
|
73
|
+
#status;
|
74
|
+
#statusText;
|
75
|
+
#request;
|
8
76
|
constructor(status, statusText, body, request) {
|
9
77
|
super(statusText);
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
__privateSet(this, _status, status);
|
15
|
-
__privateSet(this, _statusText, statusText);
|
16
|
-
if (body) __privateSet(this, _errors, body.errors);
|
17
|
-
if (request) __privateSet(this, _request, request);
|
78
|
+
this.#status = status;
|
79
|
+
this.#statusText = statusText;
|
80
|
+
if (body) this.#errors = body.errors;
|
81
|
+
if (request) this.#request = request;
|
18
82
|
}
|
19
83
|
get errors() {
|
20
|
-
return
|
84
|
+
return this.#errors;
|
21
85
|
}
|
22
86
|
get status() {
|
23
|
-
return
|
87
|
+
return this.#status;
|
24
88
|
}
|
25
89
|
get statusText() {
|
26
|
-
return
|
90
|
+
return this.#statusText;
|
27
91
|
}
|
28
92
|
get request() {
|
29
|
-
return
|
93
|
+
return this.#request;
|
30
94
|
}
|
31
95
|
};
|
32
|
-
|
33
|
-
|
34
|
-
_statusText = new WeakMap();
|
35
|
-
_request = new WeakMap();
|
36
|
-
__publicField(_FetchError, "isFetchError", (error) => {
|
37
|
-
return error instanceof _FetchError;
|
38
|
-
});
|
39
|
-
let FetchError = _FetchError;
|
40
|
-
const fetchURL = async (url, requestOptions, clientOptions) => {
|
41
|
-
debug("fetch: %s, %O, native[%s]", url, requestOptions || {}, clientOptions?.fetch ? "no" : "yes");
|
96
|
+
var fetchURL = async (url, requestOptions, clientOptions) => {
|
97
|
+
debug2("fetch: %s, %O, native[%s]", url, requestOptions || {}, clientOptions?.fetch ? "no" : "yes");
|
42
98
|
const interceptors = clientOptions?.interceptors;
|
43
99
|
if (interceptors?.request?.onSuccess) ({ url, options: requestOptions } = await interceptors.request.onSuccess({ url, options: requestOptions }));
|
44
100
|
const fetchClient = clientOptions?.fetch || fetch;
|
@@ -50,11 +106,11 @@ const fetchURL = async (url, requestOptions, clientOptions) => {
|
|
50
106
|
if (interceptors?.rawReader?.onFailure) await interceptors.rawReader.onFailure(response);
|
51
107
|
}
|
52
108
|
const responseBody = response.body && response.status !== 204 ? await response.json().then((json) => {
|
53
|
-
|
109
|
+
debug2("response: %O", json);
|
54
110
|
return json;
|
55
111
|
}).catch((err) => {
|
56
|
-
|
57
|
-
if (response.ok) throw new SdkError({ message: "Error parsing API response body", type:
|
112
|
+
debug2("error: %s", err.message);
|
113
|
+
if (response.ok) throw new SdkError({ message: "Error parsing API response body", type: "parse" /* PARSE */ });
|
58
114
|
}) : void 0;
|
59
115
|
if (!response.ok) {
|
60
116
|
let error = new FetchError(response.status, response.statusText, responseBody, requestOptions);
|