@commercelayer/sdk 2.3.1 → 2.3.3-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{api.d.ts → cjs/api.d.ts} +101 -101
- package/lib/cjs/api.js +406 -0
- package/lib/{client.d.ts → cjs/client.d.ts} +30 -30
- package/lib/cjs/client.js +101 -0
- package/lib/{commercelayer.d.ts → cjs/commercelayer.d.ts} +118 -118
- package/lib/cjs/commercelayer.js +201 -0
- package/lib/{common.d.ts → cjs/common.d.ts} +4 -4
- package/lib/cjs/common.js +13 -0
- package/lib/{config.d.ts → cjs/config.d.ts} +7 -7
- package/lib/cjs/config.js +9 -0
- package/lib/{error.d.ts → cjs/error.d.ts} +26 -23
- package/lib/cjs/error.js +40 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +6 -6
- package/lib/cjs/index.js +24 -0
- package/lib/{interceptor.d.ts → cjs/interceptor.d.ts} +19 -19
- package/lib/cjs/interceptor.js +2 -0
- package/lib/{jsonapi.d.ts → cjs/jsonapi.d.ts} +7 -7
- package/lib/cjs/jsonapi.js +63 -0
- package/lib/{model.d.ts → cjs/model.d.ts} +99 -99
- package/lib/cjs/model.js +3 -0
- package/lib/{query.d.ts → cjs/query.d.ts} +57 -57
- package/lib/cjs/query.js +172 -0
- package/lib/{resource.d.ts → cjs/resource.d.ts} +69 -69
- package/lib/cjs/resource.js +114 -0
- package/lib/{resources → cjs/resources}/addresses.d.ts +91 -91
- package/lib/cjs/resources/addresses.js +47 -0
- package/lib/{resources → cjs/resources}/adjustments.d.ts +39 -39
- package/lib/cjs/resources/adjustments.js +47 -0
- package/lib/{resources → cjs/resources}/adyen_gateways.d.ts +49 -49
- package/lib/cjs/resources/adyen_gateways.js +47 -0
- package/lib/{resources → cjs/resources}/adyen_payments.d.ts +47 -47
- package/lib/cjs/resources/adyen_payments.js +47 -0
- package/lib/{resources → cjs/resources}/application.d.ts +25 -25
- package/lib/cjs/resources/application.js +35 -0
- package/lib/{resources → cjs/resources}/attachments.d.ts +160 -160
- package/lib/cjs/resources/attachments.js +47 -0
- package/lib/{resources → cjs/resources}/authorizations.d.ts +58 -58
- package/lib/cjs/resources/authorizations.js +41 -0
- package/lib/{resources → cjs/resources}/avalara_accounts.d.ts +53 -53
- package/lib/cjs/resources/avalara_accounts.js +47 -0
- package/lib/{resources → cjs/resources}/billing_info_validation_rules.d.ts +35 -35
- package/lib/cjs/resources/billing_info_validation_rules.js +47 -0
- package/lib/{resources → cjs/resources}/bing_geocoders.d.ts +37 -37
- package/lib/cjs/resources/bing_geocoders.js +47 -0
- package/lib/{resources → cjs/resources}/braintree_gateways.d.ts +58 -58
- package/lib/cjs/resources/braintree_gateways.js +47 -0
- package/lib/{resources → cjs/resources}/braintree_payments.d.ts +49 -49
- package/lib/cjs/resources/braintree_payments.js +47 -0
- package/lib/{resources → cjs/resources}/bundles.d.ts +69 -69
- package/lib/cjs/resources/bundles.js +47 -0
- package/lib/{resources → cjs/resources}/captures.d.ts +49 -49
- package/lib/cjs/resources/captures.js +41 -0
- package/lib/{resources → cjs/resources}/carrier_accounts.d.ts +28 -28
- package/lib/cjs/resources/carrier_accounts.js +38 -0
- package/lib/{resources → cjs/resources}/checkout_com_gateways.d.ts +47 -47
- package/lib/cjs/resources/checkout_com_gateways.js +47 -0
- package/lib/{resources → cjs/resources}/checkout_com_payments.d.ts +53 -53
- package/lib/cjs/resources/checkout_com_payments.js +47 -0
- package/lib/{resources → cjs/resources}/coupon_codes_promotion_rules.d.ts +62 -62
- package/lib/cjs/resources/coupon_codes_promotion_rules.js +47 -0
- package/lib/{resources → cjs/resources}/coupon_recipients.d.ts +46 -46
- package/lib/cjs/resources/coupon_recipients.js +47 -0
- package/lib/{resources → cjs/resources}/coupons.d.ts +45 -45
- package/lib/cjs/resources/coupons.js +47 -0
- package/lib/{resources → cjs/resources}/customer_addresses.d.ts +43 -43
- package/lib/cjs/resources/customer_addresses.js +47 -0
- package/lib/{resources → cjs/resources}/customer_groups.d.ts +37 -37
- package/lib/cjs/resources/customer_groups.js +47 -0
- package/lib/{resources → cjs/resources}/customer_password_resets.d.ts +36 -36
- package/lib/cjs/resources/customer_password_resets.js +47 -0
- package/lib/{resources → cjs/resources}/customer_payment_sources.d.ts +69 -69
- package/lib/cjs/resources/customer_payment_sources.js +47 -0
- package/lib/{resources → cjs/resources}/customer_subscriptions.d.ts +31 -31
- package/lib/cjs/resources/customer_subscriptions.js +47 -0
- package/lib/{resources → cjs/resources}/customers.d.ts +56 -56
- package/lib/cjs/resources/customers.js +47 -0
- package/lib/{resources → cjs/resources}/delivery_lead_times.d.ts +52 -52
- package/lib/cjs/resources/delivery_lead_times.js +47 -0
- package/lib/{resources → cjs/resources}/event_callbacks.d.ts +27 -27
- package/lib/cjs/resources/event_callbacks.js +38 -0
- package/lib/{resources → cjs/resources}/external_gateways.d.ts +48 -48
- package/lib/cjs/resources/external_gateways.js +47 -0
- package/lib/{resources → cjs/resources}/external_payments.d.ts +42 -42
- package/lib/cjs/resources/external_payments.js +47 -0
- package/lib/{resources → cjs/resources}/external_promotions.d.ts +82 -82
- package/lib/cjs/resources/external_promotions.js +47 -0
- package/lib/{resources → cjs/resources}/external_tax_calculators.d.ts +45 -45
- package/lib/cjs/resources/external_tax_calculators.js +47 -0
- package/lib/{resources → cjs/resources}/fixed_amount_promotions.d.ts +84 -84
- package/lib/cjs/resources/fixed_amount_promotions.js +47 -0
- package/lib/{resources → cjs/resources}/fixed_price_promotions.d.ts +93 -93
- package/lib/cjs/resources/fixed_price_promotions.js +47 -0
- package/lib/{resources → cjs/resources}/free_gift_promotions.d.ts +91 -91
- package/lib/cjs/resources/free_gift_promotions.js +47 -0
- package/lib/{resources → cjs/resources}/free_shipping_promotions.d.ts +79 -79
- package/lib/cjs/resources/free_shipping_promotions.js +47 -0
- package/lib/{resources → cjs/resources}/geocoders.d.ts +25 -25
- package/lib/cjs/resources/geocoders.js +35 -0
- package/lib/{resources → cjs/resources}/gift_card_recipients.d.ts +46 -46
- package/lib/cjs/resources/gift_card_recipients.js +47 -0
- package/lib/{resources → cjs/resources}/gift_cards.d.ts +84 -84
- package/lib/cjs/resources/gift_cards.js +47 -0
- package/lib/{resources → cjs/resources}/google_geocoders.d.ts +37 -37
- package/lib/cjs/resources/google_geocoders.js +47 -0
- package/lib/{resources → cjs/resources}/imports.d.ts +44 -44
- package/lib/cjs/resources/imports.js +44 -0
- package/lib/{resources → cjs/resources}/in_stock_subscriptions.d.ts +60 -60
- package/lib/cjs/resources/in_stock_subscriptions.js +47 -0
- package/lib/{resources → cjs/resources}/inventory_models.d.ts +43 -43
- package/lib/cjs/resources/inventory_models.js +47 -0
- package/lib/{resources → cjs/resources}/inventory_return_locations.d.ts +45 -45
- package/lib/cjs/resources/inventory_return_locations.js +47 -0
- package/lib/{resources → cjs/resources}/inventory_stock_locations.d.ts +48 -48
- package/lib/cjs/resources/inventory_stock_locations.js +47 -0
- package/lib/{resources → cjs/resources}/line_item_options.d.ts +59 -59
- package/lib/cjs/resources/line_item_options.js +47 -0
- package/lib/{resources → cjs/resources}/line_items.d.ts +125 -125
- package/lib/cjs/resources/line_items.js +47 -0
- package/lib/{resources → cjs/resources}/manual_gateways.d.ts +36 -36
- package/lib/cjs/resources/manual_gateways.js +47 -0
- package/lib/{resources → cjs/resources}/manual_tax_calculators.d.ts +49 -49
- package/lib/cjs/resources/manual_tax_calculators.js +47 -0
- package/lib/{resources → cjs/resources}/markets.d.ts +79 -79
- package/lib/cjs/resources/markets.js +47 -0
- package/lib/{resources → cjs/resources}/merchants.d.ts +40 -40
- package/lib/cjs/resources/merchants.js +47 -0
- package/lib/{resources → cjs/resources}/order_amount_promotion_rules.d.ts +60 -60
- package/lib/cjs/resources/order_amount_promotion_rules.js +47 -0
- package/lib/{resources → cjs/resources}/order_copies.d.ts +46 -46
- package/lib/cjs/resources/order_copies.js +44 -0
- package/lib/{resources → cjs/resources}/order_subscriptions.d.ts +66 -66
- package/lib/cjs/resources/order_subscriptions.js +47 -0
- package/lib/{resources → cjs/resources}/order_validation_rules.d.ts +22 -22
- package/lib/cjs/resources/order_validation_rules.js +35 -0
- package/lib/{resources → cjs/resources}/orders.d.ts +255 -255
- package/lib/cjs/resources/orders.js +47 -0
- package/lib/{resources → cjs/resources}/organization.d.ts +34 -34
- package/lib/cjs/resources/organization.js +35 -0
- package/lib/{resources → cjs/resources}/packages.d.ts +57 -57
- package/lib/cjs/resources/packages.js +47 -0
- package/lib/{resources → cjs/resources}/parcel_line_items.d.ts +51 -51
- package/lib/cjs/resources/parcel_line_items.js +47 -0
- package/lib/{resources → cjs/resources}/parcels.d.ts +108 -108
- package/lib/cjs/resources/parcels.js +47 -0
- package/lib/{resources → cjs/resources}/payment_gateways.d.ts +33 -33
- package/lib/cjs/resources/payment_gateways.js +47 -0
- package/lib/{resources → cjs/resources}/payment_methods.d.ts +54 -54
- package/lib/cjs/resources/payment_methods.js +47 -0
- package/lib/{resources → cjs/resources}/paypal_gateways.d.ts +41 -41
- package/lib/cjs/resources/paypal_gateways.js +47 -0
- package/lib/{resources → cjs/resources}/paypal_payments.d.ts +49 -49
- package/lib/cjs/resources/paypal_payments.js +47 -0
- package/lib/{resources → cjs/resources}/percentage_discount_promotions.d.ts +91 -91
- package/lib/cjs/resources/percentage_discount_promotions.js +47 -0
- package/lib/{resources → cjs/resources}/price_lists.d.ts +41 -41
- package/lib/cjs/resources/price_lists.js +47 -0
- package/lib/{resources → cjs/resources}/prices.d.ts +58 -58
- package/lib/cjs/resources/prices.js +47 -0
- package/lib/{resources → cjs/resources}/promotion_rules.d.ts +27 -27
- package/lib/cjs/resources/promotion_rules.js +35 -0
- package/lib/{resources → cjs/resources}/promotions.d.ts +38 -38
- package/lib/cjs/resources/promotions.js +35 -0
- package/lib/{resources → cjs/resources}/refunds.d.ts +36 -36
- package/lib/cjs/resources/refunds.js +38 -0
- package/lib/{resources → cjs/resources}/return_line_items.d.ts +51 -51
- package/lib/cjs/resources/return_line_items.js +47 -0
- package/lib/{resources → cjs/resources}/returns.d.ts +69 -69
- package/lib/cjs/resources/returns.js +47 -0
- package/lib/{resources → cjs/resources}/shipments.d.ts +80 -80
- package/lib/cjs/resources/shipments.js +41 -0
- package/lib/{resources → cjs/resources}/shipping_categories.d.ts +35 -35
- package/lib/cjs/resources/shipping_categories.js +47 -0
- package/lib/{resources → cjs/resources}/shipping_methods.d.ts +71 -71
- package/lib/cjs/resources/shipping_methods.js +47 -0
- package/lib/{resources → cjs/resources}/shipping_zones.d.ts +51 -51
- package/lib/cjs/resources/shipping_zones.js +47 -0
- package/lib/{resources → cjs/resources}/sku_list_items.d.ts +46 -46
- package/lib/cjs/resources/sku_list_items.js +47 -0
- package/lib/{resources → cjs/resources}/sku_list_promotion_rules.d.ts +70 -70
- package/lib/cjs/resources/sku_list_promotion_rules.js +47 -0
- package/lib/{resources → cjs/resources}/sku_lists.d.ts +50 -50
- package/lib/cjs/resources/sku_lists.js +47 -0
- package/lib/{resources → cjs/resources}/sku_options.d.ts +55 -55
- package/lib/cjs/resources/sku_options.js +47 -0
- package/lib/{resources → cjs/resources}/skus.d.ts +76 -76
- package/lib/cjs/resources/skus.js +47 -0
- package/lib/{resources → cjs/resources}/stock_items.d.ts +50 -50
- package/lib/cjs/resources/stock_items.js +47 -0
- package/lib/{resources → cjs/resources}/stock_line_items.d.ts +30 -30
- package/lib/cjs/resources/stock_line_items.js +38 -0
- package/lib/{resources → cjs/resources}/stock_locations.d.ts +55 -55
- package/lib/cjs/resources/stock_locations.js +47 -0
- package/lib/{resources → cjs/resources}/stock_transfers.d.ts +70 -70
- package/lib/cjs/resources/stock_transfers.js +47 -0
- package/lib/{resources → cjs/resources}/stripe_gateways.d.ts +40 -40
- package/lib/cjs/resources/stripe_gateways.js +47 -0
- package/lib/{resources → cjs/resources}/stripe_payments.d.ts +44 -44
- package/lib/cjs/resources/stripe_payments.js +47 -0
- package/lib/{resources → cjs/resources}/tax_calculators.d.ts +27 -27
- package/lib/cjs/resources/tax_calculators.js +35 -0
- package/lib/{resources → cjs/resources}/tax_categories.d.ts +61 -61
- package/lib/cjs/resources/tax_categories.js +47 -0
- package/lib/{resources → cjs/resources}/tax_rules.d.ts +72 -72
- package/lib/cjs/resources/tax_rules.js +47 -0
- package/lib/{resources → cjs/resources}/taxjar_accounts.d.ts +44 -44
- package/lib/cjs/resources/taxjar_accounts.js +47 -0
- package/lib/{resources → cjs/resources}/transactions.d.ts +33 -33
- package/lib/cjs/resources/transactions.js +35 -0
- package/lib/{resources → cjs/resources}/voids.d.ts +36 -36
- package/lib/cjs/resources/voids.js +38 -0
- package/lib/{resources → cjs/resources}/webhooks.d.ts +45 -45
- package/lib/cjs/resources/webhooks.js +47 -0
- package/lib/{resources → cjs/resources}/wire_transfers.d.ts +35 -35
- package/lib/cjs/resources/wire_transfers.js +47 -0
- package/lib/{static.d.ts → cjs/static.d.ts} +6 -5
- package/lib/cjs/static.js +36 -0
- package/lib/{util.d.ts → cjs/util.d.ts} +3 -3
- package/lib/cjs/util.js +7 -0
- package/lib/esm/api.d.ts +101 -0
- package/lib/esm/api.js +304 -0
- package/lib/esm/client.d.ts +30 -0
- package/lib/esm/client.js +96 -0
- package/lib/esm/commercelayer.d.ts +118 -0
- package/lib/esm/commercelayer.js +177 -0
- package/lib/esm/common.d.ts +4 -0
- package/lib/esm/common.js +9 -0
- package/lib/esm/config.d.ts +7 -0
- package/lib/esm/config.js +7 -0
- package/lib/esm/error.d.ts +26 -0
- package/lib/esm/error.js +35 -0
- package/lib/esm/index.d.ts +6 -0
- package/lib/esm/index.js +6 -0
- package/lib/esm/interceptor.d.ts +19 -0
- package/lib/esm/interceptor.js +1 -0
- package/lib/esm/jsonapi.d.ts +7 -0
- package/lib/esm/jsonapi.js +59 -0
- package/lib/esm/model.d.ts +99 -0
- package/lib/esm/model.js +2 -0
- package/lib/esm/query.d.ts +57 -0
- package/lib/esm/query.js +168 -0
- package/lib/esm/resource.d.ts +69 -0
- package/lib/esm/resource.js +108 -0
- package/lib/esm/resources/addresses.d.ts +91 -0
- package/lib/esm/resources/addresses.js +45 -0
- package/lib/esm/resources/adjustments.d.ts +39 -0
- package/lib/esm/resources/adjustments.js +45 -0
- package/lib/esm/resources/adyen_gateways.d.ts +49 -0
- package/lib/esm/resources/adyen_gateways.js +45 -0
- package/lib/esm/resources/adyen_payments.d.ts +47 -0
- package/lib/esm/resources/adyen_payments.js +45 -0
- package/lib/esm/resources/application.d.ts +25 -0
- package/lib/esm/resources/application.js +33 -0
- package/lib/esm/resources/attachments.d.ts +160 -0
- package/lib/esm/resources/attachments.js +45 -0
- package/lib/esm/resources/authorizations.d.ts +58 -0
- package/lib/esm/resources/authorizations.js +39 -0
- package/lib/esm/resources/avalara_accounts.d.ts +53 -0
- package/lib/esm/resources/avalara_accounts.js +45 -0
- package/lib/esm/resources/billing_info_validation_rules.d.ts +35 -0
- package/lib/esm/resources/billing_info_validation_rules.js +45 -0
- package/lib/esm/resources/bing_geocoders.d.ts +37 -0
- package/lib/esm/resources/bing_geocoders.js +45 -0
- package/lib/esm/resources/braintree_gateways.d.ts +58 -0
- package/lib/esm/resources/braintree_gateways.js +45 -0
- package/lib/esm/resources/braintree_payments.d.ts +49 -0
- package/lib/esm/resources/braintree_payments.js +45 -0
- package/lib/esm/resources/bundles.d.ts +69 -0
- package/lib/esm/resources/bundles.js +45 -0
- package/lib/esm/resources/captures.d.ts +49 -0
- package/lib/esm/resources/captures.js +39 -0
- package/lib/esm/resources/carrier_accounts.d.ts +28 -0
- package/lib/esm/resources/carrier_accounts.js +36 -0
- package/lib/esm/resources/checkout_com_gateways.d.ts +47 -0
- package/lib/esm/resources/checkout_com_gateways.js +45 -0
- package/lib/esm/resources/checkout_com_payments.d.ts +53 -0
- package/lib/esm/resources/checkout_com_payments.js +45 -0
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +62 -0
- package/lib/esm/resources/coupon_codes_promotion_rules.js +45 -0
- package/lib/esm/resources/coupon_recipients.d.ts +46 -0
- package/lib/esm/resources/coupon_recipients.js +45 -0
- package/lib/esm/resources/coupons.d.ts +45 -0
- package/lib/esm/resources/coupons.js +45 -0
- package/lib/esm/resources/customer_addresses.d.ts +43 -0
- package/lib/esm/resources/customer_addresses.js +45 -0
- package/lib/esm/resources/customer_groups.d.ts +37 -0
- package/lib/esm/resources/customer_groups.js +45 -0
- package/lib/esm/resources/customer_password_resets.d.ts +36 -0
- package/lib/esm/resources/customer_password_resets.js +45 -0
- package/lib/esm/resources/customer_payment_sources.d.ts +69 -0
- package/lib/esm/resources/customer_payment_sources.js +45 -0
- package/lib/esm/resources/customer_subscriptions.d.ts +31 -0
- package/lib/esm/resources/customer_subscriptions.js +45 -0
- package/lib/esm/resources/customers.d.ts +56 -0
- package/lib/esm/resources/customers.js +45 -0
- package/lib/esm/resources/delivery_lead_times.d.ts +52 -0
- package/lib/esm/resources/delivery_lead_times.js +45 -0
- package/lib/esm/resources/event_callbacks.d.ts +27 -0
- package/lib/esm/resources/event_callbacks.js +36 -0
- package/lib/esm/resources/external_gateways.d.ts +48 -0
- package/lib/esm/resources/external_gateways.js +45 -0
- package/lib/esm/resources/external_payments.d.ts +42 -0
- package/lib/esm/resources/external_payments.js +45 -0
- package/lib/esm/resources/external_promotions.d.ts +82 -0
- package/lib/esm/resources/external_promotions.js +45 -0
- package/lib/esm/resources/external_tax_calculators.d.ts +45 -0
- package/lib/esm/resources/external_tax_calculators.js +45 -0
- package/lib/esm/resources/fixed_amount_promotions.d.ts +84 -0
- package/lib/esm/resources/fixed_amount_promotions.js +45 -0
- package/lib/esm/resources/fixed_price_promotions.d.ts +93 -0
- package/lib/esm/resources/fixed_price_promotions.js +45 -0
- package/lib/esm/resources/free_gift_promotions.d.ts +91 -0
- package/lib/esm/resources/free_gift_promotions.js +45 -0
- package/lib/esm/resources/free_shipping_promotions.d.ts +79 -0
- package/lib/esm/resources/free_shipping_promotions.js +45 -0
- package/lib/esm/resources/geocoders.d.ts +25 -0
- package/lib/esm/resources/geocoders.js +33 -0
- package/lib/esm/resources/gift_card_recipients.d.ts +46 -0
- package/lib/esm/resources/gift_card_recipients.js +45 -0
- package/lib/esm/resources/gift_cards.d.ts +84 -0
- package/lib/esm/resources/gift_cards.js +45 -0
- package/lib/esm/resources/google_geocoders.d.ts +37 -0
- package/lib/esm/resources/google_geocoders.js +45 -0
- package/lib/esm/resources/imports.d.ts +44 -0
- package/lib/esm/resources/imports.js +42 -0
- package/lib/esm/resources/in_stock_subscriptions.d.ts +60 -0
- package/lib/esm/resources/in_stock_subscriptions.js +45 -0
- package/lib/esm/resources/inventory_models.d.ts +43 -0
- package/lib/esm/resources/inventory_models.js +45 -0
- package/lib/esm/resources/inventory_return_locations.d.ts +45 -0
- package/lib/esm/resources/inventory_return_locations.js +45 -0
- package/lib/esm/resources/inventory_stock_locations.d.ts +48 -0
- package/lib/esm/resources/inventory_stock_locations.js +45 -0
- package/lib/esm/resources/line_item_options.d.ts +59 -0
- package/lib/esm/resources/line_item_options.js +45 -0
- package/lib/esm/resources/line_items.d.ts +125 -0
- package/lib/esm/resources/line_items.js +45 -0
- package/lib/esm/resources/manual_gateways.d.ts +36 -0
- package/lib/esm/resources/manual_gateways.js +45 -0
- package/lib/esm/resources/manual_tax_calculators.d.ts +49 -0
- package/lib/esm/resources/manual_tax_calculators.js +45 -0
- package/lib/esm/resources/markets.d.ts +79 -0
- package/lib/esm/resources/markets.js +45 -0
- package/lib/esm/resources/merchants.d.ts +40 -0
- package/lib/esm/resources/merchants.js +45 -0
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +60 -0
- package/lib/esm/resources/order_amount_promotion_rules.js +45 -0
- package/lib/esm/resources/order_copies.d.ts +46 -0
- package/lib/esm/resources/order_copies.js +42 -0
- package/lib/esm/resources/order_subscriptions.d.ts +66 -0
- package/lib/esm/resources/order_subscriptions.js +45 -0
- package/lib/esm/resources/order_validation_rules.d.ts +22 -0
- package/lib/esm/resources/order_validation_rules.js +33 -0
- package/lib/esm/resources/orders.d.ts +255 -0
- package/lib/esm/resources/orders.js +45 -0
- package/lib/esm/resources/organization.d.ts +34 -0
- package/lib/esm/resources/organization.js +33 -0
- package/lib/esm/resources/packages.d.ts +57 -0
- package/lib/esm/resources/packages.js +45 -0
- package/lib/esm/resources/parcel_line_items.d.ts +51 -0
- package/lib/esm/resources/parcel_line_items.js +45 -0
- package/lib/esm/resources/parcels.d.ts +108 -0
- package/lib/esm/resources/parcels.js +45 -0
- package/lib/esm/resources/payment_gateways.d.ts +33 -0
- package/lib/esm/resources/payment_gateways.js +45 -0
- package/lib/esm/resources/payment_methods.d.ts +54 -0
- package/lib/esm/resources/payment_methods.js +45 -0
- package/lib/esm/resources/paypal_gateways.d.ts +41 -0
- package/lib/esm/resources/paypal_gateways.js +45 -0
- package/lib/esm/resources/paypal_payments.d.ts +49 -0
- package/lib/esm/resources/paypal_payments.js +45 -0
- package/lib/esm/resources/percentage_discount_promotions.d.ts +91 -0
- package/lib/esm/resources/percentage_discount_promotions.js +45 -0
- package/lib/esm/resources/price_lists.d.ts +41 -0
- package/lib/esm/resources/price_lists.js +45 -0
- package/lib/esm/resources/prices.d.ts +58 -0
- package/lib/esm/resources/prices.js +45 -0
- package/lib/esm/resources/promotion_rules.d.ts +27 -0
- package/lib/esm/resources/promotion_rules.js +33 -0
- package/lib/esm/resources/promotions.d.ts +38 -0
- package/lib/esm/resources/promotions.js +33 -0
- package/lib/esm/resources/refunds.d.ts +36 -0
- package/lib/esm/resources/refunds.js +36 -0
- package/lib/esm/resources/return_line_items.d.ts +51 -0
- package/lib/esm/resources/return_line_items.js +45 -0
- package/lib/esm/resources/returns.d.ts +69 -0
- package/lib/esm/resources/returns.js +45 -0
- package/lib/esm/resources/shipments.d.ts +80 -0
- package/lib/esm/resources/shipments.js +39 -0
- package/lib/esm/resources/shipping_categories.d.ts +35 -0
- package/lib/esm/resources/shipping_categories.js +45 -0
- package/lib/esm/resources/shipping_methods.d.ts +71 -0
- package/lib/esm/resources/shipping_methods.js +45 -0
- package/lib/esm/resources/shipping_zones.d.ts +51 -0
- package/lib/esm/resources/shipping_zones.js +45 -0
- package/lib/esm/resources/sku_list_items.d.ts +46 -0
- package/lib/esm/resources/sku_list_items.js +45 -0
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +70 -0
- package/lib/esm/resources/sku_list_promotion_rules.js +45 -0
- package/lib/esm/resources/sku_lists.d.ts +50 -0
- package/lib/esm/resources/sku_lists.js +45 -0
- package/lib/esm/resources/sku_options.d.ts +55 -0
- package/lib/esm/resources/sku_options.js +45 -0
- package/lib/esm/resources/skus.d.ts +76 -0
- package/lib/esm/resources/skus.js +45 -0
- package/lib/esm/resources/stock_items.d.ts +50 -0
- package/lib/esm/resources/stock_items.js +45 -0
- package/lib/esm/resources/stock_line_items.d.ts +30 -0
- package/lib/esm/resources/stock_line_items.js +36 -0
- package/lib/esm/resources/stock_locations.d.ts +55 -0
- package/lib/esm/resources/stock_locations.js +45 -0
- package/lib/esm/resources/stock_transfers.d.ts +70 -0
- package/lib/esm/resources/stock_transfers.js +45 -0
- package/lib/esm/resources/stripe_gateways.d.ts +40 -0
- package/lib/esm/resources/stripe_gateways.js +45 -0
- package/lib/esm/resources/stripe_payments.d.ts +44 -0
- package/lib/esm/resources/stripe_payments.js +45 -0
- package/lib/esm/resources/tax_calculators.d.ts +27 -0
- package/lib/esm/resources/tax_calculators.js +33 -0
- package/lib/esm/resources/tax_categories.d.ts +61 -0
- package/lib/esm/resources/tax_categories.js +45 -0
- package/lib/esm/resources/tax_rules.d.ts +72 -0
- package/lib/esm/resources/tax_rules.js +45 -0
- package/lib/esm/resources/taxjar_accounts.d.ts +44 -0
- package/lib/esm/resources/taxjar_accounts.js +45 -0
- package/lib/esm/resources/transactions.d.ts +33 -0
- package/lib/esm/resources/transactions.js +33 -0
- package/lib/esm/resources/voids.d.ts +36 -0
- package/lib/esm/resources/voids.js +36 -0
- package/lib/esm/resources/webhooks.d.ts +45 -0
- package/lib/esm/resources/webhooks.js +45 -0
- package/lib/esm/resources/wire_transfers.d.ts +35 -0
- package/lib/esm/resources/wire_transfers.js +45 -0
- package/lib/esm/static.d.ts +6 -0
- package/lib/esm/static.js +14 -0
- package/lib/esm/util.d.ts +3 -0
- package/lib/esm/util.js +4 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +70 -57
- package/lib/index.js +0 -8
- package/lib/sdk.cjs.development.js +0 -17132
- package/lib/sdk.cjs.development.js.map +0 -1
- package/lib/sdk.cjs.production.min.js +0 -2
- package/lib/sdk.cjs.production.min.js.map +0 -1
- package/lib/sdk.esm.js +0 -17126
- package/lib/sdk.esm.js.map +0 -1
@@ -1,19 +1,19 @@
|
|
1
|
-
import { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from "axios";
|
2
|
-
declare type InterceptorManager = {
|
3
|
-
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
4
|
-
response: AxiosInterceptorManager<any>;
|
5
|
-
};
|
6
|
-
declare type RequestObj = AxiosRequestConfig;
|
7
|
-
declare type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
|
8
|
-
declare type ResponseObj = AxiosResponse;
|
9
|
-
declare type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
|
10
|
-
declare type ErrorObj = AxiosError;
|
11
|
-
declare type ErrorInterceptor = (error: ErrorObj) => ErrorObj;
|
12
|
-
declare type InterceptorType = 'request' | 'response';
|
13
|
-
export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType };
|
14
|
-
export type { RequestObj, ResponseObj, ErrorObj };
|
15
|
-
declare type RawResponseReader = {
|
16
|
-
id: number | undefined;
|
17
|
-
rawResponse: ResponseObj | undefined;
|
18
|
-
};
|
19
|
-
export type { RawResponseReader };
|
1
|
+
import { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from "axios";
|
2
|
+
declare type InterceptorManager = {
|
3
|
+
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
4
|
+
response: AxiosInterceptorManager<any>;
|
5
|
+
};
|
6
|
+
declare type RequestObj = AxiosRequestConfig;
|
7
|
+
declare type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
|
8
|
+
declare type ResponseObj = AxiosResponse;
|
9
|
+
declare type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
|
10
|
+
declare type ErrorObj = AxiosError;
|
11
|
+
declare type ErrorInterceptor = (error: ErrorObj) => ErrorObj;
|
12
|
+
declare type InterceptorType = 'request' | 'response';
|
13
|
+
export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType };
|
14
|
+
export type { RequestObj, ResponseObj, ErrorObj };
|
15
|
+
declare type RawResponseReader = {
|
16
|
+
id: number | undefined;
|
17
|
+
rawResponse: ResponseObj | undefined;
|
18
|
+
};
|
19
|
+
export type { RawResponseReader };
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Value } from 'json-typescript';
|
2
|
-
import { DocWithData, ResourceObject } from 'jsonapi-typescript';
|
3
|
-
import type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource } from './resource';
|
4
|
-
export type { DocWithData, Value as JSONValue };
|
5
|
-
declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
|
6
|
-
declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => ResourceObject;
|
7
|
-
export { denormalize, normalize };
|
1
|
+
import { Value } from 'json-typescript';
|
2
|
+
import { DocWithData, ResourceObject } from 'jsonapi-typescript';
|
3
|
+
import type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource } from './resource';
|
4
|
+
export type { DocWithData, Value as JSONValue };
|
5
|
+
declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
|
6
|
+
declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => ResourceObject;
|
7
|
+
export { denormalize, normalize };
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.normalize = exports.denormalize = void 0;
|
4
|
+
const common_1 = require("./common");
|
5
|
+
// DENORMALIZATION
|
6
|
+
const denormalize = (response) => {
|
7
|
+
let denormalizedResponse;
|
8
|
+
if (response.links)
|
9
|
+
delete response.links;
|
10
|
+
const data = response.data;
|
11
|
+
const included = response.included;
|
12
|
+
if (Array.isArray(data))
|
13
|
+
denormalizedResponse = data.map(res => denormalizeResource(res, included));
|
14
|
+
else
|
15
|
+
denormalizedResponse = denormalizeResource(data, included);
|
16
|
+
return denormalizedResponse;
|
17
|
+
};
|
18
|
+
exports.denormalize = denormalize;
|
19
|
+
const findIncluded = (rel, included = []) => {
|
20
|
+
return included.find(inc => {
|
21
|
+
return (rel.id === inc.id) && (rel.type === inc.type);
|
22
|
+
});
|
23
|
+
};
|
24
|
+
const denormalizeResource = (res, included) => {
|
25
|
+
const resource = Object.assign({ id: res.id, type: res.type }, res.attributes);
|
26
|
+
if (res.relationships)
|
27
|
+
Object.keys(res.relationships).forEach(key => {
|
28
|
+
const rel = res.relationships[key].data;
|
29
|
+
if (rel) {
|
30
|
+
if (Array.isArray(rel))
|
31
|
+
resource[key] = rel.map(r => denormalizeResource(findIncluded(r, included), included));
|
32
|
+
else
|
33
|
+
resource[key] = denormalizeResource(findIncluded(rel, included), included);
|
34
|
+
}
|
35
|
+
else if (rel === null)
|
36
|
+
resource[key] = null;
|
37
|
+
});
|
38
|
+
return resource;
|
39
|
+
};
|
40
|
+
// NORMALIZATION
|
41
|
+
const normalize = (resource) => {
|
42
|
+
const attributes = {};
|
43
|
+
const relationships = {};
|
44
|
+
for (const field in resource) {
|
45
|
+
if (['type', 'id'].includes(field))
|
46
|
+
continue;
|
47
|
+
const value = resource[field];
|
48
|
+
if (value && ((0, common_1.isResourceId)(value) || (Array.isArray(value) && (0, common_1.isResourceId)(value[0])))) {
|
49
|
+
relationships[field] = { data: value };
|
50
|
+
}
|
51
|
+
else
|
52
|
+
attributes[field] = value;
|
53
|
+
}
|
54
|
+
const normalized = {
|
55
|
+
type: resource.type,
|
56
|
+
attributes,
|
57
|
+
relationships
|
58
|
+
};
|
59
|
+
if ((0, common_1.isResourceId)(resource))
|
60
|
+
normalized.id = resource.id;
|
61
|
+
return normalized;
|
62
|
+
};
|
63
|
+
exports.normalize = normalize;
|
@@ -1,99 +1,99 @@
|
|
1
|
-
/**
|
2
|
-
* ©2021 Commerce Layer Inc.
|
3
|
-
* Source code generated automatically by SDK codegen from OpenAPI schema 2.7.3
|
4
|
-
**/
|
5
|
-
export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
|
6
|
-
export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
|
7
|
-
export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate } from './resources/adyen_gateways';
|
8
|
-
export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate } from './resources/adyen_payments';
|
9
|
-
export type { Application } from './resources/application';
|
10
|
-
export type { Attachment, AttachmentCreate, AttachmentUpdate } from './resources/attachments';
|
11
|
-
export type { Authorization, AuthorizationUpdate } from './resources/authorizations';
|
12
|
-
export type { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate } from './resources/avalara_accounts';
|
13
|
-
export type { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate } from './resources/billing_info_validation_rules';
|
14
|
-
export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './resources/bing_geocoders';
|
15
|
-
export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways';
|
16
|
-
export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments';
|
17
|
-
export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles';
|
18
|
-
export type { Capture, CaptureUpdate } from './resources/captures';
|
19
|
-
export type { CarrierAccount } from './resources/carrier_accounts';
|
20
|
-
export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways';
|
21
|
-
export type { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate } from './resources/checkout_com_payments';
|
22
|
-
export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules';
|
23
|
-
export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients';
|
24
|
-
export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons';
|
25
|
-
export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses';
|
26
|
-
export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups';
|
27
|
-
export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets';
|
28
|
-
export type { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate } from './resources/customer_payment_sources';
|
29
|
-
export type { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate } from './resources/customer_subscriptions';
|
30
|
-
export type { Customer, CustomerCreate, CustomerUpdate } from './resources/customers';
|
31
|
-
export type { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate } from './resources/delivery_lead_times';
|
32
|
-
export type { EventCallback } from './resources/event_callbacks';
|
33
|
-
export type { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate } from './resources/external_gateways';
|
34
|
-
export type { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate } from './resources/external_payments';
|
35
|
-
export type { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate } from './resources/external_promotions';
|
36
|
-
export type { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate } from './resources/external_tax_calculators';
|
37
|
-
export type { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate } from './resources/fixed_amount_promotions';
|
38
|
-
export type { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate } from './resources/fixed_price_promotions';
|
39
|
-
export type { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate } from './resources/free_gift_promotions';
|
40
|
-
export type { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate } from './resources/free_shipping_promotions';
|
41
|
-
export type { Geocoder } from './resources/geocoders';
|
42
|
-
export type { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate } from './resources/gift_card_recipients';
|
43
|
-
export type { GiftCard, GiftCardCreate, GiftCardUpdate } from './resources/gift_cards';
|
44
|
-
export type { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate } from './resources/google_geocoders';
|
45
|
-
export type { Import, ImportCreate } from './resources/imports';
|
46
|
-
export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate } from './resources/in_stock_subscriptions';
|
47
|
-
export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models';
|
48
|
-
export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations';
|
49
|
-
export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations';
|
50
|
-
export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options';
|
51
|
-
export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items';
|
52
|
-
export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways';
|
53
|
-
export type { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate } from './resources/manual_tax_calculators';
|
54
|
-
export type { Market, MarketCreate, MarketUpdate } from './resources/markets';
|
55
|
-
export type { Merchant, MerchantCreate, MerchantUpdate } from './resources/merchants';
|
56
|
-
export type { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate } from './resources/order_amount_promotion_rules';
|
57
|
-
export type { OrderCopy, OrderCopyCreate } from './resources/order_copies';
|
58
|
-
export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions';
|
59
|
-
export type { OrderValidationRule } from './resources/order_validation_rules';
|
60
|
-
export type { Order, OrderCreate, OrderUpdate } from './resources/orders';
|
61
|
-
export type { Organization } from './resources/organization';
|
62
|
-
export type { Package, PackageCreate, PackageUpdate } from './resources/packages';
|
63
|
-
export type { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate } from './resources/parcel_line_items';
|
64
|
-
export type { Parcel, ParcelCreate, ParcelUpdate } from './resources/parcels';
|
65
|
-
export type { PaymentGateway, PaymentGatewayCreate, PaymentGatewayUpdate } from './resources/payment_gateways';
|
66
|
-
export type { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate } from './resources/payment_methods';
|
67
|
-
export type { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate } from './resources/paypal_gateways';
|
68
|
-
export type { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate } from './resources/paypal_payments';
|
69
|
-
export type { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate } from './resources/percentage_discount_promotions';
|
70
|
-
export type { PriceList, PriceListCreate, PriceListUpdate } from './resources/price_lists';
|
71
|
-
export type { Price, PriceCreate, PriceUpdate } from './resources/prices';
|
72
|
-
export type { PromotionRule } from './resources/promotion_rules';
|
73
|
-
export type { Promotion } from './resources/promotions';
|
74
|
-
export type { Refund } from './resources/refunds';
|
75
|
-
export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items';
|
76
|
-
export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns';
|
77
|
-
export type { Shipment, ShipmentUpdate } from './resources/shipments';
|
78
|
-
export type { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate } from './resources/shipping_categories';
|
79
|
-
export type { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate } from './resources/shipping_methods';
|
80
|
-
export type { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate } from './resources/shipping_zones';
|
81
|
-
export type { SkuListItem, SkuListItemCreate, SkuListItemUpdate } from './resources/sku_list_items';
|
82
|
-
export type { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate } from './resources/sku_list_promotion_rules';
|
83
|
-
export type { SkuList, SkuListCreate, SkuListUpdate } from './resources/sku_lists';
|
84
|
-
export type { SkuOption, SkuOptionCreate, SkuOptionUpdate } from './resources/sku_options';
|
85
|
-
export type { Sku, SkuCreate, SkuUpdate } from './resources/skus';
|
86
|
-
export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items';
|
87
|
-
export type { StockLineItem } from './resources/stock_line_items';
|
88
|
-
export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations';
|
89
|
-
export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers';
|
90
|
-
export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways';
|
91
|
-
export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments';
|
92
|
-
export type { TaxCalculator } from './resources/tax_calculators';
|
93
|
-
export type { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate } from './resources/tax_categories';
|
94
|
-
export type { TaxRule, TaxRuleCreate, TaxRuleUpdate } from './resources/tax_rules';
|
95
|
-
export type { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate } from './resources/taxjar_accounts';
|
96
|
-
export type { Transaction } from './resources/transactions';
|
97
|
-
export type { Void } from './resources/voids';
|
98
|
-
export type { Webhook, WebhookCreate, WebhookUpdate } from './resources/webhooks';
|
99
|
-
export type { WireTransfer, WireTransferCreate, WireTransferUpdate } from './resources/wire_transfers';
|
1
|
+
/**
|
2
|
+
* ©2021 Commerce Layer Inc.
|
3
|
+
* Source code generated automatically by SDK codegen from OpenAPI schema 2.7.3
|
4
|
+
**/
|
5
|
+
export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
|
6
|
+
export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
|
7
|
+
export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate } from './resources/adyen_gateways';
|
8
|
+
export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate } from './resources/adyen_payments';
|
9
|
+
export type { Application } from './resources/application';
|
10
|
+
export type { Attachment, AttachmentCreate, AttachmentUpdate } from './resources/attachments';
|
11
|
+
export type { Authorization, AuthorizationUpdate } from './resources/authorizations';
|
12
|
+
export type { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate } from './resources/avalara_accounts';
|
13
|
+
export type { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate } from './resources/billing_info_validation_rules';
|
14
|
+
export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './resources/bing_geocoders';
|
15
|
+
export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways';
|
16
|
+
export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments';
|
17
|
+
export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles';
|
18
|
+
export type { Capture, CaptureUpdate } from './resources/captures';
|
19
|
+
export type { CarrierAccount } from './resources/carrier_accounts';
|
20
|
+
export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways';
|
21
|
+
export type { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate } from './resources/checkout_com_payments';
|
22
|
+
export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules';
|
23
|
+
export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients';
|
24
|
+
export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons';
|
25
|
+
export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses';
|
26
|
+
export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups';
|
27
|
+
export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets';
|
28
|
+
export type { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate } from './resources/customer_payment_sources';
|
29
|
+
export type { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate } from './resources/customer_subscriptions';
|
30
|
+
export type { Customer, CustomerCreate, CustomerUpdate } from './resources/customers';
|
31
|
+
export type { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate } from './resources/delivery_lead_times';
|
32
|
+
export type { EventCallback } from './resources/event_callbacks';
|
33
|
+
export type { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate } from './resources/external_gateways';
|
34
|
+
export type { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate } from './resources/external_payments';
|
35
|
+
export type { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate } from './resources/external_promotions';
|
36
|
+
export type { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate } from './resources/external_tax_calculators';
|
37
|
+
export type { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate } from './resources/fixed_amount_promotions';
|
38
|
+
export type { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate } from './resources/fixed_price_promotions';
|
39
|
+
export type { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate } from './resources/free_gift_promotions';
|
40
|
+
export type { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate } from './resources/free_shipping_promotions';
|
41
|
+
export type { Geocoder } from './resources/geocoders';
|
42
|
+
export type { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate } from './resources/gift_card_recipients';
|
43
|
+
export type { GiftCard, GiftCardCreate, GiftCardUpdate } from './resources/gift_cards';
|
44
|
+
export type { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate } from './resources/google_geocoders';
|
45
|
+
export type { Import, ImportCreate } from './resources/imports';
|
46
|
+
export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate } from './resources/in_stock_subscriptions';
|
47
|
+
export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models';
|
48
|
+
export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations';
|
49
|
+
export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations';
|
50
|
+
export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options';
|
51
|
+
export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items';
|
52
|
+
export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways';
|
53
|
+
export type { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate } from './resources/manual_tax_calculators';
|
54
|
+
export type { Market, MarketCreate, MarketUpdate } from './resources/markets';
|
55
|
+
export type { Merchant, MerchantCreate, MerchantUpdate } from './resources/merchants';
|
56
|
+
export type { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate } from './resources/order_amount_promotion_rules';
|
57
|
+
export type { OrderCopy, OrderCopyCreate } from './resources/order_copies';
|
58
|
+
export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions';
|
59
|
+
export type { OrderValidationRule } from './resources/order_validation_rules';
|
60
|
+
export type { Order, OrderCreate, OrderUpdate } from './resources/orders';
|
61
|
+
export type { Organization } from './resources/organization';
|
62
|
+
export type { Package, PackageCreate, PackageUpdate } from './resources/packages';
|
63
|
+
export type { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate } from './resources/parcel_line_items';
|
64
|
+
export type { Parcel, ParcelCreate, ParcelUpdate } from './resources/parcels';
|
65
|
+
export type { PaymentGateway, PaymentGatewayCreate, PaymentGatewayUpdate } from './resources/payment_gateways';
|
66
|
+
export type { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate } from './resources/payment_methods';
|
67
|
+
export type { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate } from './resources/paypal_gateways';
|
68
|
+
export type { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate } from './resources/paypal_payments';
|
69
|
+
export type { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate } from './resources/percentage_discount_promotions';
|
70
|
+
export type { PriceList, PriceListCreate, PriceListUpdate } from './resources/price_lists';
|
71
|
+
export type { Price, PriceCreate, PriceUpdate } from './resources/prices';
|
72
|
+
export type { PromotionRule } from './resources/promotion_rules';
|
73
|
+
export type { Promotion } from './resources/promotions';
|
74
|
+
export type { Refund } from './resources/refunds';
|
75
|
+
export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items';
|
76
|
+
export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns';
|
77
|
+
export type { Shipment, ShipmentUpdate } from './resources/shipments';
|
78
|
+
export type { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate } from './resources/shipping_categories';
|
79
|
+
export type { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate } from './resources/shipping_methods';
|
80
|
+
export type { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate } from './resources/shipping_zones';
|
81
|
+
export type { SkuListItem, SkuListItemCreate, SkuListItemUpdate } from './resources/sku_list_items';
|
82
|
+
export type { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate } from './resources/sku_list_promotion_rules';
|
83
|
+
export type { SkuList, SkuListCreate, SkuListUpdate } from './resources/sku_lists';
|
84
|
+
export type { SkuOption, SkuOptionCreate, SkuOptionUpdate } from './resources/sku_options';
|
85
|
+
export type { Sku, SkuCreate, SkuUpdate } from './resources/skus';
|
86
|
+
export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items';
|
87
|
+
export type { StockLineItem } from './resources/stock_line_items';
|
88
|
+
export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations';
|
89
|
+
export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers';
|
90
|
+
export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways';
|
91
|
+
export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments';
|
92
|
+
export type { TaxCalculator } from './resources/tax_calculators';
|
93
|
+
export type { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate } from './resources/tax_categories';
|
94
|
+
export type { TaxRule, TaxRuleCreate, TaxRuleUpdate } from './resources/tax_rules';
|
95
|
+
export type { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate } from './resources/taxjar_accounts';
|
96
|
+
export type { Transaction } from './resources/transactions';
|
97
|
+
export type { Void } from './resources/voids';
|
98
|
+
export type { Webhook, WebhookCreate, WebhookUpdate } from './resources/webhooks';
|
99
|
+
export type { WireTransfer, WireTransferCreate, WireTransferUpdate } from './resources/wire_transfers';
|
package/lib/cjs/model.js
ADDED
@@ -1,57 +1,57 @@
|
|
1
|
-
interface QueryParamsRetrieve {
|
2
|
-
include?: string[];
|
3
|
-
fields?: {
|
4
|
-
[key: string]: string[];
|
5
|
-
};
|
6
|
-
}
|
7
|
-
interface QueryParamsList extends QueryParamsRetrieve {
|
8
|
-
sort?: string[] | {
|
9
|
-
[key: string]: 'asc' | 'desc';
|
10
|
-
};
|
11
|
-
filters?: {
|
12
|
-
[key: string]: string | number | boolean;
|
13
|
-
};
|
14
|
-
pageNumber?: number;
|
15
|
-
pageSize?: number;
|
16
|
-
}
|
17
|
-
declare type QueryParams = QueryParamsRetrieve | QueryParamsList;
|
18
|
-
export { QueryParamsRetrieve, QueryParamsList, QueryParams };
|
19
|
-
declare type FilterPredicate = 'blank' | 'cont' | 'cont_all' | 'cont_any' | 'does_not_match' | 'does_not_match_all' | 'does_not_match_any' | 'end' | 'end_all' | 'end_any' | 'eq' | 'false' | 'gt' | 'gt_all' | 'gt_any' | 'gteq' | 'gteq_all' | 'gteq_any' | 'in' | 'lt' | 'lt_all' | 'lt_any' | 'lteq' | 'lteq_all' | 'lteq_any' | 'matches' | 'matches_all' | 'matches_any' | 'not_cont' | 'not_cont_all' | 'not_end' | 'not_end_all' | 'not_end_any' | 'not_eq' | 'not_eq_all' | 'not_in' | 'not_null' | 'not_start' | 'not_start_all' | 'not_start_any' | 'null' | 'present' | 'start' | 'start_all' | 'start_any' | 'true';
|
20
|
-
declare class QueryBuilderRetrieve {
|
21
|
-
#private;
|
22
|
-
constructor(resource?: string);
|
23
|
-
include(...resources: string[]): QueryBuilderRetrieve;
|
24
|
-
field(field: string, resource?: string): QueryBuilderRetrieve;
|
25
|
-
fields(fields: string[], resource?: string): QueryBuilderRetrieve;
|
26
|
-
clear(): QueryBuilderRetrieve;
|
27
|
-
build(): QueryParams;
|
28
|
-
generate(): {
|
29
|
-
[key: string]: string;
|
30
|
-
};
|
31
|
-
}
|
32
|
-
declare class QueryBuilderList extends QueryBuilderRetrieve {
|
33
|
-
#private;
|
34
|
-
constructor(resource?: string);
|
35
|
-
include(...resources: string[]): QueryBuilderList;
|
36
|
-
field(field: string, resource?: string): QueryBuilderList;
|
37
|
-
fields(fields: string[], resource?: string): QueryBuilderList;
|
38
|
-
pageNumber(num: number): QueryBuilderList;
|
39
|
-
pageSize(size: number): QueryBuilderList;
|
40
|
-
page(num: number, size: number): QueryBuilderList;
|
41
|
-
sort(field: string, descending?: boolean): QueryBuilderList;
|
42
|
-
filter(field: string | string[], predicate: FilterPredicate, value: string | number | boolean | string[], resource?: string): QueryBuilderList;
|
43
|
-
clear(): QueryBuilderList;
|
44
|
-
build(): QueryParams;
|
45
|
-
generate(): {
|
46
|
-
[key: string]: string;
|
47
|
-
};
|
48
|
-
}
|
49
|
-
declare class QueryBuilder extends QueryBuilderList {
|
50
|
-
constructor(resource?: string);
|
51
|
-
}
|
52
|
-
export default QueryBuilder;
|
53
|
-
export { QueryBuilderRetrieve, QueryBuilderList };
|
54
|
-
declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined) => {
|
55
|
-
[key: string]: string;
|
56
|
-
};
|
57
|
-
export { generateQueryStringParams };
|
1
|
+
interface QueryParamsRetrieve {
|
2
|
+
include?: string[];
|
3
|
+
fields?: {
|
4
|
+
[key: string]: string[];
|
5
|
+
};
|
6
|
+
}
|
7
|
+
interface QueryParamsList extends QueryParamsRetrieve {
|
8
|
+
sort?: string[] | {
|
9
|
+
[key: string]: 'asc' | 'desc';
|
10
|
+
};
|
11
|
+
filters?: {
|
12
|
+
[key: string]: string | number | boolean;
|
13
|
+
};
|
14
|
+
pageNumber?: number;
|
15
|
+
pageSize?: number;
|
16
|
+
}
|
17
|
+
declare type QueryParams = QueryParamsRetrieve | QueryParamsList;
|
18
|
+
export { QueryParamsRetrieve, QueryParamsList, QueryParams };
|
19
|
+
declare type FilterPredicate = 'blank' | 'cont' | 'cont_all' | 'cont_any' | 'does_not_match' | 'does_not_match_all' | 'does_not_match_any' | 'end' | 'end_all' | 'end_any' | 'eq' | 'false' | 'gt' | 'gt_all' | 'gt_any' | 'gteq' | 'gteq_all' | 'gteq_any' | 'in' | 'lt' | 'lt_all' | 'lt_any' | 'lteq' | 'lteq_all' | 'lteq_any' | 'matches' | 'matches_all' | 'matches_any' | 'not_cont' | 'not_cont_all' | 'not_end' | 'not_end_all' | 'not_end_any' | 'not_eq' | 'not_eq_all' | 'not_in' | 'not_null' | 'not_start' | 'not_start_all' | 'not_start_any' | 'null' | 'present' | 'start' | 'start_all' | 'start_any' | 'true';
|
20
|
+
declare class QueryBuilderRetrieve {
|
21
|
+
#private;
|
22
|
+
constructor(resource?: string);
|
23
|
+
include(...resources: string[]): QueryBuilderRetrieve;
|
24
|
+
field(field: string, resource?: string): QueryBuilderRetrieve;
|
25
|
+
fields(fields: string[], resource?: string): QueryBuilderRetrieve;
|
26
|
+
clear(): QueryBuilderRetrieve;
|
27
|
+
build(): QueryParams;
|
28
|
+
generate(): {
|
29
|
+
[key: string]: string;
|
30
|
+
};
|
31
|
+
}
|
32
|
+
declare class QueryBuilderList extends QueryBuilderRetrieve {
|
33
|
+
#private;
|
34
|
+
constructor(resource?: string);
|
35
|
+
include(...resources: string[]): QueryBuilderList;
|
36
|
+
field(field: string, resource?: string): QueryBuilderList;
|
37
|
+
fields(fields: string[], resource?: string): QueryBuilderList;
|
38
|
+
pageNumber(num: number): QueryBuilderList;
|
39
|
+
pageSize(size: number): QueryBuilderList;
|
40
|
+
page(num: number, size: number): QueryBuilderList;
|
41
|
+
sort(field: string, descending?: boolean): QueryBuilderList;
|
42
|
+
filter(field: string | string[], predicate: FilterPredicate, value: string | number | boolean | string[], resource?: string): QueryBuilderList;
|
43
|
+
clear(): QueryBuilderList;
|
44
|
+
build(): QueryParams;
|
45
|
+
generate(): {
|
46
|
+
[key: string]: string;
|
47
|
+
};
|
48
|
+
}
|
49
|
+
declare class QueryBuilder extends QueryBuilderList {
|
50
|
+
constructor(resource?: string);
|
51
|
+
}
|
52
|
+
export default QueryBuilder;
|
53
|
+
export { QueryBuilderRetrieve, QueryBuilderList };
|
54
|
+
declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined) => {
|
55
|
+
[key: string]: string;
|
56
|
+
};
|
57
|
+
export { generateQueryStringParams };
|
package/lib/cjs/query.js
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
"use strict";
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
4
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
5
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
6
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
7
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
8
|
+
};
|
9
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
10
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
11
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
12
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
13
|
+
};
|
14
|
+
var _QueryBuilderRetrieve_resource, _QueryBuilderRetrieve_include, _QueryBuilderRetrieve_fields, _QueryBuilderList_sort, _QueryBuilderList_filters, _QueryBuilderList_pageNumber, _QueryBuilderList_pageSize;
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
16
|
+
exports.generateQueryStringParams = exports.QueryBuilderList = exports.QueryBuilderRetrieve = void 0;
|
17
|
+
const isParamsList = (params) => {
|
18
|
+
return (params.filters || params.pageNumber || params.pageSize || params.sort);
|
19
|
+
};
|
20
|
+
class QueryBuilderRetrieve {
|
21
|
+
constructor(resource) {
|
22
|
+
_QueryBuilderRetrieve_resource.set(this, void 0);
|
23
|
+
_QueryBuilderRetrieve_include.set(this, void 0);
|
24
|
+
_QueryBuilderRetrieve_fields.set(this, void 0);
|
25
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_resource, resource || '', "f");
|
26
|
+
}
|
27
|
+
include(...resources) {
|
28
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f"))
|
29
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_include, [], "f");
|
30
|
+
__classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f").push(...resources);
|
31
|
+
return this;
|
32
|
+
}
|
33
|
+
field(field, resource) {
|
34
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f"))
|
35
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_fields, {}, "f");
|
36
|
+
if (!resource)
|
37
|
+
resource = __classPrivateFieldGet(this, _QueryBuilderRetrieve_resource, "f");
|
38
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource])
|
39
|
+
__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource] = [];
|
40
|
+
__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource].push(field);
|
41
|
+
return this;
|
42
|
+
}
|
43
|
+
fields(fields, resource) {
|
44
|
+
fields.forEach(f => {
|
45
|
+
this.field(f, resource);
|
46
|
+
});
|
47
|
+
return this;
|
48
|
+
}
|
49
|
+
clear() {
|
50
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_include, undefined, "f");
|
51
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_fields, undefined, "f");
|
52
|
+
return this;
|
53
|
+
}
|
54
|
+
build() {
|
55
|
+
return {
|
56
|
+
include: __classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f"),
|
57
|
+
fields: __classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f"),
|
58
|
+
};
|
59
|
+
}
|
60
|
+
generate() {
|
61
|
+
return generateQueryStringParams(this.build());
|
62
|
+
}
|
63
|
+
}
|
64
|
+
exports.QueryBuilderRetrieve = QueryBuilderRetrieve;
|
65
|
+
_QueryBuilderRetrieve_resource = new WeakMap(), _QueryBuilderRetrieve_include = new WeakMap(), _QueryBuilderRetrieve_fields = new WeakMap();
|
66
|
+
class QueryBuilderList extends QueryBuilderRetrieve {
|
67
|
+
constructor(resource) {
|
68
|
+
super(resource);
|
69
|
+
_QueryBuilderList_sort.set(this, void 0);
|
70
|
+
_QueryBuilderList_filters.set(this, void 0);
|
71
|
+
_QueryBuilderList_pageNumber.set(this, void 0);
|
72
|
+
_QueryBuilderList_pageSize.set(this, void 0);
|
73
|
+
}
|
74
|
+
include(...resources) {
|
75
|
+
return super.include(...resources);
|
76
|
+
}
|
77
|
+
field(field, resource) {
|
78
|
+
return super.field(field, resource);
|
79
|
+
}
|
80
|
+
fields(fields, resource) {
|
81
|
+
return super.fields(fields, resource);
|
82
|
+
}
|
83
|
+
pageNumber(num) {
|
84
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, num, "f");
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
pageSize(size) {
|
88
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, size, "f");
|
89
|
+
return this;
|
90
|
+
}
|
91
|
+
page(num, size) {
|
92
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, num, "f");
|
93
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, size, "f");
|
94
|
+
return this;
|
95
|
+
}
|
96
|
+
sort(field, descending) {
|
97
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderList_sort, "f"))
|
98
|
+
__classPrivateFieldSet(this, _QueryBuilderList_sort, [], "f");
|
99
|
+
__classPrivateFieldGet(this, _QueryBuilderList_sort, "f").push(`${descending ? '-' : ''}${field}`);
|
100
|
+
return this;
|
101
|
+
}
|
102
|
+
filter(field, predicate, value, resource) {
|
103
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderList_filters, "f"))
|
104
|
+
__classPrivateFieldSet(this, _QueryBuilderList_filters, {}, "f");
|
105
|
+
const r = resource ? `${resource}_` : '';
|
106
|
+
__classPrivateFieldGet(this, _QueryBuilderList_filters, "f")[`${Array.isArray(field) ? field.map(f => `${r}${f}`).join('_or_') : (r + field)}_${predicate}`] = Array.isArray(value) ? value.join(',') : value;
|
107
|
+
return this;
|
108
|
+
}
|
109
|
+
clear() {
|
110
|
+
super.clear();
|
111
|
+
__classPrivateFieldSet(this, _QueryBuilderList_sort, undefined, "f");
|
112
|
+
__classPrivateFieldSet(this, _QueryBuilderList_filters, undefined, "f");
|
113
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, undefined, "f");
|
114
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, undefined, "f");
|
115
|
+
return this;
|
116
|
+
}
|
117
|
+
build() {
|
118
|
+
return Object.assign(super.build(), {
|
119
|
+
sort: __classPrivateFieldGet(this, _QueryBuilderList_sort, "f"),
|
120
|
+
filters: __classPrivateFieldGet(this, _QueryBuilderList_filters, "f"),
|
121
|
+
pageNumber: __classPrivateFieldGet(this, _QueryBuilderList_pageNumber, "f"),
|
122
|
+
pageSize: __classPrivateFieldGet(this, _QueryBuilderList_pageSize, "f"),
|
123
|
+
});
|
124
|
+
}
|
125
|
+
generate() {
|
126
|
+
return generateQueryStringParams(this.build());
|
127
|
+
}
|
128
|
+
}
|
129
|
+
exports.QueryBuilderList = QueryBuilderList;
|
130
|
+
_QueryBuilderList_sort = new WeakMap(), _QueryBuilderList_filters = new WeakMap(), _QueryBuilderList_pageNumber = new WeakMap(), _QueryBuilderList_pageSize = new WeakMap();
|
131
|
+
class QueryBuilder extends QueryBuilderList {
|
132
|
+
constructor(resource) {
|
133
|
+
super(resource);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
exports.default = QueryBuilder;
|
137
|
+
const generateQueryStringParams = (params) => {
|
138
|
+
const qp = {};
|
139
|
+
if (!params)
|
140
|
+
return qp;
|
141
|
+
// Include
|
142
|
+
if (params.include)
|
143
|
+
qp['include'] = params.include.join(',');
|
144
|
+
// Fields
|
145
|
+
if (params.fields) {
|
146
|
+
Object.entries(params.fields).forEach(([p, v]) => {
|
147
|
+
qp[`fields[${p}]`] = v.join(',');
|
148
|
+
});
|
149
|
+
}
|
150
|
+
if (isParamsList(params)) {
|
151
|
+
// Sort
|
152
|
+
if (params.sort) {
|
153
|
+
if (Array.isArray(params.sort))
|
154
|
+
qp['sort'] = params.sort.join(',');
|
155
|
+
else
|
156
|
+
qp['sort'] = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',');
|
157
|
+
}
|
158
|
+
// Page
|
159
|
+
if (params.pageNumber)
|
160
|
+
qp['page[number]'] = String(params.pageNumber);
|
161
|
+
if (params.pageSize)
|
162
|
+
qp['page[size]'] = String(params.pageSize);
|
163
|
+
// Filters
|
164
|
+
if (params.filters) {
|
165
|
+
Object.entries(params.filters).forEach(([p, v]) => {
|
166
|
+
qp[`filter[q][${p}]`] = String(v);
|
167
|
+
});
|
168
|
+
}
|
169
|
+
}
|
170
|
+
return qp;
|
171
|
+
};
|
172
|
+
exports.generateQueryStringParams = generateQueryStringParams;
|