@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
package/lib/esm/query.js
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
5
|
+
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");
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
7
|
+
};
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
10
|
+
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");
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
12
|
+
};
|
13
|
+
var _QueryBuilderRetrieve_resource, _QueryBuilderRetrieve_include, _QueryBuilderRetrieve_fields, _QueryBuilderList_sort, _QueryBuilderList_filters, _QueryBuilderList_pageNumber, _QueryBuilderList_pageSize;
|
14
|
+
const isParamsList = (params) => {
|
15
|
+
return (params.filters || params.pageNumber || params.pageSize || params.sort);
|
16
|
+
};
|
17
|
+
class QueryBuilderRetrieve {
|
18
|
+
constructor(resource) {
|
19
|
+
_QueryBuilderRetrieve_resource.set(this, void 0);
|
20
|
+
_QueryBuilderRetrieve_include.set(this, void 0);
|
21
|
+
_QueryBuilderRetrieve_fields.set(this, void 0);
|
22
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_resource, resource || '', "f");
|
23
|
+
}
|
24
|
+
include(...resources) {
|
25
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f"))
|
26
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_include, [], "f");
|
27
|
+
__classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f").push(...resources);
|
28
|
+
return this;
|
29
|
+
}
|
30
|
+
field(field, resource) {
|
31
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f"))
|
32
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_fields, {}, "f");
|
33
|
+
if (!resource)
|
34
|
+
resource = __classPrivateFieldGet(this, _QueryBuilderRetrieve_resource, "f");
|
35
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource])
|
36
|
+
__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource] = [];
|
37
|
+
__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource].push(field);
|
38
|
+
return this;
|
39
|
+
}
|
40
|
+
fields(fields, resource) {
|
41
|
+
fields.forEach(f => {
|
42
|
+
this.field(f, resource);
|
43
|
+
});
|
44
|
+
return this;
|
45
|
+
}
|
46
|
+
clear() {
|
47
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_include, undefined, "f");
|
48
|
+
__classPrivateFieldSet(this, _QueryBuilderRetrieve_fields, undefined, "f");
|
49
|
+
return this;
|
50
|
+
}
|
51
|
+
build() {
|
52
|
+
return {
|
53
|
+
include: __classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f"),
|
54
|
+
fields: __classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f"),
|
55
|
+
};
|
56
|
+
}
|
57
|
+
generate() {
|
58
|
+
return generateQueryStringParams(this.build());
|
59
|
+
}
|
60
|
+
}
|
61
|
+
_QueryBuilderRetrieve_resource = new WeakMap(), _QueryBuilderRetrieve_include = new WeakMap(), _QueryBuilderRetrieve_fields = new WeakMap();
|
62
|
+
class QueryBuilderList extends QueryBuilderRetrieve {
|
63
|
+
constructor(resource) {
|
64
|
+
super(resource);
|
65
|
+
_QueryBuilderList_sort.set(this, void 0);
|
66
|
+
_QueryBuilderList_filters.set(this, void 0);
|
67
|
+
_QueryBuilderList_pageNumber.set(this, void 0);
|
68
|
+
_QueryBuilderList_pageSize.set(this, void 0);
|
69
|
+
}
|
70
|
+
include(...resources) {
|
71
|
+
return super.include(...resources);
|
72
|
+
}
|
73
|
+
field(field, resource) {
|
74
|
+
return super.field(field, resource);
|
75
|
+
}
|
76
|
+
fields(fields, resource) {
|
77
|
+
return super.fields(fields, resource);
|
78
|
+
}
|
79
|
+
pageNumber(num) {
|
80
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, num, "f");
|
81
|
+
return this;
|
82
|
+
}
|
83
|
+
pageSize(size) {
|
84
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, size, "f");
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
page(num, size) {
|
88
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, num, "f");
|
89
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, size, "f");
|
90
|
+
return this;
|
91
|
+
}
|
92
|
+
sort(field, descending) {
|
93
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderList_sort, "f"))
|
94
|
+
__classPrivateFieldSet(this, _QueryBuilderList_sort, [], "f");
|
95
|
+
__classPrivateFieldGet(this, _QueryBuilderList_sort, "f").push(`${descending ? '-' : ''}${field}`);
|
96
|
+
return this;
|
97
|
+
}
|
98
|
+
filter(field, predicate, value, resource) {
|
99
|
+
if (!__classPrivateFieldGet(this, _QueryBuilderList_filters, "f"))
|
100
|
+
__classPrivateFieldSet(this, _QueryBuilderList_filters, {}, "f");
|
101
|
+
const r = resource ? `${resource}_` : '';
|
102
|
+
__classPrivateFieldGet(this, _QueryBuilderList_filters, "f")[`${Array.isArray(field) ? field.map(f => `${r}${f}`).join('_or_') : (r + field)}_${predicate}`] = Array.isArray(value) ? value.join(',') : value;
|
103
|
+
return this;
|
104
|
+
}
|
105
|
+
clear() {
|
106
|
+
super.clear();
|
107
|
+
__classPrivateFieldSet(this, _QueryBuilderList_sort, undefined, "f");
|
108
|
+
__classPrivateFieldSet(this, _QueryBuilderList_filters, undefined, "f");
|
109
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, undefined, "f");
|
110
|
+
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, undefined, "f");
|
111
|
+
return this;
|
112
|
+
}
|
113
|
+
build() {
|
114
|
+
return Object.assign(super.build(), {
|
115
|
+
sort: __classPrivateFieldGet(this, _QueryBuilderList_sort, "f"),
|
116
|
+
filters: __classPrivateFieldGet(this, _QueryBuilderList_filters, "f"),
|
117
|
+
pageNumber: __classPrivateFieldGet(this, _QueryBuilderList_pageNumber, "f"),
|
118
|
+
pageSize: __classPrivateFieldGet(this, _QueryBuilderList_pageSize, "f"),
|
119
|
+
});
|
120
|
+
}
|
121
|
+
generate() {
|
122
|
+
return generateQueryStringParams(this.build());
|
123
|
+
}
|
124
|
+
}
|
125
|
+
_QueryBuilderList_sort = new WeakMap(), _QueryBuilderList_filters = new WeakMap(), _QueryBuilderList_pageNumber = new WeakMap(), _QueryBuilderList_pageSize = new WeakMap();
|
126
|
+
class QueryBuilder extends QueryBuilderList {
|
127
|
+
constructor(resource) {
|
128
|
+
super(resource);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
export default QueryBuilder;
|
132
|
+
export { QueryBuilderRetrieve, QueryBuilderList };
|
133
|
+
const generateQueryStringParams = (params) => {
|
134
|
+
const qp = {};
|
135
|
+
if (!params)
|
136
|
+
return qp;
|
137
|
+
// Include
|
138
|
+
if (params.include)
|
139
|
+
qp['include'] = params.include.join(',');
|
140
|
+
// Fields
|
141
|
+
if (params.fields) {
|
142
|
+
Object.entries(params.fields).forEach(([p, v]) => {
|
143
|
+
qp[`fields[${p}]`] = v.join(',');
|
144
|
+
});
|
145
|
+
}
|
146
|
+
if (isParamsList(params)) {
|
147
|
+
// Sort
|
148
|
+
if (params.sort) {
|
149
|
+
if (Array.isArray(params.sort))
|
150
|
+
qp['sort'] = params.sort.join(',');
|
151
|
+
else
|
152
|
+
qp['sort'] = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',');
|
153
|
+
}
|
154
|
+
// Page
|
155
|
+
if (params.pageNumber)
|
156
|
+
qp['page[number]'] = String(params.pageNumber);
|
157
|
+
if (params.pageSize)
|
158
|
+
qp['page[size]'] = String(params.pageSize);
|
159
|
+
// Filters
|
160
|
+
if (params.filters) {
|
161
|
+
Object.entries(params.filters).forEach(([p, v]) => {
|
162
|
+
qp[`filter[q][${p}]`] = String(v);
|
163
|
+
});
|
164
|
+
}
|
165
|
+
}
|
166
|
+
return qp;
|
167
|
+
};
|
168
|
+
export { generateQueryStringParams };
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { ApiClientConfig, ApiClientInitConfig } from './client';
|
2
|
+
import { JSONValue } from './jsonapi';
|
3
|
+
import { QueryParamsRetrieve, QueryParamsList } from './query';
|
4
|
+
import { ResourceTypeLock } from './api';
|
5
|
+
import { InterceptorManager } from './interceptor';
|
6
|
+
declare type Metadata = {
|
7
|
+
[key: string]: JSONValue;
|
8
|
+
};
|
9
|
+
interface ResourceType {
|
10
|
+
readonly type: ResourceTypeLock;
|
11
|
+
}
|
12
|
+
interface ResourceId extends ResourceType {
|
13
|
+
readonly id: string;
|
14
|
+
}
|
15
|
+
interface Resource extends ResourceId {
|
16
|
+
reference?: string;
|
17
|
+
reference_origin?: string;
|
18
|
+
metadata?: Metadata;
|
19
|
+
readonly created_at: string;
|
20
|
+
readonly updated_at: string;
|
21
|
+
}
|
22
|
+
interface ResourceCreate {
|
23
|
+
reference?: string;
|
24
|
+
reference_origin?: string;
|
25
|
+
metadata?: Metadata;
|
26
|
+
}
|
27
|
+
interface ResourceUpdate {
|
28
|
+
readonly id: string;
|
29
|
+
reference?: string;
|
30
|
+
reference_origin?: string;
|
31
|
+
metadata?: Metadata;
|
32
|
+
}
|
33
|
+
declare type ListMeta = {
|
34
|
+
readonly pageCount: number;
|
35
|
+
readonly recordCount: number;
|
36
|
+
readonly currentPage: number;
|
37
|
+
readonly recordsPerPage: number;
|
38
|
+
};
|
39
|
+
declare class ListResponse<R> extends Array<R> {
|
40
|
+
readonly meta: ListMeta;
|
41
|
+
constructor(meta: ListMeta, data: Array<R>);
|
42
|
+
first(): R | undefined;
|
43
|
+
last(): R | undefined;
|
44
|
+
get(index: number): R | undefined;
|
45
|
+
}
|
46
|
+
export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse };
|
47
|
+
declare type ResourceAdapterConfig = {};
|
48
|
+
declare type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig;
|
49
|
+
declare type ResourcesConfig = ResourceAdapterConfig & ApiClientConfig;
|
50
|
+
declare class ResourceAdapter {
|
51
|
+
#private;
|
52
|
+
constructor(config: ResourcesInitConfig);
|
53
|
+
get interceptors(): InterceptorManager;
|
54
|
+
config(config: ResourcesConfig): void;
|
55
|
+
singleton<R extends Resource>(resource: ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
56
|
+
retrieve<R extends Resource>(resource: ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
57
|
+
list<R extends Resource>(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
58
|
+
create<C extends ResourceCreate, R extends Resource>(resource: C & ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
59
|
+
update<U extends ResourceUpdate, R extends Resource>(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
60
|
+
delete(resource: ResourceId, options?: ResourcesConfig): Promise<void>;
|
61
|
+
}
|
62
|
+
declare abstract class ApiResource {
|
63
|
+
static readonly TYPE: ResourceTypeLock;
|
64
|
+
protected resources: ResourceAdapter;
|
65
|
+
constructor(adapter: ResourceAdapter);
|
66
|
+
abstract relationship(id: string | ResourceId): ResourceId;
|
67
|
+
}
|
68
|
+
export default ResourceAdapter;
|
69
|
+
export { ApiResource, ResourcesConfig, ResourcesInitConfig };
|
@@ -0,0 +1,108 @@
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
+
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");
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
+
};
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
+
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");
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
+
};
|
12
|
+
var _ResourceAdapter_client, _ResourceAdapter_config;
|
13
|
+
import ApiClient from './client';
|
14
|
+
import { denormalize, normalize } from './jsonapi';
|
15
|
+
import { generateQueryStringParams } from './query';
|
16
|
+
import config from './config';
|
17
|
+
class ListResponse extends Array {
|
18
|
+
constructor(meta, data) {
|
19
|
+
super(...data);
|
20
|
+
this.meta = meta;
|
21
|
+
}
|
22
|
+
first() { return this.length ? this[0] : undefined; }
|
23
|
+
last() { return this.length ? this[this.length - 1] : undefined; }
|
24
|
+
get(index) { return (this.length && (index >= 0)) ? this[index] : undefined; }
|
25
|
+
}
|
26
|
+
class ResourceAdapter {
|
27
|
+
constructor(config) {
|
28
|
+
_ResourceAdapter_client.set(this, void 0);
|
29
|
+
_ResourceAdapter_config.set(this, {});
|
30
|
+
__classPrivateFieldSet(this, _ResourceAdapter_client, ApiClient.create(config), "f");
|
31
|
+
this.config(config);
|
32
|
+
}
|
33
|
+
get interceptors() { return __classPrivateFieldGet(this, _ResourceAdapter_client, "f").interceptors; }
|
34
|
+
config(config) {
|
35
|
+
if (!config)
|
36
|
+
return;
|
37
|
+
// Client config
|
38
|
+
__classPrivateFieldGet(this, _ResourceAdapter_client, "f").config(config);
|
39
|
+
// Resources config
|
40
|
+
// if (typeof config.rawResponse !== 'undefined') this.#config.rawResponse = config.rawResponse
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
/*
|
44
|
+
private isRawResponse(options?: ResourcesConfig): boolean {
|
45
|
+
return (typeof options?.rawResponse !== 'undefined') ? (options?.rawResponse === true) : (this.#config.rawResponse === true)
|
46
|
+
}
|
47
|
+
*/
|
48
|
+
async singleton(resource, params, options) {
|
49
|
+
const queryParams = generateQueryStringParams(params);
|
50
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
51
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
52
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
|
53
|
+
const r = denormalize(res);
|
54
|
+
return r;
|
55
|
+
}
|
56
|
+
async retrieve(resource, params, options) {
|
57
|
+
const queryParams = generateQueryStringParams(params);
|
58
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
59
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
60
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}/${resource.id}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
|
61
|
+
const r = denormalize(res);
|
62
|
+
return r;
|
63
|
+
}
|
64
|
+
async list(resource, params, options) {
|
65
|
+
var _a, _b;
|
66
|
+
const queryParams = generateQueryStringParams(params);
|
67
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
68
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
69
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
|
70
|
+
const r = denormalize(res);
|
71
|
+
const meta = {
|
72
|
+
pageCount: Number((_a = res.meta) === null || _a === void 0 ? void 0 : _a.page_count),
|
73
|
+
recordCount: Number((_b = res.meta) === null || _b === void 0 ? void 0 : _b.record_count),
|
74
|
+
currentPage: (params === null || params === void 0 ? void 0 : params.pageNumber) || config.default.pageNumber,
|
75
|
+
recordsPerPage: (params === null || params === void 0 ? void 0 : params.pageSize) || config.default.pageSize
|
76
|
+
};
|
77
|
+
return new ListResponse(meta, r);
|
78
|
+
}
|
79
|
+
async create(resource, params, options) {
|
80
|
+
const queryParams = generateQueryStringParams(params);
|
81
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
82
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
83
|
+
const data = normalize(resource);
|
84
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('post', resource.type, data, Object.assign(Object.assign({}, options), { params: queryParams }));
|
85
|
+
const r = denormalize(res);
|
86
|
+
return r;
|
87
|
+
}
|
88
|
+
async update(resource, params, options) {
|
89
|
+
const queryParams = generateQueryStringParams(params);
|
90
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
91
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
92
|
+
const data = normalize(resource);
|
93
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('patch', `${resource.type}/${resource.id}`, data, Object.assign(Object.assign({}, options), { params: queryParams }));
|
94
|
+
const r = denormalize(res);
|
95
|
+
return r;
|
96
|
+
}
|
97
|
+
async delete(resource, options) {
|
98
|
+
await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('delete', `${resource.type}/${resource.id}`, undefined, options);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
_ResourceAdapter_client = new WeakMap(), _ResourceAdapter_config = new WeakMap();
|
102
|
+
class ApiResource {
|
103
|
+
constructor(adapter) {
|
104
|
+
this.resources = adapter;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
export default ResourceAdapter;
|
108
|
+
export { ApiResource };
|
@@ -0,0 +1,91 @@
|
|
1
|
+
/**
|
2
|
+
* ©2021 Commerce Layer Inc.
|
3
|
+
* Source code generated automatically by SDK codegen from OpenAPI schema 2.7.3
|
4
|
+
**/
|
5
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource';
|
6
|
+
import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query';
|
7
|
+
import { Geocoder } from './geocoders';
|
8
|
+
declare type AddressRel = ResourceId & {
|
9
|
+
type: typeof Addresses.TYPE;
|
10
|
+
};
|
11
|
+
declare type GeocoderRel = ResourceId & {
|
12
|
+
type: 'geocoders';
|
13
|
+
};
|
14
|
+
interface Address extends Resource {
|
15
|
+
business?: boolean;
|
16
|
+
first_name?: string;
|
17
|
+
last_name?: string;
|
18
|
+
company?: string;
|
19
|
+
full_name?: string;
|
20
|
+
line_1?: string;
|
21
|
+
line_2?: string;
|
22
|
+
city?: string;
|
23
|
+
zip_code?: string;
|
24
|
+
state_code?: string;
|
25
|
+
country_code?: string;
|
26
|
+
phone?: string;
|
27
|
+
full_address?: string;
|
28
|
+
name?: string;
|
29
|
+
email?: string;
|
30
|
+
notes?: string;
|
31
|
+
lat?: number;
|
32
|
+
lng?: number;
|
33
|
+
is_localized?: boolean;
|
34
|
+
is_geocoded?: boolean;
|
35
|
+
provider_name?: string;
|
36
|
+
map_url?: string;
|
37
|
+
static_map_url?: string;
|
38
|
+
billing_info?: string;
|
39
|
+
geocoder?: Geocoder;
|
40
|
+
}
|
41
|
+
interface AddressCreate extends ResourceCreate {
|
42
|
+
business?: boolean;
|
43
|
+
first_name?: string;
|
44
|
+
last_name?: string;
|
45
|
+
company?: string;
|
46
|
+
line_1: string;
|
47
|
+
line_2?: string;
|
48
|
+
city: string;
|
49
|
+
zip_code?: string;
|
50
|
+
state_code: string;
|
51
|
+
country_code: string;
|
52
|
+
phone: string;
|
53
|
+
email?: string;
|
54
|
+
notes?: string;
|
55
|
+
lat?: number;
|
56
|
+
lng?: number;
|
57
|
+
billing_info?: string;
|
58
|
+
geocoder?: GeocoderRel;
|
59
|
+
}
|
60
|
+
interface AddressUpdate extends ResourceUpdate {
|
61
|
+
business?: boolean;
|
62
|
+
first_name?: string;
|
63
|
+
last_name?: string;
|
64
|
+
company?: string;
|
65
|
+
line_1?: string;
|
66
|
+
line_2?: string;
|
67
|
+
city?: string;
|
68
|
+
zip_code?: string;
|
69
|
+
state_code?: string;
|
70
|
+
country_code?: string;
|
71
|
+
phone?: string;
|
72
|
+
email?: string;
|
73
|
+
notes?: string;
|
74
|
+
lat?: number;
|
75
|
+
lng?: number;
|
76
|
+
billing_info?: string;
|
77
|
+
geocoder?: GeocoderRel;
|
78
|
+
}
|
79
|
+
declare class Addresses extends ApiResource {
|
80
|
+
static readonly TYPE: 'addresses';
|
81
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Address>>;
|
82
|
+
create(resource: AddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
|
83
|
+
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
|
84
|
+
update(resource: AddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
|
85
|
+
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
86
|
+
isAddress(resource: any): resource is Address;
|
87
|
+
relationship(id: string | ResourceId): AddressRel;
|
88
|
+
type(): string;
|
89
|
+
}
|
90
|
+
export default Addresses;
|
91
|
+
export { Address, AddressCreate, AddressUpdate };
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/**
|
2
|
+
* ©2021 Commerce Layer Inc.
|
3
|
+
* Source code generated automatically by SDK codegen from OpenAPI schema 2.7.3
|
4
|
+
**/
|
5
|
+
import { ApiResource } from '../resource';
|
6
|
+
class Addresses extends ApiResource {
|
7
|
+
// static readonly PATH = 'addresses'
|
8
|
+
async list(params, options) {
|
9
|
+
return this.resources.list({ type: Addresses.TYPE }, params, options);
|
10
|
+
}
|
11
|
+
async create(resource, params, options) {
|
12
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: Addresses.TYPE }), params, options);
|
13
|
+
}
|
14
|
+
async retrieve(id, params, options) {
|
15
|
+
return this.resources.retrieve({ type: Addresses.TYPE, id }, params, options);
|
16
|
+
}
|
17
|
+
async update(resource, params, options) {
|
18
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: Addresses.TYPE }), params, options);
|
19
|
+
}
|
20
|
+
async delete(id, options) {
|
21
|
+
await this.resources.delete({ type: Addresses.TYPE, id }, options);
|
22
|
+
}
|
23
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
24
|
+
isAddress(resource) {
|
25
|
+
return resource.type && (resource.type === Addresses.TYPE);
|
26
|
+
}
|
27
|
+
/*
|
28
|
+
filter(): QueryBuilderRetrieve {
|
29
|
+
return new QueryBuilderRetrieve(Addresses.TYPE)
|
30
|
+
}
|
31
|
+
*/
|
32
|
+
/*
|
33
|
+
filterList(): QueryBuilderList {
|
34
|
+
return new QueryBuilderList(Addresses.TYPE)
|
35
|
+
}
|
36
|
+
*/
|
37
|
+
relationship(id) {
|
38
|
+
return (typeof id === 'string') ? { id, type: Addresses.TYPE } : { id: id.id, type: Addresses.TYPE };
|
39
|
+
}
|
40
|
+
type() {
|
41
|
+
return Addresses.TYPE;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
Addresses.TYPE = 'addresses';
|
45
|
+
export default Addresses;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* ©2021 Commerce Layer Inc.
|
3
|
+
* Source code generated automatically by SDK codegen from OpenAPI schema 2.7.3
|
4
|
+
**/
|
5
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource';
|
6
|
+
import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query';
|
7
|
+
declare type AdjustmentRel = ResourceId & {
|
8
|
+
type: typeof Adjustments.TYPE;
|
9
|
+
};
|
10
|
+
interface Adjustment extends Resource {
|
11
|
+
name?: string;
|
12
|
+
currency_code?: string;
|
13
|
+
amount_cents?: number;
|
14
|
+
amount_float?: number;
|
15
|
+
formatted_amount?: string;
|
16
|
+
}
|
17
|
+
interface AdjustmentCreate extends ResourceCreate {
|
18
|
+
name: string;
|
19
|
+
currency_code: string;
|
20
|
+
amount_cents: number;
|
21
|
+
}
|
22
|
+
interface AdjustmentUpdate extends ResourceUpdate {
|
23
|
+
name?: string;
|
24
|
+
currency_code?: string;
|
25
|
+
amount_cents?: number;
|
26
|
+
}
|
27
|
+
declare class Adjustments extends ApiResource {
|
28
|
+
static readonly TYPE: 'adjustments';
|
29
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Adjustment>>;
|
30
|
+
create(resource: AdjustmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
|
31
|
+
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
|
32
|
+
update(resource: AdjustmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
|
33
|
+
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
34
|
+
isAdjustment(resource: any): resource is Adjustment;
|
35
|
+
relationship(id: string | ResourceId): AdjustmentRel;
|
36
|
+
type(): string;
|
37
|
+
}
|
38
|
+
export default Adjustments;
|
39
|
+
export { Adjustment, AdjustmentCreate, AdjustmentUpdate };
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/**
|
2
|
+
* ©2021 Commerce Layer Inc.
|
3
|
+
* Source code generated automatically by SDK codegen from OpenAPI schema 2.7.3
|
4
|
+
**/
|
5
|
+
import { ApiResource } from '../resource';
|
6
|
+
class Adjustments extends ApiResource {
|
7
|
+
// static readonly PATH = 'adjustments'
|
8
|
+
async list(params, options) {
|
9
|
+
return this.resources.list({ type: Adjustments.TYPE }, params, options);
|
10
|
+
}
|
11
|
+
async create(resource, params, options) {
|
12
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: Adjustments.TYPE }), params, options);
|
13
|
+
}
|
14
|
+
async retrieve(id, params, options) {
|
15
|
+
return this.resources.retrieve({ type: Adjustments.TYPE, id }, params, options);
|
16
|
+
}
|
17
|
+
async update(resource, params, options) {
|
18
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: Adjustments.TYPE }), params, options);
|
19
|
+
}
|
20
|
+
async delete(id, options) {
|
21
|
+
await this.resources.delete({ type: Adjustments.TYPE, id }, options);
|
22
|
+
}
|
23
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
24
|
+
isAdjustment(resource) {
|
25
|
+
return resource.type && (resource.type === Adjustments.TYPE);
|
26
|
+
}
|
27
|
+
/*
|
28
|
+
filter(): QueryBuilderRetrieve {
|
29
|
+
return new QueryBuilderRetrieve(Adjustments.TYPE)
|
30
|
+
}
|
31
|
+
*/
|
32
|
+
/*
|
33
|
+
filterList(): QueryBuilderList {
|
34
|
+
return new QueryBuilderList(Adjustments.TYPE)
|
35
|
+
}
|
36
|
+
*/
|
37
|
+
relationship(id) {
|
38
|
+
return (typeof id === 'string') ? { id, type: Adjustments.TYPE } : { id: id.id, type: Adjustments.TYPE };
|
39
|
+
}
|
40
|
+
type() {
|
41
|
+
return Adjustments.TYPE;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
Adjustments.TYPE = 'adjustments';
|
45
|
+
export default Adjustments;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/**
|
2
|
+
* ©2021 Commerce Layer Inc.
|
3
|
+
* Source code generated automatically by SDK codegen from OpenAPI schema 2.7.3
|
4
|
+
**/
|
5
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource';
|
6
|
+
import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query';
|
7
|
+
import { PaymentMethod } from './payment_methods';
|
8
|
+
import { AdyenPayment } from './adyen_payments';
|
9
|
+
declare type AdyenGatewayRel = ResourceId & {
|
10
|
+
type: typeof AdyenGateways.TYPE;
|
11
|
+
};
|
12
|
+
declare type AdyenPaymentRel = ResourceId & {
|
13
|
+
type: 'adyen_payments';
|
14
|
+
};
|
15
|
+
interface AdyenGateway extends Resource {
|
16
|
+
name?: string;
|
17
|
+
live_url_prefix?: string;
|
18
|
+
payment_methods?: PaymentMethod[];
|
19
|
+
adyen_payments?: AdyenPayment[];
|
20
|
+
}
|
21
|
+
interface AdyenGatewayCreate extends ResourceCreate {
|
22
|
+
name: string;
|
23
|
+
merchant_account: string;
|
24
|
+
api_key: string;
|
25
|
+
public_key?: string;
|
26
|
+
live_url_prefix: string;
|
27
|
+
adyen_payments?: AdyenPaymentRel[];
|
28
|
+
}
|
29
|
+
interface AdyenGatewayUpdate extends ResourceUpdate {
|
30
|
+
name?: string;
|
31
|
+
merchant_account?: string;
|
32
|
+
api_key?: string;
|
33
|
+
public_key?: string;
|
34
|
+
live_url_prefix?: string;
|
35
|
+
adyen_payments?: AdyenPaymentRel[];
|
36
|
+
}
|
37
|
+
declare class AdyenGateways extends ApiResource {
|
38
|
+
static readonly TYPE: 'adyen_gateways';
|
39
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<AdyenGateway>>;
|
40
|
+
create(resource: AdyenGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenGateway>;
|
41
|
+
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenGateway>;
|
42
|
+
update(resource: AdyenGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenGateway>;
|
43
|
+
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
44
|
+
isAdyenGateway(resource: any): resource is AdyenGateway;
|
45
|
+
relationship(id: string | ResourceId): AdyenGatewayRel;
|
46
|
+
type(): string;
|
47
|
+
}
|
48
|
+
export default AdyenGateways;
|
49
|
+
export { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate };
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/**
|
2
|
+
* ©2021 Commerce Layer Inc.
|
3
|
+
* Source code generated automatically by SDK codegen from OpenAPI schema 2.7.3
|
4
|
+
**/
|
5
|
+
import { ApiResource } from '../resource';
|
6
|
+
class AdyenGateways extends ApiResource {
|
7
|
+
// static readonly PATH = 'adyen_gateways'
|
8
|
+
async list(params, options) {
|
9
|
+
return this.resources.list({ type: AdyenGateways.TYPE }, params, options);
|
10
|
+
}
|
11
|
+
async create(resource, params, options) {
|
12
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: AdyenGateways.TYPE }), params, options);
|
13
|
+
}
|
14
|
+
async retrieve(id, params, options) {
|
15
|
+
return this.resources.retrieve({ type: AdyenGateways.TYPE, id }, params, options);
|
16
|
+
}
|
17
|
+
async update(resource, params, options) {
|
18
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: AdyenGateways.TYPE }), params, options);
|
19
|
+
}
|
20
|
+
async delete(id, options) {
|
21
|
+
await this.resources.delete({ type: AdyenGateways.TYPE, id }, options);
|
22
|
+
}
|
23
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
24
|
+
isAdyenGateway(resource) {
|
25
|
+
return resource.type && (resource.type === AdyenGateways.TYPE);
|
26
|
+
}
|
27
|
+
/*
|
28
|
+
filter(): QueryBuilderRetrieve {
|
29
|
+
return new QueryBuilderRetrieve(AdyenGateways.TYPE)
|
30
|
+
}
|
31
|
+
*/
|
32
|
+
/*
|
33
|
+
filterList(): QueryBuilderList {
|
34
|
+
return new QueryBuilderList(AdyenGateways.TYPE)
|
35
|
+
}
|
36
|
+
*/
|
37
|
+
relationship(id) {
|
38
|
+
return (typeof id === 'string') ? { id, type: AdyenGateways.TYPE } : { id: id.id, type: AdyenGateways.TYPE };
|
39
|
+
}
|
40
|
+
type() {
|
41
|
+
return AdyenGateways.TYPE;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
AdyenGateways.TYPE = 'adyen_gateways';
|
45
|
+
export default AdyenGateways;
|