@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/index.d.mts
CHANGED
|
@@ -1,25 +1,55 @@
|
|
|
1
|
-
import { I as
|
|
2
|
-
|
|
1
|
+
import { I as ICommerceClient } from './interface-NJcjuqaL.mjs';
|
|
2
|
+
import { I as IShopifyConfig, L as LoggerConfig, S as ShopifyCommerceClient, a as ICustomConfig, C as CustomBackendClient } from './service-DBKEK2oS.mjs';
|
|
3
|
+
export { EAvailability, ECollectionSortKey, EFulfillmentStatus, EOrderSortKey, EOrderStatus, EPaymentStatus, EProductSortKey, IAddToCartRequest, IAddress, IArticleByHandleRequest, IBaseQueryParams, IBlogArticleRequest, ICartItemRequest, ICollectionFilterRequest, ICollectionQueryRequest, ICollectionsByhandlesRequest, ICreateCheckoutRequest, ICustomerQueryRequest, ICustomerRequest, IFetchRequest, IGetArticleRequest, IGraphqlRequest, IImage, IMetafield, IMoney, IOptionsRequest, IOrderByIdRequest, IOrderHistoryRequest, IOrderQueryRequest, IOrderRequest, IPaginationParams, IProductFilters, IProductQueryReqest, IProductRecommendationsRequest, IProductsByHandlesRequest, IRemoveFromCartRequest, IResponse, IResponseMeta, ISeo, ISingleCartRequest, ISingleCollectionRequest, ISingleCustomerRequest, ISingleOrderRequest, ISingleProductRequest, ITrendingArticleRequest, IUpdateCartRequest, IUpdateCustomerRequest, IUpdateOrderRequest } from './models/index.mjs';
|
|
4
|
+
export { createCollectionProductStaticParams, createCollectionStaticParams, createProductStaticParams, createProductViaCollectionsStaticParams } from './static-params/index.mjs';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
|
-
* Commerce
|
|
6
|
-
*
|
|
7
|
+
* Commerce Client Factory
|
|
8
|
+
*
|
|
9
|
+
* Factory functions for creating commerce client instances.
|
|
10
|
+
* Supports Shopify Storefront API and custom backend integrations.
|
|
11
|
+
*
|
|
12
|
+
* @module @shopkit/data-layer
|
|
7
13
|
*/
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
* Create a Shopify commerce client
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
17
|
+
*
|
|
18
|
+
* @param config - Shopify Storefront API configuration
|
|
19
|
+
* @param logging - Optional logger configuration
|
|
20
|
+
* @returns Configured ShopifyCommerceClient instance
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const client = createShopifyClient({
|
|
25
|
+
* domain: 'your-store.myshopify.com',
|
|
26
|
+
* storefrontAccessToken: 'your-token',
|
|
27
|
+
* apiVersion: '2024-01',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
13
30
|
*/
|
|
14
31
|
declare function createShopifyClient(config: IShopifyConfig, logging?: LoggerConfig): ShopifyCommerceClient;
|
|
15
32
|
/**
|
|
16
33
|
* Create a Custom Backend commerce client
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
34
|
+
*
|
|
35
|
+
* @param config - Custom backend configuration
|
|
36
|
+
* @param logging - Optional logger configuration
|
|
37
|
+
* @returns Configured CustomBackendClient instance
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const client = createCustomClient({
|
|
42
|
+
* baseUrl: 'https://api.example.com',
|
|
43
|
+
* apiKey: 'your-api-key',
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
19
46
|
*/
|
|
20
47
|
declare function createCustomClient(config: ICustomConfig, logging?: LoggerConfig): CustomBackendClient;
|
|
21
48
|
/**
|
|
22
49
|
* Commerce client configuration options
|
|
50
|
+
*
|
|
51
|
+
* Discriminated union type for different client configurations.
|
|
52
|
+
* Use the `type` field to specify which adapter to use.
|
|
23
53
|
*/
|
|
24
54
|
type IClientConfig = {
|
|
25
55
|
type: "shopify";
|
|
@@ -32,9 +62,33 @@ type IClientConfig = {
|
|
|
32
62
|
};
|
|
33
63
|
/**
|
|
34
64
|
* Create a commerce client based on configuration
|
|
35
|
-
*
|
|
36
|
-
*
|
|
65
|
+
*
|
|
66
|
+
* Factory function that creates the appropriate client based on the
|
|
67
|
+
* configuration type. This is the recommended way to create clients
|
|
68
|
+
* as it provides a unified interface.
|
|
69
|
+
*
|
|
70
|
+
* @param clientConfig - Client configuration with type and config
|
|
71
|
+
* @returns CommerceClient instance implementing ICommerceClient
|
|
72
|
+
* @throws Error if unsupported client type is provided
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* // Shopify client
|
|
77
|
+
* const shopifyClient = createCommerceClient({
|
|
78
|
+
* type: 'shopify',
|
|
79
|
+
* config: {
|
|
80
|
+
* domain: 'store.myshopify.com',
|
|
81
|
+
* storefrontAccessToken: 'token',
|
|
82
|
+
* },
|
|
83
|
+
* });
|
|
84
|
+
*
|
|
85
|
+
* // Custom backend client
|
|
86
|
+
* const customClient = createCommerceClient({
|
|
87
|
+
* type: 'custom',
|
|
88
|
+
* config: { baseUrl: 'https://api.example.com' },
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
37
91
|
*/
|
|
38
92
|
declare function createCommerceClient(clientConfig: IClientConfig): ICommerceClient;
|
|
39
93
|
|
|
40
|
-
export { type IClientConfig, createCommerceClient, createCustomClient, createShopifyClient };
|
|
94
|
+
export { type IClientConfig, ICommerceClient, ICustomConfig, IShopifyConfig, createCommerceClient, createCustomClient, createShopifyClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,55 @@
|
|
|
1
|
-
import { I as
|
|
2
|
-
|
|
1
|
+
import { I as ICommerceClient } from './interface-dqoKc63z.js';
|
|
2
|
+
import { I as IShopifyConfig, L as LoggerConfig, S as ShopifyCommerceClient, a as ICustomConfig, C as CustomBackendClient } from './service-BHCLUEim.js';
|
|
3
|
+
export { EAvailability, ECollectionSortKey, EFulfillmentStatus, EOrderSortKey, EOrderStatus, EPaymentStatus, EProductSortKey, IAddToCartRequest, IAddress, IArticleByHandleRequest, IBaseQueryParams, IBlogArticleRequest, ICartItemRequest, ICollectionFilterRequest, ICollectionQueryRequest, ICollectionsByhandlesRequest, ICreateCheckoutRequest, ICustomerQueryRequest, ICustomerRequest, IFetchRequest, IGetArticleRequest, IGraphqlRequest, IImage, IMetafield, IMoney, IOptionsRequest, IOrderByIdRequest, IOrderHistoryRequest, IOrderQueryRequest, IOrderRequest, IPaginationParams, IProductFilters, IProductQueryReqest, IProductRecommendationsRequest, IProductsByHandlesRequest, IRemoveFromCartRequest, IResponse, IResponseMeta, ISeo, ISingleCartRequest, ISingleCollectionRequest, ISingleCustomerRequest, ISingleOrderRequest, ISingleProductRequest, ITrendingArticleRequest, IUpdateCartRequest, IUpdateCustomerRequest, IUpdateOrderRequest } from './models/index.js';
|
|
4
|
+
export { createCollectionProductStaticParams, createCollectionStaticParams, createProductStaticParams, createProductViaCollectionsStaticParams } from './static-params/index.js';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
|
-
* Commerce
|
|
6
|
-
*
|
|
7
|
+
* Commerce Client Factory
|
|
8
|
+
*
|
|
9
|
+
* Factory functions for creating commerce client instances.
|
|
10
|
+
* Supports Shopify Storefront API and custom backend integrations.
|
|
11
|
+
*
|
|
12
|
+
* @module @shopkit/data-layer
|
|
7
13
|
*/
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
* Create a Shopify commerce client
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
17
|
+
*
|
|
18
|
+
* @param config - Shopify Storefront API configuration
|
|
19
|
+
* @param logging - Optional logger configuration
|
|
20
|
+
* @returns Configured ShopifyCommerceClient instance
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const client = createShopifyClient({
|
|
25
|
+
* domain: 'your-store.myshopify.com',
|
|
26
|
+
* storefrontAccessToken: 'your-token',
|
|
27
|
+
* apiVersion: '2024-01',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
13
30
|
*/
|
|
14
31
|
declare function createShopifyClient(config: IShopifyConfig, logging?: LoggerConfig): ShopifyCommerceClient;
|
|
15
32
|
/**
|
|
16
33
|
* Create a Custom Backend commerce client
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
34
|
+
*
|
|
35
|
+
* @param config - Custom backend configuration
|
|
36
|
+
* @param logging - Optional logger configuration
|
|
37
|
+
* @returns Configured CustomBackendClient instance
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const client = createCustomClient({
|
|
42
|
+
* baseUrl: 'https://api.example.com',
|
|
43
|
+
* apiKey: 'your-api-key',
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
19
46
|
*/
|
|
20
47
|
declare function createCustomClient(config: ICustomConfig, logging?: LoggerConfig): CustomBackendClient;
|
|
21
48
|
/**
|
|
22
49
|
* Commerce client configuration options
|
|
50
|
+
*
|
|
51
|
+
* Discriminated union type for different client configurations.
|
|
52
|
+
* Use the `type` field to specify which adapter to use.
|
|
23
53
|
*/
|
|
24
54
|
type IClientConfig = {
|
|
25
55
|
type: "shopify";
|
|
@@ -32,9 +62,33 @@ type IClientConfig = {
|
|
|
32
62
|
};
|
|
33
63
|
/**
|
|
34
64
|
* Create a commerce client based on configuration
|
|
35
|
-
*
|
|
36
|
-
*
|
|
65
|
+
*
|
|
66
|
+
* Factory function that creates the appropriate client based on the
|
|
67
|
+
* configuration type. This is the recommended way to create clients
|
|
68
|
+
* as it provides a unified interface.
|
|
69
|
+
*
|
|
70
|
+
* @param clientConfig - Client configuration with type and config
|
|
71
|
+
* @returns CommerceClient instance implementing ICommerceClient
|
|
72
|
+
* @throws Error if unsupported client type is provided
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* // Shopify client
|
|
77
|
+
* const shopifyClient = createCommerceClient({
|
|
78
|
+
* type: 'shopify',
|
|
79
|
+
* config: {
|
|
80
|
+
* domain: 'store.myshopify.com',
|
|
81
|
+
* storefrontAccessToken: 'token',
|
|
82
|
+
* },
|
|
83
|
+
* });
|
|
84
|
+
*
|
|
85
|
+
* // Custom backend client
|
|
86
|
+
* const customClient = createCommerceClient({
|
|
87
|
+
* type: 'custom',
|
|
88
|
+
* config: { baseUrl: 'https://api.example.com' },
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
37
91
|
*/
|
|
38
92
|
declare function createCommerceClient(clientConfig: IClientConfig): ICommerceClient;
|
|
39
93
|
|
|
40
|
-
export { type IClientConfig, createCommerceClient, createCustomClient, createShopifyClient };
|
|
94
|
+
export { type IClientConfig, ICommerceClient, ICustomConfig, IShopifyConfig, createCommerceClient, createCustomClient, createShopifyClient };
|