@shopkit/data-layer 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -7
- package/dist/adapters/index.d.mts +2 -1
- package/dist/adapters/index.d.ts +2 -1
- package/dist/adapters/index.js +221 -64
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/index.mjs +221 -64
- package/dist/adapters/index.mjs.map +1 -1
- package/dist/index.d.mts +65 -11
- package/dist/index.d.ts +65 -11
- package/dist/index.js +357 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +354 -66
- package/dist/index.mjs.map +1 -1
- package/dist/interface-NJcjuqaL.d.mts +236 -0
- package/dist/interface-dqoKc63z.d.ts +236 -0
- package/dist/models/index.d.mts +45 -62
- package/dist/models/index.d.ts +45 -62
- package/dist/{service-NPmqCNGb.d.mts → service-BHCLUEim.d.ts} +38 -279
- package/dist/{service-Q7zlmyFk.d.ts → service-DBKEK2oS.d.mts} +38 -279
- package/dist/static-params/index.d.mts +65 -0
- package/dist/static-params/index.d.ts +65 -0
- package/dist/static-params/index.js +275 -0
- package/dist/static-params/index.js.map +1 -0
- package/dist/static-params/index.mjs +270 -0
- package/dist/static-params/index.mjs.map +1 -0
- package/package.json +6 -1
|
@@ -1,237 +1,5 @@
|
|
|
1
|
-
import { ISingleProductRequest, IOptionsRequest, IResponse, IProductQueryReqest, ISingleCollectionRequest, ICollectionQueryRequest, ICollectionsByhandlesRequest, ICollectionFilterRequest, ISingleOrderRequest, IOrderQueryRequest, IOrderRequest, IUpdateOrderRequest, IOrderHistoryRequest, IOrderByIdRequest, ISingleCustomerRequest, ICustomerQueryRequest, ICustomerRequest, IUpdateCustomerRequest, ISingleCartRequest, IUpdateCartRequest, IAddToCartRequest, IRemoveFromCartRequest, ICreateCheckoutRequest, IGetArticleRequest, IBlogArticleRequest, ITrendingArticleRequest, IArticleByHandleRequest,
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Core interface that all platform adapters will implement
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
interface ICommerceClient {
|
|
8
|
-
/**
|
|
9
|
-
* Retrieve a single product by ID or handle
|
|
10
|
-
* @param params - Product identifier (id or handle)
|
|
11
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
12
|
-
* @returns Promise resolving to product data
|
|
13
|
-
*/
|
|
14
|
-
getProduct(params: ISingleProductRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
15
|
-
/**
|
|
16
|
-
* Retrieve multiple products with filtering and pagination
|
|
17
|
-
* @param params - Query parameters for filtering, sorting, and pagination
|
|
18
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
19
|
-
* @returns Promise resolving to paginated products response
|
|
20
|
-
*/
|
|
21
|
-
getProducts(params: IProductQueryReqest, options?: IOptionsRequest): Promise<IResponse>;
|
|
22
|
-
/**
|
|
23
|
-
* Retrieve multiple products by their handles
|
|
24
|
-
* @param handles - Array of product handles
|
|
25
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
26
|
-
* @returns Promise resolving to array of products
|
|
27
|
-
*/
|
|
28
|
-
getProductsByHandles(handles: string[], options?: IOptionsRequest): Promise<IResponse>;
|
|
29
|
-
/**
|
|
30
|
-
* Retrieve a single collection by ID or handle
|
|
31
|
-
* @param params - Collection identifier (id or handle)
|
|
32
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
33
|
-
* @returns Promise resolving to collection data
|
|
34
|
-
*/
|
|
35
|
-
getCollection(params: ISingleCollectionRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Retrieve multiple collections with filtering and pagination
|
|
38
|
-
* @param params - Query parameters for filtering, sorting, and pagination
|
|
39
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
40
|
-
* @returns Promise resolving to paginated collections response
|
|
41
|
-
*/
|
|
42
|
-
getCollections(params: ICollectionQueryRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
43
|
-
/**
|
|
44
|
-
* Retrieve multiple collections by their handles with individual query parameters
|
|
45
|
-
* Each collection can have its own specific filtering, pagination, and sorting options
|
|
46
|
-
* @param params - Array of collection objects, each containing:
|
|
47
|
-
* - handle: Collection handle (required)
|
|
48
|
-
* - query: Search query string (optional)
|
|
49
|
-
* - after/before: Pagination cursors (optional)
|
|
50
|
-
* - first/last: Number of items to return (optional)
|
|
51
|
-
* - reverse: Sort order reversal (optional)
|
|
52
|
-
* - sortKey: Collection sorting key (optional)
|
|
53
|
-
* - productLimit: Max products per collection (optional)
|
|
54
|
-
* - productSortKey: Product sorting within collection (optional)
|
|
55
|
-
* - productReverse: Product sort order reversal (optional)
|
|
56
|
-
* - filters: Product filtering options including price, availability, type, vendor, tags (optional)
|
|
57
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
58
|
-
* @returns Promise resolving to collections data with individual query results
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* const result = await client.getCollectionsByHandels([
|
|
62
|
-
* { handle: 'featured', first: 10, sortKey: 'UPDATED_AT' },
|
|
63
|
-
* { handle: 'sale', productLimit: 5, filters: [{ available: true }] }
|
|
64
|
-
* ]);
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
getCollectionsByHandels(params: ICollectionsByhandlesRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
68
|
-
/**
|
|
69
|
-
* Retrieve available filters for collections
|
|
70
|
-
* @param params - Collection identifier (id or handle) to get filters for
|
|
71
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
72
|
-
* @returns Promise resolving to available filter options (price ranges, brands, categories, etc.)
|
|
73
|
-
*/
|
|
74
|
-
getCollectionFilters(params: ICollectionFilterRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
75
|
-
/**
|
|
76
|
-
* Retrieve a single order by ID
|
|
77
|
-
* @param params - Order identifier
|
|
78
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
79
|
-
* @returns Promise resolving to order data
|
|
80
|
-
*/
|
|
81
|
-
getOrder(params: ISingleOrderRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
82
|
-
/**
|
|
83
|
-
* Retrieve multiple orders with filtering and pagination
|
|
84
|
-
* @param params - Query parameters for filtering, sorting, and pagination
|
|
85
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
86
|
-
* @returns Promise resolving to paginated orders response
|
|
87
|
-
*/
|
|
88
|
-
getOrders(params: IOrderQueryRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
89
|
-
/**
|
|
90
|
-
* Create a new order
|
|
91
|
-
* @param data - Order data to create
|
|
92
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
93
|
-
* @returns Promise resolving to created order
|
|
94
|
-
*/
|
|
95
|
-
createOrder(data: IOrderRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
96
|
-
/**
|
|
97
|
-
* Update an existing order
|
|
98
|
-
* @param params - Object containing id and data to update
|
|
99
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
100
|
-
* @returns Promise resolving to updated order
|
|
101
|
-
*/
|
|
102
|
-
updateOrder(params: IUpdateOrderRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
103
|
-
/**
|
|
104
|
-
* Retrieve order history for a customer
|
|
105
|
-
* @param params - Object containing customerAccessToken, page, and limit
|
|
106
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
107
|
-
* @returns Promise resolving to order history
|
|
108
|
-
*/
|
|
109
|
-
getOrderHistory(params: IOrderHistoryRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
110
|
-
/**
|
|
111
|
-
* Retrieve a specific order for a customer
|
|
112
|
-
* @param params - Object containing customerAccessToken and orderId
|
|
113
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
114
|
-
* @returns Promise resolving to order data
|
|
115
|
-
*/
|
|
116
|
-
getOrderById(params: IOrderByIdRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
117
|
-
/**
|
|
118
|
-
* Retrieve a single customer by ID
|
|
119
|
-
* @param params - Customer identifier
|
|
120
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
121
|
-
* @returns Promise resolving to customer data
|
|
122
|
-
*/
|
|
123
|
-
getCustomer(params: ISingleCustomerRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
124
|
-
/**
|
|
125
|
-
* Retrieve multiple customers with filtering and pagination
|
|
126
|
-
* @param params - Query parameters for filtering, sorting, and pagination
|
|
127
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
128
|
-
* @returns Promise resolving to paginated customers response
|
|
129
|
-
*/
|
|
130
|
-
getCustomers(params: ICustomerQueryRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
131
|
-
/**
|
|
132
|
-
* Create a new customer account
|
|
133
|
-
* @param data - Customer data to create
|
|
134
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
135
|
-
* @returns Promise resolving to created customer
|
|
136
|
-
*/
|
|
137
|
-
createCustomer(data: ICustomerRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
138
|
-
/**
|
|
139
|
-
* Update an existing customer account
|
|
140
|
-
* @param params - Object containing id and data to update
|
|
141
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
142
|
-
* @returns Promise resolving to updated customer
|
|
143
|
-
*/
|
|
144
|
-
updateCustomer(params: IUpdateCustomerRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
145
|
-
/**
|
|
146
|
-
* Retrieve a shopping cart by ID
|
|
147
|
-
* @param params - Cart identifier
|
|
148
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
149
|
-
* @returns Promise resolving to standardized response with cart data
|
|
150
|
-
*/
|
|
151
|
-
getCart(params: ISingleCartRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
152
|
-
/**
|
|
153
|
-
* Create a new shopping cart
|
|
154
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
155
|
-
* @returns Promise resolving to standardized response with created cart
|
|
156
|
-
*/
|
|
157
|
-
createCart(options?: IOptionsRequest): Promise<IResponse>;
|
|
158
|
-
/**
|
|
159
|
-
* Update an existing shopping cart
|
|
160
|
-
* @param params - Object containing id and data to update
|
|
161
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
162
|
-
* @returns Promise resolving to standardized response with updated cart
|
|
163
|
-
*/
|
|
164
|
-
updateCart(params: IUpdateCartRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
165
|
-
/**
|
|
166
|
-
* Add items to a shopping cart
|
|
167
|
-
* @param params - Object containing cart id and items to add
|
|
168
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
169
|
-
* @returns Promise resolving to standardized response with updated cart
|
|
170
|
-
*/
|
|
171
|
-
addToCart(params: IAddToCartRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
172
|
-
/**
|
|
173
|
-
* Remove items from a shopping cart
|
|
174
|
-
* @param params - Object containing cart id and item IDs to remove
|
|
175
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
176
|
-
* @returns Promise resolving to standardized response with updated cart
|
|
177
|
-
*/
|
|
178
|
-
removeFromCart(params: IRemoveFromCartRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
179
|
-
/**
|
|
180
|
-
* Create a new checkout session
|
|
181
|
-
* @param params - Checkout data
|
|
182
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
183
|
-
* @returns Promise resolving to checkout session
|
|
184
|
-
*/
|
|
185
|
-
createCheckout(params: ICreateCheckoutRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
186
|
-
/**
|
|
187
|
-
* Retrieve a single article
|
|
188
|
-
* @param params - Query parameters for filtering articles
|
|
189
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
190
|
-
* @returns Promise resolving to article data
|
|
191
|
-
*/
|
|
192
|
-
getArticle(params?: IGetArticleRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
193
|
-
/**
|
|
194
|
-
* Retrieve blog articles with optional filtering
|
|
195
|
-
* @param params - Query parameters for category and limit
|
|
196
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
197
|
-
* @returns Promise resolving to articles array
|
|
198
|
-
*/
|
|
199
|
-
getBlogArticles(params: IBlogArticleRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
200
|
-
/**
|
|
201
|
-
* Retrieve trending articles with optional filtering
|
|
202
|
-
* @param params - Query parameters for category
|
|
203
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
204
|
-
* @returns Promise resolving to trending articles
|
|
205
|
-
*/
|
|
206
|
-
getTrendingArticles(params: ITrendingArticleRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
207
|
-
/**
|
|
208
|
-
* Retrieve a specific article by handle
|
|
209
|
-
* @param params - Article parameters including category and handle
|
|
210
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
211
|
-
* @returns Promise resolving to article data
|
|
212
|
-
*/
|
|
213
|
-
getArticleByHandle(params: IArticleByHandleRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
214
|
-
/**
|
|
215
|
-
* Utility method to make GraphQL requests
|
|
216
|
-
* @param query - GraphQL query string
|
|
217
|
-
* @param variables - GraphQL variables
|
|
218
|
-
* @param options - Request options
|
|
219
|
-
* @returns Promise resolving to standardized response
|
|
220
|
-
*/
|
|
221
|
-
graphqlRequest(query: string, variables?: Record<string, any>): Promise<IResponse>;
|
|
222
|
-
/**
|
|
223
|
-
* Utility method to make custom fetch requests to any endpoint
|
|
224
|
-
* @param url - Target URL for the request
|
|
225
|
-
* @param options - Request options
|
|
226
|
-
* @returns Promise resolving to standardized response
|
|
227
|
-
*/
|
|
228
|
-
fetchRequest(url: string, options?: {
|
|
229
|
-
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
230
|
-
headers?: Record<string, string>;
|
|
231
|
-
body?: any;
|
|
232
|
-
signal?: AbortSignal;
|
|
233
|
-
}): Promise<IResponse>;
|
|
234
|
-
}
|
|
1
|
+
import { ISingleProductRequest, IOptionsRequest, IResponse, IProductQueryReqest, IProductsByHandlesRequest, IProductRecommendationsRequest, ISingleCollectionRequest, ICollectionQueryRequest, ICollectionsByhandlesRequest, ICollectionFilterRequest, ISingleOrderRequest, IOrderQueryRequest, IOrderRequest, IUpdateOrderRequest, IOrderHistoryRequest, IOrderByIdRequest, ISingleCustomerRequest, ICustomerQueryRequest, ICustomerRequest, IUpdateCustomerRequest, ISingleCartRequest, IUpdateCartRequest, IAddToCartRequest, IRemoveFromCartRequest, ICreateCheckoutRequest, IGetArticleRequest, IBlogArticleRequest, ITrendingArticleRequest, IArticleByHandleRequest, IGraphqlRequest, IFetchRequest } from './models/index.mjs';
|
|
2
|
+
import { I as ICommerceClient } from './interface-NJcjuqaL.mjs';
|
|
235
3
|
|
|
236
4
|
/**
|
|
237
5
|
* Shopify-specific types for the commerce library
|
|
@@ -320,12 +88,21 @@ declare abstract class BaseCommerceClient implements ICommerceClient {
|
|
|
320
88
|
getProducts(params: IProductQueryReqest, options?: IOptionsRequest): Promise<IResponse>;
|
|
321
89
|
/**
|
|
322
90
|
* Retrieve multiple products by their handles
|
|
323
|
-
* @param
|
|
91
|
+
* @param params - Object containing array of product handles
|
|
324
92
|
* @param options - Request options (headers, timeout, etc.)
|
|
325
93
|
* @returns Promise resolving to array of products
|
|
326
94
|
* @throws NotImplementedError if not implemented in adapter
|
|
327
95
|
*/
|
|
328
|
-
getProductsByHandles(
|
|
96
|
+
getProductsByHandles(params: IProductsByHandlesRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* Retrieve product recommendations for a given product
|
|
99
|
+
* Uses platform-specific recommendation algorithms (e.g., Shopify's productRecommendations)
|
|
100
|
+
* @param productId - Product ID or handle to get recommendations for
|
|
101
|
+
* @param options - Request options (headers, timeout, etc.)
|
|
102
|
+
* @returns Promise resolving to array of recommended products
|
|
103
|
+
* @throws NotImplementedError if not implemented in adapter
|
|
104
|
+
*/
|
|
105
|
+
getProductRecommendations(params: IProductRecommendationsRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
329
106
|
/**
|
|
330
107
|
* Retrieve a single collection by ID or handle
|
|
331
108
|
* @param params - Collection identifier (id or handle)
|
|
@@ -360,7 +137,7 @@ declare abstract class BaseCommerceClient implements ICommerceClient {
|
|
|
360
137
|
* @returns Promise resolving to collections data with individual query results
|
|
361
138
|
* @throws NotImplementedError if not implemented in adapter
|
|
362
139
|
*/
|
|
363
|
-
|
|
140
|
+
getCollectionsByHandles(params: ICollectionsByhandlesRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
364
141
|
/**
|
|
365
142
|
* Retrieve available filters for collections
|
|
366
143
|
* @param params - Collection identifier (id or handle) to get filters for
|
|
@@ -387,12 +164,12 @@ declare abstract class BaseCommerceClient implements ICommerceClient {
|
|
|
387
164
|
getOrders(params: IOrderQueryRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
388
165
|
/**
|
|
389
166
|
* Create a new order
|
|
390
|
-
* @param
|
|
167
|
+
* @param params - Order data to create
|
|
391
168
|
* @param options - Request options (headers, timeout, etc.)
|
|
392
169
|
* @returns Promise resolving to created order
|
|
393
170
|
* @throws NotImplementedError if not implemented in adapter
|
|
394
171
|
*/
|
|
395
|
-
createOrder(
|
|
172
|
+
createOrder(params: IOrderRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
396
173
|
/**
|
|
397
174
|
* Update an existing order
|
|
398
175
|
* @param params - Object containing id and data to update
|
|
@@ -435,12 +212,12 @@ declare abstract class BaseCommerceClient implements ICommerceClient {
|
|
|
435
212
|
getCustomers(params: ICustomerQueryRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
436
213
|
/**
|
|
437
214
|
* Create a new customer account
|
|
438
|
-
* @param
|
|
215
|
+
* @param params - Customer data to create
|
|
439
216
|
* @param options - Request options (headers, timeout, etc.)
|
|
440
217
|
* @returns Promise resolving to created customer
|
|
441
218
|
* @throws NotImplementedError if not implemented in adapter
|
|
442
219
|
*/
|
|
443
|
-
createCustomer(
|
|
220
|
+
createCustomer(params: ICustomerRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
444
221
|
/**
|
|
445
222
|
* Update an existing customer account
|
|
446
223
|
* @param params - Object containing id and data to update
|
|
@@ -496,24 +273,6 @@ declare abstract class BaseCommerceClient implements ICommerceClient {
|
|
|
496
273
|
* @throws NotImplementedError if not implemented in adapter
|
|
497
274
|
*/
|
|
498
275
|
createCheckout(params: ICreateCheckoutRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
499
|
-
/**
|
|
500
|
-
* Update an existing checkout session
|
|
501
|
-
* @param id - Checkout identifier
|
|
502
|
-
* @param data - Checkout update data
|
|
503
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
504
|
-
* @returns Promise resolving to updated checkout
|
|
505
|
-
* @throws NotImplementedError if not implemented in adapter
|
|
506
|
-
*/
|
|
507
|
-
updateCheckout(id: string, data: ICheckoutUpdateRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
508
|
-
/**
|
|
509
|
-
* Complete a checkout and create an order
|
|
510
|
-
* @param id - Checkout identifier
|
|
511
|
-
* @param paymentData - Payment information
|
|
512
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
513
|
-
* @returns Promise resolving to created order
|
|
514
|
-
* @throws NotImplementedError if not implemented in adapter
|
|
515
|
-
*/
|
|
516
|
-
completeCheckout(id: string, paymentData: IPaymentRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
517
276
|
/**
|
|
518
277
|
* Retrieve a single article
|
|
519
278
|
* @param params - Query parameters for filtering articles
|
|
@@ -548,19 +307,17 @@ declare abstract class BaseCommerceClient implements ICommerceClient {
|
|
|
548
307
|
getArticleByHandle(params: IArticleByHandleRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
549
308
|
/**
|
|
550
309
|
* Utility method to make GraphQL requests
|
|
551
|
-
* @param
|
|
552
|
-
* @param variables - GraphQL variables
|
|
310
|
+
* @param params - Object containing query string and optional variables
|
|
553
311
|
* @returns Promise resolving to standardized response
|
|
554
312
|
* @throws NotImplementedError if not implemented in adapter
|
|
555
313
|
*/
|
|
556
|
-
graphqlRequest(
|
|
314
|
+
graphqlRequest(params: IGraphqlRequest): Promise<IResponse>;
|
|
557
315
|
/**
|
|
558
316
|
* Utility method to make custom fetch requests to any endpoint
|
|
559
|
-
* @param
|
|
560
|
-
* @param options - Request options
|
|
317
|
+
* @param params - Object containing url and optional fetch options
|
|
561
318
|
* @returns Promise resolving to standardized response
|
|
562
319
|
*/
|
|
563
|
-
fetchRequest(
|
|
320
|
+
fetchRequest(params: IFetchRequest): Promise<IResponse>;
|
|
564
321
|
}
|
|
565
322
|
|
|
566
323
|
/**
|
|
@@ -592,7 +349,12 @@ declare class ShopifyCommerceClient extends BaseCommerceClient {
|
|
|
592
349
|
/**
|
|
593
350
|
* Get multiple products by their handles using batch query
|
|
594
351
|
*/
|
|
595
|
-
getProductsByHandles(
|
|
352
|
+
getProductsByHandles(params: IProductsByHandlesRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
353
|
+
/**
|
|
354
|
+
* Get product recommendations for a given product
|
|
355
|
+
* Uses Shopify's productRecommendations API
|
|
356
|
+
*/
|
|
357
|
+
getProductRecommendations(params: IProductRecommendationsRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
596
358
|
/**
|
|
597
359
|
* Get collections based on query parameters
|
|
598
360
|
*/
|
|
@@ -601,17 +363,16 @@ declare class ShopifyCommerceClient extends BaseCommerceClient {
|
|
|
601
363
|
* Get a collection by ID
|
|
602
364
|
*/
|
|
603
365
|
getCollection(params: ISingleCollectionRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
604
|
-
/**
|
|
605
|
-
* Retrieve multiple collections by their handles with individual query parameters
|
|
606
|
-
* Each collection can have its own specific filtering, pagination, and sorting options
|
|
607
|
-
* @param params - Array of collection objects with handles and their respective query parameters
|
|
608
|
-
* @param options - Request options (headers, timeout, etc.)
|
|
609
|
-
* @returns Promise resolving to collections data with individual query results
|
|
610
|
-
*/
|
|
611
366
|
/**
|
|
612
367
|
* Get multiple collections by their handles (preferred method name)
|
|
613
368
|
*/
|
|
614
369
|
getCollectionsByHandles(params: ICollectionsByhandlesRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
370
|
+
/**
|
|
371
|
+
* Get collection filters (available filter options for a collection)
|
|
372
|
+
*/
|
|
373
|
+
getCollectionFilters(params: {
|
|
374
|
+
handle: string;
|
|
375
|
+
}, options?: IOptionsRequest): Promise<IResponse>;
|
|
615
376
|
/**
|
|
616
377
|
* Create a new cart
|
|
617
378
|
*/
|
|
@@ -663,7 +424,7 @@ declare class ShopifyCommerceClient extends BaseCommerceClient {
|
|
|
663
424
|
/**
|
|
664
425
|
* Utility method to make GraphQL requests using Shopify client
|
|
665
426
|
*/
|
|
666
|
-
graphqlRequest(
|
|
427
|
+
graphqlRequest(params: IGraphqlRequest): Promise<IResponse>;
|
|
667
428
|
}
|
|
668
429
|
|
|
669
430
|
/**
|
|
@@ -709,7 +470,7 @@ declare class CustomBackendClient extends BaseCommerceClient {
|
|
|
709
470
|
constructor(config: ICustomConfig, logging?: LoggerConfig);
|
|
710
471
|
getProduct(params: ISingleProductRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
711
472
|
getProducts(params: IProductQueryReqest, options?: IOptionsRequest): Promise<IResponse>;
|
|
712
|
-
getProductsByHandles(
|
|
473
|
+
getProductsByHandles(params: IProductsByHandlesRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
713
474
|
/**
|
|
714
475
|
* Get collections based on query parameters
|
|
715
476
|
*/
|
|
@@ -725,7 +486,7 @@ declare class CustomBackendClient extends BaseCommerceClient {
|
|
|
725
486
|
* @param options - Request options (headers, timeout, etc.)
|
|
726
487
|
* @returns Promise resolving to collections data with individual query results
|
|
727
488
|
*/
|
|
728
|
-
|
|
489
|
+
getCollectionsByHandles(params: ICollectionsByhandlesRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
729
490
|
getCollectionFilters(params: ICollectionFilterRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
730
491
|
getCart(params: ISingleCartRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
731
492
|
createCart(options?: IOptionsRequest): Promise<IResponse>;
|
|
@@ -733,8 +494,6 @@ declare class CustomBackendClient extends BaseCommerceClient {
|
|
|
733
494
|
addToCart(params: IAddToCartRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
734
495
|
removeFromCart(params: IRemoveFromCartRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
735
496
|
createCheckout(params: ICreateCheckoutRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
736
|
-
updateCheckout(id: string, data: ICheckoutUpdateRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
737
|
-
completeCheckout(id: string, paymentData: IPaymentRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
738
497
|
getCustomer(params: ISingleCustomerRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
739
498
|
getCustomers(params: ICustomerQueryRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
740
499
|
createCustomer(params: ICustomerRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
@@ -747,4 +506,4 @@ declare class CustomBackendClient extends BaseCommerceClient {
|
|
|
747
506
|
getOrderById(params: IOrderByIdRequest, options?: IOptionsRequest): Promise<IResponse>;
|
|
748
507
|
}
|
|
749
508
|
|
|
750
|
-
export { CustomBackendClient as C, type IShopifyConfig as I, type LoggerConfig as L, ShopifyCommerceClient as S, type ICustomConfig as a
|
|
509
|
+
export { CustomBackendClient as C, type IShopifyConfig as I, type LoggerConfig as L, ShopifyCommerceClient as S, type ICustomConfig as a };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { I as ICommerceClient } from '../interface-NJcjuqaL.mjs';
|
|
2
|
+
import '../models/index.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Factory for /collections/[collectionname] and /collections-b/[collectionname].
|
|
6
|
+
* Fetches ALL collection handles from the commerce backend at build time.
|
|
7
|
+
* Returns [] safely when the API is down or returns no data.
|
|
8
|
+
*/
|
|
9
|
+
declare function createCollectionStaticParams(getClient: () => ICommerceClient, options?: {
|
|
10
|
+
limit?: number;
|
|
11
|
+
}): () => Promise<{
|
|
12
|
+
collectionname: string;
|
|
13
|
+
}[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Factory for /products/[handle] routes on backends that expose a direct
|
|
16
|
+
* products-list endpoint (e.g. Shopify Storefront API).
|
|
17
|
+
*
|
|
18
|
+
* NOT for the custom REST backend — that backend has no products-list endpoint.
|
|
19
|
+
* Use createProductViaCollectionsStaticParams instead, which traverses collections
|
|
20
|
+
* to discover all product handles.
|
|
21
|
+
*
|
|
22
|
+
* Returns [] safely when the API is down or returns no data.
|
|
23
|
+
*/
|
|
24
|
+
declare function createProductStaticParams(getClient: () => ICommerceClient, options?: {
|
|
25
|
+
limit?: number;
|
|
26
|
+
}): () => Promise<{
|
|
27
|
+
handle: string;
|
|
28
|
+
}[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Factory for flat /products/[handle] routes on backends without a direct products-list
|
|
31
|
+
* endpoint. Traverses all collections to discover product handles and deduplicates by
|
|
32
|
+
* handle — each unique product appears exactly once in the output.
|
|
33
|
+
* Returns [] safely when the API is down or returns no data.
|
|
34
|
+
*
|
|
35
|
+
* Default limits: 250 collections × 100 products per collection.
|
|
36
|
+
* Tune via options if your backend is rate-limited.
|
|
37
|
+
*/
|
|
38
|
+
declare function createProductViaCollectionsStaticParams(getClient: () => ICommerceClient, options?: {
|
|
39
|
+
collectionsLimit?: number;
|
|
40
|
+
productsPerCollection?: number;
|
|
41
|
+
concurrency?: number;
|
|
42
|
+
}): () => Promise<{
|
|
43
|
+
handle: string;
|
|
44
|
+
}[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Factory for nested /collections/[collectionname]/products/[handle] routes.
|
|
47
|
+
* Produces { collectionname, handle }[] pairs — one entry per valid collection+product
|
|
48
|
+
* combination. A product in multiple collections generates a pair for each collection,
|
|
49
|
+
* so every collection-product page is pre-built. Deduplicates by the full pair key
|
|
50
|
+
* (collectionname + handle) to avoid duplicate Next.js static entries.
|
|
51
|
+
* Returns [] safely when the API is down or returns no data.
|
|
52
|
+
*
|
|
53
|
+
* Default limits: 50 collections × 20 products per collection.
|
|
54
|
+
* Tune via options if your store has more collections or products per collection.
|
|
55
|
+
*/
|
|
56
|
+
declare function createCollectionProductStaticParams(getClient: () => ICommerceClient, options?: {
|
|
57
|
+
collectionsLimit?: number;
|
|
58
|
+
productsPerCollection?: number;
|
|
59
|
+
concurrency?: number;
|
|
60
|
+
}): () => Promise<{
|
|
61
|
+
collectionname: string;
|
|
62
|
+
handle: string;
|
|
63
|
+
}[]>;
|
|
64
|
+
|
|
65
|
+
export { createCollectionProductStaticParams, createCollectionStaticParams, createProductStaticParams, createProductViaCollectionsStaticParams };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { I as ICommerceClient } from '../interface-dqoKc63z.js';
|
|
2
|
+
import '../models/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Factory for /collections/[collectionname] and /collections-b/[collectionname].
|
|
6
|
+
* Fetches ALL collection handles from the commerce backend at build time.
|
|
7
|
+
* Returns [] safely when the API is down or returns no data.
|
|
8
|
+
*/
|
|
9
|
+
declare function createCollectionStaticParams(getClient: () => ICommerceClient, options?: {
|
|
10
|
+
limit?: number;
|
|
11
|
+
}): () => Promise<{
|
|
12
|
+
collectionname: string;
|
|
13
|
+
}[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Factory for /products/[handle] routes on backends that expose a direct
|
|
16
|
+
* products-list endpoint (e.g. Shopify Storefront API).
|
|
17
|
+
*
|
|
18
|
+
* NOT for the custom REST backend — that backend has no products-list endpoint.
|
|
19
|
+
* Use createProductViaCollectionsStaticParams instead, which traverses collections
|
|
20
|
+
* to discover all product handles.
|
|
21
|
+
*
|
|
22
|
+
* Returns [] safely when the API is down or returns no data.
|
|
23
|
+
*/
|
|
24
|
+
declare function createProductStaticParams(getClient: () => ICommerceClient, options?: {
|
|
25
|
+
limit?: number;
|
|
26
|
+
}): () => Promise<{
|
|
27
|
+
handle: string;
|
|
28
|
+
}[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Factory for flat /products/[handle] routes on backends without a direct products-list
|
|
31
|
+
* endpoint. Traverses all collections to discover product handles and deduplicates by
|
|
32
|
+
* handle — each unique product appears exactly once in the output.
|
|
33
|
+
* Returns [] safely when the API is down or returns no data.
|
|
34
|
+
*
|
|
35
|
+
* Default limits: 250 collections × 100 products per collection.
|
|
36
|
+
* Tune via options if your backend is rate-limited.
|
|
37
|
+
*/
|
|
38
|
+
declare function createProductViaCollectionsStaticParams(getClient: () => ICommerceClient, options?: {
|
|
39
|
+
collectionsLimit?: number;
|
|
40
|
+
productsPerCollection?: number;
|
|
41
|
+
concurrency?: number;
|
|
42
|
+
}): () => Promise<{
|
|
43
|
+
handle: string;
|
|
44
|
+
}[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Factory for nested /collections/[collectionname]/products/[handle] routes.
|
|
47
|
+
* Produces { collectionname, handle }[] pairs — one entry per valid collection+product
|
|
48
|
+
* combination. A product in multiple collections generates a pair for each collection,
|
|
49
|
+
* so every collection-product page is pre-built. Deduplicates by the full pair key
|
|
50
|
+
* (collectionname + handle) to avoid duplicate Next.js static entries.
|
|
51
|
+
* Returns [] safely when the API is down or returns no data.
|
|
52
|
+
*
|
|
53
|
+
* Default limits: 50 collections × 20 products per collection.
|
|
54
|
+
* Tune via options if your store has more collections or products per collection.
|
|
55
|
+
*/
|
|
56
|
+
declare function createCollectionProductStaticParams(getClient: () => ICommerceClient, options?: {
|
|
57
|
+
collectionsLimit?: number;
|
|
58
|
+
productsPerCollection?: number;
|
|
59
|
+
concurrency?: number;
|
|
60
|
+
}): () => Promise<{
|
|
61
|
+
collectionname: string;
|
|
62
|
+
handle: string;
|
|
63
|
+
}[]>;
|
|
64
|
+
|
|
65
|
+
export { createCollectionProductStaticParams, createCollectionStaticParams, createProductStaticParams, createProductViaCollectionsStaticParams };
|