@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.js CHANGED
@@ -784,7 +784,7 @@ function createLogger(config = {}) {
784
784
  }
785
785
  return new UniversalLogger(fullConfig);
786
786
  }
787
- createLogger({
787
+ var logger = createLogger({
788
788
  enabled: false,
789
789
  level: "info",
790
790
  prettyPrint: false
@@ -850,14 +850,25 @@ var BaseCommerceClient = class {
850
850
  }
851
851
  /**
852
852
  * Retrieve multiple products by their handles
853
- * @param handles - Array of product handles
853
+ * @param params - Object containing array of product handles
854
854
  * @param options - Request options (headers, timeout, etc.)
855
855
  * @returns Promise resolving to array of products
856
856
  * @throws NotImplementedError if not implemented in adapter
857
857
  */
858
- getProductsByHandles(handles, options) {
858
+ getProductsByHandles(params, options) {
859
859
  this.throwNotImplemented("getProductsByHandles");
860
860
  }
861
+ /**
862
+ * Retrieve product recommendations for a given product
863
+ * Uses platform-specific recommendation algorithms (e.g., Shopify's productRecommendations)
864
+ * @param productId - Product ID or handle to get recommendations for
865
+ * @param options - Request options (headers, timeout, etc.)
866
+ * @returns Promise resolving to array of recommended products
867
+ * @throws NotImplementedError if not implemented in adapter
868
+ */
869
+ getProductRecommendations(params, options) {
870
+ this.throwNotImplemented("getProductRecommendations");
871
+ }
861
872
  // ========================================
862
873
  // COLLECTION OPERATIONS
863
874
  // ========================================
@@ -899,8 +910,8 @@ var BaseCommerceClient = class {
899
910
  * @returns Promise resolving to collections data with individual query results
900
911
  * @throws NotImplementedError if not implemented in adapter
901
912
  */
902
- getCollectionsByHandels(params, options) {
903
- this.throwNotImplemented("getCollectionsByHandels");
913
+ getCollectionsByHandles(params, options) {
914
+ this.throwNotImplemented("getCollectionsByHandles");
904
915
  }
905
916
  /**
906
917
  * Retrieve available filters for collections
@@ -937,12 +948,12 @@ var BaseCommerceClient = class {
937
948
  }
938
949
  /**
939
950
  * Create a new order
940
- * @param data - Order data to create
951
+ * @param params - Order data to create
941
952
  * @param options - Request options (headers, timeout, etc.)
942
953
  * @returns Promise resolving to created order
943
954
  * @throws NotImplementedError if not implemented in adapter
944
955
  */
945
- createOrder(data, options) {
956
+ createOrder(params, options) {
946
957
  this.throwNotImplemented("createOrder");
947
958
  }
948
959
  /**
@@ -1000,12 +1011,12 @@ var BaseCommerceClient = class {
1000
1011
  }
1001
1012
  /**
1002
1013
  * Create a new customer account
1003
- * @param data - Customer data to create
1014
+ * @param params - Customer data to create
1004
1015
  * @param options - Request options (headers, timeout, etc.)
1005
1016
  * @returns Promise resolving to created customer
1006
1017
  * @throws NotImplementedError if not implemented in adapter
1007
1018
  */
1008
- createCustomer(data, options) {
1019
+ createCustomer(params, options) {
1009
1020
  this.throwNotImplemented("createCustomer");
1010
1021
  }
1011
1022
  /**
@@ -1083,28 +1094,6 @@ var BaseCommerceClient = class {
1083
1094
  createCheckout(params, options) {
1084
1095
  this.throwNotImplemented("createCheckout");
1085
1096
  }
1086
- /**
1087
- * Update an existing checkout session
1088
- * @param id - Checkout identifier
1089
- * @param data - Checkout update data
1090
- * @param options - Request options (headers, timeout, etc.)
1091
- * @returns Promise resolving to updated checkout
1092
- * @throws NotImplementedError if not implemented in adapter
1093
- */
1094
- updateCheckout(id, data, options) {
1095
- this.throwNotImplemented("updateCheckout");
1096
- }
1097
- /**
1098
- * Complete a checkout and create an order
1099
- * @param id - Checkout identifier
1100
- * @param paymentData - Payment information
1101
- * @param options - Request options (headers, timeout, etc.)
1102
- * @returns Promise resolving to created order
1103
- * @throws NotImplementedError if not implemented in adapter
1104
- */
1105
- completeCheckout(id, paymentData, options) {
1106
- this.throwNotImplemented("completeCheckout");
1107
- }
1108
1097
  // ========================================
1109
1098
  // ARTICLE/BLOG OPERATIONS
1110
1099
  // ========================================
@@ -1153,22 +1142,21 @@ var BaseCommerceClient = class {
1153
1142
  // ========================================
1154
1143
  /**
1155
1144
  * Utility method to make GraphQL requests
1156
- * @param query - GraphQL query string
1157
- * @param variables - GraphQL variables
1145
+ * @param params - Object containing query string and optional variables
1158
1146
  * @returns Promise resolving to standardized response
1159
1147
  * @throws NotImplementedError if not implemented in adapter
1160
1148
  */
1161
- graphqlRequest(query, variables) {
1149
+ graphqlRequest(params) {
1162
1150
  this.throwNotImplemented("graphqlRequest");
1163
1151
  }
1164
1152
  /**
1165
1153
  * Utility method to make custom fetch requests to any endpoint
1166
- * @param url - Target URL for the request
1167
- * @param options - Request options
1154
+ * @param params - Object containing url and optional fetch options
1168
1155
  * @returns Promise resolving to standardized response
1169
1156
  */
1170
- async fetchRequest(url, fetchOptions) {
1157
+ async fetchRequest(params) {
1171
1158
  try {
1159
+ const { url, ...fetchOptions } = params;
1172
1160
  const response = await fetch(url, fetchOptions);
1173
1161
  const data = await response.json();
1174
1162
  if (response.ok) {
@@ -1626,6 +1614,92 @@ var GET_COLLECTION = `
1626
1614
  }
1627
1615
  }
1628
1616
  `;
1617
+ var GET_PRODUCT_RECOMMENDATIONS = `
1618
+ query GetProductRecommendations($productId: ID!) {
1619
+ productRecommendations(productId: $productId) {
1620
+ id
1621
+ title
1622
+ description
1623
+ handle
1624
+ productType
1625
+ vendor
1626
+ tags
1627
+ availableForSale
1628
+ options {
1629
+ id
1630
+ name
1631
+ values
1632
+ }
1633
+ variants(first: 10) {
1634
+ nodes {
1635
+ id
1636
+ title
1637
+ sku
1638
+ availableForSale
1639
+ selectedOptions {
1640
+ name
1641
+ value
1642
+ }
1643
+ price {
1644
+ amount
1645
+ currencyCode
1646
+ }
1647
+ compareAtPrice {
1648
+ amount
1649
+ currencyCode
1650
+ }
1651
+ image {
1652
+ id
1653
+ url
1654
+ altText
1655
+ width
1656
+ height
1657
+ }
1658
+ }
1659
+ }
1660
+ images(first: 10) {
1661
+ nodes {
1662
+ id
1663
+ url
1664
+ altText
1665
+ width
1666
+ height
1667
+ }
1668
+ }
1669
+ priceRange {
1670
+ minVariantPrice {
1671
+ amount
1672
+ currencyCode
1673
+ }
1674
+ maxVariantPrice {
1675
+ amount
1676
+ currencyCode
1677
+ }
1678
+ }
1679
+ compareAtPriceRange {
1680
+ minVariantPrice {
1681
+ amount
1682
+ currencyCode
1683
+ }
1684
+ maxVariantPrice {
1685
+ amount
1686
+ currencyCode
1687
+ }
1688
+ }
1689
+ metafields(
1690
+ identifiers: [
1691
+ { namespace: "reviews", key: "rating" },
1692
+ { namespace: "reviews", key: "rating_count" }
1693
+ ]
1694
+ ) {
1695
+ key
1696
+ namespace
1697
+ value
1698
+ type
1699
+ }
1700
+ }
1701
+ }
1702
+ `;
1629
1703
  var GET_COLLECTIONS = `
1630
1704
  query GetCollections(
1631
1705
  $first: Int,
@@ -1852,11 +1926,78 @@ var ProductService = class extends BaseShopifyService {
1852
1926
  });
1853
1927
  }
1854
1928
  }
1929
+ /**
1930
+ * Get product recommendations for a given product
1931
+ * Uses Shopify's productRecommendations API
1932
+ */
1933
+ async getProductRecommendations(params, options) {
1934
+ try {
1935
+ const { productId } = params;
1936
+ if (!productId) {
1937
+ return formatResponse({
1938
+ success: false,
1939
+ message: "No product ID provided."
1940
+ });
1941
+ }
1942
+ const formattedId = productId.includes("gid://") ? productId : `gid://shopify/Product/${productId}`;
1943
+ const query = options?.query || GET_PRODUCT_RECOMMENDATIONS;
1944
+ const variables = options?.variables || { productId: formattedId };
1945
+ const { result, errors } = await this.query(query, variables, options);
1946
+ if (errors && errors.length > 0) {
1947
+ this.logger.error(
1948
+ "GraphQL errors in GET_PRODUCT_RECOMMENDATIONS",
1949
+ void 0,
1950
+ { errors }
1951
+ );
1952
+ return formatResponse({
1953
+ success: false,
1954
+ message: "Failed to fetch product recommendations due to upstream errors.",
1955
+ error: {
1956
+ message: "GraphQL errors received.",
1957
+ details: errors
1958
+ }
1959
+ });
1960
+ }
1961
+ if (!result.data || !result.data.productRecommendations) {
1962
+ return formatResponse({
1963
+ success: true,
1964
+ message: "No product recommendations found.",
1965
+ data: [],
1966
+ meta: void 0
1967
+ });
1968
+ }
1969
+ return formatResponse({
1970
+ success: true,
1971
+ message: "Product recommendations retrieved successfully.",
1972
+ data: mapGetProductsToResponse({
1973
+ nodes: result.data.productRecommendations
1974
+ }),
1975
+ meta: {
1976
+ sourceProductId: productId,
1977
+ recommendationCount: result.data.productRecommendations.length
1978
+ }
1979
+ });
1980
+ } catch (error) {
1981
+ this.logger.error("Error in getProductRecommendations", void 0, {
1982
+ error
1983
+ });
1984
+ const safeMessage = error instanceof Error ? error.message : "An unexpected error occurred while processing the request.";
1985
+ return formatResponse({
1986
+ success: false,
1987
+ message: "An error occurred while processing the request.",
1988
+ error: {
1989
+ message: safeMessage,
1990
+ details: error
1991
+ }
1992
+ });
1993
+ }
1994
+ }
1855
1995
  /**
1856
1996
  * Get multiple products by their handles using batch query
1857
1997
  */
1858
- async getProductsByHandles(handles, options) {
1998
+ async getProductsByHandles(params, options) {
1859
1999
  try {
2000
+ const { handles } = params;
1860
2001
  if (!handles || handles.length === 0) {
1861
2002
  return formatResponse({
1862
2003
  success: true,
@@ -3937,8 +4078,15 @@ var ShopifyCommerceClient = class extends BaseCommerceClient {
3937
4078
  /**
3938
4079
  * Get multiple products by their handles using batch query
3939
4080
  */
3940
- async getProductsByHandles(handles, options) {
3941
- return this.productService.getProductsByHandles(handles, options);
4081
+ async getProductsByHandles(params, options) {
4082
+ return this.productService.getProductsByHandles(params, options);
4083
+ }
4084
+ /**
4085
+ * Get product recommendations for a given product
4086
+ * Uses Shopify's productRecommendations API
4087
+ */
4088
+ async getProductRecommendations(params, options) {
4089
+ return this.productService.getProductRecommendations(params, options);
3942
4090
  }
3943
4091
  // ============================================================================
3944
4092
  // COLLECTION API METHODS - Now delegated to ProductService
@@ -3955,19 +4103,30 @@ var ShopifyCommerceClient = class extends BaseCommerceClient {
3955
4103
  async getCollection(params, options) {
3956
4104
  return this.productService.getCollection(params, options);
3957
4105
  }
3958
- /**
3959
- * Retrieve multiple collections by their handles with individual query parameters
3960
- * Each collection can have its own specific filtering, pagination, and sorting options
3961
- * @param params - Array of collection objects with handles and their respective query parameters
3962
- * @param options - Request options (headers, timeout, etc.)
3963
- * @returns Promise resolving to collections data with individual query results
3964
- */
3965
4106
  /**
3966
4107
  * Get multiple collections by their handles (preferred method name)
3967
4108
  */
3968
4109
  getCollectionsByHandles(params, options) {
3969
4110
  return this.productService.getCollectionsByHandles(params, options);
3970
4111
  }
4112
+ /**
4113
+ * Get collection filters (available filter options for a collection)
4114
+ */
4115
+ async getCollectionFilters(params, options) {
4116
+ const result = await this.productService.getCollection(
4117
+ { handle: params.handle },
4118
+ options
4119
+ );
4120
+ if (!result.success) {
4121
+ return result;
4122
+ }
4123
+ return formatResponse({
4124
+ success: true,
4125
+ message: "Collection filters retrieved successfully",
4126
+ data: result.meta?.filters || [],
4127
+ meta: void 0
4128
+ });
4129
+ }
3971
4130
  // ============================================================================
3972
4131
  // CART API METHODS - Delegated to CartService
3973
4132
  // ============================================================================
@@ -4069,7 +4228,8 @@ var ShopifyCommerceClient = class extends BaseCommerceClient {
4069
4228
  /**
4070
4229
  * Utility method to make GraphQL requests using Shopify client
4071
4230
  */
4072
- async graphqlRequest(query, variables) {
4231
+ async graphqlRequest(params) {
4232
+ const { query, variables } = params;
4073
4233
  this.logger.info("Making GraphQL request", {
4074
4234
  query: query.substring(0, 100) + "..."
4075
4235
  });
@@ -4235,7 +4395,7 @@ var PRODUCT_ENDPOINTS = {
4235
4395
  getCollections: (v = DEFAULT_VERSION) => `/api/${v}/collections`,
4236
4396
  getCollectionByHandle: (v = DEFAULT_VERSION, h) => `/api/${v}/collections/handle/${h}`,
4237
4397
  getCollectionById: (v = DEFAULT_VERSION, id) => `/api/${v}/collections/${id}`,
4238
- getCollectionsByHandels: (v = DEFAULT_VERSION) => `/api/${v}/collections/details`,
4398
+ getCollectionsByHandles: (v = DEFAULT_VERSION) => `/api/${v}/collections/details`,
4239
4399
  getCollectionFilters: (v = DEFAULT_VERSION, collectionHandle) => `/api/${v}/storefront/collections/${collectionHandle}/filters`
4240
4400
  };
4241
4401
 
@@ -4347,8 +4507,9 @@ var ProductService2 = class extends BaseCustomService {
4347
4507
  /**
4348
4508
  * Get multiple products by their handles using batch query
4349
4509
  */
4350
- async getProductsByHandles(handles, options) {
4510
+ async getProductsByHandles(params, options) {
4351
4511
  try {
4512
+ const { handles } = params;
4352
4513
  if (!handles || handles.length === 0) {
4353
4514
  return formatResponse({
4354
4515
  success: true,
@@ -4514,7 +4675,7 @@ var ProductService2 = class extends BaseCustomService {
4514
4675
  * Get multiple collections by their handles with individual query parameters
4515
4676
  * Each collection can have its own specific filtering, pagination, and sorting options
4516
4677
  */
4517
- async getCollectionsByHandels(params, options) {
4678
+ async getCollectionsByHandles(params, options) {
4518
4679
  try {
4519
4680
  const { handles } = params;
4520
4681
  if (!handles || handles.length === 0) {
@@ -4549,7 +4710,7 @@ var ProductService2 = class extends BaseCustomService {
4549
4710
  );
4550
4711
  }
4551
4712
  const result = await this.request(
4552
- PRODUCT_ENDPOINTS.getCollectionsByHandels(options?.version),
4713
+ PRODUCT_ENDPOINTS.getCollectionsByHandles(options?.version),
4553
4714
  "POST",
4554
4715
  payload,
4555
4716
  options
@@ -4562,7 +4723,9 @@ var ProductService2 = class extends BaseCustomService {
4562
4723
  meta: { pagination: void 0 }
4563
4724
  });
4564
4725
  }
4565
- const mappedCollections = result.collections.map((collection) => ({
4726
+ const mappedCollections = result.collections.filter(
4727
+ (collection) => collection !== null && collection !== void 0
4728
+ ).map((collection) => ({
4566
4729
  handle: collection.handle,
4567
4730
  data: mapGetCollectionsByHandelsResponse(collection),
4568
4731
  meta: {
@@ -4578,7 +4741,7 @@ var ProductService2 = class extends BaseCustomService {
4578
4741
  meta: void 0
4579
4742
  });
4580
4743
  } catch (error) {
4581
- this.logger.error("Error in getCollectionsByHandels", void 0, {
4744
+ this.logger.error("Error in getCollectionsByHandles", void 0, {
4582
4745
  error
4583
4746
  });
4584
4747
  const safeMessage = error instanceof Error ? error.message : "An unexpected error occurred while processing the request.";
@@ -5179,9 +5342,9 @@ var CustomBackendClient = class extends BaseCommerceClient {
5179
5342
  async getProducts(params, options) {
5180
5343
  return this.productService.getProducts(params, filterRestOptions(options));
5181
5344
  }
5182
- async getProductsByHandles(handles, options) {
5345
+ async getProductsByHandles(params, options) {
5183
5346
  return this.productService.getProductsByHandles(
5184
- handles,
5347
+ params,
5185
5348
  filterRestOptions(options)
5186
5349
  );
5187
5350
  }
@@ -5200,7 +5363,7 @@ var CustomBackendClient = class extends BaseCommerceClient {
5200
5363
  /**
5201
5364
  * Get a collection by ID
5202
5365
  */
5203
- getCollection(params, options) {
5366
+ async getCollection(params, options) {
5204
5367
  return this.productService.getCollection(
5205
5368
  params,
5206
5369
  filterRestOptions(options)
@@ -5213,8 +5376,8 @@ var CustomBackendClient = class extends BaseCommerceClient {
5213
5376
  * @param options - Request options (headers, timeout, etc.)
5214
5377
  * @returns Promise resolving to collections data with individual query results
5215
5378
  */
5216
- getCollectionsByHandels(params, options) {
5217
- return this.productService.getCollectionsByHandels(
5379
+ async getCollectionsByHandles(params, options) {
5380
+ return this.productService.getCollectionsByHandles(
5218
5381
  params,
5219
5382
  filterRestOptions(options)
5220
5383
  );
@@ -5251,12 +5414,6 @@ var CustomBackendClient = class extends BaseCommerceClient {
5251
5414
  async createCheckout(params, options) {
5252
5415
  return this.cartService.createCheckout(params, filterRestOptions(options));
5253
5416
  }
5254
- async updateCheckout(id, data, options) {
5255
- throw new Error("Checkout service not implemented in custom adapter");
5256
- }
5257
- async completeCheckout(id, paymentData, options) {
5258
- throw new Error("Checkout service not implemented in custom adapter");
5259
- }
5260
5417
  // ========================================
5261
5418
  // CUSTOMER OPERATIONS
5262
5419
  // ========================================
@@ -5373,6 +5530,137 @@ var EFulfillmentStatus = /* @__PURE__ */ ((EFulfillmentStatus2) => {
5373
5530
  return EFulfillmentStatus2;
5374
5531
  })(EFulfillmentStatus || {});
5375
5532
 
5533
+ // src/static-params/index.ts
5534
+ var log = logger.child({ module: "static-params" });
5535
+ async function withConcurrency(thunks, limit) {
5536
+ const results = new Array(thunks.length);
5537
+ let next = 0;
5538
+ async function worker() {
5539
+ while (next < thunks.length) {
5540
+ const i = next++;
5541
+ results[i] = await thunks[i]().catch(() => []);
5542
+ }
5543
+ }
5544
+ await Promise.all(Array.from({ length: Math.min(limit, thunks.length) }, worker));
5545
+ return results;
5546
+ }
5547
+ async function traverseCollectionProducts(client, collectionsLimit, productsPerCollection, concurrency) {
5548
+ const collectionsResult = await client.getCollections({ first: collectionsLimit });
5549
+ const collections = Array.isArray(collectionsResult?.data) ? collectionsResult.data : [];
5550
+ if (collections.length === 0) return [];
5551
+ if (collections.length >= collectionsLimit) {
5552
+ log.warn(
5553
+ "getCollections hit the collections limit \u2014 some collections may be missing from static build; increase options.collectionsLimit if needed",
5554
+ { count: collections.length, limit: collectionsLimit }
5555
+ );
5556
+ }
5557
+ const thunks = collections.map((collection) => async () => {
5558
+ const collectionname = collection?.handle;
5559
+ if (!collectionname) return [];
5560
+ try {
5561
+ const result = await client.getCollection({
5562
+ handle: collectionname,
5563
+ productLimit: productsPerCollection
5564
+ });
5565
+ const col = result?.data;
5566
+ const products = Array.isArray(col?.products) ? col.products : [];
5567
+ return products.map((p) => p?.handle).filter((h) => Boolean(h)).map((productHandle) => ({ collectionname, productHandle }));
5568
+ } catch (err) {
5569
+ log.warn(
5570
+ "Skipping collection during static generation \u2014 getCollection failed",
5571
+ { collection: collectionname, err: err instanceof Error ? err.message : String(err) }
5572
+ );
5573
+ return [];
5574
+ }
5575
+ });
5576
+ const pairsNested = await withConcurrency(thunks, concurrency);
5577
+ return pairsNested.flat();
5578
+ }
5579
+ function createCollectionStaticParams(getClient, options) {
5580
+ return async function generateStaticParams() {
5581
+ const limit = options?.limit ?? 250;
5582
+ try {
5583
+ const result = await getClient().getCollections({ first: limit });
5584
+ const collections = Array.isArray(result?.data) ? result.data : [];
5585
+ if (collections.length >= limit) {
5586
+ log.warn(
5587
+ "getCollections returned max limit \u2014 some collections may be missing from static build; increase options.limit if needed",
5588
+ { count: collections.length, limit }
5589
+ );
5590
+ }
5591
+ return collections.map((c) => c?.handle).filter((h) => Boolean(h)).map((handle) => ({ collectionname: handle }));
5592
+ } catch (error) {
5593
+ log.error("getCollections failed during static generation", error instanceof Error ? error : new Error(String(error)));
5594
+ return [];
5595
+ }
5596
+ };
5597
+ }
5598
+ function createProductStaticParams(getClient, options) {
5599
+ return async function generateStaticParams() {
5600
+ const limit = options?.limit ?? 250;
5601
+ try {
5602
+ const result = await getClient().getProducts({ first: limit });
5603
+ const products = Array.isArray(result?.data) ? result.data : [];
5604
+ if (products.length >= limit) {
5605
+ log.warn(
5606
+ "getProducts returned max limit \u2014 some products may be missing from static build; increase options.limit if needed",
5607
+ { count: products.length, limit }
5608
+ );
5609
+ }
5610
+ return products.map((p) => p?.handle).filter((h) => Boolean(h)).map((handle) => ({ handle }));
5611
+ } catch (error) {
5612
+ log.error("getProducts failed during static generation", error instanceof Error ? error : new Error(String(error)));
5613
+ return [];
5614
+ }
5615
+ };
5616
+ }
5617
+ function createProductViaCollectionsStaticParams(getClient, options) {
5618
+ return async function generateStaticParams() {
5619
+ try {
5620
+ const pairs = await traverseCollectionProducts(
5621
+ getClient(),
5622
+ options?.collectionsLimit ?? 250,
5623
+ options?.productsPerCollection ?? 100,
5624
+ options?.concurrency ?? 10
5625
+ );
5626
+ const seen = /* @__PURE__ */ new Set();
5627
+ return pairs.filter(({ productHandle }) => {
5628
+ if (seen.has(productHandle)) return false;
5629
+ seen.add(productHandle);
5630
+ return true;
5631
+ }).map(({ productHandle }) => ({ handle: productHandle }));
5632
+ } catch (error) {
5633
+ log.error("getProductHandlesViaCollections failed during static generation", error instanceof Error ? error : new Error(String(error)));
5634
+ return [];
5635
+ }
5636
+ };
5637
+ }
5638
+ function createCollectionProductStaticParams(getClient, options) {
5639
+ return async function generateStaticParams() {
5640
+ try {
5641
+ const pairs = await traverseCollectionProducts(
5642
+ getClient(),
5643
+ options?.collectionsLimit ?? 50,
5644
+ options?.productsPerCollection ?? 20,
5645
+ options?.concurrency ?? 10
5646
+ );
5647
+ const seen = /* @__PURE__ */ new Set();
5648
+ return pairs.filter(({ collectionname, productHandle }) => {
5649
+ const key = `${collectionname}:${productHandle}`;
5650
+ if (seen.has(key)) return false;
5651
+ seen.add(key);
5652
+ return true;
5653
+ }).map(({ collectionname, productHandle }) => ({
5654
+ collectionname,
5655
+ handle: productHandle
5656
+ }));
5657
+ } catch (error) {
5658
+ log.error("getCollectionProducts failed during static generation", error instanceof Error ? error : new Error(String(error)));
5659
+ return [];
5660
+ }
5661
+ };
5662
+ }
5663
+
5376
5664
  exports.EAvailability = EAvailability;
5377
5665
  exports.ECollectionSortKey = ECollectionSortKey;
5378
5666
  exports.EFulfillmentStatus = EFulfillmentStatus;
@@ -5380,8 +5668,12 @@ exports.EOrderSortKey = EOrderSortKey;
5380
5668
  exports.EOrderStatus = EOrderStatus;
5381
5669
  exports.EPaymentStatus = EPaymentStatus;
5382
5670
  exports.EProductSortKey = EProductSortKey;
5671
+ exports.createCollectionProductStaticParams = createCollectionProductStaticParams;
5672
+ exports.createCollectionStaticParams = createCollectionStaticParams;
5383
5673
  exports.createCommerceClient = createCommerceClient;
5384
5674
  exports.createCustomClient = createCustomClient;
5675
+ exports.createProductStaticParams = createProductStaticParams;
5676
+ exports.createProductViaCollectionsStaticParams = createProductViaCollectionsStaticParams;
5385
5677
  exports.createShopifyClient = createShopifyClient;
5386
5678
  //# sourceMappingURL=index.js.map
5387
5679
  //# sourceMappingURL=index.js.map