@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/dist/index.d.mts CHANGED
@@ -1,25 +1,55 @@
1
- import { I as IShopifyConfig, L as LoggerConfig, S as ShopifyCommerceClient, a as ICustomConfig, C as CustomBackendClient, b as ICommerceClient } from './service-NPmqCNGb.mjs';
2
- export { EAvailability, ECollectionSortKey, EFulfillmentStatus, EOrderSortKey, EOrderStatus, EPaymentStatus, EProductSortKey, IAddToCartRequest, IAddress, IArticleByHandleRequest, IBaseQueryParams, IBlogArticleRequest, ICartItemRequest, ICheckoutUpdateRequest, ICollectionFilterRequest, ICollectionQueryRequest, ICollectionsByhandlesRequest, ICreateCheckoutRequest, ICustomerQueryRequest, ICustomerRequest, IFetchOptionsRequest, IGetArticleRequest, IImage, IMetafield, IMoney, IOptionsRequest, IOrderByIdRequest, IOrderHistoryRequest, IOrderQueryRequest, IOrderRequest, IPaginationParams, IPaymentRequest, IProductFilters, IProductQueryReqest, IRemoveFromCartRequest, IResponse, IResponseMeta, ISeo, ISingleCartRequest, ISingleCollectionRequest, ISingleCustomerRequest, ISingleOrderRequest, ISingleProductRequest, ITrendingArticleRequest, IUpdateCartRequest, IUpdateCustomerRequest, IUpdateOrderRequest } from './models/index.mjs';
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 client factory
6
- * Simple client creation and management
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
- * @param config Shopify configuration
12
- * @returns ShopifyCommerceClient instance
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
- * @param config Custom backend configuration
18
- * @returns CustomBackendClient instance
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
- * @param clientConfig Client configuration with type and config
36
- * @returns CommerceClient instance
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 IShopifyConfig, L as LoggerConfig, S as ShopifyCommerceClient, a as ICustomConfig, C as CustomBackendClient, b as ICommerceClient } from './service-Q7zlmyFk.js';
2
- export { EAvailability, ECollectionSortKey, EFulfillmentStatus, EOrderSortKey, EOrderStatus, EPaymentStatus, EProductSortKey, IAddToCartRequest, IAddress, IArticleByHandleRequest, IBaseQueryParams, IBlogArticleRequest, ICartItemRequest, ICheckoutUpdateRequest, ICollectionFilterRequest, ICollectionQueryRequest, ICollectionsByhandlesRequest, ICreateCheckoutRequest, ICustomerQueryRequest, ICustomerRequest, IFetchOptionsRequest, IGetArticleRequest, IImage, IMetafield, IMoney, IOptionsRequest, IOrderByIdRequest, IOrderHistoryRequest, IOrderQueryRequest, IOrderRequest, IPaginationParams, IPaymentRequest, IProductFilters, IProductQueryReqest, IRemoveFromCartRequest, IResponse, IResponseMeta, ISeo, ISingleCartRequest, ISingleCollectionRequest, ISingleCustomerRequest, ISingleOrderRequest, ISingleProductRequest, ITrendingArticleRequest, IUpdateCartRequest, IUpdateCustomerRequest, IUpdateOrderRequest } from './models/index.js';
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 client factory
6
- * Simple client creation and management
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
- * @param config Shopify configuration
12
- * @returns ShopifyCommerceClient instance
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
- * @param config Custom backend configuration
18
- * @returns CustomBackendClient instance
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
- * @param clientConfig Client configuration with type and config
36
- * @returns CommerceClient instance
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 };