@commercelayer/sdk 7.0.0-beta.1 → 7.0.0-beta.10
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-BYcswOJ0.d.cts +16784 -0
- package/lib/api-Cknm0QL_.d.ts +16784 -0
- package/lib/api.cjs +936 -0
- package/lib/api.d.cts +4 -0
- package/lib/api.d.ts +4 -0
- package/lib/api.js +275 -0
- package/lib/client.cjs +170 -0
- package/lib/client.d.cts +36 -0
- package/lib/client.d.ts +36 -0
- package/lib/client.js +161 -0
- package/lib/commercelayer.cjs +798 -0
- package/lib/commercelayer.d.cts +167 -0
- package/lib/commercelayer.d.ts +167 -0
- package/lib/commercelayer.js +768 -0
- package/lib/common.cjs +17 -0
- package/lib/common.d.cts +13 -0
- package/lib/common.d.ts +13 -0
- package/lib/common.js +13 -0
- package/lib/config.cjs +21 -0
- package/lib/config.d.cts +19 -0
- package/lib/config.d.ts +19 -0
- package/lib/config.js +17 -0
- package/lib/debug.cjs +19 -0
- package/lib/debug.d.cts +4 -0
- package/lib/debug.d.ts +4 -0
- package/lib/debug.js +15 -0
- package/lib/error.cjs +97 -0
- package/lib/error.d.cts +35 -0
- package/lib/error.d.ts +35 -0
- package/lib/error.js +91 -0
- package/lib/fetch.cjs +83 -0
- package/lib/fetch.d.cts +1 -0
- package/lib/fetch.d.ts +1 -0
- package/lib/fetch.js +76 -0
- package/lib/index.cjs +32 -2
- package/lib/index.d.cts +8 -16916
- package/lib/index.d.ts +8 -16916
- package/lib/index.js +3 -2
- package/lib/instance.cjs +272 -0
- package/lib/instance.d.cts +141 -0
- package/lib/instance.d.ts +141 -0
- package/lib/instance.js +139 -0
- package/lib/interceptor-5MISI1yn.d.cts +54 -0
- package/lib/interceptor-5MISI1yn.d.ts +54 -0
- package/lib/interceptor.cjs +2 -0
- package/lib/interceptor.d.cts +1 -0
- package/lib/interceptor.d.ts +1 -0
- package/lib/interceptor.js +1 -0
- package/lib/jsonapi.cjs +79 -0
- package/lib/jsonapi.d.cts +11 -0
- package/lib/jsonapi.d.ts +11 -0
- package/lib/jsonapi.js +71 -0
- package/lib/model.cjs +2 -0
- package/lib/model.d.cts +4 -0
- package/lib/model.d.ts +4 -0
- package/lib/model.js +1 -0
- package/lib/query.cjs +64 -0
- package/lib/query.d.cts +4 -0
- package/lib/query.d.ts +4 -0
- package/lib/query.js +56 -0
- package/lib/resource.cjs +222 -0
- package/lib/resource.d.cts +4 -0
- package/lib/resource.d.ts +4 -0
- package/lib/resource.js +209 -0
- package/lib/resources/addresses.cjs +53 -0
- package/lib/resources/addresses.d.cts +4 -0
- package/lib/resources/addresses.d.ts +4 -0
- package/lib/resources/addresses.js +49 -0
- package/lib/resources/adjustments.cjs +41 -0
- package/lib/resources/adjustments.d.cts +4 -0
- package/lib/resources/adjustments.d.ts +4 -0
- package/lib/resources/adjustments.js +37 -0
- package/lib/resources/adyen_gateways.cjs +49 -0
- package/lib/resources/adyen_gateways.d.cts +4 -0
- package/lib/resources/adyen_gateways.d.ts +4 -0
- package/lib/resources/adyen_gateways.js +45 -0
- package/lib/resources/adyen_payments.cjs +55 -0
- package/lib/resources/adyen_payments.d.cts +4 -0
- package/lib/resources/adyen_payments.d.ts +4 -0
- package/lib/resources/adyen_payments.js +51 -0
- package/lib/resources/applications.cjs +31 -0
- package/lib/resources/applications.d.cts +4 -0
- package/lib/resources/applications.d.ts +4 -0
- package/lib/resources/applications.js +27 -0
- package/lib/resources/attachments.cjs +37 -0
- package/lib/resources/attachments.d.cts +4 -0
- package/lib/resources/attachments.d.ts +4 -0
- package/lib/resources/attachments.js +33 -0
- package/lib/resources/authorizations.cjs +70 -0
- package/lib/resources/authorizations.d.cts +4 -0
- package/lib/resources/authorizations.d.ts +4 -0
- package/lib/resources/authorizations.js +66 -0
- package/lib/resources/avalara_accounts.cjs +57 -0
- package/lib/resources/avalara_accounts.d.cts +4 -0
- package/lib/resources/avalara_accounts.d.ts +4 -0
- package/lib/resources/avalara_accounts.js +53 -0
- package/lib/resources/axerve_gateways.cjs +49 -0
- package/lib/resources/axerve_gateways.d.cts +4 -0
- package/lib/resources/axerve_gateways.d.ts +4 -0
- package/lib/resources/axerve_gateways.js +45 -0
- package/lib/resources/axerve_payments.cjs +52 -0
- package/lib/resources/axerve_payments.d.cts +4 -0
- package/lib/resources/axerve_payments.d.ts +4 -0
- package/lib/resources/axerve_payments.js +48 -0
- package/lib/resources/bing_geocoders.cjs +49 -0
- package/lib/resources/bing_geocoders.d.cts +4 -0
- package/lib/resources/bing_geocoders.d.ts +4 -0
- package/lib/resources/bing_geocoders.js +45 -0
- package/lib/resources/braintree_gateways.cjs +49 -0
- package/lib/resources/braintree_gateways.d.cts +4 -0
- package/lib/resources/braintree_gateways.d.ts +4 -0
- package/lib/resources/braintree_gateways.js +45 -0
- package/lib/resources/braintree_payments.cjs +49 -0
- package/lib/resources/braintree_payments.d.cts +4 -0
- package/lib/resources/braintree_payments.d.ts +4 -0
- package/lib/resources/braintree_payments.js +45 -0
- package/lib/resources/bundles.cjs +71 -0
- package/lib/resources/bundles.d.cts +4 -0
- package/lib/resources/bundles.d.ts +4 -0
- package/lib/resources/bundles.js +67 -0
- package/lib/resources/buy_x_pay_y_promotions.cjs +91 -0
- package/lib/resources/buy_x_pay_y_promotions.d.cts +4 -0
- package/lib/resources/buy_x_pay_y_promotions.d.ts +4 -0
- package/lib/resources/buy_x_pay_y_promotions.js +87 -0
- package/lib/resources/captures.cjs +71 -0
- package/lib/resources/captures.d.cts +4 -0
- package/lib/resources/captures.d.ts +4 -0
- package/lib/resources/captures.js +67 -0
- package/lib/resources/carrier_accounts.cjs +49 -0
- package/lib/resources/carrier_accounts.d.cts +4 -0
- package/lib/resources/carrier_accounts.d.ts +4 -0
- package/lib/resources/carrier_accounts.js +45 -0
- package/lib/resources/checkout_com_gateways.cjs +49 -0
- package/lib/resources/checkout_com_gateways.d.cts +4 -0
- package/lib/resources/checkout_com_gateways.d.ts +4 -0
- package/lib/resources/checkout_com_gateways.js +45 -0
- package/lib/resources/checkout_com_payments.cjs +55 -0
- package/lib/resources/checkout_com_payments.d.cts +4 -0
- package/lib/resources/checkout_com_payments.d.ts +4 -0
- package/lib/resources/checkout_com_payments.js +51 -0
- package/lib/resources/cleanups.cjs +48 -0
- package/lib/resources/cleanups.d.cts +4 -0
- package/lib/resources/cleanups.d.ts +4 -0
- package/lib/resources/cleanups.js +44 -0
- package/lib/resources/coupon_codes_promotion_rules.cjs +45 -0
- package/lib/resources/coupon_codes_promotion_rules.d.cts +4 -0
- package/lib/resources/coupon_codes_promotion_rules.d.ts +4 -0
- package/lib/resources/coupon_codes_promotion_rules.js +41 -0
- package/lib/resources/coupon_recipients.cjs +49 -0
- package/lib/resources/coupon_recipients.d.cts +4 -0
- package/lib/resources/coupon_recipients.d.ts +4 -0
- package/lib/resources/coupon_recipients.js +45 -0
- package/lib/resources/coupons.cjs +57 -0
- package/lib/resources/coupons.d.cts +4 -0
- package/lib/resources/coupons.d.ts +4 -0
- package/lib/resources/coupons.js +53 -0
- package/lib/resources/custom_promotion_rules.cjs +41 -0
- package/lib/resources/custom_promotion_rules.d.cts +4 -0
- package/lib/resources/custom_promotion_rules.d.ts +4 -0
- package/lib/resources/custom_promotion_rules.js +37 -0
- package/lib/resources/customer_addresses.cjs +53 -0
- package/lib/resources/customer_addresses.d.cts +4 -0
- package/lib/resources/customer_addresses.d.ts +4 -0
- package/lib/resources/customer_addresses.js +49 -0
- package/lib/resources/customer_groups.cjs +53 -0
- package/lib/resources/customer_groups.d.cts +4 -0
- package/lib/resources/customer_groups.d.ts +4 -0
- package/lib/resources/customer_groups.js +49 -0
- package/lib/resources/customer_password_resets.cjs +48 -0
- package/lib/resources/customer_password_resets.d.cts +4 -0
- package/lib/resources/customer_password_resets.d.ts +4 -0
- package/lib/resources/customer_password_resets.js +44 -0
- package/lib/resources/customer_payment_sources.cjs +49 -0
- package/lib/resources/customer_payment_sources.d.cts +4 -0
- package/lib/resources/customer_payment_sources.d.ts +4 -0
- package/lib/resources/customer_payment_sources.js +45 -0
- package/lib/resources/customer_subscriptions.cjs +49 -0
- package/lib/resources/customer_subscriptions.d.cts +4 -0
- package/lib/resources/customer_subscriptions.d.ts +4 -0
- package/lib/resources/customer_subscriptions.js +45 -0
- package/lib/resources/customers.cjs +81 -0
- package/lib/resources/customers.d.cts +4 -0
- package/lib/resources/customers.d.ts +4 -0
- package/lib/resources/customers.js +77 -0
- package/lib/resources/delivery_lead_times.cjs +53 -0
- package/lib/resources/delivery_lead_times.d.cts +4 -0
- package/lib/resources/delivery_lead_times.d.ts +4 -0
- package/lib/resources/delivery_lead_times.js +49 -0
- package/lib/resources/discount_engine_items.cjs +36 -0
- package/lib/resources/discount_engine_items.d.cts +4 -0
- package/lib/resources/discount_engine_items.d.ts +4 -0
- package/lib/resources/discount_engine_items.js +32 -0
- package/lib/resources/discount_engines.cjs +44 -0
- package/lib/resources/discount_engines.d.cts +4 -0
- package/lib/resources/discount_engines.d.ts +4 -0
- package/lib/resources/discount_engines.js +40 -0
- package/lib/resources/easypost_pickups.cjs +52 -0
- package/lib/resources/easypost_pickups.d.cts +4 -0
- package/lib/resources/easypost_pickups.d.ts +4 -0
- package/lib/resources/easypost_pickups.js +48 -0
- package/lib/resources/event_callbacks.cjs +32 -0
- package/lib/resources/event_callbacks.d.cts +4 -0
- package/lib/resources/event_callbacks.d.ts +4 -0
- package/lib/resources/event_callbacks.js +28 -0
- package/lib/resources/events.cjs +42 -0
- package/lib/resources/events.d.cts +4 -0
- package/lib/resources/events.d.ts +4 -0
- package/lib/resources/events.js +38 -0
- package/lib/resources/exports.cjs +48 -0
- package/lib/resources/exports.d.cts +4 -0
- package/lib/resources/exports.d.ts +4 -0
- package/lib/resources/exports.js +44 -0
- package/lib/resources/external_gateways.cjs +52 -0
- package/lib/resources/external_gateways.d.cts +4 -0
- package/lib/resources/external_gateways.d.ts +4 -0
- package/lib/resources/external_gateways.js +48 -0
- package/lib/resources/external_payments.cjs +53 -0
- package/lib/resources/external_payments.d.cts +4 -0
- package/lib/resources/external_payments.d.ts +4 -0
- package/lib/resources/external_payments.js +49 -0
- package/lib/resources/external_promotions.cjs +94 -0
- package/lib/resources/external_promotions.d.cts +4 -0
- package/lib/resources/external_promotions.d.ts +4 -0
- package/lib/resources/external_promotions.js +90 -0
- package/lib/resources/external_tax_calculators.cjs +56 -0
- package/lib/resources/external_tax_calculators.d.cts +4 -0
- package/lib/resources/external_tax_calculators.d.ts +4 -0
- package/lib/resources/external_tax_calculators.js +52 -0
- package/lib/resources/fixed_amount_promotions.cjs +91 -0
- package/lib/resources/fixed_amount_promotions.d.cts +4 -0
- package/lib/resources/fixed_amount_promotions.d.ts +4 -0
- package/lib/resources/fixed_amount_promotions.js +87 -0
- package/lib/resources/fixed_price_promotions.cjs +91 -0
- package/lib/resources/fixed_price_promotions.d.cts +4 -0
- package/lib/resources/fixed_price_promotions.d.ts +4 -0
- package/lib/resources/fixed_price_promotions.js +87 -0
- package/lib/resources/flex_promotions.cjs +67 -0
- package/lib/resources/flex_promotions.d.cts +4 -0
- package/lib/resources/flex_promotions.d.ts +4 -0
- package/lib/resources/flex_promotions.js +63 -0
- package/lib/resources/free_gift_promotions.cjs +91 -0
- package/lib/resources/free_gift_promotions.d.cts +4 -0
- package/lib/resources/free_gift_promotions.d.ts +4 -0
- package/lib/resources/free_gift_promotions.js +87 -0
- package/lib/resources/free_shipping_promotions.cjs +87 -0
- package/lib/resources/free_shipping_promotions.d.cts +4 -0
- package/lib/resources/free_shipping_promotions.d.ts +4 -0
- package/lib/resources/free_shipping_promotions.js +83 -0
- package/lib/resources/geocoders.cjs +40 -0
- package/lib/resources/geocoders.d.cts +4 -0
- package/lib/resources/geocoders.d.ts +4 -0
- package/lib/resources/geocoders.js +36 -0
- package/lib/resources/gift_card_recipients.cjs +49 -0
- package/lib/resources/gift_card_recipients.d.cts +4 -0
- package/lib/resources/gift_card_recipients.d.ts +4 -0
- package/lib/resources/gift_card_recipients.js +45 -0
- package/lib/resources/gift_cards.cjs +73 -0
- package/lib/resources/gift_cards.d.cts +4 -0
- package/lib/resources/gift_cards.d.ts +4 -0
- package/lib/resources/gift_cards.js +69 -0
- package/lib/resources/google_geocoders.cjs +49 -0
- package/lib/resources/google_geocoders.d.cts +4 -0
- package/lib/resources/google_geocoders.d.ts +4 -0
- package/lib/resources/google_geocoders.js +45 -0
- package/lib/resources/imports.cjs +44 -0
- package/lib/resources/imports.d.cts +4 -0
- package/lib/resources/imports.d.ts +4 -0
- package/lib/resources/imports.js +40 -0
- package/lib/resources/in_stock_subscriptions.cjs +63 -0
- package/lib/resources/in_stock_subscriptions.d.cts +4 -0
- package/lib/resources/in_stock_subscriptions.d.ts +4 -0
- package/lib/resources/in_stock_subscriptions.js +59 -0
- package/lib/resources/inventory_models.cjs +53 -0
- package/lib/resources/inventory_models.d.cts +4 -0
- package/lib/resources/inventory_models.d.ts +4 -0
- package/lib/resources/inventory_models.js +49 -0
- package/lib/resources/inventory_return_locations.cjs +49 -0
- package/lib/resources/inventory_return_locations.d.cts +4 -0
- package/lib/resources/inventory_return_locations.d.ts +4 -0
- package/lib/resources/inventory_return_locations.js +45 -0
- package/lib/resources/inventory_stock_locations.cjs +49 -0
- package/lib/resources/inventory_stock_locations.d.cts +4 -0
- package/lib/resources/inventory_stock_locations.d.ts +4 -0
- package/lib/resources/inventory_stock_locations.js +45 -0
- package/lib/resources/klarna_gateways.cjs +49 -0
- package/lib/resources/klarna_gateways.d.cts +4 -0
- package/lib/resources/klarna_gateways.d.ts +4 -0
- package/lib/resources/klarna_gateways.js +45 -0
- package/lib/resources/klarna_payments.cjs +52 -0
- package/lib/resources/klarna_payments.d.cts +4 -0
- package/lib/resources/klarna_payments.d.ts +4 -0
- package/lib/resources/klarna_payments.js +48 -0
- package/lib/resources/line_item_options.cjs +53 -0
- package/lib/resources/line_item_options.d.cts +4 -0
- package/lib/resources/line_item_options.d.ts +4 -0
- package/lib/resources/line_item_options.js +49 -0
- package/lib/resources/line_items.cjs +82 -0
- package/lib/resources/line_items.d.cts +4 -0
- package/lib/resources/line_items.d.ts +4 -0
- package/lib/resources/line_items.js +78 -0
- package/lib/resources/links.cjs +47 -0
- package/lib/resources/links.d.cts +4 -0
- package/lib/resources/links.d.ts +4 -0
- package/lib/resources/links.js +43 -0
- package/lib/resources/manual_gateways.cjs +45 -0
- package/lib/resources/manual_gateways.d.cts +4 -0
- package/lib/resources/manual_gateways.d.ts +4 -0
- package/lib/resources/manual_gateways.js +41 -0
- package/lib/resources/manual_tax_calculators.cjs +57 -0
- package/lib/resources/manual_tax_calculators.d.cts +4 -0
- package/lib/resources/manual_tax_calculators.d.ts +4 -0
- package/lib/resources/manual_tax_calculators.js +53 -0
- package/lib/resources/markets.cjs +91 -0
- package/lib/resources/markets.d.cts +4 -0
- package/lib/resources/markets.d.ts +4 -0
- package/lib/resources/markets.js +87 -0
- package/lib/resources/merchants.cjs +49 -0
- package/lib/resources/merchants.d.cts +4 -0
- package/lib/resources/merchants.d.ts +4 -0
- package/lib/resources/merchants.js +45 -0
- package/lib/resources/notifications.cjs +37 -0
- package/lib/resources/notifications.d.cts +4 -0
- package/lib/resources/notifications.d.ts +4 -0
- package/lib/resources/notifications.js +33 -0
- package/lib/resources/order_amount_promotion_rules.cjs +41 -0
- package/lib/resources/order_amount_promotion_rules.d.cts +4 -0
- package/lib/resources/order_amount_promotion_rules.d.ts +4 -0
- package/lib/resources/order_amount_promotion_rules.js +37 -0
- package/lib/resources/order_copies.cjs +53 -0
- package/lib/resources/order_copies.d.cts +4 -0
- package/lib/resources/order_copies.d.ts +4 -0
- package/lib/resources/order_copies.js +49 -0
- package/lib/resources/order_factories.cjs +40 -0
- package/lib/resources/order_factories.d.cts +4 -0
- package/lib/resources/order_factories.d.ts +4 -0
- package/lib/resources/order_factories.js +36 -0
- package/lib/resources/order_subscription_items.cjs +45 -0
- package/lib/resources/order_subscription_items.d.cts +4 -0
- package/lib/resources/order_subscription_items.d.ts +4 -0
- package/lib/resources/order_subscription_items.js +41 -0
- package/lib/resources/order_subscriptions.cjs +97 -0
- package/lib/resources/order_subscriptions.d.cts +4 -0
- package/lib/resources/order_subscriptions.d.ts +4 -0
- package/lib/resources/order_subscriptions.js +93 -0
- package/lib/resources/orders.cjs +266 -0
- package/lib/resources/orders.d.cts +4 -0
- package/lib/resources/orders.d.ts +4 -0
- package/lib/resources/orders.js +262 -0
- package/lib/resources/organizations.cjs +31 -0
- package/lib/resources/organizations.d.cts +4 -0
- package/lib/resources/organizations.d.ts +4 -0
- package/lib/resources/organizations.js +27 -0
- package/lib/resources/packages.cjs +53 -0
- package/lib/resources/packages.d.cts +4 -0
- package/lib/resources/packages.d.ts +4 -0
- package/lib/resources/packages.js +49 -0
- package/lib/resources/parcel_line_items.cjs +49 -0
- package/lib/resources/parcel_line_items.d.cts +4 -0
- package/lib/resources/parcel_line_items.d.ts +4 -0
- package/lib/resources/parcel_line_items.js +45 -0
- package/lib/resources/parcels.cjs +61 -0
- package/lib/resources/parcels.d.cts +4 -0
- package/lib/resources/parcels.d.ts +4 -0
- package/lib/resources/parcels.js +57 -0
- package/lib/resources/payment_gateways.cjs +36 -0
- package/lib/resources/payment_gateways.d.cts +4 -0
- package/lib/resources/payment_gateways.d.ts +4 -0
- package/lib/resources/payment_gateways.js +32 -0
- package/lib/resources/payment_methods.cjs +67 -0
- package/lib/resources/payment_methods.d.cts +4 -0
- package/lib/resources/payment_methods.d.ts +4 -0
- package/lib/resources/payment_methods.js +63 -0
- package/lib/resources/payment_options.cjs +45 -0
- package/lib/resources/payment_options.d.cts +4 -0
- package/lib/resources/payment_options.d.ts +4 -0
- package/lib/resources/payment_options.js +41 -0
- package/lib/resources/paypal_gateways.cjs +49 -0
- package/lib/resources/paypal_gateways.d.cts +4 -0
- package/lib/resources/paypal_gateways.d.ts +4 -0
- package/lib/resources/paypal_gateways.js +45 -0
- package/lib/resources/paypal_payments.cjs +49 -0
- package/lib/resources/paypal_payments.d.cts +4 -0
- package/lib/resources/paypal_payments.d.ts +4 -0
- package/lib/resources/paypal_payments.js +45 -0
- package/lib/resources/percentage_discount_promotions.cjs +91 -0
- package/lib/resources/percentage_discount_promotions.d.cts +4 -0
- package/lib/resources/percentage_discount_promotions.d.ts +4 -0
- package/lib/resources/percentage_discount_promotions.js +87 -0
- package/lib/resources/pickups.cjs +40 -0
- package/lib/resources/pickups.d.cts +4 -0
- package/lib/resources/pickups.d.ts +4 -0
- package/lib/resources/pickups.js +36 -0
- package/lib/resources/price_frequency_tiers.cjs +53 -0
- package/lib/resources/price_frequency_tiers.d.cts +4 -0
- package/lib/resources/price_frequency_tiers.d.ts +4 -0
- package/lib/resources/price_frequency_tiers.js +49 -0
- package/lib/resources/price_list_schedulers.cjs +59 -0
- package/lib/resources/price_list_schedulers.d.cts +4 -0
- package/lib/resources/price_list_schedulers.d.ts +4 -0
- package/lib/resources/price_list_schedulers.js +55 -0
- package/lib/resources/price_lists.cjs +53 -0
- package/lib/resources/price_lists.d.cts +4 -0
- package/lib/resources/price_lists.d.ts +4 -0
- package/lib/resources/price_lists.js +49 -0
- package/lib/resources/price_tiers.cjs +40 -0
- package/lib/resources/price_tiers.d.cts +4 -0
- package/lib/resources/price_tiers.d.ts +4 -0
- package/lib/resources/price_tiers.js +36 -0
- package/lib/resources/price_volume_tiers.cjs +53 -0
- package/lib/resources/price_volume_tiers.d.cts +4 -0
- package/lib/resources/price_volume_tiers.d.ts +4 -0
- package/lib/resources/price_volume_tiers.js +49 -0
- package/lib/resources/prices.cjs +77 -0
- package/lib/resources/prices.d.cts +4 -0
- package/lib/resources/prices.d.ts +4 -0
- package/lib/resources/prices.js +73 -0
- package/lib/resources/promotion_rules.cjs +32 -0
- package/lib/resources/promotion_rules.d.cts +4 -0
- package/lib/resources/promotion_rules.d.ts +4 -0
- package/lib/resources/promotion_rules.js +28 -0
- package/lib/resources/promotions.cjs +72 -0
- package/lib/resources/promotions.d.cts +4 -0
- package/lib/resources/promotions.d.ts +4 -0
- package/lib/resources/promotions.js +68 -0
- package/lib/resources/recurring_order_copies.cjs +53 -0
- package/lib/resources/recurring_order_copies.d.cts +4 -0
- package/lib/resources/recurring_order_copies.d.ts +4 -0
- package/lib/resources/recurring_order_copies.js +49 -0
- package/lib/resources/refunds.cjs +58 -0
- package/lib/resources/refunds.d.cts +4 -0
- package/lib/resources/refunds.d.ts +4 -0
- package/lib/resources/refunds.js +54 -0
- package/lib/resources/reserved_stocks.cjs +44 -0
- package/lib/resources/reserved_stocks.d.cts +4 -0
- package/lib/resources/reserved_stocks.d.ts +4 -0
- package/lib/resources/reserved_stocks.js +40 -0
- package/lib/resources/resource_errors.cjs +28 -0
- package/lib/resources/resource_errors.d.cts +4 -0
- package/lib/resources/resource_errors.d.ts +4 -0
- package/lib/resources/resource_errors.js +24 -0
- package/lib/resources/return_line_items.cjs +48 -0
- package/lib/resources/return_line_items.d.cts +4 -0
- package/lib/resources/return_line_items.d.ts +4 -0
- package/lib/resources/return_line_items.js +44 -0
- package/lib/resources/returns.cjs +122 -0
- package/lib/resources/returns.d.cts +4 -0
- package/lib/resources/returns.d.ts +4 -0
- package/lib/resources/returns.js +118 -0
- package/lib/resources/satispay_gateways.cjs +49 -0
- package/lib/resources/satispay_gateways.d.cts +4 -0
- package/lib/resources/satispay_gateways.d.ts +4 -0
- package/lib/resources/satispay_gateways.js +45 -0
- package/lib/resources/satispay_payments.cjs +52 -0
- package/lib/resources/satispay_payments.d.cts +4 -0
- package/lib/resources/satispay_payments.d.ts +4 -0
- package/lib/resources/satispay_payments.js +48 -0
- package/lib/resources/shipments.cjs +152 -0
- package/lib/resources/shipments.d.cts +4 -0
- package/lib/resources/shipments.d.ts +4 -0
- package/lib/resources/shipments.js +148 -0
- package/lib/resources/shipping_categories.cjs +49 -0
- package/lib/resources/shipping_categories.d.cts +4 -0
- package/lib/resources/shipping_categories.d.ts +4 -0
- package/lib/resources/shipping_categories.js +45 -0
- package/lib/resources/shipping_method_tiers.cjs +40 -0
- package/lib/resources/shipping_method_tiers.d.cts +4 -0
- package/lib/resources/shipping_method_tiers.d.ts +4 -0
- package/lib/resources/shipping_method_tiers.js +36 -0
- package/lib/resources/shipping_methods.cjs +86 -0
- package/lib/resources/shipping_methods.d.cts +4 -0
- package/lib/resources/shipping_methods.d.ts +4 -0
- package/lib/resources/shipping_methods.js +82 -0
- package/lib/resources/shipping_weight_tiers.cjs +49 -0
- package/lib/resources/shipping_weight_tiers.d.cts +4 -0
- package/lib/resources/shipping_weight_tiers.d.ts +4 -0
- package/lib/resources/shipping_weight_tiers.js +45 -0
- package/lib/resources/shipping_zones.cjs +45 -0
- package/lib/resources/shipping_zones.d.cts +4 -0
- package/lib/resources/shipping_zones.d.ts +4 -0
- package/lib/resources/shipping_zones.js +41 -0
- package/lib/resources/sku_list_items.cjs +49 -0
- package/lib/resources/sku_list_items.d.cts +4 -0
- package/lib/resources/sku_list_items.d.ts +4 -0
- package/lib/resources/sku_list_items.js +45 -0
- package/lib/resources/sku_list_promotion_rules.cjs +49 -0
- package/lib/resources/sku_list_promotion_rules.d.cts +4 -0
- package/lib/resources/sku_list_promotion_rules.d.ts +4 -0
- package/lib/resources/sku_list_promotion_rules.js +45 -0
- package/lib/resources/sku_lists.cjs +65 -0
- package/lib/resources/sku_lists.d.cts +4 -0
- package/lib/resources/sku_lists.d.ts +4 -0
- package/lib/resources/sku_lists.js +61 -0
- package/lib/resources/sku_options.cjs +57 -0
- package/lib/resources/sku_options.d.cts +4 -0
- package/lib/resources/sku_options.d.ts +4 -0
- package/lib/resources/sku_options.js +53 -0
- package/lib/resources/skus.cjs +101 -0
- package/lib/resources/skus.d.cts +4 -0
- package/lib/resources/skus.d.ts +4 -0
- package/lib/resources/skus.js +97 -0
- package/lib/resources/stock_items.cjs +64 -0
- package/lib/resources/stock_items.d.cts +4 -0
- package/lib/resources/stock_items.d.ts +4 -0
- package/lib/resources/stock_items.js +60 -0
- package/lib/resources/stock_line_items.cjs +70 -0
- package/lib/resources/stock_line_items.d.cts +4 -0
- package/lib/resources/stock_line_items.d.ts +4 -0
- package/lib/resources/stock_line_items.js +66 -0
- package/lib/resources/stock_locations.cjs +69 -0
- package/lib/resources/stock_locations.d.cts +4 -0
- package/lib/resources/stock_locations.d.ts +4 -0
- package/lib/resources/stock_locations.js +65 -0
- package/lib/resources/stock_reservations.cjs +68 -0
- package/lib/resources/stock_reservations.d.cts +4 -0
- package/lib/resources/stock_reservations.d.ts +4 -0
- package/lib/resources/stock_reservations.js +64 -0
- package/lib/resources/stock_transfers.cjs +91 -0
- package/lib/resources/stock_transfers.d.cts +4 -0
- package/lib/resources/stock_transfers.d.ts +4 -0
- package/lib/resources/stock_transfers.js +87 -0
- package/lib/resources/stores.cjs +65 -0
- package/lib/resources/stores.d.cts +4 -0
- package/lib/resources/stores.d.ts +4 -0
- package/lib/resources/stores.js +61 -0
- package/lib/resources/stripe_gateways.cjs +49 -0
- package/lib/resources/stripe_gateways.d.cts +4 -0
- package/lib/resources/stripe_gateways.d.ts +4 -0
- package/lib/resources/stripe_gateways.js +45 -0
- package/lib/resources/stripe_payments.cjs +55 -0
- package/lib/resources/stripe_payments.d.cts +4 -0
- package/lib/resources/stripe_payments.d.ts +4 -0
- package/lib/resources/stripe_payments.js +51 -0
- package/lib/resources/stripe_tax_accounts.cjs +57 -0
- package/lib/resources/stripe_tax_accounts.d.cts +4 -0
- package/lib/resources/stripe_tax_accounts.d.ts +4 -0
- package/lib/resources/stripe_tax_accounts.js +53 -0
- package/lib/resources/subscription_models.cjs +49 -0
- package/lib/resources/subscription_models.d.cts +4 -0
- package/lib/resources/subscription_models.d.ts +4 -0
- package/lib/resources/subscription_models.js +45 -0
- package/lib/resources/tags.cjs +37 -0
- package/lib/resources/tags.d.cts +4 -0
- package/lib/resources/tags.d.ts +4 -0
- package/lib/resources/tags.js +33 -0
- package/lib/resources/talon_one_accounts.cjs +53 -0
- package/lib/resources/talon_one_accounts.d.cts +4 -0
- package/lib/resources/talon_one_accounts.d.ts +4 -0
- package/lib/resources/talon_one_accounts.js +49 -0
- package/lib/resources/tax_calculators.cjs +44 -0
- package/lib/resources/tax_calculators.d.cts +4 -0
- package/lib/resources/tax_calculators.d.ts +4 -0
- package/lib/resources/tax_calculators.js +40 -0
- package/lib/resources/tax_categories.cjs +49 -0
- package/lib/resources/tax_categories.d.cts +4 -0
- package/lib/resources/tax_categories.d.ts +4 -0
- package/lib/resources/tax_categories.js +45 -0
- package/lib/resources/tax_rules.cjs +45 -0
- package/lib/resources/tax_rules.d.cts +4 -0
- package/lib/resources/tax_rules.d.ts +4 -0
- package/lib/resources/tax_rules.js +41 -0
- package/lib/resources/taxjar_accounts.cjs +57 -0
- package/lib/resources/taxjar_accounts.d.cts +4 -0
- package/lib/resources/taxjar_accounts.d.ts +4 -0
- package/lib/resources/taxjar_accounts.js +53 -0
- package/lib/resources/transactions.cjs +44 -0
- package/lib/resources/transactions.d.cts +4 -0
- package/lib/resources/transactions.d.ts +4 -0
- package/lib/resources/transactions.js +40 -0
- package/lib/resources/versions.cjs +28 -0
- package/lib/resources/versions.d.cts +4 -0
- package/lib/resources/versions.d.ts +4 -0
- package/lib/resources/versions.js +24 -0
- package/lib/resources/vertex_accounts.cjs +56 -0
- package/lib/resources/vertex_accounts.d.cts +4 -0
- package/lib/resources/vertex_accounts.d.ts +4 -0
- package/lib/resources/vertex_accounts.js +52 -0
- package/lib/resources/voids.cjs +54 -0
- package/lib/resources/voids.d.cts +4 -0
- package/lib/resources/voids.d.ts +4 -0
- package/lib/resources/voids.js +50 -0
- package/lib/resources/webhooks.cjs +54 -0
- package/lib/resources/webhooks.d.cts +4 -0
- package/lib/resources/webhooks.d.ts +4 -0
- package/lib/resources/webhooks.js +50 -0
- package/lib/resources/wire_transfers.cjs +45 -0
- package/lib/resources/wire_transfers.d.cts +4 -0
- package/lib/resources/wire_transfers.d.ts +4 -0
- package/lib/resources/wire_transfers.js +41 -0
- package/lib/static.cjs +39 -0
- package/lib/static.d.cts +19 -0
- package/lib/static.d.ts +19 -0
- package/lib/static.js +33 -0
- package/lib/types.cjs +2 -0
- package/lib/types.d.cts +7 -0
- package/lib/types.d.ts +7 -0
- package/lib/types.js +1 -0
- package/lib/util.cjs +37 -0
- package/lib/util.d.cts +13 -0
- package/lib/util.d.ts +13 -0
- package/lib/util.js +32 -0
- package/package.json +12 -10
package/lib/resource.cjs
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var ApiClient = require('./client');
|
6
|
+
var jsonapi = require('./jsonapi');
|
7
|
+
var query = require('./query');
|
8
|
+
var config = require('./config');
|
9
|
+
var error = require('./error');
|
10
|
+
var Debug = require('./debug');
|
11
|
+
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
13
|
+
|
14
|
+
var ApiClient__default = /*#__PURE__*/_interopDefault(ApiClient);
|
15
|
+
var config__default = /*#__PURE__*/_interopDefault(config);
|
16
|
+
var Debug__default = /*#__PURE__*/_interopDefault(Debug);
|
17
|
+
|
18
|
+
var __defProp = Object.defineProperty;
|
19
|
+
var __typeError = (msg) => {
|
20
|
+
throw TypeError(msg);
|
21
|
+
};
|
22
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
23
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
24
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
25
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
26
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
27
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
28
|
+
var _client, _config, _resources;
|
29
|
+
const debug = Debug__default.default("resource");
|
30
|
+
class ListResponse extends Array {
|
31
|
+
constructor(meta, data) {
|
32
|
+
super(...data || []);
|
33
|
+
__publicField(this, "meta");
|
34
|
+
this.meta = meta;
|
35
|
+
}
|
36
|
+
first() {
|
37
|
+
return this.length ? this[0] : void 0;
|
38
|
+
}
|
39
|
+
last() {
|
40
|
+
return this.length ? this[this.length - 1] : void 0;
|
41
|
+
}
|
42
|
+
get(index) {
|
43
|
+
return this.length && index >= 0 ? this[index] : void 0;
|
44
|
+
}
|
45
|
+
hasNextPage() {
|
46
|
+
return this.meta.currentPage < this.meta.pageCount;
|
47
|
+
}
|
48
|
+
hasPrevPage() {
|
49
|
+
return this.meta.currentPage > 1;
|
50
|
+
}
|
51
|
+
getRecordCount() {
|
52
|
+
return this.meta.recordCount;
|
53
|
+
}
|
54
|
+
getPageCount() {
|
55
|
+
return this.meta.pageCount;
|
56
|
+
}
|
57
|
+
get recordCount() {
|
58
|
+
return this.meta.recordCount;
|
59
|
+
}
|
60
|
+
get pageCount() {
|
61
|
+
return this.meta.pageCount;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
const _ApiResourceAdapter = class _ApiResourceAdapter {
|
65
|
+
static init(config2) {
|
66
|
+
return _ApiResourceAdapter.adapter = new ResourceAdapter(config2);
|
67
|
+
}
|
68
|
+
static get(config2) {
|
69
|
+
if (config2) return _ApiResourceAdapter.init(config2);
|
70
|
+
else {
|
71
|
+
if (_ApiResourceAdapter.adapter) return _ApiResourceAdapter.adapter;
|
72
|
+
else throw new error.SdkError({ message: "RersourceAdapter not initialized" });
|
73
|
+
}
|
74
|
+
}
|
75
|
+
static config(config2) {
|
76
|
+
_ApiResourceAdapter.get().config(config2);
|
77
|
+
}
|
78
|
+
};
|
79
|
+
__publicField(_ApiResourceAdapter, "adapter");
|
80
|
+
let ApiResourceAdapter = _ApiResourceAdapter;
|
81
|
+
class ResourceAdapter {
|
82
|
+
constructor(config2) {
|
83
|
+
__privateAdd(this, _client);
|
84
|
+
__privateAdd(this, _config, {});
|
85
|
+
__privateSet(this, _client, ApiClient__default.default.create(config2));
|
86
|
+
this.localConfig(config2);
|
87
|
+
}
|
88
|
+
localConfig(config2) {
|
89
|
+
}
|
90
|
+
config(config2) {
|
91
|
+
debug("config %o", config2);
|
92
|
+
this.localConfig(config2);
|
93
|
+
__privateGet(this, _client).config(config2);
|
94
|
+
return this;
|
95
|
+
}
|
96
|
+
get client() {
|
97
|
+
return __privateGet(this, _client);
|
98
|
+
}
|
99
|
+
async singleton(resource, params, options, path) {
|
100
|
+
debug("singleton: %o, %O, %O", resource, params || {}, options || {});
|
101
|
+
const queryParams = query.generateQueryStringParams(params, resource);
|
102
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
103
|
+
const res = await __privateGet(this, _client).request("GET", `${path || resource.type}`, void 0, { ...options, params: queryParams });
|
104
|
+
const r = jsonapi.denormalize(res);
|
105
|
+
return r;
|
106
|
+
}
|
107
|
+
async retrieve(resource, params, options) {
|
108
|
+
debug("retrieve: %o, %O, %O", resource, params || {}, options || {});
|
109
|
+
const queryParams = query.generateQueryStringParams(params, resource);
|
110
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
111
|
+
const res = await __privateGet(this, _client).request("GET", `${resource.type}/${resource.id}`, void 0, { ...options, params: queryParams });
|
112
|
+
const r = jsonapi.denormalize(res);
|
113
|
+
return r;
|
114
|
+
}
|
115
|
+
async list(resource, params, options) {
|
116
|
+
debug("list: %o, %O, %O", resource, params || {}, options || {});
|
117
|
+
const queryParams = query.generateQueryStringParams(params, resource);
|
118
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
119
|
+
if (!queryParams["page[number]"]) queryParams["page[number]"] = "1";
|
120
|
+
const res = await __privateGet(this, _client).request("GET", `${resource.type}`, void 0, { ...options, params: queryParams });
|
121
|
+
const r = jsonapi.denormalize(res);
|
122
|
+
const meta = {
|
123
|
+
pageCount: Number(res.meta?.page_count),
|
124
|
+
recordCount: Number(res.meta?.record_count),
|
125
|
+
currentPage: params?.pageNumber || config__default.default.default.pageNumber,
|
126
|
+
recordsPerPage: params?.pageSize || config__default.default.default.pageSize
|
127
|
+
};
|
128
|
+
return new ListResponse(meta, r);
|
129
|
+
}
|
130
|
+
async create(resource, params, options) {
|
131
|
+
debug("create: %o, %O, %O", resource, params || {}, options || {});
|
132
|
+
const queryParams = query.generateQueryStringParams(params, resource);
|
133
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
134
|
+
const data = jsonapi.normalize(resource);
|
135
|
+
const res = await __privateGet(this, _client).request("POST", resource.type, data, { ...options, params: queryParams });
|
136
|
+
const r = jsonapi.denormalize(res);
|
137
|
+
return r;
|
138
|
+
}
|
139
|
+
async update(resource, params, options) {
|
140
|
+
debug("update: %o, %O, %O", resource, params || {}, options || {});
|
141
|
+
const queryParams = query.generateQueryStringParams(params, resource);
|
142
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
143
|
+
const data = jsonapi.normalize(resource);
|
144
|
+
const res = await __privateGet(this, _client).request("PATCH", `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
|
145
|
+
const r = jsonapi.denormalize(res);
|
146
|
+
return r;
|
147
|
+
}
|
148
|
+
async delete(resource, options) {
|
149
|
+
debug("delete: %o, %O", resource, options || {});
|
150
|
+
await __privateGet(this, _client).request("DELETE", `${resource.type}/${resource.id}`, void 0, options);
|
151
|
+
}
|
152
|
+
async fetch(resource, path, params, options) {
|
153
|
+
debug("fetch: %o, %O, %O", path, params || {}, options || {});
|
154
|
+
const queryParams = query.generateQueryStringParams(params, resource);
|
155
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
156
|
+
const res = await __privateGet(this, _client).request("GET", path, void 0, { ...options, params: queryParams });
|
157
|
+
const r = jsonapi.denormalize(res);
|
158
|
+
if (Array.isArray(r)) {
|
159
|
+
const p = params;
|
160
|
+
const meta = {
|
161
|
+
pageCount: Number(res.meta?.page_count),
|
162
|
+
recordCount: Number(res.meta?.record_count),
|
163
|
+
currentPage: p?.pageNumber || config__default.default.default.pageNumber,
|
164
|
+
recordsPerPage: p?.pageSize || config__default.default.default.pageSize
|
165
|
+
};
|
166
|
+
return new ListResponse(meta, r);
|
167
|
+
} else return r;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
_client = new WeakMap();
|
171
|
+
_config = new WeakMap();
|
172
|
+
class ApiResourceBase {
|
173
|
+
constructor(adapter) {
|
174
|
+
__privateAdd(this, _resources);
|
175
|
+
debug("new resource instance: %s", this.type());
|
176
|
+
__privateSet(this, _resources, adapter);
|
177
|
+
}
|
178
|
+
get resources() {
|
179
|
+
return __privateGet(this, _resources) || __privateSet(this, _resources, ApiResourceAdapter.get());
|
180
|
+
}
|
181
|
+
relationshipOneToOne(id) {
|
182
|
+
return id === null || typeof id === "string" ? { id, type: this.type() } : { id: id.id, type: this.type() };
|
183
|
+
}
|
184
|
+
relationshipOneToMany(...ids) {
|
185
|
+
return ids === null || ids.length === 0 || ids[0] === null ? [{ id: null, type: this.type() }] : ids.map((id) => {
|
186
|
+
return { id, type: this.type() };
|
187
|
+
});
|
188
|
+
}
|
189
|
+
path() {
|
190
|
+
return this.type();
|
191
|
+
}
|
192
|
+
// reference, reference_origin and metadata attributes are always updatable
|
193
|
+
async update(resource, params, options) {
|
194
|
+
return this.resources.update({ ...resource, type: this.type() }, params, options);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
_resources = new WeakMap();
|
198
|
+
__publicField(ApiResourceBase, "TYPE");
|
199
|
+
class ApiResource extends ApiResourceBase {
|
200
|
+
async retrieve(id, params, options) {
|
201
|
+
return this.resources.retrieve(typeof id === "string" ? { type: this.type(), id } : id, params, options);
|
202
|
+
}
|
203
|
+
async list(params, options) {
|
204
|
+
return this.resources.list({ type: this.type() }, params, options);
|
205
|
+
}
|
206
|
+
async count(filter, options) {
|
207
|
+
const params = { filters: query.isParamsList(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
|
208
|
+
const response = await this.list(params, options);
|
209
|
+
return Promise.resolve(response.meta.recordCount);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
class ApiSingleton extends ApiResourceBase {
|
213
|
+
async retrieve(params, options) {
|
214
|
+
return this.resources.singleton({ type: this.type() }, params, options, this.path());
|
215
|
+
}
|
216
|
+
}
|
217
|
+
var resource_default = ResourceAdapter;
|
218
|
+
|
219
|
+
exports.ApiResource = ApiResource;
|
220
|
+
exports.ApiResourceAdapter = ApiResourceAdapter;
|
221
|
+
exports.ApiSingleton = ApiSingleton;
|
222
|
+
exports.default = resource_default;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import './client.cjs';
|
2
|
+
export { A as ApiResource, C as ApiResourceAdapter, v as ApiSingleton, t as ListMeta, L as ListResponse, M as Metadata, q as Resource, y as ResourceAdapter, r as ResourceCreate, B as ResourceFilter, p as ResourceId, u as ResourceRel, z as ResourceSort, R as ResourceType, s as ResourceUpdate, w as ResourcesConfig, x as ResourcesInitConfig, y as default } from './api-BYcswOJ0.cjs';
|
3
|
+
import './interceptor-5MISI1yn.cjs';
|
4
|
+
import './types.cjs';
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import './client.js';
|
2
|
+
export { A as ApiResource, C as ApiResourceAdapter, v as ApiSingleton, t as ListMeta, L as ListResponse, M as Metadata, q as Resource, y as ResourceAdapter, r as ResourceCreate, B as ResourceFilter, p as ResourceId, u as ResourceRel, z as ResourceSort, R as ResourceType, s as ResourceUpdate, w as ResourcesConfig, x as ResourcesInitConfig, y as default } from './api-Cknm0QL_.js';
|
3
|
+
import './interceptor-5MISI1yn.js';
|
4
|
+
import './types.js';
|
package/lib/resource.js
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
import ApiClient from './client';
|
2
|
+
import { denormalize, normalize } from './jsonapi';
|
3
|
+
import { generateQueryStringParams, isParamsList } from './query';
|
4
|
+
import config from './config';
|
5
|
+
import { SdkError } from './error';
|
6
|
+
import Debug from './debug';
|
7
|
+
|
8
|
+
var __defProp = Object.defineProperty;
|
9
|
+
var __typeError = (msg) => {
|
10
|
+
throw TypeError(msg);
|
11
|
+
};
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
13
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
14
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
15
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
16
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
17
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
18
|
+
var _client, _config, _resources;
|
19
|
+
const debug = Debug("resource");
|
20
|
+
class ListResponse extends Array {
|
21
|
+
constructor(meta, data) {
|
22
|
+
super(...data || []);
|
23
|
+
__publicField(this, "meta");
|
24
|
+
this.meta = meta;
|
25
|
+
}
|
26
|
+
first() {
|
27
|
+
return this.length ? this[0] : void 0;
|
28
|
+
}
|
29
|
+
last() {
|
30
|
+
return this.length ? this[this.length - 1] : void 0;
|
31
|
+
}
|
32
|
+
get(index) {
|
33
|
+
return this.length && index >= 0 ? this[index] : void 0;
|
34
|
+
}
|
35
|
+
hasNextPage() {
|
36
|
+
return this.meta.currentPage < this.meta.pageCount;
|
37
|
+
}
|
38
|
+
hasPrevPage() {
|
39
|
+
return this.meta.currentPage > 1;
|
40
|
+
}
|
41
|
+
getRecordCount() {
|
42
|
+
return this.meta.recordCount;
|
43
|
+
}
|
44
|
+
getPageCount() {
|
45
|
+
return this.meta.pageCount;
|
46
|
+
}
|
47
|
+
get recordCount() {
|
48
|
+
return this.meta.recordCount;
|
49
|
+
}
|
50
|
+
get pageCount() {
|
51
|
+
return this.meta.pageCount;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
const _ApiResourceAdapter = class _ApiResourceAdapter {
|
55
|
+
static init(config2) {
|
56
|
+
return _ApiResourceAdapter.adapter = new ResourceAdapter(config2);
|
57
|
+
}
|
58
|
+
static get(config2) {
|
59
|
+
if (config2) return _ApiResourceAdapter.init(config2);
|
60
|
+
else {
|
61
|
+
if (_ApiResourceAdapter.adapter) return _ApiResourceAdapter.adapter;
|
62
|
+
else throw new SdkError({ message: "RersourceAdapter not initialized" });
|
63
|
+
}
|
64
|
+
}
|
65
|
+
static config(config2) {
|
66
|
+
_ApiResourceAdapter.get().config(config2);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
__publicField(_ApiResourceAdapter, "adapter");
|
70
|
+
let ApiResourceAdapter = _ApiResourceAdapter;
|
71
|
+
class ResourceAdapter {
|
72
|
+
constructor(config2) {
|
73
|
+
__privateAdd(this, _client);
|
74
|
+
__privateAdd(this, _config, {});
|
75
|
+
__privateSet(this, _client, ApiClient.create(config2));
|
76
|
+
this.localConfig(config2);
|
77
|
+
}
|
78
|
+
localConfig(config2) {
|
79
|
+
}
|
80
|
+
config(config2) {
|
81
|
+
debug("config %o", config2);
|
82
|
+
this.localConfig(config2);
|
83
|
+
__privateGet(this, _client).config(config2);
|
84
|
+
return this;
|
85
|
+
}
|
86
|
+
get client() {
|
87
|
+
return __privateGet(this, _client);
|
88
|
+
}
|
89
|
+
async singleton(resource, params, options, path) {
|
90
|
+
debug("singleton: %o, %O, %O", resource, params || {}, options || {});
|
91
|
+
const queryParams = generateQueryStringParams(params, resource);
|
92
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
93
|
+
const res = await __privateGet(this, _client).request("GET", `${path || resource.type}`, void 0, { ...options, params: queryParams });
|
94
|
+
const r = denormalize(res);
|
95
|
+
return r;
|
96
|
+
}
|
97
|
+
async retrieve(resource, params, options) {
|
98
|
+
debug("retrieve: %o, %O, %O", resource, params || {}, options || {});
|
99
|
+
const queryParams = generateQueryStringParams(params, resource);
|
100
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
101
|
+
const res = await __privateGet(this, _client).request("GET", `${resource.type}/${resource.id}`, void 0, { ...options, params: queryParams });
|
102
|
+
const r = denormalize(res);
|
103
|
+
return r;
|
104
|
+
}
|
105
|
+
async list(resource, params, options) {
|
106
|
+
debug("list: %o, %O, %O", resource, params || {}, options || {});
|
107
|
+
const queryParams = generateQueryStringParams(params, resource);
|
108
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
109
|
+
if (!queryParams["page[number]"]) queryParams["page[number]"] = "1";
|
110
|
+
const res = await __privateGet(this, _client).request("GET", `${resource.type}`, void 0, { ...options, params: queryParams });
|
111
|
+
const r = denormalize(res);
|
112
|
+
const meta = {
|
113
|
+
pageCount: Number(res.meta?.page_count),
|
114
|
+
recordCount: Number(res.meta?.record_count),
|
115
|
+
currentPage: params?.pageNumber || config.default.pageNumber,
|
116
|
+
recordsPerPage: params?.pageSize || config.default.pageSize
|
117
|
+
};
|
118
|
+
return new ListResponse(meta, r);
|
119
|
+
}
|
120
|
+
async create(resource, params, options) {
|
121
|
+
debug("create: %o, %O, %O", resource, params || {}, options || {});
|
122
|
+
const queryParams = generateQueryStringParams(params, resource);
|
123
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
124
|
+
const data = normalize(resource);
|
125
|
+
const res = await __privateGet(this, _client).request("POST", resource.type, data, { ...options, params: queryParams });
|
126
|
+
const r = denormalize(res);
|
127
|
+
return r;
|
128
|
+
}
|
129
|
+
async update(resource, params, options) {
|
130
|
+
debug("update: %o, %O, %O", resource, params || {}, options || {});
|
131
|
+
const queryParams = generateQueryStringParams(params, resource);
|
132
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
133
|
+
const data = normalize(resource);
|
134
|
+
const res = await __privateGet(this, _client).request("PATCH", `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
|
135
|
+
const r = denormalize(res);
|
136
|
+
return r;
|
137
|
+
}
|
138
|
+
async delete(resource, options) {
|
139
|
+
debug("delete: %o, %O", resource, options || {});
|
140
|
+
await __privateGet(this, _client).request("DELETE", `${resource.type}/${resource.id}`, void 0, options);
|
141
|
+
}
|
142
|
+
async fetch(resource, path, params, options) {
|
143
|
+
debug("fetch: %o, %O, %O", path, params || {}, options || {});
|
144
|
+
const queryParams = generateQueryStringParams(params, resource);
|
145
|
+
if (options?.params) Object.assign(queryParams, options?.params);
|
146
|
+
const res = await __privateGet(this, _client).request("GET", path, void 0, { ...options, params: queryParams });
|
147
|
+
const r = denormalize(res);
|
148
|
+
if (Array.isArray(r)) {
|
149
|
+
const p = params;
|
150
|
+
const meta = {
|
151
|
+
pageCount: Number(res.meta?.page_count),
|
152
|
+
recordCount: Number(res.meta?.record_count),
|
153
|
+
currentPage: p?.pageNumber || config.default.pageNumber,
|
154
|
+
recordsPerPage: p?.pageSize || config.default.pageSize
|
155
|
+
};
|
156
|
+
return new ListResponse(meta, r);
|
157
|
+
} else return r;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
_client = new WeakMap();
|
161
|
+
_config = new WeakMap();
|
162
|
+
class ApiResourceBase {
|
163
|
+
constructor(adapter) {
|
164
|
+
__privateAdd(this, _resources);
|
165
|
+
debug("new resource instance: %s", this.type());
|
166
|
+
__privateSet(this, _resources, adapter);
|
167
|
+
}
|
168
|
+
get resources() {
|
169
|
+
return __privateGet(this, _resources) || __privateSet(this, _resources, ApiResourceAdapter.get());
|
170
|
+
}
|
171
|
+
relationshipOneToOne(id) {
|
172
|
+
return id === null || typeof id === "string" ? { id, type: this.type() } : { id: id.id, type: this.type() };
|
173
|
+
}
|
174
|
+
relationshipOneToMany(...ids) {
|
175
|
+
return ids === null || ids.length === 0 || ids[0] === null ? [{ id: null, type: this.type() }] : ids.map((id) => {
|
176
|
+
return { id, type: this.type() };
|
177
|
+
});
|
178
|
+
}
|
179
|
+
path() {
|
180
|
+
return this.type();
|
181
|
+
}
|
182
|
+
// reference, reference_origin and metadata attributes are always updatable
|
183
|
+
async update(resource, params, options) {
|
184
|
+
return this.resources.update({ ...resource, type: this.type() }, params, options);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
_resources = new WeakMap();
|
188
|
+
__publicField(ApiResourceBase, "TYPE");
|
189
|
+
class ApiResource extends ApiResourceBase {
|
190
|
+
async retrieve(id, params, options) {
|
191
|
+
return this.resources.retrieve(typeof id === "string" ? { type: this.type(), id } : id, params, options);
|
192
|
+
}
|
193
|
+
async list(params, options) {
|
194
|
+
return this.resources.list({ type: this.type() }, params, options);
|
195
|
+
}
|
196
|
+
async count(filter, options) {
|
197
|
+
const params = { filters: isParamsList(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
|
198
|
+
const response = await this.list(params, options);
|
199
|
+
return Promise.resolve(response.meta.recordCount);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
class ApiSingleton extends ApiResourceBase {
|
203
|
+
async retrieve(params, options) {
|
204
|
+
return this.resources.singleton({ type: this.type() }, params, options, this.path());
|
205
|
+
}
|
206
|
+
}
|
207
|
+
var resource_default = ResourceAdapter;
|
208
|
+
|
209
|
+
export { ApiResource, ApiResourceAdapter, ApiSingleton, resource_default as default };
|
@@ -0,0 +1,53 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var resource = require('../resource');
|
4
|
+
|
5
|
+
var __defProp = Object.defineProperty;
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
7
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
8
|
+
const _Addresses = class _Addresses extends resource.ApiResource {
|
9
|
+
async create(resource, params, options) {
|
10
|
+
return this.resources.create({ ...resource, type: _Addresses.TYPE }, params, options);
|
11
|
+
}
|
12
|
+
async update(resource, params, options) {
|
13
|
+
return this.resources.update({ ...resource, type: _Addresses.TYPE }, params, options);
|
14
|
+
}
|
15
|
+
async delete(id, options) {
|
16
|
+
await this.resources.delete(typeof id === "string" ? { id, type: _Addresses.TYPE } : id, options);
|
17
|
+
}
|
18
|
+
async geocoder(addressId, params, options) {
|
19
|
+
const _addressId = addressId.id || addressId;
|
20
|
+
return this.resources.fetch({ type: "geocoders" }, `addresses/${_addressId}/geocoder`, params, options);
|
21
|
+
}
|
22
|
+
async events(addressId, params, options) {
|
23
|
+
const _addressId = addressId.id || addressId;
|
24
|
+
return this.resources.fetch({ type: "events" }, `addresses/${_addressId}/events`, params, options);
|
25
|
+
}
|
26
|
+
async tags(addressId, params, options) {
|
27
|
+
const _addressId = addressId.id || addressId;
|
28
|
+
return this.resources.fetch({ type: "tags" }, `addresses/${_addressId}/tags`, params, options);
|
29
|
+
}
|
30
|
+
async versions(addressId, params, options) {
|
31
|
+
const _addressId = addressId.id || addressId;
|
32
|
+
return this.resources.fetch({ type: "versions" }, `addresses/${_addressId}/versions`, params, options);
|
33
|
+
}
|
34
|
+
isAddress(resource) {
|
35
|
+
return resource.type && resource.type === _Addresses.TYPE;
|
36
|
+
}
|
37
|
+
relationship(id) {
|
38
|
+
return super.relationshipOneToOne(id);
|
39
|
+
}
|
40
|
+
relationshipToMany(...ids) {
|
41
|
+
return super.relationshipOneToMany(...ids);
|
42
|
+
}
|
43
|
+
type() {
|
44
|
+
return _Addresses.TYPE;
|
45
|
+
}
|
46
|
+
};
|
47
|
+
__publicField(_Addresses, "TYPE", "addresses");
|
48
|
+
let Addresses = _Addresses;
|
49
|
+
var addresses_default = Addresses;
|
50
|
+
|
51
|
+
module.exports = addresses_default;
|
52
|
+
|
53
|
+
module.exports = exports.default;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
6
|
+
const _Addresses = class _Addresses extends ApiResource {
|
7
|
+
async create(resource, params, options) {
|
8
|
+
return this.resources.create({ ...resource, type: _Addresses.TYPE }, params, options);
|
9
|
+
}
|
10
|
+
async update(resource, params, options) {
|
11
|
+
return this.resources.update({ ...resource, type: _Addresses.TYPE }, params, options);
|
12
|
+
}
|
13
|
+
async delete(id, options) {
|
14
|
+
await this.resources.delete(typeof id === "string" ? { id, type: _Addresses.TYPE } : id, options);
|
15
|
+
}
|
16
|
+
async geocoder(addressId, params, options) {
|
17
|
+
const _addressId = addressId.id || addressId;
|
18
|
+
return this.resources.fetch({ type: "geocoders" }, `addresses/${_addressId}/geocoder`, params, options);
|
19
|
+
}
|
20
|
+
async events(addressId, params, options) {
|
21
|
+
const _addressId = addressId.id || addressId;
|
22
|
+
return this.resources.fetch({ type: "events" }, `addresses/${_addressId}/events`, params, options);
|
23
|
+
}
|
24
|
+
async tags(addressId, params, options) {
|
25
|
+
const _addressId = addressId.id || addressId;
|
26
|
+
return this.resources.fetch({ type: "tags" }, `addresses/${_addressId}/tags`, params, options);
|
27
|
+
}
|
28
|
+
async versions(addressId, params, options) {
|
29
|
+
const _addressId = addressId.id || addressId;
|
30
|
+
return this.resources.fetch({ type: "versions" }, `addresses/${_addressId}/versions`, params, options);
|
31
|
+
}
|
32
|
+
isAddress(resource) {
|
33
|
+
return resource.type && resource.type === _Addresses.TYPE;
|
34
|
+
}
|
35
|
+
relationship(id) {
|
36
|
+
return super.relationshipOneToOne(id);
|
37
|
+
}
|
38
|
+
relationshipToMany(...ids) {
|
39
|
+
return super.relationshipOneToMany(...ids);
|
40
|
+
}
|
41
|
+
type() {
|
42
|
+
return _Addresses.TYPE;
|
43
|
+
}
|
44
|
+
};
|
45
|
+
__publicField(_Addresses, "TYPE", "addresses");
|
46
|
+
let Addresses = _Addresses;
|
47
|
+
var addresses_default = Addresses;
|
48
|
+
|
49
|
+
export { addresses_default as default };
|
@@ -0,0 +1,41 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var resource = require('../resource');
|
4
|
+
|
5
|
+
var __defProp = Object.defineProperty;
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
7
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
8
|
+
const _Adjustments = class _Adjustments extends resource.ApiResource {
|
9
|
+
async create(resource, params, options) {
|
10
|
+
return this.resources.create({ ...resource, type: _Adjustments.TYPE }, params, options);
|
11
|
+
}
|
12
|
+
async update(resource, params, options) {
|
13
|
+
return this.resources.update({ ...resource, type: _Adjustments.TYPE }, params, options);
|
14
|
+
}
|
15
|
+
async delete(id, options) {
|
16
|
+
await this.resources.delete(typeof id === "string" ? { id, type: _Adjustments.TYPE } : id, options);
|
17
|
+
}
|
18
|
+
async versions(adjustmentId, params, options) {
|
19
|
+
const _adjustmentId = adjustmentId.id || adjustmentId;
|
20
|
+
return this.resources.fetch({ type: "versions" }, `adjustments/${_adjustmentId}/versions`, params, options);
|
21
|
+
}
|
22
|
+
isAdjustment(resource) {
|
23
|
+
return resource.type && resource.type === _Adjustments.TYPE;
|
24
|
+
}
|
25
|
+
relationship(id) {
|
26
|
+
return super.relationshipOneToOne(id);
|
27
|
+
}
|
28
|
+
relationshipToMany(...ids) {
|
29
|
+
return super.relationshipOneToMany(...ids);
|
30
|
+
}
|
31
|
+
type() {
|
32
|
+
return _Adjustments.TYPE;
|
33
|
+
}
|
34
|
+
};
|
35
|
+
__publicField(_Adjustments, "TYPE", "adjustments");
|
36
|
+
let Adjustments = _Adjustments;
|
37
|
+
var adjustments_default = Adjustments;
|
38
|
+
|
39
|
+
module.exports = adjustments_default;
|
40
|
+
|
41
|
+
module.exports = exports.default;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
6
|
+
const _Adjustments = class _Adjustments extends ApiResource {
|
7
|
+
async create(resource, params, options) {
|
8
|
+
return this.resources.create({ ...resource, type: _Adjustments.TYPE }, params, options);
|
9
|
+
}
|
10
|
+
async update(resource, params, options) {
|
11
|
+
return this.resources.update({ ...resource, type: _Adjustments.TYPE }, params, options);
|
12
|
+
}
|
13
|
+
async delete(id, options) {
|
14
|
+
await this.resources.delete(typeof id === "string" ? { id, type: _Adjustments.TYPE } : id, options);
|
15
|
+
}
|
16
|
+
async versions(adjustmentId, params, options) {
|
17
|
+
const _adjustmentId = adjustmentId.id || adjustmentId;
|
18
|
+
return this.resources.fetch({ type: "versions" }, `adjustments/${_adjustmentId}/versions`, params, options);
|
19
|
+
}
|
20
|
+
isAdjustment(resource) {
|
21
|
+
return resource.type && resource.type === _Adjustments.TYPE;
|
22
|
+
}
|
23
|
+
relationship(id) {
|
24
|
+
return super.relationshipOneToOne(id);
|
25
|
+
}
|
26
|
+
relationshipToMany(...ids) {
|
27
|
+
return super.relationshipOneToMany(...ids);
|
28
|
+
}
|
29
|
+
type() {
|
30
|
+
return _Adjustments.TYPE;
|
31
|
+
}
|
32
|
+
};
|
33
|
+
__publicField(_Adjustments, "TYPE", "adjustments");
|
34
|
+
let Adjustments = _Adjustments;
|
35
|
+
var adjustments_default = Adjustments;
|
36
|
+
|
37
|
+
export { adjustments_default as default };
|