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