@commercelayer/sdk 4.22.0 → 4.23.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 +109 -1
- package/lib/cjs/api.js +343 -1
- package/lib/cjs/client.d.ts +31 -1
- package/lib/cjs/client.js +123 -1
- package/lib/cjs/commercelayer.d.ts +133 -1
- package/lib/cjs/commercelayer.js +224 -1
- package/lib/cjs/common.d.ts +4 -1
- package/lib/cjs/common.js +14 -1
- package/lib/cjs/config.d.ts +11 -1
- package/lib/cjs/config.js +13 -1
- package/lib/cjs/debug.d.ts +3 -1
- package/lib/cjs/debug.js +42 -1
- package/lib/cjs/error.d.ts +28 -1
- package/lib/cjs/error.js +43 -1
- package/lib/cjs/index.d.ts +7 -1
- package/lib/cjs/index.js +29 -1
- package/lib/cjs/interceptor.d.ts +21 -1
- package/lib/cjs/interceptor.js +2 -1
- package/lib/cjs/jsonapi.d.ts +5 -1
- package/lib/cjs/jsonapi.js +82 -1
- package/lib/cjs/model.d.ts +107 -1
- package/lib/cjs/model.js +3 -1
- package/lib/cjs/query.d.ts +23 -1
- package/lib/cjs/query.js +51 -1
- package/lib/cjs/resource.d.ts +77 -1
- package/lib/cjs/resource.js +145 -1
- package/lib/cjs/resources/addresses.d.ts +88 -1
- package/lib/cjs/resources/addresses.js +37 -1
- package/lib/cjs/resources/adjustments.d.ts +35 -1
- package/lib/cjs/resources/adjustments.js +33 -1
- package/lib/cjs/resources/adyen_gateways.d.ts +56 -1
- package/lib/cjs/resources/adyen_gateways.js +41 -1
- package/lib/cjs/resources/adyen_payments.d.ts +45 -1
- package/lib/cjs/resources/adyen_payments.js +41 -1
- package/lib/cjs/resources/application.d.ts +21 -1
- package/lib/cjs/resources/application.js +21 -1
- package/lib/cjs/resources/attachments.d.ts +156 -1
- package/lib/cjs/resources/attachments.js +33 -1
- package/lib/cjs/resources/authorizations.d.ts +60 -1
- package/lib/cjs/resources/authorizations.js +43 -1
- package/lib/cjs/resources/avalara_accounts.d.ts +55 -1
- package/lib/cjs/resources/avalara_accounts.js +45 -1
- package/lib/cjs/resources/billing_info_validation_rules.d.ts +35 -1
- package/lib/cjs/resources/billing_info_validation_rules.js +41 -1
- package/lib/cjs/resources/bing_geocoders.d.ts +35 -1
- package/lib/cjs/resources/bing_geocoders.js +41 -1
- package/lib/cjs/resources/braintree_gateways.d.ts +56 -1
- package/lib/cjs/resources/braintree_gateways.js +41 -1
- package/lib/cjs/resources/braintree_payments.d.ts +47 -1
- package/lib/cjs/resources/braintree_payments.js +41 -1
- package/lib/cjs/resources/bundles.d.ts +76 -1
- package/lib/cjs/resources/bundles.js +49 -1
- package/lib/cjs/resources/captures.d.ts +51 -1
- package/lib/cjs/resources/captures.js +43 -1
- package/lib/cjs/resources/carrier_accounts.d.ts +26 -1
- package/lib/cjs/resources/carrier_accounts.js +32 -1
- package/lib/cjs/resources/checkout_com_gateways.d.ts +45 -1
- package/lib/cjs/resources/checkout_com_gateways.js +41 -1
- package/lib/cjs/resources/checkout_com_payments.d.ts +58 -1
- package/lib/cjs/resources/checkout_com_payments.js +41 -1
- package/lib/cjs/resources/cleanups.d.ts +36 -1
- package/lib/cjs/resources/cleanups.js +34 -1
- package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +59 -1
- package/lib/cjs/resources/coupon_codes_promotion_rules.js +37 -1
- package/lib/cjs/resources/coupon_recipients.d.ts +44 -1
- package/lib/cjs/resources/coupon_recipients.js +41 -1
- package/lib/cjs/resources/coupons.d.ts +45 -1
- package/lib/cjs/resources/coupons.js +37 -1
- package/lib/cjs/resources/customer_addresses.d.ts +44 -1
- package/lib/cjs/resources/customer_addresses.js +45 -1
- package/lib/cjs/resources/customer_groups.d.ts +36 -1
- package/lib/cjs/resources/customer_groups.js +45 -1
- package/lib/cjs/resources/customer_password_resets.d.ts +36 -1
- package/lib/cjs/resources/customer_password_resets.js +41 -1
- package/lib/cjs/resources/customer_payment_sources.d.ts +70 -1
- package/lib/cjs/resources/customer_payment_sources.js +37 -1
- package/lib/cjs/resources/customer_subscriptions.d.ts +31 -1
- package/lib/cjs/resources/customer_subscriptions.js +41 -1
- package/lib/cjs/resources/customers.d.ts +66 -1
- package/lib/cjs/resources/customers.js +73 -1
- package/lib/cjs/resources/delivery_lead_times.d.ts +51 -1
- package/lib/cjs/resources/delivery_lead_times.js +45 -1
- package/lib/cjs/resources/event_callbacks.d.ts +24 -1
- package/lib/cjs/resources/event_callbacks.js +28 -1
- package/lib/cjs/resources/events.d.ts +24 -1
- package/lib/cjs/resources/events.js +32 -1
- package/lib/cjs/resources/exports.d.ts +40 -1
- package/lib/cjs/resources/exports.js +34 -1
- package/lib/cjs/resources/external_gateways.d.ts +49 -1
- package/lib/cjs/resources/external_gateways.js +41 -1
- package/lib/cjs/resources/external_payments.d.ts +43 -1
- package/lib/cjs/resources/external_payments.js +45 -1
- package/lib/cjs/resources/external_promotions.d.ts +90 -1
- package/lib/cjs/resources/external_promotions.js +57 -1
- package/lib/cjs/resources/external_tax_calculators.d.ts +37 -1
- package/lib/cjs/resources/external_tax_calculators.js +41 -1
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +91 -1
- package/lib/cjs/resources/fixed_amount_promotions.js +57 -1
- package/lib/cjs/resources/fixed_price_promotions.d.ts +102 -1
- package/lib/cjs/resources/fixed_price_promotions.js +65 -1
- package/lib/cjs/resources/free_gift_promotions.d.ts +100 -1
- package/lib/cjs/resources/free_gift_promotions.js +65 -1
- package/lib/cjs/resources/free_shipping_promotions.d.ts +83 -1
- package/lib/cjs/resources/free_shipping_promotions.js +53 -1
- package/lib/cjs/resources/geocoders.d.ts +24 -1
- package/lib/cjs/resources/geocoders.js +32 -1
- package/lib/cjs/resources/gift_card_recipients.d.ts +44 -1
- package/lib/cjs/resources/gift_card_recipients.js +41 -1
- package/lib/cjs/resources/gift_cards.d.ts +85 -1
- package/lib/cjs/resources/gift_cards.js +49 -1
- package/lib/cjs/resources/google_geocoders.d.ts +35 -1
- package/lib/cjs/resources/google_geocoders.js +41 -1
- package/lib/cjs/resources/imports.d.ts +45 -1
- package/lib/cjs/resources/imports.js +34 -1
- package/lib/cjs/resources/in_stock_subscriptions.d.ts +62 -1
- package/lib/cjs/resources/in_stock_subscriptions.js +49 -1
- package/lib/cjs/resources/inventory_models.d.ts +42 -1
- package/lib/cjs/resources/inventory_models.js +45 -1
- package/lib/cjs/resources/inventory_return_locations.d.ts +43 -1
- package/lib/cjs/resources/inventory_return_locations.js +41 -1
- package/lib/cjs/resources/inventory_stock_locations.d.ts +46 -1
- package/lib/cjs/resources/inventory_stock_locations.js +41 -1
- package/lib/cjs/resources/klarna_gateways.d.ts +44 -1
- package/lib/cjs/resources/klarna_gateways.js +41 -1
- package/lib/cjs/resources/klarna_payments.d.ts +45 -1
- package/lib/cjs/resources/klarna_payments.js +41 -1
- package/lib/cjs/resources/line_item_options.d.ts +57 -1
- package/lib/cjs/resources/line_item_options.js +41 -1
- package/lib/cjs/resources/line_items.d.ts +126 -1
- package/lib/cjs/resources/line_items.js +49 -1
- package/lib/cjs/resources/manual_gateways.d.ts +33 -1
- package/lib/cjs/resources/manual_gateways.js +37 -1
- package/lib/cjs/resources/manual_tax_calculators.d.ts +41 -1
- package/lib/cjs/resources/manual_tax_calculators.js +45 -1
- package/lib/cjs/resources/markets.d.ts +88 -1
- package/lib/cjs/resources/markets.js +57 -1
- package/lib/cjs/resources/merchants.d.ts +38 -1
- package/lib/cjs/resources/merchants.js +41 -1
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +56 -1
- package/lib/cjs/resources/order_amount_promotion_rules.js +33 -1
- package/lib/cjs/resources/order_copies.d.ts +48 -1
- package/lib/cjs/resources/order_copies.js +46 -1
- package/lib/cjs/resources/order_subscriptions.d.ts +70 -1
- package/lib/cjs/resources/order_subscriptions.js +57 -1
- package/lib/cjs/resources/order_validation_rules.d.ts +23 -1
- package/lib/cjs/resources/order_validation_rules.js +32 -1
- package/lib/cjs/resources/orders.d.ts +288 -1
- package/lib/cjs/resources/orders.js +113 -1
- package/lib/cjs/resources/organization.d.ts +32 -1
- package/lib/cjs/resources/organization.js +21 -1
- package/lib/cjs/resources/packages.d.ts +56 -1
- package/lib/cjs/resources/packages.js +45 -1
- package/lib/cjs/resources/parcel_line_items.d.ts +51 -1
- package/lib/cjs/resources/parcel_line_items.js +41 -1
- package/lib/cjs/resources/parcels.d.ts +119 -1
- package/lib/cjs/resources/parcels.js +53 -1
- package/lib/cjs/resources/payment_gateways.d.ts +21 -1
- package/lib/cjs/resources/payment_gateways.js +28 -1
- package/lib/cjs/resources/payment_methods.d.ts +61 -1
- package/lib/cjs/resources/payment_methods.js +45 -1
- package/lib/cjs/resources/paypal_gateways.d.ts +37 -1
- package/lib/cjs/resources/paypal_gateways.js +41 -1
- package/lib/cjs/resources/paypal_payments.d.ts +51 -1
- package/lib/cjs/resources/paypal_payments.js +41 -1
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +100 -1
- package/lib/cjs/resources/percentage_discount_promotions.js +65 -1
- package/lib/cjs/resources/price_lists.d.ts +39 -1
- package/lib/cjs/resources/price_lists.js +41 -1
- package/lib/cjs/resources/price_tiers.d.ts +28 -1
- package/lib/cjs/resources/price_tiers.js +32 -1
- package/lib/cjs/resources/price_volume_tiers.d.ts +46 -1
- package/lib/cjs/resources/price_volume_tiers.js +41 -1
- package/lib/cjs/resources/prices.d.ts +68 -1
- package/lib/cjs/resources/prices.js +53 -1
- package/lib/cjs/resources/promotion_rules.d.ts +24 -1
- package/lib/cjs/resources/promotion_rules.js +24 -1
- package/lib/cjs/resources/promotions.d.ts +41 -1
- package/lib/cjs/resources/promotions.js +44 -1
- package/lib/cjs/resources/refunds.d.ts +37 -1
- package/lib/cjs/resources/refunds.js +36 -1
- package/lib/cjs/resources/return_line_items.d.ts +49 -1
- package/lib/cjs/resources/return_line_items.js +41 -1
- package/lib/cjs/resources/returns.d.ts +75 -1
- package/lib/cjs/resources/returns.js +65 -1
- package/lib/cjs/resources/shipments.d.ts +93 -1
- package/lib/cjs/resources/shipments.js +83 -1
- package/lib/cjs/resources/shipping_categories.d.ts +33 -1
- package/lib/cjs/resources/shipping_categories.js +41 -1
- package/lib/cjs/resources/shipping_method_tiers.d.ts +28 -1
- package/lib/cjs/resources/shipping_method_tiers.js +32 -1
- package/lib/cjs/resources/shipping_methods.d.ts +107 -1
- package/lib/cjs/resources/shipping_methods.js +65 -1
- package/lib/cjs/resources/shipping_weight_tiers.d.ts +46 -1
- package/lib/cjs/resources/shipping_weight_tiers.js +41 -1
- package/lib/cjs/resources/shipping_zones.d.ts +48 -1
- package/lib/cjs/resources/shipping_zones.js +37 -1
- package/lib/cjs/resources/sku_list_items.d.ts +47 -1
- package/lib/cjs/resources/sku_list_items.js +41 -1
- package/lib/cjs/resources/sku_list_promotion_rules.d.ts +68 -1
- package/lib/cjs/resources/sku_list_promotion_rules.js +41 -1
- package/lib/cjs/resources/sku_lists.d.ts +60 -1
- package/lib/cjs/resources/sku_lists.js +53 -1
- package/lib/cjs/resources/sku_options.d.ts +56 -1
- package/lib/cjs/resources/sku_options.js +41 -1
- package/lib/cjs/resources/skus.d.ts +78 -1
- package/lib/cjs/resources/skus.js +57 -1
- package/lib/cjs/resources/stock_items.d.ts +49 -1
- package/lib/cjs/resources/stock_items.js +45 -1
- package/lib/cjs/resources/stock_line_items.d.ts +29 -1
- package/lib/cjs/resources/stock_line_items.js +36 -1
- package/lib/cjs/resources/stock_locations.d.ts +57 -1
- package/lib/cjs/resources/stock_locations.js +57 -1
- package/lib/cjs/resources/stock_transfers.d.ts +74 -1
- package/lib/cjs/resources/stock_transfers.js +57 -1
- package/lib/cjs/resources/stripe_gateways.d.ts +41 -1
- package/lib/cjs/resources/stripe_gateways.js +41 -1
- package/lib/cjs/resources/stripe_payments.d.ts +46 -1
- package/lib/cjs/resources/stripe_payments.js +41 -1
- package/lib/cjs/resources/tax_calculators.d.ts +24 -1
- package/lib/cjs/resources/tax_calculators.js +32 -1
- package/lib/cjs/resources/tax_categories.d.ts +59 -1
- package/lib/cjs/resources/tax_categories.js +41 -1
- package/lib/cjs/resources/tax_rules.d.ts +69 -1
- package/lib/cjs/resources/tax_rules.js +37 -1
- package/lib/cjs/resources/taxjar_accounts.d.ts +43 -1
- package/lib/cjs/resources/taxjar_accounts.js +45 -1
- package/lib/cjs/resources/transactions.d.ts +31 -1
- package/lib/cjs/resources/transactions.js +28 -1
- package/lib/cjs/resources/voids.d.ts +37 -1
- package/lib/cjs/resources/voids.js +36 -1
- package/lib/cjs/resources/webhooks.d.ts +43 -1
- package/lib/cjs/resources/webhooks.js +37 -1
- package/lib/cjs/resources/wire_transfers.d.ts +32 -1
- package/lib/cjs/resources/wire_transfers.js +37 -1
- package/lib/cjs/static.d.ts +8 -1
- package/lib/cjs/static.js +47 -1
- package/lib/cjs/util.d.ts +6 -1
- package/lib/cjs/util.js +15 -1
- package/lib/esm/api.d.ts +109 -1
- package/lib/esm/api.js +231 -1
- package/lib/esm/client.d.ts +31 -1
- package/lib/esm/client.js +118 -1
- package/lib/esm/commercelayer.d.ts +133 -1
- package/lib/esm/commercelayer.js +195 -1
- package/lib/esm/common.d.ts +4 -1
- package/lib/esm/common.js +10 -1
- package/lib/esm/config.d.ts +11 -1
- package/lib/esm/config.js +11 -1
- package/lib/esm/debug.d.ts +3 -1
- package/lib/esm/debug.js +40 -1
- package/lib/esm/error.d.ts +28 -1
- package/lib/esm/error.js +38 -1
- package/lib/esm/index.d.ts +7 -1
- package/lib/esm/index.js +6 -1
- package/lib/esm/interceptor.d.ts +21 -1
- package/lib/esm/interceptor.js +1 -1
- package/lib/esm/jsonapi.d.ts +5 -1
- package/lib/esm/jsonapi.js +75 -1
- package/lib/esm/model.d.ts +107 -1
- package/lib/esm/model.js +2 -1
- package/lib/esm/query.d.ts +23 -1
- package/lib/esm/query.js +45 -1
- package/lib/esm/resource.d.ts +77 -1
- package/lib/esm/resource.js +139 -1
- package/lib/esm/resources/addresses.d.ts +88 -1
- package/lib/esm/resources/addresses.js +35 -1
- package/lib/esm/resources/adjustments.d.ts +35 -1
- package/lib/esm/resources/adjustments.js +31 -1
- package/lib/esm/resources/adyen_gateways.d.ts +56 -1
- package/lib/esm/resources/adyen_gateways.js +39 -1
- package/lib/esm/resources/adyen_payments.d.ts +45 -1
- package/lib/esm/resources/adyen_payments.js +39 -1
- package/lib/esm/resources/application.d.ts +21 -1
- package/lib/esm/resources/application.js +19 -1
- package/lib/esm/resources/attachments.d.ts +156 -1
- package/lib/esm/resources/attachments.js +31 -1
- package/lib/esm/resources/authorizations.d.ts +60 -1
- package/lib/esm/resources/authorizations.js +41 -1
- package/lib/esm/resources/avalara_accounts.d.ts +55 -1
- package/lib/esm/resources/avalara_accounts.js +43 -1
- package/lib/esm/resources/billing_info_validation_rules.d.ts +35 -1
- package/lib/esm/resources/billing_info_validation_rules.js +39 -1
- package/lib/esm/resources/bing_geocoders.d.ts +35 -1
- package/lib/esm/resources/bing_geocoders.js +39 -1
- package/lib/esm/resources/braintree_gateways.d.ts +56 -1
- package/lib/esm/resources/braintree_gateways.js +39 -1
- package/lib/esm/resources/braintree_payments.d.ts +47 -1
- package/lib/esm/resources/braintree_payments.js +39 -1
- package/lib/esm/resources/bundles.d.ts +76 -1
- package/lib/esm/resources/bundles.js +47 -1
- package/lib/esm/resources/captures.d.ts +51 -1
- package/lib/esm/resources/captures.js +41 -1
- package/lib/esm/resources/carrier_accounts.d.ts +26 -1
- package/lib/esm/resources/carrier_accounts.js +30 -1
- package/lib/esm/resources/checkout_com_gateways.d.ts +45 -1
- package/lib/esm/resources/checkout_com_gateways.js +39 -1
- package/lib/esm/resources/checkout_com_payments.d.ts +58 -1
- package/lib/esm/resources/checkout_com_payments.js +39 -1
- package/lib/esm/resources/cleanups.d.ts +36 -1
- package/lib/esm/resources/cleanups.js +32 -1
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +59 -1
- package/lib/esm/resources/coupon_codes_promotion_rules.js +35 -1
- package/lib/esm/resources/coupon_recipients.d.ts +44 -1
- package/lib/esm/resources/coupon_recipients.js +39 -1
- package/lib/esm/resources/coupons.d.ts +45 -1
- package/lib/esm/resources/coupons.js +35 -1
- package/lib/esm/resources/customer_addresses.d.ts +44 -1
- package/lib/esm/resources/customer_addresses.js +43 -1
- package/lib/esm/resources/customer_groups.d.ts +36 -1
- package/lib/esm/resources/customer_groups.js +43 -1
- package/lib/esm/resources/customer_password_resets.d.ts +36 -1
- package/lib/esm/resources/customer_password_resets.js +39 -1
- package/lib/esm/resources/customer_payment_sources.d.ts +70 -1
- package/lib/esm/resources/customer_payment_sources.js +35 -1
- package/lib/esm/resources/customer_subscriptions.d.ts +31 -1
- package/lib/esm/resources/customer_subscriptions.js +39 -1
- package/lib/esm/resources/customers.d.ts +66 -1
- package/lib/esm/resources/customers.js +71 -1
- package/lib/esm/resources/delivery_lead_times.d.ts +51 -1
- package/lib/esm/resources/delivery_lead_times.js +43 -1
- package/lib/esm/resources/event_callbacks.d.ts +24 -1
- package/lib/esm/resources/event_callbacks.js +26 -1
- package/lib/esm/resources/events.d.ts +24 -1
- package/lib/esm/resources/events.js +30 -1
- package/lib/esm/resources/exports.d.ts +40 -1
- package/lib/esm/resources/exports.js +32 -1
- package/lib/esm/resources/external_gateways.d.ts +49 -1
- package/lib/esm/resources/external_gateways.js +39 -1
- package/lib/esm/resources/external_payments.d.ts +43 -1
- package/lib/esm/resources/external_payments.js +43 -1
- package/lib/esm/resources/external_promotions.d.ts +90 -1
- package/lib/esm/resources/external_promotions.js +55 -1
- package/lib/esm/resources/external_tax_calculators.d.ts +37 -1
- package/lib/esm/resources/external_tax_calculators.js +39 -1
- package/lib/esm/resources/fixed_amount_promotions.d.ts +91 -1
- package/lib/esm/resources/fixed_amount_promotions.js +55 -1
- package/lib/esm/resources/fixed_price_promotions.d.ts +102 -1
- package/lib/esm/resources/fixed_price_promotions.js +63 -1
- package/lib/esm/resources/free_gift_promotions.d.ts +100 -1
- package/lib/esm/resources/free_gift_promotions.js +63 -1
- package/lib/esm/resources/free_shipping_promotions.d.ts +83 -1
- package/lib/esm/resources/free_shipping_promotions.js +51 -1
- package/lib/esm/resources/geocoders.d.ts +24 -1
- package/lib/esm/resources/geocoders.js +30 -1
- package/lib/esm/resources/gift_card_recipients.d.ts +44 -1
- package/lib/esm/resources/gift_card_recipients.js +39 -1
- package/lib/esm/resources/gift_cards.d.ts +85 -1
- package/lib/esm/resources/gift_cards.js +47 -1
- package/lib/esm/resources/google_geocoders.d.ts +35 -1
- package/lib/esm/resources/google_geocoders.js +39 -1
- package/lib/esm/resources/imports.d.ts +45 -1
- package/lib/esm/resources/imports.js +32 -1
- package/lib/esm/resources/in_stock_subscriptions.d.ts +62 -1
- package/lib/esm/resources/in_stock_subscriptions.js +47 -1
- package/lib/esm/resources/inventory_models.d.ts +42 -1
- package/lib/esm/resources/inventory_models.js +43 -1
- package/lib/esm/resources/inventory_return_locations.d.ts +43 -1
- package/lib/esm/resources/inventory_return_locations.js +39 -1
- package/lib/esm/resources/inventory_stock_locations.d.ts +46 -1
- package/lib/esm/resources/inventory_stock_locations.js +39 -1
- package/lib/esm/resources/klarna_gateways.d.ts +44 -1
- package/lib/esm/resources/klarna_gateways.js +39 -1
- package/lib/esm/resources/klarna_payments.d.ts +45 -1
- package/lib/esm/resources/klarna_payments.js +39 -1
- package/lib/esm/resources/line_item_options.d.ts +57 -1
- package/lib/esm/resources/line_item_options.js +39 -1
- package/lib/esm/resources/line_items.d.ts +126 -1
- package/lib/esm/resources/line_items.js +47 -1
- package/lib/esm/resources/manual_gateways.d.ts +33 -1
- package/lib/esm/resources/manual_gateways.js +35 -1
- package/lib/esm/resources/manual_tax_calculators.d.ts +41 -1
- package/lib/esm/resources/manual_tax_calculators.js +43 -1
- package/lib/esm/resources/markets.d.ts +88 -1
- package/lib/esm/resources/markets.js +55 -1
- package/lib/esm/resources/merchants.d.ts +38 -1
- package/lib/esm/resources/merchants.js +39 -1
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +56 -1
- package/lib/esm/resources/order_amount_promotion_rules.js +31 -1
- package/lib/esm/resources/order_copies.d.ts +48 -1
- package/lib/esm/resources/order_copies.js +44 -1
- package/lib/esm/resources/order_subscriptions.d.ts +70 -1
- package/lib/esm/resources/order_subscriptions.js +55 -1
- package/lib/esm/resources/order_validation_rules.d.ts +23 -1
- package/lib/esm/resources/order_validation_rules.js +30 -1
- package/lib/esm/resources/orders.d.ts +288 -1
- package/lib/esm/resources/orders.js +111 -1
- package/lib/esm/resources/organization.d.ts +32 -1
- package/lib/esm/resources/organization.js +19 -1
- package/lib/esm/resources/packages.d.ts +56 -1
- package/lib/esm/resources/packages.js +43 -1
- package/lib/esm/resources/parcel_line_items.d.ts +51 -1
- package/lib/esm/resources/parcel_line_items.js +39 -1
- package/lib/esm/resources/parcels.d.ts +119 -1
- package/lib/esm/resources/parcels.js +51 -1
- package/lib/esm/resources/payment_gateways.d.ts +21 -1
- package/lib/esm/resources/payment_gateways.js +26 -1
- package/lib/esm/resources/payment_methods.d.ts +61 -1
- package/lib/esm/resources/payment_methods.js +43 -1
- package/lib/esm/resources/paypal_gateways.d.ts +37 -1
- package/lib/esm/resources/paypal_gateways.js +39 -1
- package/lib/esm/resources/paypal_payments.d.ts +51 -1
- package/lib/esm/resources/paypal_payments.js +39 -1
- package/lib/esm/resources/percentage_discount_promotions.d.ts +100 -1
- package/lib/esm/resources/percentage_discount_promotions.js +63 -1
- package/lib/esm/resources/price_lists.d.ts +39 -1
- package/lib/esm/resources/price_lists.js +39 -1
- package/lib/esm/resources/price_tiers.d.ts +28 -1
- package/lib/esm/resources/price_tiers.js +30 -1
- package/lib/esm/resources/price_volume_tiers.d.ts +46 -1
- package/lib/esm/resources/price_volume_tiers.js +39 -1
- package/lib/esm/resources/prices.d.ts +68 -1
- package/lib/esm/resources/prices.js +51 -1
- package/lib/esm/resources/promotion_rules.d.ts +24 -1
- package/lib/esm/resources/promotion_rules.js +22 -1
- package/lib/esm/resources/promotions.d.ts +41 -1
- package/lib/esm/resources/promotions.js +42 -1
- package/lib/esm/resources/refunds.d.ts +37 -1
- package/lib/esm/resources/refunds.js +34 -1
- package/lib/esm/resources/return_line_items.d.ts +49 -1
- package/lib/esm/resources/return_line_items.js +39 -1
- package/lib/esm/resources/returns.d.ts +75 -1
- package/lib/esm/resources/returns.js +63 -1
- package/lib/esm/resources/shipments.d.ts +93 -1
- package/lib/esm/resources/shipments.js +81 -1
- package/lib/esm/resources/shipping_categories.d.ts +33 -1
- package/lib/esm/resources/shipping_categories.js +39 -1
- package/lib/esm/resources/shipping_method_tiers.d.ts +28 -1
- package/lib/esm/resources/shipping_method_tiers.js +30 -1
- package/lib/esm/resources/shipping_methods.d.ts +107 -1
- package/lib/esm/resources/shipping_methods.js +63 -1
- package/lib/esm/resources/shipping_weight_tiers.d.ts +46 -1
- package/lib/esm/resources/shipping_weight_tiers.js +39 -1
- package/lib/esm/resources/shipping_zones.d.ts +48 -1
- package/lib/esm/resources/shipping_zones.js +35 -1
- package/lib/esm/resources/sku_list_items.d.ts +47 -1
- package/lib/esm/resources/sku_list_items.js +39 -1
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +68 -1
- package/lib/esm/resources/sku_list_promotion_rules.js +39 -1
- package/lib/esm/resources/sku_lists.d.ts +60 -1
- package/lib/esm/resources/sku_lists.js +51 -1
- package/lib/esm/resources/sku_options.d.ts +56 -1
- package/lib/esm/resources/sku_options.js +39 -1
- package/lib/esm/resources/skus.d.ts +78 -1
- package/lib/esm/resources/skus.js +55 -1
- package/lib/esm/resources/stock_items.d.ts +49 -1
- package/lib/esm/resources/stock_items.js +43 -1
- package/lib/esm/resources/stock_line_items.d.ts +29 -1
- package/lib/esm/resources/stock_line_items.js +34 -1
- package/lib/esm/resources/stock_locations.d.ts +57 -1
- package/lib/esm/resources/stock_locations.js +55 -1
- package/lib/esm/resources/stock_transfers.d.ts +74 -1
- package/lib/esm/resources/stock_transfers.js +55 -1
- package/lib/esm/resources/stripe_gateways.d.ts +41 -1
- package/lib/esm/resources/stripe_gateways.js +39 -1
- package/lib/esm/resources/stripe_payments.d.ts +46 -1
- package/lib/esm/resources/stripe_payments.js +39 -1
- package/lib/esm/resources/tax_calculators.d.ts +24 -1
- package/lib/esm/resources/tax_calculators.js +30 -1
- package/lib/esm/resources/tax_categories.d.ts +59 -1
- package/lib/esm/resources/tax_categories.js +39 -1
- package/lib/esm/resources/tax_rules.d.ts +69 -1
- package/lib/esm/resources/tax_rules.js +35 -1
- package/lib/esm/resources/taxjar_accounts.d.ts +43 -1
- package/lib/esm/resources/taxjar_accounts.js +43 -1
- package/lib/esm/resources/transactions.d.ts +31 -1
- package/lib/esm/resources/transactions.js +26 -1
- package/lib/esm/resources/voids.d.ts +37 -1
- package/lib/esm/resources/voids.js +34 -1
- package/lib/esm/resources/webhooks.d.ts +43 -1
- package/lib/esm/resources/webhooks.js +35 -1
- package/lib/esm/resources/wire_transfers.d.ts +32 -1
- package/lib/esm/resources/wire_transfers.js +35 -1
- package/lib/esm/static.d.ts +8 -1
- package/lib/esm/static.js +18 -1
- package/lib/esm/util.d.ts +6 -1
- package/lib/esm/util.js +11 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -15
package/lib/cjs/debug.js
CHANGED
@@ -1 +1,42 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
4
|
+
// import Debug from 'debug'
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
/* Nope debugger */
|
7
|
+
const debuggerFunction = (_pattern, ..._args) => {
|
8
|
+
// console.log(_pattern)
|
9
|
+
};
|
10
|
+
let debuggerFactory = (_namespace) => debuggerFunction;
|
11
|
+
/* Try loading 'debug' module */
|
12
|
+
try {
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
14
|
+
const debugModule = require('debug');
|
15
|
+
if (debugModule && (typeof debugModule === 'function'))
|
16
|
+
debuggerFactory = debugModule;
|
17
|
+
}
|
18
|
+
catch (error) {
|
19
|
+
//
|
20
|
+
}
|
21
|
+
const debugPrefix = 'clsdk';
|
22
|
+
/* Retrieve the name of the caller 'module' */
|
23
|
+
/*
|
24
|
+
const caller = (): string => {
|
25
|
+
|
26
|
+
const err = new Error()
|
27
|
+
|
28
|
+
Error.prepareStackTrace = (_, stack) => stack
|
29
|
+
const stack = err.stack as unknown as NodeJS.CallSite[]
|
30
|
+
Error.prepareStackTrace = undefined
|
31
|
+
|
32
|
+
const fileName = stack[2].getFileName() || '/'
|
33
|
+
|
34
|
+
return fileName.replace(/^.*[\\/]/, '').replace('.ts', '')
|
35
|
+
|
36
|
+
}
|
37
|
+
*/
|
38
|
+
/* Return a debugger for the defined namespace */
|
39
|
+
const debug = (namespace) => {
|
40
|
+
return debuggerFactory(`${debugPrefix}:${namespace}`);
|
41
|
+
};
|
42
|
+
exports.default = debug;
|
package/lib/cjs/error.d.ts
CHANGED
@@ -1 +1,28 @@
|
|
1
|
-
declare enum ErrorType
|
1
|
+
declare enum ErrorType {
|
2
|
+
CLIENT = "client",
|
3
|
+
REQUEST = "request",
|
4
|
+
RESPONSE = "response",
|
5
|
+
GENERIC = "generic",
|
6
|
+
CANCEL = "cancel"
|
7
|
+
}
|
8
|
+
declare class SdkError extends Error {
|
9
|
+
static NAME: string;
|
10
|
+
static isSdkError(error: any): error is ApiError;
|
11
|
+
type: string;
|
12
|
+
code?: string;
|
13
|
+
source?: Error;
|
14
|
+
request?: any;
|
15
|
+
constructor(error: {
|
16
|
+
message: string;
|
17
|
+
type?: ErrorType;
|
18
|
+
});
|
19
|
+
}
|
20
|
+
declare class ApiError extends SdkError {
|
21
|
+
static NAME: string;
|
22
|
+
static isApiError(error: any): error is ApiError;
|
23
|
+
errors: any[];
|
24
|
+
status?: number;
|
25
|
+
constructor(error: SdkError);
|
26
|
+
first(): any;
|
27
|
+
}
|
28
|
+
export { SdkError, ApiError, ErrorType };
|
package/lib/cjs/error.js
CHANGED
@@ -1 +1,43 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
|
5
|
+
var ErrorType;
|
6
|
+
(function (ErrorType) {
|
7
|
+
ErrorType["CLIENT"] = "client";
|
8
|
+
ErrorType["REQUEST"] = "request";
|
9
|
+
ErrorType["RESPONSE"] = "response";
|
10
|
+
ErrorType["GENERIC"] = "generic";
|
11
|
+
ErrorType["CANCEL"] = "cancel";
|
12
|
+
})(ErrorType || (ErrorType = {}));
|
13
|
+
exports.ErrorType = ErrorType;
|
14
|
+
class SdkError extends Error {
|
15
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
16
|
+
static isSdkError(error) {
|
17
|
+
return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
18
|
+
}
|
19
|
+
constructor(error) {
|
20
|
+
super(error.message);
|
21
|
+
this.name = SdkError.NAME; // this.constructor.name
|
22
|
+
this.type = error.type || ErrorType.GENERIC;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
exports.SdkError = SdkError;
|
26
|
+
SdkError.NAME = 'SdkError';
|
27
|
+
class ApiError extends SdkError {
|
28
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
29
|
+
static isApiError(error) {
|
30
|
+
return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
|
31
|
+
}
|
32
|
+
constructor(error) {
|
33
|
+
super(Object.assign(Object.assign({}, error), { type: ErrorType.RESPONSE }));
|
34
|
+
this.errors = [];
|
35
|
+
this.name = ApiError.NAME; // this.constructor.name
|
36
|
+
}
|
37
|
+
first() {
|
38
|
+
var _a;
|
39
|
+
return (((_a = this.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) ? this.errors[0] : undefined;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
exports.ApiError = ApiError;
|
43
|
+
ApiError.NAME = 'ApiError';
|
package/lib/cjs/index.d.ts
CHANGED
@@ -1 +1,7 @@
|
|
1
|
-
export{default,CommerceLayer
|
1
|
+
export { default, CommerceLayer } from './commercelayer';
|
2
|
+
export type { CommerceLayerClient } from './commercelayer';
|
3
|
+
export { CommerceLayerStatic } from './static';
|
4
|
+
export type { QueryParamsRetrieve, QueryParamsList, QueryParams } from './query';
|
5
|
+
export * from './model';
|
6
|
+
export type { RequestObj, ResponseObj, ErrorObj, HeadersObj } from './interceptor';
|
7
|
+
export type { SdkError, ApiError, ErrorType } from './error';
|
package/lib/cjs/index.js
CHANGED
@@ -1 +1,29 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
|
+
};
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
+
exports.CommerceLayerStatic = exports.CommerceLayer = exports.default = void 0;
|
21
|
+
// SDK
|
22
|
+
var commercelayer_1 = require("./commercelayer");
|
23
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(commercelayer_1).default; } });
|
24
|
+
Object.defineProperty(exports, "CommerceLayer", { enumerable: true, get: function () { return commercelayer_1.CommerceLayer; } });
|
25
|
+
// Commerce Layer static functions
|
26
|
+
var static_1 = require("./static");
|
27
|
+
Object.defineProperty(exports, "CommerceLayerStatic", { enumerable: true, get: function () { return static_1.CommerceLayerStatic; } });
|
28
|
+
// Resource model types
|
29
|
+
__exportStar(require("./model"), exports);
|
package/lib/cjs/interceptor.d.ts
CHANGED
@@ -1 +1,21 @@
|
|
1
|
-
import{AxiosError,AxiosInterceptorManager,AxiosRequestConfig,AxiosResponse,AxiosResponseHeaders,RawAxiosResponseHeaders
|
1
|
+
import { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders, RawAxiosResponseHeaders } from 'axios';
|
2
|
+
type InterceptorManager = {
|
3
|
+
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
4
|
+
response: AxiosInterceptorManager<any>;
|
5
|
+
};
|
6
|
+
type RequestObj = AxiosRequestConfig;
|
7
|
+
type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
|
8
|
+
type ResponseObj = AxiosResponse;
|
9
|
+
type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
|
10
|
+
type HeadersObj = AxiosResponseHeaders | RawAxiosResponseHeaders;
|
11
|
+
type ErrorObj = AxiosError;
|
12
|
+
type ErrorInterceptor = (error: ErrorObj) => ErrorObj;
|
13
|
+
type InterceptorType = 'request' | 'response';
|
14
|
+
export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType };
|
15
|
+
export type { RequestObj, ResponseObj, ErrorObj, HeadersObj };
|
16
|
+
type RawResponseReader = {
|
17
|
+
id: number | undefined;
|
18
|
+
rawResponse: ResponseObj | undefined;
|
19
|
+
headers: HeadersObj | undefined;
|
20
|
+
};
|
21
|
+
export type { RawResponseReader };
|
package/lib/cjs/interceptor.js
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/cjs/jsonapi.d.ts
CHANGED
@@ -1 +1,5 @@
|
|
1
|
-
import type{DocWithData,ResourceObject as JSONAPIObject}from'jsonapi-typescript';
|
1
|
+
import type { DocWithData, ResourceObject as JSONAPIObject } from 'jsonapi-typescript';
|
2
|
+
import type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource } from './resource';
|
3
|
+
declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
|
4
|
+
declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => JSONAPIObject;
|
5
|
+
export { denormalize, normalize };
|
package/lib/cjs/jsonapi.js
CHANGED
@@ -1 +1,82 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.normalize = exports.denormalize = void 0;
|
7
|
+
const common_1 = require("./common");
|
8
|
+
const debug_1 = __importDefault(require("./debug"));
|
9
|
+
const debug = (0, debug_1.default)('jsonapi');
|
10
|
+
// DENORMALIZATION
|
11
|
+
const denormalize = (response) => {
|
12
|
+
let denormalizedResponse;
|
13
|
+
if (response.links)
|
14
|
+
delete response.links;
|
15
|
+
const data = response.data;
|
16
|
+
const included = response.included;
|
17
|
+
if (!data)
|
18
|
+
denormalizedResponse = data;
|
19
|
+
else {
|
20
|
+
if (Array.isArray(data))
|
21
|
+
denormalizedResponse = data.map(res => denormalizeResource(res, included));
|
22
|
+
else
|
23
|
+
denormalizedResponse = denormalizeResource(data, included);
|
24
|
+
}
|
25
|
+
return denormalizedResponse;
|
26
|
+
};
|
27
|
+
exports.denormalize = denormalize;
|
28
|
+
const findIncluded = (rel, included = []) => {
|
29
|
+
const inc = included.find(inc => {
|
30
|
+
return (rel.id === inc.id) && (rel.type === inc.type);
|
31
|
+
});
|
32
|
+
return inc || rel;
|
33
|
+
};
|
34
|
+
const denormalizeResource = (res, included) => {
|
35
|
+
debug('denormalize resource: %O, %o', res, included || {});
|
36
|
+
if (!res)
|
37
|
+
return res;
|
38
|
+
const resource = Object.assign({ id: res.id, type: res.type }, res.attributes);
|
39
|
+
if (res.relationships)
|
40
|
+
Object.keys(res.relationships).forEach(key => {
|
41
|
+
const rel = res.relationships[key].data;
|
42
|
+
if (rel) {
|
43
|
+
if (Array.isArray(rel))
|
44
|
+
resource[key] = rel.map(r => denormalizeResource(findIncluded(r, included), included));
|
45
|
+
else
|
46
|
+
resource[key] = denormalizeResource(findIncluded(rel, included), included);
|
47
|
+
}
|
48
|
+
else if (rel === null)
|
49
|
+
resource[key] = null;
|
50
|
+
});
|
51
|
+
debug('denormalized resource: %O', resource);
|
52
|
+
return resource;
|
53
|
+
};
|
54
|
+
// NORMALIZATION
|
55
|
+
const normalize = (resource) => {
|
56
|
+
debug('normalize resource: %O', resource);
|
57
|
+
const attributes = {};
|
58
|
+
const relationships = {};
|
59
|
+
for (const field in resource) {
|
60
|
+
if (['type', 'id'].includes(field))
|
61
|
+
continue;
|
62
|
+
const value = resource[field];
|
63
|
+
if (value && (0, common_1.isResourceType)(value) && value.id === null) {
|
64
|
+
relationships[field] = { data: null };
|
65
|
+
}
|
66
|
+
else if (value && ((0, common_1.isResourceId)(value) || (Array.isArray(value) && (0, common_1.isResourceId)(value[0])))) {
|
67
|
+
relationships[field] = { data: value };
|
68
|
+
}
|
69
|
+
else
|
70
|
+
attributes[field] = value;
|
71
|
+
}
|
72
|
+
const normalized = {
|
73
|
+
type: resource.type,
|
74
|
+
attributes,
|
75
|
+
relationships
|
76
|
+
};
|
77
|
+
if ((0, common_1.isResourceId)(resource))
|
78
|
+
normalized.id = resource.id;
|
79
|
+
debug('normalized resource: %O', normalized);
|
80
|
+
return normalized;
|
81
|
+
};
|
82
|
+
exports.normalize = normalize;
|
package/lib/cjs/model.d.ts
CHANGED
@@ -1 +1,107 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* ©2023 Commerce Layer Inc.
|
3
|
+
**/
|
4
|
+
export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
|
5
|
+
export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
|
6
|
+
export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate } from './resources/adyen_gateways';
|
7
|
+
export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate } from './resources/adyen_payments';
|
8
|
+
export type { Application } from './resources/application';
|
9
|
+
export type { Attachment, AttachmentCreate, AttachmentUpdate } from './resources/attachments';
|
10
|
+
export type { Authorization, AuthorizationUpdate } from './resources/authorizations';
|
11
|
+
export type { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate } from './resources/avalara_accounts';
|
12
|
+
export type { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate } from './resources/billing_info_validation_rules';
|
13
|
+
export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './resources/bing_geocoders';
|
14
|
+
export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways';
|
15
|
+
export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments';
|
16
|
+
export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles';
|
17
|
+
export type { Capture, CaptureUpdate } from './resources/captures';
|
18
|
+
export type { CarrierAccount } from './resources/carrier_accounts';
|
19
|
+
export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways';
|
20
|
+
export type { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate } from './resources/checkout_com_payments';
|
21
|
+
export type { Cleanup, CleanupCreate } from './resources/cleanups';
|
22
|
+
export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules';
|
23
|
+
export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients';
|
24
|
+
export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons';
|
25
|
+
export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses';
|
26
|
+
export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups';
|
27
|
+
export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets';
|
28
|
+
export type { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate } from './resources/customer_payment_sources';
|
29
|
+
export type { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate } from './resources/customer_subscriptions';
|
30
|
+
export type { Customer, CustomerCreate, CustomerUpdate } from './resources/customers';
|
31
|
+
export type { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate } from './resources/delivery_lead_times';
|
32
|
+
export type { EventCallback } from './resources/event_callbacks';
|
33
|
+
export type { Event } from './resources/events';
|
34
|
+
export type { Export, ExportCreate } from './resources/exports';
|
35
|
+
export type { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate } from './resources/external_gateways';
|
36
|
+
export type { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate } from './resources/external_payments';
|
37
|
+
export type { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate } from './resources/external_promotions';
|
38
|
+
export type { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate } from './resources/external_tax_calculators';
|
39
|
+
export type { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate } from './resources/fixed_amount_promotions';
|
40
|
+
export type { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate } from './resources/fixed_price_promotions';
|
41
|
+
export type { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate } from './resources/free_gift_promotions';
|
42
|
+
export type { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate } from './resources/free_shipping_promotions';
|
43
|
+
export type { Geocoder } from './resources/geocoders';
|
44
|
+
export type { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate } from './resources/gift_card_recipients';
|
45
|
+
export type { GiftCard, GiftCardCreate, GiftCardUpdate } from './resources/gift_cards';
|
46
|
+
export type { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate } from './resources/google_geocoders';
|
47
|
+
export type { Import, ImportCreate } from './resources/imports';
|
48
|
+
export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate } from './resources/in_stock_subscriptions';
|
49
|
+
export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models';
|
50
|
+
export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations';
|
51
|
+
export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations';
|
52
|
+
export type { KlarnaGateway, KlarnaGatewayCreate, KlarnaGatewayUpdate } from './resources/klarna_gateways';
|
53
|
+
export type { KlarnaPayment, KlarnaPaymentCreate, KlarnaPaymentUpdate } from './resources/klarna_payments';
|
54
|
+
export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options';
|
55
|
+
export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items';
|
56
|
+
export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways';
|
57
|
+
export type { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate } from './resources/manual_tax_calculators';
|
58
|
+
export type { Market, MarketCreate, MarketUpdate } from './resources/markets';
|
59
|
+
export type { Merchant, MerchantCreate, MerchantUpdate } from './resources/merchants';
|
60
|
+
export type { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate } from './resources/order_amount_promotion_rules';
|
61
|
+
export type { OrderCopy, OrderCopyCreate } from './resources/order_copies';
|
62
|
+
export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions';
|
63
|
+
export type { OrderValidationRule } from './resources/order_validation_rules';
|
64
|
+
export type { Order, OrderCreate, OrderUpdate } from './resources/orders';
|
65
|
+
export type { Organization } from './resources/organization';
|
66
|
+
export type { Package, PackageCreate, PackageUpdate } from './resources/packages';
|
67
|
+
export type { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate } from './resources/parcel_line_items';
|
68
|
+
export type { Parcel, ParcelCreate, ParcelUpdate } from './resources/parcels';
|
69
|
+
export type { PaymentGateway } from './resources/payment_gateways';
|
70
|
+
export type { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate } from './resources/payment_methods';
|
71
|
+
export type { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate } from './resources/paypal_gateways';
|
72
|
+
export type { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate } from './resources/paypal_payments';
|
73
|
+
export type { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate } from './resources/percentage_discount_promotions';
|
74
|
+
export type { PriceList, PriceListCreate, PriceListUpdate } from './resources/price_lists';
|
75
|
+
export type { PriceTier } from './resources/price_tiers';
|
76
|
+
export type { PriceVolumeTier, PriceVolumeTierCreate, PriceVolumeTierUpdate } from './resources/price_volume_tiers';
|
77
|
+
export type { Price, PriceCreate, PriceUpdate } from './resources/prices';
|
78
|
+
export type { PromotionRule } from './resources/promotion_rules';
|
79
|
+
export type { Promotion } from './resources/promotions';
|
80
|
+
export type { Refund } from './resources/refunds';
|
81
|
+
export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items';
|
82
|
+
export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns';
|
83
|
+
export type { Shipment, ShipmentUpdate } from './resources/shipments';
|
84
|
+
export type { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate } from './resources/shipping_categories';
|
85
|
+
export type { ShippingMethodTier } from './resources/shipping_method_tiers';
|
86
|
+
export type { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate } from './resources/shipping_methods';
|
87
|
+
export type { ShippingWeightTier, ShippingWeightTierCreate, ShippingWeightTierUpdate } from './resources/shipping_weight_tiers';
|
88
|
+
export type { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate } from './resources/shipping_zones';
|
89
|
+
export type { SkuListItem, SkuListItemCreate, SkuListItemUpdate } from './resources/sku_list_items';
|
90
|
+
export type { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate } from './resources/sku_list_promotion_rules';
|
91
|
+
export type { SkuList, SkuListCreate, SkuListUpdate } from './resources/sku_lists';
|
92
|
+
export type { SkuOption, SkuOptionCreate, SkuOptionUpdate } from './resources/sku_options';
|
93
|
+
export type { Sku, SkuCreate, SkuUpdate } from './resources/skus';
|
94
|
+
export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items';
|
95
|
+
export type { StockLineItem } from './resources/stock_line_items';
|
96
|
+
export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations';
|
97
|
+
export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers';
|
98
|
+
export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways';
|
99
|
+
export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments';
|
100
|
+
export type { TaxCalculator } from './resources/tax_calculators';
|
101
|
+
export type { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate } from './resources/tax_categories';
|
102
|
+
export type { TaxRule, TaxRuleCreate, TaxRuleUpdate } from './resources/tax_rules';
|
103
|
+
export type { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate } from './resources/taxjar_accounts';
|
104
|
+
export type { Transaction } from './resources/transactions';
|
105
|
+
export type { Void } from './resources/voids';
|
106
|
+
export type { Webhook, WebhookCreate, WebhookUpdate } from './resources/webhooks';
|
107
|
+
export type { WireTransfer, WireTransferCreate, WireTransferUpdate } from './resources/wire_transfers';
|
package/lib/cjs/model.js
CHANGED
package/lib/cjs/query.d.ts
CHANGED
@@ -1 +1,23 @@
|
|
1
|
-
import{ResourceType}from"./resource";
|
1
|
+
import { ResourceType } from "./resource";
|
2
|
+
interface QueryParamsRetrieve {
|
3
|
+
include?: string[];
|
4
|
+
fields?: string[] | {
|
5
|
+
[key: string]: string[];
|
6
|
+
};
|
7
|
+
}
|
8
|
+
interface QueryParamsList extends QueryParamsRetrieve {
|
9
|
+
sort?: string[] | {
|
10
|
+
[key: string]: 'asc' | 'desc';
|
11
|
+
};
|
12
|
+
filters?: {
|
13
|
+
[key: string]: string | number | boolean;
|
14
|
+
};
|
15
|
+
pageNumber?: number;
|
16
|
+
pageSize?: number;
|
17
|
+
}
|
18
|
+
type QueryParams = QueryParamsRetrieve | QueryParamsList;
|
19
|
+
export { QueryParamsRetrieve, QueryParamsList, QueryParams };
|
20
|
+
declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined, res: string | ResourceType) => {
|
21
|
+
[key: string]: string;
|
22
|
+
};
|
23
|
+
export { generateQueryStringParams };
|
package/lib/cjs/query.js
CHANGED
@@ -1 +1,51 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.generateQueryStringParams = void 0;
|
7
|
+
const debug_1 = __importDefault(require("./debug"));
|
8
|
+
const debug = (0, debug_1.default)('query');
|
9
|
+
const isParamsList = (params) => {
|
10
|
+
return (params.filters || params.pageNumber || params.pageSize || params.sort);
|
11
|
+
};
|
12
|
+
const generateQueryStringParams = (params, res) => {
|
13
|
+
debug('generate query string params: %O, %O', params, res);
|
14
|
+
const qp = {};
|
15
|
+
if (!params)
|
16
|
+
return qp;
|
17
|
+
// Include
|
18
|
+
if (params.include)
|
19
|
+
qp.include = params.include.join(',');
|
20
|
+
// Fields
|
21
|
+
if (params.fields) {
|
22
|
+
if (Array.isArray(params.fields))
|
23
|
+
params.fields = { [res.type || res]: params.fields };
|
24
|
+
Object.entries(params.fields).forEach(([p, v]) => {
|
25
|
+
qp[`fields[${p}]`] = v.join(',');
|
26
|
+
});
|
27
|
+
}
|
28
|
+
if (isParamsList(params)) {
|
29
|
+
// Sort
|
30
|
+
if (params.sort) {
|
31
|
+
if (Array.isArray(params.sort))
|
32
|
+
qp.sort = params.sort.join(',');
|
33
|
+
else
|
34
|
+
qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',');
|
35
|
+
}
|
36
|
+
// Page
|
37
|
+
if (params.pageNumber)
|
38
|
+
qp['page[number]'] = String(params.pageNumber);
|
39
|
+
if (params.pageSize)
|
40
|
+
qp['page[size]'] = String(params.pageSize);
|
41
|
+
// Filters
|
42
|
+
if (params.filters) {
|
43
|
+
Object.entries(params.filters).forEach(([p, v]) => {
|
44
|
+
qp[`filter[q][${p}]`] = String(v);
|
45
|
+
});
|
46
|
+
}
|
47
|
+
}
|
48
|
+
debug('query string params: %O', qp);
|
49
|
+
return qp;
|
50
|
+
};
|
51
|
+
exports.generateQueryStringParams = generateQueryStringParams;
|
package/lib/cjs/resource.d.ts
CHANGED
@@ -1 +1,77 @@
|
|
1
|
-
import{ApiClientInitConfig}from'./client';
|
1
|
+
import { ApiClientInitConfig } from './client';
|
2
|
+
import { QueryParamsRetrieve, QueryParamsList } from './query';
|
3
|
+
import { ResourceTypeLock } from './api';
|
4
|
+
import { InterceptorManager } from './interceptor';
|
5
|
+
import { QueryParams } from '.';
|
6
|
+
type ResourceNull = {
|
7
|
+
id: null;
|
8
|
+
} & ResourceType;
|
9
|
+
type ResourceRel = ResourceId | ResourceNull;
|
10
|
+
type Metadata = {
|
11
|
+
[key: string]: any;
|
12
|
+
};
|
13
|
+
interface ResourceType {
|
14
|
+
readonly type: ResourceTypeLock;
|
15
|
+
}
|
16
|
+
interface ResourceId extends ResourceType {
|
17
|
+
readonly id: string;
|
18
|
+
}
|
19
|
+
interface Resource extends ResourceId {
|
20
|
+
reference?: string;
|
21
|
+
reference_origin?: string;
|
22
|
+
metadata?: Metadata;
|
23
|
+
readonly created_at: string;
|
24
|
+
readonly updated_at: string;
|
25
|
+
}
|
26
|
+
interface ResourceCreate {
|
27
|
+
reference?: string;
|
28
|
+
reference_origin?: string;
|
29
|
+
metadata?: Metadata;
|
30
|
+
}
|
31
|
+
interface ResourceUpdate {
|
32
|
+
readonly id: string;
|
33
|
+
reference?: string;
|
34
|
+
reference_origin?: string;
|
35
|
+
metadata?: Metadata;
|
36
|
+
}
|
37
|
+
type ListMeta = {
|
38
|
+
readonly pageCount: number;
|
39
|
+
readonly recordCount: number;
|
40
|
+
readonly currentPage: number;
|
41
|
+
readonly recordsPerPage: number;
|
42
|
+
};
|
43
|
+
declare class ListResponse<R> extends Array<R> {
|
44
|
+
readonly meta: ListMeta;
|
45
|
+
constructor(meta: ListMeta, data: R[]);
|
46
|
+
first(): R | undefined;
|
47
|
+
last(): R | undefined;
|
48
|
+
get(index: number): R | undefined;
|
49
|
+
}
|
50
|
+
export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse, ResourceRel };
|
51
|
+
type ResourceAdapterConfig = {};
|
52
|
+
type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig;
|
53
|
+
type ResourcesConfig = Partial<ResourcesInitConfig>;
|
54
|
+
declare class ResourceAdapter {
|
55
|
+
#private;
|
56
|
+
constructor(config: ResourcesInitConfig);
|
57
|
+
get interceptors(): InterceptorManager;
|
58
|
+
private localConfig;
|
59
|
+
config(config: ResourcesConfig): void;
|
60
|
+
singleton<R extends Resource>(resource: ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
61
|
+
retrieve<R extends Resource>(resource: ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
62
|
+
list<R extends Resource>(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
63
|
+
create<C extends ResourceCreate, R extends Resource>(resource: C & ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
64
|
+
update<U extends ResourceUpdate, R extends Resource>(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
65
|
+
delete(resource: ResourceId, options?: ResourcesConfig): Promise<void>;
|
66
|
+
fetch<R extends Resource>(resource: string | ResourceType, path: string, params?: QueryParams, options?: ResourcesConfig): Promise<R | ListResponse<R>>;
|
67
|
+
}
|
68
|
+
declare abstract class ApiResource {
|
69
|
+
static readonly TYPE: ResourceTypeLock;
|
70
|
+
protected resources: ResourceAdapter;
|
71
|
+
constructor(adapter: ResourceAdapter);
|
72
|
+
abstract relationship(id: string | ResourceId | null): ResourceRel;
|
73
|
+
abstract type(): string;
|
74
|
+
update(resource: ResourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Resource>;
|
75
|
+
}
|
76
|
+
export default ResourceAdapter;
|
77
|
+
export { ApiResource, ResourcesConfig, ResourcesInitConfig };
|