@commercelayer/sdk 3.6.0 → 3.7.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 -1
- package/lib/cjs/client.js +1 -1
- package/lib/cjs/commercelayer.js +1 -1
- package/lib/cjs/model.d.ts +1 -1
- package/lib/cjs/resource.js +1 -1
- package/lib/cjs/resources/klarna_payments.d.ts +4 -0
- package/lib/cjs/resources/orders.d.ts +1 -0
- package/lib/cjs/util.d.ts +1 -0
- package/lib/client.js +1 -1
- package/lib/commercelayer.js +1 -1
- package/lib/common.js +1 -1
- package/lib/debug.d.ts +1 -1
- package/lib/debug.js +1 -1
- package/lib/error.js +1 -1
- package/lib/esm/api.d.ts +1 -1
- package/lib/esm/client.js +1 -1
- package/lib/esm/commercelayer.js +1 -1
- package/lib/esm/model.d.ts +1 -1
- package/lib/esm/resource.js +1 -1
- package/lib/esm/resources/klarna_payments.d.ts +4 -0
- package/lib/esm/resources/orders.d.ts +1 -0
- package/lib/esm/util.d.ts +1 -0
- package/lib/jsonapi.js +1 -1
- package/lib/query.d.ts +1 -1
- package/lib/query.js +1 -1
- package/lib/resource.d.ts +1 -1
- package/lib/resource.js +1 -1
- package/lib/resources/addresses.d.ts +1 -1
- package/lib/resources/addresses.js +1 -1
- package/lib/resources/adjustments.d.ts +1 -1
- package/lib/resources/adjustments.js +1 -1
- package/lib/resources/adyen_gateways.d.ts +1 -1
- package/lib/resources/adyen_gateways.js +1 -1
- package/lib/resources/adyen_payments.d.ts +1 -1
- package/lib/resources/adyen_payments.js +1 -1
- package/lib/resources/application.d.ts +1 -1
- package/lib/resources/application.js +1 -1
- package/lib/resources/attachments.d.ts +1 -1
- package/lib/resources/attachments.js +1 -1
- package/lib/resources/authorizations.d.ts +1 -1
- package/lib/resources/authorizations.js +1 -1
- package/lib/resources/avalara_accounts.d.ts +1 -1
- package/lib/resources/avalara_accounts.js +1 -1
- package/lib/resources/billing_info_validation_rules.d.ts +1 -1
- package/lib/resources/billing_info_validation_rules.js +1 -1
- package/lib/resources/bing_geocoders.d.ts +1 -1
- package/lib/resources/bing_geocoders.js +1 -1
- package/lib/resources/braintree_gateways.d.ts +1 -1
- package/lib/resources/braintree_gateways.js +1 -1
- package/lib/resources/braintree_payments.d.ts +1 -1
- package/lib/resources/braintree_payments.js +1 -1
- package/lib/resources/bundles.d.ts +1 -1
- package/lib/resources/bundles.js +1 -1
- package/lib/resources/captures.d.ts +1 -1
- package/lib/resources/captures.js +1 -1
- package/lib/resources/carrier_accounts.d.ts +1 -1
- package/lib/resources/carrier_accounts.js +1 -1
- package/lib/resources/checkout_com_gateways.d.ts +1 -1
- package/lib/resources/checkout_com_gateways.js +1 -1
- package/lib/resources/checkout_com_payments.d.ts +1 -1
- package/lib/resources/checkout_com_payments.js +1 -1
- package/lib/resources/coupon_codes_promotion_rules.d.ts +1 -1
- package/lib/resources/coupon_codes_promotion_rules.js +1 -1
- package/lib/resources/coupon_recipients.d.ts +1 -1
- package/lib/resources/coupon_recipients.js +1 -1
- package/lib/resources/coupons.d.ts +1 -1
- package/lib/resources/coupons.js +1 -1
- package/lib/resources/customer_addresses.d.ts +1 -1
- package/lib/resources/customer_addresses.js +1 -1
- package/lib/resources/customer_groups.d.ts +1 -1
- package/lib/resources/customer_groups.js +1 -1
- package/lib/resources/customer_password_resets.d.ts +1 -1
- package/lib/resources/customer_password_resets.js +1 -1
- package/lib/resources/customer_payment_sources.d.ts +1 -1
- package/lib/resources/customer_payment_sources.js +1 -1
- package/lib/resources/customer_subscriptions.d.ts +1 -1
- package/lib/resources/customer_subscriptions.js +1 -1
- package/lib/resources/customers.d.ts +1 -1
- package/lib/resources/customers.js +1 -1
- package/lib/resources/delivery_lead_times.d.ts +1 -1
- package/lib/resources/delivery_lead_times.js +1 -1
- package/lib/resources/event_callbacks.d.ts +1 -1
- package/lib/resources/event_callbacks.js +1 -1
- package/lib/resources/external_gateways.d.ts +1 -1
- package/lib/resources/external_gateways.js +1 -1
- package/lib/resources/external_payments.d.ts +1 -1
- package/lib/resources/external_payments.js +1 -1
- package/lib/resources/external_promotions.d.ts +1 -1
- package/lib/resources/external_promotions.js +1 -1
- package/lib/resources/external_tax_calculators.d.ts +1 -1
- package/lib/resources/external_tax_calculators.js +1 -1
- package/lib/resources/fixed_amount_promotions.d.ts +1 -1
- package/lib/resources/fixed_amount_promotions.js +1 -1
- package/lib/resources/fixed_price_promotions.d.ts +1 -1
- package/lib/resources/fixed_price_promotions.js +1 -1
- package/lib/resources/free_gift_promotions.d.ts +1 -1
- package/lib/resources/free_gift_promotions.js +1 -1
- package/lib/resources/free_shipping_promotions.d.ts +1 -1
- package/lib/resources/free_shipping_promotions.js +1 -1
- package/lib/resources/geocoders.d.ts +1 -1
- package/lib/resources/geocoders.js +1 -1
- package/lib/resources/gift_card_recipients.d.ts +1 -1
- package/lib/resources/gift_card_recipients.js +1 -1
- package/lib/resources/gift_cards.d.ts +1 -1
- package/lib/resources/gift_cards.js +1 -1
- package/lib/resources/google_geocoders.d.ts +1 -1
- package/lib/resources/google_geocoders.js +1 -1
- package/lib/resources/imports.d.ts +1 -1
- package/lib/resources/imports.js +1 -1
- package/lib/resources/in_stock_subscriptions.d.ts +1 -1
- package/lib/resources/in_stock_subscriptions.js +1 -1
- package/lib/resources/inventory_models.d.ts +1 -1
- package/lib/resources/inventory_models.js +1 -1
- package/lib/resources/inventory_return_locations.d.ts +1 -1
- package/lib/resources/inventory_return_locations.js +1 -1
- package/lib/resources/inventory_stock_locations.d.ts +1 -1
- package/lib/resources/inventory_stock_locations.js +1 -1
- package/lib/resources/klarna_gateways.d.ts +1 -1
- package/lib/resources/klarna_gateways.js +1 -1
- package/lib/resources/klarna_payments.d.ts +1 -1
- package/lib/resources/klarna_payments.js +1 -1
- package/lib/resources/line_item_options.d.ts +1 -1
- package/lib/resources/line_item_options.js +1 -1
- package/lib/resources/line_items.d.ts +1 -1
- package/lib/resources/line_items.js +1 -1
- package/lib/resources/manual_gateways.d.ts +1 -1
- package/lib/resources/manual_gateways.js +1 -1
- package/lib/resources/manual_tax_calculators.d.ts +1 -1
- package/lib/resources/manual_tax_calculators.js +1 -1
- package/lib/resources/markets.d.ts +1 -1
- package/lib/resources/markets.js +1 -1
- package/lib/resources/merchants.d.ts +1 -1
- package/lib/resources/merchants.js +1 -1
- package/lib/resources/order_amount_promotion_rules.d.ts +1 -1
- package/lib/resources/order_amount_promotion_rules.js +1 -1
- package/lib/resources/order_copies.d.ts +1 -1
- package/lib/resources/order_copies.js +1 -1
- package/lib/resources/order_subscriptions.d.ts +1 -1
- package/lib/resources/order_subscriptions.js +1 -1
- package/lib/resources/order_validation_rules.d.ts +1 -1
- package/lib/resources/order_validation_rules.js +1 -1
- package/lib/resources/orders.d.ts +1 -1
- package/lib/resources/orders.js +1 -1
- package/lib/resources/organization.d.ts +1 -1
- package/lib/resources/organization.js +1 -1
- package/lib/resources/packages.d.ts +1 -1
- package/lib/resources/packages.js +1 -1
- package/lib/resources/parcel_line_items.d.ts +1 -1
- package/lib/resources/parcel_line_items.js +1 -1
- package/lib/resources/parcels.d.ts +1 -1
- package/lib/resources/parcels.js +1 -1
- package/lib/resources/payment_gateways.d.ts +1 -1
- package/lib/resources/payment_gateways.js +1 -1
- package/lib/resources/payment_methods.d.ts +1 -1
- package/lib/resources/payment_methods.js +1 -1
- package/lib/resources/paypal_gateways.d.ts +1 -1
- package/lib/resources/paypal_gateways.js +1 -1
- package/lib/resources/paypal_payments.d.ts +1 -1
- package/lib/resources/paypal_payments.js +1 -1
- package/lib/resources/percentage_discount_promotions.d.ts +1 -1
- package/lib/resources/percentage_discount_promotions.js +1 -1
- package/lib/resources/price_lists.d.ts +1 -1
- package/lib/resources/price_lists.js +1 -1
- package/lib/resources/prices.d.ts +1 -1
- package/lib/resources/prices.js +1 -1
- package/lib/resources/promotion_rules.d.ts +1 -1
- package/lib/resources/promotion_rules.js +1 -1
- package/lib/resources/promotions.d.ts +1 -1
- package/lib/resources/promotions.js +1 -1
- package/lib/resources/refunds.d.ts +1 -1
- package/lib/resources/refunds.js +1 -1
- package/lib/resources/return_line_items.d.ts +1 -1
- package/lib/resources/return_line_items.js +1 -1
- package/lib/resources/returns.d.ts +1 -1
- package/lib/resources/returns.js +1 -1
- package/lib/resources/shipments.d.ts +1 -1
- package/lib/resources/shipments.js +1 -1
- package/lib/resources/shipping_categories.d.ts +1 -1
- package/lib/resources/shipping_categories.js +1 -1
- package/lib/resources/shipping_methods.d.ts +1 -1
- package/lib/resources/shipping_methods.js +1 -1
- package/lib/resources/shipping_zones.d.ts +1 -1
- package/lib/resources/shipping_zones.js +1 -1
- package/lib/resources/sku_list_items.d.ts +1 -1
- package/lib/resources/sku_list_items.js +1 -1
- package/lib/resources/sku_list_promotion_rules.d.ts +1 -1
- package/lib/resources/sku_list_promotion_rules.js +1 -1
- package/lib/resources/sku_lists.d.ts +1 -1
- package/lib/resources/sku_lists.js +1 -1
- package/lib/resources/sku_options.d.ts +1 -1
- package/lib/resources/sku_options.js +1 -1
- package/lib/resources/skus.d.ts +1 -1
- package/lib/resources/skus.js +1 -1
- package/lib/resources/stock_items.d.ts +1 -1
- package/lib/resources/stock_items.js +1 -1
- package/lib/resources/stock_line_items.d.ts +1 -1
- package/lib/resources/stock_line_items.js +1 -1
- package/lib/resources/stock_locations.d.ts +1 -1
- package/lib/resources/stock_locations.js +1 -1
- package/lib/resources/stock_transfers.d.ts +1 -1
- package/lib/resources/stock_transfers.js +1 -1
- package/lib/resources/stripe_gateways.d.ts +1 -1
- package/lib/resources/stripe_gateways.js +1 -1
- package/lib/resources/stripe_payments.d.ts +1 -1
- package/lib/resources/stripe_payments.js +1 -1
- package/lib/resources/tax_calculators.d.ts +1 -1
- package/lib/resources/tax_calculators.js +1 -1
- package/lib/resources/tax_categories.d.ts +1 -1
- package/lib/resources/tax_categories.js +1 -1
- package/lib/resources/tax_rules.d.ts +1 -1
- package/lib/resources/tax_rules.js +1 -1
- package/lib/resources/taxjar_accounts.d.ts +1 -1
- package/lib/resources/taxjar_accounts.js +1 -1
- package/lib/resources/transactions.d.ts +1 -1
- package/lib/resources/transactions.js +1 -1
- package/lib/resources/voids.d.ts +1 -1
- package/lib/resources/voids.js +1 -1
- package/lib/resources/webhooks.d.ts +1 -1
- package/lib/resources/webhooks.js +1 -1
- package/lib/resources/wire_transfers.d.ts +1 -1
- package/lib/resources/wire_transfers.js +1 -1
- package/lib/static.d.ts +1 -1
- package/lib/static.js +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/lib/cjs/api.d.ts
CHANGED
package/lib/cjs/client.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var __classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(t,e,r,s,a){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?a.call(t,r):a?a.value=r:e.set(t,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},_ApiClient_accessToken,_ApiClient_client;Object.defineProperty(exports,"__esModule",{value:!0});const axios_1=__importDefault(require("axios")),error_1=require("./error"),config_1=__importDefault(require("./config")),baseURL=(t,e)=>`https://${t.toLowerCase()}.${e||config_1.default.default.domain}/api`,handleError=t=>{let e=new error_1.SdkError({message:t.message,type:error_1.ErrorType.GENERIC});if(axios_1.default.isAxiosError(t))if(t.response){const r=new error_1.ApiError(e);r.type=error_1.ErrorType.RESPONSE,r.status=t.response.status,r.code=String(r.status),r.errors=t.response.data.errors,e=r}else t.request?(e.type=error_1.ErrorType.REQUEST,e.request=t.request):e.type=error_1.ErrorType.CLIENT;else axios_1.default.isCancel(t)?e.type=error_1.ErrorType.CANCEL:e.source=t;throw e};class ApiClient{constructor(e){_ApiClient_accessToken.set(this,void 0),_ApiClient_client.set(this,void 0),this.baseUrl=baseURL(e.organization,e.domain),__classPrivateFieldSet(this,_ApiClient_accessToken,e.accessToken,"f");const r={timeout:e.timeout||config_1.default.client.timeout};__classPrivateFieldSet(this,_ApiClient_client,axios_1.default.create(Object.assign({baseURL:this.baseUrl,timeout:config_1.default.client.timeout,headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json",Authorization:"Bearer "+__classPrivateFieldGet(this,_ApiClient_accessToken,"f")}},r)),"f"),this.interceptors=__classPrivateFieldGet(this,_ApiClient_client,"f").interceptors}static create(e){if(!
|
1
|
+
"use strict";var __classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(t,e,r,s,a){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?a.call(t,r):a?a.value=r:e.set(t,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},_ApiClient_accessToken,_ApiClient_client;Object.defineProperty(exports,"__esModule",{value:!0});const axios_1=__importDefault(require("axios")),error_1=require("./error"),config_1=__importDefault(require("./config")),baseURL=(t,e)=>`https://${t.toLowerCase()}.${e||config_1.default.default.domain}/api`,handleError=t=>{let e=new error_1.SdkError({message:t.message,type:error_1.ErrorType.GENERIC});if(axios_1.default.isAxiosError(t))if(t.response){const r=new error_1.ApiError(e);r.type=error_1.ErrorType.RESPONSE,r.status=t.response.status,r.code=String(r.status),r.errors=t.response.data.errors,e=r}else t.request?(e.type=error_1.ErrorType.REQUEST,e.request=t.request):e.type=error_1.ErrorType.CLIENT;else axios_1.default.isCancel(t)?e.type=error_1.ErrorType.CANCEL:e.source=t;throw e};class ApiClient{constructor(e){_ApiClient_accessToken.set(this,void 0),_ApiClient_client.set(this,void 0),this.baseUrl=baseURL(e.organization,e.domain),__classPrivateFieldSet(this,_ApiClient_accessToken,e.accessToken,"f");const r={timeout:e.timeout||config_1.default.client.timeout};__classPrivateFieldSet(this,_ApiClient_client,axios_1.default.create(Object.assign({baseURL:this.baseUrl,timeout:config_1.default.client.timeout,headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json",Authorization:"Bearer "+__classPrivateFieldGet(this,_ApiClient_accessToken,"f")}},r)),"f"),this.interceptors=__classPrivateFieldGet(this,_ApiClient_client,"f").interceptors}static create(e){if(!e?.organization)throw new Error("Undefined 'organization' parameter");if(!e?.accessToken)throw new Error("Undefined 'accessToken' parameter");return new ApiClient(e)}config(e){const r=__classPrivateFieldGet(this,_ApiClient_client,"f").defaults;e.timeout&&(r.timeout=e.timeout),e.organization&&(this.baseUrl=baseURL(e.organization,e.domain)),e.accessToken&&(__classPrivateFieldSet(this,_ApiClient_accessToken,e.accessToken,"f"),r.headers.common.Authorization="Bearer "+__classPrivateFieldGet(this,_ApiClient_accessToken,"f"))}async request(e,r,s,a){const o=s?{data:s}:void 0,c=r,u=a?.organization?baseURL(a.organization,a.domain):void 0,n=a?.accessToken||__classPrivateFieldGet(this,_ApiClient_accessToken,"f"),l=n?{Authorization:"Bearer "+n}:void 0;return __classPrivateFieldGet(this,_ApiClient_client,"f").request(Object.assign({method:e,baseURL:u,url:c,data:o,headers:l},a)).then(i=>i.data).catch(i=>handleError(i))}}_ApiClient_accessToken=new WeakMap,_ApiClient_client=new WeakMap,exports.default=ApiClient;
|
package/lib/cjs/commercelayer.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,s,i){i===void 0&&(i=s);var n=Object.getOwnPropertyDescriptor(t,s);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,i,n)}:function(e,t,s,i){i===void 0&&(i=s),e[i]=t[s]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var s in e)s!=="default"&&Object.prototype.hasOwnProperty.call(e,s)&&__createBinding(t,e,s);return __setModuleDefault(t,e),t},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(e,t,s,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,s):n?n.value=s:t.set(e,s),s},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(e,t,s,i){if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?i:s==="a"?i.call(e):i?i.value:t.get(e)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},_CommerceLayerClient_adapter,_CommerceLayerClient_organization;Object.defineProperty(exports,"__esModule",{value:!0});const api=__importStar(require("./api")),static_1=require("./static"),resource_1=__importDefault(require("./resource")),OPEN_API_SCHEMA_VERSION="2.9.1";class CommerceLayerClient{constructor(t){_CommerceLayerClient_adapter.set(this,void 0),_CommerceLayerClient_organization.set(this,void 0),__classPrivateFieldSet(this,_CommerceLayerClient_adapter,new resource_1.default(t),"f"),__classPrivateFieldSet(this,_CommerceLayerClient_organization,t.organization,"f"),this.addresses=new api.Addresses(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adjustments=new api.Adjustments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adyen_gateways=new api.AdyenGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adyen_payments=new api.AdyenPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.application=new api.Applications(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.attachments=new api.Attachments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.authorizations=new api.Authorizations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.avalara_accounts=new api.AvalaraAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.billing_info_validation_rules=new api.BillingInfoValidationRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.bing_geocoders=new api.BingGeocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.braintree_gateways=new api.BraintreeGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.braintree_payments=new api.BraintreePayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.bundles=new api.Bundles(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.captures=new api.Captures(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.carrier_accounts=new api.CarrierAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.checkout_com_gateways=new api.CheckoutComGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.checkout_com_payments=new api.CheckoutComPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupon_codes_promotion_rules=new api.CouponCodesPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupon_recipients=new api.CouponRecipients(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupons=new api.Coupons(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_addresses=new api.CustomerAddresses(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_groups=new api.CustomerGroups(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_password_resets=new api.CustomerPasswordResets(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_payment_sources=new api.CustomerPaymentSources(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_subscriptions=new api.CustomerSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customers=new api.Customers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.delivery_lead_times=new api.DeliveryLeadTimes(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.event_callbacks=new api.EventCallbacks(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_gateways=new api.ExternalGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_payments=new api.ExternalPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_promotions=new api.ExternalPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_tax_calculators=new api.ExternalTaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.fixed_amount_promotions=new api.FixedAmountPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.fixed_price_promotions=new api.FixedPricePromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.free_gift_promotions=new api.FreeGiftPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.free_shipping_promotions=new api.FreeShippingPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.geocoders=new api.Geocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.gift_card_recipients=new api.GiftCardRecipients(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.gift_cards=new api.GiftCards(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.google_geocoders=new api.GoogleGeocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.imports=new api.Imports(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.in_stock_subscriptions=new api.InStockSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_models=new api.InventoryModels(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_return_locations=new api.InventoryReturnLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_stock_locations=new api.InventoryStockLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.klarna_gateways=new api.KlarnaGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.klarna_payments=new api.KlarnaPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.line_item_options=new api.LineItemOptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.line_items=new api.LineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.manual_gateways=new api.ManualGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.manual_tax_calculators=new api.ManualTaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.markets=new api.Markets(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.merchants=new api.Merchants(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_amount_promotion_rules=new api.OrderAmountPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_copies=new api.OrderCopies(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_subscriptions=new api.OrderSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_validation_rules=new api.OrderValidationRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.orders=new api.Orders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.organization=new api.Organizations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.packages=new api.Packages(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.parcel_line_items=new api.ParcelLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.parcels=new api.Parcels(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.payment_gateways=new api.PaymentGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.payment_methods=new api.PaymentMethods(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.paypal_gateways=new api.PaypalGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.paypal_payments=new api.PaypalPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.percentage_discount_promotions=new api.PercentageDiscountPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.price_lists=new api.PriceLists(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.prices=new api.Prices(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.promotion_rules=new api.PromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.promotions=new api.Promotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.refunds=new api.Refunds(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.return_line_items=new api.ReturnLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.returns=new api.Returns(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipments=new api.Shipments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_categories=new api.ShippingCategories(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_methods=new api.ShippingMethods(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_zones=new api.ShippingZones(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_list_items=new api.SkuListItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_list_promotion_rules=new api.SkuListPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_lists=new api.SkuLists(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_options=new api.SkuOptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.skus=new api.Skus(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_items=new api.StockItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_line_items=new api.StockLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_locations=new api.StockLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_transfers=new api.StockTransfers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stripe_gateways=new api.StripeGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stripe_payments=new api.StripePayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_calculators=new api.TaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_categories=new api.TaxCategories(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_rules=new api.TaxRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.taxjar_accounts=new api.TaxjarAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.transactions=new api.Transactions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.voids=new api.Voids(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.webhooks=new api.Webhooks(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.wire_transfers=new api.WireTransfers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f"))}static get openApiSchemaVersion(){return OPEN_API_SCHEMA_VERSION}get currentOrganization(){return __classPrivateFieldGet(this,_CommerceLayerClient_organization,"f")}config(t){t.organization&&__classPrivateFieldSet(this,_CommerceLayerClient_organization,t.organization,"f"),__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").config(t)}resources(){return static_1.CommerceLayerStatic.resources()}isApiError(t){return static_1.CommerceLayerStatic.isApiError(t)}addRequestInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors.request.use(t,s)}addResponseInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors.response.use(t,s)}removeInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors[t].eject(s)}addRawResponseReader(){const t={id:void 0,rawResponse:void 0};function s(n){return t.rawResponse=n==null?void 0:n.data,n}const i=this.addResponseInterceptor(s);return t.id=i,t}removeRawResponseReader(t){const s=typeof t=="number"?t:t.id;if(s)return this.removeInterceptor("response",s)}}_CommerceLayerClient_adapter=new WeakMap,_CommerceLayerClient_organization=new WeakMap;const CommerceLayer=e=>new CommerceLayerClient(e);exports.default=CommerceLayer;
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,s,i){i===void 0&&(i=s);var n=Object.getOwnPropertyDescriptor(t,s);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,i,n)}:function(e,t,s,i){i===void 0&&(i=s),e[i]=t[s]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var s in e)s!=="default"&&Object.prototype.hasOwnProperty.call(e,s)&&__createBinding(t,e,s);return __setModuleDefault(t,e),t},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(e,t,s,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,s):n?n.value=s:t.set(e,s),s},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(e,t,s,i){if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?i:s==="a"?i.call(e):i?i.value:t.get(e)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},_CommerceLayerClient_adapter,_CommerceLayerClient_organization;Object.defineProperty(exports,"__esModule",{value:!0});const api=__importStar(require("./api")),static_1=require("./static"),resource_1=__importDefault(require("./resource")),OPEN_API_SCHEMA_VERSION="2.9.2";class CommerceLayerClient{constructor(t){_CommerceLayerClient_adapter.set(this,void 0),_CommerceLayerClient_organization.set(this,void 0),__classPrivateFieldSet(this,_CommerceLayerClient_adapter,new resource_1.default(t),"f"),__classPrivateFieldSet(this,_CommerceLayerClient_organization,t.organization,"f"),this.addresses=new api.Addresses(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adjustments=new api.Adjustments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adyen_gateways=new api.AdyenGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adyen_payments=new api.AdyenPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.application=new api.Applications(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.attachments=new api.Attachments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.authorizations=new api.Authorizations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.avalara_accounts=new api.AvalaraAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.billing_info_validation_rules=new api.BillingInfoValidationRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.bing_geocoders=new api.BingGeocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.braintree_gateways=new api.BraintreeGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.braintree_payments=new api.BraintreePayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.bundles=new api.Bundles(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.captures=new api.Captures(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.carrier_accounts=new api.CarrierAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.checkout_com_gateways=new api.CheckoutComGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.checkout_com_payments=new api.CheckoutComPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupon_codes_promotion_rules=new api.CouponCodesPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupon_recipients=new api.CouponRecipients(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupons=new api.Coupons(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_addresses=new api.CustomerAddresses(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_groups=new api.CustomerGroups(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_password_resets=new api.CustomerPasswordResets(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_payment_sources=new api.CustomerPaymentSources(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_subscriptions=new api.CustomerSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customers=new api.Customers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.delivery_lead_times=new api.DeliveryLeadTimes(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.event_callbacks=new api.EventCallbacks(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_gateways=new api.ExternalGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_payments=new api.ExternalPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_promotions=new api.ExternalPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_tax_calculators=new api.ExternalTaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.fixed_amount_promotions=new api.FixedAmountPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.fixed_price_promotions=new api.FixedPricePromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.free_gift_promotions=new api.FreeGiftPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.free_shipping_promotions=new api.FreeShippingPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.geocoders=new api.Geocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.gift_card_recipients=new api.GiftCardRecipients(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.gift_cards=new api.GiftCards(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.google_geocoders=new api.GoogleGeocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.imports=new api.Imports(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.in_stock_subscriptions=new api.InStockSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_models=new api.InventoryModels(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_return_locations=new api.InventoryReturnLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_stock_locations=new api.InventoryStockLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.klarna_gateways=new api.KlarnaGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.klarna_payments=new api.KlarnaPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.line_item_options=new api.LineItemOptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.line_items=new api.LineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.manual_gateways=new api.ManualGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.manual_tax_calculators=new api.ManualTaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.markets=new api.Markets(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.merchants=new api.Merchants(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_amount_promotion_rules=new api.OrderAmountPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_copies=new api.OrderCopies(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_subscriptions=new api.OrderSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_validation_rules=new api.OrderValidationRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.orders=new api.Orders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.organization=new api.Organizations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.packages=new api.Packages(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.parcel_line_items=new api.ParcelLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.parcels=new api.Parcels(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.payment_gateways=new api.PaymentGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.payment_methods=new api.PaymentMethods(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.paypal_gateways=new api.PaypalGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.paypal_payments=new api.PaypalPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.percentage_discount_promotions=new api.PercentageDiscountPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.price_lists=new api.PriceLists(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.prices=new api.Prices(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.promotion_rules=new api.PromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.promotions=new api.Promotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.refunds=new api.Refunds(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.return_line_items=new api.ReturnLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.returns=new api.Returns(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipments=new api.Shipments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_categories=new api.ShippingCategories(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_methods=new api.ShippingMethods(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_zones=new api.ShippingZones(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_list_items=new api.SkuListItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_list_promotion_rules=new api.SkuListPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_lists=new api.SkuLists(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_options=new api.SkuOptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.skus=new api.Skus(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_items=new api.StockItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_line_items=new api.StockLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_locations=new api.StockLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_transfers=new api.StockTransfers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stripe_gateways=new api.StripeGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stripe_payments=new api.StripePayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_calculators=new api.TaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_categories=new api.TaxCategories(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_rules=new api.TaxRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.taxjar_accounts=new api.TaxjarAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.transactions=new api.Transactions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.voids=new api.Voids(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.webhooks=new api.Webhooks(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.wire_transfers=new api.WireTransfers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f"))}static get openApiSchemaVersion(){return OPEN_API_SCHEMA_VERSION}get currentOrganization(){return __classPrivateFieldGet(this,_CommerceLayerClient_organization,"f")}config(t){t.organization&&__classPrivateFieldSet(this,_CommerceLayerClient_organization,t.organization,"f"),__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").config(t)}resources(){return static_1.CommerceLayerStatic.resources()}isApiError(t){return static_1.CommerceLayerStatic.isApiError(t)}addRequestInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors.request.use(t,s)}addResponseInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors.response.use(t,s)}removeInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors[t].eject(s)}addRawResponseReader(){const t={id:void 0,rawResponse:void 0};function s(n){return t.rawResponse=n?.data,n}const i=this.addResponseInterceptor(s);return t.id=i,t}removeRawResponseReader(t){const s=typeof t=="number"?t:t.id;if(s)return this.removeInterceptor("response",s)}}_CommerceLayerClient_adapter=new WeakMap,_CommerceLayerClient_organization=new WeakMap;const CommerceLayer=e=>new CommerceLayerClient(e);exports.default=CommerceLayer;
|
package/lib/cjs/model.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* ©2022 Commerce Layer Inc.
|
3
|
-
* OpenAPI schema, version 2.9.
|
3
|
+
* OpenAPI schema, version 2.9.2
|
4
4
|
**/
|
5
5
|
export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
|
6
6
|
export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
|
package/lib/cjs/resource.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var __classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(s,t,r,e,a){if(e==="m")throw new TypeError("Private method is not writable");if(e==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!a:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e==="a"?a.call(s,r):a?a.value=r:t.set(s,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(s,t,r,e){if(r==="a"&&!e)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!e:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?e:r==="a"?e.call(s):e?e.value:t.get(s)},__importDefault=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},_ResourceAdapter_client,_ResourceAdapter_config;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiResource=void 0;const client_1=__importDefault(require("./client")),jsonapi_1=require("./jsonapi"),query_1=require("./query"),config_1=__importDefault(require("./config"));class ListResponse extends Array{constructor(t,r){super(...r||[]);this.meta=t}first(){return this.length?this[0]:void 0}last(){return this.length?this[this.length-1]:void 0}get(t){return this.length&&t>=0?this[t]:void 0}}class ResourceAdapter{constructor(t){_ResourceAdapter_client.set(this,void 0),_ResourceAdapter_config.set(this,{}),__classPrivateFieldSet(this,_ResourceAdapter_client,client_1.default.create(t),"f"),this.config(t)}get interceptors(){return __classPrivateFieldGet(this,_ResourceAdapter_client,"f").interceptors}config(t){__classPrivateFieldGet(this,_ResourceAdapter_client,"f").config(t)}async singleton(t,r,e){const a=(0,query_1.generateQueryStringParams)(r,t);
|
1
|
+
"use strict";var __classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(s,t,r,e,a){if(e==="m")throw new TypeError("Private method is not writable");if(e==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!a:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e==="a"?a.call(s,r):a?a.value=r:t.set(s,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(s,t,r,e){if(r==="a"&&!e)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!e:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?e:r==="a"?e.call(s):e?e.value:t.get(s)},__importDefault=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},_ResourceAdapter_client,_ResourceAdapter_config;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiResource=void 0;const client_1=__importDefault(require("./client")),jsonapi_1=require("./jsonapi"),query_1=require("./query"),config_1=__importDefault(require("./config"));class ListResponse extends Array{constructor(t,r){super(...r||[]);this.meta=t}first(){return this.length?this[0]:void 0}last(){return this.length?this[this.length-1]:void 0}get(t){return this.length&&t>=0?this[t]:void 0}}class ResourceAdapter{constructor(t){_ResourceAdapter_client.set(this,void 0),_ResourceAdapter_config.set(this,{}),__classPrivateFieldSet(this,_ResourceAdapter_client,client_1.default.create(t),"f"),this.config(t)}get interceptors(){return __classPrivateFieldGet(this,_ResourceAdapter_client,"f").interceptors}config(t){__classPrivateFieldGet(this,_ResourceAdapter_client,"f").config(t)}async singleton(t,r,e){const a=(0,query_1.generateQueryStringParams)(r,t);e?.params&&Object.assign(a,e?.params);const i=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("get",`${t.type}`,void 0,Object.assign(Object.assign({},e),{params:a}));return(0,jsonapi_1.denormalize)(i)}async retrieve(t,r,e){const a=(0,query_1.generateQueryStringParams)(r,t);e?.params&&Object.assign(a,e?.params);const i=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("get",`${t.type}/${t.id}`,void 0,Object.assign(Object.assign({},e),{params:a}));return(0,jsonapi_1.denormalize)(i)}async list(t,r,e){var a,i;const n=(0,query_1.generateQueryStringParams)(r,t);e?.params&&Object.assign(n,e?.params);const u=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("get",`${t.type}`,void 0,Object.assign(Object.assign({},e),{params:n})),c=(0,jsonapi_1.denormalize)(u),d={pageCount:Number((a=u.meta)===null||a===void 0?void 0:a.page_count),recordCount:Number((i=u.meta)===null||i===void 0?void 0:i.record_count),currentPage:r?.pageNumber||config_1.default.default.pageNumber,recordsPerPage:r?.pageSize||config_1.default.default.pageSize};return new ListResponse(d,c)}async create(t,r,e){const a=(0,query_1.generateQueryStringParams)(r,t);e?.params&&Object.assign(a,e?.params);const i=(0,jsonapi_1.normalize)(t),n=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("post",t.type,i,Object.assign(Object.assign({},e),{params:a}));return(0,jsonapi_1.denormalize)(n)}async update(t,r,e){const a=(0,query_1.generateQueryStringParams)(r,t);e?.params&&Object.assign(a,e?.params);const i=(0,jsonapi_1.normalize)(t),n=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("patch",`${t.type}/${t.id}`,i,Object.assign(Object.assign({},e),{params:a}));return(0,jsonapi_1.denormalize)(n)}async delete(t,r){await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("delete",`${t.type}/${t.id}`,void 0,r)}}_ResourceAdapter_client=new WeakMap,_ResourceAdapter_config=new WeakMap;class ApiResource{constructor(t){this.resources=t}}exports.ApiResource=ApiResource,exports.default=ResourceAdapter;
|
@@ -13,6 +13,10 @@ interface KlarnaPayment extends Resource {
|
|
13
13
|
client_token?: string;
|
14
14
|
payment_methods?: object[];
|
15
15
|
auth_token?: string;
|
16
|
+
mismatched_amounts?: boolean;
|
17
|
+
intent_amount_cents?: number;
|
18
|
+
intent_amount_float?: number;
|
19
|
+
formatted_intent_amount?: string;
|
16
20
|
order?: Order;
|
17
21
|
payment_gateway?: PaymentGateway;
|
18
22
|
}
|
@@ -224,6 +224,7 @@ interface OrderUpdate extends ResourceUpdate {
|
|
224
224
|
_capture?: boolean;
|
225
225
|
_refund?: boolean;
|
226
226
|
_update_taxes?: boolean;
|
227
|
+
_nullify_payment_source?: boolean;
|
227
228
|
_billing_address_clone_id?: string;
|
228
229
|
_shipping_address_clone_id?: string;
|
229
230
|
_customer_payment_source_id?: string;
|
package/lib/cjs/util.d.ts
CHANGED
package/lib/client.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import p from"axios";import{SdkError as E,ApiError as y,ErrorType as i}from"./error";import c from"./config";import w from"./debug";const n=w("client"),h=(o,e)=>`https://${o.toLowerCase()}.${e||c.default.domain}/api`,T=o=>{let e=new E({message:o.message,type:i.GENERIC});if(p.isAxiosError(o))if(o.response){const t=new y(e);t.type=i.RESPONSE,t.status=o.response.status,t.code=String(t.status),t.errors=o.response.data.errors,e=t}else o.request?(e.type=i.REQUEST,e.request=o.request):e.type=i.CLIENT;else p.isCancel(o)?e.type=i.CANCEL:e.source=o;throw e};class m{static create(e){if(!e?.organization)throw new Error("Undefined 'organization' parameter");if(!e?.accessToken)throw new Error("Undefined 'accessToken' parameter");return new m(e)}baseUrl;#e;#t;interceptors;constructor(e){n("new client instance %O",e),this.baseUrl=h(e.organization,e.domain),this.#e=e.accessToken;const t={timeout:e.timeout||c.client.timeout,proxy:e.proxy,httpAgent:e.httpAgent,httpsAgent:e.httpsAgent},r={baseURL:this.baseUrl,timeout:c.client.timeout,headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json",Authorization:"Bearer "+this.#e},...t};n("axios options: %O",r),this.#t=p.create(r),this.interceptors=this.#t.interceptors}config(e){n("config %o",e);const t=this.#t.defaults;e.timeout&&(t.timeout=e.timeout),e.proxy&&(t.proxy=e.proxy),e.httpAgent&&(t.httpAgent=e.httpAgent),e.httpsAgent&&(t.httpsAgent=e.httpsAgent),e.organization&&(this.baseUrl=h(e.organization,e.domain)),e.accessToken&&(this.#e=e.accessToken,t.headers.common.Authorization="Bearer "+this.#e)}async request(e,t,r,s){n("request %s %s, %O, %O",e,t,r||{},s||{});const g=r?{data:r}:void 0,l=t,A=s?.organization?h(s.organization,s.domain):void 0,u=s?.accessToken||this.#e,f=u?{Authorization:"Bearer "+u}:void 0,d={method:e,baseURL:A,url:l,data:g,headers:f,...s};return n("request params: %O",d),this.#t.request(d).then(a=>a.data).catch(a=>T(a))}}export default m;
|
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.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{resourceList as t}from"./api";const
|
1
|
+
import{resourceList as t}from"./api";const e=s=>s&&s.type&&s.id&&t.includes(s.type),p=s=>s&&typeof s.type<"u"&&s.type&&t.includes(s.type);export{e as isResourceId,p as isResourceType};
|
package/lib/debug.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
declare type Debugger=(pattern:string,...args:any[])=>void;declare const debug:(namespace
|
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.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/esm/api.d.ts
CHANGED
package/lib/esm/client.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var l=this&&this.__classPrivateFieldSet||function(a,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?a!==e||!s:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(a,t):s?s.value=t:e.set(a,t),t},n=this&&this.__classPrivateFieldGet||function(a,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?a!==e||!r:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(a):r?r.value:e.get(a)},i,o;import h from"axios";import{SdkError as y,ApiError as b,ErrorType as c}from"./error";import u from"./config";const f=(a,e)=>`https://${a.toLowerCase()}.${e||u.default.domain}/api`,C=a=>{let e=new y({message:a.message,type:c.GENERIC});if(h.isAxiosError(a))if(a.response){const t=new b(e);t.type=c.RESPONSE,t.status=a.response.status,t.code=String(t.status),t.errors=a.response.data.errors,e=t}else a.request?(e.type=c.REQUEST,e.request=a.request):e.type=c.CLIENT;else h.isCancel(a)?e.type=c.CANCEL:e.source=a;throw e};class m{constructor(e){i.set(this,void 0),o.set(this,void 0),this.baseUrl=f(e.organization,e.domain),l(this,i,e.accessToken,"f");const t={timeout:e.timeout||u.client.timeout};l(this,o,h.create(Object.assign({baseURL:this.baseUrl,timeout:u.client.timeout,headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json",Authorization:"Bearer "+n(this,i,"f")}},t)),"f"),this.interceptors=n(this,o,"f").interceptors}static create(e){if(!
|
1
|
+
var l=this&&this.__classPrivateFieldSet||function(a,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?a!==e||!s:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(a,t):s?s.value=t:e.set(a,t),t},n=this&&this.__classPrivateFieldGet||function(a,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?a!==e||!r:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(a):r?r.value:e.get(a)},i,o;import h from"axios";import{SdkError as y,ApiError as b,ErrorType as c}from"./error";import u from"./config";const f=(a,e)=>`https://${a.toLowerCase()}.${e||u.default.domain}/api`,C=a=>{let e=new y({message:a.message,type:c.GENERIC});if(h.isAxiosError(a))if(a.response){const t=new b(e);t.type=c.RESPONSE,t.status=a.response.status,t.code=String(t.status),t.errors=a.response.data.errors,e=t}else a.request?(e.type=c.REQUEST,e.request=a.request):e.type=c.CLIENT;else h.isCancel(a)?e.type=c.CANCEL:e.source=a;throw e};class m{constructor(e){i.set(this,void 0),o.set(this,void 0),this.baseUrl=f(e.organization,e.domain),l(this,i,e.accessToken,"f");const t={timeout:e.timeout||u.client.timeout};l(this,o,h.create(Object.assign({baseURL:this.baseUrl,timeout:u.client.timeout,headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json",Authorization:"Bearer "+n(this,i,"f")}},t)),"f"),this.interceptors=n(this,o,"f").interceptors}static create(e){if(!e?.organization)throw new Error("Undefined 'organization' parameter");if(!e?.accessToken)throw new Error("Undefined 'accessToken' parameter");return new m(e)}config(e){const t=n(this,o,"f").defaults;e.timeout&&(t.timeout=e.timeout),e.organization&&(this.baseUrl=f(e.organization,e.domain)),e.accessToken&&(l(this,i,e.accessToken,"f"),t.headers.common.Authorization="Bearer "+n(this,i,"f"))}async request(e,t,r,s){const p=r?{data:r}:void 0,E=t,v=s?.organization?f(s.organization,s.domain):void 0,w=s?.accessToken||n(this,i,"f"),T=w?{Authorization:"Bearer "+w}:void 0;return n(this,o,"f").request(Object.assign({method:e,baseURL:v,url:E,data:p,headers:T},s)).then(d=>d.data).catch(d=>C(d))}}i=new WeakMap,o=new WeakMap;export default m;
|
package/lib/esm/commercelayer.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var c=this&&this.__classPrivateFieldSet||function(o,i,n,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?o!==i||!a:!i.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(o,n):a?a.value=n:i.set(o,n),n},s=this&&this.__classPrivateFieldGet||function(o,i,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?o!==i||!r:!i.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(o):r?r.value:i.get(o)},t,h;import*as e from"./api";import{CommerceLayerStatic as w}from"./static";import f from"./resource";const p="2.9.
|
1
|
+
var c=this&&this.__classPrivateFieldSet||function(o,i,n,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?o!==i||!a:!i.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(o,n):a?a.value=n:i.set(o,n),n},s=this&&this.__classPrivateFieldGet||function(o,i,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?o!==i||!r:!i.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(o):r?r.value:i.get(o)},t,h;import*as e from"./api";import{CommerceLayerStatic as w}from"./static";import f from"./resource";const p="2.9.2";class u{constructor(i){t.set(this,void 0),h.set(this,void 0),c(this,t,new f(i),"f"),c(this,h,i.organization,"f"),this.addresses=new e.Addresses(s(this,t,"f")),this.adjustments=new e.Adjustments(s(this,t,"f")),this.adyen_gateways=new e.AdyenGateways(s(this,t,"f")),this.adyen_payments=new e.AdyenPayments(s(this,t,"f")),this.application=new e.Applications(s(this,t,"f")),this.attachments=new e.Attachments(s(this,t,"f")),this.authorizations=new e.Authorizations(s(this,t,"f")),this.avalara_accounts=new e.AvalaraAccounts(s(this,t,"f")),this.billing_info_validation_rules=new e.BillingInfoValidationRules(s(this,t,"f")),this.bing_geocoders=new e.BingGeocoders(s(this,t,"f")),this.braintree_gateways=new e.BraintreeGateways(s(this,t,"f")),this.braintree_payments=new e.BraintreePayments(s(this,t,"f")),this.bundles=new e.Bundles(s(this,t,"f")),this.captures=new e.Captures(s(this,t,"f")),this.carrier_accounts=new e.CarrierAccounts(s(this,t,"f")),this.checkout_com_gateways=new e.CheckoutComGateways(s(this,t,"f")),this.checkout_com_payments=new e.CheckoutComPayments(s(this,t,"f")),this.coupon_codes_promotion_rules=new e.CouponCodesPromotionRules(s(this,t,"f")),this.coupon_recipients=new e.CouponRecipients(s(this,t,"f")),this.coupons=new e.Coupons(s(this,t,"f")),this.customer_addresses=new e.CustomerAddresses(s(this,t,"f")),this.customer_groups=new e.CustomerGroups(s(this,t,"f")),this.customer_password_resets=new e.CustomerPasswordResets(s(this,t,"f")),this.customer_payment_sources=new e.CustomerPaymentSources(s(this,t,"f")),this.customer_subscriptions=new e.CustomerSubscriptions(s(this,t,"f")),this.customers=new e.Customers(s(this,t,"f")),this.delivery_lead_times=new e.DeliveryLeadTimes(s(this,t,"f")),this.event_callbacks=new e.EventCallbacks(s(this,t,"f")),this.external_gateways=new e.ExternalGateways(s(this,t,"f")),this.external_payments=new e.ExternalPayments(s(this,t,"f")),this.external_promotions=new e.ExternalPromotions(s(this,t,"f")),this.external_tax_calculators=new e.ExternalTaxCalculators(s(this,t,"f")),this.fixed_amount_promotions=new e.FixedAmountPromotions(s(this,t,"f")),this.fixed_price_promotions=new e.FixedPricePromotions(s(this,t,"f")),this.free_gift_promotions=new e.FreeGiftPromotions(s(this,t,"f")),this.free_shipping_promotions=new e.FreeShippingPromotions(s(this,t,"f")),this.geocoders=new e.Geocoders(s(this,t,"f")),this.gift_card_recipients=new e.GiftCardRecipients(s(this,t,"f")),this.gift_cards=new e.GiftCards(s(this,t,"f")),this.google_geocoders=new e.GoogleGeocoders(s(this,t,"f")),this.imports=new e.Imports(s(this,t,"f")),this.in_stock_subscriptions=new e.InStockSubscriptions(s(this,t,"f")),this.inventory_models=new e.InventoryModels(s(this,t,"f")),this.inventory_return_locations=new e.InventoryReturnLocations(s(this,t,"f")),this.inventory_stock_locations=new e.InventoryStockLocations(s(this,t,"f")),this.klarna_gateways=new e.KlarnaGateways(s(this,t,"f")),this.klarna_payments=new e.KlarnaPayments(s(this,t,"f")),this.line_item_options=new e.LineItemOptions(s(this,t,"f")),this.line_items=new e.LineItems(s(this,t,"f")),this.manual_gateways=new e.ManualGateways(s(this,t,"f")),this.manual_tax_calculators=new e.ManualTaxCalculators(s(this,t,"f")),this.markets=new e.Markets(s(this,t,"f")),this.merchants=new e.Merchants(s(this,t,"f")),this.order_amount_promotion_rules=new e.OrderAmountPromotionRules(s(this,t,"f")),this.order_copies=new e.OrderCopies(s(this,t,"f")),this.order_subscriptions=new e.OrderSubscriptions(s(this,t,"f")),this.order_validation_rules=new e.OrderValidationRules(s(this,t,"f")),this.orders=new e.Orders(s(this,t,"f")),this.organization=new e.Organizations(s(this,t,"f")),this.packages=new e.Packages(s(this,t,"f")),this.parcel_line_items=new e.ParcelLineItems(s(this,t,"f")),this.parcels=new e.Parcels(s(this,t,"f")),this.payment_gateways=new e.PaymentGateways(s(this,t,"f")),this.payment_methods=new e.PaymentMethods(s(this,t,"f")),this.paypal_gateways=new e.PaypalGateways(s(this,t,"f")),this.paypal_payments=new e.PaypalPayments(s(this,t,"f")),this.percentage_discount_promotions=new e.PercentageDiscountPromotions(s(this,t,"f")),this.price_lists=new e.PriceLists(s(this,t,"f")),this.prices=new e.Prices(s(this,t,"f")),this.promotion_rules=new e.PromotionRules(s(this,t,"f")),this.promotions=new e.Promotions(s(this,t,"f")),this.refunds=new e.Refunds(s(this,t,"f")),this.return_line_items=new e.ReturnLineItems(s(this,t,"f")),this.returns=new e.Returns(s(this,t,"f")),this.shipments=new e.Shipments(s(this,t,"f")),this.shipping_categories=new e.ShippingCategories(s(this,t,"f")),this.shipping_methods=new e.ShippingMethods(s(this,t,"f")),this.shipping_zones=new e.ShippingZones(s(this,t,"f")),this.sku_list_items=new e.SkuListItems(s(this,t,"f")),this.sku_list_promotion_rules=new e.SkuListPromotionRules(s(this,t,"f")),this.sku_lists=new e.SkuLists(s(this,t,"f")),this.sku_options=new e.SkuOptions(s(this,t,"f")),this.skus=new e.Skus(s(this,t,"f")),this.stock_items=new e.StockItems(s(this,t,"f")),this.stock_line_items=new e.StockLineItems(s(this,t,"f")),this.stock_locations=new e.StockLocations(s(this,t,"f")),this.stock_transfers=new e.StockTransfers(s(this,t,"f")),this.stripe_gateways=new e.StripeGateways(s(this,t,"f")),this.stripe_payments=new e.StripePayments(s(this,t,"f")),this.tax_calculators=new e.TaxCalculators(s(this,t,"f")),this.tax_categories=new e.TaxCategories(s(this,t,"f")),this.tax_rules=new e.TaxRules(s(this,t,"f")),this.taxjar_accounts=new e.TaxjarAccounts(s(this,t,"f")),this.transactions=new e.Transactions(s(this,t,"f")),this.voids=new e.Voids(s(this,t,"f")),this.webhooks=new e.Webhooks(s(this,t,"f")),this.wire_transfers=new e.WireTransfers(s(this,t,"f"))}static get openApiSchemaVersion(){return p}get currentOrganization(){return s(this,h,"f")}config(i){i.organization&&c(this,h,i.organization,"f"),s(this,t,"f").config(i)}resources(){return w.resources()}isApiError(i){return w.isApiError(i)}addRequestInterceptor(i,n){return s(this,t,"f").interceptors.request.use(i,n)}addResponseInterceptor(i,n){return s(this,t,"f").interceptors.response.use(i,n)}removeInterceptor(i,n){return s(this,t,"f").interceptors[i].eject(n)}addRawResponseReader(){const i={id:void 0,rawResponse:void 0};function n(a){return i.rawResponse=a?.data,a}const r=this.addResponseInterceptor(n);return i.id=r,i}removeRawResponseReader(i){const n=typeof i=="number"?i:i.id;if(n)return this.removeInterceptor("response",n)}}t=new WeakMap,h=new WeakMap;const m=o=>new u(o);export default m;
|
package/lib/esm/model.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* ©2022 Commerce Layer Inc.
|
3
|
-
* OpenAPI schema, version 2.9.
|
3
|
+
* OpenAPI schema, version 2.9.2
|
4
4
|
**/
|
5
5
|
export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
|
6
6
|
export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
|
package/lib/esm/resource.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var w=this&&this.__classPrivateFieldSet||function(s,t,a,e,r){if(e==="m")throw new TypeError("Private method is not writable");if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!r:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e==="a"?r.call(s,a):r?r.value=a:t.set(s,a),a},d=this&&this.__classPrivateFieldGet||function(s,t,a,e){if(a==="a"&&!e)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!e:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?e:a==="a"?e.call(s):e?e.value:t.get(s)},n,h;import y from"./client";import{denormalize as u,normalize as g}from"./jsonapi";import{generateQueryStringParams as o}from"./query";import m from"./config";class b extends Array{constructor(t,a){super(...a||[]);this.meta=t}first(){return this.length?this[0]:void 0}last(){return this.length?this[this.length-1]:void 0}get(t){return this.length&&t>=0?this[t]:void 0}}class p{constructor(t){n.set(this,void 0),h.set(this,{}),w(this,n,y.create(t),"f"),this.config(t)}get interceptors(){return d(this,n,"f").interceptors}config(t){d(this,n,"f").config(t)}async singleton(t,a,e){const r=o(a,t);
|
1
|
+
var w=this&&this.__classPrivateFieldSet||function(s,t,a,e,r){if(e==="m")throw new TypeError("Private method is not writable");if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!r:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e==="a"?r.call(s,a):r?r.value=a:t.set(s,a),a},d=this&&this.__classPrivateFieldGet||function(s,t,a,e){if(a==="a"&&!e)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!e:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?e:a==="a"?e.call(s):e?e.value:t.get(s)},n,h;import y from"./client";import{denormalize as u,normalize as g}from"./jsonapi";import{generateQueryStringParams as o}from"./query";import m from"./config";class b extends Array{constructor(t,a){super(...a||[]);this.meta=t}first(){return this.length?this[0]:void 0}last(){return this.length?this[this.length-1]:void 0}get(t){return this.length&&t>=0?this[t]:void 0}}class p{constructor(t){n.set(this,void 0),h.set(this,{}),w(this,n,y.create(t),"f"),this.config(t)}get interceptors(){return d(this,n,"f").interceptors}config(t){d(this,n,"f").config(t)}async singleton(t,a,e){const r=o(a,t);e?.params&&Object.assign(r,e?.params);const i=await d(this,n,"f").request("get",`${t.type}`,void 0,Object.assign(Object.assign({},e),{params:r}));return u(i)}async retrieve(t,a,e){const r=o(a,t);e?.params&&Object.assign(r,e?.params);const i=await d(this,n,"f").request("get",`${t.type}/${t.id}`,void 0,Object.assign(Object.assign({},e),{params:r}));return u(i)}async list(t,a,e){var r,i;const c=o(a,t);e?.params&&Object.assign(c,e?.params);const l=await d(this,n,"f").request("get",`${t.type}`,void 0,Object.assign(Object.assign({},e),{params:c})),f=u(l),v={pageCount:Number((r=l.meta)===null||r===void 0?void 0:r.page_count),recordCount:Number((i=l.meta)===null||i===void 0?void 0:i.record_count),currentPage:a?.pageNumber||m.default.pageNumber,recordsPerPage:a?.pageSize||m.default.pageSize};return new b(v,f)}async create(t,a,e){const r=o(a,t);e?.params&&Object.assign(r,e?.params);const i=g(t),c=await d(this,n,"f").request("post",t.type,i,Object.assign(Object.assign({},e),{params:r}));return u(c)}async update(t,a,e){const r=o(a,t);e?.params&&Object.assign(r,e?.params);const i=g(t),c=await d(this,n,"f").request("patch",`${t.type}/${t.id}`,i,Object.assign(Object.assign({},e),{params:r}));return u(c)}async delete(t,a){await d(this,n,"f").request("delete",`${t.type}/${t.id}`,void 0,a)}}n=new WeakMap,h=new WeakMap;class j{constructor(t){this.resources=t}}export default p;export{j as ApiResource};
|
@@ -13,6 +13,10 @@ interface KlarnaPayment extends Resource {
|
|
13
13
|
client_token?: string;
|
14
14
|
payment_methods?: object[];
|
15
15
|
auth_token?: string;
|
16
|
+
mismatched_amounts?: boolean;
|
17
|
+
intent_amount_cents?: number;
|
18
|
+
intent_amount_float?: number;
|
19
|
+
formatted_intent_amount?: string;
|
16
20
|
order?: Order;
|
17
21
|
payment_gateway?: PaymentGateway;
|
18
22
|
}
|
@@ -224,6 +224,7 @@ interface OrderUpdate extends ResourceUpdate {
|
|
224
224
|
_capture?: boolean;
|
225
225
|
_refund?: boolean;
|
226
226
|
_update_taxes?: boolean;
|
227
|
+
_nullify_payment_source?: boolean;
|
227
228
|
_billing_address_clone_id?: string;
|
228
229
|
_shipping_address_clone_id?: string;
|
229
230
|
_customer_payment_source_id?: string;
|
package/lib/esm/util.d.ts
CHANGED
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 a=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(a("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(o=>r(d(o,s),s)):i[n]=r(d(t,s),s):t===null&&(i[n]=null)}),a("denormalized resource: %O",i),i},y=e=>{a("normalize resource: %O",e);const s={},i={};for(const t in e){if(["type","id"].includes(t))continue;const o=e[t];o&&c(o)&&o.id===null?i[t]={data:null}:o&&(l(o)||Array.isArray(o)&&l(o[0]))?i[t]={data:o}:s[t]=o}const n={type:e.type,attributes:s,relationships:i};return l(e)&&(n.id=e.id),a("normalized resource: %O",n),n};export{p as denormalize,y as normalize};
|
package/lib/query.d.ts
CHANGED
@@ -1 +1 @@
|
|
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:ResourceType)=>{[key:string]:string;};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 +1 @@
|
|
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: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};
|
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 +1 @@
|
|
1
|
-
import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import{QueryParamsList,QueryParamsRetrieve}from'../query';import{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,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
|
+
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 +1 @@
|
|
1
|
-
import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import{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
|
+
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;
|
@@ -1 +1 @@
|
|
1
|
-
import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import{QueryParamsList,QueryParamsRetrieve}from'../query';import{PaymentMethod}from'./payment_methods';import{AdyenPayment}from'./adyen_payments';declare type AdyenGatewayRel=ResourceRel&{type:typeof AdyenGateways.TYPE;};declare type AdyenPaymentRel=ResourceRel&{type:'adyen_payments';};interface AdyenGateway extends Resource{name?:string;live_url_prefix?:string;payment_methods?:PaymentMethod[];adyen_payments?:AdyenPayment[];}interface AdyenGatewayCreate extends ResourceCreate{name:string;merchant_account:string;api_key:string;public_key?:string;live_url_prefix:string;adyen_payments?:AdyenPaymentRel[];}interface AdyenGatewayUpdate extends ResourceUpdate{name?:string;merchant_account?:string;api_key?:string;public_key?:string;live_url_prefix?:string;adyen_payments?:AdyenPaymentRel[];}declare class AdyenGateways extends ApiResource{static readonly TYPE:'adyen_gateways';list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<AdyenGateway>>;create(resource:AdyenGatewayCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenGateway>;retrieve(id:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenGateway>;update(resource:AdyenGatewayUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenGateway>;delete(id:string,options?:ResourcesConfig):Promise<void>;payment_methods(adyenGatewayId:string,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<PaymentMethod>>;adyen_payments(adyenGatewayId:string,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<AdyenPayment>>;isAdyenGateway(resource:any):resource is AdyenGateway;relationship(id:string|ResourceId|null):AdyenGatewayRel;type():string;}export default AdyenGateways;export{AdyenGateway,AdyenGatewayCreate,AdyenGatewayUpdate};
|
1
|
+
import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import type{QueryParamsList,QueryParamsRetrieve}from'../query';import type{PaymentMethod}from'./payment_methods';import type{AdyenPayment}from'./adyen_payments';declare type AdyenGatewayRel=ResourceRel&{type:typeof AdyenGateways.TYPE;};declare type AdyenPaymentRel=ResourceRel&{type:'adyen_payments';};interface AdyenGateway extends Resource{name?:string;live_url_prefix?:string;payment_methods?:PaymentMethod[];adyen_payments?:AdyenPayment[];}interface AdyenGatewayCreate extends ResourceCreate{name:string;merchant_account:string;api_key:string;public_key?:string;live_url_prefix:string;adyen_payments?:AdyenPaymentRel[];}interface AdyenGatewayUpdate extends ResourceUpdate{name?:string;merchant_account?:string;api_key?:string;public_key?:string;live_url_prefix?:string;adyen_payments?:AdyenPaymentRel[];}declare class AdyenGateways extends ApiResource{static readonly TYPE:'adyen_gateways';list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<AdyenGateway>>;create(resource:AdyenGatewayCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenGateway>;retrieve(id:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenGateway>;update(resource:AdyenGatewayUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenGateway>;delete(id:string,options?:ResourcesConfig):Promise<void>;payment_methods(adyenGatewayId:string|AdyenGateway,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<PaymentMethod>>;adyen_payments(adyenGatewayId:string|AdyenGateway,params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<AdyenPayment>>;isAdyenGateway(resource:any):resource is AdyenGateway;relationship(id:string|ResourceId|null):AdyenGatewayRel;type():string;}export default AdyenGateways;export{AdyenGateway,AdyenGatewayCreate,AdyenGatewayUpdate};
|
@@ -1 +1 @@
|
|
1
|
-
import{ApiResource as
|
1
|
+
import{ApiResource as a}from"../resource";class r extends a{static TYPE="adyen_gateways";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 payment_methods(e,t,s){const y=e.id||e;return this.resources.fetch({type:"payment_methods"},`adyen_gateways/${y}/payment_methods`,t,s)}async adyen_payments(e,t,s){const y=e.id||e;return this.resources.fetch({type:"adyen_payments"},`adyen_gateways/${y}/adyen_payments`,t,s)}isAdyenGateway(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 +1 @@
|
|
1
|
-
import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import{QueryParamsList,QueryParamsRetrieve}from'../query';import{Order}from'./orders';import{PaymentGateway}from'./payment_gateways';declare type AdyenPaymentRel=ResourceRel&{type:typeof AdyenPayments.TYPE;};declare type OrderRel=ResourceRel&{type:'orders';};interface AdyenPayment extends Resource{public_key?:string;payment_methods?:object;payment_request_data?:object;payment_request_details?:object;payment_response?:object;order?:Order;payment_gateway?:PaymentGateway;}interface AdyenPaymentCreate extends ResourceCreate{order:OrderRel;}interface AdyenPaymentUpdate extends ResourceUpdate{payment_request_data?:object;payment_request_details?:object;payment_response?:object;_details?:boolean;order?:OrderRel;}declare class AdyenPayments extends ApiResource{static readonly TYPE:'adyen_payments';list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<AdyenPayment>>;create(resource:AdyenPaymentCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenPayment>;retrieve(id:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenPayment>;update(resource:AdyenPaymentUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenPayment>;delete(id:string,options?:ResourcesConfig):Promise<void>;order(adyenPaymentId:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Order>;payment_gateway(adyenPaymentId:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<PaymentGateway>;isAdyenPayment(resource:any):resource is AdyenPayment;relationship(id:string|ResourceId|null):AdyenPaymentRel;type():string;}export default AdyenPayments;export{AdyenPayment,AdyenPaymentCreate,AdyenPaymentUpdate};
|
1
|
+
import{ApiResource,Resource,ResourceCreate,ResourceUpdate,ResourcesConfig,ResourceId,ResourceRel,ListResponse}from'../resource';import type{QueryParamsList,QueryParamsRetrieve}from'../query';import type{Order}from'./orders';import type{PaymentGateway}from'./payment_gateways';declare type AdyenPaymentRel=ResourceRel&{type:typeof AdyenPayments.TYPE;};declare type OrderRel=ResourceRel&{type:'orders';};interface AdyenPayment extends Resource{public_key?:string;payment_methods?:object;payment_request_data?:object;payment_request_details?:object;payment_response?:object;mismatched_amounts?:boolean;order?:Order;payment_gateway?:PaymentGateway;}interface AdyenPaymentCreate extends ResourceCreate{order:OrderRel;}interface AdyenPaymentUpdate extends ResourceUpdate{payment_request_data?:object;payment_request_details?:object;payment_response?:object;_details?:boolean;order?:OrderRel;}declare class AdyenPayments extends ApiResource{static readonly TYPE:'adyen_payments';list(params?:QueryParamsList,options?:ResourcesConfig):Promise<ListResponse<AdyenPayment>>;create(resource:AdyenPaymentCreate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenPayment>;retrieve(id:string,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenPayment>;update(resource:AdyenPaymentUpdate,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<AdyenPayment>;delete(id:string,options?:ResourcesConfig):Promise<void>;order(adyenPaymentId:string|AdyenPayment,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Order>;payment_gateway(adyenPaymentId:string|AdyenPayment,params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<PaymentGateway>;isAdyenPayment(resource:any):resource is AdyenPayment;relationship(id:string|ResourceId|null):AdyenPaymentRel;type():string;}export default AdyenPayments;export{AdyenPayment,AdyenPaymentCreate,AdyenPaymentUpdate};
|
@@ -1 +1 @@
|
|
1
|
-
import{ApiResource as y}from"../resource";class r extends y{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 order(e,t,s){return this.resources.fetch({type:"orders"},`adyen_payments/${
|
1
|
+
import{ApiResource as y}from"../resource";class r extends y{static TYPE="adyen_payments";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 order(e,t,s){const a=e.id||e;return this.resources.fetch({type:"orders"},`adyen_payments/${a}/order`,t,s)}async payment_gateway(e,t,s){const a=e.id||e;return this.resources.fetch({type:"payment_gateways"},`adyen_payments/${a}/payment_gateway`,t,s)}isAdyenPayment(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 +1 @@
|
|
1
|
-
import{ApiResource,Resource,ResourcesConfig,ResourceId,ResourceRel}from'../resource';import{QueryParamsRetrieve}from'../query';declare type ApplicationRel=ResourceRel&{type:typeof Applications.TYPE;};interface Application extends Resource{name?:string;kind?:string;public_access?:string;redirect_uri?:string;scopes?:string;}declare class Applications extends ApiResource{static readonly TYPE:'application';retrieve(params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Application>;isApplication(resource:any):resource is Application;relationship(id:string|ResourceId|null):ApplicationRel;type():string;}export default Applications;export{Application};
|
1
|
+
import{ApiResource,Resource,ResourcesConfig,ResourceId,ResourceRel}from'../resource';import type{QueryParamsRetrieve}from'../query';declare type ApplicationRel=ResourceRel&{type:typeof Applications.TYPE;};interface Application extends Resource{name?:string;kind?:string;public_access?:string;redirect_uri?:string;scopes?:string;}declare class Applications extends ApiResource{static readonly TYPE:'application';retrieve(params?:QueryParamsRetrieve,options?:ResourcesConfig):Promise<Application>;isApplication(resource:any):resource is Application;relationship(id:string|ResourceId|null):ApplicationRel;type():string;}export default Applications;export{Application};
|
@@ -1 +1 @@
|
|
1
|
-
import{ApiResource as
|
1
|
+
import{ApiResource as r}from"../resource";class t extends r{static TYPE="application";async retrieve(e,i){return this.resources.singleton({type:t.TYPE},e,i)}isApplication(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;
|