@commercelayer/sdk 6.0.0-alfa.4 → 6.0.0-alfa.6
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 +0 -3
- package/lib/cjs/api.js +0 -10
- package/lib/cjs/client.d.ts +6 -14
- package/lib/cjs/client.js +39 -73
- package/lib/cjs/commercelayer.d.ts +126 -125
- package/lib/cjs/commercelayer.js +267 -155
- package/lib/cjs/common.js +0 -11
- package/lib/cjs/config.js +0 -2
- package/lib/cjs/debug.js +0 -21
- package/lib/cjs/error.d.ts +6 -7
- package/lib/cjs/error.js +35 -33
- package/lib/cjs/fetch.d.ts +13 -0
- package/lib/cjs/fetch.js +67 -0
- package/lib/cjs/index.js +0 -2
- package/lib/cjs/interceptor.d.ts +24 -12
- package/lib/cjs/jsonapi.js +0 -2
- package/lib/cjs/model.d.ts +0 -3
- package/lib/cjs/model.js +0 -1
- package/lib/cjs/query.d.ts +2 -1
- package/lib/cjs/query.js +8 -7
- package/lib/cjs/resource.d.ts +0 -5
- package/lib/cjs/resource.js +7 -36
- package/lib/cjs/static.js +0 -1
- package/lib/cjs/util.js +0 -1
- package/lib/esm/api.d.ts +0 -3
- package/lib/esm/api.js +0 -10
- package/lib/esm/client.d.ts +6 -14
- package/lib/esm/client.js +37 -73
- package/lib/esm/commercelayer.d.ts +126 -125
- package/lib/esm/commercelayer.js +265 -277
- package/lib/esm/common.js +0 -11
- package/lib/esm/config.js +0 -2
- package/lib/esm/debug.js +0 -21
- package/lib/esm/error.d.ts +6 -7
- package/lib/esm/error.js +35 -31
- package/lib/esm/fetch.d.ts +13 -0
- package/lib/esm/fetch.js +46 -0
- package/lib/esm/index.js +0 -2
- package/lib/esm/interceptor.d.ts +24 -12
- package/lib/esm/jsonapi.js +0 -2
- package/lib/esm/model.d.ts +0 -3
- package/lib/esm/model.js +0 -1
- package/lib/esm/query.d.ts +2 -1
- package/lib/esm/query.js +7 -7
- package/lib/esm/resource.d.ts +0 -5
- package/lib/esm/resource.js +7 -36
- package/lib/esm/static.js +0 -1
- package/lib/esm/util.js +1 -27
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -13
package/lib/cjs/api.d.ts
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
import type { Resource, ResourceRel } from './resource';
|
2
2
|
import type { TagType } from './resources/tags';
|
3
3
|
import type { VersionType } from './resources/versions';
|
4
|
-
/**
|
5
|
-
* ©2024 Commerce Layer Inc.
|
6
|
-
**/
|
7
4
|
export { default as Addresses } from './resources/addresses';
|
8
5
|
export { default as Adjustments } from './resources/adjustments';
|
9
6
|
export { default as AdyenGateways } from './resources/adyen_gateways';
|
package/lib/cjs/api.js
CHANGED
@@ -6,11 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.InventoryModels = exports.InStockSubscriptions = exports.Imports = exports.GoogleGeocoders = exports.GiftCards = exports.GiftCardRecipients = exports.Geocoders = exports.FreeShippingPromotions = exports.FreeGiftPromotions = exports.FixedPricePromotions = exports.FixedAmountPromotions = exports.ExternalTaxCalculators = exports.ExternalPromotions = exports.ExternalPayments = exports.ExternalGateways = exports.Exports = exports.Events = exports.EventCallbacks = exports.DeliveryLeadTimes = exports.Customers = exports.CustomerSubscriptions = exports.CustomerPaymentSources = exports.CustomerPasswordResets = exports.CustomerGroups = exports.CustomerAddresses = exports.CustomPromotionRules = exports.Coupons = exports.CouponRecipients = exports.CouponCodesPromotionRules = exports.Cleanups = exports.CheckoutComPayments = exports.CheckoutComGateways = exports.CarrierAccounts = exports.Captures = exports.BuyXPayYPromotions = exports.Bundles = exports.BraintreePayments = exports.BraintreeGateways = exports.BingGeocoders = exports.BillingInfoValidationRules = exports.AxervePayments = exports.AxerveGateways = exports.AvalaraAccounts = exports.Authorizations = exports.Attachments = exports.Applications = exports.AdyenPayments = exports.AdyenGateways = exports.Adjustments = exports.Addresses = void 0;
|
7
7
|
exports.SkuListPromotionRules = exports.SkuListItems = exports.ShippingZones = exports.ShippingWeightTiers = exports.ShippingMethods = exports.ShippingMethodTiers = exports.ShippingCategories = exports.Shipments = exports.SatispayPayments = exports.SatispayGateways = exports.Returns = exports.ReturnLineItems = exports.ResourceErrors = exports.ReservedStocks = exports.Refunds = exports.RecurringOrderCopies = exports.Promotions = exports.PromotionRules = exports.Prices = exports.PriceVolumeTiers = exports.PriceTiers = exports.PriceLists = exports.PriceFrequencyTiers = exports.PercentageDiscountPromotions = exports.PaypalPayments = exports.PaypalGateways = exports.PaymentOptions = exports.PaymentMethods = exports.PaymentGateways = exports.Parcels = exports.ParcelLineItems = exports.Packages = exports.Organizations = exports.Orders = exports.OrderValidationRules = exports.OrderSubscriptions = exports.OrderSubscriptionItems = exports.OrderFactories = exports.OrderCopies = exports.OrderAmountPromotionRules = exports.Merchants = exports.Markets = exports.ManualTaxCalculators = exports.ManualGateways = exports.LineItems = exports.LineItemOptions = exports.KlarnaPayments = exports.KlarnaGateways = exports.InventoryStockLocations = exports.InventoryReturnLocations = void 0;
|
8
8
|
exports.singletonList = exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids = exports.Versions = exports.Transactions = exports.TaxjarAccounts = exports.TaxRules = exports.TaxCategories = exports.TaxCalculators = exports.Tags = exports.SubscriptionModels = exports.StripePayments = exports.StripeGateways = exports.StockTransfers = exports.StockReservations = exports.StockLocations = exports.StockLineItems = exports.StockItems = exports.Skus = exports.SkuOptions = exports.SkuLists = void 0;
|
9
|
-
// ##__API_RESOURCES_START__##
|
10
|
-
// ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
|
11
|
-
/**
|
12
|
-
* ©2024 Commerce Layer Inc.
|
13
|
-
**/
|
14
9
|
var addresses_1 = require("./resources/addresses");
|
15
10
|
Object.defineProperty(exports, "Addresses", { enumerable: true, get: function () { return __importDefault(addresses_1).default; } });
|
16
11
|
var adjustments_1 = require("./resources/adjustments");
|
@@ -253,9 +248,7 @@ var webhooks_1 = require("./resources/webhooks");
|
|
253
248
|
Object.defineProperty(exports, "Webhooks", { enumerable: true, get: function () { return __importDefault(webhooks_1).default; } });
|
254
249
|
var wire_transfers_1 = require("./resources/wire_transfers");
|
255
250
|
Object.defineProperty(exports, "WireTransfers", { enumerable: true, get: function () { return __importDefault(wire_transfers_1).default; } });
|
256
|
-
// ##__API_RESOURCE_TYPES_STOP__##
|
257
251
|
exports.resourceList = [
|
258
|
-
// ##__API_RESOURCE_LIST_START__##
|
259
252
|
'addresses',
|
260
253
|
'adjustments',
|
261
254
|
'adyen_gateways',
|
@@ -377,11 +370,8 @@ exports.resourceList = [
|
|
377
370
|
'voids',
|
378
371
|
'webhooks',
|
379
372
|
'wire_transfers'
|
380
|
-
// ##__API_RESOURCE_LIST_STOP__##
|
381
373
|
];
|
382
374
|
exports.singletonList = [
|
383
|
-
// ##__API_RESOURCE_SINGLETON_START__##
|
384
375
|
'application',
|
385
376
|
'organization'
|
386
|
-
// ##__API_RESOURCE_SINGLETON_STOP__##
|
387
377
|
];
|
package/lib/cjs/client.d.ts
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
import type { AxiosAdapter, AxiosProxyConfig, Method } from 'axios';
|
2
1
|
import type { InterceptorManager } from './interceptor';
|
3
|
-
type
|
4
|
-
type Adapter = AxiosAdapter;
|
2
|
+
import { type FetchResponse } from './fetch';
|
5
3
|
type RequestParams = Record<string, string | number | boolean>;
|
6
4
|
type RequestHeaders = Record<string, string>;
|
7
5
|
type RequestConfig = {
|
8
6
|
timeout?: number;
|
9
7
|
params?: RequestParams;
|
10
|
-
httpAgent?: any;
|
11
|
-
httpsAgent?: any;
|
12
|
-
proxy?: ProxyConfig;
|
13
8
|
headers?: RequestHeaders;
|
14
|
-
};
|
15
|
-
type RequestConfigExtra = {
|
16
|
-
adapter?: Adapter;
|
17
9
|
userAgent?: string;
|
18
10
|
};
|
19
11
|
type ApiConfig = {
|
@@ -21,18 +13,18 @@ type ApiConfig = {
|
|
21
13
|
domain?: string;
|
22
14
|
accessToken: string;
|
23
15
|
};
|
24
|
-
type ApiClientInitConfig = ApiConfig & RequestConfig
|
16
|
+
type ApiClientInitConfig = ApiConfig & RequestConfig;
|
25
17
|
type ApiClientConfig = Partial<ApiClientInitConfig>;
|
18
|
+
export type Method = 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH';
|
26
19
|
declare class ApiClient {
|
27
20
|
#private;
|
28
21
|
static create(options: ApiClientInitConfig): ApiClient;
|
29
|
-
baseUrl: string;
|
30
|
-
interceptors: InterceptorManager;
|
31
22
|
private constructor();
|
23
|
+
get interceptors(): InterceptorManager;
|
24
|
+
get requestHeaders(): RequestHeaders;
|
32
25
|
config(config: ApiClientConfig): ApiClient;
|
33
26
|
userAgent(userAgent: string): ApiClient;
|
34
|
-
|
35
|
-
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
|
27
|
+
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<FetchResponse>;
|
36
28
|
private customHeaders;
|
37
29
|
}
|
38
30
|
export default ApiClient;
|
package/lib/cjs/client.js
CHANGED
@@ -13,14 +13,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
15
|
};
|
16
|
-
var _ApiClient_accessToken,
|
16
|
+
var _ApiClient_baseUrl, _ApiClient_accessToken, _ApiClient_clientConfig, _ApiClient_interceptors;
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
const axios_1 = __importDefault(require("axios"));
|
19
18
|
const error_1 = require("./error");
|
20
19
|
const config_1 = __importDefault(require("./config"));
|
21
|
-
|
22
|
-
// import type { Agent as HttpsAgent } from 'https'
|
23
|
-
// import { packageInfo } from './util'
|
20
|
+
const fetch_1 = require("./fetch");
|
24
21
|
const debug_1 = __importDefault(require("./debug"));
|
25
22
|
const debug = (0, debug_1.default)('client');
|
26
23
|
const baseURL = (organization, domain) => {
|
@@ -34,111 +31,80 @@ class ApiClient {
|
|
34
31
|
return new ApiClient(options);
|
35
32
|
}
|
36
33
|
constructor(options) {
|
34
|
+
_ApiClient_baseUrl.set(this, void 0);
|
37
35
|
_ApiClient_accessToken.set(this, void 0);
|
38
|
-
|
36
|
+
_ApiClient_clientConfig.set(this, void 0);
|
37
|
+
_ApiClient_interceptors.set(this, void 0);
|
39
38
|
debug('new client instance %O', options);
|
40
|
-
this
|
39
|
+
__classPrivateFieldSet(this, _ApiClient_baseUrl, baseURL(options.organization, options.domain), "f");
|
41
40
|
__classPrivateFieldSet(this, _ApiClient_accessToken, options.accessToken, "f");
|
42
|
-
const
|
41
|
+
const fetchConfig = {
|
43
42
|
timeout: options.timeout || config_1.default.client.timeout,
|
44
|
-
proxy: options.proxy,
|
45
|
-
httpAgent: options.httpAgent,
|
46
|
-
httpsAgent: options.httpsAgent
|
47
43
|
};
|
48
|
-
// Set custom headers
|
49
44
|
const customHeaders = this.customHeaders(options.headers);
|
50
|
-
// Set headers
|
51
45
|
const headers = {
|
52
46
|
...customHeaders,
|
53
47
|
'Accept': 'application/vnd.api+json',
|
54
48
|
'Content-Type': 'application/vnd.api+json',
|
55
49
|
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
56
50
|
};
|
57
|
-
|
58
|
-
|
59
|
-
if (userAgent) {
|
60
|
-
if (!userAgent.includes('axios/'))
|
61
|
-
userAgent += ` axios/${axios_1.default.VERSION}`;
|
51
|
+
const userAgent = options.userAgent;
|
52
|
+
if (userAgent)
|
62
53
|
headers['User-Agent'] = userAgent;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
if (
|
71
|
-
|
72
|
-
|
73
|
-
__classPrivateFieldSet(this, _ApiClient_client, axios_1.default.create(axiosOptions), "f");
|
74
|
-
this.interceptors = __classPrivateFieldGet(this, _ApiClient_client, "f").interceptors;
|
54
|
+
fetchConfig.headers = headers;
|
55
|
+
__classPrivateFieldSet(this, _ApiClient_clientConfig, fetchConfig, "f");
|
56
|
+
debug('fetch config: %O', fetchConfig);
|
57
|
+
__classPrivateFieldSet(this, _ApiClient_interceptors, {}, "f");
|
58
|
+
}
|
59
|
+
get interceptors() { return __classPrivateFieldGet(this, _ApiClient_interceptors, "f"); }
|
60
|
+
get requestHeaders() {
|
61
|
+
if (!__classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers)
|
62
|
+
__classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers = {};
|
63
|
+
return __classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers;
|
75
64
|
}
|
76
65
|
config(config) {
|
77
66
|
debug('config %o', config);
|
78
|
-
const def = __classPrivateFieldGet(this,
|
79
|
-
|
67
|
+
const def = __classPrivateFieldGet(this, _ApiClient_clientConfig, "f");
|
68
|
+
if (!def.headers)
|
69
|
+
def.headers = {};
|
80
70
|
if (config.timeout)
|
81
71
|
def.timeout = config.timeout;
|
82
|
-
if (config.proxy)
|
83
|
-
def.proxy = config.proxy;
|
84
|
-
if (config.httpAgent)
|
85
|
-
def.httpAgent = config.httpAgent;
|
86
|
-
if (config.httpsAgent)
|
87
|
-
def.httpsAgent = config.httpsAgent;
|
88
|
-
if (config.adapter)
|
89
|
-
this.adapter(config.adapter);
|
90
72
|
if (config.userAgent)
|
91
73
|
this.userAgent(config.userAgent);
|
92
|
-
// API Client config
|
93
74
|
if (config.organization)
|
94
|
-
this
|
75
|
+
__classPrivateFieldSet(this, _ApiClient_baseUrl, baseURL(config.organization, config.domain), "f");
|
95
76
|
if (config.accessToken) {
|
96
77
|
__classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
|
97
|
-
def.headers.
|
78
|
+
def.headers.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
98
79
|
}
|
99
80
|
if (config.headers)
|
100
|
-
def.headers
|
81
|
+
def.headers = { ...def.headers, ...this.customHeaders(config.headers) };
|
101
82
|
return this;
|
102
83
|
}
|
103
84
|
userAgent(userAgent) {
|
104
|
-
if (userAgent)
|
105
|
-
|
106
|
-
if (!ua.includes('axios/')) {
|
107
|
-
// const axiosVer = packageInfo(['dependencies.axios'], { nestedName: true })
|
108
|
-
if (axios_1.default.VERSION)
|
109
|
-
ua += ` axios/${axios_1.default.VERSION}`;
|
110
|
-
}
|
111
|
-
__classPrivateFieldGet(this, _ApiClient_client, "f").defaults.headers['User-Agent'] = ua;
|
112
|
-
}
|
113
|
-
return this;
|
114
|
-
}
|
115
|
-
adapter(adapter) {
|
116
|
-
if (adapter)
|
117
|
-
__classPrivateFieldGet(this, _ApiClient_client, "f").defaults.adapter = adapter;
|
85
|
+
if (userAgent)
|
86
|
+
this.requestHeaders['User-Agent'] = userAgent;
|
118
87
|
return this;
|
119
88
|
}
|
120
89
|
async request(method, path, body, options) {
|
121
90
|
debug('request %s %s, %O, %O', method, path, body || {}, options || {});
|
122
|
-
// Ignored params alerts (in debug mode)
|
123
|
-
if (options?.adapter)
|
124
|
-
debug('Adapter ignored in request config');
|
125
91
|
if (options?.userAgent)
|
126
92
|
debug('User-Agent header ignored in request config');
|
127
|
-
const
|
128
|
-
const url = path;
|
129
|
-
|
130
|
-
const
|
93
|
+
const baseUrl = options?.organization ? baseURL(options.organization, options.domain) : __classPrivateFieldGet(this, _ApiClient_baseUrl, "f");
|
94
|
+
const url = new URL(`${baseUrl}/${path}`);
|
95
|
+
const bodyData = body ? JSON.stringify({ data: body }) : undefined;
|
96
|
+
const headers = { ...this.requestHeaders, ...this.customHeaders(options?.headers) };
|
131
97
|
const accessToken = options?.accessToken || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
132
|
-
const headers = this.customHeaders(options?.headers);
|
133
98
|
if (accessToken)
|
134
99
|
headers.Authorization = 'Bearer ' + accessToken;
|
135
|
-
const
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
100
|
+
const fetchOptions = { method, body: bodyData, headers };
|
101
|
+
const timeout = options?.timeout || __classPrivateFieldGet(this, _ApiClient_clientConfig, "f").timeout;
|
102
|
+
if (timeout)
|
103
|
+
fetchOptions.signal = AbortSignal.timeout(timeout);
|
104
|
+
if (options?.params)
|
105
|
+
Object.entries(options?.params).forEach(([name, value]) => { url.searchParams.append(name, String(value)); });
|
106
|
+
return await (0, fetch_1.fetchURL)(url, fetchOptions, this.interceptors)
|
140
107
|
.catch((error) => (0, error_1.handleError)(error));
|
141
|
-
// .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
|
142
108
|
}
|
143
109
|
customHeaders(headers) {
|
144
110
|
const customHeaders = {};
|
@@ -150,5 +116,5 @@ class ApiClient {
|
|
150
116
|
return customHeaders;
|
151
117
|
}
|
152
118
|
}
|
153
|
-
_ApiClient_accessToken = new WeakMap(),
|
119
|
+
_ApiClient_baseUrl = new WeakMap(), _ApiClient_accessToken = new WeakMap(), _ApiClient_clientConfig = new WeakMap(), _ApiClient_interceptors = new WeakMap();
|
154
120
|
exports.default = ApiClient;
|
@@ -10,142 +10,143 @@ type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
|
|
10
10
|
declare class CommerceLayerClient {
|
11
11
|
#private;
|
12
12
|
readonly openApiSchemaVersion = "5.1.0";
|
13
|
-
addresses: api.Addresses;
|
14
|
-
adjustments: api.Adjustments;
|
15
|
-
adyen_gateways: api.AdyenGateways;
|
16
|
-
adyen_payments: api.AdyenPayments;
|
17
|
-
application: api.Applications;
|
18
|
-
attachments: api.Attachments;
|
19
|
-
authorizations: api.Authorizations;
|
20
|
-
avalara_accounts: api.AvalaraAccounts;
|
21
|
-
axerve_gateways: api.AxerveGateways;
|
22
|
-
axerve_payments: api.AxervePayments;
|
23
|
-
billing_info_validation_rules: api.BillingInfoValidationRules;
|
24
|
-
bing_geocoders: api.BingGeocoders;
|
25
|
-
braintree_gateways: api.BraintreeGateways;
|
26
|
-
braintree_payments: api.BraintreePayments;
|
27
|
-
bundles: api.Bundles;
|
28
|
-
buy_x_pay_y_promotions: api.BuyXPayYPromotions;
|
29
|
-
captures: api.Captures;
|
30
|
-
carrier_accounts: api.CarrierAccounts;
|
31
|
-
checkout_com_gateways: api.CheckoutComGateways;
|
32
|
-
checkout_com_payments: api.CheckoutComPayments;
|
33
|
-
cleanups: api.Cleanups;
|
34
|
-
coupon_codes_promotion_rules: api.CouponCodesPromotionRules;
|
35
|
-
coupon_recipients: api.CouponRecipients;
|
36
|
-
coupons: api.Coupons;
|
37
|
-
custom_promotion_rules: api.CustomPromotionRules;
|
38
|
-
customer_addresses: api.CustomerAddresses;
|
39
|
-
customer_groups: api.CustomerGroups;
|
40
|
-
customer_password_resets: api.CustomerPasswordResets;
|
41
|
-
customer_payment_sources: api.CustomerPaymentSources;
|
42
|
-
customer_subscriptions: api.CustomerSubscriptions;
|
43
|
-
customers: api.Customers;
|
44
|
-
delivery_lead_times: api.DeliveryLeadTimes;
|
45
|
-
event_callbacks: api.EventCallbacks;
|
46
|
-
events: api.Events;
|
47
|
-
exports: api.Exports;
|
48
|
-
external_gateways: api.ExternalGateways;
|
49
|
-
external_payments: api.ExternalPayments;
|
50
|
-
external_promotions: api.ExternalPromotions;
|
51
|
-
external_tax_calculators: api.ExternalTaxCalculators;
|
52
|
-
fixed_amount_promotions: api.FixedAmountPromotions;
|
53
|
-
fixed_price_promotions: api.FixedPricePromotions;
|
54
|
-
free_gift_promotions: api.FreeGiftPromotions;
|
55
|
-
free_shipping_promotions: api.FreeShippingPromotions;
|
56
|
-
geocoders: api.Geocoders;
|
57
|
-
gift_card_recipients: api.GiftCardRecipients;
|
58
|
-
gift_cards: api.GiftCards;
|
59
|
-
google_geocoders: api.GoogleGeocoders;
|
60
|
-
imports: api.Imports;
|
61
|
-
in_stock_subscriptions: api.InStockSubscriptions;
|
62
|
-
inventory_models: api.InventoryModels;
|
63
|
-
inventory_return_locations: api.InventoryReturnLocations;
|
64
|
-
inventory_stock_locations: api.InventoryStockLocations;
|
65
|
-
klarna_gateways: api.KlarnaGateways;
|
66
|
-
klarna_payments: api.KlarnaPayments;
|
67
|
-
line_item_options: api.LineItemOptions;
|
68
|
-
line_items: api.LineItems;
|
69
|
-
manual_gateways: api.ManualGateways;
|
70
|
-
manual_tax_calculators: api.ManualTaxCalculators;
|
71
|
-
markets: api.Markets;
|
72
|
-
merchants: api.Merchants;
|
73
|
-
order_amount_promotion_rules: api.OrderAmountPromotionRules;
|
74
|
-
order_copies: api.OrderCopies;
|
75
|
-
order_factories: api.OrderFactories;
|
76
|
-
order_subscription_items: api.OrderSubscriptionItems;
|
77
|
-
order_subscriptions: api.OrderSubscriptions;
|
78
|
-
order_validation_rules: api.OrderValidationRules;
|
79
|
-
orders: api.Orders;
|
80
|
-
organization: api.Organizations;
|
81
|
-
packages: api.Packages;
|
82
|
-
parcel_line_items: api.ParcelLineItems;
|
83
|
-
parcels: api.Parcels;
|
84
|
-
payment_gateways: api.PaymentGateways;
|
85
|
-
payment_methods: api.PaymentMethods;
|
86
|
-
payment_options: api.PaymentOptions;
|
87
|
-
paypal_gateways: api.PaypalGateways;
|
88
|
-
paypal_payments: api.PaypalPayments;
|
89
|
-
percentage_discount_promotions: api.PercentageDiscountPromotions;
|
90
|
-
price_frequency_tiers: api.PriceFrequencyTiers;
|
91
|
-
price_lists: api.PriceLists;
|
92
|
-
price_tiers: api.PriceTiers;
|
93
|
-
price_volume_tiers: api.PriceVolumeTiers;
|
94
|
-
prices: api.Prices;
|
95
|
-
promotion_rules: api.PromotionRules;
|
96
|
-
promotions: api.Promotions;
|
97
|
-
recurring_order_copies: api.RecurringOrderCopies;
|
98
|
-
refunds: api.Refunds;
|
99
|
-
reserved_stocks: api.ReservedStocks;
|
100
|
-
resource_errors: api.ResourceErrors;
|
101
|
-
return_line_items: api.ReturnLineItems;
|
102
|
-
returns: api.Returns;
|
103
|
-
satispay_gateways: api.SatispayGateways;
|
104
|
-
satispay_payments: api.SatispayPayments;
|
105
|
-
shipments: api.Shipments;
|
106
|
-
shipping_categories: api.ShippingCategories;
|
107
|
-
shipping_method_tiers: api.ShippingMethodTiers;
|
108
|
-
shipping_methods: api.ShippingMethods;
|
109
|
-
shipping_weight_tiers: api.ShippingWeightTiers;
|
110
|
-
shipping_zones: api.ShippingZones;
|
111
|
-
sku_list_items: api.SkuListItems;
|
112
|
-
sku_list_promotion_rules: api.SkuListPromotionRules;
|
113
|
-
sku_lists: api.SkuLists;
|
114
|
-
sku_options: api.SkuOptions;
|
115
|
-
skus: api.Skus;
|
116
|
-
stock_items: api.StockItems;
|
117
|
-
stock_line_items: api.StockLineItems;
|
118
|
-
stock_locations: api.StockLocations;
|
119
|
-
stock_reservations: api.StockReservations;
|
120
|
-
stock_transfers: api.StockTransfers;
|
121
|
-
stripe_gateways: api.StripeGateways;
|
122
|
-
stripe_payments: api.StripePayments;
|
123
|
-
subscription_models: api.SubscriptionModels;
|
124
|
-
tags: api.Tags;
|
125
|
-
tax_calculators: api.TaxCalculators;
|
126
|
-
tax_categories: api.TaxCategories;
|
127
|
-
tax_rules: api.TaxRules;
|
128
|
-
taxjar_accounts: api.TaxjarAccounts;
|
129
|
-
transactions: api.Transactions;
|
130
|
-
versions: api.Versions;
|
131
|
-
voids: api.Voids;
|
132
|
-
webhooks: api.Webhooks;
|
133
|
-
wire_transfers: api.WireTransfers;
|
134
13
|
constructor(config: CommerceLayerInitConfig);
|
14
|
+
get addresses(): api.Addresses;
|
15
|
+
get adjustments(): api.Adjustments;
|
16
|
+
get adyen_gateways(): api.AdyenGateways;
|
17
|
+
get adyen_payments(): api.AdyenPayments;
|
18
|
+
get application(): api.Applications;
|
19
|
+
get attachments(): api.Attachments;
|
20
|
+
get authorizations(): api.Authorizations;
|
21
|
+
get avalara_accounts(): api.AvalaraAccounts;
|
22
|
+
get axerve_gateways(): api.AxerveGateways;
|
23
|
+
get axerve_payments(): api.AxervePayments;
|
24
|
+
get billing_info_validation_rules(): api.BillingInfoValidationRules;
|
25
|
+
get bing_geocoders(): api.BingGeocoders;
|
26
|
+
get braintree_gateways(): api.BraintreeGateways;
|
27
|
+
get braintree_payments(): api.BraintreePayments;
|
28
|
+
get bundles(): api.Bundles;
|
29
|
+
get buy_x_pay_y_promotions(): api.BuyXPayYPromotions;
|
30
|
+
get captures(): api.Captures;
|
31
|
+
get carrier_accounts(): api.CarrierAccounts;
|
32
|
+
get checkout_com_gateways(): api.CheckoutComGateways;
|
33
|
+
get checkout_com_payments(): api.CheckoutComPayments;
|
34
|
+
get cleanups(): api.Cleanups;
|
35
|
+
get coupon_codes_promotion_rules(): api.CouponCodesPromotionRules;
|
36
|
+
get coupon_recipients(): api.CouponRecipients;
|
37
|
+
get coupons(): api.Coupons;
|
38
|
+
get custom_promotion_rules(): api.CustomPromotionRules;
|
39
|
+
get customer_addresses(): api.CustomerAddresses;
|
40
|
+
get customer_groups(): api.CustomerGroups;
|
41
|
+
get customer_password_resets(): api.CustomerPasswordResets;
|
42
|
+
get customer_payment_sources(): api.CustomerPaymentSources;
|
43
|
+
get customer_subscriptions(): api.CustomerSubscriptions;
|
44
|
+
get customers(): api.Customers;
|
45
|
+
get delivery_lead_times(): api.DeliveryLeadTimes;
|
46
|
+
get event_callbacks(): api.EventCallbacks;
|
47
|
+
get events(): api.Events;
|
48
|
+
get exports(): api.Exports;
|
49
|
+
get external_gateways(): api.ExternalGateways;
|
50
|
+
get external_payments(): api.ExternalPayments;
|
51
|
+
get external_promotions(): api.ExternalPromotions;
|
52
|
+
get external_tax_calculators(): api.ExternalTaxCalculators;
|
53
|
+
get fixed_amount_promotions(): api.FixedAmountPromotions;
|
54
|
+
get fixed_price_promotions(): api.FixedPricePromotions;
|
55
|
+
get free_gift_promotions(): api.FreeGiftPromotions;
|
56
|
+
get free_shipping_promotions(): api.FreeShippingPromotions;
|
57
|
+
get geocoders(): api.Geocoders;
|
58
|
+
get gift_card_recipients(): api.GiftCardRecipients;
|
59
|
+
get gift_cards(): api.GiftCards;
|
60
|
+
get google_geocoders(): api.GoogleGeocoders;
|
61
|
+
get imports(): api.Imports;
|
62
|
+
get in_stock_subscriptions(): api.InStockSubscriptions;
|
63
|
+
get inventory_models(): api.InventoryModels;
|
64
|
+
get inventory_return_locations(): api.InventoryReturnLocations;
|
65
|
+
get inventory_stock_locations(): api.InventoryStockLocations;
|
66
|
+
get klarna_gateways(): api.KlarnaGateways;
|
67
|
+
get klarna_payments(): api.KlarnaPayments;
|
68
|
+
get line_item_options(): api.LineItemOptions;
|
69
|
+
get line_items(): api.LineItems;
|
70
|
+
get manual_gateways(): api.ManualGateways;
|
71
|
+
get manual_tax_calculators(): api.ManualTaxCalculators;
|
72
|
+
get markets(): api.Markets;
|
73
|
+
get merchants(): api.Merchants;
|
74
|
+
get order_amount_promotion_rules(): api.OrderAmountPromotionRules;
|
75
|
+
get order_copies(): api.OrderCopies;
|
76
|
+
get order_factories(): api.OrderFactories;
|
77
|
+
get order_subscription_items(): api.OrderSubscriptionItems;
|
78
|
+
get order_subscriptions(): api.OrderSubscriptions;
|
79
|
+
get order_validation_rules(): api.OrderValidationRules;
|
80
|
+
get orders(): api.Orders;
|
81
|
+
get organization(): api.Organizations;
|
82
|
+
get packages(): api.Packages;
|
83
|
+
get parcel_line_items(): api.ParcelLineItems;
|
84
|
+
get parcels(): api.Parcels;
|
85
|
+
get payment_gateways(): api.PaymentGateways;
|
86
|
+
get payment_methods(): api.PaymentMethods;
|
87
|
+
get payment_options(): api.PaymentOptions;
|
88
|
+
get paypal_gateways(): api.PaypalGateways;
|
89
|
+
get paypal_payments(): api.PaypalPayments;
|
90
|
+
get percentage_discount_promotions(): api.PercentageDiscountPromotions;
|
91
|
+
get price_frequency_tiers(): api.PriceFrequencyTiers;
|
92
|
+
get price_lists(): api.PriceLists;
|
93
|
+
get price_tiers(): api.PriceTiers;
|
94
|
+
get price_volume_tiers(): api.PriceVolumeTiers;
|
95
|
+
get prices(): api.Prices;
|
96
|
+
get promotion_rules(): api.PromotionRules;
|
97
|
+
get promotions(): api.Promotions;
|
98
|
+
get recurring_order_copies(): api.RecurringOrderCopies;
|
99
|
+
get refunds(): api.Refunds;
|
100
|
+
get reserved_stocks(): api.ReservedStocks;
|
101
|
+
get resource_errors(): api.ResourceErrors;
|
102
|
+
get return_line_items(): api.ReturnLineItems;
|
103
|
+
get returns(): api.Returns;
|
104
|
+
get satispay_gateways(): api.SatispayGateways;
|
105
|
+
get satispay_payments(): api.SatispayPayments;
|
106
|
+
get shipments(): api.Shipments;
|
107
|
+
get shipping_categories(): api.ShippingCategories;
|
108
|
+
get shipping_method_tiers(): api.ShippingMethodTiers;
|
109
|
+
get shipping_methods(): api.ShippingMethods;
|
110
|
+
get shipping_weight_tiers(): api.ShippingWeightTiers;
|
111
|
+
get shipping_zones(): api.ShippingZones;
|
112
|
+
get sku_list_items(): api.SkuListItems;
|
113
|
+
get sku_list_promotion_rules(): api.SkuListPromotionRules;
|
114
|
+
get sku_lists(): api.SkuLists;
|
115
|
+
get sku_options(): api.SkuOptions;
|
116
|
+
get skus(): api.Skus;
|
117
|
+
get stock_items(): api.StockItems;
|
118
|
+
get stock_line_items(): api.StockLineItems;
|
119
|
+
get stock_locations(): api.StockLocations;
|
120
|
+
get stock_reservations(): api.StockReservations;
|
121
|
+
get stock_transfers(): api.StockTransfers;
|
122
|
+
get stripe_gateways(): api.StripeGateways;
|
123
|
+
get stripe_payments(): api.StripePayments;
|
124
|
+
get subscription_models(): api.SubscriptionModels;
|
125
|
+
get tags(): api.Tags;
|
126
|
+
get tax_calculators(): api.TaxCalculators;
|
127
|
+
get tax_categories(): api.TaxCategories;
|
128
|
+
get tax_rules(): api.TaxRules;
|
129
|
+
get taxjar_accounts(): api.TaxjarAccounts;
|
130
|
+
get transactions(): api.Transactions;
|
131
|
+
get versions(): api.Versions;
|
132
|
+
get voids(): api.Voids;
|
133
|
+
get webhooks(): api.Webhooks;
|
134
|
+
get wire_transfers(): api.WireTransfers;
|
135
135
|
get currentOrganization(): string;
|
136
|
+
private get interceptors();
|
136
137
|
private localConfig;
|
137
138
|
config(config: CommerceLayerConfig): CommerceLayerClient;
|
138
139
|
resources(): readonly string[];
|
139
140
|
singletons(): readonly string[];
|
140
141
|
isSingleton(resource: api.ResourceTypeLock): boolean;
|
141
142
|
isApiError(error: any): error is ApiError;
|
142
|
-
addRequestInterceptor(
|
143
|
-
addResponseInterceptor(
|
144
|
-
removeInterceptor(type: InterceptorType, id
|
143
|
+
addRequestInterceptor(onSuccess?: RequestInterceptor, onFailure?: ErrorInterceptor): void;
|
144
|
+
addResponseInterceptor(onSuccess?: ResponseInterceptor, onFailure?: ErrorInterceptor): void;
|
145
|
+
removeInterceptor(type: InterceptorType, id?: number): void;
|
145
146
|
addRawResponseReader(options?: {
|
146
147
|
headers: boolean;
|
147
148
|
}): RawResponseReader;
|
148
|
-
removeRawResponseReader(
|
149
|
+
removeRawResponseReader(): void;
|
149
150
|
}
|
150
151
|
declare const CommerceLayer: (config: CommerceLayerInitConfig) => CommerceLayerClient;
|
151
152
|
export default CommerceLayer;
|