bc-api-client 0.1.0-beta.18 → 0.1.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -38
- package/dist/endpoints.js.map +2 -2
- package/dist/index.js +135 -82
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
An opinionated and minimalistic client focusing on simplicity and concurrent performance.
|
|
6
6
|
Features (or antifeatures - depends on your opinion)
|
|
7
|
+
|
|
7
8
|
- Node 20+ LTS, ESM
|
|
8
9
|
- Bring Your Own Types
|
|
9
10
|
- Basic API methods (get, post, put, delete)
|
|
@@ -15,13 +16,14 @@ Features (or antifeatures - depends on your opinion)
|
|
|
15
16
|
⚠️ **Disclaimer**: This library provides concurrent request capabilities. BigCommerce has strict rate limits that vary by plan and endpoint. The author is not responsible for any issues arising from improper API usage. Use at your own risk.
|
|
16
17
|
|
|
17
18
|
## Table of Contents
|
|
19
|
+
|
|
18
20
|
- [Installation](#installation)
|
|
19
21
|
- [Usage](#usage)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
- [API Client](#api-client)
|
|
23
|
+
- [Authentication](#authentication)
|
|
22
24
|
- [API](#api)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
- [BigCommerceClient](#bigcommerceclient)
|
|
26
|
+
- [BigCommerceAuth](#bigcommerceauth)
|
|
25
27
|
- [Tips](#tips)
|
|
26
28
|
- [License](#license)
|
|
27
29
|
|
|
@@ -48,53 +50,53 @@ type MyProduct = {
|
|
|
48
50
|
name: string;
|
|
49
51
|
sku: string;
|
|
50
52
|
inventory_level: number;
|
|
51
|
-
}
|
|
53
|
+
};
|
|
52
54
|
|
|
53
55
|
const fields = 'id,name,sku,inventory_level';
|
|
54
56
|
|
|
55
57
|
const client = new BigCommerceClient({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
storeHash: 'your-store-hash',
|
|
59
|
+
accessToken: 'your-access-token',
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
// Basic GET request
|
|
61
63
|
const products = await client.get<V3Response<MyProduct[]>>(bc.products.path, {
|
|
62
|
-
|
|
64
|
+
query: { include_fields: fields },
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
// Low level concurrent requests with error handling
|
|
66
68
|
const results = await client.concurrent<never, V3Response<MyProduct>>(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
[
|
|
70
|
+
{ method: 'GET', endpoint: bc.products.byId(1), query: { include_fields: fields } },
|
|
71
|
+
{ method: 'GET', endpoint: bc.products.byId(2), query: { include_fields: fields } },
|
|
72
|
+
],
|
|
73
|
+
{
|
|
74
|
+
concurrency: 10,
|
|
75
|
+
skipErrors: true, // Optional: skip failed requests instead of throwing
|
|
76
|
+
},
|
|
75
77
|
);
|
|
76
78
|
|
|
77
79
|
// Collect all pages from v3 endpoint
|
|
78
80
|
const allProducts = await client.collect<MyProduct>(bc.products.path, {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
query: {
|
|
82
|
+
include_fields: fields,
|
|
83
|
+
},
|
|
84
|
+
concurrency: 10, // Optional: control concurrent requests
|
|
85
|
+
skipErrors: true, // Optional: skip failed requests
|
|
84
86
|
});
|
|
85
87
|
|
|
86
88
|
// Collect all pages from v2 endpoint
|
|
87
89
|
type MyOrder = {
|
|
88
90
|
id: number;
|
|
89
91
|
status: string;
|
|
90
|
-
}
|
|
92
|
+
};
|
|
91
93
|
|
|
92
94
|
const orders = await client.collectV2<MyOrder>(bc.orders.v2.path, {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
query: {
|
|
96
|
+
limit: '5',
|
|
97
|
+
},
|
|
98
|
+
concurrency: 10, // Optional: control concurrent requests
|
|
99
|
+
skipErrors: true, // Optional: skip failed requests
|
|
98
100
|
});
|
|
99
101
|
|
|
100
102
|
// Query with multiple filter values
|
|
@@ -102,13 +104,13 @@ const orders = await client.collectV2<MyOrder>(bc.orders.v2.path, {
|
|
|
102
104
|
const productIds = [1, 2, 3, 4, 5]; // Example IDs
|
|
103
105
|
|
|
104
106
|
const filteredProducts = await client.query<MyProduct>(bc.products.path, {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
key: 'id:in',
|
|
108
|
+
values: productIds,
|
|
109
|
+
query: {
|
|
110
|
+
include_fields: fields,
|
|
111
|
+
},
|
|
112
|
+
concurrency: 10, // Optional: control concurrent requests
|
|
113
|
+
skipErrors: true, // Optional: skip failed requests
|
|
112
114
|
});
|
|
113
115
|
```
|
|
114
116
|
|
|
@@ -118,9 +120,9 @@ const filteredProducts = await client.query<MyProduct>(bc.products.path, {
|
|
|
118
120
|
import { BigCommerceAuth } from 'bigcommerce-client';
|
|
119
121
|
|
|
120
122
|
const auth = new BigCommerceAuth({
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
clientId: 'your-client-id',
|
|
124
|
+
secret: 'your-client-secret',
|
|
125
|
+
redirectUri: 'your-redirect-uri',
|
|
124
126
|
});
|
|
125
127
|
|
|
126
128
|
// Request token
|
|
@@ -135,6 +137,7 @@ const claims = await auth.verify(jwtPayload, 'your-store-hash');
|
|
|
135
137
|
### BigCommerceClient
|
|
136
138
|
|
|
137
139
|
#### Constructor
|
|
140
|
+
|
|
138
141
|
```typescript
|
|
139
142
|
new BigCommerceClient(config: {
|
|
140
143
|
storeHash: string;
|
|
@@ -148,57 +151,75 @@ new BigCommerceClient(config: {
|
|
|
148
151
|
```
|
|
149
152
|
|
|
150
153
|
#### `get<R>(endpoint: string, options?: GetOptions): Promise<R>`
|
|
154
|
+
|
|
151
155
|
Makes a GET request to the BigCommerce API.
|
|
156
|
+
|
|
152
157
|
- `endpoint`: The API endpoint to request
|
|
153
158
|
- `options.query`: Query parameters to include in the request
|
|
154
159
|
- `options.version`: API version to use (v2 or v3, default: v3)
|
|
155
160
|
|
|
156
161
|
#### `post<T, R>(endpoint: string, options?: PostOptions<T>): Promise<R>`
|
|
162
|
+
|
|
157
163
|
Makes a POST request to the BigCommerce API.
|
|
164
|
+
|
|
158
165
|
- `endpoint`: The API endpoint to request
|
|
159
166
|
- `options.query`: Query parameters to include in the request
|
|
160
167
|
- `options.version`: API version to use (v2 or v3, default: v3)
|
|
161
168
|
- `options.body`: Request body data of type `T`
|
|
162
169
|
|
|
163
170
|
#### `put<T, R>(endpoint: string, options?: PostOptions<T>): Promise<R>`
|
|
171
|
+
|
|
164
172
|
Makes a PUT request to the BigCommerce API.
|
|
173
|
+
|
|
165
174
|
- `endpoint`: The API endpoint to request
|
|
166
175
|
- `options.query`: Query parameters to include in the request
|
|
167
176
|
- `options.version`: API version to use (v2 or v3, default: v3)
|
|
168
177
|
- `options.body`: Request body data of type `T`
|
|
169
178
|
|
|
170
179
|
#### `delete<R>(endpoint: string, options?: Pick<GetOptions, 'version'>): Promise<void>`
|
|
180
|
+
|
|
171
181
|
Makes a DELETE request to the BigCommerce API.
|
|
182
|
+
|
|
172
183
|
- `endpoint`: The API endpoint to delete
|
|
173
184
|
- `options.version`: API version to use (v2 or v3, default: v3)
|
|
174
185
|
|
|
175
186
|
#### `concurrent<T, R>(requests: RequestOptions<T>[], options?: ConcurrencyOptions): Promise<R[]>`
|
|
187
|
+
|
|
176
188
|
Executes multiple requests concurrently with rate limit handling.
|
|
189
|
+
|
|
177
190
|
- `requests`: Array of request options to execute
|
|
178
191
|
- `options.concurrency`: Maximum number of concurrent requests (default: 10)
|
|
179
192
|
- `options.skipErrors`: Whether to skip errors and continue processing (the errors will be logged if logger is provided), default: false)
|
|
180
193
|
|
|
181
194
|
#### `concurrentSettled<T, R>(requests: RequestOptions<T>[], options?: Pick<ConcurrencyOptions, 'concurrency'>): Promise<PromiseSettledResult<R>[]>`
|
|
195
|
+
|
|
182
196
|
Lowest level concurrent request method. This method executes requests in chunks and returns bare PromiseSettledResult objects. Use this method if you need to handle errors in a custom way.
|
|
197
|
+
|
|
183
198
|
- `requests`: Array of request options to execute
|
|
184
199
|
- `options.concurrency`: Maximum number of concurrent requests (default: 10)
|
|
185
200
|
|
|
186
201
|
#### `collect<T>(endpoint: string, options: Omit<GetOptions, 'version'> & ConcurrencyOptions): Promise<T[]>`
|
|
202
|
+
|
|
187
203
|
Automatically fetches all pages of a paginated v3 endpoint. Pulls the first page and uses pagination meta to collect remaining pages concurrently.
|
|
204
|
+
|
|
188
205
|
- `endpoint`: The API endpoint to request
|
|
189
206
|
- `options.query`: Query parameters to include in the request (limit defaults to 250)
|
|
190
207
|
- `options.concurrency`: Maximum number of concurrent requests (default: 10)
|
|
191
208
|
- `options.skipErrors`: Whether to skip errors and continue processing (default: false)
|
|
192
209
|
|
|
193
210
|
#### `collectV2<T>(endpoint: string, options: Omit<GetOptions, 'version'> & ConcurrencyOptions): Promise<T[]>`
|
|
211
|
+
|
|
194
212
|
Automatically fetches all pages of a paginated v2 endpoint. Pulls all pages concurrently until a 204 is returned.
|
|
213
|
+
|
|
195
214
|
- `endpoint`: The API endpoint to request
|
|
196
215
|
- `options.query`: Query parameters to include in the request (limit defaults to 250)
|
|
197
216
|
- `options.concurrency`: Maximum number of concurrent requests (default: 10)
|
|
198
217
|
- `options.skipErrors`: Whether to skip errors and continue processing (default: false)
|
|
199
218
|
|
|
200
219
|
#### `query<T>(endpoint: string, options: QueryOptions): Promise<T[]>`
|
|
220
|
+
|
|
201
221
|
Queries multiple values against a single field using the v3 API. If the URL + query params are too long, the query will be chunked.
|
|
222
|
+
|
|
202
223
|
- `endpoint`: The API endpoint to request
|
|
203
224
|
- `options.key`: The field name to query against (e.g. 'id:in')
|
|
204
225
|
- `options.values`: Array of values to query for
|
|
@@ -209,6 +230,7 @@ Queries multiple values against a single field using the v3 API. If the URL + qu
|
|
|
209
230
|
### BigCommerceAuth
|
|
210
231
|
|
|
211
232
|
#### Constructor
|
|
233
|
+
|
|
212
234
|
```typescript
|
|
213
235
|
new BigCommerceAuth(config: {
|
|
214
236
|
clientId: string;
|
|
@@ -220,9 +242,11 @@ new BigCommerceAuth(config: {
|
|
|
220
242
|
```
|
|
221
243
|
|
|
222
244
|
#### `requestToken(data: string | UrlSearchParams | AuthQuery): Promise<TokenResponse>`
|
|
245
|
+
|
|
223
246
|
Requests an access token from BigCommerce OAuth.
|
|
224
247
|
|
|
225
248
|
#### `verify(jwtPayload: string, storeHash: string): Promise<Claims>`
|
|
249
|
+
|
|
226
250
|
Verifies a JWT payload from BigCommerce.
|
|
227
251
|
|
|
228
252
|
## Tips
|
|
@@ -237,4 +261,3 @@ Verifies a JWT payload from BigCommerce.
|
|
|
237
261
|
## License
|
|
238
262
|
|
|
239
263
|
MIT
|
|
240
|
-
|
package/dist/endpoints.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/endpoints.ts"],
|
|
4
|
-
"sourcesContent": ["const catalogSummary = '/catalog/summary';\n\nconst products = {\n path: '/catalog/products',\n byId: (id: number) => `/catalog/products/${id}`,\n batchPrices: '/pricing/products',\n metafields: {\n batch: '/catalog/products/metafields',\n product: {\n path: (productId: number) => `/catalog/products/${productId}/metafields`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/metafields/${id}`,\n },\n },\n bulkPricingRules: {\n path: (productId: number) => `/catalog/products/${productId}/bulk-pricing-rules`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/bulk-pricing-rules/${id}`,\n },\n categoryAssignments: '/catalog/products/category-assignments',\n channelAssignments: '/catalog/products/channel-assignments',\n complexRules: {\n path: (productId: number) => `/catalog/products/${productId}/complex-rules`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/complex-rules/${id}`,\n },\n customFields: {\n path: (productId: number) => `/catalog/products/${productId}/custom-fields`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/custom-fields/${id}`,\n },\n images: {\n path: (productId: number) => `/catalog/products/${productId}/images`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/images/${id}`,\n },\n reviews: {\n path: (productId: number) => `/catalog/products/${productId}/reviews`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/reviews/${id}`,\n },\n videos: {\n path: (productId: number) => `/catalog/products/${productId}/videos`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/videos/${id}`,\n },\n};\n\nconst modifiers = {\n path: (productId: number) => `/catalog/products/${productId}/modifiers`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/modifiers/${id}`,\n values: {\n path: (productId: number, modifierId: number) =>\n `/catalog/products/${productId}/modifiers/${modifierId}/values`,\n byId: (productId: number, modifierId: number, id: number) =>\n `/catalog/products/${productId}/modifiers/${modifierId}/values/${id}`,\n createImage: (productId: number, modifierId: number, id: number) =>\n `/catalog/products/${productId}/modifiers/${modifierId}/values/${id}/image`,\n },\n};\n\nconst variantOptions = {\n path: (productId: number) => `/catalog/products/${productId}/options`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/options/${id}`,\n values: {\n path: (productId: number, optionId: number) => `/catalog/products/${productId}/options/${optionId}/values`,\n byId: (productId: number, optionId: number, id: number) =>\n `/catalog/products/${productId}/options/${optionId}/values/${id}`,\n },\n};\n\nconst variants = {\n batch: '/catalog/variants',\n path: (productId: number) => `/catalog/products/${productId}/variants`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/variants/${id}`,\n createImage: (productId: number, id: number) => `/catalog/products/${productId}/variants/${id}/image`,\n metafields: {\n batch: '/catalog/variants/metafields',\n path: (productId: number, id: number) => `/catalog/products/${productId}/variants/${id}/metafields`,\n byId: (productId: number, variantId: number, id: number) =>\n `/catalog/products/${productId}/variants/${variantId}/metafields/${id}`,\n },\n};\n\nconst brands = {\n path: '/catalog/brands',\n byId: (id: number) => `/catalog/brands/${id}`,\n image: (id: number) => `/catalog/brands/${id}/image`,\n metafields: {\n batch: '/catalog/brands/metafields',\n path: (id: number) => `/catalog/brands/${id}/metafields`,\n byId: (brandId: number, id: number) => `/catalog/brands/${brandId}/metafields/${id}`,\n },\n};\n\nconst categories = {\n deprecated: {\n path: '/catalog/categories',\n byId: (id: number) => `/catalog/categories/${id}`,\n },\n image: (id: number) => `/catalog/categories/${id}/image`,\n metafields: {\n batch: '/catalog/categories/metafields',\n path: (id: number) => `/catalog/categories/${id}/metafields`,\n byId: (categoryId: number, id: number) => `/catalog/categories/${categoryId}/metafields/${id}`,\n },\n sortOrder: (id: number) => `/catalog/categories/${id}/products/sort-order`,\n};\n\nconst trees = {\n path: '/catalog/trees',\n byId: (id: number) => `/catalog/trees/${id}`,\n categories: (id: number) => `/catalog/trees/${id}/categories`,\n allCategories: '/catalog/trees/categories',\n};\n\nconst abandonedCarts = {\n path: (token: string) => `/abandoned-carts/${token}`,\n settings: {\n global: '/abandoned-carts/settings',\n channel: (channelId: number) => `/abandoned-carts/settings/${channelId}`,\n },\n};\n\nconst carts = {\n path: '/carts',\n byId: (uuid: string) => `/carts/${uuid}`,\n createRedirectUrl: (uuid: string) => `/carts/${uuid}/redirect_urls`,\n items: {\n path: (uuid: string) => `/carts/${uuid}/items`,\n byId: (cartUuid: string, itemUuid: string) => `/carts/${cartUuid}/items/${itemUuid}`,\n },\n metafields: {\n batch: '/carts/metafields',\n path: (uuid: string) => `/carts/${uuid}/metafields`,\n byId: (cartUuid: string, metafieldUuid: string) => `/carts/${cartUuid}/metafields/${metafieldUuid}`,\n },\n settings: {\n global: '/carts/settings',\n channel: (channelId: number) => `/carts/settings/${channelId}`,\n },\n};\n\nconst channels = {\n path: '/channels',\n byId: (id: number) => `/channels/${id}`,\n activeTheme: (id: number) => `/channels/${id}/active-theme`,\n site: (id: number) => `/channels/${id}/site`,\n menus: (id: number) => `/channels/${id}/channel-menus`,\n checkoutUrl: (id: number) => `/channels/${id}/site/checkout-url`,\n currencyAssignments: {\n path: (id: number) => `/channels/${id}/currency-assignments`,\n byId: (channelId: number, id: number) => `/channels/${channelId}/currency-assignments/${id}`,\n },\n listings: {\n path: (id: number) => `/channels/${id}/listings`,\n byId: (channelId: number, id: number) => `/channels/${channelId}/listings/${id}`,\n },\n metafields: {\n batch: '/channels/metafields',\n path: (id: number) => `/channels/${id}/metafields`,\n byId: (channelId: number, id: number) => `/channels/${channelId}/metafields/${id}`,\n },\n};\n\nconst checkouts = {\n path: (uuid: string) => `/checkouts/${uuid}`,\n billingAddress: (uuid: string) => `/checkouts/${uuid}/billing-address`,\n consignments: {\n path: (uuid: string) => `/checkouts/${uuid}/consignments`,\n byId: (checkoutUuid: string, consignmentUuid: string) => `/checkouts/${checkoutUuid}/consignments/${consignmentUuid}`,\n },\n coupons: {\n add: (uuid: string) => `/checkouts/${uuid}/coupons`,\n delete: (uuid: string, code: string) => `/checkouts/${uuid}/coupons/${code}`,\n },\n discounts: (uuid: string) => `/checkouts/${uuid}/discounts`,\n fees: (uuid: string) => `/checkouts/${uuid}/fees`,\n createOrder: (uuid: string) => `/checkouts/${uuid}/orders`,\n settings: '/checkouts/settings',\n createToken: (uuid: string) => `/checkouts/${uuid}/token`,\n};\n\nconst currencies = {\n v2: {\n path: '/currencies',\n byId: (id: string) => `/currencies/${id}`,\n },\n};\n\nconst customers = {\n path: '/customers',\n addresses: (id: number) => `/customers/${id}/addresses`,\n attributes: (id: number) => `/customers/${id}/attributes`,\n attributesValues: (id: number) => `/customers/${id}/attribute-values`,\n settings: {\n channel: (channelId: number) => `/customers/settings/channels/${channelId}`,\n global: '/customers/settings',\n },\n consent: (id: number) => `/customers/${id}/consent`,\n formFieldValues: '/customers/form-field-values',\n storedInstruments: (id: number) => `/customers/${id}/stored-instruments`,\n validateCredentials: '/customers/validate-credentials',\n metafields: {\n batch: '/customers/metafields',\n path: (id: number) => `/customers/${id}/metafields`,\n byId: (customerId: number, id: number) => `/customers/${customerId}/metafields/${id}`,\n },\n v2: {\n groups: {\n path: '/customer_groups',\n byId: (id: number) => `/customer_groups/${id}`,\n count: '/customer_groups/count',\n },\n deprecated: {\n path: '/customers',\n byId: (id: number) => `/customers/${id}`,\n addresses: {\n path: (id: number) => `/customers/${id}/addresses`,\n byId: (customerId: number, id: number) => `/customers/${customerId}/addresses/${id}`,\n },\n validatePassword: (id: number) => `/customers/${id}/validate_password`,\n },\n },\n subscribers: {\n path: '/customers/subscribers',\n byId: (id: number) => `/customers/subscribers/${id}`,\n },\n};\n\nexport const customerSegmentation = {\n segments: '/segments',\n shopperProfileSegments: (profileId: string) => `/shopper-profiles/${profileId}/segments`,\n shopperProfiles: '/shopper-profiles',\n segmentShopperProfiles: (segmentId: string) => `/segments/${segmentId}/shopper-profiles`,\n};\n\nexport const geography = {\n v2: {\n countries: {\n path: '/countries',\n byId: (id: string) => `/countries/${id}`,\n count: '/countries/count',\n states: {\n path: (id: string) => `/countries/${id}/states`,\n byId: (countryId: string, id: string) => `/countries/${countryId}/states/${id}`,\n count: (countryId: string) => `/countries/${countryId}/states/count`,\n },\n },\n states: {\n path: '/countries/states',\n count: '/countries/states/count',\n },\n },\n};\n\nconst inventory = {\n adjustments: {\n absolute: '/inventory/adjustments/absolute',\n relative: '/inventory/adjustments/relative',\n },\n items: {\n path: '/inventory/items',\n atLocation: (locationId: string) => `/inventory/locations/${locationId}/items`,\n updateLocationSettings: (locationId: string) => `/inventory/locations/${locationId}/items`,\n },\n};\n\nconst locations = {\n path: '/inventory/locations',\n metafields: {\n batch: '/inventory/locations/metafields',\n path: (id: string) => `/inventory/locations/${id}/metafields`,\n byId: (locationId: string, id: string) => `/inventory/locations/${locationId}/metafields/${id}`,\n },\n};\n\nconst ordersV2 = {\n path: '/orders',\n byId: (id: number) => `/orders/${id}`,\n count: '/orders/count',\n consignments: {\n path: (id: number) => `/orders/${id}/consignments`,\n shippingQuotes: (orderId: number, consignmentId: number) =>\n `/orders/${orderId}/consignments/shipping/${consignmentId}/shipping_quotes`,\n },\n coupons: (id: number) => `/orders/${id}/coupons`,\n fees: (id: number) => `/orders/${id}/fees`,\n messages: (id: number) => `/orders/${id}/messages`,\n products: {\n path: (id: number) => `/orders/${id}/products`,\n byId: (orderId: number, id: number) => `/orders/${orderId}/products/${id}`,\n },\n shipments: {\n path: (id: number) => `/orders/${id}/shipments`,\n count: (id: number) => `/orders/${id}/shipments/count`,\n byId: (orderId: number, id: number) => `/orders/${orderId}/shipments/${id}`,\n },\n shippingAddresses: {\n path: (id: number) => `/orders/${id}/shipping_addresses`,\n byId: (orderId: number, id: number) => `/orders/${orderId}/shipping_addresses/${id}`,\n quotes: (orderId: number, id: number) => `/orders/${orderId}/shipping_addresses/${id}/shipping_quotes`,\n },\n statuses: {\n path: '/order_statuses',\n byId: (id: number) => `/order_statuses/${id}`,\n },\n taxes: (id: number) => `/orders/${id}/taxes`,\n};\n\nconst orders = {\n v2: ordersV2,\n transactions: (id: number) => `/orders/${id}/transactions`,\n metafields: {\n batch: '/orders/metafields',\n path: (id: number) => `/orders/${id}/metafields`,\n byId: (orderId: number, id: number) => `/orders/${orderId}/metafields/${id}`,\n },\n settings: {\n global: '/orders/settings',\n channel: (channelId: number) => `/orders/settings/${channelId}`,\n },\n payments: {\n capture: (id: number) => `/orders/${id}/payment_actions/capture`,\n void: (id: number) => `/orders/${id}/payment_actions/void`,\n },\n refunds: {\n path: '/orders/payment_actions/refunds',\n byId: (refundId: number) => `/orders/payment_actions/refunds/${refundId}`,\n quote: (id: number) => `/orders/${id}/payment_actions/refund_quote`,\n forOrder: (id: number) => `/orders/${id}/payment_actions/refunds`,\n },\n pickups: {\n path: '/orders/pickups',\n methods: '/pickup/methods',\n options: '/pickup/options',\n },\n};\n\nconst priceLists = {\n path: '/pricelists',\n byId: (id: number) => `/pricelists/${id}`,\n assignments: {\n path: '/pricelists/assignments',\n byId: (id: number) => `/pricelists/assignments/${id}`,\n },\n records: {\n path: '/pricelists/records',\n forList: (id: number) => `/pricelists/${id}/records`,\n byVariant: (listId: number, variantId: number) => `/pricelists/${listId}/records/${variantId}`,\n byCurrency: (listId: number, variantId: number, currencyCode: string) =>\n `/pricelists/${listId}/records/${variantId}/${currencyCode}`,\n },\n};\n\nconst promotions = {\n path: '/promotions',\n byId: (id: number) => `/promotions/${id}`,\n coupons: {\n path: (promotionId: number) => `/promotions/${promotionId}/codes`,\n byId: (promotionId: number, id: number) => `/promotions/${promotionId}/codes/${id}`,\n },\n settings: '/promotions/settings',\n};\n\nconst redirects = {\n path: '/storefront/redirects',\n imexJobs: '/storefront/redirects/imex/jobs',\n createExportJob: '/storefront/redirects/imex/export',\n createImportJob: '/storefront/redirects/imex/import',\n exportEventStream: (jobUuid: string) => `/storefront/redirects/imex/export/${jobUuid}/events`,\n importEventStream: (jobUuid: string) => `/storefront/redirects/imex/import/${jobUuid}/events`,\n downloadExport: (jobUuid: string) => `/storefront/redirects/imex/export/${jobUuid}/download`,\n};\n\nconst scripts = {\n path: '/content/scripts',\n byId: (uuid: string) => `/content/scripts/${uuid}`,\n};\n\nconst settings = {\n analytics: {\n providers: '/settings/analytics',\n provider: (providerId: string) => `/settings/analytics/${providerId}`,\n },\n catalog: '/settings/catalog',\n emailStatuses: '/settings/email-statuses',\n createFavicon: '/settings/favicon/image',\n inventory: {\n path: '/settings/inventory',\n notifications: '/settings/inventory/notifications',\n },\n logo: {\n path: '/settings/logo',\n image: '/settings/logo/image',\n },\n filters: {\n enabled: '/settings/search/filters',\n available: '/settings/search/filters/available',\n contextual: '/settings/search/filters/contexts',\n },\n locale: '/settings/locale',\n profile: '/settings/profile',\n storefront: {\n category: '/settings/storefront/category',\n product: '/settings/storefront/product',\n robotstxt: '/settings/storefront/robotstxt',\n search: '/settings/storefront/search',\n security: '/settings/storefront/security',\n seo: '/settings/storefront/seo',\n status: '/settings/storefront/status',\n uom: '/settings/storefront/units-of-measurement',\n },\n};\n\nconst shippingV2 = {\n carrierConnections: '/shipping/carrier/connection',\n methods: {\n path: (zoneId: number) => `/shipping/zones/${zoneId}/methods`,\n byId: (zoneId: number, id: number) => `/shipping/zones/${zoneId}/methods/${id}`,\n },\n zones: {\n path: '/shipping/zones',\n byId: (id: number) => `/shipping/zones/${id}`,\n },\n};\n\nconst shipping = {\n v2: shippingV2,\n customsInformation: '/shipping/products/customs-information',\n settings: {\n global: '/shipping/settings',\n channel: (channelId: number) => `/shipping/settings/${channelId}`,\n },\n};\n\nconst sites = {\n path: '/sites',\n byId: (id: number) => `/sites/${id}`,\n certificates: {\n all: '/sites/certificates',\n forSite: (id: number) => `/sites/${id}/certificates`,\n },\n routes: {\n path: (siteId: number) => `/sites/${siteId}/routes`,\n byId: (siteId: number, id: number) => `/sites/${siteId}/routes/${id}`,\n },\n};\n\nconst store = {\n v2: {\n info: '/store',\n time: '/time',\n },\n metafields: {\n batch: '/store/metafields',\n path: (id: number) => `/store/metafields/${id}`,\n byId: (storeId: number, id: number) => `/store/metafields/${storeId}/${id}`,\n },\n logs: '/store/systemlogs',\n};\n\nconst tax = {\n v2: {\n classes: {\n path: '/tax_classes',\n byId: (id: number) => `/tax_classes/${id}`,\n },\n },\n customers: '/tax/customers',\n rates: '/tax/rates',\n zones: '/tax/zones',\n properties: '/tax/properties',\n productProperties: '/tax/products/properties',\n settings: '/tax/settings',\n};\n\nconst wishlists = {\n path: '/wishlists',\n byId: (id: number) => `/wishlists/${id}`,\n items: {\n delete: (id: number, itemId: number) => `/wishlists/${id}/items/${itemId}`,\n add: (id: number) => `/wishlists/${id}/items`,\n },\n};\n\nconst webhooks = {\n path: '/hooks',\n byId: (id: number) => `/hooks/${id}`,\n admin: '/hooks/admin',\n upsertEmailNotifications: '/hooks/admin',\n};\n\nexport const bc = {\n catalogSummary,\n products,\n modifiers,\n variantOptions,\n variants,\n brands,\n categories,\n trees,\n abandonedCarts,\n carts,\n channels,\n checkouts,\n currencies,\n customers,\n customerSegmentation,\n geography,\n inventory,\n locations,\n orders,\n priceLists,\n promotions,\n redirects,\n scripts,\n settings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A,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;",
|
|
4
|
+
"sourcesContent": ["const catalogSummary = '/catalog/summary';\n\nconst products = {\n path: '/catalog/products',\n byId: (id: number) => `/catalog/products/${id}`,\n batchPrices: '/pricing/products',\n metafields: {\n batch: '/catalog/products/metafields',\n product: {\n path: (productId: number) => `/catalog/products/${productId}/metafields`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/metafields/${id}`,\n },\n },\n bulkPricingRules: {\n path: (productId: number) => `/catalog/products/${productId}/bulk-pricing-rules`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/bulk-pricing-rules/${id}`,\n },\n categoryAssignments: '/catalog/products/category-assignments',\n channelAssignments: '/catalog/products/channel-assignments',\n complexRules: {\n path: (productId: number) => `/catalog/products/${productId}/complex-rules`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/complex-rules/${id}`,\n },\n customFields: {\n path: (productId: number) => `/catalog/products/${productId}/custom-fields`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/custom-fields/${id}`,\n },\n images: {\n path: (productId: number) => `/catalog/products/${productId}/images`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/images/${id}`,\n },\n reviews: {\n path: (productId: number) => `/catalog/products/${productId}/reviews`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/reviews/${id}`,\n },\n videos: {\n path: (productId: number) => `/catalog/products/${productId}/videos`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/videos/${id}`,\n },\n};\n\nconst modifiers = {\n path: (productId: number) => `/catalog/products/${productId}/modifiers`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/modifiers/${id}`,\n values: {\n path: (productId: number, modifierId: number) =>\n `/catalog/products/${productId}/modifiers/${modifierId}/values`,\n byId: (productId: number, modifierId: number, id: number) =>\n `/catalog/products/${productId}/modifiers/${modifierId}/values/${id}`,\n createImage: (productId: number, modifierId: number, id: number) =>\n `/catalog/products/${productId}/modifiers/${modifierId}/values/${id}/image`,\n },\n};\n\nconst variantOptions = {\n path: (productId: number) => `/catalog/products/${productId}/options`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/options/${id}`,\n values: {\n path: (productId: number, optionId: number) => `/catalog/products/${productId}/options/${optionId}/values`,\n byId: (productId: number, optionId: number, id: number) =>\n `/catalog/products/${productId}/options/${optionId}/values/${id}`,\n },\n};\n\nconst variants = {\n batch: '/catalog/variants',\n path: (productId: number) => `/catalog/products/${productId}/variants`,\n byId: (productId: number, id: number) => `/catalog/products/${productId}/variants/${id}`,\n createImage: (productId: number, id: number) => `/catalog/products/${productId}/variants/${id}/image`,\n metafields: {\n batch: '/catalog/variants/metafields',\n path: (productId: number, id: number) => `/catalog/products/${productId}/variants/${id}/metafields`,\n byId: (productId: number, variantId: number, id: number) =>\n `/catalog/products/${productId}/variants/${variantId}/metafields/${id}`,\n },\n};\n\nconst brands = {\n path: '/catalog/brands',\n byId: (id: number) => `/catalog/brands/${id}`,\n image: (id: number) => `/catalog/brands/${id}/image`,\n metafields: {\n batch: '/catalog/brands/metafields',\n path: (id: number) => `/catalog/brands/${id}/metafields`,\n byId: (brandId: number, id: number) => `/catalog/brands/${brandId}/metafields/${id}`,\n },\n};\n\nconst categories = {\n deprecated: {\n path: '/catalog/categories',\n byId: (id: number) => `/catalog/categories/${id}`,\n },\n image: (id: number) => `/catalog/categories/${id}/image`,\n metafields: {\n batch: '/catalog/categories/metafields',\n path: (id: number) => `/catalog/categories/${id}/metafields`,\n byId: (categoryId: number, id: number) => `/catalog/categories/${categoryId}/metafields/${id}`,\n },\n sortOrder: (id: number) => `/catalog/categories/${id}/products/sort-order`,\n};\n\nconst trees = {\n path: '/catalog/trees',\n byId: (id: number) => `/catalog/trees/${id}`,\n categories: (id: number) => `/catalog/trees/${id}/categories`,\n allCategories: '/catalog/trees/categories',\n};\n\nconst abandonedCarts = {\n path: (token: string) => `/abandoned-carts/${token}`,\n settings: {\n global: '/abandoned-carts/settings',\n channel: (channelId: number) => `/abandoned-carts/settings/${channelId}`,\n },\n};\n\nconst carts = {\n path: '/carts',\n byId: (uuid: string) => `/carts/${uuid}`,\n createRedirectUrl: (uuid: string) => `/carts/${uuid}/redirect_urls`,\n items: {\n path: (uuid: string) => `/carts/${uuid}/items`,\n byId: (cartUuid: string, itemUuid: string) => `/carts/${cartUuid}/items/${itemUuid}`,\n },\n metafields: {\n batch: '/carts/metafields',\n path: (uuid: string) => `/carts/${uuid}/metafields`,\n byId: (cartUuid: string, metafieldUuid: string) => `/carts/${cartUuid}/metafields/${metafieldUuid}`,\n },\n settings: {\n global: '/carts/settings',\n channel: (channelId: number) => `/carts/settings/${channelId}`,\n },\n};\n\nconst channels = {\n path: '/channels',\n byId: (id: number) => `/channels/${id}`,\n activeTheme: (id: number) => `/channels/${id}/active-theme`,\n site: (id: number) => `/channels/${id}/site`,\n menus: (id: number) => `/channels/${id}/channel-menus`,\n checkoutUrl: (id: number) => `/channels/${id}/site/checkout-url`,\n currencyAssignments: {\n path: (id: number) => `/channels/${id}/currency-assignments`,\n byId: (channelId: number, id: number) => `/channels/${channelId}/currency-assignments/${id}`,\n },\n listings: {\n path: (id: number) => `/channels/${id}/listings`,\n byId: (channelId: number, id: number) => `/channels/${channelId}/listings/${id}`,\n },\n metafields: {\n batch: '/channels/metafields',\n path: (id: number) => `/channels/${id}/metafields`,\n byId: (channelId: number, id: number) => `/channels/${channelId}/metafields/${id}`,\n },\n};\n\nconst checkouts = {\n path: (uuid: string) => `/checkouts/${uuid}`,\n billingAddress: (uuid: string) => `/checkouts/${uuid}/billing-address`,\n consignments: {\n path: (uuid: string) => `/checkouts/${uuid}/consignments`,\n byId: (checkoutUuid: string, consignmentUuid: string) =>\n `/checkouts/${checkoutUuid}/consignments/${consignmentUuid}`,\n },\n coupons: {\n add: (uuid: string) => `/checkouts/${uuid}/coupons`,\n delete: (uuid: string, code: string) => `/checkouts/${uuid}/coupons/${code}`,\n },\n discounts: (uuid: string) => `/checkouts/${uuid}/discounts`,\n fees: (uuid: string) => `/checkouts/${uuid}/fees`,\n createOrder: (uuid: string) => `/checkouts/${uuid}/orders`,\n settings: '/checkouts/settings',\n createToken: (uuid: string) => `/checkouts/${uuid}/token`,\n};\n\nconst currencies = {\n v2: {\n path: '/currencies',\n byId: (id: string) => `/currencies/${id}`,\n },\n};\n\nconst customers = {\n path: '/customers',\n addresses: (id: number) => `/customers/${id}/addresses`,\n attributes: (id: number) => `/customers/${id}/attributes`,\n attributesValues: (id: number) => `/customers/${id}/attribute-values`,\n settings: {\n channel: (channelId: number) => `/customers/settings/channels/${channelId}`,\n global: '/customers/settings',\n },\n consent: (id: number) => `/customers/${id}/consent`,\n formFieldValues: '/customers/form-field-values',\n storedInstruments: (id: number) => `/customers/${id}/stored-instruments`,\n validateCredentials: '/customers/validate-credentials',\n metafields: {\n batch: '/customers/metafields',\n path: (id: number) => `/customers/${id}/metafields`,\n byId: (customerId: number, id: number) => `/customers/${customerId}/metafields/${id}`,\n },\n v2: {\n groups: {\n path: '/customer_groups',\n byId: (id: number) => `/customer_groups/${id}`,\n count: '/customer_groups/count',\n },\n deprecated: {\n path: '/customers',\n byId: (id: number) => `/customers/${id}`,\n addresses: {\n path: (id: number) => `/customers/${id}/addresses`,\n byId: (customerId: number, id: number) => `/customers/${customerId}/addresses/${id}`,\n },\n validatePassword: (id: number) => `/customers/${id}/validate_password`,\n },\n },\n subscribers: {\n path: '/customers/subscribers',\n byId: (id: number) => `/customers/subscribers/${id}`,\n },\n};\n\nexport const customerSegmentation = {\n segments: '/segments',\n shopperProfileSegments: (profileId: string) => `/shopper-profiles/${profileId}/segments`,\n shopperProfiles: '/shopper-profiles',\n segmentShopperProfiles: (segmentId: string) => `/segments/${segmentId}/shopper-profiles`,\n};\n\nexport const geography = {\n v2: {\n countries: {\n path: '/countries',\n byId: (id: string) => `/countries/${id}`,\n count: '/countries/count',\n states: {\n path: (id: string) => `/countries/${id}/states`,\n byId: (countryId: string, id: string) => `/countries/${countryId}/states/${id}`,\n count: (countryId: string) => `/countries/${countryId}/states/count`,\n },\n },\n states: {\n path: '/countries/states',\n count: '/countries/states/count',\n },\n },\n};\n\nconst inventory = {\n adjustments: {\n absolute: '/inventory/adjustments/absolute',\n relative: '/inventory/adjustments/relative',\n },\n items: {\n path: '/inventory/items',\n atLocation: (locationId: string) => `/inventory/locations/${locationId}/items`,\n updateLocationSettings: (locationId: string) => `/inventory/locations/${locationId}/items`,\n },\n};\n\nconst locations = {\n path: '/inventory/locations',\n metafields: {\n batch: '/inventory/locations/metafields',\n path: (id: string) => `/inventory/locations/${id}/metafields`,\n byId: (locationId: string, id: string) => `/inventory/locations/${locationId}/metafields/${id}`,\n },\n};\n\nconst ordersV2 = {\n path: '/orders',\n byId: (id: number) => `/orders/${id}`,\n count: '/orders/count',\n consignments: {\n path: (id: number) => `/orders/${id}/consignments`,\n shippingQuotes: (orderId: number, consignmentId: number) =>\n `/orders/${orderId}/consignments/shipping/${consignmentId}/shipping_quotes`,\n },\n coupons: (id: number) => `/orders/${id}/coupons`,\n fees: (id: number) => `/orders/${id}/fees`,\n messages: (id: number) => `/orders/${id}/messages`,\n products: {\n path: (id: number) => `/orders/${id}/products`,\n byId: (orderId: number, id: number) => `/orders/${orderId}/products/${id}`,\n },\n shipments: {\n path: (id: number) => `/orders/${id}/shipments`,\n count: (id: number) => `/orders/${id}/shipments/count`,\n byId: (orderId: number, id: number) => `/orders/${orderId}/shipments/${id}`,\n },\n shippingAddresses: {\n path: (id: number) => `/orders/${id}/shipping_addresses`,\n byId: (orderId: number, id: number) => `/orders/${orderId}/shipping_addresses/${id}`,\n quotes: (orderId: number, id: number) => `/orders/${orderId}/shipping_addresses/${id}/shipping_quotes`,\n },\n statuses: {\n path: '/order_statuses',\n byId: (id: number) => `/order_statuses/${id}`,\n },\n taxes: (id: number) => `/orders/${id}/taxes`,\n};\n\nconst orders = {\n v2: ordersV2,\n transactions: (id: number) => `/orders/${id}/transactions`,\n metafields: {\n batch: '/orders/metafields',\n path: (id: number) => `/orders/${id}/metafields`,\n byId: (orderId: number, id: number) => `/orders/${orderId}/metafields/${id}`,\n },\n settings: {\n global: '/orders/settings',\n channel: (channelId: number) => `/orders/settings/${channelId}`,\n },\n payments: {\n capture: (id: number) => `/orders/${id}/payment_actions/capture`,\n void: (id: number) => `/orders/${id}/payment_actions/void`,\n },\n refunds: {\n path: '/orders/payment_actions/refunds',\n byId: (refundId: number) => `/orders/payment_actions/refunds/${refundId}`,\n quote: (id: number) => `/orders/${id}/payment_actions/refund_quote`,\n forOrder: (id: number) => `/orders/${id}/payment_actions/refunds`,\n },\n pickups: {\n path: '/orders/pickups',\n methods: '/pickup/methods',\n options: '/pickup/options',\n },\n};\n\nconst priceLists = {\n path: '/pricelists',\n byId: (id: number) => `/pricelists/${id}`,\n assignments: {\n path: '/pricelists/assignments',\n byId: (id: number) => `/pricelists/assignments/${id}`,\n },\n records: {\n path: '/pricelists/records',\n forList: (id: number) => `/pricelists/${id}/records`,\n byVariant: (listId: number, variantId: number) => `/pricelists/${listId}/records/${variantId}`,\n byCurrency: (listId: number, variantId: number, currencyCode: string) =>\n `/pricelists/${listId}/records/${variantId}/${currencyCode}`,\n },\n};\n\nconst promotions = {\n path: '/promotions',\n byId: (id: number) => `/promotions/${id}`,\n coupons: {\n path: (promotionId: number) => `/promotions/${promotionId}/codes`,\n byId: (promotionId: number, id: number) => `/promotions/${promotionId}/codes/${id}`,\n },\n settings: '/promotions/settings',\n};\n\nconst redirects = {\n path: '/storefront/redirects',\n imexJobs: '/storefront/redirects/imex/jobs',\n createExportJob: '/storefront/redirects/imex/export',\n createImportJob: '/storefront/redirects/imex/import',\n exportEventStream: (jobUuid: string) => `/storefront/redirects/imex/export/${jobUuid}/events`,\n importEventStream: (jobUuid: string) => `/storefront/redirects/imex/import/${jobUuid}/events`,\n downloadExport: (jobUuid: string) => `/storefront/redirects/imex/export/${jobUuid}/download`,\n};\n\nconst scripts = {\n path: '/content/scripts',\n byId: (uuid: string) => `/content/scripts/${uuid}`,\n};\n\nconst settings = {\n analytics: {\n providers: '/settings/analytics',\n provider: (providerId: string) => `/settings/analytics/${providerId}`,\n },\n catalog: '/settings/catalog',\n emailStatuses: '/settings/email-statuses',\n createFavicon: '/settings/favicon/image',\n inventory: {\n path: '/settings/inventory',\n notifications: '/settings/inventory/notifications',\n },\n logo: {\n path: '/settings/logo',\n image: '/settings/logo/image',\n },\n filters: {\n enabled: '/settings/search/filters',\n available: '/settings/search/filters/available',\n contextual: '/settings/search/filters/contexts',\n },\n locale: '/settings/locale',\n profile: '/settings/profile',\n storefront: {\n category: '/settings/storefront/category',\n product: '/settings/storefront/product',\n robotstxt: '/settings/storefront/robotstxt',\n search: '/settings/storefront/search',\n security: '/settings/storefront/security',\n seo: '/settings/storefront/seo',\n status: '/settings/storefront/status',\n uom: '/settings/storefront/units-of-measurement',\n },\n};\n\nconst shippingV2 = {\n carrierConnections: '/shipping/carrier/connection',\n methods: {\n path: (zoneId: number) => `/shipping/zones/${zoneId}/methods`,\n byId: (zoneId: number, id: number) => `/shipping/zones/${zoneId}/methods/${id}`,\n },\n zones: {\n path: '/shipping/zones',\n byId: (id: number) => `/shipping/zones/${id}`,\n },\n};\n\nconst shipping = {\n v2: shippingV2,\n customsInformation: '/shipping/products/customs-information',\n settings: {\n global: '/shipping/settings',\n channel: (channelId: number) => `/shipping/settings/${channelId}`,\n },\n};\n\nconst sites = {\n path: '/sites',\n byId: (id: number) => `/sites/${id}`,\n certificates: {\n all: '/sites/certificates',\n forSite: (id: number) => `/sites/${id}/certificates`,\n },\n routes: {\n path: (siteId: number) => `/sites/${siteId}/routes`,\n byId: (siteId: number, id: number) => `/sites/${siteId}/routes/${id}`,\n },\n};\n\nconst store = {\n v2: {\n info: '/store',\n time: '/time',\n },\n metafields: {\n batch: '/store/metafields',\n path: (id: number) => `/store/metafields/${id}`,\n byId: (storeId: number, id: number) => `/store/metafields/${storeId}/${id}`,\n },\n logs: '/store/systemlogs',\n};\n\nconst tax = {\n v2: {\n classes: {\n path: '/tax_classes',\n byId: (id: number) => `/tax_classes/${id}`,\n },\n },\n customers: '/tax/customers',\n rates: '/tax/rates',\n zones: '/tax/zones',\n properties: '/tax/properties',\n productProperties: '/tax/products/properties',\n settings: '/tax/settings',\n};\n\nconst wishlists = {\n path: '/wishlists',\n byId: (id: number) => `/wishlists/${id}`,\n items: {\n delete: (id: number, itemId: number) => `/wishlists/${id}/items/${itemId}`,\n add: (id: number) => `/wishlists/${id}/items`,\n },\n};\n\nconst webhooks = {\n path: '/hooks',\n byId: (id: number) => `/hooks/${id}`,\n admin: '/hooks/admin',\n upsertEmailNotifications: '/hooks/admin',\n};\n\nexport const bc = {\n catalogSummary,\n products,\n modifiers,\n variantOptions,\n variants,\n brands,\n categories,\n trees,\n abandonedCarts,\n carts,\n channels,\n checkouts,\n currencies,\n customers,\n customerSegmentation,\n geography,\n inventory,\n locations,\n orders,\n priceLists,\n promotions,\n redirects,\n scripts,\n settings,\n shipping,\n sites,\n store,\n tax,\n wishlists,\n webhooks,\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,IAAM,iBAAiB;AAEvB,IAAM,WAAW;AAAA,EACb,MAAM;AAAA,EACN,MAAM,CAAC,OAAe,qBAAqB,EAAE;AAAA,EAC7C,aAAa;AAAA,EACb,YAAY;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,MACL,MAAM,CAAC,cAAsB,qBAAqB,SAAS;AAAA,MAC3D,MAAM,CAAC,WAAmB,OAAe,qBAAqB,SAAS,eAAe,EAAE;AAAA,IAC5F;AAAA,EACJ;AAAA,EACA,kBAAkB;AAAA,IACd,MAAM,CAAC,cAAsB,qBAAqB,SAAS;AAAA,IAC3D,MAAM,CAAC,WAAmB,OAAe,qBAAqB,SAAS,uBAAuB,EAAE;AAAA,EACpG;AAAA,EACA,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,cAAc;AAAA,IACV,MAAM,CAAC,cAAsB,qBAAqB,SAAS;AAAA,IAC3D,MAAM,CAAC,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;AAAA,EACN,MAAM,CAAC,OAAe,cAAc,EAAE;AAAA,EACtC,OAAO;AAAA,IACH,QAAQ,CAAC,IAAY,WAAmB,cAAc,EAAE,UAAU,MAAM;AAAA,IACxE,KAAK,CAAC,OAAe,cAAc,EAAE;AAAA,EACzC;AACJ;AAEA,IAAM,WAAW;AAAA,EACb,MAAM;AAAA,EACN,MAAM,CAAC,OAAe,UAAU,EAAE;AAAA,EAClC,OAAO;AAAA,EACP,0BAA0B;AAC9B;AAEO,IAAM,KAAK;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -52,11 +52,14 @@ var request = async (options) => {
|
|
|
52
52
|
if (err.status === 429 && typeof err.data === "object" && err.data !== null && "headers" in err.data) {
|
|
53
53
|
const headers = err.data.headers;
|
|
54
54
|
const retryAfter = Number.parseInt(headers[CONFIG.HEADERS.RETRY_AFTER]);
|
|
55
|
-
logger?.debug(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
logger?.debug(
|
|
56
|
+
{
|
|
57
|
+
retryAfter,
|
|
58
|
+
retries,
|
|
59
|
+
remaining: headers[CONFIG.HEADERS.REQUESTS_LEFT]
|
|
60
|
+
},
|
|
61
|
+
"Rate limit hit, retrying"
|
|
62
|
+
);
|
|
60
63
|
if (Number.isNaN(retryAfter)) {
|
|
61
64
|
throw new RequestError(
|
|
62
65
|
err.status,
|
|
@@ -66,10 +69,13 @@ var request = async (options) => {
|
|
|
66
69
|
);
|
|
67
70
|
}
|
|
68
71
|
if (retryAfter > maxDelay) {
|
|
69
|
-
logger?.warn(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
logger?.warn(
|
|
73
|
+
{
|
|
74
|
+
retryAfter,
|
|
75
|
+
maxDelay
|
|
76
|
+
},
|
|
77
|
+
"Rate limit delay exceeds maximum allowed delay"
|
|
78
|
+
);
|
|
73
79
|
throw new RequestError(
|
|
74
80
|
err.status,
|
|
75
81
|
`Rate limit exceeded: ${retryAfter}ms, ${err.message}`,
|
|
@@ -84,10 +90,13 @@ var request = async (options) => {
|
|
|
84
90
|
throw err;
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
|
-
logger?.error(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
logger?.error(
|
|
94
|
+
{
|
|
95
|
+
retries,
|
|
96
|
+
error: lastError
|
|
97
|
+
},
|
|
98
|
+
"Request failed after maximum retries"
|
|
99
|
+
);
|
|
91
100
|
throw lastError ?? new RequestError(500, "Failed to make request", "Too many retries after rate limit");
|
|
92
101
|
};
|
|
93
102
|
var safeRequest = async (options) => {
|
|
@@ -100,12 +109,15 @@ var safeRequest = async (options) => {
|
|
|
100
109
|
throw error;
|
|
101
110
|
}
|
|
102
111
|
if (!(error instanceof HTTPError)) {
|
|
103
|
-
logger?.error(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
logger?.error(
|
|
113
|
+
{
|
|
114
|
+
error: error instanceof Error ? {
|
|
115
|
+
name: error.name,
|
|
116
|
+
message: error.message
|
|
117
|
+
} : error
|
|
118
|
+
},
|
|
119
|
+
"Unexpected error during request"
|
|
120
|
+
);
|
|
109
121
|
throw error;
|
|
110
122
|
}
|
|
111
123
|
let data;
|
|
@@ -122,10 +134,13 @@ var safeRequest = async (options) => {
|
|
|
122
134
|
} catch {
|
|
123
135
|
data = "Failed to read error response";
|
|
124
136
|
}
|
|
125
|
-
logger?.error(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
137
|
+
logger?.error(
|
|
138
|
+
{
|
|
139
|
+
status: error?.response?.status,
|
|
140
|
+
errorMessage
|
|
141
|
+
},
|
|
142
|
+
"HTTP error during request"
|
|
143
|
+
);
|
|
129
144
|
throw new RequestError(
|
|
130
145
|
error?.response?.status ?? 500,
|
|
131
146
|
errorMessage,
|
|
@@ -146,31 +161,41 @@ var safeRequest = async (options) => {
|
|
|
146
161
|
try {
|
|
147
162
|
return JSON.parse(text);
|
|
148
163
|
} catch (error) {
|
|
149
|
-
logger?.error(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
`Failed to parse response: ${text}`,
|
|
159
|
-
text,
|
|
160
|
-
error
|
|
164
|
+
logger?.error(
|
|
165
|
+
{
|
|
166
|
+
status: res.status,
|
|
167
|
+
error: error instanceof Error ? {
|
|
168
|
+
name: error.name,
|
|
169
|
+
message: error.message
|
|
170
|
+
} : error
|
|
171
|
+
},
|
|
172
|
+
"Failed to parse response"
|
|
161
173
|
);
|
|
174
|
+
throw new RequestError(res.status, `Failed to parse response: ${text}`, text, error);
|
|
162
175
|
}
|
|
163
176
|
};
|
|
164
177
|
var call = async (options) => {
|
|
165
|
-
const {
|
|
178
|
+
const {
|
|
179
|
+
storeHash,
|
|
180
|
+
accessToken,
|
|
181
|
+
endpoint,
|
|
182
|
+
method = "GET",
|
|
183
|
+
body,
|
|
184
|
+
version = CONFIG.DEFAULT_VERSION,
|
|
185
|
+
query,
|
|
186
|
+
logger
|
|
187
|
+
} = options;
|
|
166
188
|
const url = `${CONFIG.BASE_URL}${storeHash}/${version}/${endpoint.replace(/^\//, "")}`;
|
|
167
189
|
const searchParams = query ? new URLSearchParams(query).toString() : "";
|
|
168
190
|
const fullUrl = searchParams ? `${url}?${searchParams}` : url;
|
|
169
191
|
if (fullUrl.length > CONFIG.MAX_URL_LENGTH) {
|
|
170
|
-
logger?.error(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
192
|
+
logger?.error(
|
|
193
|
+
{
|
|
194
|
+
urlLength: fullUrl.length,
|
|
195
|
+
maxLength: CONFIG.MAX_URL_LENGTH
|
|
196
|
+
},
|
|
197
|
+
"URL length exceeds maximum allowed length"
|
|
198
|
+
);
|
|
174
199
|
throw new RequestError(
|
|
175
200
|
400,
|
|
176
201
|
"URL too long",
|
|
@@ -181,7 +206,7 @@ var call = async (options) => {
|
|
|
181
206
|
method,
|
|
182
207
|
headers: {
|
|
183
208
|
"Content-Type": "application/json",
|
|
184
|
-
|
|
209
|
+
Accept: "application/json",
|
|
185
210
|
"X-Auth-Token": accessToken
|
|
186
211
|
},
|
|
187
212
|
json: body
|
|
@@ -223,10 +248,7 @@ var chunkStrLength = (items, options = {}) => {
|
|
|
223
248
|
var MAX_PAGE_SIZE = 250;
|
|
224
249
|
var DEFAULT_CONCURRENCY = 10;
|
|
225
250
|
function chunkArray(array, size) {
|
|
226
|
-
return Array.from(
|
|
227
|
-
{ length: Math.ceil(array.length / size) },
|
|
228
|
-
(_, i) => array.slice(i * size, i * size + size)
|
|
229
|
-
);
|
|
251
|
+
return Array.from({ length: Math.ceil(array.length / size) }, (_, i) => array.slice(i * size, i * size + size));
|
|
230
252
|
}
|
|
231
253
|
function rangeArray(start, end) {
|
|
232
254
|
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
@@ -325,9 +347,12 @@ var BigCommerceClient = class {
|
|
|
325
347
|
if (!skipErrors) {
|
|
326
348
|
throw result.reason;
|
|
327
349
|
} else {
|
|
328
|
-
this.config.logger?.warn(
|
|
329
|
-
|
|
330
|
-
|
|
350
|
+
this.config.logger?.warn(
|
|
351
|
+
{
|
|
352
|
+
error: result.reason
|
|
353
|
+
},
|
|
354
|
+
"Error in concurrent request"
|
|
355
|
+
);
|
|
331
356
|
}
|
|
332
357
|
}
|
|
333
358
|
}
|
|
@@ -344,13 +369,16 @@ var BigCommerceClient = class {
|
|
|
344
369
|
async concurrentSettled(requests, options) {
|
|
345
370
|
const chunkSize = options?.concurrency ?? this.config.concurrency ?? DEFAULT_CONCURRENCY;
|
|
346
371
|
const chunks = chunkArray(requests, chunkSize);
|
|
347
|
-
this.config.logger?.debug(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
372
|
+
this.config.logger?.debug(
|
|
373
|
+
{
|
|
374
|
+
totalRequests: requests.length,
|
|
375
|
+
chunkSize,
|
|
376
|
+
chunks: chunks.length
|
|
377
|
+
},
|
|
378
|
+
"Starting concurrent requests with detailed results"
|
|
379
|
+
);
|
|
352
380
|
const allResults = [];
|
|
353
|
-
for (const chunk of chunks) {
|
|
381
|
+
for (const [index, chunk] of chunks.entries()) {
|
|
354
382
|
const responses = await Promise.allSettled(
|
|
355
383
|
chunk.map(
|
|
356
384
|
(opt) => request({
|
|
@@ -359,6 +387,16 @@ var BigCommerceClient = class {
|
|
|
359
387
|
})
|
|
360
388
|
)
|
|
361
389
|
);
|
|
390
|
+
this.config.logger?.debug(
|
|
391
|
+
{
|
|
392
|
+
chunkIndex: index,
|
|
393
|
+
chunkSize: chunk.length,
|
|
394
|
+
totalRequests: requests.length,
|
|
395
|
+
totalChunks: chunks.length,
|
|
396
|
+
responses: responses.map((response) => response.status)
|
|
397
|
+
},
|
|
398
|
+
"Completed chunk"
|
|
399
|
+
);
|
|
362
400
|
allResults.push(...responses);
|
|
363
401
|
}
|
|
364
402
|
return allResults;
|
|
@@ -388,10 +426,13 @@ var BigCommerceClient = class {
|
|
|
388
426
|
const results = [...first.data];
|
|
389
427
|
const pages = first.meta.pagination.total_pages;
|
|
390
428
|
if (pages > 1) {
|
|
391
|
-
this.config.logger?.debug(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
429
|
+
this.config.logger?.debug(
|
|
430
|
+
{
|
|
431
|
+
totalPages: pages,
|
|
432
|
+
itemsPerPage: first.data.length
|
|
433
|
+
},
|
|
434
|
+
"Collecting remaining pages"
|
|
435
|
+
);
|
|
395
436
|
const pageRequests = rangeArray(2, pages).map((page) => ({
|
|
396
437
|
endpoint,
|
|
397
438
|
method: "GET",
|
|
@@ -455,12 +496,15 @@ var BigCommerceClient = class {
|
|
|
455
496
|
if (!(options.skipErrors ?? this.config.skipErrors ?? false)) {
|
|
456
497
|
throw response.reason;
|
|
457
498
|
} else {
|
|
458
|
-
this.config.logger?.warn(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
499
|
+
this.config.logger?.warn(
|
|
500
|
+
{
|
|
501
|
+
error: response.reason instanceof Error ? {
|
|
502
|
+
name: response.reason.name,
|
|
503
|
+
message: response.reason.message
|
|
504
|
+
} : response.reason
|
|
505
|
+
},
|
|
506
|
+
"Error in collectV2"
|
|
507
|
+
);
|
|
464
508
|
}
|
|
465
509
|
}
|
|
466
510
|
}
|
|
@@ -469,10 +513,10 @@ var BigCommerceClient = class {
|
|
|
469
513
|
return results;
|
|
470
514
|
}
|
|
471
515
|
/**
|
|
472
|
-
* Queries multiple values against a single field using the v3 API.
|
|
516
|
+
* Queries multiple values against a single field using the v3 API.
|
|
473
517
|
* If the url + query params are too long, the query will be chunked. Otherwise, this method acts like `collect`.
|
|
474
518
|
* This method does not check for uniqueness of the `values` array.
|
|
475
|
-
*
|
|
519
|
+
*
|
|
476
520
|
* @param endpoint - The API endpoint to request
|
|
477
521
|
* @param options.key - The field name to query against e.g. `sku:in`
|
|
478
522
|
* @param options.values - Array of values to query for e.g. `['123', '456', ...]`
|
|
@@ -500,13 +544,16 @@ var BigCommerceClient = class {
|
|
|
500
544
|
offset,
|
|
501
545
|
chunkLength
|
|
502
546
|
});
|
|
503
|
-
this.config.logger?.debug(
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
547
|
+
this.config.logger?.debug(
|
|
548
|
+
{
|
|
549
|
+
offset,
|
|
550
|
+
totalValues: options.values.length,
|
|
551
|
+
chunks: chunks.length,
|
|
552
|
+
valuesPerChunk: chunks[0]?.length,
|
|
553
|
+
separatorSize
|
|
554
|
+
},
|
|
555
|
+
"Querying with chunked values"
|
|
556
|
+
);
|
|
510
557
|
const requests = chunks.map((chunk) => ({
|
|
511
558
|
...options,
|
|
512
559
|
endpoint,
|
|
@@ -557,11 +604,14 @@ var BigCommerceAuth = class {
|
|
|
557
604
|
grant_type: GRANT_TYPE,
|
|
558
605
|
redirect_uri: this.config.redirectUri
|
|
559
606
|
};
|
|
560
|
-
this.config.logger?.debug(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
607
|
+
this.config.logger?.debug(
|
|
608
|
+
{
|
|
609
|
+
clientId: this.config.clientId,
|
|
610
|
+
context: query.context,
|
|
611
|
+
scopes: query.scope
|
|
612
|
+
},
|
|
613
|
+
"Requesting OAuth token"
|
|
614
|
+
);
|
|
565
615
|
let res;
|
|
566
616
|
try {
|
|
567
617
|
res = await ky2(TOKEN_ENDPOINT, {
|
|
@@ -605,10 +655,13 @@ var BigCommerceAuth = class {
|
|
|
605
655
|
issuer: ISSUER,
|
|
606
656
|
subject: `stores/${storeHash}`
|
|
607
657
|
});
|
|
608
|
-
this.config.logger?.debug(
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
658
|
+
this.config.logger?.debug(
|
|
659
|
+
{
|
|
660
|
+
userId: payload.user?.id,
|
|
661
|
+
storeHash: payload.sub.split("/")[1]
|
|
662
|
+
},
|
|
663
|
+
"JWT verified successfully"
|
|
664
|
+
);
|
|
612
665
|
return payload;
|
|
613
666
|
} catch (error) {
|
|
614
667
|
this.config.logger?.error({
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/net.ts", "../src/util.ts", "../src/client.ts", "../src/auth.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Network utilities for interacting with the BigCommerce API.\n * Provides rate-limited request handling, error management, and type-safe API calls.\n */\n\nimport ky, { KyResponse, HTTPError } from 'ky';\nimport { Logger } from './core';\n\n/** HTTP methods supported by the API */\nexport type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';\n\nexport const Methods: Record<string, Method> = {\n GET: 'GET',\n POST: 'POST',\n PUT: 'PUT',\n DELETE: 'DELETE',\n} as const;\n\nexport const BASE_URL = 'https://api.bigcommerce.com/stores/';\n\n/** Configuration for the BigCommerce API client */\nconst CONFIG = {\n /** Base URL for BigCommerce API */\n BASE_URL,\n /** Default API version to use */\n DEFAULT_VERSION: 'v3',\n /** Maximum delay in milliseconds for rate limit retries */\n DEFAULT_MAX_DELAY: 60e3,\n /** Maximum allowed URL length */\n MAX_URL_LENGTH: 2048,\n /** Default maximum number of retries for rate-limited requests */\n DEFAULT_MAX_RETRIES: 5,\n /** Rate limit header names */\n HEADERS: {\n /** Time window for rate limiting in milliseconds */\n WINDOW: 'x-rate-limit-time-window-ms',\n /** Time to wait before retrying after rate limit in milliseconds */\n RETRY_AFTER: 'x-rate-limit-time-reset-ms',\n /** Total request quota for the time window */\n REQUEST_QUOTA: 'x-rate-limit-requests-quota',\n /** Number of requests remaining in the current window */\n REQUESTS_LEFT: 'x-rate-limit-requests-left',\n }\n} as const;\n\n/** Supported BigCommerce API versions */\nexport type ApiVersion = 'v3' | 'v2';\n\n/**\n * Options for making API requests\n * @template T - Type of the request body\n */\nexport type RequestOptions<T> = {\n /** API endpoint to call */\n endpoint: string;\n /** HTTP method to use */\n method?: Method;\n /** Request body data */\n body?: T;\n /** API version to use */\n version?: ApiVersion;\n /** Query parameters to append to the URL */\n query?: Record<string, string>;\n};\n\nexport type StoreOptions = {\n /** BigCommerce store hash */\n storeHash: string;\n /** API access token */\n accessToken: string;\n}\n\n/**\n * Options for rate limit handling\n */\nexport type RateLimitOptions = {\n /** Maximum delay in milliseconds before giving up on rate-limited requests */\n maxDelay?: number;\n /** Maximum number of retries for rate-limited requests */\n maxRetries?: number;\n};\n\n/**\n * Custom error class for API request failures\n * @template T - Type of the error data\n */\nexport class RequestError<T> extends Error {\n constructor(\n public status: number,\n public message: string,\n public data: T | string,\n public cause?: unknown,\n ) {\n super(message, { cause });\n }\n}\n\n/**\n * Makes an API request with rate limit handling\n * @template T - Type of the request body and response\n * @param options - Request options including rate limit settings\n * @returns Promise resolving to the API response\n * @throws {RequestError} If the request fails or rate limit is exceeded\n */\nexport const request = async <T, R>(options: RequestOptions<T> & RateLimitOptions & StoreOptions & {\n logger?: Logger;\n}): Promise<R> => {\n const { maxDelay = CONFIG.DEFAULT_MAX_DELAY, maxRetries = CONFIG.DEFAULT_MAX_RETRIES, logger } = options;\n\n let retries = 0;\n let lastError: RequestError<T> | null = null;\n\n while (retries < maxRetries) {\n try {\n return await safeRequest<T, R>(options);\n } catch (error) {\n const err = error as RequestError<T>;\n lastError = err;\n\n if (err.status === 429 && typeof err.data === 'object' && err.data !== null && 'headers' in err.data) {\n const headers = err.data.headers as Record<string, string>;\n const retryAfter = Number.parseInt(headers[CONFIG.HEADERS.RETRY_AFTER]);\n\n logger?.debug({\n retryAfter,\n retries,\n remaining: headers[CONFIG.HEADERS.REQUESTS_LEFT]\n }, 'Rate limit hit, retrying');\n\n if (Number.isNaN(retryAfter)) {\n throw new RequestError(\n err.status,\n `Failed to parse retry after: ${headers[CONFIG.HEADERS.RETRY_AFTER]}, ${err.message}`,\n err.data,\n err.cause,\n );\n }\n\n if (retryAfter > maxDelay) {\n logger?.warn({\n retryAfter,\n maxDelay\n }, 'Rate limit delay exceeds maximum allowed delay');\n throw new RequestError(\n err.status,\n `Rate limit exceeded: ${retryAfter}ms, ${err.message}`,\n err.data,\n err.cause,\n );\n }\n\n await new Promise((resolve) => setTimeout(resolve, retryAfter));\n retries++;\n continue;\n }\n\n throw err;\n }\n }\n\n logger?.error({\n retries,\n error: lastError\n }, 'Request failed after maximum retries');\n\n throw lastError ?? new RequestError(500, 'Failed to make request', 'Too many retries after rate limit');\n};\n\n/**\n * Makes a single API request with error handling\n * @template T - Type of the request body and response\n * @param options - Request options\n * @returns Promise resolving to the API response\n * @throws {RequestError} If the request fails\n */ \nconst safeRequest = async <T, R>(options: RequestOptions<T> & StoreOptions & {\n logger?: Logger;\n}): Promise<R> => {\n const { logger } = options;\n let res: KyResponse<T>;\n\n try {\n res = await call<T, R>(options);\n } catch (error) {\n if(error instanceof RequestError) {\n throw error;\n }\n\n if(!(error instanceof HTTPError)) {\n logger?.error({\n error: error instanceof Error ? {\n name: error.name,\n message: error.message\n } : error\n }, 'Unexpected error during request');\n throw error;\n }\n\n let data: unknown;\n let errorMessage = error.message;\n\n try {\n data = await error.response.text();\n try {\n data = JSON.parse(data as string);\n\n if (typeof data === 'object' && data !== null && 'message' in data) {\n errorMessage = data.message as string;\n }\n } catch {\n // If JSON parsing fails, keep the text response\n }\n } catch {\n data = 'Failed to read error response';\n }\n\n logger?.error({\n status: error?.response?.status,\n errorMessage\n }, 'HTTP error during request');\n\n throw new RequestError(\n error?.response?.status ?? 500,\n errorMessage,\n {\n data,\n endpoint: options.endpoint,\n query: options.query,\n body: options.body,\n headers: Object.fromEntries(error?.response?.headers?.entries() ?? []),\n },\n error,\n );\n }\n\n const text = await res.text();\n\n if(res.status === 204) {\n return undefined as unknown as R;\n }\n\n try {\n return JSON.parse(text);\n } catch (error) {\n logger?.error({\n status: res.status,\n error: error instanceof Error ? {\n name: error.name,\n message: error.message\n } : error\n }, 'Failed to parse response');\n throw new RequestError(\n res.status,\n `Failed to parse response: ${text}`,\n text,\n error\n );\n }\n};\n\n/**\n * Internal function to make the actual HTTP request\n * @template T - Type of the request body and response\n * @param options - Request options\n * @returns Promise resolving to the raw response\n * @throws {RequestError} If the URL is too long or request fails\n */\nconst call = async <T, R>(options: RequestOptions<T> & StoreOptions & {\n logger?: Logger;\n}): Promise<KyResponse<R>> => {\n const { storeHash, accessToken, endpoint, method = 'GET', body, version = CONFIG.DEFAULT_VERSION, query, logger } = options;\n\n const url = `${CONFIG.BASE_URL}${storeHash}/${version}/${endpoint.replace(/^\\//, '')}`;\n \n // Check URL length including search params\n const searchParams = query ? new URLSearchParams(query).toString() : '';\n const fullUrl = searchParams ? `${url}?${searchParams}` : url;\n \n if (fullUrl.length > CONFIG.MAX_URL_LENGTH) {\n logger?.error({\n urlLength: fullUrl.length,\n maxLength: CONFIG.MAX_URL_LENGTH\n }, 'URL length exceeds maximum allowed length');\n throw new RequestError(\n 400,\n 'URL too long',\n `URL length ${fullUrl.length} exceeds maximum allowed length of ${CONFIG.MAX_URL_LENGTH}`,\n );\n }\n\n const request = {\n method,\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n 'X-Auth-Token': accessToken,\n },\n json: body,\n };\n\n const response = await ky<R>(fullUrl, request);\n return response;\n};\n", "/**\n * Split an array of strings into chunks by following logic\n *\n * 1. add length of each string + separatorSize to offset\n * 2. if result is greater than `maxLength`, start a new chunk\n * 3. otherwise, add the string to the current chunk until the chunk is of `chunkLength`\n *\n * This function to be used for splitting query params to avoid url length limit\n *\n * @param items array of strings\n * @param options\n * @param options.maxLength max length of the combined strings\n * @param options.chunkLength max length of each chunk\n * @param options.offset offset of the first chunk\n * @param options.separatorSize size of the separator\n */\nexport const chunkStrLength = (\n items: string[],\n options: {\n maxLength?: number;\n chunkLength?: number;\n offset?: number;\n separatorSize?: number;\n } = {},\n) => {\n const { maxLength = 2048, chunkLength = 250, offset = 0, separatorSize = 1 } = options;\n\n const chunks: string[][] = [];\n let currentStrLength = offset;\n let currentChunk: string[] = [];\n\n for (const item of items) {\n const itemLength = encodeURIComponent(item).length;\n const separatorLength = currentChunk.length > 0 ? separatorSize : 0;\n const totalItemLength = itemLength + separatorLength;\n\n // Check if adding this item would exceed limits\n const wouldExceedLength = currentStrLength + totalItemLength > maxLength;\n const wouldExceedCount = currentChunk.length >= chunkLength;\n\n if ((wouldExceedLength || wouldExceedCount) && currentChunk.length > 0) {\n chunks.push(currentChunk);\n currentChunk = [];\n currentStrLength = offset;\n }\n\n // Handle items that are too large even for a new chunk\n if (itemLength + offset > maxLength) {\n // Either skip, truncate, or throw error depending on requirements\n throw new Error(`Item too large: ${itemLength} exceeds maxLength ${maxLength}`);\n }\n\n currentChunk.push(item);\n currentStrLength += totalItemLength;\n }\n\n if (currentChunk.length > 0) {\n chunks.push(currentChunk);\n }\n\n return chunks;\n};\n", "import { V3Resource, Logger } from './core';\nimport { BASE_URL, RateLimitOptions, RequestError, RequestOptions, StoreOptions, request } from './net';\nimport { chunkStrLength } from './util';\n\nconst MAX_PAGE_SIZE = 250;\nconst DEFAULT_CONCURRENCY = 10;\n\n// Helper function to chunk array into smaller arrays\nfunction chunkArray<T>(array: T[], size: number): T[][] {\n return Array.from({ length: Math.ceil(array.length / size) }, (_, i) =>\n array.slice(i * size, i * size + size)\n );\n}\n\n// Helper function to create range array\nfunction rangeArray(start: number, end: number): number[] {\n return Array.from({ length: end - start + 1 }, (_, i) => start + i);\n}\n\n/**\n * Options for GET requests to the BigCommerce API\n */\nexport type GetOptions = {\n /** Query parameters to include in the request */\n query?: Record<string, string>;\n /** API version to use (v2 or v3) */\n version?: 'v2' | 'v3';\n};\n\n/**\n * Options for POST/PUT requests to the BigCommerce API\n */\nexport type PostOptions<T> = GetOptions & {\n /** Request body data */\n body: T;\n};\n\n/**\n * Options for controlling concurrent request behavior\n */\nexport type ConcurrencyOptions = {\n /** Maximum number of concurrent requests (default: 10) */\n concurrency?: number;\n /** Whether to skip errors and continue processing (default: false) */\n skipErrors?: boolean;\n};\n\n/**\n * Options for querying multiple values against a single filter field\n */\nexport type QueryOptions = Omit<GetOptions, 'version'> & ConcurrencyOptions & {\n /** The field name to query against */\n key: string;\n /** Array of values to query for */\n values: (string | number)[];\n};\n\n/**\n * Configuration options for the BigCommerce client\n */\nexport type Config = StoreOptions & RateLimitOptions & ConcurrencyOptions & {\n /** Logger instance */\n logger?: Logger;\n};\n\n/**\n * Client for interacting with the BigCommerce API\n * \n * This client provides methods for making HTTP requests to the BigCommerce API,\n * with support for both v2 and v3 endpoints, pagination, and concurrent requests.\n */\nexport class BigCommerceClient {\n /**\n * Creates a new BigCommerce client instance\n * @param config - Configuration options for the client\n * @param config.storeHash - The store hash to use for the client\n * @param config.accessToken - The API access token to use for the client\n * @param config.maxRetries - The maximum number of retries for rate limit errors (default: 5)\n * @param config.maxDelay - Maximum time to wait to retry in case of rate limit errors in milliseconds (default: 60000 - 1 minute). If `X-Rate-Limit-Time-Reset-Ms` header is higher than `maxDelay`, the request will fail immediately.\n * @param config.concurrency - The default concurrency for concurrent methods (default: 10)\n * @param config.skipErrors - Whether to skip errors during concurrent requests (default: false)\n * @param config.logger - Optional logger instance for debugging and error tracking\n */\n constructor(private readonly config: Config) {}\n\n /**\n * Makes a GET request to the BigCommerce API\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.version - API version to use (v2 or v3) (default: v3)\n * @returns Promise resolving to the response data of type `R`\n */\n async get<R>(endpoint: string, options?: GetOptions): Promise<R> {\n return request<never, R>({\n endpoint,\n method: 'GET',\n ...options,\n ...this.config,\n });\n }\n\n /**\n * Makes a POST request to the BigCommerce API\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.version - API version to use (v2 or v3) (default: v3)\n * @param options.body - Request body data of type `T`\n * @returns Promise resolving to the response data of type `R`\n */\n async post<T, R>(endpoint: string, options?: PostOptions<T>): Promise<R> {\n return request<T, R>({\n endpoint,\n method: 'POST',\n ...options,\n ...this.config,\n });\n }\n\n /**\n * Makes a PUT request to the BigCommerce API\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.version - API version to use (v2 or v3) (default: v3)\n * @param options.body - Request body data of type `T`\n * @returns Promise resolving to the response data of type `R`\n */\n async put<T, R>(endpoint: string, options?: PostOptions<T>): Promise<R> {\n return request<T, R>({\n endpoint,\n method: 'PUT',\n ...options,\n ...this.config,\n });\n }\n\n /**\n * Makes a DELETE request to the BigCommerce API\n * @param endpoint - The API endpoint to delete\n * @param options.version - API version to use (v2 or v3) (default: v3)\n * @returns Promise resolving to void\n */\n async delete<R>(endpoint: string, options?: Pick<GetOptions, 'version'>): Promise<void> {\n await request<never, R>({\n endpoint,\n method: 'DELETE',\n ...options,\n ...this.config,\n });\n }\n\n /**\n * Executes multiple requests concurrently with controlled concurrency\n * @param requests - Array of request options to execute\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @param options.skipErrors - Whether to skip errors and continue processing (the errors will be logged if logger is provided), overrides the client's skipErrors setting (default: false)\n * @returns Promise resolving to array of response data\n */\n async concurrent<T, R>(requests: RequestOptions<T>[], options?: ConcurrencyOptions): Promise<R[]> {\n const skipErrors = options?.skipErrors ?? this.config.skipErrors ?? false;\n const results = await this.concurrentSettled<T, R>(requests, options);\n\n const successfulResults: R[] = [];\n\n for (const result of results) {\n if (result.status === 'fulfilled') {\n successfulResults.push(result.value);\n } else {\n if (!skipErrors) {\n throw result.reason;\n } else {\n this.config.logger?.warn({\n error: result.reason\n }, 'Error in concurrent request');\n }\n }\n }\n\n return successfulResults;\n }\n\n /**\n * Lowest level concurrent request method.\n * This method executes requests in chunks and returns bare PromiseSettledResult objects.\n * Use this method if you need to handle errors in a custom way.\n * @param requests - Array of request options to execute\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @returns Promise resolving to array of PromiseSettledResult containing both successful and failed requests\n */\n async concurrentSettled<T, R>(requests: RequestOptions<T>[], options?: Pick<ConcurrencyOptions, 'concurrency'>): Promise<PromiseSettledResult<R>[]> {\n const chunkSize = options?.concurrency ?? this.config.concurrency ?? DEFAULT_CONCURRENCY;\n const chunks = chunkArray(requests, chunkSize);\n\n this.config.logger?.debug({\n totalRequests: requests.length,\n chunkSize,\n chunks: chunks.length\n }, 'Starting concurrent requests with detailed results');\n\n const allResults: PromiseSettledResult<R>[] = [];\n\n for (const chunk of chunks) {\n const responses = await Promise.allSettled(\n chunk.map((opt) =>\n request<T, R>({\n ...opt,\n ...this.config,\n }),\n ),\n );\n\n allResults.push(...responses);\n }\n\n return allResults;\n }\n\n /**\n * Collects all pages of data from a paginated v3 API endpoint.\n * This method pulls the first page and uses pagination meta to collect the remaining pages concurrently.\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @param options.skipErrors - Whether to skip errors and continue processing (the errors will be logged if logger is provided), overrides the client's skipErrors setting (default: false)\n * @returns Promise resolving to array of all items across all pages\n */\n async collect<T>(endpoint: string, options?: Omit<GetOptions, 'version'> & ConcurrencyOptions): Promise<T[]> {\n options = options ?? {};\n\n if (options.query) {\n if (!options.query.limit) {\n options.query.limit = MAX_PAGE_SIZE.toString();\n }\n } else {\n options.query = { limit: MAX_PAGE_SIZE.toString() };\n }\n\n const first = await this.get<V3Resource<T[]>>(endpoint, options);\n\n if (!Array.isArray(first.data) || !first?.meta?.pagination?.total_pages) {\n return first.data;\n }\n\n const results: T[] = [...first.data];\n const pages = first.meta.pagination.total_pages;\n\n if (pages > 1) {\n this.config.logger?.debug({\n totalPages: pages,\n itemsPerPage: first.data.length\n }, 'Collecting remaining pages');\n\n const pageRequests = rangeArray(2, pages).map((page) => ({\n endpoint,\n method: 'GET' as const,\n query: {\n ...options.query,\n page: page.toString(),\n },\n }));\n\n const remainingPages = await this.concurrent<never, V3Resource<T[]>>(pageRequests, options);\n\n remainingPages.forEach((page) => {\n if (Array.isArray(page.data)) {\n results.push(...page.data);\n }\n });\n }\n\n return results;\n }\n\n /**\n * Collects all pages of data from a paginated v2 API endpoint.\n * This method simply pulls all pages concurrently until a 204 is returned in a batch.\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @param options.skipErrors - Whether to skip errors and continue processing (the errors will be logged if logger is provided), overrides the client's skipErrors setting (default: false)\n * @returns Promise resolving to array of all items across all pages\n */\n async collectV2<T>(endpoint: string, options?: Omit<GetOptions, 'version'> & ConcurrencyOptions): Promise<T[]> {\n options = options ?? {};\n\n if (options.query) {\n if (!options.query.limit) {\n options.query.limit = MAX_PAGE_SIZE.toString();\n }\n } else {\n options.query = { limit: MAX_PAGE_SIZE.toString() };\n }\n\n let done = false;\n const results: T[] = [];\n let page = 1;\n const concurrency = options.concurrency ?? this.config.concurrency ?? DEFAULT_CONCURRENCY;\n\n while (!done) {\n const pages = rangeArray(page, page + concurrency);\n page += concurrency;\n\n const requests = pages.map((page) => ({\n ...options,\n endpoint,\n version: 'v2' as const,\n query: { ...options.query, page: page.toString() },\n }));\n\n const responses = await Promise.allSettled(requests.map((request) => this.get<T[]>(endpoint, request)));\n\n responses.forEach((response) => {\n if (response.status === 'fulfilled') {\n if (response.value) {\n results.push(...response.value);\n } else {\n done = true;\n }\n } else {\n if (response.reason instanceof RequestError && response.reason.status === 404) {\n done = true;\n } else {\n if (!(options.skipErrors ?? this.config.skipErrors ?? false)) {\n throw response.reason;\n } else {\n this.config.logger?.warn({\n error: response.reason instanceof Error ? {\n name: response.reason.name,\n message: response.reason.message\n } : response.reason\n }, 'Error in collectV2');\n }\n }\n }\n });\n }\n\n return results;\n }\n\n /**\n * Queries multiple values against a single field using the v3 API. \n * If the url + query params are too long, the query will be chunked. Otherwise, this method acts like `collect`.\n * This method does not check for uniqueness of the `values` array.\n * \n * @param endpoint - The API endpoint to request\n * @param options.key - The field name to query against e.g. `sku:in`\n * @param options.values - Array of values to query for e.g. `['123', '456', ...]`\n * @param options.query - Additional query parameters\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @param options.skipErrors - Whether to skip errors and continue processing (the errors will be logged if logger is provided), overrides the client's skipErrors setting (default: false)\n * @returns Promise resolving to array of matching items\n */\n async query<T>(endpoint: string, options: QueryOptions): Promise<T[]> {\n if(options.query) {\n if(!options.query.limit) {\n options.query.limit = MAX_PAGE_SIZE.toString();\n }\n } else {\n options.query = { limit: MAX_PAGE_SIZE.toString() };\n }\n\n const keySize = encodeURIComponent(options.key).length;\n const fullUrl = `${BASE_URL}${this.config.storeHash}/v3/${endpoint}?${new URLSearchParams(options.query).toString()}`;\n const offset = fullUrl.length + keySize + 1;\n const chunkLength = Number.parseInt(options.query?.limit) || MAX_PAGE_SIZE;\n const separatorSize = encodeURIComponent(',').length;\n\n const queryStr = options.values.map((value) => `${value}`)\n const chunks = chunkStrLength(queryStr, {\n separatorSize,\n offset,\n chunkLength,\n });\n\n this.config.logger?.debug({\n offset,\n totalValues: options.values.length,\n chunks: chunks.length,\n valuesPerChunk: chunks[0]?.length,\n separatorSize,\n }, 'Querying with chunked values');\n\n const requests = chunks.map((chunk) => ({\n ...options,\n endpoint,\n query: { ...options.query, [options.key]: chunk.join(',') },\n }));\n\n const responses = await this.concurrent<never, V3Resource<T[]>>(requests, options);\n\n return responses.flatMap((response) => response.data);\n }\n}\n", "import ky, { HTTPError, KyResponse } from 'ky';\nimport * as jose from 'jose';\nimport { Logger } from './core';\n\n/**\n * Configuration options for BigCommerce authentication\n */\ntype Config = {\n /** The OAuth client ID from BigCommerce */\n clientId: string;\n /** The OAuth client secret from BigCommerce */\n secret: string;\n /** The redirect URI registered with BigCommerce */\n redirectUri: string;\n /** Optional array of scopes to validate during auth callback */\n scopes?: string[];\n /** Optional logger instance */\n logger?: Logger;\n};\n\nconst GRANT_TYPE = 'authorization_code';\nconst TOKEN_ENDPOINT = 'https://login.bigcommerce.com/oauth2/token';\nconst ISSUER = 'bc';\n\n/**\n * Query parameters received from BigCommerce auth callback\n */\ntype AuthQuery = {\n /** The authorization code from BigCommerce */\n code: string;\n /** The granted OAuth scopes */\n scope: string;\n /** The store context */\n context: string;\n};\n\n/**\n * Request payload for token endpoint\n */\ntype TokenRequest = {\n client_id: string;\n client_secret: string;\n code: string;\n context: string;\n scope: string;\n grant_type: typeof GRANT_TYPE;\n redirect_uri: string;\n};\n\n/**\n * User information returned from BigCommerce\n */\nexport type User = {\n /** The user's ID */\n id: number;\n /** The user's username */\n username: string;\n /** The user's email address */\n email: string;\n};\n\n/**\n * Response from BigCommerce token endpoint\n */\nexport type TokenResponse = {\n /** The OAuth access token */\n access_token: string;\n /** The granted OAuth scopes */\n scope: string;\n /** Information about the authenticated user */\n user: User;\n /** Information about the store owner */\n owner: User;\n /** The store context */\n context: string;\n /** The BigCommerce account UUID */\n account_uuid: string;\n};\n\n/**\n * JWT claims from BigCommerce\n */\nexport type Claims = {\n /** JWT audience */\n aud: string;\n /** JWT issuer */\n iss: string;\n /** JWT issued at timestamp */\n iat: number;\n /** JWT not before timestamp */\n nbf: number;\n /** JWT expiration timestamp */\n exp: number;\n /** JWT unique identifier */\n jti: string;\n /** JWT subject */\n sub: string;\n /** Information about the authenticated user */\n user: {\n id: number;\n email: string;\n locale: string;\n };\n /** Information about the store owner */\n owner: {\n id: number;\n email: string;\n };\n /** The store URL */\n url: string;\n /** The channel ID (if applicable) */\n channel_id: number | null;\n}\n\n/**\n * Handles authentication with BigCommerce OAuth\n */\nexport class BigCommerceAuth {\n /**\n * Creates a new BigCommerceAuth instance for handling OAuth authentication\n * @param config - Configuration options for BigCommerce authentication\n * @param config.clientId - The OAuth client ID from BigCommerce\n * @param config.secret - The OAuth client secret from BigCommerce\n * @param config.redirectUri - The redirect URI registered with BigCommerce\n * @param config.scopes - Optional array of scopes to validate during auth callback\n * @param config.logger - Optional logger instance for debugging and error tracking\n * @throws {Error} If the redirect URI is invalid\n */\n constructor(private readonly config: Config) {\n try {\n new URL(this.config.redirectUri);\n } catch (error) {\n throw new Error('Invalid redirect URI', { cause: error });\n }\n }\n\n /**\n * Requests an access token from BigCommerce\n * @param data - Either a query string, URLSearchParams, or AuthQuery object containing auth callback data\n * @returns Promise resolving to the token response\n */\n async requestToken(data: string | AuthQuery | URLSearchParams): Promise<TokenResponse> {\n const query = typeof data === 'string' || data instanceof URLSearchParams ? this.parseQueryString(data) : data;\n\n this.validateScopes(query.scope);\n\n const tokenRequest: TokenRequest = {\n client_id: this.config.clientId,\n client_secret: this.config.secret,\n ...query,\n grant_type: GRANT_TYPE,\n redirect_uri: this.config.redirectUri,\n };\n\n this.config.logger?.debug({\n clientId: this.config.clientId,\n context: query.context,\n scopes: query.scope\n }, 'Requesting OAuth token');\n\n let res: KyResponse;\n\n try {\n res = await ky<TokenResponse>(TOKEN_ENDPOINT, {\n method: 'POST',\n json: tokenRequest,\n });\n } catch (error) {\n if(error instanceof HTTPError) {\n const text = await error.response.text();\n\n this.config.logger?.error({\n err: {\n name: error.name,\n message: error.message,\n text\n }\n });\n\n throw new Error(`Failed to request token. BC returned: ${text}`, { cause: error });\n }\n\n this.config.logger?.error({\n err: error instanceof Error ? {\n name: error.name,\n message: error.message\n } : error\n });\n\n throw new Error(`Failed to request token`, { cause: error });\n }\n\n return res.json();\n }\n\n /**\n * Verifies a JWT payload from BigCommerce\n * @param jwtPayload - The JWT string to verify\n * @param storeHash - The store hash for the BigCommerce store\n * @returns Promise resolving to the verified JWT claims\n * @throws {Error} If the JWT is invalid\n */\n async verify(jwtPayload: string, storeHash: string): Promise<Claims> {\n try {\n const secret = new TextEncoder().encode(this.config.secret);\n\n const { payload }: { payload: Claims } = await jose.jwtVerify(jwtPayload, secret, {\n audience: this.config.clientId,\n issuer: ISSUER,\n subject: `stores/${storeHash}`,\n });\n\n this.config.logger?.debug({\n userId: payload.user?.id,\n storeHash: payload.sub.split('/')[1]\n }, 'JWT verified successfully');\n\n return payload;\n } catch (error) {\n this.config.logger?.error({\n error: error instanceof Error ? {\n name: error.name,\n message: error.message\n } : error\n });\n\n throw new Error('Invalid JWT payload', { cause: error });\n }\n }\n\n /**\n * Parses and validates a query string from BigCommerce auth callback\n * @param queryString - The query string to parse\n * @returns The parsed auth query parameters\n * @throws {Error} If required parameters are missing or scopes are invalid\n */\n private parseQueryString(queryString: string | URLSearchParams): AuthQuery {\n const params = typeof queryString === 'string' ? new URLSearchParams(queryString) : queryString;\n\n // Get required parameters\n const code = params.get('code');\n const scope = params.get('scope');\n const context = params.get('context');\n\n // Validate required parameters\n if (!code) {\n throw new Error('No code found in query string');\n }\n\n if (!scope) {\n throw new Error('No scope found in query string');\n } else if (this.config.scopes?.length) {\n this.validateScopes(scope);\n }\n\n if (!context) {\n throw new Error('No context found in query string');\n }\n\n\n return {\n code,\n scope,\n context,\n };\n }\n\n /**\n * Validates that the granted scopes match the expected scopes\n * @param scopes - Space-separated list of granted scopes\n * @throws {Error} If the scopes don't match the expected scopes\n */\n private validateScopes(scopes: string) {\n if (!this.config.scopes) {\n return;\n }\n\n const grantedScopes = scopes.split(' ');\n const requiredScopes = this.config.scopes;\n const missingScopes = requiredScopes.filter(scope => !grantedScopes.includes(scope));\n\n if (missingScopes.length) {\n throw new Error(`Scope mismatch: ${scopes}; expected: ${this.config.scopes.join(' ')}`);\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAKA,OAAO,MAAkB,iBAAiB;AAMnC,IAAM,UAAkC;AAAA,EAC3C,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACZ;AAEO,IAAM,WAAW;AAGxB,IAAM,SAAS;AAAA;AAAA,EAEX;AAAA;AAAA,EAEA,iBAAiB;AAAA;AAAA,EAEjB,mBAAmB;AAAA;AAAA,EAEnB,gBAAgB;AAAA;AAAA,EAEhB,qBAAqB;AAAA;AAAA,EAErB,SAAS;AAAA;AAAA,IAEL,QAAQ;AAAA;AAAA,IAER,aAAa;AAAA;AAAA,IAEb,eAAe;AAAA;AAAA,IAEf,eAAe;AAAA,EACnB;AACJ;AA2CO,IAAM,eAAN,cAA8B,MAAM;AAAA,EACvC,YACW,QACA,SACA,MACA,OACT;AACE,UAAM,SAAS,EAAE,MAAM,CAAC;AALjB;AACA;AACA;AACA;AAAA,EAGX;AACJ;AASO,IAAM,UAAU,OAA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cAAc,QAAQ;AACtB,YAAM,IAAI,MAAM,mBAAmB,MAAM,eAAe,KAAK,OAAO,OAAO,KAAK,GAAG,CAAC,EAAE;AAAA,IAC1F;AAAA,EACJ;AACJ;",
|
|
4
|
+
"sourcesContent": ["/**\n * Network utilities for interacting with the BigCommerce API.\n * Provides rate-limited request handling, error management, and type-safe API calls.\n */\n\nimport ky, { KyResponse, HTTPError } from 'ky';\nimport { Logger } from './core';\n\n/** HTTP methods supported by the API */\nexport type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';\n\nexport const Methods: Record<string, Method> = {\n GET: 'GET',\n POST: 'POST',\n PUT: 'PUT',\n DELETE: 'DELETE',\n} as const;\n\nexport const BASE_URL = 'https://api.bigcommerce.com/stores/';\n\n/** Configuration for the BigCommerce API client */\nconst CONFIG = {\n /** Base URL for BigCommerce API */\n BASE_URL,\n /** Default API version to use */\n DEFAULT_VERSION: 'v3',\n /** Maximum delay in milliseconds for rate limit retries */\n DEFAULT_MAX_DELAY: 60e3,\n /** Maximum allowed URL length */\n MAX_URL_LENGTH: 2048,\n /** Default maximum number of retries for rate-limited requests */\n DEFAULT_MAX_RETRIES: 5,\n /** Rate limit header names */\n HEADERS: {\n /** Time window for rate limiting in milliseconds */\n WINDOW: 'x-rate-limit-time-window-ms',\n /** Time to wait before retrying after rate limit in milliseconds */\n RETRY_AFTER: 'x-rate-limit-time-reset-ms',\n /** Total request quota for the time window */\n REQUEST_QUOTA: 'x-rate-limit-requests-quota',\n /** Number of requests remaining in the current window */\n REQUESTS_LEFT: 'x-rate-limit-requests-left',\n },\n} as const;\n\n/** Supported BigCommerce API versions */\nexport type ApiVersion = 'v3' | 'v2';\n\n/**\n * Options for making API requests\n * @template T - Type of the request body\n */\nexport type RequestOptions<T> = {\n /** API endpoint to call */\n endpoint: string;\n /** HTTP method to use */\n method?: Method;\n /** Request body data */\n body?: T;\n /** API version to use */\n version?: ApiVersion;\n /** Query parameters to append to the URL */\n query?: Record<string, string>;\n};\n\nexport type StoreOptions = {\n /** BigCommerce store hash */\n storeHash: string;\n /** API access token */\n accessToken: string;\n};\n\n/**\n * Options for rate limit handling\n */\nexport type RateLimitOptions = {\n /** Maximum delay in milliseconds before giving up on rate-limited requests */\n maxDelay?: number;\n /** Maximum number of retries for rate-limited requests */\n maxRetries?: number;\n};\n\n/**\n * Custom error class for API request failures\n * @template T - Type of the error data\n */\nexport class RequestError<T> extends Error {\n constructor(\n public status: number,\n public message: string,\n public data: T | string,\n public cause?: unknown,\n ) {\n super(message, { cause });\n }\n}\n\n/**\n * Makes an API request with rate limit handling\n * @template T - Type of the request body and response\n * @param options - Request options including rate limit settings\n * @returns Promise resolving to the API response\n * @throws {RequestError} If the request fails or rate limit is exceeded\n */\nexport const request = async <T, R>(\n options: RequestOptions<T> &\n RateLimitOptions &\n StoreOptions & {\n logger?: Logger;\n },\n): Promise<R> => {\n const { maxDelay = CONFIG.DEFAULT_MAX_DELAY, maxRetries = CONFIG.DEFAULT_MAX_RETRIES, logger } = options;\n\n let retries = 0;\n let lastError: RequestError<T> | null = null;\n\n while (retries < maxRetries) {\n try {\n return await safeRequest<T, R>(options);\n } catch (error) {\n const err = error as RequestError<T>;\n lastError = err;\n\n if (err.status === 429 && typeof err.data === 'object' && err.data !== null && 'headers' in err.data) {\n const headers = err.data.headers as Record<string, string>;\n const retryAfter = Number.parseInt(headers[CONFIG.HEADERS.RETRY_AFTER]);\n\n logger?.debug(\n {\n retryAfter,\n retries,\n remaining: headers[CONFIG.HEADERS.REQUESTS_LEFT],\n },\n 'Rate limit hit, retrying',\n );\n\n if (Number.isNaN(retryAfter)) {\n throw new RequestError(\n err.status,\n `Failed to parse retry after: ${headers[CONFIG.HEADERS.RETRY_AFTER]}, ${err.message}`,\n err.data,\n err.cause,\n );\n }\n\n if (retryAfter > maxDelay) {\n logger?.warn(\n {\n retryAfter,\n maxDelay,\n },\n 'Rate limit delay exceeds maximum allowed delay',\n );\n throw new RequestError(\n err.status,\n `Rate limit exceeded: ${retryAfter}ms, ${err.message}`,\n err.data,\n err.cause,\n );\n }\n\n await new Promise((resolve) => setTimeout(resolve, retryAfter));\n retries++;\n continue;\n }\n\n throw err;\n }\n }\n\n logger?.error(\n {\n retries,\n error: lastError,\n },\n 'Request failed after maximum retries',\n );\n\n throw lastError ?? new RequestError(500, 'Failed to make request', 'Too many retries after rate limit');\n};\n\n/**\n * Makes a single API request with error handling\n * @template T - Type of the request body and response\n * @param options - Request options\n * @returns Promise resolving to the API response\n * @throws {RequestError} If the request fails\n */\nconst safeRequest = async <T, R>(\n options: RequestOptions<T> &\n StoreOptions & {\n logger?: Logger;\n },\n): Promise<R> => {\n const { logger } = options;\n let res: KyResponse<T>;\n\n try {\n res = await call<T, R>(options);\n } catch (error) {\n if (error instanceof RequestError) {\n throw error;\n }\n\n if (!(error instanceof HTTPError)) {\n logger?.error(\n {\n error:\n error instanceof Error\n ? {\n name: error.name,\n message: error.message,\n }\n : error,\n },\n 'Unexpected error during request',\n );\n throw error;\n }\n\n let data: unknown;\n let errorMessage = error.message;\n\n try {\n data = await error.response.text();\n try {\n data = JSON.parse(data as string);\n\n if (typeof data === 'object' && data !== null && 'message' in data) {\n errorMessage = data.message as string;\n }\n } catch {\n // If JSON parsing fails, keep the text response\n }\n } catch {\n data = 'Failed to read error response';\n }\n\n logger?.error(\n {\n status: error?.response?.status,\n errorMessage,\n },\n 'HTTP error during request',\n );\n\n throw new RequestError(\n error?.response?.status ?? 500,\n errorMessage,\n {\n data,\n endpoint: options.endpoint,\n query: options.query,\n body: options.body,\n headers: Object.fromEntries(error?.response?.headers?.entries() ?? []),\n },\n error,\n );\n }\n\n const text = await res.text();\n\n if (res.status === 204) {\n return undefined as unknown as R;\n }\n\n try {\n return JSON.parse(text);\n } catch (error) {\n logger?.error(\n {\n status: res.status,\n error:\n error instanceof Error\n ? {\n name: error.name,\n message: error.message,\n }\n : error,\n },\n 'Failed to parse response',\n );\n throw new RequestError(res.status, `Failed to parse response: ${text}`, text, error);\n }\n};\n\n/**\n * Internal function to make the actual HTTP request\n * @template T - Type of the request body and response\n * @param options - Request options\n * @returns Promise resolving to the raw response\n * @throws {RequestError} If the URL is too long or request fails\n */\nconst call = async <T, R>(\n options: RequestOptions<T> &\n StoreOptions & {\n logger?: Logger;\n },\n): Promise<KyResponse<R>> => {\n const {\n storeHash,\n accessToken,\n endpoint,\n method = 'GET',\n body,\n version = CONFIG.DEFAULT_VERSION,\n query,\n logger,\n } = options;\n\n const url = `${CONFIG.BASE_URL}${storeHash}/${version}/${endpoint.replace(/^\\//, '')}`;\n\n // Check URL length including search params\n const searchParams = query ? new URLSearchParams(query).toString() : '';\n const fullUrl = searchParams ? `${url}?${searchParams}` : url;\n\n if (fullUrl.length > CONFIG.MAX_URL_LENGTH) {\n logger?.error(\n {\n urlLength: fullUrl.length,\n maxLength: CONFIG.MAX_URL_LENGTH,\n },\n 'URL length exceeds maximum allowed length',\n );\n throw new RequestError(\n 400,\n 'URL too long',\n `URL length ${fullUrl.length} exceeds maximum allowed length of ${CONFIG.MAX_URL_LENGTH}`,\n );\n }\n\n const request = {\n method,\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n 'X-Auth-Token': accessToken,\n },\n json: body,\n };\n\n const response = await ky<R>(fullUrl, request);\n return response;\n};\n", "/**\n * Split an array of strings into chunks by following logic\n *\n * 1. add length of each string + separatorSize to offset\n * 2. if result is greater than `maxLength`, start a new chunk\n * 3. otherwise, add the string to the current chunk until the chunk is of `chunkLength`\n *\n * This function to be used for splitting query params to avoid url length limit\n *\n * @param items array of strings\n * @param options\n * @param options.maxLength max length of the combined strings\n * @param options.chunkLength max length of each chunk\n * @param options.offset offset of the first chunk\n * @param options.separatorSize size of the separator\n */\nexport const chunkStrLength = (\n items: string[],\n options: {\n maxLength?: number;\n chunkLength?: number;\n offset?: number;\n separatorSize?: number;\n } = {},\n) => {\n const { maxLength = 2048, chunkLength = 250, offset = 0, separatorSize = 1 } = options;\n\n const chunks: string[][] = [];\n let currentStrLength = offset;\n let currentChunk: string[] = [];\n\n for (const item of items) {\n const itemLength = encodeURIComponent(item).length;\n const separatorLength = currentChunk.length > 0 ? separatorSize : 0;\n const totalItemLength = itemLength + separatorLength;\n\n // Check if adding this item would exceed limits\n const wouldExceedLength = currentStrLength + totalItemLength > maxLength;\n const wouldExceedCount = currentChunk.length >= chunkLength;\n\n if ((wouldExceedLength || wouldExceedCount) && currentChunk.length > 0) {\n chunks.push(currentChunk);\n currentChunk = [];\n currentStrLength = offset;\n }\n\n // Handle items that are too large even for a new chunk\n if (itemLength + offset > maxLength) {\n // Either skip, truncate, or throw error depending on requirements\n throw new Error(`Item too large: ${itemLength} exceeds maxLength ${maxLength}`);\n }\n\n currentChunk.push(item);\n currentStrLength += totalItemLength;\n }\n\n if (currentChunk.length > 0) {\n chunks.push(currentChunk);\n }\n\n return chunks;\n};\n", "import { V3Resource, Logger } from './core';\nimport { BASE_URL, RateLimitOptions, RequestError, RequestOptions, StoreOptions, request } from './net';\nimport { chunkStrLength } from './util';\n\nconst MAX_PAGE_SIZE = 250;\nconst DEFAULT_CONCURRENCY = 10;\n\n// Helper function to chunk array into smaller arrays\nfunction chunkArray<T>(array: T[], size: number): T[][] {\n return Array.from({ length: Math.ceil(array.length / size) }, (_, i) => array.slice(i * size, i * size + size));\n}\n\n// Helper function to create range array\nfunction rangeArray(start: number, end: number): number[] {\n return Array.from({ length: end - start + 1 }, (_, i) => start + i);\n}\n\n/**\n * Options for GET requests to the BigCommerce API\n */\nexport type GetOptions = {\n /** Query parameters to include in the request */\n query?: Record<string, string>;\n /** API version to use (v2 or v3) */\n version?: 'v2' | 'v3';\n};\n\n/**\n * Options for POST/PUT requests to the BigCommerce API\n */\nexport type PostOptions<T> = GetOptions & {\n /** Request body data */\n body: T;\n};\n\n/**\n * Options for controlling concurrent request behavior\n */\nexport type ConcurrencyOptions = {\n /** Maximum number of concurrent requests (default: 10) */\n concurrency?: number;\n /** Whether to skip errors and continue processing (default: false) */\n skipErrors?: boolean;\n};\n\n/**\n * Options for querying multiple values against a single filter field\n */\nexport type QueryOptions = Omit<GetOptions, 'version'> &\n ConcurrencyOptions & {\n /** The field name to query against */\n key: string;\n /** Array of values to query for */\n values: (string | number)[];\n };\n\n/**\n * Configuration options for the BigCommerce client\n */\nexport type Config = StoreOptions &\n RateLimitOptions &\n ConcurrencyOptions & {\n /** Logger instance */\n logger?: Logger;\n };\n\n/**\n * Client for interacting with the BigCommerce API\n *\n * This client provides methods for making HTTP requests to the BigCommerce API,\n * with support for both v2 and v3 endpoints, pagination, and concurrent requests.\n */\nexport class BigCommerceClient {\n /**\n * Creates a new BigCommerce client instance\n * @param config - Configuration options for the client\n * @param config.storeHash - The store hash to use for the client\n * @param config.accessToken - The API access token to use for the client\n * @param config.maxRetries - The maximum number of retries for rate limit errors (default: 5)\n * @param config.maxDelay - Maximum time to wait to retry in case of rate limit errors in milliseconds (default: 60000 - 1 minute). If `X-Rate-Limit-Time-Reset-Ms` header is higher than `maxDelay`, the request will fail immediately.\n * @param config.concurrency - The default concurrency for concurrent methods (default: 10)\n * @param config.skipErrors - Whether to skip errors during concurrent requests (default: false)\n * @param config.logger - Optional logger instance for debugging and error tracking\n */\n constructor(private readonly config: Config) {}\n\n /**\n * Makes a GET request to the BigCommerce API\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.version - API version to use (v2 or v3) (default: v3)\n * @returns Promise resolving to the response data of type `R`\n */\n async get<R>(endpoint: string, options?: GetOptions): Promise<R> {\n return request<never, R>({\n endpoint,\n method: 'GET',\n ...options,\n ...this.config,\n });\n }\n\n /**\n * Makes a POST request to the BigCommerce API\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.version - API version to use (v2 or v3) (default: v3)\n * @param options.body - Request body data of type `T`\n * @returns Promise resolving to the response data of type `R`\n */\n async post<T, R>(endpoint: string, options?: PostOptions<T>): Promise<R> {\n return request<T, R>({\n endpoint,\n method: 'POST',\n ...options,\n ...this.config,\n });\n }\n\n /**\n * Makes a PUT request to the BigCommerce API\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.version - API version to use (v2 or v3) (default: v3)\n * @param options.body - Request body data of type `T`\n * @returns Promise resolving to the response data of type `R`\n */\n async put<T, R>(endpoint: string, options?: PostOptions<T>): Promise<R> {\n return request<T, R>({\n endpoint,\n method: 'PUT',\n ...options,\n ...this.config,\n });\n }\n\n /**\n * Makes a DELETE request to the BigCommerce API\n * @param endpoint - The API endpoint to delete\n * @param options.version - API version to use (v2 or v3) (default: v3)\n * @returns Promise resolving to void\n */\n async delete<R>(endpoint: string, options?: Pick<GetOptions, 'version'>): Promise<void> {\n await request<never, R>({\n endpoint,\n method: 'DELETE',\n ...options,\n ...this.config,\n });\n }\n\n /**\n * Executes multiple requests concurrently with controlled concurrency\n * @param requests - Array of request options to execute\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @param options.skipErrors - Whether to skip errors and continue processing (the errors will be logged if logger is provided), overrides the client's skipErrors setting (default: false)\n * @returns Promise resolving to array of response data\n */\n async concurrent<T, R>(requests: RequestOptions<T>[], options?: ConcurrencyOptions): Promise<R[]> {\n const skipErrors = options?.skipErrors ?? this.config.skipErrors ?? false;\n const results = await this.concurrentSettled<T, R>(requests, options);\n\n const successfulResults: R[] = [];\n\n for (const result of results) {\n if (result.status === 'fulfilled') {\n successfulResults.push(result.value);\n } else {\n if (!skipErrors) {\n throw result.reason;\n } else {\n this.config.logger?.warn(\n {\n error: result.reason,\n },\n 'Error in concurrent request',\n );\n }\n }\n }\n\n return successfulResults;\n }\n\n /**\n * Lowest level concurrent request method.\n * This method executes requests in chunks and returns bare PromiseSettledResult objects.\n * Use this method if you need to handle errors in a custom way.\n * @param requests - Array of request options to execute\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @returns Promise resolving to array of PromiseSettledResult containing both successful and failed requests\n */\n async concurrentSettled<T, R>(\n requests: RequestOptions<T>[],\n options?: Pick<ConcurrencyOptions, 'concurrency'>,\n ): Promise<PromiseSettledResult<R>[]> {\n const chunkSize = options?.concurrency ?? this.config.concurrency ?? DEFAULT_CONCURRENCY;\n const chunks = chunkArray(requests, chunkSize);\n\n this.config.logger?.debug(\n {\n totalRequests: requests.length,\n chunkSize,\n chunks: chunks.length,\n },\n 'Starting concurrent requests with detailed results',\n );\n\n const allResults: PromiseSettledResult<R>[] = [];\n\n for (const [index, chunk] of chunks.entries()) {\n const responses = await Promise.allSettled(\n chunk.map((opt) =>\n request<T, R>({\n ...opt,\n ...this.config,\n }),\n ),\n );\n\n this.config.logger?.debug(\n {\n chunkIndex: index,\n chunkSize: chunk.length,\n totalRequests: requests.length,\n totalChunks: chunks.length,\n responses: responses.map((response) => response.status),\n },\n 'Completed chunk',\n );\n\n allResults.push(...responses);\n }\n\n return allResults;\n }\n\n /**\n * Collects all pages of data from a paginated v3 API endpoint.\n * This method pulls the first page and uses pagination meta to collect the remaining pages concurrently.\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @param options.skipErrors - Whether to skip errors and continue processing (the errors will be logged if logger is provided), overrides the client's skipErrors setting (default: false)\n * @returns Promise resolving to array of all items across all pages\n */\n async collect<T>(endpoint: string, options?: Omit<GetOptions, 'version'> & ConcurrencyOptions): Promise<T[]> {\n options = options ?? {};\n\n if (options.query) {\n if (!options.query.limit) {\n options.query.limit = MAX_PAGE_SIZE.toString();\n }\n } else {\n options.query = { limit: MAX_PAGE_SIZE.toString() };\n }\n\n const first = await this.get<V3Resource<T[]>>(endpoint, options);\n\n if (!Array.isArray(first.data) || !first?.meta?.pagination?.total_pages) {\n return first.data;\n }\n\n const results: T[] = [...first.data];\n const pages = first.meta.pagination.total_pages;\n\n if (pages > 1) {\n this.config.logger?.debug(\n {\n totalPages: pages,\n itemsPerPage: first.data.length,\n },\n 'Collecting remaining pages',\n );\n\n const pageRequests = rangeArray(2, pages).map((page) => ({\n endpoint,\n method: 'GET' as const,\n query: {\n ...options.query,\n page: page.toString(),\n },\n }));\n\n const remainingPages = await this.concurrent<never, V3Resource<T[]>>(pageRequests, options);\n\n remainingPages.forEach((page) => {\n if (Array.isArray(page.data)) {\n results.push(...page.data);\n }\n });\n }\n\n return results;\n }\n\n /**\n * Collects all pages of data from a paginated v2 API endpoint.\n * This method simply pulls all pages concurrently until a 204 is returned in a batch.\n * @param endpoint - The API endpoint to request\n * @param options.query - Query parameters to include in the request\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @param options.skipErrors - Whether to skip errors and continue processing (the errors will be logged if logger is provided), overrides the client's skipErrors setting (default: false)\n * @returns Promise resolving to array of all items across all pages\n */\n async collectV2<T>(endpoint: string, options?: Omit<GetOptions, 'version'> & ConcurrencyOptions): Promise<T[]> {\n options = options ?? {};\n\n if (options.query) {\n if (!options.query.limit) {\n options.query.limit = MAX_PAGE_SIZE.toString();\n }\n } else {\n options.query = { limit: MAX_PAGE_SIZE.toString() };\n }\n\n let done = false;\n const results: T[] = [];\n let page = 1;\n const concurrency = options.concurrency ?? this.config.concurrency ?? DEFAULT_CONCURRENCY;\n\n while (!done) {\n const pages = rangeArray(page, page + concurrency);\n page += concurrency;\n\n const requests = pages.map((page) => ({\n ...options,\n endpoint,\n version: 'v2' as const,\n query: { ...options.query, page: page.toString() },\n }));\n\n const responses = await Promise.allSettled(requests.map((request) => this.get<T[]>(endpoint, request)));\n\n responses.forEach((response) => {\n if (response.status === 'fulfilled') {\n if (response.value) {\n results.push(...response.value);\n } else {\n done = true;\n }\n } else {\n if (response.reason instanceof RequestError && response.reason.status === 404) {\n done = true;\n } else {\n if (!(options.skipErrors ?? this.config.skipErrors ?? false)) {\n throw response.reason;\n } else {\n this.config.logger?.warn(\n {\n error:\n response.reason instanceof Error\n ? {\n name: response.reason.name,\n message: response.reason.message,\n }\n : response.reason,\n },\n 'Error in collectV2',\n );\n }\n }\n }\n });\n }\n\n return results;\n }\n\n /**\n * Queries multiple values against a single field using the v3 API.\n * If the url + query params are too long, the query will be chunked. Otherwise, this method acts like `collect`.\n * This method does not check for uniqueness of the `values` array.\n *\n * @param endpoint - The API endpoint to request\n * @param options.key - The field name to query against e.g. `sku:in`\n * @param options.values - Array of values to query for e.g. `['123', '456', ...]`\n * @param options.query - Additional query parameters\n * @param options.concurrency - Maximum number of concurrent requests, overrides the client's concurrency setting (default: 10)\n * @param options.skipErrors - Whether to skip errors and continue processing (the errors will be logged if logger is provided), overrides the client's skipErrors setting (default: false)\n * @returns Promise resolving to array of matching items\n */\n async query<T>(endpoint: string, options: QueryOptions): Promise<T[]> {\n if (options.query) {\n if (!options.query.limit) {\n options.query.limit = MAX_PAGE_SIZE.toString();\n }\n } else {\n options.query = { limit: MAX_PAGE_SIZE.toString() };\n }\n\n const keySize = encodeURIComponent(options.key).length;\n const fullUrl = `${BASE_URL}${this.config.storeHash}/v3/${endpoint}?${new URLSearchParams(options.query).toString()}`;\n const offset = fullUrl.length + keySize + 1;\n const chunkLength = Number.parseInt(options.query?.limit) || MAX_PAGE_SIZE;\n const separatorSize = encodeURIComponent(',').length;\n\n const queryStr = options.values.map((value) => `${value}`);\n const chunks = chunkStrLength(queryStr, {\n separatorSize,\n offset,\n chunkLength,\n });\n\n this.config.logger?.debug(\n {\n offset,\n totalValues: options.values.length,\n chunks: chunks.length,\n valuesPerChunk: chunks[0]?.length,\n separatorSize,\n },\n 'Querying with chunked values',\n );\n\n const requests = chunks.map((chunk) => ({\n ...options,\n endpoint,\n query: { ...options.query, [options.key]: chunk.join(',') },\n }));\n\n const responses = await this.concurrent<never, V3Resource<T[]>>(requests, options);\n\n return responses.flatMap((response) => response.data);\n }\n}\n", "import ky, { HTTPError, KyResponse } from 'ky';\nimport * as jose from 'jose';\nimport { Logger } from './core';\n\n/**\n * Configuration options for BigCommerce authentication\n */\ntype Config = {\n /** The OAuth client ID from BigCommerce */\n clientId: string;\n /** The OAuth client secret from BigCommerce */\n secret: string;\n /** The redirect URI registered with BigCommerce */\n redirectUri: string;\n /** Optional array of scopes to validate during auth callback */\n scopes?: string[];\n /** Optional logger instance */\n logger?: Logger;\n};\n\nconst GRANT_TYPE = 'authorization_code';\nconst TOKEN_ENDPOINT = 'https://login.bigcommerce.com/oauth2/token';\nconst ISSUER = 'bc';\n\n/**\n * Query parameters received from BigCommerce auth callback\n */\ntype AuthQuery = {\n /** The authorization code from BigCommerce */\n code: string;\n /** The granted OAuth scopes */\n scope: string;\n /** The store context */\n context: string;\n};\n\n/**\n * Request payload for token endpoint\n */\ntype TokenRequest = {\n client_id: string;\n client_secret: string;\n code: string;\n context: string;\n scope: string;\n grant_type: typeof GRANT_TYPE;\n redirect_uri: string;\n};\n\n/**\n * User information returned from BigCommerce\n */\nexport type User = {\n /** The user's ID */\n id: number;\n /** The user's username */\n username: string;\n /** The user's email address */\n email: string;\n};\n\n/**\n * Response from BigCommerce token endpoint\n */\nexport type TokenResponse = {\n /** The OAuth access token */\n access_token: string;\n /** The granted OAuth scopes */\n scope: string;\n /** Information about the authenticated user */\n user: User;\n /** Information about the store owner */\n owner: User;\n /** The store context */\n context: string;\n /** The BigCommerce account UUID */\n account_uuid: string;\n};\n\n/**\n * JWT claims from BigCommerce\n */\nexport type Claims = {\n /** JWT audience */\n aud: string;\n /** JWT issuer */\n iss: string;\n /** JWT issued at timestamp */\n iat: number;\n /** JWT not before timestamp */\n nbf: number;\n /** JWT expiration timestamp */\n exp: number;\n /** JWT unique identifier */\n jti: string;\n /** JWT subject */\n sub: string;\n /** Information about the authenticated user */\n user: {\n id: number;\n email: string;\n locale: string;\n };\n /** Information about the store owner */\n owner: {\n id: number;\n email: string;\n };\n /** The store URL */\n url: string;\n /** The channel ID (if applicable) */\n channel_id: number | null;\n};\n\n/**\n * Handles authentication with BigCommerce OAuth\n */\nexport class BigCommerceAuth {\n /**\n * Creates a new BigCommerceAuth instance for handling OAuth authentication\n * @param config - Configuration options for BigCommerce authentication\n * @param config.clientId - The OAuth client ID from BigCommerce\n * @param config.secret - The OAuth client secret from BigCommerce\n * @param config.redirectUri - The redirect URI registered with BigCommerce\n * @param config.scopes - Optional array of scopes to validate during auth callback\n * @param config.logger - Optional logger instance for debugging and error tracking\n * @throws {Error} If the redirect URI is invalid\n */\n constructor(private readonly config: Config) {\n try {\n new URL(this.config.redirectUri);\n } catch (error) {\n throw new Error('Invalid redirect URI', { cause: error });\n }\n }\n\n /**\n * Requests an access token from BigCommerce\n * @param data - Either a query string, URLSearchParams, or AuthQuery object containing auth callback data\n * @returns Promise resolving to the token response\n */\n async requestToken(data: string | AuthQuery | URLSearchParams): Promise<TokenResponse> {\n const query = typeof data === 'string' || data instanceof URLSearchParams ? this.parseQueryString(data) : data;\n\n this.validateScopes(query.scope);\n\n const tokenRequest: TokenRequest = {\n client_id: this.config.clientId,\n client_secret: this.config.secret,\n ...query,\n grant_type: GRANT_TYPE,\n redirect_uri: this.config.redirectUri,\n };\n\n this.config.logger?.debug(\n {\n clientId: this.config.clientId,\n context: query.context,\n scopes: query.scope,\n },\n 'Requesting OAuth token',\n );\n\n let res: KyResponse;\n\n try {\n res = await ky<TokenResponse>(TOKEN_ENDPOINT, {\n method: 'POST',\n json: tokenRequest,\n });\n } catch (error) {\n if (error instanceof HTTPError) {\n const text = await error.response.text();\n\n this.config.logger?.error({\n err: {\n name: error.name,\n message: error.message,\n text,\n },\n });\n\n throw new Error(`Failed to request token. BC returned: ${text}`, { cause: error });\n }\n\n this.config.logger?.error({\n err:\n error instanceof Error\n ? {\n name: error.name,\n message: error.message,\n }\n : error,\n });\n\n throw new Error(`Failed to request token`, { cause: error });\n }\n\n return res.json();\n }\n\n /**\n * Verifies a JWT payload from BigCommerce\n * @param jwtPayload - The JWT string to verify\n * @param storeHash - The store hash for the BigCommerce store\n * @returns Promise resolving to the verified JWT claims\n * @throws {Error} If the JWT is invalid\n */\n async verify(jwtPayload: string, storeHash: string): Promise<Claims> {\n try {\n const secret = new TextEncoder().encode(this.config.secret);\n\n const { payload }: { payload: Claims } = await jose.jwtVerify(jwtPayload, secret, {\n audience: this.config.clientId,\n issuer: ISSUER,\n subject: `stores/${storeHash}`,\n });\n\n this.config.logger?.debug(\n {\n userId: payload.user?.id,\n storeHash: payload.sub.split('/')[1],\n },\n 'JWT verified successfully',\n );\n\n return payload;\n } catch (error) {\n this.config.logger?.error({\n error:\n error instanceof Error\n ? {\n name: error.name,\n message: error.message,\n }\n : error,\n });\n\n throw new Error('Invalid JWT payload', { cause: error });\n }\n }\n\n /**\n * Parses and validates a query string from BigCommerce auth callback\n * @param queryString - The query string to parse\n * @returns The parsed auth query parameters\n * @throws {Error} If required parameters are missing or scopes are invalid\n */\n private parseQueryString(queryString: string | URLSearchParams): AuthQuery {\n const params = typeof queryString === 'string' ? new URLSearchParams(queryString) : queryString;\n\n // Get required parameters\n const code = params.get('code');\n const scope = params.get('scope');\n const context = params.get('context');\n\n // Validate required parameters\n if (!code) {\n throw new Error('No code found in query string');\n }\n\n if (!scope) {\n throw new Error('No scope found in query string');\n } else if (this.config.scopes?.length) {\n this.validateScopes(scope);\n }\n\n if (!context) {\n throw new Error('No context found in query string');\n }\n\n return {\n code,\n scope,\n context,\n };\n }\n\n /**\n * Validates that the granted scopes match the expected scopes\n * @param scopes - Space-separated list of granted scopes\n * @throws {Error} If the scopes don't match the expected scopes\n */\n private validateScopes(scopes: string) {\n if (!this.config.scopes) {\n return;\n }\n\n const grantedScopes = scopes.split(' ');\n const requiredScopes = this.config.scopes;\n const missingScopes = requiredScopes.filter((scope) => !grantedScopes.includes(scope));\n\n if (missingScopes.length) {\n throw new Error(`Scope mismatch: ${scopes}; expected: ${this.config.scopes.join(' ')}`);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAKA,OAAO,MAAkB,iBAAiB;AAMnC,IAAM,UAAkC;AAAA,EAC3C,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACZ;AAEO,IAAM,W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