@commercelayer/sdk 7.0.0-beta.8 → 7.0.0-rc.1
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/README.md +48 -35
- package/lib/api-DDgIE2i8.d.ts +17175 -0
- package/lib/api-DmIZO_Np.d.cts +17175 -0
- package/lib/api.cjs +796 -0
- package/lib/api.cjs.map +1 -0
- package/lib/api.d.cts +4 -0
- package/lib/api.d.ts +4 -0
- package/lib/api.js +133 -0
- package/lib/api.js.map +1 -0
- package/lib/client.cjs +160 -0
- package/lib/client.cjs.map +1 -0
- package/lib/client.d.cts +36 -0
- package/lib/client.d.ts +36 -0
- package/lib/client.js +151 -0
- package/lib/client.js.map +1 -0
- package/lib/commercelayer.cjs +114 -0
- package/lib/commercelayer.cjs.map +1 -0
- package/lib/commercelayer.d.cts +36 -0
- package/lib/commercelayer.d.ts +36 -0
- package/lib/commercelayer.js +104 -0
- package/lib/commercelayer.js.map +1 -0
- package/lib/config.cjs +23 -0
- package/lib/config.cjs.map +1 -0
- package/lib/config.d.cts +19 -0
- package/lib/config.d.ts +19 -0
- package/lib/config.js +19 -0
- package/lib/config.js.map +1 -0
- package/lib/debug.cjs +21 -0
- package/lib/debug.cjs.map +1 -0
- package/lib/debug.d.cts +4 -0
- package/lib/debug.d.ts +4 -0
- package/lib/debug.js +17 -0
- package/lib/debug.js.map +1 -0
- package/lib/enum.cjs +659 -0
- package/lib/enum.cjs.map +1 -0
- package/lib/enum.d.cts +4 -0
- package/lib/enum.d.ts +4 -0
- package/lib/enum.js +643 -0
- package/lib/enum.js.map +1 -0
- package/lib/error.cjs +101 -0
- package/lib/error.cjs.map +1 -0
- package/lib/error.d.cts +38 -0
- package/lib/error.d.ts +38 -0
- package/lib/error.js +93 -0
- package/lib/error.js.map +1 -0
- package/lib/fetch.cjs +69 -0
- package/lib/fetch.cjs.map +1 -0
- package/lib/fetch.d.cts +1 -0
- package/lib/fetch.d.ts +1 -0
- package/lib/fetch.js +62 -0
- package/lib/fetch.js.map +1 -0
- package/lib/index.cjs +34 -2
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.cts +7 -17201
- package/lib/index.d.ts +7 -17201
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -0
- package/lib/interceptor-5MISI1yn.d.cts +54 -0
- package/lib/interceptor-5MISI1yn.d.ts +54 -0
- package/lib/interceptor.cjs +4 -0
- package/lib/interceptor.cjs.map +1 -0
- package/lib/interceptor.d.cts +1 -0
- package/lib/interceptor.d.ts +1 -0
- package/lib/interceptor.js +3 -0
- package/lib/interceptor.js.map +1 -0
- package/lib/jsonapi.cjs +81 -0
- package/lib/jsonapi.cjs.map +1 -0
- package/lib/jsonapi.d.cts +11 -0
- package/lib/jsonapi.d.ts +11 -0
- package/lib/jsonapi.js +73 -0
- package/lib/jsonapi.js.map +1 -0
- package/lib/model.cjs +4 -0
- package/lib/model.cjs.map +1 -0
- package/lib/model.d.cts +4 -0
- package/lib/model.d.ts +4 -0
- package/lib/model.js +3 -0
- package/lib/model.js.map +1 -0
- package/lib/query.cjs +66 -0
- package/lib/query.cjs.map +1 -0
- package/lib/query.d.cts +4 -0
- package/lib/query.d.ts +4 -0
- package/lib/query.js +58 -0
- package/lib/query.js.map +1 -0
- package/lib/resource.cjs +218 -0
- package/lib/resource.cjs.map +1 -0
- package/lib/resource.d.cts +4 -0
- package/lib/resource.d.ts +4 -0
- package/lib/resource.js +206 -0
- package/lib/resource.js.map +1 -0
- package/lib/resources/addresses.cjs +58 -0
- package/lib/resources/addresses.cjs.map +1 -0
- package/lib/resources/addresses.d.cts +4 -0
- package/lib/resources/addresses.d.ts +4 -0
- package/lib/resources/addresses.js +54 -0
- package/lib/resources/addresses.js.map +1 -0
- package/lib/resources/adjustments.cjs +40 -0
- package/lib/resources/adjustments.cjs.map +1 -0
- package/lib/resources/adjustments.d.cts +4 -0
- package/lib/resources/adjustments.d.ts +4 -0
- package/lib/resources/adjustments.js +36 -0
- package/lib/resources/adjustments.js.map +1 -0
- package/lib/resources/adyen_gateways.cjs +48 -0
- package/lib/resources/adyen_gateways.cjs.map +1 -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 +44 -0
- package/lib/resources/adyen_gateways.js.map +1 -0
- package/lib/resources/adyen_payments.cjs +54 -0
- package/lib/resources/adyen_payments.cjs.map +1 -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 +50 -0
- package/lib/resources/adyen_payments.js.map +1 -0
- package/lib/resources/applications.cjs +30 -0
- package/lib/resources/applications.cjs.map +1 -0
- package/lib/resources/applications.d.cts +4 -0
- package/lib/resources/applications.d.ts +4 -0
- package/lib/resources/applications.js +26 -0
- package/lib/resources/applications.js.map +1 -0
- package/lib/resources/attachments.cjs +36 -0
- package/lib/resources/attachments.cjs.map +1 -0
- package/lib/resources/attachments.d.cts +4 -0
- package/lib/resources/attachments.d.ts +4 -0
- package/lib/resources/attachments.js +32 -0
- package/lib/resources/attachments.js.map +1 -0
- package/lib/resources/authorizations.cjs +69 -0
- package/lib/resources/authorizations.cjs.map +1 -0
- package/lib/resources/authorizations.d.cts +4 -0
- package/lib/resources/authorizations.d.ts +4 -0
- package/lib/resources/authorizations.js +65 -0
- package/lib/resources/authorizations.js.map +1 -0
- package/lib/resources/avalara_accounts.cjs +56 -0
- package/lib/resources/avalara_accounts.cjs.map +1 -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 +52 -0
- package/lib/resources/avalara_accounts.js.map +1 -0
- package/lib/resources/axerve_gateways.cjs +48 -0
- package/lib/resources/axerve_gateways.cjs.map +1 -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 +44 -0
- package/lib/resources/axerve_gateways.js.map +1 -0
- package/lib/resources/axerve_payments.cjs +51 -0
- package/lib/resources/axerve_payments.cjs.map +1 -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 +47 -0
- package/lib/resources/axerve_payments.js.map +1 -0
- package/lib/resources/bing_geocoders.cjs +48 -0
- package/lib/resources/bing_geocoders.cjs.map +1 -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 +44 -0
- package/lib/resources/bing_geocoders.js.map +1 -0
- package/lib/resources/braintree_gateways.cjs +48 -0
- package/lib/resources/braintree_gateways.cjs.map +1 -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 +44 -0
- package/lib/resources/braintree_gateways.js.map +1 -0
- package/lib/resources/braintree_payments.cjs +48 -0
- package/lib/resources/braintree_payments.cjs.map +1 -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 +44 -0
- package/lib/resources/braintree_payments.js.map +1 -0
- package/lib/resources/bundles.cjs +76 -0
- package/lib/resources/bundles.cjs.map +1 -0
- package/lib/resources/bundles.d.cts +4 -0
- package/lib/resources/bundles.d.ts +4 -0
- package/lib/resources/bundles.js +72 -0
- package/lib/resources/bundles.js.map +1 -0
- package/lib/resources/buy_x_pay_y_promotions.cjs +96 -0
- package/lib/resources/buy_x_pay_y_promotions.cjs.map +1 -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 +92 -0
- package/lib/resources/buy_x_pay_y_promotions.js.map +1 -0
- package/lib/resources/captures.cjs +70 -0
- package/lib/resources/captures.cjs.map +1 -0
- package/lib/resources/captures.d.cts +4 -0
- package/lib/resources/captures.d.ts +4 -0
- package/lib/resources/captures.js +66 -0
- package/lib/resources/captures.js.map +1 -0
- package/lib/resources/carrier_accounts.cjs +48 -0
- package/lib/resources/carrier_accounts.cjs.map +1 -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 +44 -0
- package/lib/resources/carrier_accounts.js.map +1 -0
- package/lib/resources/checkout_com_gateways.cjs +48 -0
- package/lib/resources/checkout_com_gateways.cjs.map +1 -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 +44 -0
- package/lib/resources/checkout_com_gateways.js.map +1 -0
- package/lib/resources/checkout_com_payments.cjs +54 -0
- package/lib/resources/checkout_com_payments.cjs.map +1 -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 +50 -0
- package/lib/resources/checkout_com_payments.js.map +1 -0
- package/lib/resources/cleanups.cjs +47 -0
- package/lib/resources/cleanups.cjs.map +1 -0
- package/lib/resources/cleanups.d.cts +4 -0
- package/lib/resources/cleanups.d.ts +4 -0
- package/lib/resources/cleanups.js +43 -0
- package/lib/resources/cleanups.js.map +1 -0
- package/lib/resources/coupon_codes_promotion_rules.cjs +44 -0
- package/lib/resources/coupon_codes_promotion_rules.cjs.map +1 -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 +40 -0
- package/lib/resources/coupon_codes_promotion_rules.js.map +1 -0
- package/lib/resources/coupon_recipients.cjs +48 -0
- package/lib/resources/coupon_recipients.cjs.map +1 -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 +44 -0
- package/lib/resources/coupon_recipients.js.map +1 -0
- package/lib/resources/coupons.cjs +62 -0
- package/lib/resources/coupons.cjs.map +1 -0
- package/lib/resources/coupons.d.cts +4 -0
- package/lib/resources/coupons.d.ts +4 -0
- package/lib/resources/coupons.js +58 -0
- package/lib/resources/coupons.js.map +1 -0
- package/lib/resources/custom_promotion_rules.cjs +40 -0
- package/lib/resources/custom_promotion_rules.cjs.map +1 -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 +36 -0
- package/lib/resources/custom_promotion_rules.js.map +1 -0
- package/lib/resources/customer_addresses.cjs +52 -0
- package/lib/resources/customer_addresses.cjs.map +1 -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 +48 -0
- package/lib/resources/customer_addresses.js.map +1 -0
- package/lib/resources/customer_groups.cjs +52 -0
- package/lib/resources/customer_groups.cjs.map +1 -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 +48 -0
- package/lib/resources/customer_groups.js.map +1 -0
- package/lib/resources/customer_password_resets.cjs +47 -0
- package/lib/resources/customer_password_resets.cjs.map +1 -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 +43 -0
- package/lib/resources/customer_password_resets.js.map +1 -0
- package/lib/resources/customer_payment_sources.cjs +48 -0
- package/lib/resources/customer_payment_sources.cjs.map +1 -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 +44 -0
- package/lib/resources/customer_payment_sources.js.map +1 -0
- package/lib/resources/customer_subscriptions.cjs +48 -0
- package/lib/resources/customer_subscriptions.cjs.map +1 -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 +44 -0
- package/lib/resources/customer_subscriptions.js.map +1 -0
- package/lib/resources/customers.cjs +86 -0
- package/lib/resources/customers.cjs.map +1 -0
- package/lib/resources/customers.d.cts +4 -0
- package/lib/resources/customers.d.ts +4 -0
- package/lib/resources/customers.js +82 -0
- package/lib/resources/customers.js.map +1 -0
- package/lib/resources/delivery_lead_times.cjs +52 -0
- package/lib/resources/delivery_lead_times.cjs.map +1 -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 +48 -0
- package/lib/resources/delivery_lead_times.js.map +1 -0
- package/lib/resources/discount_engine_items.cjs +35 -0
- package/lib/resources/discount_engine_items.cjs.map +1 -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 +31 -0
- package/lib/resources/discount_engine_items.js.map +1 -0
- package/lib/resources/discount_engines.cjs +43 -0
- package/lib/resources/discount_engines.cjs.map +1 -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 +39 -0
- package/lib/resources/discount_engines.js.map +1 -0
- package/lib/resources/easypost_pickups.cjs +51 -0
- package/lib/resources/easypost_pickups.cjs.map +1 -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 +47 -0
- package/lib/resources/easypost_pickups.js.map +1 -0
- package/lib/resources/event_callbacks.cjs +31 -0
- package/lib/resources/event_callbacks.cjs.map +1 -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 +27 -0
- package/lib/resources/event_callbacks.js.map +1 -0
- package/lib/resources/events.cjs +41 -0
- package/lib/resources/events.cjs.map +1 -0
- package/lib/resources/events.d.cts +4 -0
- package/lib/resources/events.d.ts +4 -0
- package/lib/resources/events.js +37 -0
- package/lib/resources/events.js.map +1 -0
- package/lib/resources/exports.cjs +47 -0
- package/lib/resources/exports.cjs.map +1 -0
- package/lib/resources/exports.d.cts +4 -0
- package/lib/resources/exports.d.ts +4 -0
- package/lib/resources/exports.js +43 -0
- package/lib/resources/exports.js.map +1 -0
- package/lib/resources/external_gateways.cjs +51 -0
- package/lib/resources/external_gateways.cjs.map +1 -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 +47 -0
- package/lib/resources/external_gateways.js.map +1 -0
- package/lib/resources/external_payments.cjs +52 -0
- package/lib/resources/external_payments.cjs.map +1 -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 +48 -0
- package/lib/resources/external_payments.js.map +1 -0
- package/lib/resources/external_promotions.cjs +99 -0
- package/lib/resources/external_promotions.cjs.map +1 -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 +95 -0
- package/lib/resources/external_promotions.js.map +1 -0
- package/lib/resources/external_tax_calculators.cjs +55 -0
- package/lib/resources/external_tax_calculators.cjs.map +1 -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 +51 -0
- package/lib/resources/external_tax_calculators.js.map +1 -0
- package/lib/resources/fixed_amount_promotions.cjs +96 -0
- package/lib/resources/fixed_amount_promotions.cjs.map +1 -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 +92 -0
- package/lib/resources/fixed_amount_promotions.js.map +1 -0
- package/lib/resources/fixed_price_promotions.cjs +96 -0
- package/lib/resources/fixed_price_promotions.cjs.map +1 -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 +92 -0
- package/lib/resources/fixed_price_promotions.js.map +1 -0
- package/lib/resources/flex_promotions.cjs +72 -0
- package/lib/resources/flex_promotions.cjs.map +1 -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 +68 -0
- package/lib/resources/flex_promotions.js.map +1 -0
- package/lib/resources/free_gift_promotions.cjs +96 -0
- package/lib/resources/free_gift_promotions.cjs.map +1 -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 +92 -0
- package/lib/resources/free_gift_promotions.js.map +1 -0
- package/lib/resources/free_shipping_promotions.cjs +92 -0
- package/lib/resources/free_shipping_promotions.cjs.map +1 -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 +88 -0
- package/lib/resources/free_shipping_promotions.js.map +1 -0
- package/lib/resources/geocoders.cjs +39 -0
- package/lib/resources/geocoders.cjs.map +1 -0
- package/lib/resources/geocoders.d.cts +4 -0
- package/lib/resources/geocoders.d.ts +4 -0
- package/lib/resources/geocoders.js +35 -0
- package/lib/resources/geocoders.js.map +1 -0
- package/lib/resources/gift_card_recipients.cjs +48 -0
- package/lib/resources/gift_card_recipients.cjs.map +1 -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 +44 -0
- package/lib/resources/gift_card_recipients.js.map +1 -0
- package/lib/resources/gift_cards.cjs +78 -0
- package/lib/resources/gift_cards.cjs.map +1 -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 +74 -0
- package/lib/resources/gift_cards.js.map +1 -0
- package/lib/resources/google_geocoders.cjs +48 -0
- package/lib/resources/google_geocoders.cjs.map +1 -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 +44 -0
- package/lib/resources/google_geocoders.js.map +1 -0
- package/lib/resources/imports.cjs +43 -0
- package/lib/resources/imports.cjs.map +1 -0
- package/lib/resources/imports.d.cts +4 -0
- package/lib/resources/imports.d.ts +4 -0
- package/lib/resources/imports.js +39 -0
- package/lib/resources/imports.js.map +1 -0
- package/lib/resources/in_stock_subscriptions.cjs +62 -0
- package/lib/resources/in_stock_subscriptions.cjs.map +1 -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 +58 -0
- package/lib/resources/in_stock_subscriptions.js.map +1 -0
- package/lib/resources/inventory_models.cjs +52 -0
- package/lib/resources/inventory_models.cjs.map +1 -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 +48 -0
- package/lib/resources/inventory_models.js.map +1 -0
- package/lib/resources/inventory_return_locations.cjs +48 -0
- package/lib/resources/inventory_return_locations.cjs.map +1 -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 +44 -0
- package/lib/resources/inventory_return_locations.js.map +1 -0
- package/lib/resources/inventory_stock_locations.cjs +48 -0
- package/lib/resources/inventory_stock_locations.cjs.map +1 -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 +44 -0
- package/lib/resources/inventory_stock_locations.js.map +1 -0
- package/lib/resources/klarna_gateways.cjs +48 -0
- package/lib/resources/klarna_gateways.cjs.map +1 -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 +44 -0
- package/lib/resources/klarna_gateways.js.map +1 -0
- package/lib/resources/klarna_payments.cjs +51 -0
- package/lib/resources/klarna_payments.cjs.map +1 -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 +47 -0
- package/lib/resources/klarna_payments.js.map +1 -0
- package/lib/resources/line_item_options.cjs +58 -0
- package/lib/resources/line_item_options.cjs.map +1 -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 +54 -0
- package/lib/resources/line_item_options.js.map +1 -0
- package/lib/resources/line_items.cjs +87 -0
- package/lib/resources/line_items.cjs.map +1 -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 +83 -0
- package/lib/resources/line_items.js.map +1 -0
- package/lib/resources/links.cjs +46 -0
- package/lib/resources/links.cjs.map +1 -0
- package/lib/resources/links.d.cts +4 -0
- package/lib/resources/links.d.ts +4 -0
- package/lib/resources/links.js +42 -0
- package/lib/resources/links.js.map +1 -0
- package/lib/resources/manual_gateways.cjs +44 -0
- package/lib/resources/manual_gateways.cjs.map +1 -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 +40 -0
- package/lib/resources/manual_gateways.js.map +1 -0
- package/lib/resources/manual_tax_calculators.cjs +56 -0
- package/lib/resources/manual_tax_calculators.cjs.map +1 -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 +52 -0
- package/lib/resources/manual_tax_calculators.js.map +1 -0
- package/lib/resources/markets.cjs +98 -0
- package/lib/resources/markets.cjs.map +1 -0
- package/lib/resources/markets.d.cts +4 -0
- package/lib/resources/markets.d.ts +4 -0
- package/lib/resources/markets.js +94 -0
- package/lib/resources/markets.js.map +1 -0
- package/lib/resources/merchants.cjs +48 -0
- package/lib/resources/merchants.cjs.map +1 -0
- package/lib/resources/merchants.d.cts +4 -0
- package/lib/resources/merchants.d.ts +4 -0
- package/lib/resources/merchants.js +44 -0
- package/lib/resources/merchants.js.map +1 -0
- package/lib/resources/notifications.cjs +36 -0
- package/lib/resources/notifications.cjs.map +1 -0
- package/lib/resources/notifications.d.cts +4 -0
- package/lib/resources/notifications.d.ts +4 -0
- package/lib/resources/notifications.js +32 -0
- package/lib/resources/notifications.js.map +1 -0
- package/lib/resources/order_amount_promotion_rules.cjs +40 -0
- package/lib/resources/order_amount_promotion_rules.cjs.map +1 -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 +36 -0
- package/lib/resources/order_amount_promotion_rules.js.map +1 -0
- package/lib/resources/order_copies.cjs +52 -0
- package/lib/resources/order_copies.cjs.map +1 -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 +48 -0
- package/lib/resources/order_copies.js.map +1 -0
- package/lib/resources/order_factories.cjs +39 -0
- package/lib/resources/order_factories.cjs.map +1 -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 +35 -0
- package/lib/resources/order_factories.js.map +1 -0
- package/lib/resources/order_subscription_items.cjs +44 -0
- package/lib/resources/order_subscription_items.cjs.map +1 -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 +40 -0
- package/lib/resources/order_subscription_items.js.map +1 -0
- package/lib/resources/order_subscriptions.cjs +102 -0
- package/lib/resources/order_subscriptions.cjs.map +1 -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 +98 -0
- package/lib/resources/order_subscriptions.js.map +1 -0
- package/lib/resources/orders.cjs +279 -0
- package/lib/resources/orders.cjs.map +1 -0
- package/lib/resources/orders.d.cts +4 -0
- package/lib/resources/orders.d.ts +4 -0
- package/lib/resources/orders.js +275 -0
- package/lib/resources/orders.js.map +1 -0
- package/lib/resources/organizations.cjs +30 -0
- package/lib/resources/organizations.cjs.map +1 -0
- package/lib/resources/organizations.d.cts +4 -0
- package/lib/resources/organizations.d.ts +4 -0
- package/lib/resources/organizations.js +26 -0
- package/lib/resources/organizations.js.map +1 -0
- package/lib/resources/packages.cjs +52 -0
- package/lib/resources/packages.cjs.map +1 -0
- package/lib/resources/packages.d.cts +4 -0
- package/lib/resources/packages.d.ts +4 -0
- package/lib/resources/packages.js +48 -0
- package/lib/resources/packages.js.map +1 -0
- package/lib/resources/parcel_line_items.cjs +48 -0
- package/lib/resources/parcel_line_items.cjs.map +1 -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 +44 -0
- package/lib/resources/parcel_line_items.js.map +1 -0
- package/lib/resources/parcels.cjs +60 -0
- package/lib/resources/parcels.cjs.map +1 -0
- package/lib/resources/parcels.d.cts +4 -0
- package/lib/resources/parcels.d.ts +4 -0
- package/lib/resources/parcels.js +56 -0
- package/lib/resources/parcels.js.map +1 -0
- package/lib/resources/payment_gateways.cjs +35 -0
- package/lib/resources/payment_gateways.cjs.map +1 -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 +31 -0
- package/lib/resources/payment_gateways.js.map +1 -0
- package/lib/resources/payment_methods.cjs +66 -0
- package/lib/resources/payment_methods.cjs.map +1 -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 +62 -0
- package/lib/resources/payment_methods.js.map +1 -0
- package/lib/resources/payment_options.cjs +44 -0
- package/lib/resources/payment_options.cjs.map +1 -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 +40 -0
- package/lib/resources/payment_options.js.map +1 -0
- package/lib/resources/paypal_gateways.cjs +48 -0
- package/lib/resources/paypal_gateways.cjs.map +1 -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 +44 -0
- package/lib/resources/paypal_gateways.js.map +1 -0
- package/lib/resources/paypal_payments.cjs +48 -0
- package/lib/resources/paypal_payments.cjs.map +1 -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 +44 -0
- package/lib/resources/paypal_payments.js.map +1 -0
- package/lib/resources/percentage_discount_promotions.cjs +96 -0
- package/lib/resources/percentage_discount_promotions.cjs.map +1 -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 +92 -0
- package/lib/resources/percentage_discount_promotions.js.map +1 -0
- package/lib/resources/pickups.cjs +39 -0
- package/lib/resources/pickups.cjs.map +1 -0
- package/lib/resources/pickups.d.cts +4 -0
- package/lib/resources/pickups.d.ts +4 -0
- package/lib/resources/pickups.js +35 -0
- package/lib/resources/pickups.js.map +1 -0
- package/lib/resources/price_frequency_tiers.cjs +52 -0
- package/lib/resources/price_frequency_tiers.cjs.map +1 -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 +48 -0
- package/lib/resources/price_frequency_tiers.js.map +1 -0
- package/lib/resources/price_list_schedulers.cjs +58 -0
- package/lib/resources/price_list_schedulers.cjs.map +1 -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 +54 -0
- package/lib/resources/price_list_schedulers.js.map +1 -0
- package/lib/resources/price_lists.cjs +52 -0
- package/lib/resources/price_lists.cjs.map +1 -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 +48 -0
- package/lib/resources/price_lists.js.map +1 -0
- package/lib/resources/price_tiers.cjs +39 -0
- package/lib/resources/price_tiers.cjs.map +1 -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 +35 -0
- package/lib/resources/price_tiers.js.map +1 -0
- package/lib/resources/price_volume_tiers.cjs +52 -0
- package/lib/resources/price_volume_tiers.cjs.map +1 -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 +48 -0
- package/lib/resources/price_volume_tiers.js.map +1 -0
- package/lib/resources/prices.cjs +76 -0
- package/lib/resources/prices.cjs.map +1 -0
- package/lib/resources/prices.d.cts +4 -0
- package/lib/resources/prices.d.ts +4 -0
- package/lib/resources/prices.js +72 -0
- package/lib/resources/prices.js.map +1 -0
- package/lib/resources/promotion_rules.cjs +31 -0
- package/lib/resources/promotion_rules.cjs.map +1 -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 +27 -0
- package/lib/resources/promotion_rules.js.map +1 -0
- package/lib/resources/promotions.cjs +71 -0
- package/lib/resources/promotions.cjs.map +1 -0
- package/lib/resources/promotions.d.cts +4 -0
- package/lib/resources/promotions.d.ts +4 -0
- package/lib/resources/promotions.js +67 -0
- package/lib/resources/promotions.js.map +1 -0
- package/lib/resources/recurring_order_copies.cjs +52 -0
- package/lib/resources/recurring_order_copies.cjs.map +1 -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 +48 -0
- package/lib/resources/recurring_order_copies.js.map +1 -0
- package/lib/resources/refunds.cjs +57 -0
- package/lib/resources/refunds.cjs.map +1 -0
- package/lib/resources/refunds.d.cts +4 -0
- package/lib/resources/refunds.d.ts +4 -0
- package/lib/resources/refunds.js +53 -0
- package/lib/resources/refunds.js.map +1 -0
- package/lib/resources/reserved_stocks.cjs +43 -0
- package/lib/resources/reserved_stocks.cjs.map +1 -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 +39 -0
- package/lib/resources/reserved_stocks.js.map +1 -0
- package/lib/resources/resource_errors.cjs +27 -0
- package/lib/resources/resource_errors.cjs.map +1 -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 +23 -0
- package/lib/resources/resource_errors.js.map +1 -0
- package/lib/resources/return_line_items.cjs +47 -0
- package/lib/resources/return_line_items.cjs.map +1 -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 +43 -0
- package/lib/resources/return_line_items.js.map +1 -0
- package/lib/resources/returns.cjs +127 -0
- package/lib/resources/returns.cjs.map +1 -0
- package/lib/resources/returns.d.cts +4 -0
- package/lib/resources/returns.d.ts +4 -0
- package/lib/resources/returns.js +123 -0
- package/lib/resources/returns.js.map +1 -0
- package/lib/resources/satispay_gateways.cjs +48 -0
- package/lib/resources/satispay_gateways.cjs.map +1 -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 +44 -0
- package/lib/resources/satispay_gateways.js.map +1 -0
- package/lib/resources/satispay_payments.cjs +51 -0
- package/lib/resources/satispay_payments.cjs.map +1 -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 +47 -0
- package/lib/resources/satispay_payments.js.map +1 -0
- package/lib/resources/shipments.cjs +157 -0
- package/lib/resources/shipments.cjs.map +1 -0
- package/lib/resources/shipments.d.cts +4 -0
- package/lib/resources/shipments.d.ts +4 -0
- package/lib/resources/shipments.js +153 -0
- package/lib/resources/shipments.js.map +1 -0
- package/lib/resources/shipping_categories.cjs +48 -0
- package/lib/resources/shipping_categories.cjs.map +1 -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 +44 -0
- package/lib/resources/shipping_categories.js.map +1 -0
- package/lib/resources/shipping_method_tiers.cjs +39 -0
- package/lib/resources/shipping_method_tiers.cjs.map +1 -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 +35 -0
- package/lib/resources/shipping_method_tiers.js.map +1 -0
- package/lib/resources/shipping_methods.cjs +85 -0
- package/lib/resources/shipping_methods.cjs.map +1 -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 +81 -0
- package/lib/resources/shipping_methods.js.map +1 -0
- package/lib/resources/shipping_weight_tiers.cjs +48 -0
- package/lib/resources/shipping_weight_tiers.cjs.map +1 -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 +44 -0
- package/lib/resources/shipping_weight_tiers.js.map +1 -0
- package/lib/resources/shipping_zones.cjs +44 -0
- package/lib/resources/shipping_zones.cjs.map +1 -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 +40 -0
- package/lib/resources/shipping_zones.js.map +1 -0
- package/lib/resources/sku_list_items.cjs +48 -0
- package/lib/resources/sku_list_items.cjs.map +1 -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 +44 -0
- package/lib/resources/sku_list_items.js.map +1 -0
- package/lib/resources/sku_list_promotion_rules.cjs +48 -0
- package/lib/resources/sku_list_promotion_rules.cjs.map +1 -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 +44 -0
- package/lib/resources/sku_list_promotion_rules.js.map +1 -0
- package/lib/resources/sku_lists.cjs +64 -0
- package/lib/resources/sku_lists.cjs.map +1 -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 +60 -0
- package/lib/resources/sku_lists.js.map +1 -0
- package/lib/resources/sku_options.cjs +62 -0
- package/lib/resources/sku_options.cjs.map +1 -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 +58 -0
- package/lib/resources/sku_options.js.map +1 -0
- package/lib/resources/skus.cjs +106 -0
- package/lib/resources/skus.cjs.map +1 -0
- package/lib/resources/skus.d.cts +4 -0
- package/lib/resources/skus.d.ts +4 -0
- package/lib/resources/skus.js +102 -0
- package/lib/resources/skus.js.map +1 -0
- package/lib/resources/stock_items.cjs +63 -0
- package/lib/resources/stock_items.cjs.map +1 -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 +59 -0
- package/lib/resources/stock_items.js.map +1 -0
- package/lib/resources/stock_line_items.cjs +69 -0
- package/lib/resources/stock_line_items.cjs.map +1 -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 +65 -0
- package/lib/resources/stock_line_items.js.map +1 -0
- package/lib/resources/stock_locations.cjs +68 -0
- package/lib/resources/stock_locations.cjs.map +1 -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 +64 -0
- package/lib/resources/stock_locations.js.map +1 -0
- package/lib/resources/stock_reservations.cjs +67 -0
- package/lib/resources/stock_reservations.cjs.map +1 -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 +63 -0
- package/lib/resources/stock_reservations.js.map +1 -0
- package/lib/resources/stock_transfers.cjs +90 -0
- package/lib/resources/stock_transfers.cjs.map +1 -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 +86 -0
- package/lib/resources/stock_transfers.js.map +1 -0
- package/lib/resources/stores.cjs +64 -0
- package/lib/resources/stores.cjs.map +1 -0
- package/lib/resources/stores.d.cts +4 -0
- package/lib/resources/stores.d.ts +4 -0
- package/lib/resources/stores.js +60 -0
- package/lib/resources/stores.js.map +1 -0
- package/lib/resources/stripe_gateways.cjs +48 -0
- package/lib/resources/stripe_gateways.cjs.map +1 -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 +44 -0
- package/lib/resources/stripe_gateways.js.map +1 -0
- package/lib/resources/stripe_payments.cjs +54 -0
- package/lib/resources/stripe_payments.cjs.map +1 -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 +50 -0
- package/lib/resources/stripe_payments.js.map +1 -0
- package/lib/resources/stripe_tax_accounts.cjs +56 -0
- package/lib/resources/stripe_tax_accounts.cjs.map +1 -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 +52 -0
- package/lib/resources/stripe_tax_accounts.js.map +1 -0
- package/lib/resources/subscription_models.cjs +48 -0
- package/lib/resources/subscription_models.cjs.map +1 -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 +44 -0
- package/lib/resources/subscription_models.js.map +1 -0
- package/lib/resources/tags.cjs +36 -0
- package/lib/resources/tags.cjs.map +1 -0
- package/lib/resources/tags.d.cts +4 -0
- package/lib/resources/tags.d.ts +4 -0
- package/lib/resources/tags.js +32 -0
- package/lib/resources/tags.js.map +1 -0
- package/lib/resources/talon_one_accounts.cjs +52 -0
- package/lib/resources/talon_one_accounts.cjs.map +1 -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 +48 -0
- package/lib/resources/talon_one_accounts.js.map +1 -0
- package/lib/resources/tax_calculators.cjs +43 -0
- package/lib/resources/tax_calculators.cjs.map +1 -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 +39 -0
- package/lib/resources/tax_calculators.js.map +1 -0
- package/lib/resources/tax_categories.cjs +48 -0
- package/lib/resources/tax_categories.cjs.map +1 -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 +44 -0
- package/lib/resources/tax_categories.js.map +1 -0
- package/lib/resources/tax_rules.cjs +44 -0
- package/lib/resources/tax_rules.cjs.map +1 -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 +40 -0
- package/lib/resources/tax_rules.js.map +1 -0
- package/lib/resources/taxjar_accounts.cjs +56 -0
- package/lib/resources/taxjar_accounts.cjs.map +1 -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 +52 -0
- package/lib/resources/taxjar_accounts.js.map +1 -0
- package/lib/resources/transactions.cjs +43 -0
- package/lib/resources/transactions.cjs.map +1 -0
- package/lib/resources/transactions.d.cts +4 -0
- package/lib/resources/transactions.d.ts +4 -0
- package/lib/resources/transactions.js +39 -0
- package/lib/resources/transactions.js.map +1 -0
- package/lib/resources/versions.cjs +27 -0
- package/lib/resources/versions.cjs.map +1 -0
- package/lib/resources/versions.d.cts +4 -0
- package/lib/resources/versions.d.ts +4 -0
- package/lib/resources/versions.js +23 -0
- package/lib/resources/versions.js.map +1 -0
- package/lib/resources/vertex_accounts.cjs +55 -0
- package/lib/resources/vertex_accounts.cjs.map +1 -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 +51 -0
- package/lib/resources/vertex_accounts.js.map +1 -0
- package/lib/resources/voids.cjs +53 -0
- package/lib/resources/voids.cjs.map +1 -0
- package/lib/resources/voids.d.cts +4 -0
- package/lib/resources/voids.d.ts +4 -0
- package/lib/resources/voids.js +49 -0
- package/lib/resources/voids.js.map +1 -0
- package/lib/resources/webhooks.cjs +53 -0
- package/lib/resources/webhooks.cjs.map +1 -0
- package/lib/resources/webhooks.d.cts +4 -0
- package/lib/resources/webhooks.d.ts +4 -0
- package/lib/resources/webhooks.js +49 -0
- package/lib/resources/webhooks.js.map +1 -0
- package/lib/resources/wire_transfers.cjs +44 -0
- package/lib/resources/wire_transfers.cjs.map +1 -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 +40 -0
- package/lib/resources/wire_transfers.js.map +1 -0
- package/lib/static.cjs +49 -0
- package/lib/static.cjs.map +1 -0
- package/lib/static.d.cts +22 -0
- package/lib/static.d.ts +22 -0
- package/lib/static.js +47 -0
- package/lib/static.js.map +1 -0
- package/lib/types.cjs +4 -0
- package/lib/types.cjs.map +1 -0
- package/lib/types.d.cts +7 -0
- package/lib/types.d.ts +7 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/util.cjs +39 -0
- package/lib/util.cjs.map +1 -0
- package/lib/util.d.cts +13 -0
- package/lib/util.d.ts +13 -0
- package/lib/util.js +34 -0
- package/lib/util.js.map +1 -0
- package/package.json +8 -10
@@ -0,0 +1,54 @@
|
|
1
|
+
type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
2
|
+
type FetchResponse = any;
|
3
|
+
type FetchRequestOptions = RequestInit;
|
4
|
+
type FetchClientOptions = {
|
5
|
+
interceptors?: InterceptorManager;
|
6
|
+
fetch?: Fetch;
|
7
|
+
};
|
8
|
+
declare class FetchError extends Error {
|
9
|
+
#private;
|
10
|
+
static isFetchError: (error: any) => error is FetchError;
|
11
|
+
constructor(status: number, statusText: string, body?: any, request?: FetchRequestOptions);
|
12
|
+
get errors(): any[] | undefined;
|
13
|
+
get status(): number;
|
14
|
+
get statusText(): string;
|
15
|
+
get request(): Partial<FetchRequestOptions> | undefined;
|
16
|
+
}
|
17
|
+
declare const fetchURL: (url: URL, requestOptions: FetchRequestOptions, clientOptions?: FetchClientOptions) => Promise<FetchResponse>;
|
18
|
+
|
19
|
+
type InterceptorEventManager<S extends (RequestInterceptor | ResponseInterceptor), F extends (ErrorInterceptor | ResponseInterceptor)> = {
|
20
|
+
onSuccess?: S;
|
21
|
+
onFailure?: F;
|
22
|
+
};
|
23
|
+
type RequestEventManager = InterceptorEventManager<RequestInterceptor, ErrorInterceptor>;
|
24
|
+
type ResponseEventManager = InterceptorEventManager<ResponseInterceptor, ErrorInterceptor>;
|
25
|
+
type ErrorEventManager = InterceptorEventManager<ResponseInterceptor, ResponseInterceptor>;
|
26
|
+
type InterceptorManager = {
|
27
|
+
request?: RequestEventManager;
|
28
|
+
response?: ResponseEventManager;
|
29
|
+
rawReader?: ErrorEventManager;
|
30
|
+
};
|
31
|
+
type RequestObj = {
|
32
|
+
url: URL;
|
33
|
+
options: FetchRequestOptions;
|
34
|
+
};
|
35
|
+
type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
|
36
|
+
type ResponseObj = Response;
|
37
|
+
type ResponseInterceptor = (response: ResponseObj) => ResponseObj | Promise<ResponseObj>;
|
38
|
+
type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-interval' | 'x-ratelimit-remaining';
|
39
|
+
type ApiHeaders = {
|
40
|
+
[key in ApiHeadersList]: string | number | boolean;
|
41
|
+
};
|
42
|
+
type HeadersObj = Record<string, string> | ApiHeaders;
|
43
|
+
type ErrorObj = FetchError;
|
44
|
+
type ErrorInterceptor = (error: ErrorObj) => ErrorObj | Promise<ErrorObj>;
|
45
|
+
type InterceptorType = 'request' | 'response';
|
46
|
+
|
47
|
+
type RawResponseReader = {
|
48
|
+
id: number;
|
49
|
+
rawResponse?: any;
|
50
|
+
headers?: HeadersObj;
|
51
|
+
ok: boolean;
|
52
|
+
};
|
53
|
+
|
54
|
+
export { type ErrorObj as E, type Fetch as F, type HeadersObj as H, type InterceptorType as I, type RequestObj as R, type ResponseObj as a, type RequestInterceptor as b, type ErrorInterceptor as c, type ResponseInterceptor as d, type RawResponseReader as e, type InterceptorManager as f, type FetchResponse as g, type FetchRequestOptions as h, type FetchClientOptions as i, FetchError as j, fetchURL as k };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"interceptor.cjs"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { c as ErrorInterceptor, E as ErrorObj, H as HeadersObj, f as InterceptorManager, I as InterceptorType, e as RawResponseReader, b as RequestInterceptor, R as RequestObj, d as ResponseInterceptor, a as ResponseObj } from './interceptor-5MISI1yn.cjs';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { c as ErrorInterceptor, E as ErrorObj, H as HeadersObj, f as InterceptorManager, I as InterceptorType, e as RawResponseReader, b as RequestInterceptor, R as RequestObj, d as ResponseInterceptor, a as ResponseObj } from './interceptor-5MISI1yn.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"interceptor.js"}
|
package/lib/jsonapi.cjs
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var resource = require('./resource');
|
4
|
+
var config = require('./config');
|
5
|
+
var Debug = require('./debug');
|
6
|
+
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
8
|
+
|
9
|
+
var config__default = /*#__PURE__*/_interopDefault(config);
|
10
|
+
var Debug__default = /*#__PURE__*/_interopDefault(Debug);
|
11
|
+
|
12
|
+
const debug = Debug__default.default("jsonapi");
|
13
|
+
const denormalize = (response) => {
|
14
|
+
if (!response) return response;
|
15
|
+
let denormalizedResponse;
|
16
|
+
if (response.links) delete response.links;
|
17
|
+
const data = response.data;
|
18
|
+
const included = response.included;
|
19
|
+
if (!data) denormalizedResponse = data;
|
20
|
+
else {
|
21
|
+
if (Array.isArray(data)) denormalizedResponse = data.map((res) => denormalizeResource(res, included));
|
22
|
+
else denormalizedResponse = denormalizeResource(data, included);
|
23
|
+
}
|
24
|
+
return denormalizedResponse;
|
25
|
+
};
|
26
|
+
const findIncluded = (rel, included = []) => {
|
27
|
+
const inc = included.find((inc2) => {
|
28
|
+
return rel.id === inc2.id && rel.type === inc2.type;
|
29
|
+
});
|
30
|
+
return inc || rel;
|
31
|
+
};
|
32
|
+
const denormalizeResource = (res, included, chain = []) => {
|
33
|
+
debug("denormalize resource: %O, %o", res, included || {});
|
34
|
+
if (!res) return res;
|
35
|
+
const resource = {
|
36
|
+
id: res.id,
|
37
|
+
type: res.type,
|
38
|
+
...res.attributes
|
39
|
+
};
|
40
|
+
if (res.relationships) Object.keys(res.relationships).forEach((key) => {
|
41
|
+
const rel = res.relationships[key].data;
|
42
|
+
if (rel) {
|
43
|
+
if (chain.filter((r) => r.id === rel.id && r.type === rel.type).length >= config__default.default.jsonapi.maxResourceIncluded) resource[key] = rel;
|
44
|
+
else {
|
45
|
+
if (Array.isArray(rel)) resource[key] = rel.map((r) => denormalizeResource(findIncluded(r, included), included, [...chain, r]));
|
46
|
+
else resource[key] = denormalizeResource(findIncluded(rel, included), included, [...chain, rel]);
|
47
|
+
}
|
48
|
+
} else if (rel === null) resource[key] = null;
|
49
|
+
});
|
50
|
+
debug("denormalized resource: %O", resource);
|
51
|
+
return resource;
|
52
|
+
};
|
53
|
+
const normalize = (resource$1) => {
|
54
|
+
debug("normalize resource: %O", resource$1);
|
55
|
+
const attributes = {};
|
56
|
+
const relationships = {};
|
57
|
+
for (const field in resource$1) {
|
58
|
+
if (["type", "id"].includes(field)) continue;
|
59
|
+
const value = resource$1[field];
|
60
|
+
if (Array.isArray(value) && value.length === 1 && resource.isResourceType(value[0]) && value[0].id === null) {
|
61
|
+
relationships[field] = { data: [] };
|
62
|
+
} else if (value && resource.isResourceType(value) && value.id === null) {
|
63
|
+
relationships[field] = { data: null };
|
64
|
+
} else if (value && (resource.isResourceId(value) || Array.isArray(value) && resource.isResourceId(value[0]))) {
|
65
|
+
relationships[field] = { data: value };
|
66
|
+
} else attributes[field] = value;
|
67
|
+
}
|
68
|
+
const normalized = {
|
69
|
+
type: resource$1.type,
|
70
|
+
attributes,
|
71
|
+
relationships
|
72
|
+
};
|
73
|
+
if (resource.isResourceId(resource$1)) normalized.id = resource$1.id;
|
74
|
+
debug("normalized resource: %O", normalized);
|
75
|
+
return normalized;
|
76
|
+
};
|
77
|
+
|
78
|
+
exports.denormalize = denormalize;
|
79
|
+
exports.normalize = normalize;
|
80
|
+
//# sourceMappingURL=jsonapi.cjs.map
|
81
|
+
//# sourceMappingURL=jsonapi.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/jsonapi.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EAAO,OAAA,UAAA;AAER","file":"jsonapi.cjs","sourcesContent":["\nimport type { Value as JSONValue } from 'json-typescript'\nimport type { DocWithData, Included, ResourceIdentifierObject, ResourceObject as JSONAPIObject, AttributesObject, RelationshipsObject } from 'jsonapi-typescript'\nimport type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource, ResourceRel } from './resource'\nimport { isResourceId, isResourceType } from './resource'\nimport config from './config'\n\nimport Debug from './debug'\nconst debug = Debug('jsonapi')\n\nexport type { DocWithData }\n\n\n\n// DENORMALIZATION\n\nconst denormalize = <R extends Resource>(response: DocWithData): R | R[] => {\n\n\tif (!response) return response\n\t\n\tlet denormalizedResponse\n\n\tif (response.links) delete response.links\n\n\tconst data = response.data\n\tconst included = response.included\n\n\tif (!data) denormalizedResponse = data\n\telse {\n\t\tif (Array.isArray(data)) denormalizedResponse = data.map(res => denormalizeResource<R>(res, included))\n\t\telse denormalizedResponse = denormalizeResource<R>(data, included)\n\t}\n\n\treturn denormalizedResponse\n\n}\n\n\nconst findIncluded = (rel: ResourceIdentifierObject, included: Included = []): JSONAPIObject | undefined => {\n\tconst inc = included.find(inc => {\n\t\treturn (rel.id === inc.id) && (rel.type === inc.type)\n\t})\n\treturn inc || rel\n}\n\n\nconst denormalizeResource = <T extends ResourceType>(res: any, included?: Included, chain: ResourceIdentifierObject[] = []): T => {\n\n\tdebug('denormalize resource: %O, %o', res, included || {})\n\n\tif (!res) return res\n\n\tconst resource = {\n\t\tid: res.id,\n\t\ttype: res.type,\n\t\t...res.attributes,\n\t}\n\n\tif (res.relationships) Object.keys(res.relationships as object).forEach(key => {\n\t\tconst rel: ResourceIdentifierObject = res.relationships[key].data\n\t\tif (rel) {\n\t\t\tif (chain.filter(r => (r.id === rel.id) && (r.type === rel.type)).length >= config.jsonapi.maxResourceIncluded) resource[key] = rel\n\t\t\telse {\n\t\t\t\tif (Array.isArray(rel)) resource[key] = rel.map((r: ResourceIdentifierObject) => denormalizeResource<ResourceType>(findIncluded(r, included), included, [...chain, r]))\n\t\t\t\telse resource[key] = denormalizeResource<ResourceType>(findIncluded(rel, included), included, [...chain, rel])\n\t\t\t}\n\t\t} else if (rel === null) resource[key] = null\n\t})\n\n\tdebug('denormalized resource: %O', resource)\n\n\treturn resource\n\n}\n\n\n// NORMALIZATION\n\nconst normalize = (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)): JSONAPIObject => {\n\n\tdebug('normalize resource: %O', resource)\n\n\tconst attributes: AttributesObject = {}\n\tconst relationships: RelationshipsObject = {}\n\n\tfor (const field in resource) {\n\t\tif (['type', 'id'].includes(field)) continue\n\t\tconst value = resource[field as keyof (ResourceCreate | ResourceUpdate)]\n\t\tif (Array.isArray(value) && (value.length === 1) && isResourceType(value[0]) && ((value[0] as ResourceRel).id === null)) {\n\t\t\trelationships[field] = { data: [] }\n\t\t}\n\t\telse\n\t\tif (value && isResourceType(value) && ((value as ResourceRel).id === null)) {\n\t\t\trelationships[field] = { data: null }\n\t\t}\n\t\telse\n\t\tif (value && (isResourceId(value) || (Array.isArray(value) && isResourceId(value[0])))) {\n\t\t\trelationships[field] = { data: value as ResourceIdentifierObject }\n\t\t}\n\t\telse attributes[field] = value as JSONValue\n\t}\n\n\tconst normalized: JSONAPIObject = {\n\t\ttype: resource.type,\n\t\tattributes,\n\t\trelationships\n\t}\n\n\tif (isResourceId(resource)) normalized.id = resource.id\n\n\tdebug('normalized resource: %O', normalized)\n\n\treturn normalized\n\n}\n\n\n\nexport { denormalize, normalize }\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { DocWithData, ResourceObject } from 'jsonapi-typescript';
|
2
|
+
export { DocWithData } from 'jsonapi-typescript';
|
3
|
+
import { j as Resource, k as ResourceCreate, R as ResourceType, l as ResourceUpdate, i as ResourceId } from './api-DmIZO_Np.cjs';
|
4
|
+
import './client.cjs';
|
5
|
+
import './interceptor-5MISI1yn.cjs';
|
6
|
+
import './types.cjs';
|
7
|
+
|
8
|
+
declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
|
9
|
+
declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => ResourceObject;
|
10
|
+
|
11
|
+
export { denormalize, normalize };
|
package/lib/jsonapi.d.ts
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
import { DocWithData, ResourceObject } from 'jsonapi-typescript';
|
2
|
+
export { DocWithData } from 'jsonapi-typescript';
|
3
|
+
import { j as Resource, k as ResourceCreate, R as ResourceType, l as ResourceUpdate, i as ResourceId } from './api-DDgIE2i8.js';
|
4
|
+
import './client.js';
|
5
|
+
import './interceptor-5MISI1yn.js';
|
6
|
+
import './types.js';
|
7
|
+
|
8
|
+
declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
|
9
|
+
declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => ResourceObject;
|
10
|
+
|
11
|
+
export { denormalize, normalize };
|
package/lib/jsonapi.js
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
import { isResourceType, isResourceId } from './resource';
|
2
|
+
import config from './config';
|
3
|
+
import Debug from './debug';
|
4
|
+
|
5
|
+
const debug = Debug("jsonapi");
|
6
|
+
const denormalize = (response) => {
|
7
|
+
if (!response) return response;
|
8
|
+
let denormalizedResponse;
|
9
|
+
if (response.links) delete response.links;
|
10
|
+
const data = response.data;
|
11
|
+
const included = response.included;
|
12
|
+
if (!data) denormalizedResponse = data;
|
13
|
+
else {
|
14
|
+
if (Array.isArray(data)) denormalizedResponse = data.map((res) => denormalizeResource(res, included));
|
15
|
+
else denormalizedResponse = denormalizeResource(data, included);
|
16
|
+
}
|
17
|
+
return denormalizedResponse;
|
18
|
+
};
|
19
|
+
const findIncluded = (rel, included = []) => {
|
20
|
+
const inc = included.find((inc2) => {
|
21
|
+
return rel.id === inc2.id && rel.type === inc2.type;
|
22
|
+
});
|
23
|
+
return inc || rel;
|
24
|
+
};
|
25
|
+
const denormalizeResource = (res, included, chain = []) => {
|
26
|
+
debug("denormalize resource: %O, %o", res, included || {});
|
27
|
+
if (!res) return res;
|
28
|
+
const resource = {
|
29
|
+
id: res.id,
|
30
|
+
type: res.type,
|
31
|
+
...res.attributes
|
32
|
+
};
|
33
|
+
if (res.relationships) Object.keys(res.relationships).forEach((key) => {
|
34
|
+
const rel = res.relationships[key].data;
|
35
|
+
if (rel) {
|
36
|
+
if (chain.filter((r) => r.id === rel.id && r.type === rel.type).length >= config.jsonapi.maxResourceIncluded) resource[key] = rel;
|
37
|
+
else {
|
38
|
+
if (Array.isArray(rel)) resource[key] = rel.map((r) => denormalizeResource(findIncluded(r, included), included, [...chain, r]));
|
39
|
+
else resource[key] = denormalizeResource(findIncluded(rel, included), included, [...chain, rel]);
|
40
|
+
}
|
41
|
+
} else if (rel === null) resource[key] = null;
|
42
|
+
});
|
43
|
+
debug("denormalized resource: %O", resource);
|
44
|
+
return resource;
|
45
|
+
};
|
46
|
+
const normalize = (resource) => {
|
47
|
+
debug("normalize resource: %O", resource);
|
48
|
+
const attributes = {};
|
49
|
+
const relationships = {};
|
50
|
+
for (const field in resource) {
|
51
|
+
if (["type", "id"].includes(field)) continue;
|
52
|
+
const value = resource[field];
|
53
|
+
if (Array.isArray(value) && value.length === 1 && isResourceType(value[0]) && value[0].id === null) {
|
54
|
+
relationships[field] = { data: [] };
|
55
|
+
} else if (value && isResourceType(value) && value.id === null) {
|
56
|
+
relationships[field] = { data: null };
|
57
|
+
} else if (value && (isResourceId(value) || Array.isArray(value) && isResourceId(value[0]))) {
|
58
|
+
relationships[field] = { data: value };
|
59
|
+
} else attributes[field] = value;
|
60
|
+
}
|
61
|
+
const normalized = {
|
62
|
+
type: resource.type,
|
63
|
+
attributes,
|
64
|
+
relationships
|
65
|
+
};
|
66
|
+
if (isResourceId(resource)) normalized.id = resource.id;
|
67
|
+
debug("normalized resource: %O", normalized);
|
68
|
+
return normalized;
|
69
|
+
};
|
70
|
+
|
71
|
+
export { denormalize, normalize };
|
72
|
+
//# sourceMapp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A;AAErD,EAAA,KAAA,CAAM,2BAA2B,UAAU,CAAA;AAE3C,EAAO,OAAA,UAAA;AAER","file":"jsonapi.js","sourcesContent":["\nimport type { Value as JSONValue } from 'json-typescript'\nimport type { DocWithData, Included, ResourceIdentifierObject, ResourceObject as JSONAPIObject, AttributesObject, RelationshipsObject } from 'jsonapi-typescript'\nimport type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource, ResourceRel } from './resource'\nimport { isResourceId, isResourceType } from './resource'\nimport config from './config'\n\nimport Debug from './debug'\nconst debug = Debug('jsonapi')\n\nexport type { DocWithData }\n\n\n\n// DENORMALIZATION\n\nconst denormalize = <R extends Resource>(response: DocWithData): R | R[] => {\n\n\tif (!response) return response\n\t\n\tlet denormalizedResponse\n\n\tif (response.links) delete response.links\n\n\tconst data = response.data\n\tconst included = response.included\n\n\tif (!data) denormalizedResponse = data\n\telse {\n\t\tif (Array.isArray(data)) denormalizedResponse = data.map(res => denormalizeResource<R>(res, included))\n\t\telse denormalizedResponse = denormalizeResource<R>(data, included)\n\t}\n\n\treturn denormalizedResponse\n\n}\n\n\nconst findIncluded = (rel: ResourceIdentifierObject, included: Included = []): JSONAPIObject | undefined => {\n\tconst inc = included.find(inc => {\n\t\treturn (rel.id === inc.id) && (rel.type === inc.type)\n\t})\n\treturn inc || rel\n}\n\n\nconst denormalizeResource = <T extends ResourceType>(res: any, included?: Included, chain: ResourceIdentifierObject[] = []): T => {\n\n\tdebug('denormalize resource: %O, %o', res, included || {})\n\n\tif (!res) return res\n\n\tconst resource = {\n\t\tid: res.id,\n\t\ttype: res.type,\n\t\t...res.attributes,\n\t}\n\n\tif (res.relationships) Object.keys(res.relationships as object).forEach(key => {\n\t\tconst rel: ResourceIdentifierObject = res.relationships[key].data\n\t\tif (rel) {\n\t\t\tif (chain.filter(r => (r.id === rel.id) && (r.type === rel.type)).length >= config.jsonapi.maxResourceIncluded) resource[key] = rel\n\t\t\telse {\n\t\t\t\tif (Array.isArray(rel)) resource[key] = rel.map((r: ResourceIdentifierObject) => denormalizeResource<ResourceType>(findIncluded(r, included), included, [...chain, r]))\n\t\t\t\telse resource[key] = denormalizeResource<ResourceType>(findIncluded(rel, included), included, [...chain, rel])\n\t\t\t}\n\t\t} else if (rel === null) resource[key] = null\n\t})\n\n\tdebug('denormalized resource: %O', resource)\n\n\treturn resource\n\n}\n\n\n// NORMALIZATION\n\nconst normalize = (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)): JSONAPIObject => {\n\n\tdebug('normalize resource: %O', resource)\n\n\tconst attributes: AttributesObject = {}\n\tconst relationships: RelationshipsObject = {}\n\n\tfor (const field in resource) {\n\t\tif (['type', 'id'].includes(field)) continue\n\t\tconst value = resource[field as keyof (ResourceCreate | ResourceUpdate)]\n\t\tif (Array.isArray(value) && (value.length === 1) && isResourceType(value[0]) && ((value[0] as ResourceRel).id === null)) {\n\t\t\trelationships[field] = { data: [] }\n\t\t}\n\t\telse\n\t\tif (value && isResourceType(value) && ((value as ResourceRel).id === null)) {\n\t\t\trelationships[field] = { data: null }\n\t\t}\n\t\telse\n\t\tif (value && (isResourceId(value) || (Array.isArray(value) && isResourceId(value[0])))) {\n\t\t\trelationships[field] = { data: value as ResourceIdentifierObject }\n\t\t}\n\t\telse attributes[field] = value as JSONValue\n\t}\n\n\tconst normalized: JSONAPIObject = {\n\t\ttype: resource.type,\n\t\tattributes,\n\t\trelationships\n\t}\n\n\tif (isResourceId(resource)) normalized.id = resource.id\n\n\tdebug('normalized resource: %O', normalized)\n\n\treturn normalized\n\n}\n\n\n\nexport { denormalize, normalize }\n"]}
|
package/lib/model.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"model.cjs"}
|
package/lib/model.d.cts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
export { bO as Address, bP as AddressCreate, bR as AddressSort, bQ as AddressUpdate, bS as Adjustment, bT as AdjustmentCreate, bV as AdjustmentSort, bU as AdjustmentUpdate, bW as AdyenGateway, bX as AdyenGatewayCreate, bZ as AdyenGatewaySort, bY as AdyenGatewayUpdate, b_ as AdyenPayment, b$ as AdyenPaymentCreate, c1 as AdyenPaymentSort, c0 as AdyenPaymentUpdate, c2 as Application, c3 as ApplicationSort, c4 as Attachment, c5 as AttachmentCreate, c7 as AttachmentSort, c6 as AttachmentUpdate, c8 as Authorization, ca as AuthorizationSort, c9 as AuthorizationUpdate, cb as AvalaraAccount, cc as AvalaraAccountCreate, ce as AvalaraAccountSort, cd as AvalaraAccountUpdate, cf as AxerveGateway, cg as AxerveGatewayCreate, ci as AxerveGatewaySort, ch as AxerveGatewayUpdate, cj as AxervePayment, ck as AxervePaymentCreate, cm as AxervePaymentSort, cl as AxervePaymentUpdate, cn as BingGeocoder, co as BingGeocoderCreate, cq as BingGeocoderSort, cp as BingGeocoderUpdate, cr as BraintreeGateway, cs as BraintreeGatewayCreate, cu as BraintreeGatewaySort, ct as BraintreeGatewayUpdate, cv as BraintreePayment, cw as BraintreePaymentCreate, cy as BraintreePaymentSort, cx as BraintreePaymentUpdate, cz as Bundle, cA as BundleCreate, cC as BundleSort, cB as BundleUpdate, cD as BuyXPayYPromotion, cE as BuyXPayYPromotionCreate, cG as BuyXPayYPromotionSort, cF as BuyXPayYPromotionUpdate, cH as Capture, cJ as CaptureSort, cI as CaptureUpdate, cK as CarrierAccount, cL as CarrierAccountCreate, cN as CarrierAccountSort, cM as CarrierAccountUpdate, cO as CheckoutComGateway, cP as CheckoutComGatewayCreate, cR as CheckoutComGatewaySort, cQ as CheckoutComGatewayUpdate, cS as CheckoutComPayment, cT as CheckoutComPaymentCreate, cV as CheckoutComPaymentSort, cU as CheckoutComPaymentUpdate, cW as Cleanup, cX as CleanupCreate, cZ as CleanupSort, cY as CleanupUpdate, d6 as Coupon, c_ as CouponCodesPromotionRule, c$ as CouponCodesPromotionRuleCreate, d1 as CouponCodesPromotionRuleSort, d0 as CouponCodesPromotionRuleUpdate, d7 as CouponCreate, d2 as CouponRecipient, d3 as CouponRecipientCreate, d5 as CouponRecipientSort, d4 as CouponRecipientUpdate, d9 as CouponSort, d8 as CouponUpdate, da as CustomPromotionRule, db as CustomPromotionRuleCreate, dd as CustomPromotionRuleSort, dc as CustomPromotionRuleUpdate, dz as Customer, de as CustomerAddress, df as CustomerAddressCreate, dh as CustomerAddressSort, dg as CustomerAddressUpdate, dA as CustomerCreate, di as CustomerGroup, dj as CustomerGroupCreate, dl as CustomerGroupSort, dk as CustomerGroupUpdate, dm as CustomerPasswordReset, dn as CustomerPasswordResetCreate, dq as CustomerPasswordResetSort, dp as CustomerPasswordResetUpdate, dr as CustomerPaymentSource, ds as CustomerPaymentSourceCreate, du as CustomerPaymentSourceSort, dt as CustomerPaymentSourceUpdate, dC as CustomerSort, dv as CustomerSubscription, dw as CustomerSubscriptionCreate, dy as CustomerSubscriptionSort, dx as CustomerSubscriptionUpdate, dB as CustomerUpdate, dD as DeliveryLeadTime, dE as DeliveryLeadTimeCreate, dG as DeliveryLeadTimeSort, dF as DeliveryLeadTimeUpdate, dJ as DiscountEngine, dH as DiscountEngineItem, dI as DiscountEngineItemSort, dK as DiscountEngineSort, dL as EasypostPickup, dM as EasypostPickupCreate, dO as EasypostPickupSort, dN as EasypostPickupUpdate, dR as Event, dP as EventCallback, dQ as EventCallbackSort, dT as EventSort, dS as EventUpdate, dU as Export, dV as ExportCreate, dX as ExportSort, dW as ExportUpdate, dY as ExternalGateway, dZ as ExternalGatewayCreate, d$ as ExternalGatewaySort, d_ as ExternalGatewayUpdate, e0 as ExternalPayment, e1 as ExternalPaymentCreate, e3 as ExternalPaymentSort, e2 as ExternalPaymentUpdate, e4 as ExternalPromotion, e5 as ExternalPromotionCreate, e7 as ExternalPromotionSort, e6 as ExternalPromotionUpdate, e8 as ExternalTaxCalculator, e9 as ExternalTaxCalculatorCreate, eb as ExternalTaxCalculatorSort, ea as ExternalTaxCalculatorUpdate, ec as FixedAmountPromotion, ed as FixedAmountPromotionCreate, ef as FixedAmountPromotionSort, ee as FixedAmountPromotionUpdate, eg as FixedPricePromotion, eh as FixedPricePromotionCreate, ej as FixedPricePromotionSort, ei as FixedPricePromotionUpdate, ek as FlexPromotion, el as FlexPromotionCreate, en as FlexPromotionSort, em as FlexPromotionUpdate, eo as FreeGiftPromotion, ep as FreeGiftPromotionCreate, er as FreeGiftPromotionSort, eq as FreeGiftPromotionUpdate, es as FreeShippingPromotion, et as FreeShippingPromotionCreate, ev as FreeShippingPromotionSort, eu as FreeShippingPromotionUpdate, ew as Geocoder, ex as GeocoderSort, eC as GiftCard, eD as GiftCardCreate, ey as GiftCardRecipient, ez as GiftCardRecipientCreate, eB as GiftCardRecipientSort, eA as GiftCardRecipientUpdate, eF as GiftCardSort, eE as GiftCardUpdate, eG as GoogleGeocoder, eH as GoogleGeocoderCreate, eJ as GoogleGeocoderSort, eI as GoogleGeocoderUpdate, eK as Import, eL as ImportCreate, eN as ImportSort, eM as ImportUpdate, eO as InStockSubscription, eP as InStockSubscriptionCreate, eR as InStockSubscriptionSort, eQ as InStockSubscriptionUpdate, eS as InventoryModel, eT as InventoryModelCreate, eV as InventoryModelSort, eU as InventoryModelUpdate, eW as InventoryReturnLocation, eX as InventoryReturnLocationCreate, eZ as InventoryReturnLocationSort, eY as InventoryReturnLocationUpdate, e_ as InventoryStockLocation, e$ as InventoryStockLocationCreate, f1 as InventoryStockLocationSort, f0 as InventoryStockLocationUpdate, f2 as KlarnaGateway, f3 as KlarnaGatewayCreate, f5 as KlarnaGatewaySort, f4 as KlarnaGatewayUpdate, f6 as KlarnaPayment, f7 as KlarnaPaymentCreate, f9 as KlarnaPaymentSort, f8 as KlarnaPaymentUpdate, fe as LineItem, ff as LineItemCreate, fa as LineItemOption, fb as LineItemOptionCreate, fd as LineItemOptionSort, fc as LineItemOptionUpdate, fh as LineItemSort, fg as LineItemUpdate, fi as Link, fj as LinkCreate, fl as LinkSort, fk as LinkUpdate, fm as ManualGateway, fn as ManualGatewayCreate, fp as ManualGatewaySort, fo as ManualGatewayUpdate, fq as ManualTaxCalculator, fr as ManualTaxCalculatorCreate, ft as ManualTaxCalculatorSort, fs as ManualTaxCalculatorUpdate, fu as Market, fv as MarketCreate, fx as MarketSort, fw as MarketUpdate, fy as Merchant, fz as MerchantCreate, fB as MerchantSort, fA as MerchantUpdate, fC as Notification, fD as NotificationCreate, fF as NotificationSort, fE as NotificationUpdate, fY as Order, fG as OrderAmountPromotionRule, fH as OrderAmountPromotionRuleCreate, fJ as OrderAmountPromotionRuleSort, fI as OrderAmountPromotionRuleUpdate, fK as OrderCopy, fL as OrderCopyCreate, fN as OrderCopySort, fM as OrderCopyUpdate, fZ as OrderCreate, fO as OrderFactory, fP as OrderFactorySort, f$ as OrderSort, fU as OrderSubscription, fV as OrderSubscriptionCreate, fQ as OrderSubscriptionItem, fR as OrderSubscriptionItemCreate, fT as OrderSubscriptionItemSort, fS as OrderSubscriptionItemUpdate, fX as OrderSubscriptionSort, fW as OrderSubscriptionUpdate, f_ as OrderUpdate, g0 as Organization, g1 as OrganizationSort, g2 as Package, g3 as PackageCreate, g5 as PackageSort, g4 as PackageUpdate, ga as Parcel, gb as ParcelCreate, g6 as ParcelLineItem, g7 as ParcelLineItemCreate, g9 as ParcelLineItemSort, g8 as ParcelLineItemUpdate, gd as ParcelSort, gc as ParcelUpdate, ge as PaymentGateway, gf as PaymentGatewaySort, gg as PaymentMethod, gh as PaymentMethodCreate, gj as PaymentMethodSort, gi as PaymentMethodUpdate, gk as PaymentOption, gl as PaymentOptionCreate, gn as PaymentOptionSort, gm as PaymentOptionUpdate, go as PaypalGateway, gp as PaypalGatewayCreate, gr as PaypalGatewaySort, gq as PaypalGatewayUpdate, gs as PaypalPayment, gt as PaypalPaymentCreate, gv as PaypalPaymentSort, gu as PaypalPaymentUpdate, gw as PercentageDiscountPromotion, gx as PercentageDiscountPromotionCreate, gz as PercentageDiscountPromotionSort, gy as PercentageDiscountPromotionUpdate, gA as Pickup, gB as PickupSort, gU as Price, gV as PriceCreate, gC as PriceFrequencyTier, gD as PriceFrequencyTierCreate, gF as PriceFrequencyTierSort, gE as PriceFrequencyTierUpdate, gK as PriceList, gL as PriceListCreate, gG as PriceListScheduler, gH as PriceListSchedulerCreate, gJ as PriceListSchedulerSort, gI as PriceListSchedulerUpdate, gN as PriceListSort, gM as PriceListUpdate, gX as PriceSort, gO as PriceTier, gP as PriceTierSort, gW as PriceUpdate, gQ as PriceVolumeTier, gR as PriceVolumeTierCreate, gT as PriceVolumeTierSort, gS as PriceVolumeTierUpdate, g_ as Promotion, gY as PromotionRule, gZ as PromotionRuleSort, g$ as PromotionSort, h0 as RecurringOrderCopy, h1 as RecurringOrderCopyCreate, h3 as RecurringOrderCopySort, h2 as RecurringOrderCopyUpdate, h4 as Refund, h6 as RefundSort, h5 as RefundUpdate, h7 as ReservedStock, h8 as ReservedStockSort, h9 as ResourceError, ha as ResourceErrorSort, hf as Return, hg as ReturnCreate, hb as ReturnLineItem, hc as ReturnLineItemCreate, he as ReturnLineItemSort, hd as ReturnLineItemUpdate, hi as ReturnSort, hh as ReturnUpdate, hj as SatispayGateway, hk as SatispayGatewayCreate, hm as SatispayGatewaySort, hl as SatispayGatewayUpdate, hn as SatispayPayment, ho as SatispayPaymentCreate, hq as SatispayPaymentSort, hp as SatispayPaymentUpdate, hr as Shipment, hs as ShipmentCreate, hu as ShipmentSort, ht as ShipmentUpdate, hv as ShippingCategory, hw as ShippingCategoryCreate, hy as ShippingCategorySort, hx as ShippingCategoryUpdate, hB as ShippingMethod, hC as ShippingMethodCreate, hE as ShippingMethodSort, hz as ShippingMethodTier, hA as ShippingMethodTierSort, hD as ShippingMethodUpdate, hF as ShippingWeightTier, hG as ShippingWeightTierCreate, hI as ShippingWeightTierSort, hH as ShippingWeightTierUpdate, hJ as ShippingZone, hK as ShippingZoneCreate, hM as ShippingZoneSort, hL as ShippingZoneUpdate, i1 as Sku, i2 as SkuCreate, hV as SkuList, hW as SkuListCreate, hN as SkuListItem, hO as SkuListItemCreate, hQ as SkuListItemSort, hP as SkuListItemUpdate, hR as SkuListPromotionRule, hS as SkuListPromotionRuleCreate, hU as SkuListPromotionRuleSort, hT as SkuListPromotionRuleUpdate, hY as SkuListSort, hX as SkuListUpdate, hZ as SkuOption, h_ as SkuOptionCreate, i0 as SkuOptionSort, h$ as SkuOptionUpdate, i4 as SkuSort, i3 as SkuUpdate, i5 as StockItem, i6 as StockItemCreate, i8 as StockItemSort, i7 as StockItemUpdate, i9 as StockLineItem, ia as StockLineItemCreate, ic as StockLineItemSort, ib as StockLineItemUpdate, id as StockLocation, ie as StockLocationCreate, ih as StockLocationSort, ig as StockLocationUpdate, ii as StockReservation, ij as StockReservationCreate, il as StockReservationSort, ik as StockReservationUpdate, im as StockTransfer, io as StockTransferCreate, iq as StockTransferSort, ip as StockTransferUpdate, ir as Store, is as StoreCreate, iu as StoreSort, it as StoreUpdate, iv as StripeGateway, iw as StripeGatewayCreate, iy as StripeGatewaySort, ix as StripeGatewayUpdate, iz as StripePayment, iA as StripePaymentCreate, iC as StripePaymentSort, iB as StripePaymentUpdate, iD as StripeTaxAccount, iE as StripeTaxAccountCreate, iG as StripeTaxAccountSort, iF as StripeTaxAccountUpdate, iH as SubscriptionModel, iI as SubscriptionModelCreate, iK as SubscriptionModelSort, iJ as SubscriptionModelUpdate, iL as Tag, iM as TagCreate, iO as TagSort, iN as TagUpdate, iP as TalonOneAccount, iQ as TalonOneAccountCreate, iS as TalonOneAccountSort, iR as TalonOneAccountUpdate, iT as TaxCalculator, iU as TaxCalculatorSort, iV as TaxCategory, iW as TaxCategoryCreate, iY as TaxCategorySort, iX as TaxCategoryUpdate, iZ as TaxRule, i_ as TaxRuleCreate, j0 as TaxRuleSort, i$ as TaxRuleUpdate, j1 as TaxjarAccount, j2 as TaxjarAccountCreate, j4 as TaxjarAccountSort, j3 as TaxjarAccountUpdate, j5 as Transaction, j6 as TransactionSort, j7 as Version, j8 as VersionSort, j9 as VertexAccount, ja as VertexAccountCreate, jc as VertexAccountSort, jb as VertexAccountUpdate, jd as Void, jf as VoidSort, je as VoidUpdate, jg as Webhook, jh as WebhookCreate, jj as WebhookSort, ji as WebhookUpdate, jk as WireTransfer, jl as WireTransferCreate, jn as WireTransferSort, jm as WireTransferUpdate } from './api-DmIZO_Np.cjs';
|
2
|
+
import './client.cjs';
|
3
|
+
import './interceptor-5MISI1yn.cjs';
|
4
|
+
import './types.cjs';
|
package/lib/model.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
export { bO as Address, bP as AddressCreate, bR as AddressSort, bQ as AddressUpdate, bS as Adjustment, bT as AdjustmentCreate, bV as AdjustmentSort, bU as AdjustmentUpdate, bW as AdyenGateway, bX as AdyenGatewayCreate, bZ as AdyenGatewaySort, bY as AdyenGatewayUpdate, b_ as AdyenPayment, b$ as AdyenPaymentCreate, c1 as AdyenPaymentSort, c0 as AdyenPaymentUpdate, c2 as Application, c3 as ApplicationSort, c4 as Attachment, c5 as AttachmentCreate, c7 as AttachmentSort, c6 as AttachmentUpdate, c8 as Authorization, ca as AuthorizationSort, c9 as AuthorizationUpdate, cb as AvalaraAccount, cc as AvalaraAccountCreate, ce as AvalaraAccountSort, cd as AvalaraAccountUpdate, cf as AxerveGateway, cg as AxerveGatewayCreate, ci as AxerveGatewaySort, ch as AxerveGatewayUpdate, cj as AxervePayment, ck as AxervePaymentCreate, cm as AxervePaymentSort, cl as AxervePaymentUpdate, cn as BingGeocoder, co as BingGeocoderCreate, cq as BingGeocoderSort, cp as BingGeocoderUpdate, cr as BraintreeGateway, cs as BraintreeGatewayCreate, cu as BraintreeGatewaySort, ct as BraintreeGatewayUpdate, cv as BraintreePayment, cw as BraintreePaymentCreate, cy as BraintreePaymentSort, cx as BraintreePaymentUpdate, cz as Bundle, cA as BundleCreate, cC as BundleSort, cB as BundleUpdate, cD as BuyXPayYPromotion, cE as BuyXPayYPromotionCreate, cG as BuyXPayYPromotionSort, cF as BuyXPayYPromotionUpdate, cH as Capture, cJ as CaptureSort, cI as CaptureUpdate, cK as CarrierAccount, cL as CarrierAccountCreate, cN as CarrierAccountSort, cM as CarrierAccountUpdate, cO as CheckoutComGateway, cP as CheckoutComGatewayCreate, cR as CheckoutComGatewaySort, cQ as CheckoutComGatewayUpdate, cS as CheckoutComPayment, cT as CheckoutComPaymentCreate, cV as CheckoutComPaymentSort, cU as CheckoutComPaymentUpdate, cW as Cleanup, cX as CleanupCreate, cZ as CleanupSort, cY as CleanupUpdate, d6 as Coupon, c_ as CouponCodesPromotionRule, c$ as CouponCodesPromotionRuleCreate, d1 as CouponCodesPromotionRuleSort, d0 as CouponCodesPromotionRuleUpdate, d7 as CouponCreate, d2 as CouponRecipient, d3 as CouponRecipientCreate, d5 as CouponRecipientSort, d4 as CouponRecipientUpdate, d9 as CouponSort, d8 as CouponUpdate, da as CustomPromotionRule, db as CustomPromotionRuleCreate, dd as CustomPromotionRuleSort, dc as CustomPromotionRuleUpdate, dz as Customer, de as CustomerAddress, df as CustomerAddressCreate, dh as CustomerAddressSort, dg as CustomerAddressUpdate, dA as CustomerCreate, di as CustomerGroup, dj as CustomerGroupCreate, dl as CustomerGroupSort, dk as CustomerGroupUpdate, dm as CustomerPasswordReset, dn as CustomerPasswordResetCreate, dq as CustomerPasswordResetSort, dp as CustomerPasswordResetUpdate, dr as CustomerPaymentSource, ds as CustomerPaymentSourceCreate, du as CustomerPaymentSourceSort, dt as CustomerPaymentSourceUpdate, dC as CustomerSort, dv as CustomerSubscription, dw as CustomerSubscriptionCreate, dy as CustomerSubscriptionSort, dx as CustomerSubscriptionUpdate, dB as CustomerUpdate, dD as DeliveryLeadTime, dE as DeliveryLeadTimeCreate, dG as DeliveryLeadTimeSort, dF as DeliveryLeadTimeUpdate, dJ as DiscountEngine, dH as DiscountEngineItem, dI as DiscountEngineItemSort, dK as DiscountEngineSort, dL as EasypostPickup, dM as EasypostPickupCreate, dO as EasypostPickupSort, dN as EasypostPickupUpdate, dR as Event, dP as EventCallback, dQ as EventCallbackSort, dT as EventSort, dS as EventUpdate, dU as Export, dV as ExportCreate, dX as ExportSort, dW as ExportUpdate, dY as ExternalGateway, dZ as ExternalGatewayCreate, d$ as ExternalGatewaySort, d_ as ExternalGatewayUpdate, e0 as ExternalPayment, e1 as ExternalPaymentCreate, e3 as ExternalPaymentSort, e2 as ExternalPaymentUpdate, e4 as ExternalPromotion, e5 as ExternalPromotionCreate, e7 as ExternalPromotionSort, e6 as ExternalPromotionUpdate, e8 as ExternalTaxCalculator, e9 as ExternalTaxCalculatorCreate, eb as ExternalTaxCalculatorSort, ea as ExternalTaxCalculatorUpdate, ec as FixedAmountPromotion, ed as FixedAmountPromotionCreate, ef as FixedAmountPromotionSort, ee as FixedAmountPromotionUpdate, eg as FixedPricePromotion, eh as FixedPricePromotionCreate, ej as FixedPricePromotionSort, ei as FixedPricePromotionUpdate, ek as FlexPromotion, el as FlexPromotionCreate, en as FlexPromotionSort, em as FlexPromotionUpdate, eo as FreeGiftPromotion, ep as FreeGiftPromotionCreate, er as FreeGiftPromotionSort, eq as FreeGiftPromotionUpdate, es as FreeShippingPromotion, et as FreeShippingPromotionCreate, ev as FreeShippingPromotionSort, eu as FreeShippingPromotionUpdate, ew as Geocoder, ex as GeocoderSort, eC as GiftCard, eD as GiftCardCreate, ey as GiftCardRecipient, ez as GiftCardRecipientCreate, eB as GiftCardRecipientSort, eA as GiftCardRecipientUpdate, eF as GiftCardSort, eE as GiftCardUpdate, eG as GoogleGeocoder, eH as GoogleGeocoderCreate, eJ as GoogleGeocoderSort, eI as GoogleGeocoderUpdate, eK as Import, eL as ImportCreate, eN as ImportSort, eM as ImportUpdate, eO as InStockSubscription, eP as InStockSubscriptionCreate, eR as InStockSubscriptionSort, eQ as InStockSubscriptionUpdate, eS as InventoryModel, eT as InventoryModelCreate, eV as InventoryModelSort, eU as InventoryModelUpdate, eW as InventoryReturnLocation, eX as InventoryReturnLocationCreate, eZ as InventoryReturnLocationSort, eY as InventoryReturnLocationUpdate, e_ as InventoryStockLocation, e$ as InventoryStockLocationCreate, f1 as InventoryStockLocationSort, f0 as InventoryStockLocationUpdate, f2 as KlarnaGateway, f3 as KlarnaGatewayCreate, f5 as KlarnaGatewaySort, f4 as KlarnaGatewayUpdate, f6 as KlarnaPayment, f7 as KlarnaPaymentCreate, f9 as KlarnaPaymentSort, f8 as KlarnaPaymentUpdate, fe as LineItem, ff as LineItemCreate, fa as LineItemOption, fb as LineItemOptionCreate, fd as LineItemOptionSort, fc as LineItemOptionUpdate, fh as LineItemSort, fg as LineItemUpdate, fi as Link, fj as LinkCreate, fl as LinkSort, fk as LinkUpdate, fm as ManualGateway, fn as ManualGatewayCreate, fp as ManualGatewaySort, fo as ManualGatewayUpdate, fq as ManualTaxCalculator, fr as ManualTaxCalculatorCreate, ft as ManualTaxCalculatorSort, fs as ManualTaxCalculatorUpdate, fu as Market, fv as MarketCreate, fx as MarketSort, fw as MarketUpdate, fy as Merchant, fz as MerchantCreate, fB as MerchantSort, fA as MerchantUpdate, fC as Notification, fD as NotificationCreate, fF as NotificationSort, fE as NotificationUpdate, fY as Order, fG as OrderAmountPromotionRule, fH as OrderAmountPromotionRuleCreate, fJ as OrderAmountPromotionRuleSort, fI as OrderAmountPromotionRuleUpdate, fK as OrderCopy, fL as OrderCopyCreate, fN as OrderCopySort, fM as OrderCopyUpdate, fZ as OrderCreate, fO as OrderFactory, fP as OrderFactorySort, f$ as OrderSort, fU as OrderSubscription, fV as OrderSubscriptionCreate, fQ as OrderSubscriptionItem, fR as OrderSubscriptionItemCreate, fT as OrderSubscriptionItemSort, fS as OrderSubscriptionItemUpdate, fX as OrderSubscriptionSort, fW as OrderSubscriptionUpdate, f_ as OrderUpdate, g0 as Organization, g1 as OrganizationSort, g2 as Package, g3 as PackageCreate, g5 as PackageSort, g4 as PackageUpdate, ga as Parcel, gb as ParcelCreate, g6 as ParcelLineItem, g7 as ParcelLineItemCreate, g9 as ParcelLineItemSort, g8 as ParcelLineItemUpdate, gd as ParcelSort, gc as ParcelUpdate, ge as PaymentGateway, gf as PaymentGatewaySort, gg as PaymentMethod, gh as PaymentMethodCreate, gj as PaymentMethodSort, gi as PaymentMethodUpdate, gk as PaymentOption, gl as PaymentOptionCreate, gn as PaymentOptionSort, gm as PaymentOptionUpdate, go as PaypalGateway, gp as PaypalGatewayCreate, gr as PaypalGatewaySort, gq as PaypalGatewayUpdate, gs as PaypalPayment, gt as PaypalPaymentCreate, gv as PaypalPaymentSort, gu as PaypalPaymentUpdate, gw as PercentageDiscountPromotion, gx as PercentageDiscountPromotionCreate, gz as PercentageDiscountPromotionSort, gy as PercentageDiscountPromotionUpdate, gA as Pickup, gB as PickupSort, gU as Price, gV as PriceCreate, gC as PriceFrequencyTier, gD as PriceFrequencyTierCreate, gF as PriceFrequencyTierSort, gE as PriceFrequencyTierUpdate, gK as PriceList, gL as PriceListCreate, gG as PriceListScheduler, gH as PriceListSchedulerCreate, gJ as PriceListSchedulerSort, gI as PriceListSchedulerUpdate, gN as PriceListSort, gM as PriceListUpdate, gX as PriceSort, gO as PriceTier, gP as PriceTierSort, gW as PriceUpdate, gQ as PriceVolumeTier, gR as PriceVolumeTierCreate, gT as PriceVolumeTierSort, gS as PriceVolumeTierUpdate, g_ as Promotion, gY as PromotionRule, gZ as PromotionRuleSort, g$ as PromotionSort, h0 as RecurringOrderCopy, h1 as RecurringOrderCopyCreate, h3 as RecurringOrderCopySort, h2 as RecurringOrderCopyUpdate, h4 as Refund, h6 as RefundSort, h5 as RefundUpdate, h7 as ReservedStock, h8 as ReservedStockSort, h9 as ResourceError, ha as ResourceErrorSort, hf as Return, hg as ReturnCreate, hb as ReturnLineItem, hc as ReturnLineItemCreate, he as ReturnLineItemSort, hd as ReturnLineItemUpdate, hi as ReturnSort, hh as ReturnUpdate, hj as SatispayGateway, hk as SatispayGatewayCreate, hm as SatispayGatewaySort, hl as SatispayGatewayUpdate, hn as SatispayPayment, ho as SatispayPaymentCreate, hq as SatispayPaymentSort, hp as SatispayPaymentUpdate, hr as Shipment, hs as ShipmentCreate, hu as ShipmentSort, ht as ShipmentUpdate, hv as ShippingCategory, hw as ShippingCategoryCreate, hy as ShippingCategorySort, hx as ShippingCategoryUpdate, hB as ShippingMethod, hC as ShippingMethodCreate, hE as ShippingMethodSort, hz as ShippingMethodTier, hA as ShippingMethodTierSort, hD as ShippingMethodUpdate, hF as ShippingWeightTier, hG as ShippingWeightTierCreate, hI as ShippingWeightTierSort, hH as ShippingWeightTierUpdate, hJ as ShippingZone, hK as ShippingZoneCreate, hM as ShippingZoneSort, hL as ShippingZoneUpdate, i1 as Sku, i2 as SkuCreate, hV as SkuList, hW as SkuListCreate, hN as SkuListItem, hO as SkuListItemCreate, hQ as SkuListItemSort, hP as SkuListItemUpdate, hR as SkuListPromotionRule, hS as SkuListPromotionRuleCreate, hU as SkuListPromotionRuleSort, hT as SkuListPromotionRuleUpdate, hY as SkuListSort, hX as SkuListUpdate, hZ as SkuOption, h_ as SkuOptionCreate, i0 as SkuOptionSort, h$ as SkuOptionUpdate, i4 as SkuSort, i3 as SkuUpdate, i5 as StockItem, i6 as StockItemCreate, i8 as StockItemSort, i7 as StockItemUpdate, i9 as StockLineItem, ia as StockLineItemCreate, ic as StockLineItemSort, ib as StockLineItemUpdate, id as StockLocation, ie as StockLocationCreate, ih as StockLocationSort, ig as StockLocationUpdate, ii as StockReservation, ij as StockReservationCreate, il as StockReservationSort, ik as StockReservationUpdate, im as StockTransfer, io as StockTransferCreate, iq as StockTransferSort, ip as StockTransferUpdate, ir as Store, is as StoreCreate, iu as StoreSort, it as StoreUpdate, iv as StripeGateway, iw as StripeGatewayCreate, iy as StripeGatewaySort, ix as StripeGatewayUpdate, iz as StripePayment, iA as StripePaymentCreate, iC as StripePaymentSort, iB as StripePaymentUpdate, iD as StripeTaxAccount, iE as StripeTaxAccountCreate, iG as StripeTaxAccountSort, iF as StripeTaxAccountUpdate, iH as SubscriptionModel, iI as SubscriptionModelCreate, iK as SubscriptionModelSort, iJ as SubscriptionModelUpdate, iL as Tag, iM as TagCreate, iO as TagSort, iN as TagUpdate, iP as TalonOneAccount, iQ as TalonOneAccountCreate, iS as TalonOneAccountSort, iR as TalonOneAccountUpdate, iT as TaxCalculator, iU as TaxCalculatorSort, iV as TaxCategory, iW as TaxCategoryCreate, iY as TaxCategorySort, iX as TaxCategoryUpdate, iZ as TaxRule, i_ as TaxRuleCreate, j0 as TaxRuleSort, i$ as TaxRuleUpdate, j1 as TaxjarAccount, j2 as TaxjarAccountCreate, j4 as TaxjarAccountSort, j3 as TaxjarAccountUpdate, j5 as Transaction, j6 as TransactionSort, j7 as Version, j8 as VersionSort, j9 as VertexAccount, ja as VertexAccountCreate, jc as VertexAccountSort, jb as VertexAccountUpdate, jd as Void, jf as VoidSort, je as VoidUpdate, jg as Webhook, jh as WebhookCreate, jj as WebhookSort, ji as WebhookUpdate, jk as WireTransfer, jl as WireTransferCreate, jn as WireTransferSort, jm as WireTransferUpdate } from './api-DDgIE2i8.js';
|
2
|
+
import './client.js';
|
3
|
+
import './interceptor-5MISI1yn.js';
|
4
|
+
import './types.js';
|
package/lib/model.js
ADDED
package/lib/model.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"model.js"}
|
package/lib/query.cjs
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var error = require('./error');
|
4
|
+
var Debug = require('./debug');
|
5
|
+
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
7
|
+
|
8
|
+
var Debug__default = /*#__PURE__*/_interopDefault(Debug);
|
9
|
+
|
10
|
+
const debug = Debug__default.default("query");
|
11
|
+
const arrayFilters = ["_any", "_all", "_in", "_not_in_or_null"];
|
12
|
+
const isArrayFilter = (filter) => {
|
13
|
+
return arrayFilters.some((f) => filter.endsWith(f));
|
14
|
+
};
|
15
|
+
const objectFilters = ["_jcont"];
|
16
|
+
const isObjectFilter = (filter) => {
|
17
|
+
return objectFilters.some((f) => filter.endsWith(f));
|
18
|
+
};
|
19
|
+
const isParamsList = (params) => {
|
20
|
+
return params && (params.filters || params.pageNumber || params.pageSize || params.sort);
|
21
|
+
};
|
22
|
+
const generateQueryStringParams = (params, res) => {
|
23
|
+
debug("generate query string params: %O, %O", params, res);
|
24
|
+
const qp = {};
|
25
|
+
if (!params) return qp;
|
26
|
+
if (params.include) qp.include = params.include.join(",");
|
27
|
+
if (params.fields) {
|
28
|
+
if (Array.isArray(params.fields)) params.fields = { [res.type || res]: params.fields };
|
29
|
+
Object.entries(params.fields).forEach(([p, v]) => {
|
30
|
+
qp[`fields[${p}]`] = v.join(",");
|
31
|
+
});
|
32
|
+
}
|
33
|
+
if (isParamsList(params)) {
|
34
|
+
if (params.sort) {
|
35
|
+
if (Array.isArray(params.sort)) qp.sort = params.sort.join(",");
|
36
|
+
else qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === "desc" ? "-" : ""}${k}`).join(",");
|
37
|
+
}
|
38
|
+
if (params.pageNumber) qp["page[number]"] = String(params.pageNumber);
|
39
|
+
if (params.pageSize) qp["page[size]"] = String(params.pageSize);
|
40
|
+
if (params.filters) {
|
41
|
+
Object.entries(params.filters).forEach(([p, v]) => {
|
42
|
+
let val;
|
43
|
+
if (Array.isArray(v)) {
|
44
|
+
if (!isArrayFilter(p)) throw new error.SdkError({ message: `Incorrect filter [${p}]: Array value is supported only for the following filters: ${arrayFilters.join(", ")}`, type: error.ErrorType.REQUEST });
|
45
|
+
val = v.join(",");
|
46
|
+
} else if (typeof v === "object") {
|
47
|
+
if (!isObjectFilter(p)) throw new error.SdkError({ message: `Incorrect filter [${p}]: Object value is supported only for the following filters: ${objectFilters.join(", ")}`, type: error.ErrorType.REQUEST });
|
48
|
+
val = JSON.stringify(v);
|
49
|
+
} else val = String(v);
|
50
|
+
qp[`filter[q][${p}]`] = val;
|
51
|
+
});
|
52
|
+
}
|
53
|
+
}
|
54
|
+
debug("query string params: %O", qp);
|
55
|
+
return qp;
|
56
|
+
};
|
57
|
+
const generateSearchString = (params, questionMark = true) => {
|
58
|
+
if (!params || Object.keys(params).length === 0) return "";
|
59
|
+
return `${questionMark ? "?" : ""}${Object.entries(params).map(([key, val]) => `${key}=${String(val)}`).join("&")}`;
|
60
|
+
};
|
61
|
+
|
62
|
+
exports.generateQueryStringParams = generateQueryStringParams;
|
63
|
+
exports.generateSearchString = generateSearchString;
|
64
|
+
exports.isParamsList = isParamsList;
|
65
|
+
//# sourceMappingURL=query.cjs.map
|
66
|
+
//# sourceMappingURL=query.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/query.ts"],"names":["Debug","SdkError","ErrorType"],"mappings":";;;;;;;;;AAOA,MAAM,KAAA,GAAQA,uBAAM,OAAO,CAAA;AAG3B,MAAM,YAAe,GAAA,CAAC,MAAQ,EAAA,MAAA,EAAQ,OAAO,iBAAiB,CAAA;AAC9D,MAAM,aAAA,GAAgB,CAAC,MAA4B,KAAA;AAClD,EAAA,OAAO,aAAa,IAAK,CAAA,CAAA,CAAA,KAAK,MAAO,CAAA,QAAA,CAAS,CAAC,CAAC,CAAA;AACjD,CAAA;AAEA,MAAM,aAAA,GAAgB,CAAC,QAAQ,CAAA;AAC/B,MAAM,cAAA,GAAiB,CAAC,MAA4B,KAAA;AACnD,EAAA,OAAO,cAAc,IAAK,CAAA,CAAA,CAAA,KAAK,MAAO,CAAA,QAAA,CAAS,CAAC,CAAC,CAAA;AAClD,CAAA;AAyCM,MAAA,YAAA,GAAe,CAAqB,MAA8C,KAAA;AACvF,EAAA,OAAO,WAAW,MAAO,CAAA,OAAA,IAAW,OAAO,UAAc,IAAA,MAAA,CAAO,YAAY,MAAO,CAAA,IAAA,CAAA;AACpF;AAKM,MAAA,yBAAA,GAA4B,CAAqB,MAAA,EAAoC,GAAkD,KAAA;AAE5I,EAAM,KAAA,CAAA,sCAAA,EAAwC,QAAQ,GAAG,CAAA;AAEzD,EAAA,MAAM,KAAwB,EAAC;AAC/B,EAAI,IAAA,CAAC,QAAe,OAAA,E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A,GAAA,GAAM,EAAE,CAAA,EAAG,OAAO,OAAQ,CAAA,MAAM,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,KAAK,GAAG,CAAA,KAAM,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,MAAA,CAAO,GAAG,CAAC,CAAE,CAAA,CAAA,CAAE,IAAK,CAAA,GAAG,CAAC,CAAA,CAAA;AAClH","file":"query.cjs","sourcesContent":["\nimport type { Resource, ResourceType } from \"./resource\"\nimport { ErrorType, SdkError } from \"./error\"\nimport type { PositiveNumberRange, StringKey } from \"./types\"\nimport type { ResourceFields, ResourceSortFields, ResourceTypeLock } from \"./enum\"\n\nimport Debug from './debug'\nconst debug = Debug('query')\n\n\nconst arrayFilters = ['_any', '_all', '_in', '_not_in_or_null']\nconst isArrayFilter = (filter: string): boolean => {\n\treturn arrayFilters.some(f => filter.endsWith(f))\n}\n\nconst objectFilters = ['_jcont']\nconst isObjectFilter = (filter: string): boolean => {\n\treturn objectFilters.some(f => filter.endsWith(f))\n}\n\n\n// type QueryResType<T> = T extends { type: infer Type } ? Type : never\ntype QueryResType<T extends Resource> = T['type']\n\nexport type QueryInclude = string[]\n\ntype QueryResourceFields<R extends ResourceTypeLock> = keyof ResourceFields[R]\ntype QueryArrayFields<R extends Resource> = Array<QueryResourceFields<QueryResType<R>>>\ntype QueryRecordFields = { [key in keyof ResourceFields]?: Array<(QueryResourceFields<key>)> }\nexport type QueryFields<R extends Resource> = QueryArrayFields<R> | QueryRecordFields\n\nexport interface QueryParamsRetrieve<R extends Resource = Resource> {\n\tinclude?: QueryInclude\n\tfields?: QueryFields<R>\n}\n\ntype QuerySortType = 'asc' | 'desc'\ntype QueryResourceSortable<R extends Resource> = ResourceSortFields[QueryResType<R>]\ntype QueryResourceSortableFields<R extends Resource> = StringKey<QueryResourceSortable<R>>\ntype QueryArraySortable<R extends Resource> = Array<QueryResourceSortableFields<R> | `-${QueryResourceSortableFields<R>}`>\ntype QueryRecordSortable<R extends Resource> = Partial<Record<keyof QueryResourceSortable<R>, QuerySortType>>\nexport type QuerySort<R extends Resource> = QueryArraySortable<R> | QueryRecordSortable<R>\n\nexport type QueryFilter = Record<string, string | number | boolean | object | Array<string | number>>\n\nexport type QueryPageNumber = number\nexport type QueryPageSize = PositiveNumberRange<25>\n\nexport interface QueryParamsList<R extends Resource = Resource> extends QueryParamsRetrieve<R> {\n\tsort?: QuerySort<R>\n\tfilters?: QueryFilter\n\tpageNumber?: QueryPageNumber\n\tpageSize?: QueryPageSize\n}\n\nexport type QueryParams<R extends Resource = Resource> = QueryParamsRetrieve<R> | QueryParamsList<R>\n\n\n\nconst isParamsList = <R extends Resource>(params: any): params is QueryParamsList<R> => {\n\treturn params && (params.filters || params.pageNumber || params.pageSize || params.sort)\n}\n\n\ntype QueryStringParams = Record<string, string>\n\nconst generateQueryStringParams = <R extends Resource>(params: QueryParams<R> | undefined, res: string | ResourceType): QueryStringParams => {\n\n\tdebug('generate query string params: %O, %O', params, res)\n\n\tconst qp: QueryStringParams = {}\n\tif (!params) return qp\n\n\t// Include\n\tif (params.include) qp.include = params.include.join(',')\n\t// Fields\n\tif (params.fields) {\n\t\tif (Array.isArray(params.fields)) params.fields = { [(res as ResourceType).type || res]: params.fields }\n\t\tObject.entries(params.fields).forEach(([p, v]) => {\n\t\t\tqp[`fields[${p}]`] = v.join(',')\n\t\t})\n\t}\n\n\tif (isParamsList(params)) {\n\t\t// Sort\n\t\tif (params.sort) {\n\t\t\tif (Array.isArray(params.sort)) qp.sort = params.sort.join(',')\n\t\t\telse qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',')\n\t\t}\n\t\t// Page\n\t\tif (params.pageNumber) qp['page[number]'] = String(params.pageNumber)\n\t\tif (params.pageSize) qp['page[size]'] = String(params.pageSize)\n\t\t// Filters\n\t\tif (params.filters) {\n\t\t\tObject.entries(params.filters).forEach(([p, v]) => {\n\t\t\t\tlet val\n\t\t\t\tif (Array.isArray(v)) {\n\t\t\t\t\tif (!isArrayFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Array value is supported only for the following filters: ${arrayFilters.join(', ')}`, type: ErrorType.REQUEST })\n\t\t\t\t\tval = v.join(',')\n\t\t\t\t}\n\t\t\t\telse if (typeof v === 'object') {\n\t\t\t\t\tif (!isObjectFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Object value is supported only for the following filters: ${objectFilters.join(', ')}`, type: ErrorType.REQUEST })\n\t\t\t\t\tval = JSON.stringify(v)\n\t\t\t\t}\n\t\t\t\telse val = String(v)\n\t\t\t\tqp[`filter[q][${p}]`] = val\n\t\t\t})\n\t\t}\n\t}\n\n\tdebug('query string params: %O', qp)\n\n\treturn qp\n\n}\n\n\nconst generateSearchString = (params?: QueryStringParams, questionMark: boolean = true): string => {\n\tif (!params || (Object.keys(params).length === 0)) return ''\n\treturn `${questionMark ? '?' : ''}${Object.entries(params).map(([key, val]) => `${key}=${String(val)}`).join('&')}`\n}\n\n\nexport { generateQueryStringParams, isParamsList, generateSearchString }\n"]}
|
package/lib/query.d.cts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
export { a as QueryFields, h as QueryFilter, Q as QueryInclude, e as QueryPageNumber, f as QueryPageSize, d as QueryParams, c as QueryParamsList, b as QueryParamsRetrieve, g as QuerySort, lH as generateQueryStringParams, lJ as generateSearchString, lI as isParamsList } from './api-DmIZO_Np.cjs';
|
2
|
+
import './types.cjs';
|
3
|
+
import './client.cjs';
|
4
|
+
import './interceptor-5MISI1yn.cjs';
|
package/lib/query.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
export { a as QueryFields, h as QueryFilter, Q as QueryInclude, e as QueryPageNumber, f as QueryPageSize, d as QueryParams, c as QueryParamsList, b as QueryParamsRetrieve, g as QuerySort, lH as generateQueryStringParams, lJ as generateSearchString, lI as isParamsList } from './api-DDgIE2i8.js';
|
2
|
+
import './types.js';
|
3
|
+
import './client.js';
|
4
|
+
import './interceptor-5MISI1yn.js';
|
package/lib/query.js
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
import { SdkError, ErrorType } from './error';
|
2
|
+
import Debug from './debug';
|
3
|
+
|
4
|
+
const debug = Debug("query");
|
5
|
+
const arrayFilters = ["_any", "_all", "_in", "_not_in_or_null"];
|
6
|
+
const isArrayFilter = (filter) => {
|
7
|
+
return arrayFilters.some((f) => filter.endsWith(f));
|
8
|
+
};
|
9
|
+
const objectFilters = ["_jcont"];
|
10
|
+
const isObjectFilter = (filter) => {
|
11
|
+
return objectFilters.some((f) => filter.endsWith(f));
|
12
|
+
};
|
13
|
+
const isParamsList = (params) => {
|
14
|
+
return params && (params.filters || params.pageNumber || params.pageSize || params.sort);
|
15
|
+
};
|
16
|
+
const generateQueryStringParams = (params, res) => {
|
17
|
+
debug("generate query string params: %O, %O", params, res);
|
18
|
+
const qp = {};
|
19
|
+
if (!params) return qp;
|
20
|
+
if (params.include) qp.include = params.include.join(",");
|
21
|
+
if (params.fields) {
|
22
|
+
if (Array.isArray(params.fields)) params.fields = { [res.type || res]: params.fields };
|
23
|
+
Object.entries(params.fields).forEach(([p, v]) => {
|
24
|
+
qp[`fields[${p}]`] = v.join(",");
|
25
|
+
});
|
26
|
+
}
|
27
|
+
if (isParamsList(params)) {
|
28
|
+
if (params.sort) {
|
29
|
+
if (Array.isArray(params.sort)) qp.sort = params.sort.join(",");
|
30
|
+
else qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === "desc" ? "-" : ""}${k}`).join(",");
|
31
|
+
}
|
32
|
+
if (params.pageNumber) qp["page[number]"] = String(params.pageNumber);
|
33
|
+
if (params.pageSize) qp["page[size]"] = String(params.pageSize);
|
34
|
+
if (params.filters) {
|
35
|
+
Object.entries(params.filters).forEach(([p, v]) => {
|
36
|
+
let val;
|
37
|
+
if (Array.isArray(v)) {
|
38
|
+
if (!isArrayFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Array value is supported only for the following filters: ${arrayFilters.join(", ")}`, type: ErrorType.REQUEST });
|
39
|
+
val = v.join(",");
|
40
|
+
} else if (typeof v === "object") {
|
41
|
+
if (!isObjectFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Object value is supported only for the following filters: ${objectFilters.join(", ")}`, type: ErrorType.REQUEST });
|
42
|
+
val = JSON.stringify(v);
|
43
|
+
} else val = String(v);
|
44
|
+
qp[`filter[q][${p}]`] = val;
|
45
|
+
});
|
46
|
+
}
|
47
|
+
}
|
48
|
+
debug("query string params: %O", qp);
|
49
|
+
return qp;
|
50
|
+
};
|
51
|
+
const generateSearchString = (params, questionMark = true) => {
|
52
|
+
if (!params || Object.keys(params).length === 0) return "";
|
53
|
+
return `${questionMark ? "?" : ""}${Object.entries(params).map(([key, val]) => `${key}=${String(val)}`).join("&")}`;
|
54
|
+
};
|
55
|
+
|
56
|
+
export { generateQueryStringParams, generateSearchString, isParamsList };
|
57
|
+
//# sourceMappingURL=query.js.map
|
58
|
+
//# sourceMappingURL=query.js.map
|
package/lib/query.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/query.ts"],"names":[],"mappings":";;;AAOA,MAAM,KAAA,GAAQ,MAAM,OAAO,CAAA;AAG3B,MAAM,YAAe,GAAA,CAAC,MAAQ,EAAA,MAAA,EAAQ,OAAO,iBAAiB,CAAA;AAC9D,MAAM,aAAA,GAAgB,CAAC,MAA4B,KAAA;AAClD,EAAA,OAAO,aAAa,IAAK,CAAA,CAAA,CAAA,KAAK,MAAO,CAAA,QAAA,CAAS,CAAC,CAAC,CAAA;AACjD,CAAA;AAEA,MAAM,aAAA,GAAgB,CAAC,QAAQ,CAAA;AAC/B,MAAM,cAAA,GAAiB,CAAC,MAA4B,KAAA;AACnD,EAAA,OAAO,cAAc,IAAK,CAAA,CAAA,CAAA,KAAK,MAAO,CAAA,QAAA,CAAS,CAAC,CAAC,CAAA;AAClD,CAAA;AAyCM,MAAA,YAAA,GAAe,CAAqB,MAA8C,KAAA;AACvF,EAAA,OAAO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EAAA,KAAA,CAAM,2BAA2B,EAAE,CAAA;AAEnC,EAAO,OAAA,EAAA;AAER;AAGA,MAAM,oBAAuB,GAAA,CAAC,MAA4B,EAAA,YAAA,GAAwB,IAAiB,KAAA;AAClG,EAAI,IAAA,CAAC,UAAW,MAAO,CAAA,IAAA,CAAK,MAAM,CAAE,CAAA,MAAA,KAAW,GAAW,OAAA,EAAA;AAC1D,EAAO,OAAA,CAAA,EAAG,YAAe,GAAA,GAAA,GAAM,EAAE,CAAA,EAAG,OAAO,OAAQ,CAAA,MAAM,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,KAAK,GAAG,CAAA,KAAM,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,MAAA,CAAO,GAAG,CAAC,CAAE,CAAA,CAAA,CAAE,IAAK,CAAA,GAAG,CAAC,CAAA,CAAA;AAClH","file":"query.js","sourcesContent":["\nimport type { Resource, ResourceType } from \"./resource\"\nimport { ErrorType, SdkError } from \"./error\"\nimport type { PositiveNumberRange, StringKey } from \"./types\"\nimport type { ResourceFields, ResourceSortFields, ResourceTypeLock } from \"./enum\"\n\nimport Debug from './debug'\nconst debug = Debug('query')\n\n\nconst arrayFilters = ['_any', '_all', '_in', '_not_in_or_null']\nconst isArrayFilter = (filter: string): boolean => {\n\treturn arrayFilters.some(f => filter.endsWith(f))\n}\n\nconst objectFilters = ['_jcont']\nconst isObjectFilter = (filter: string): boolean => {\n\treturn objectFilters.some(f => filter.endsWith(f))\n}\n\n\n// type QueryResType<T> = T extends { type: infer Type } ? Type : never\ntype QueryResType<T extends Resource> = T['type']\n\nexport type QueryInclude = string[]\n\ntype QueryResourceFields<R extends ResourceTypeLock> = keyof ResourceFields[R]\ntype QueryArrayFields<R extends Resource> = Array<QueryResourceFields<QueryResType<R>>>\ntype QueryRecordFields = { [key in keyof ResourceFields]?: Array<(QueryResourceFields<key>)> }\nexport type QueryFields<R extends Resource> = QueryArrayFields<R> | QueryRecordFields\n\nexport interface QueryParamsRetrieve<R extends Resource = Resource> {\n\tinclude?: QueryInclude\n\tfields?: QueryFields<R>\n}\n\ntype QuerySortType = 'asc' | 'desc'\ntype QueryResourceSortable<R extends Resource> = ResourceSortFields[QueryResType<R>]\ntype QueryResourceSortableFields<R extends Resource> = StringKey<QueryResourceSortable<R>>\ntype QueryArraySortable<R extends Resource> = Array<QueryResourceSortableFields<R> | `-${QueryResourceSortableFields<R>}`>\ntype QueryRecordSortable<R extends Resource> = Partial<Record<keyof QueryResourceSortable<R>, QuerySortType>>\nexport type QuerySort<R extends Resource> = QueryArraySortable<R> | QueryRecordSortable<R>\n\nexport type QueryFilter = Record<string, string | number | boolean | object | Array<string | number>>\n\nexport type QueryPageNumber = number\nexport type QueryPageSize = PositiveNumberRange<25>\n\nexport interface QueryParamsList<R extends Resource = Resource> extends QueryParamsRetrieve<R> {\n\tsort?: QuerySort<R>\n\tfilters?: QueryFilter\n\tpageNumber?: QueryPageNumber\n\tpageSize?: QueryPageSize\n}\n\nexport type QueryParams<R extends Resource = Resource> = QueryParamsRetrieve<R> | QueryParamsList<R>\n\n\n\nconst isParamsList = <R extends Resource>(params: any): params is QueryParamsList<R> => {\n\treturn params && (params.filters || params.pageNumber || params.pageSize || params.sort)\n}\n\n\ntype QueryStringParams = Record<string, string>\n\nconst generateQueryStringParams = <R extends Resource>(params: QueryParams<R> | undefined, res: string | ResourceType): QueryStringParams => {\n\n\tdebug('generate query string params: %O, %O', params, res)\n\n\tconst qp: QueryStringParams = {}\n\tif (!params) return qp\n\n\t// Include\n\tif (params.include) qp.include = params.include.join(',')\n\t// Fields\n\tif (params.fields) {\n\t\tif (Array.isArray(params.fields)) params.fields = { [(res as ResourceType).type || res]: params.fields }\n\t\tObject.entries(params.fields).forEach(([p, v]) => {\n\t\t\tqp[`fields[${p}]`] = v.join(',')\n\t\t})\n\t}\n\n\tif (isParamsList(params)) {\n\t\t// Sort\n\t\tif (params.sort) {\n\t\t\tif (Array.isArray(params.sort)) qp.sort = params.sort.join(',')\n\t\t\telse qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',')\n\t\t}\n\t\t// Page\n\t\tif (params.pageNumber) qp['page[number]'] = String(params.pageNumber)\n\t\tif (params.pageSize) qp['page[size]'] = String(params.pageSize)\n\t\t// Filters\n\t\tif (params.filters) {\n\t\t\tObject.entries(params.filters).forEach(([p, v]) => {\n\t\t\t\tlet val\n\t\t\t\tif (Array.isArray(v)) {\n\t\t\t\t\tif (!isArrayFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Array value is supported only for the following filters: ${arrayFilters.join(', ')}`, type: ErrorType.REQUEST })\n\t\t\t\t\tval = v.join(',')\n\t\t\t\t}\n\t\t\t\telse if (typeof v === 'object') {\n\t\t\t\t\tif (!isObjectFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Object value is supported only for the following filters: ${objectFilters.join(', ')}`, type: ErrorType.REQUEST })\n\t\t\t\t\tval = JSON.stringify(v)\n\t\t\t\t}\n\t\t\t\telse val = String(v)\n\t\t\t\tqp[`filter[q][${p}]`] = val\n\t\t\t})\n\t\t}\n\t}\n\n\tdebug('query string params: %O', qp)\n\n\treturn qp\n\n}\n\n\nconst generateSearchString = (params?: QueryStringParams, questionMark: boolean = true): string => {\n\tif (!params || (Object.keys(params).length === 0)) return ''\n\treturn `${questionMark ? '?' : ''}${Object.entries(params).map(([key, val]) => `${key}=${String(val)}`).join('&')}`\n}\n\n\nexport { generateQueryStringParams, isParamsList, generateSearchString }\n"]}
|