@commercelayer/sdk 5.0.0-alpha.2 → 5.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -33
- package/lib/api.d.ts +1 -103
- package/lib/client.d.ts +1 -31
- package/lib/client.js +1 -1
- package/lib/commercelayer.d.ts +1 -122
- package/lib/commercelayer.js +1 -1
- package/lib/common.d.ts +1 -4
- package/lib/config.d.ts +1 -11
- package/lib/debug.d.ts +1 -3
- package/lib/debug.js +1 -1
- package/lib/error.d.ts +1 -26
- package/lib/error.js +1 -1
- package/lib/index.d.ts +1 -7
- package/lib/interceptor.d.ts +1 -19
- package/lib/jsonapi.d.ts +1 -5
- package/lib/jsonapi.js +1 -1
- package/lib/model.d.ts +1 -101
- package/lib/query.d.ts +1 -23
- package/lib/query.js +1 -1
- package/lib/resource.d.ts +1 -76
- package/lib/resource.js +1 -1
- package/lib/resources/addresses.d.ts +1 -88
- package/lib/resources/addresses.js +1 -1
- package/lib/resources/adjustments.d.ts +1 -35
- package/lib/resources/adjustments.js +1 -1
- package/lib/resources/adyen_gateways.d.ts +1 -47
- package/lib/resources/adyen_gateways.js +1 -1
- package/lib/resources/adyen_payments.d.ts +1 -44
- package/lib/resources/adyen_payments.js +1 -1
- package/lib/resources/application.d.ts +1 -21
- package/lib/resources/application.js +1 -1
- package/lib/resources/attachments.d.ts +1 -156
- package/lib/resources/attachments.js +1 -1
- package/lib/resources/authorizations.d.ts +1 -57
- package/lib/resources/authorizations.js +1 -1
- package/lib/resources/avalara_accounts.d.ts +1 -52
- package/lib/resources/avalara_accounts.js +1 -1
- package/lib/resources/billing_info_validation_rules.d.ts +1 -32
- package/lib/resources/billing_info_validation_rules.js +1 -1
- package/lib/resources/bing_geocoders.d.ts +1 -35
- package/lib/resources/bing_geocoders.js +1 -1
- package/lib/resources/braintree_gateways.d.ts +1 -56
- package/lib/resources/braintree_gateways.js +1 -1
- package/lib/resources/braintree_payments.d.ts +1 -47
- package/lib/resources/braintree_payments.js +1 -1
- package/lib/resources/bundles.d.ts +1 -74
- package/lib/resources/bundles.js +1 -1
- package/lib/resources/captures.d.ts +1 -48
- package/lib/resources/captures.js +1 -1
- package/lib/resources/carrier_accounts.d.ts +1 -26
- package/lib/resources/carrier_accounts.js +1 -1
- package/lib/resources/checkout_com_gateways.d.ts +1 -45
- package/lib/resources/checkout_com_gateways.js +1 -1
- package/lib/resources/checkout_com_payments.d.ts +1 -50
- package/lib/resources/checkout_com_payments.js +1 -1
- package/lib/resources/coupon_codes_promotion_rules.d.ts +1 -59
- package/lib/resources/coupon_codes_promotion_rules.js +1 -1
- package/lib/resources/coupon_recipients.d.ts +1 -44
- package/lib/resources/coupon_recipients.js +1 -1
- package/lib/resources/coupons.d.ts +1 -45
- package/lib/resources/coupons.js +1 -1
- package/lib/resources/customer_addresses.d.ts +1 -41
- package/lib/resources/customer_addresses.js +1 -1
- package/lib/resources/customer_groups.d.ts +1 -36
- package/lib/resources/customer_groups.js +1 -1
- package/lib/resources/customer_password_resets.d.ts +1 -33
- package/lib/resources/customer_password_resets.js +1 -1
- package/lib/resources/customer_payment_sources.d.ts +1 -70
- package/lib/resources/customer_payment_sources.js +1 -1
- package/lib/resources/customer_subscriptions.d.ts +1 -28
- package/lib/resources/customer_subscriptions.js +1 -1
- package/lib/resources/customers.d.ts +1 -60
- package/lib/resources/customers.js +1 -1
- package/lib/resources/delivery_lead_times.d.ts +1 -51
- package/lib/resources/delivery_lead_times.js +1 -1
- package/lib/resources/event_callbacks.d.ts +1 -24
- package/lib/resources/event_callbacks.js +1 -1
- package/lib/resources/external_gateways.d.ts +1 -49
- package/lib/resources/external_gateways.js +1 -1
- package/lib/resources/external_payments.d.ts +1 -43
- package/lib/resources/external_payments.js +1 -1
- package/lib/resources/external_promotions.d.ts +1 -86
- package/lib/resources/external_promotions.js +1 -1
- package/lib/resources/external_tax_calculators.d.ts +1 -44
- package/lib/resources/external_tax_calculators.js +1 -1
- package/lib/resources/fixed_amount_promotions.d.ts +1 -88
- package/lib/resources/fixed_amount_promotions.js +1 -1
- package/lib/resources/fixed_price_promotions.d.ts +1 -99
- package/lib/resources/fixed_price_promotions.js +1 -1
- package/lib/resources/free_gift_promotions.d.ts +1 -97
- package/lib/resources/free_gift_promotions.js +1 -1
- package/lib/resources/free_shipping_promotions.d.ts +1 -83
- package/lib/resources/free_shipping_promotions.js +1 -1
- package/lib/resources/geocoders.d.ts +1 -24
- package/lib/resources/geocoders.js +1 -1
- package/lib/resources/gift_card_recipients.d.ts +1 -44
- package/lib/resources/gift_card_recipients.js +1 -1
- package/lib/resources/gift_cards.d.ts +1 -82
- package/lib/resources/gift_cards.js +1 -1
- package/lib/resources/google_geocoders.d.ts +1 -35
- package/lib/resources/google_geocoders.js +1 -1
- package/lib/resources/imports.d.ts +1 -40
- package/lib/resources/imports.js +1 -1
- package/lib/resources/in_stock_subscriptions.d.ts +1 -59
- package/lib/resources/in_stock_subscriptions.js +1 -1
- package/lib/resources/inventory_models.d.ts +1 -42
- package/lib/resources/inventory_models.js +1 -1
- package/lib/resources/inventory_return_locations.d.ts +1 -43
- package/lib/resources/inventory_return_locations.js +1 -1
- package/lib/resources/inventory_stock_locations.d.ts +1 -46
- package/lib/resources/inventory_stock_locations.js +1 -1
- package/lib/resources/klarna_gateways.d.ts +1 -44
- package/lib/resources/klarna_gateways.js +1 -1
- package/lib/resources/klarna_payments.d.ts +1 -41
- package/lib/resources/klarna_payments.js +1 -1
- package/lib/resources/line_item_options.d.ts +1 -57
- package/lib/resources/line_item_options.js +1 -1
- package/lib/resources/line_items.d.ts +1 -125
- package/lib/resources/line_items.js +1 -1
- package/lib/resources/manual_gateways.d.ts +1 -33
- package/lib/resources/manual_gateways.js +1 -1
- package/lib/resources/manual_tax_calculators.d.ts +1 -49
- package/lib/resources/manual_tax_calculators.js +1 -1
- package/lib/resources/markets.d.ts +1 -81
- package/lib/resources/markets.js +1 -1
- package/lib/resources/merchants.d.ts +1 -38
- package/lib/resources/merchants.js +1 -1
- package/lib/resources/order_amount_promotion_rules.d.ts +1 -56
- package/lib/resources/order_amount_promotion_rules.js +1 -1
- package/lib/resources/order_copies.d.ts +1 -45
- package/lib/resources/order_copies.js +1 -1
- package/lib/resources/order_subscriptions.d.ts +1 -67
- package/lib/resources/order_subscriptions.js +1 -1
- package/lib/resources/order_validation_rules.d.ts +1 -20
- package/lib/resources/order_validation_rules.js +1 -1
- package/lib/resources/orders.d.ts +1 -271
- package/lib/resources/orders.js +1 -1
- package/lib/resources/organization.d.ts +1 -32
- package/lib/resources/organization.js +1 -1
- package/lib/resources/packages.d.ts +1 -56
- package/lib/resources/packages.js +1 -1
- package/lib/resources/parcel_line_items.d.ts +1 -49
- package/lib/resources/parcel_line_items.js +1 -1
- package/lib/resources/parcels.d.ts +1 -108
- package/lib/resources/parcels.js +1 -1
- package/lib/resources/payment_gateways.d.ts +1 -21
- package/lib/resources/payment_gateways.js +1 -1
- package/lib/resources/payment_methods.d.ts +1 -59
- package/lib/resources/payment_methods.js +1 -1
- package/lib/resources/paypal_gateways.d.ts +1 -39
- package/lib/resources/paypal_gateways.js +1 -1
- package/lib/resources/paypal_payments.d.ts +1 -47
- package/lib/resources/paypal_payments.js +1 -1
- package/lib/resources/percentage_discount_promotions.d.ts +1 -97
- package/lib/resources/percentage_discount_promotions.js +1 -1
- package/lib/resources/price_lists.d.ts +1 -39
- package/lib/resources/price_lists.js +1 -1
- package/lib/resources/prices.d.ts +1 -57
- package/lib/resources/prices.js +1 -1
- package/lib/resources/promotion_rules.d.ts +1 -24
- package/lib/resources/promotion_rules.js +1 -1
- package/lib/resources/promotions.d.ts +1 -41
- package/lib/resources/promotions.js +1 -1
- package/lib/resources/refunds.d.ts +1 -34
- package/lib/resources/refunds.js +1 -1
- package/lib/resources/return_line_items.d.ts +1 -49
- package/lib/resources/return_line_items.js +1 -1
- package/lib/resources/returns.d.ts +1 -72
- package/lib/resources/returns.js +1 -1
- package/lib/resources/shipments.d.ts +1 -89
- package/lib/resources/shipments.js +1 -1
- package/lib/resources/shipping_categories.d.ts +1 -33
- package/lib/resources/shipping_categories.js +1 -1
- package/lib/resources/shipping_methods.d.ts +1 -74
- package/lib/resources/shipping_methods.js +1 -1
- package/lib/resources/shipping_zones.d.ts +1 -48
- package/lib/resources/shipping_zones.js +1 -1
- package/lib/resources/sku_list_items.d.ts +1 -47
- package/lib/resources/sku_list_items.js +1 -1
- package/lib/resources/sku_list_promotion_rules.d.ts +1 -68
- package/lib/resources/sku_list_promotion_rules.js +1 -1
- package/lib/resources/sku_lists.d.ts +1 -49
- package/lib/resources/sku_lists.js +1 -1
- package/lib/resources/sku_options.d.ts +1 -56
- package/lib/resources/sku_options.js +1 -1
- package/lib/resources/skus.d.ts +1 -78
- package/lib/resources/skus.js +1 -1
- package/lib/resources/stock_items.d.ts +1 -49
- package/lib/resources/stock_items.js +1 -1
- package/lib/resources/stock_line_items.d.ts +1 -29
- package/lib/resources/stock_line_items.js +1 -1
- package/lib/resources/stock_locations.d.ts +1 -57
- package/lib/resources/stock_locations.js +1 -1
- package/lib/resources/stock_transfers.d.ts +1 -71
- package/lib/resources/stock_transfers.js +1 -1
- package/lib/resources/stripe_gateways.d.ts +1 -38
- package/lib/resources/stripe_gateways.js +1 -1
- package/lib/resources/stripe_payments.d.ts +1 -42
- package/lib/resources/stripe_payments.js +1 -1
- package/lib/resources/tax_calculators.d.ts +1 -27
- package/lib/resources/tax_calculators.js +1 -1
- package/lib/resources/tax_categories.d.ts +1 -59
- package/lib/resources/tax_categories.js +1 -1
- package/lib/resources/tax_rules.d.ts +1 -69
- package/lib/resources/tax_rules.js +1 -1
- package/lib/resources/taxjar_accounts.d.ts +1 -43
- package/lib/resources/taxjar_accounts.js +1 -1
- package/lib/resources/transactions.d.ts +1 -31
- package/lib/resources/transactions.js +1 -1
- package/lib/resources/voids.d.ts +1 -34
- package/lib/resources/voids.js +1 -1
- package/lib/resources/webhooks.d.ts +1 -42
- package/lib/resources/webhooks.js +1 -1
- package/lib/resources/wire_transfers.d.ts +1 -32
- package/lib/resources/wire_transfers.js +1 -1
- package/lib/static.d.ts +1 -6
- package/lib/static.js +1 -1
- package/lib/util.d.ts +1 -2
- package/package.json +25 -28
package/lib/commercelayer.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import*as s from"./api";import{CommerceLayerStatic as o}from"./static";import h from"./resource";import c from"./debug";const r=c("commercelayer"),_="2.9.1";class p{static get openApiSchemaVersion(){return _}#s;#t;addresses;adjustments;adyen_gateways;adyen_payments;application;attachments;authorizations;avalara_accounts;billing_info_validation_rules;bing_geocoders;braintree_gateways;braintree_payments;bundles;captures;carrier_accounts;checkout_com_gateways;checkout_com_payments;coupon_codes_promotion_rules;coupon_recipients;coupons;customer_addresses;customer_groups;customer_password_resets;customer_payment_sources;customer_subscriptions;customers;delivery_lead_times;event_callbacks;external_gateways;external_payments;external_promotions;external_tax_calculators;fixed_amount_promotions;fixed_price_promotions;free_gift_promotions;free_shipping_promotions;geocoders;gift_card_recipients;gift_cards;google_geocoders;imports;in_stock_subscriptions;inventory_models;inventory_return_locations;inventory_stock_locations;klarna_gateways;klarna_payments;line_item_options;line_items;manual_gateways;manual_tax_calculators;markets;merchants;order_amount_promotion_rules;order_copies;order_subscriptions;order_validation_rules;orders;organization;packages;parcel_line_items;parcels;payment_gateways;payment_methods;paypal_gateways;paypal_payments;percentage_discount_promotions;price_lists;prices;promotion_rules;promotions;refunds;return_line_items;returns;shipments;shipping_categories;shipping_methods;shipping_zones;sku_list_items;sku_list_promotion_rules;sku_lists;sku_options;skus;stock_items;stock_line_items;stock_locations;stock_transfers;stripe_gateways;stripe_payments;tax_calculators;tax_categories;tax_rules;taxjar_accounts;transactions;voids;webhooks;wire_transfers;constructor(t){r("new commercelayer instance %O",t),this.#s=new h(t),this.#t=t.organization,this.addresses=new s.Addresses(this.#s),this.adjustments=new s.Adjustments(this.#s),this.adyen_gateways=new s.AdyenGateways(this.#s),this.adyen_payments=new s.AdyenPayments(this.#s),this.application=new s.Applications(this.#s),this.attachments=new s.Attachments(this.#s),this.authorizations=new s.Authorizations(this.#s),this.avalara_accounts=new s.AvalaraAccounts(this.#s),this.billing_info_validation_rules=new s.BillingInfoValidationRules(this.#s),this.bing_geocoders=new s.BingGeocoders(this.#s),this.braintree_gateways=new s.BraintreeGateways(this.#s),this.braintree_payments=new s.BraintreePayments(this.#s),this.bundles=new s.Bundles(this.#s),this.captures=new s.Captures(this.#s),this.carrier_accounts=new s.CarrierAccounts(this.#s),this.checkout_com_gateways=new s.CheckoutComGateways(this.#s),this.checkout_com_payments=new s.CheckoutComPayments(this.#s),this.coupon_codes_promotion_rules=new s.CouponCodesPromotionRules(this.#s),this.coupon_recipients=new s.CouponRecipients(this.#s),this.coupons=new s.Coupons(this.#s),this.customer_addresses=new s.CustomerAddresses(this.#s),this.customer_groups=new s.CustomerGroups(this.#s),this.customer_password_resets=new s.CustomerPasswordResets(this.#s),this.customer_payment_sources=new s.CustomerPaymentSources(this.#s),this.customer_subscriptions=new s.CustomerSubscriptions(this.#s),this.customers=new s.Customers(this.#s),this.delivery_lead_times=new s.DeliveryLeadTimes(this.#s),this.event_callbacks=new s.EventCallbacks(this.#s),this.external_gateways=new s.ExternalGateways(this.#s),this.external_payments=new s.ExternalPayments(this.#s),this.external_promotions=new s.ExternalPromotions(this.#s),this.external_tax_calculators=new s.ExternalTaxCalculators(this.#s),this.fixed_amount_promotions=new s.FixedAmountPromotions(this.#s),this.fixed_price_promotions=new s.FixedPricePromotions(this.#s),this.free_gift_promotions=new s.FreeGiftPromotions(this.#s),this.free_shipping_promotions=new s.FreeShippingPromotions(this.#s),this.geocoders=new s.Geocoders(this.#s),this.gift_card_recipients=new s.GiftCardRecipients(this.#s),this.gift_cards=new s.GiftCards(this.#s),this.google_geocoders=new s.GoogleGeocoders(this.#s),this.imports=new s.Imports(this.#s),this.in_stock_subscriptions=new s.InStockSubscriptions(this.#s),this.inventory_models=new s.InventoryModels(this.#s),this.inventory_return_locations=new s.InventoryReturnLocations(this.#s),this.inventory_stock_locations=new s.InventoryStockLocations(this.#s),this.klarna_gateways=new s.KlarnaGateways(this.#s),this.klarna_payments=new s.KlarnaPayments(this.#s),this.line_item_options=new s.LineItemOptions(this.#s),this.line_items=new s.LineItems(this.#s),this.manual_gateways=new s.ManualGateways(this.#s),this.manual_tax_calculators=new s.ManualTaxCalculators(this.#s),this.markets=new s.Markets(this.#s),this.merchants=new s.Merchants(this.#s),this.order_amount_promotion_rules=new s.OrderAmountPromotionRules(this.#s),this.order_copies=new s.OrderCopies(this.#s),this.order_subscriptions=new s.OrderSubscriptions(this.#s),this.order_validation_rules=new s.OrderValidationRules(this.#s),this.orders=new s.Orders(this.#s),this.organization=new s.Organizations(this.#s),this.packages=new s.Packages(this.#s),this.parcel_line_items=new s.ParcelLineItems(this.#s),this.parcels=new s.Parcels(this.#s),this.payment_gateways=new s.PaymentGateways(this.#s),this.payment_methods=new s.PaymentMethods(this.#s),this.paypal_gateways=new s.PaypalGateways(this.#s),this.paypal_payments=new s.PaypalPayments(this.#s),this.percentage_discount_promotions=new s.PercentageDiscountPromotions(this.#s),this.price_lists=new s.PriceLists(this.#s),this.prices=new s.Prices(this.#s),this.promotion_rules=new s.PromotionRules(this.#s),this.promotions=new s.Promotions(this.#s),this.refunds=new s.Refunds(this.#s),this.return_line_items=new s.ReturnLineItems(this.#s),this.returns=new s.Returns(this.#s),this.shipments=new s.Shipments(this.#s),this.shipping_categories=new s.ShippingCategories(this.#s),this.shipping_methods=new s.ShippingMethods(this.#s),this.shipping_zones=new s.ShippingZones(this.#s),this.sku_list_items=new s.SkuListItems(this.#s),this.sku_list_promotion_rules=new s.SkuListPromotionRules(this.#s),this.sku_lists=new s.SkuLists(this.#s),this.sku_options=new s.SkuOptions(this.#s),this.skus=new s.Skus(this.#s),this.stock_items=new s.StockItems(this.#s),this.stock_line_items=new s.StockLineItems(this.#s),this.stock_locations=new s.StockLocations(this.#s),this.stock_transfers=new s.StockTransfers(this.#s),this.stripe_gateways=new s.StripeGateways(this.#s),this.stripe_payments=new s.StripePayments(this.#s),this.tax_calculators=new s.TaxCalculators(this.#s),this.tax_categories=new s.TaxCategories(this.#s),this.tax_rules=new s.TaxRules(this.#s),this.taxjar_accounts=new s.TaxjarAccounts(this.#s),this.transactions=new s.Transactions(this.#s),this.voids=new s.Voids(this.#s),this.webhooks=new s.Webhooks(this.#s),this.wire_transfers=new s.WireTransfers(this.#s)}get currentOrganization(){return this.#t}localConfig(t){t.organization&&(this.#t=t.organization)}config(t){r("config %o",t),this.localConfig(t),this.#s.config(t)}resources(){return o.resources()}isApiError(t){return o.isApiError(t)}addRequestInterceptor(t,e){return this.#s.interceptors.request.use(t,e)}addResponseInterceptor(t,e){return this.#s.interceptors.response.use(t,e)}removeInterceptor(t,e){return this.#s.interceptors[t].eject(e)}addRawResponseReader(){const t={id:void 0,rawResponse:void 0};function e(n){return t.rawResponse=n?.data,n}const a=this.addResponseInterceptor(e);return t.id=a,t}removeRawResponseReader(t){const e=typeof t=="number"?t:t.id;if(e)return this.removeInterceptor("response",e)}}const u=i=>new p(i);export default u;
|
package/lib/common.d.ts
CHANGED
@@ -1,4 +1 @@
|
|
1
|
-
import type
|
2
|
-
declare const isResourceId: (resource: any) => resource is ResourceId;
|
3
|
-
declare const isResourceType: (resource: any) => resource is ResourceType;
|
4
|
-
export { isResourceId, isResourceType };
|
1
|
+
import type{ResourceId,ResourceType}from'./resource';declare const isResourceId:(resource:any)=>resource is ResourceId;declare const isResourceType:(resource:any)=>resource is ResourceType;export{isResourceId,isResourceType};
|
package/lib/config.d.ts
CHANGED
@@ -1,11 +1 @@
|
|
1
|
-
declare const config: {
|
2
|
-
readonly default: {
|
3
|
-
readonly domain: "commercelayer.io";
|
4
|
-
readonly pageNumber: 1;
|
5
|
-
readonly pageSize: 10;
|
6
|
-
};
|
7
|
-
readonly client: {
|
8
|
-
readonly timeout: 15000;
|
9
|
-
};
|
10
|
-
};
|
11
|
-
export default config;
|
1
|
+
declare const config:{readonly default:{readonly domain:"commercelayer.io";readonly pageNumber:1;readonly pageSize:10;};readonly client:{readonly timeout:15000;};};export default config;
|
package/lib/debug.d.ts
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
declare type Debugger
|
2
|
-
declare const debug: (namespace?: string | undefined) => Debugger;
|
3
|
-
export default debug;
|
1
|
+
declare type Debugger=(pattern:string,...args:any[])=>void;declare const debug:(namespace:string)=>Debugger;export default debug;
|
package/lib/debug.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
const
|
1
|
+
const e=(t,...r)=>{};let c=t=>e;try{const t=require("debug");t&&typeof t=="function"&&(c=t)}catch{}const o="clsdk",n=t=>c(`${o}:${t}`);export default n;
|
package/lib/error.d.ts
CHANGED
@@ -1,26 +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 isSdkError(error: any): error is ApiError;
|
10
|
-
type: string;
|
11
|
-
code?: string;
|
12
|
-
source?: Error;
|
13
|
-
request?: any;
|
14
|
-
constructor(error: {
|
15
|
-
message: string;
|
16
|
-
type?: ErrorType;
|
17
|
-
});
|
18
|
-
}
|
19
|
-
declare class ApiError extends SdkError {
|
20
|
-
static isApiError(error: any): error is ApiError;
|
21
|
-
errors: any[];
|
22
|
-
status?: number;
|
23
|
-
constructor(error: SdkError);
|
24
|
-
first(): any;
|
25
|
-
}
|
26
|
-
export { SdkError, ApiError, ErrorType };
|
1
|
+
declare enum ErrorType{CLIENT="client",REQUEST="request",RESPONSE="response",GENERIC="generic",CANCEL="cancel"}declare class SdkError extends Error{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 isApiError(error:any):error is ApiError;errors:any[];status?:number;constructor(error:SdkError);first():any;}export{SdkError,ApiError,ErrorType};
|
package/lib/error.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var
|
1
|
+
var e;(function(s){s.CLIENT="client",s.REQUEST="request",s.RESPONSE="response",s.GENERIC="generic",s.CANCEL="cancel"})(e||(e={}));class t extends Error{static isSdkError(r){return r&&["SdkError","ApiError"].includes(r.name)&&Object.values(e).includes(r.type)}type;code;source;request;constructor(r){super(r.message);this.name=this.constructor.name,this.type=r.type||e.GENERIC}}class o extends t{static isApiError(r){return t.isSdkError(r)&&r.name==="ApiError"&&r.type===e.RESPONSE}errors=[];status;constructor(r){super({...r,type:e.RESPONSE});this.name=this.constructor.name}first(){return this.errors?.length>0?this.errors[0]:void 0}}export{t as SdkError,o as ApiError,e as ErrorType};
|
package/lib/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 } from './interceptor';
|
7
|
-
export type { SdkError, ApiError, ErrorType } from './error';
|
1
|
+
export{default}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}from'./interceptor';export type{SdkError,ApiError,ErrorType}from'./error';
|
package/lib/interceptor.d.ts
CHANGED
@@ -1,19 +1 @@
|
|
1
|
-
import
|
2
|
-
declare type InterceptorManager = {
|
3
|
-
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
4
|
-
response: AxiosInterceptorManager<any>;
|
5
|
-
};
|
6
|
-
declare type RequestObj = AxiosRequestConfig;
|
7
|
-
declare type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
|
8
|
-
declare type ResponseObj = AxiosResponse;
|
9
|
-
declare type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
|
10
|
-
declare type ErrorObj = AxiosError;
|
11
|
-
declare type ErrorInterceptor = (error: ErrorObj) => ErrorObj;
|
12
|
-
declare type InterceptorType = 'request' | 'response';
|
13
|
-
export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType };
|
14
|
-
export type { RequestObj, ResponseObj, ErrorObj };
|
15
|
-
declare type RawResponseReader = {
|
16
|
-
id: number | undefined;
|
17
|
-
rawResponse: ResponseObj | undefined;
|
18
|
-
};
|
19
|
-
export type { RawResponseReader };
|
1
|
+
import{AxiosError,AxiosInterceptorManager,AxiosRequestConfig,AxiosResponse}from"axios";declare type InterceptorManager={request:AxiosInterceptorManager<AxiosRequestConfig>;response:AxiosInterceptorManager<any>;};declare type RequestObj=AxiosRequestConfig;declare type RequestInterceptor=(request:RequestObj)=>RequestObj|Promise<RequestObj>;declare type ResponseObj=AxiosResponse;declare type ResponseInterceptor=(response:ResponseObj)=>ResponseObj;declare type ErrorObj=AxiosError;declare type ErrorInterceptor=(error:ErrorObj)=>ErrorObj;declare type InterceptorType='request'|'response';export type{InterceptorManager,RequestInterceptor,ResponseInterceptor,ErrorInterceptor,InterceptorType};export type{RequestObj,ResponseObj,ErrorObj};declare type RawResponseReader={id:number|undefined;rawResponse:ResponseObj|undefined;};export type{RawResponseReader};
|
package/lib/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/jsonapi.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{isResourceId as l,isResourceType as c}from"./common";import u from"./debug";const
|
1
|
+
import{isResourceId as l,isResourceType as c}from"./common";import u from"./debug";const o=u("jsonapi"),p=e=>{let s;e.links&&delete e.links;const i=e.data,n=e.included;return i?Array.isArray(i)?s=i.map(t=>r(t,n)):s=r(i,n):s=i,s},d=(e,s=[])=>s.find(i=>e.id===i.id&&e.type===i.type)||e,r=(e,s)=>{if(o("denormalize resource: %O, %o",e,s||{}),!e)return e;const i={id:e.id,type:e.type,...e.attributes};return e.relationships&&Object.keys(e.relationships).forEach(n=>{const t=e.relationships[n].data;t?Array.isArray(t)?i[n]=t.map(a=>r(d(a,s),s)):i[n]=r(d(t,s),s):t===null&&(i[n]=null)}),o("denormalized resource: %O",i),i},y=e=>{o("normalize resource: %O",e);const s={},i={};for(const t in e){if(["type","id"].includes(t))continue;const a=e[t];a&&c(a)&&a.id===null?i[t]={data:null}:a&&(l(a)||Array.isArray(a)&&l(a[0]))?i[t]={data:a}:s[t]=a}const n={type:e.type,attributes:s,relationships:i};return l(e)&&(n.id=e.id),o("normalized resource: %O",n),n};export{p as denormalize,y as normalize};
|
package/lib/model.d.ts
CHANGED
@@ -1,101 +1 @@
|
|
1
|
-
|
2
|
-
* ©2022 Commerce Layer Inc.
|
3
|
-
* OpenAPI schema, version 2.8.1
|
4
|
-
**/
|
5
|
-
export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
|
6
|
-
export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
|
7
|
-
export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate } from './resources/adyen_gateways';
|
8
|
-
export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate } from './resources/adyen_payments';
|
9
|
-
export type { Application } from './resources/application';
|
10
|
-
export type { Attachment, AttachmentCreate, AttachmentUpdate } from './resources/attachments';
|
11
|
-
export type { Authorization, AuthorizationUpdate } from './resources/authorizations';
|
12
|
-
export type { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate } from './resources/avalara_accounts';
|
13
|
-
export type { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate } from './resources/billing_info_validation_rules';
|
14
|
-
export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './resources/bing_geocoders';
|
15
|
-
export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways';
|
16
|
-
export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments';
|
17
|
-
export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles';
|
18
|
-
export type { Capture, CaptureUpdate } from './resources/captures';
|
19
|
-
export type { CarrierAccount } from './resources/carrier_accounts';
|
20
|
-
export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways';
|
21
|
-
export type { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate } from './resources/checkout_com_payments';
|
22
|
-
export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules';
|
23
|
-
export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients';
|
24
|
-
export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons';
|
25
|
-
export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses';
|
26
|
-
export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups';
|
27
|
-
export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets';
|
28
|
-
export type { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate } from './resources/customer_payment_sources';
|
29
|
-
export type { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate } from './resources/customer_subscriptions';
|
30
|
-
export type { Customer, CustomerCreate, CustomerUpdate } from './resources/customers';
|
31
|
-
export type { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate } from './resources/delivery_lead_times';
|
32
|
-
export type { EventCallback } from './resources/event_callbacks';
|
33
|
-
export type { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate } from './resources/external_gateways';
|
34
|
-
export type { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate } from './resources/external_payments';
|
35
|
-
export type { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate } from './resources/external_promotions';
|
36
|
-
export type { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate } from './resources/external_tax_calculators';
|
37
|
-
export type { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate } from './resources/fixed_amount_promotions';
|
38
|
-
export type { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate } from './resources/fixed_price_promotions';
|
39
|
-
export type { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate } from './resources/free_gift_promotions';
|
40
|
-
export type { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate } from './resources/free_shipping_promotions';
|
41
|
-
export type { Geocoder } from './resources/geocoders';
|
42
|
-
export type { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate } from './resources/gift_card_recipients';
|
43
|
-
export type { GiftCard, GiftCardCreate, GiftCardUpdate } from './resources/gift_cards';
|
44
|
-
export type { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate } from './resources/google_geocoders';
|
45
|
-
export type { Import, ImportCreate } from './resources/imports';
|
46
|
-
export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate } from './resources/in_stock_subscriptions';
|
47
|
-
export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models';
|
48
|
-
export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations';
|
49
|
-
export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations';
|
50
|
-
export type { KlarnaGateway, KlarnaGatewayCreate, KlarnaGatewayUpdate } from './resources/klarna_gateways';
|
51
|
-
export type { KlarnaPayment, KlarnaPaymentCreate, KlarnaPaymentUpdate } from './resources/klarna_payments';
|
52
|
-
export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options';
|
53
|
-
export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items';
|
54
|
-
export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways';
|
55
|
-
export type { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate } from './resources/manual_tax_calculators';
|
56
|
-
export type { Market, MarketCreate, MarketUpdate } from './resources/markets';
|
57
|
-
export type { Merchant, MerchantCreate, MerchantUpdate } from './resources/merchants';
|
58
|
-
export type { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate } from './resources/order_amount_promotion_rules';
|
59
|
-
export type { OrderCopy, OrderCopyCreate } from './resources/order_copies';
|
60
|
-
export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions';
|
61
|
-
export type { OrderValidationRule } from './resources/order_validation_rules';
|
62
|
-
export type { Order, OrderCreate, OrderUpdate } from './resources/orders';
|
63
|
-
export type { Organization } from './resources/organization';
|
64
|
-
export type { Package, PackageCreate, PackageUpdate } from './resources/packages';
|
65
|
-
export type { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate } from './resources/parcel_line_items';
|
66
|
-
export type { Parcel, ParcelCreate, ParcelUpdate } from './resources/parcels';
|
67
|
-
export type { PaymentGateway } from './resources/payment_gateways';
|
68
|
-
export type { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate } from './resources/payment_methods';
|
69
|
-
export type { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate } from './resources/paypal_gateways';
|
70
|
-
export type { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate } from './resources/paypal_payments';
|
71
|
-
export type { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate } from './resources/percentage_discount_promotions';
|
72
|
-
export type { PriceList, PriceListCreate, PriceListUpdate } from './resources/price_lists';
|
73
|
-
export type { Price, PriceCreate, PriceUpdate } from './resources/prices';
|
74
|
-
export type { PromotionRule } from './resources/promotion_rules';
|
75
|
-
export type { Promotion } from './resources/promotions';
|
76
|
-
export type { Refund } from './resources/refunds';
|
77
|
-
export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items';
|
78
|
-
export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns';
|
79
|
-
export type { Shipment, ShipmentUpdate } from './resources/shipments';
|
80
|
-
export type { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate } from './resources/shipping_categories';
|
81
|
-
export type { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate } from './resources/shipping_methods';
|
82
|
-
export type { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate } from './resources/shipping_zones';
|
83
|
-
export type { SkuListItem, SkuListItemCreate, SkuListItemUpdate } from './resources/sku_list_items';
|
84
|
-
export type { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate } from './resources/sku_list_promotion_rules';
|
85
|
-
export type { SkuList, SkuListCreate, SkuListUpdate } from './resources/sku_lists';
|
86
|
-
export type { SkuOption, SkuOptionCreate, SkuOptionUpdate } from './resources/sku_options';
|
87
|
-
export type { Sku, SkuCreate, SkuUpdate } from './resources/skus';
|
88
|
-
export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items';
|
89
|
-
export type { StockLineItem } from './resources/stock_line_items';
|
90
|
-
export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations';
|
91
|
-
export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers';
|
92
|
-
export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways';
|
93
|
-
export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments';
|
94
|
-
export type { TaxCalculator } from './resources/tax_calculators';
|
95
|
-
export type { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate } from './resources/tax_categories';
|
96
|
-
export type { TaxRule, TaxRuleCreate, TaxRuleUpdate } from './resources/tax_rules';
|
97
|
-
export type { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate } from './resources/taxjar_accounts';
|
98
|
-
export type { Transaction } from './resources/transactions';
|
99
|
-
export type { Void } from './resources/voids';
|
100
|
-
export type { Webhook, WebhookCreate, WebhookUpdate } from './resources/webhooks';
|
101
|
-
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{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{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{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{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{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}from'./resources/order_copies';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{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{PriceList,PriceListCreate,PriceListUpdate}from'./resources/price_lists';export type{Price,PriceCreate,PriceUpdate}from'./resources/prices';export type{PromotionRule}from'./resources/promotion_rules';export type{Promotion}from'./resources/promotions';export type{Refund}from'./resources/refunds';export type{ReturnLineItem,ReturnLineItemCreate,ReturnLineItemUpdate}from'./resources/return_line_items';export type{Return,ReturnCreate,ReturnUpdate}from'./resources/returns';export type{Shipment,ShipmentUpdate}from'./resources/shipments';export type{ShippingCategory,ShippingCategoryCreate,ShippingCategoryUpdate}from'./resources/shipping_categories';export type{ShippingMethod,ShippingMethodCreate,ShippingMethodUpdate}from'./resources/shipping_methods';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}from'./resources/stock_line_items';export type{StockLocation,StockLocationCreate,StockLocationUpdate}from'./resources/stock_locations';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{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{Void}from'./resources/voids';export type{Webhook,WebhookCreate,WebhookUpdate}from'./resources/webhooks';export type{WireTransfer,WireTransferCreate,WireTransferUpdate}from'./resources/wire_transfers';
|
package/lib/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
|
-
declare type QueryParams = QueryParamsRetrieve | QueryParamsList;
|
19
|
-
export { QueryParamsRetrieve, QueryParamsList, QueryParams };
|
20
|
-
declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined, res: 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;}declare 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/query.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import n from"./debug";const
|
1
|
+
import n from"./debug";const a=n("query"),o=e=>e.filters||e.pageNumber||e.pageSize||e.sort,g=(e,r)=>{a("generate query string params: %O, %O",e,r);const i={};return e&&(e.include&&(i.include=e.include.join(",")),e.fields&&(Array.isArray(e.fields)&&(e.fields={[r.type||r]:e.fields}),Object.entries(e.fields).forEach(([s,t])=>{i[`fields[${s}]`]=t.join(",")})),o(e)&&(e.sort&&(Array.isArray(e.sort)?i.sort=e.sort.join(","):i.sort=Object.entries(e.sort).map(([s,t])=>`${t==="desc"?"-":""}${s}`).join(",")),e.pageNumber&&(i["page[number]"]=String(e.pageNumber)),e.pageSize&&(i["page[size]"]=String(e.pageSize)),e.filters&&Object.entries(e.filters).forEach(([s,t])=>{i[`filter[q][${s}]`]=String(t)})),a("query string params: %O",i)),i};export{g as generateQueryStringParams};
|
package/lib/resource.d.ts
CHANGED
@@ -1,76 +1 @@
|
|
1
|
-
import
|
2
|
-
import { QueryParamsRetrieve, QueryParamsList } from './query';
|
3
|
-
import { ResourceTypeLock } from './api';
|
4
|
-
import { InterceptorManager } from './interceptor';
|
5
|
-
import { QueryParams } from '.';
|
6
|
-
declare type ResourceNull = {
|
7
|
-
id: null;
|
8
|
-
} & ResourceType;
|
9
|
-
declare type ResourceRel = ResourceId | ResourceNull;
|
10
|
-
declare type Metadata = {
|
11
|
-
[key: string]: any;
|
12
|
-
};
|
13
|
-
interface ResourceType {
|
14
|
-
readonly type: ResourceTypeLock;
|
15
|
-
}
|
16
|
-
interface ResourceId extends ResourceType {
|
17
|
-
readonly id: string;
|
18
|
-
}
|
19
|
-
interface Resource extends ResourceId {
|
20
|
-
reference?: string;
|
21
|
-
reference_origin?: string;
|
22
|
-
metadata?: Metadata;
|
23
|
-
readonly created_at: string;
|
24
|
-
readonly updated_at: string;
|
25
|
-
}
|
26
|
-
interface ResourceCreate {
|
27
|
-
reference?: string;
|
28
|
-
reference_origin?: string;
|
29
|
-
metadata?: Metadata;
|
30
|
-
}
|
31
|
-
interface ResourceUpdate {
|
32
|
-
readonly id: string;
|
33
|
-
reference?: string;
|
34
|
-
reference_origin?: string;
|
35
|
-
metadata?: Metadata;
|
36
|
-
}
|
37
|
-
declare type ListMeta = {
|
38
|
-
readonly pageCount: number;
|
39
|
-
readonly recordCount: number;
|
40
|
-
readonly currentPage: number;
|
41
|
-
readonly recordsPerPage: number;
|
42
|
-
};
|
43
|
-
declare class ListResponse<R> extends Array<R> {
|
44
|
-
readonly meta: ListMeta;
|
45
|
-
constructor(meta: ListMeta, data: Array<R>);
|
46
|
-
first(): R | undefined;
|
47
|
-
last(): R | undefined;
|
48
|
-
get(index: number): R | undefined;
|
49
|
-
}
|
50
|
-
export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse, ResourceRel };
|
51
|
-
declare type ResourceAdapterConfig = {};
|
52
|
-
declare type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig;
|
53
|
-
declare type ResourcesConfig = Partial<ResourcesInitConfig>;
|
54
|
-
declare class ResourceAdapter {
|
55
|
-
#private;
|
56
|
-
constructor(config: ResourcesInitConfig);
|
57
|
-
get interceptors(): InterceptorManager;
|
58
|
-
private localConfig;
|
59
|
-
config(config: ResourcesConfig): void;
|
60
|
-
singleton<R extends Resource>(resource: ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
61
|
-
retrieve<R extends Resource>(resource: ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
62
|
-
list<R extends Resource>(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
63
|
-
create<C extends ResourceCreate, R extends Resource>(resource: C & ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
64
|
-
update<U extends ResourceUpdate, R extends Resource>(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
65
|
-
delete(resource: ResourceId, options?: ResourcesConfig): Promise<void>;
|
66
|
-
fetch<R extends Resource>(resource: ResourceType, path: string, params?: QueryParams, options?: ResourcesConfig): Promise<R | ListResponse<R>>;
|
67
|
-
}
|
68
|
-
declare abstract class ApiResource {
|
69
|
-
static readonly TYPE: ResourceTypeLock;
|
70
|
-
protected resources: ResourceAdapter;
|
71
|
-
constructor(adapter: ResourceAdapter);
|
72
|
-
abstract relationship(id: string | ResourceId | null): ResourceRel;
|
73
|
-
abstract type(): string;
|
74
|
-
}
|
75
|
-
export default ResourceAdapter;
|
76
|
-
export { ApiResource, ResourcesConfig, ResourcesInitConfig };
|
1
|
+
import{ApiClientInitConfig}from'./client';import{QueryParamsRetrieve,QueryParamsList}from'./query';import{ResourceTypeLock}from'./api';import{InterceptorManager}from'./interceptor';import{QueryParams}from'.';declare type ResourceNull={id:null;}&ResourceType;declare type ResourceRel=ResourceId|ResourceNull;declare type Metadata={[key: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;}declare 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:Array<R>);first():R|undefined;last():R|undefined;get(index:number):R|undefined;}export type{Metadata,ResourceType,ResourceId,Resource,ResourceCreate,ResourceUpdate,ListResponse,ResourceRel};declare type ResourceAdapterConfig={};declare type ResourcesInitConfig=ResourceAdapterConfig&ApiClientInitConfig;declare 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;}export default ResourceAdapter;export{ApiResource,ResourcesConfig,ResourcesInitConfig};
|
package/lib/resource.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import f from"./client";import{denormalize as n,normalize as d}from"./jsonapi";import{generateQueryStringParams as c}from"./query";import p from"./config";import O from"./debug";const i=O("resource");class h extends Array{meta;constructor(e,r){super(...r||[]);this.meta=e}first(){return this.length?this[0]:void 0}last(){return this.length?this[this.length-1]:void 0}get(e){return this.length&&e>=0?this[e]:void 0}}class y{#e;#t={};constructor(e){this.#e=f.create(e),this.localConfig(e)}get interceptors(){return this.#e.interceptors}localConfig(e){}config(e){i("config %o",e),this.localConfig(e),this.#e.config(e)}async singleton(e,r,t){i("singleton: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=await this.#e.request("get",`${e.type}`,void 0,{...t,params:a});return n(s)}async retrieve(e,r,t){i("retrieve: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=await this.#e.request("get",`${e.type}/${e.id}`,void 0,{...t,params:a});return n(s)}async list(e,r,t){i("list: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=await this.#e.request("get",`${e.type}`,void 0,{...t,params:a}),o=n(s),u={pageCount:Number(s.meta?.page_count),recordCount:Number(s.meta?.record_count),currentPage:r?.pageNumber||p.default.pageNumber,recordsPerPage:r?.pageSize||p.default.pageSize};return new h(u,o)}async create(e,r,t){i("create: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=d(e),o=await this.#e.request("post",e.type,s,{...t,params:a});return n(o)}async update(e,r,t){i("update: %o, %O, %O",e,r||{},t||{});const a=c(r,e);t?.params&&Object.assign(a,t?.params);const s=d(e),o=await this.#e.request("patch",`${e.type}/${e.id}`,s,{...t,params:a});return n(o)}async delete(e,r){i("delete: %o, %O",e,r||{}),await this.#e.request("delete",`${e.type}/${e.id}`,void 0,r)}async fetch(e,r,t,a){i("fetch: %o, %O, %O",r,t||{},a||{});const s=c(t,e);a?.params&&Object.assign(s,a?.params);const o=await this.#e.request("get",r,void 0,{...a,params:s}),u=n(o);if(Array.isArray(u)){const g=t,l={pageCount:Number(o.meta?.page_count),recordCount:Number(o.meta?.record_count),currentPage:g?.pageNumber||p.default.pageNumber,recordsPerPage:g?.pageSize||p.default.pageSize};return new h(l,u)}else return u}}class b{static TYPE;resources;constructor(e){i("new resource instance: %s",this.type()),this.resources=e}}export default y;export{b as ApiResource};
|
@@ -1,88 +1 @@
|
|
1
|
-
import
|
2
|
-
import { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
|
-
import { Geocoder } from './geocoders';
|
4
|
-
declare type AddressRel = ResourceRel & {
|
5
|
-
type: typeof Addresses.TYPE;
|
6
|
-
};
|
7
|
-
declare type GeocoderRel = ResourceRel & {
|
8
|
-
type: 'geocoders';
|
9
|
-
};
|
10
|
-
interface Address extends Resource {
|
11
|
-
business?: boolean;
|
12
|
-
first_name?: string;
|
13
|
-
last_name?: string;
|
14
|
-
company?: string;
|
15
|
-
full_name?: string;
|
16
|
-
line_1?: string;
|
17
|
-
line_2?: string;
|
18
|
-
city?: string;
|
19
|
-
zip_code?: string;
|
20
|
-
state_code?: string;
|
21
|
-
country_code?: string;
|
22
|
-
phone?: string;
|
23
|
-
full_address?: string;
|
24
|
-
name?: string;
|
25
|
-
email?: string;
|
26
|
-
notes?: string;
|
27
|
-
lat?: number;
|
28
|
-
lng?: number;
|
29
|
-
is_localized?: boolean;
|
30
|
-
is_geocoded?: boolean;
|
31
|
-
provider_name?: string;
|
32
|
-
map_url?: string;
|
33
|
-
static_map_url?: string;
|
34
|
-
billing_info?: string;
|
35
|
-
geocoder?: Geocoder;
|
36
|
-
}
|
37
|
-
interface AddressCreate extends ResourceCreate {
|
38
|
-
business?: boolean;
|
39
|
-
first_name?: string;
|
40
|
-
last_name?: string;
|
41
|
-
company?: string;
|
42
|
-
line_1: string;
|
43
|
-
line_2?: string;
|
44
|
-
city: string;
|
45
|
-
zip_code?: string;
|
46
|
-
state_code: string;
|
47
|
-
country_code: string;
|
48
|
-
phone: string;
|
49
|
-
email?: string;
|
50
|
-
notes?: string;
|
51
|
-
lat?: number;
|
52
|
-
lng?: number;
|
53
|
-
billing_info?: string;
|
54
|
-
geocoder?: GeocoderRel;
|
55
|
-
}
|
56
|
-
interface AddressUpdate extends ResourceUpdate {
|
57
|
-
business?: boolean;
|
58
|
-
first_name?: string;
|
59
|
-
last_name?: string;
|
60
|
-
company?: string;
|
61
|
-
line_1?: string;
|
62
|
-
line_2?: string;
|
63
|
-
city?: string;
|
64
|
-
zip_code?: string;
|
65
|
-
state_code?: string;
|
66
|
-
country_code?: string;
|
67
|
-
phone?: string;
|
68
|
-
email?: string;
|
69
|
-
notes?: string;
|
70
|
-
lat?: number;
|
71
|
-
lng?: number;
|
72
|
-
billing_info?: string;
|
73
|
-
geocoder?: GeocoderRel;
|
74
|
-
}
|
75
|
-
declare class Addresses extends ApiResource {
|
76
|
-
static readonly TYPE: 'addresses';
|
77
|
-
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Address>>;
|
78
|
-
create(resource: AddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
|
79
|
-
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
|
80
|
-
update(resource: AddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
|
81
|
-
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
82
|
-
geocoder(addressId: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Geocoder>;
|
83
|
-
isAddress(resource: any): resource is Address;
|
84
|
-
relationship(id: string | ResourceId | null): AddressRel;
|
85
|
-
type(): string;
|
86
|
-
}
|
87
|
-
export default Addresses;
|
88
|
-
export { Address, AddressCreate, AddressUpdate };
|
1
|
+
import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import type{QueryParamsList,QueryParamsRetrieve}from'../query';import type{Geocoder}from'./geocoders';declare type AddressRel=ResourceRel&{type:typeof Addresses.TYPE;};declare type GeocoderRel=ResourceRel&{type:'geocoders';};interface Address extends Resource{business?:boolean;first_name?:string;last_name?:string;company?:string;full_name?:string;line_1?:string;line_2?:string;city?:string;zip_code?:string;state_code?:string;country_code?:string;phone?:string;full_address?:string;name?:string;email?:string;notes?:string;lat?:number;lng?:number;is_localized?:boolean;is_geocoded?:boolean;provider_name?:string;map_url?:string;static_map_url?:string;billing_info?:string;geocoder?:Geocoder;}interface AddressCreate extends ResourceCreate{business?:boolean;first_name?:string;last_name?:string;company?:string;line_1:string;line_2?:string;city:string;zip_code?:string;state_code:string;country_code:string;phone:string;email?:string;notes?:string;lat?:number;lng?:number;billing_info?:string;geocoder?:GeocoderRel;}interface AddressUpdate extends ResourceUpdate{business?:boolean;first_name?:string;last_name?:string;company?:string;line_1?:string;line_2?:string;city?:string;zip_code?:string;state_code?:string;country_code?:string;phone?:string;email?:string;notes?:string;lat?:number;lng?:number;billing_info?:string;geocoder?:GeocoderRel;}declare class Addresses extends ApiResource{static readonly TYPE:'addresses';list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Address>>;create(resource:AddressCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Address>;retrieve(id:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Address>;update(resource:AddressUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Address>;delete(id:string,options?:ResourcesConfig):Promise<void>;geocoder(addressId:string|Address,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Geocoder>;isAddress(resource:any):resource is Address;relationship(id:string|ResourceId|null):AddressRel;type():string;}export default Addresses;export{Address,AddressCreate,AddressUpdate};
|
@@ -1 +1 @@
|
|
1
|
-
import{ApiResource as
|
1
|
+
import{ApiResource as c}from"../resource";class r extends c{static TYPE="addresses";async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create({...e,type:r.TYPE},t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update({...e,type:r.TYPE},t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}async geocoder(e,t,s){const i=e.id||e;return this.resources.fetch({type:"geocoders"},`addresses/${i}/geocoder`,t,s)}isAddress(e){return e.type&&e.type===r.TYPE}relationship(e){return e===null||typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}export default r;
|
@@ -1,35 +1 @@
|
|
1
|
-
import
|
2
|
-
import { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
|
-
declare type AdjustmentRel = ResourceRel & {
|
4
|
-
type: typeof Adjustments.TYPE;
|
5
|
-
};
|
6
|
-
interface Adjustment extends Resource {
|
7
|
-
name?: string;
|
8
|
-
currency_code?: string;
|
9
|
-
amount_cents?: number;
|
10
|
-
amount_float?: number;
|
11
|
-
formatted_amount?: string;
|
12
|
-
}
|
13
|
-
interface AdjustmentCreate extends ResourceCreate {
|
14
|
-
name: string;
|
15
|
-
currency_code: string;
|
16
|
-
amount_cents: number;
|
17
|
-
}
|
18
|
-
interface AdjustmentUpdate extends ResourceUpdate {
|
19
|
-
name?: string;
|
20
|
-
currency_code?: string;
|
21
|
-
amount_cents?: number;
|
22
|
-
}
|
23
|
-
declare class Adjustments extends ApiResource {
|
24
|
-
static readonly TYPE: 'adjustments';
|
25
|
-
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Adjustment>>;
|
26
|
-
create(resource: AdjustmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
|
27
|
-
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
|
28
|
-
update(resource: AdjustmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
|
29
|
-
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
30
|
-
isAdjustment(resource: any): resource is Adjustment;
|
31
|
-
relationship(id: string | ResourceId | null): AdjustmentRel;
|
32
|
-
type(): string;
|
33
|
-
}
|
34
|
-
export default Adjustments;
|
35
|
-
export { Adjustment, AdjustmentCreate, AdjustmentUpdate };
|
1
|
+
import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import type{QueryParamsList,QueryParamsRetrieve}from'../query';declare type AdjustmentRel=ResourceRel&{type:typeof Adjustments.TYPE;};interface Adjustment extends Resource{name?:string;currency_code?:string;amount_cents?:number;amount_float?:number;formatted_amount?:string;}interface AdjustmentCreate extends ResourceCreate{name:string;currency_code:string;amount_cents:number;}interface AdjustmentUpdate extends ResourceUpdate{name?:string;currency_code?:string;amount_cents?:number;}declare class Adjustments extends ApiResource{static readonly TYPE:'adjustments';list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<Adjustment>>;create(resource:AdjustmentCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Adjustment>;retrieve(id:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Adjustment>;update(resource:AdjustmentUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Adjustment>;delete(id:string,options?:ResourcesConfig):Promise<void>;isAdjustment(resource:any):resource is Adjustment;relationship(id:string|ResourceId|null):AdjustmentRel;type():string;}export default Adjustments;export{Adjustment,AdjustmentCreate,AdjustmentUpdate};
|
@@ -1 +1 @@
|
|
1
|
-
import{ApiResource as i}from"../resource";class
|
1
|
+
import{ApiResource as i}from"../resource";class t extends i{static TYPE="adjustments";async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async create(e,r,s){return this.resources.create({...e,type:t.TYPE},r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update({...e,type:t.TYPE},r,s)}async delete(e,r){await this.resources.delete({type:t.TYPE,id:e},r)}isAdjustment(e){return e.type&&e.type===t.TYPE}relationship(e){return e===null||typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}export default t;
|