@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
package/dist/models/index.d.ts
CHANGED
|
@@ -156,15 +156,29 @@ interface IOptionsRequest {
|
|
|
156
156
|
*/
|
|
157
157
|
signal?: AbortSignal;
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Request for GraphQL operations
|
|
161
|
+
*/
|
|
162
|
+
interface IGraphqlRequest {
|
|
163
|
+
/** GraphQL query string */
|
|
164
|
+
query: string;
|
|
165
|
+
/** GraphQL variables */
|
|
166
|
+
variables?: Record<string, any>;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Request for custom fetch operations
|
|
170
|
+
*/
|
|
171
|
+
interface IFetchRequest {
|
|
172
|
+
/** Target URL for the request */
|
|
173
|
+
url: string;
|
|
174
|
+
/** HTTP method */
|
|
160
175
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
161
|
-
headers
|
|
162
|
-
|
|
176
|
+
/** Request headers */
|
|
177
|
+
headers?: Record<string, string>;
|
|
178
|
+
/** Request body */
|
|
179
|
+
body?: any;
|
|
180
|
+
/** AbortSignal for request cancellation */
|
|
163
181
|
signal?: AbortSignal;
|
|
164
|
-
credentials?: "omit" | "same-origin" | "include";
|
|
165
|
-
mode?: RequestMode;
|
|
166
|
-
cache?: RequestCache;
|
|
167
|
-
keepalive?: boolean;
|
|
168
182
|
[key: string]: any;
|
|
169
183
|
}
|
|
170
184
|
|
|
@@ -268,6 +282,29 @@ interface ISingleProductRequest {
|
|
|
268
282
|
id?: string | number;
|
|
269
283
|
handle?: string;
|
|
270
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Common interface for batch product requests by handles
|
|
287
|
+
* Supports retrieving multiple products by their handles
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```typescript
|
|
291
|
+
* {
|
|
292
|
+
* "handles": ["product-a", "product-b"],
|
|
293
|
+
* "first": 10
|
|
294
|
+
* }
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
interface IProductsByHandlesRequest extends IProductQueryReqest {
|
|
298
|
+
/** Array of product handles to retrieve */
|
|
299
|
+
handles: string[];
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Request for product recommendations
|
|
303
|
+
*/
|
|
304
|
+
interface IProductRecommendationsRequest {
|
|
305
|
+
/** Product ID or handle to get recommendations for */
|
|
306
|
+
productId: string;
|
|
307
|
+
}
|
|
271
308
|
/**
|
|
272
309
|
* Parameters for querying collections
|
|
273
310
|
*
|
|
@@ -490,60 +527,6 @@ interface IUpdateCartRequest {
|
|
|
490
527
|
/**
|
|
491
528
|
* Checkout data models for the commerce library
|
|
492
529
|
*/
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* Request to update a checkout
|
|
496
|
-
*/
|
|
497
|
-
interface ICheckoutUpdateRequest {
|
|
498
|
-
email?: string;
|
|
499
|
-
phone?: string;
|
|
500
|
-
shippingAddress?: IAddress;
|
|
501
|
-
billingAddress?: IAddress;
|
|
502
|
-
shippingMethodId?: string;
|
|
503
|
-
paymentMethodId?: string;
|
|
504
|
-
discountCodes?: string[];
|
|
505
|
-
note?: string;
|
|
506
|
-
customAttributes?: Array<{
|
|
507
|
-
key: string;
|
|
508
|
-
value: string;
|
|
509
|
-
}>;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Payment data for different payment methods
|
|
513
|
-
*/
|
|
514
|
-
interface IPaymentRequest {
|
|
515
|
-
creditCard?: {
|
|
516
|
-
number: string;
|
|
517
|
-
expiryMonth: string;
|
|
518
|
-
expiryYear: string;
|
|
519
|
-
cvv: string;
|
|
520
|
-
holderName: string;
|
|
521
|
-
};
|
|
522
|
-
paypal?: {
|
|
523
|
-
payerId: string;
|
|
524
|
-
paymentId: string;
|
|
525
|
-
};
|
|
526
|
-
applePay?: {
|
|
527
|
-
token: string;
|
|
528
|
-
};
|
|
529
|
-
googlePay?: {
|
|
530
|
-
token: string;
|
|
531
|
-
};
|
|
532
|
-
bankTransfer?: {
|
|
533
|
-
accountNumber: string;
|
|
534
|
-
routingNumber: string;
|
|
535
|
-
accountHolderName: string;
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Request to process a payment
|
|
540
|
-
*/
|
|
541
|
-
interface IPaymentRequest {
|
|
542
|
-
paymentMethodId: string;
|
|
543
|
-
paymentData?: IPaymentRequest;
|
|
544
|
-
billingAddress?: IAddress;
|
|
545
|
-
savePaymentMethod?: boolean;
|
|
546
|
-
}
|
|
547
530
|
/**
|
|
548
531
|
* Request to create a checkout
|
|
549
532
|
*/
|
|
@@ -595,4 +578,4 @@ interface IGetArticleRequest {
|
|
|
595
578
|
reverse?: boolean;
|
|
596
579
|
}
|
|
597
580
|
|
|
598
|
-
export { EAvailability, ECollectionSortKey, EFulfillmentStatus, EOrderSortKey, EOrderStatus, EPaymentStatus, EProductSortKey, type IAddToCartRequest, type IAddress, type IArticleByHandleRequest, type IBaseQueryParams, type IBlogArticleRequest, type ICartItemRequest, type
|
|
581
|
+
export { EAvailability, ECollectionSortKey, EFulfillmentStatus, EOrderSortKey, EOrderStatus, EPaymentStatus, EProductSortKey, type IAddToCartRequest, type IAddress, type IArticleByHandleRequest, type IBaseQueryParams, type IBlogArticleRequest, type ICartItemRequest, type ICollectionFilterRequest, type ICollectionQueryRequest, type ICollectionsByhandlesRequest, type ICreateCheckoutRequest, type ICustomerQueryRequest, type ICustomerRequest, type IFetchRequest, type IGetArticleRequest, type IGraphqlRequest, type IImage, type IMetafield, type IMoney, type IOptionsRequest, type IOrderByIdRequest, type IOrderHistoryRequest, type IOrderQueryRequest, type IOrderRequest, type IPaginationParams, type IProductFilters, type IProductQueryReqest, type IProductRecommendationsRequest, type IProductsByHandlesRequest, type IRemoveFromCartRequest, type IResponse, type IResponseMeta, type ISeo, type ISingleCartRequest, type ISingleCollectionRequest, type ISingleCustomerRequest, type ISingleOrderRequest, type ISingleProductRequest, type ITrendingArticleRequest, type IUpdateCartRequest, type IUpdateCustomerRequest, type IUpdateOrderRequest };
|
|
@@ -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.js';
|
|
2
|
+
import { I as ICommerceClient } from './interface-dqoKc63z.js';
|
|
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 };
|