@shopkit/data-layer 1.1.0 → 1.3.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,5 +1,7 @@
1
- import { I as IShopifyConfig, L as LoggerConfig, S as ShopifyCommerceClient, a as ICustomConfig, C as CustomBackendClient, b as ICommerceClient } from './service-Cnm8tn7H.mjs';
1
+ import { I as ICommerceClient } from './interface-NJcjuqaL.mjs';
2
+ import { I as IShopifyConfig, L as LoggerConfig, a as ICustomConfig, C as CustomBackendClient, S as ShopifyCommerceClient } from './service-DBKEK2oS.mjs';
2
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
7
  * Commerce Client Factory
@@ -89,4 +91,35 @@ type IClientConfig = {
89
91
  */
90
92
  declare function createCommerceClient(clientConfig: IClientConfig): ICommerceClient;
91
93
 
92
- export { type IClientConfig, ICommerceClient, ICustomConfig, IShopifyConfig, createCommerceClient, createCustomClient, createShopifyClient };
94
+ /**
95
+ * Centralized HTTP request deadline policy.
96
+ *
97
+ * Every upstream fetch made by this package MUST carry an AbortSignal.
98
+ * An unbounded fetch against a hung upstream never settles, which pins
99
+ * the awaiting caller (e.g. a Next.js SSR render and all its data) in
100
+ * memory indefinitely — root cause of the Bblunt prod memory leak
101
+ * (Jun 2026). See __tests__/adapters/custom/services/base.test.ts for
102
+ * the regression tests.
103
+ *
104
+ * Chosen default: 10s. Render-path APIs (products/collections) measure
105
+ * P99 well under 1s, while checkout-flow operations have P99s of 9–12s;
106
+ * 10s bounds the leak without failing legitimate slow checkout calls.
107
+ * Callers can tighten or loosen per request via options.timeoutMs, or
108
+ * take full control with options.signal.
109
+ */
110
+ /** Single source of truth for the default upstream request deadline. */
111
+ declare const DEFAULT_REQUEST_TIMEOUT_MS = 10000;
112
+ /**
113
+ * Resolve the AbortSignal for an upstream request.
114
+ *
115
+ * Precedence: caller-provided signal > caller timeoutMs > defaultMs.
116
+ *
117
+ * @param options - Request options possibly carrying signal/timeoutMs
118
+ * @param defaultMs - Fallback deadline (defaults to DEFAULT_REQUEST_TIMEOUT_MS)
119
+ */
120
+ declare function resolveRequestSignal(options?: {
121
+ signal?: AbortSignal | null;
122
+ timeoutMs?: number;
123
+ }, defaultMs?: number): AbortSignal;
124
+
125
+ export { DEFAULT_REQUEST_TIMEOUT_MS, type IClientConfig, ICommerceClient, ICustomConfig, IShopifyConfig, createCommerceClient, createCustomClient, createShopifyClient, resolveRequestSignal };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { I as IShopifyConfig, L as LoggerConfig, S as ShopifyCommerceClient, a as ICustomConfig, C as CustomBackendClient, b as ICommerceClient } from './service-Dw9qj17-.js';
1
+ import { I as ICommerceClient } from './interface-dqoKc63z.js';
2
+ import { I as IShopifyConfig, L as LoggerConfig, a as ICustomConfig, C as CustomBackendClient, S as ShopifyCommerceClient } from './service-BHCLUEim.js';
2
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
7
  * Commerce Client Factory
@@ -89,4 +91,35 @@ type IClientConfig = {
89
91
  */
90
92
  declare function createCommerceClient(clientConfig: IClientConfig): ICommerceClient;
91
93
 
92
- export { type IClientConfig, ICommerceClient, ICustomConfig, IShopifyConfig, createCommerceClient, createCustomClient, createShopifyClient };
94
+ /**
95
+ * Centralized HTTP request deadline policy.
96
+ *
97
+ * Every upstream fetch made by this package MUST carry an AbortSignal.
98
+ * An unbounded fetch against a hung upstream never settles, which pins
99
+ * the awaiting caller (e.g. a Next.js SSR render and all its data) in
100
+ * memory indefinitely — root cause of the Bblunt prod memory leak
101
+ * (Jun 2026). See __tests__/adapters/custom/services/base.test.ts for
102
+ * the regression tests.
103
+ *
104
+ * Chosen default: 10s. Render-path APIs (products/collections) measure
105
+ * P99 well under 1s, while checkout-flow operations have P99s of 9–12s;
106
+ * 10s bounds the leak without failing legitimate slow checkout calls.
107
+ * Callers can tighten or loosen per request via options.timeoutMs, or
108
+ * take full control with options.signal.
109
+ */
110
+ /** Single source of truth for the default upstream request deadline. */
111
+ declare const DEFAULT_REQUEST_TIMEOUT_MS = 10000;
112
+ /**
113
+ * Resolve the AbortSignal for an upstream request.
114
+ *
115
+ * Precedence: caller-provided signal > caller timeoutMs > defaultMs.
116
+ *
117
+ * @param options - Request options possibly carrying signal/timeoutMs
118
+ * @param defaultMs - Fallback deadline (defaults to DEFAULT_REQUEST_TIMEOUT_MS)
119
+ */
120
+ declare function resolveRequestSignal(options?: {
121
+ signal?: AbortSignal | null;
122
+ timeoutMs?: number;
123
+ }, defaultMs?: number): AbortSignal;
124
+
125
+ export { DEFAULT_REQUEST_TIMEOUT_MS, type IClientConfig, ICommerceClient, ICustomConfig, IShopifyConfig, createCommerceClient, createCustomClient, createShopifyClient, resolveRequestSignal };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // ../../node_modules/@shopify/graphql-client/dist/graphql-client/constants.mjs
3
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/graphql-client/constants.mjs
4
4
  var CLIENT = "GraphQL Client";
5
5
  var MIN_RETRIES = 0;
6
6
  var MAX_RETRIES = 3;
@@ -14,7 +14,7 @@ var CONTENT_TYPES = {
14
14
  var SDK_VARIANT_HEADER = "X-SDK-Variant";
15
15
  var SDK_VERSION_HEADER = "X-SDK-Version";
16
16
  var DEFAULT_SDK_VARIANT = "shopify-graphql-client";
17
- var DEFAULT_CLIENT_VERSION = "1.4.1";
17
+ var DEFAULT_CLIENT_VERSION = "1.4.2";
18
18
  var RETRY_WAIT_TIME = 1e3;
19
19
  var RETRIABLE_STATUS_CODES = [429, 503];
20
20
  var DEFER_OPERATION_REGEX = /@(defer)\b/i;
@@ -22,7 +22,7 @@ var NEWLINE_SEPARATOR = "\r\n";
22
22
  var BOUNDARY_HEADER_REGEX = /boundary="?([^=";]+)"?/i;
23
23
  var HEADER_SEPARATOR = NEWLINE_SEPARATOR + NEWLINE_SEPARATOR;
24
24
 
25
- // ../../node_modules/@shopify/graphql-client/dist/graphql-client/utilities.mjs
25
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/graphql-client/utilities.mjs
26
26
  function formatErrorMessage(message, client = CLIENT) {
27
27
  return message.startsWith(`${client}`) ? message : `${client}: ${message}`;
28
28
  }
@@ -72,7 +72,7 @@ function buildCombinedDataObject([initialDatum, ...remainingData]) {
72
72
  return remainingData.reduce(combineObjects, { ...initialDatum });
73
73
  }
74
74
 
75
- // ../../node_modules/@shopify/graphql-client/dist/graphql-client/http-fetch.mjs
75
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/graphql-client/http-fetch.mjs
76
76
  function generateHttpFetch({ clientLogger, customFetchApi = fetch, client = CLIENT, defaultRetryWaitTime = RETRY_WAIT_TIME, retriableCodes = RETRIABLE_STATUS_CODES }) {
77
77
  const httpFetch = async (requestParams, count, maxRetries) => {
78
78
  const nextCount = count + 1;
@@ -125,7 +125,7 @@ async function sleep(waitTime) {
125
125
  return new Promise((resolve) => setTimeout(resolve, waitTime));
126
126
  }
127
127
 
128
- // ../../node_modules/@shopify/graphql-client/dist/graphql-client/graphql-client.mjs
128
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/graphql-client/graphql-client.mjs
129
129
  function createGraphQLClient({ headers, url, customFetchApi = fetch, retries = 0, logger: logger2 }) {
130
130
  validateRetries({ client: CLIENT, retries });
131
131
  const config = {
@@ -296,11 +296,22 @@ function readStreamChunk(streamBodyIterator, boundary) {
296
296
  function createJsonResponseAsyncIterator(response) {
297
297
  return {
298
298
  async *[Symbol.asyncIterator]() {
299
- const processedResponse = await processJSONResponse(response);
300
- yield {
301
- ...processedResponse,
302
- hasNext: false
303
- };
299
+ try {
300
+ const processedResponse = await processJSONResponse(response);
301
+ yield {
302
+ ...processedResponse,
303
+ hasNext: false
304
+ };
305
+ } catch (error) {
306
+ yield {
307
+ errors: {
308
+ message: formatErrorMessage(getErrorMessage(error)),
309
+ networkStatusCode: response.status,
310
+ response
311
+ },
312
+ hasNext: false
313
+ };
314
+ }
304
315
  }
305
316
  };
306
317
  }
@@ -437,7 +448,7 @@ function generateRequestStream(fetchFn) {
437
448
  };
438
449
  }
439
450
 
440
- // ../../node_modules/@shopify/graphql-client/dist/api-client-utilities/validations.mjs
451
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/api-client-utilities/validations.mjs
441
452
  function validateDomainAndGetStoreUrl({ client, storeDomain }) {
442
453
  try {
443
454
  if (!storeDomain || typeof storeDomain !== "string") {
@@ -474,7 +485,7 @@ function validateApiVersion({ client, currentSupportedApiVersions, apiVersion, l
474
485
  }
475
486
  }
476
487
 
477
- // ../../node_modules/@shopify/graphql-client/dist/api-client-utilities/api-versions.mjs
488
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/api-client-utilities/api-versions.mjs
478
489
  function getQuarterMonth(quarter) {
479
490
  const month = quarter * 3 - 2;
480
491
  return month === 10 ? month : `0${month}`;
@@ -510,7 +521,7 @@ function getCurrentSupportedApiVersions() {
510
521
  ];
511
522
  }
512
523
 
513
- // ../../node_modules/@shopify/graphql-client/dist/api-client-utilities/utilities.mjs
524
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/api-client-utilities/utilities.mjs
514
525
  function generateGetHeaders(config) {
515
526
  return (customHeaders) => {
516
527
  return { ...customHeaders ?? {}, ...config.headers };
@@ -533,10 +544,10 @@ function generateGetGQLClientParams({ getHeaders, getApiUrl }) {
533
544
  };
534
545
  }
535
546
 
536
- // ../../node_modules/@shopify/storefront-api-client/dist/constants.mjs
547
+ // ../../node_modules/.bun/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/constants.mjs
537
548
  var DEFAULT_CONTENT_TYPE = "application/json";
538
549
  var DEFAULT_SDK_VARIANT2 = "storefront-api-client";
539
- var DEFAULT_CLIENT_VERSION2 = "1.0.9";
550
+ var DEFAULT_CLIENT_VERSION2 = "1.0.10";
540
551
  var PUBLIC_ACCESS_TOKEN_HEADER = "X-Shopify-Storefront-Access-Token";
541
552
  var PRIVATE_ACCESS_TOKEN_HEADER = "Shopify-Storefront-Private-Token";
542
553
  var SDK_VARIANT_HEADER2 = "X-SDK-Variant";
@@ -544,7 +555,7 @@ var SDK_VERSION_HEADER2 = "X-SDK-Version";
544
555
  var SDK_VARIANT_SOURCE_HEADER = "X-SDK-Variant-Source";
545
556
  var CLIENT2 = "Storefront API Client";
546
557
 
547
- // ../../node_modules/@shopify/storefront-api-client/dist/validations.mjs
558
+ // ../../node_modules/.bun/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/validations.mjs
548
559
  function validatePrivateAccessTokenUsage(privateAccessToken) {
549
560
  if (privateAccessToken && typeof window !== "undefined") {
550
561
  throw new Error(`${CLIENT2}: private access tokens and headers should only be used in a server-to-server implementation. Use the public API access token in nonserver environments.`);
@@ -559,7 +570,7 @@ function validateRequiredAccessTokens(publicAccessToken, privateAccessToken) {
559
570
  }
560
571
  }
561
572
 
562
- // ../../node_modules/@shopify/storefront-api-client/dist/storefront-api-client.mjs
573
+ // ../../node_modules/.bun/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/storefront-api-client.mjs
563
574
  function createStorefrontApiClient({ storeDomain, apiVersion, publicAccessToken, privateAccessToken, clientName, retries = 0, customFetchApi, logger: logger2 }) {
564
575
  const currentSupportedApiVersions = getCurrentSupportedApiVersions();
565
576
  const storeUrl = validateDomainAndGetStoreUrl({
@@ -784,7 +795,7 @@ function createLogger(config = {}) {
784
795
  }
785
796
  return new UniversalLogger(fullConfig);
786
797
  }
787
- createLogger({
798
+ var logger = createLogger({
788
799
  enabled: false,
789
800
  level: "info",
790
801
  prettyPrint: false
@@ -806,6 +817,12 @@ function formatResponse(params) {
806
817
  };
807
818
  }
808
819
 
820
+ // src/core/request-timeout.ts
821
+ var DEFAULT_REQUEST_TIMEOUT_MS = 1e4;
822
+ function resolveRequestSignal(options, defaultMs = DEFAULT_REQUEST_TIMEOUT_MS) {
823
+ return options?.signal ?? AbortSignal.timeout(options?.timeoutMs ?? defaultMs);
824
+ }
825
+
809
826
  // src/core/client.ts
810
827
  var NotImplementedError = class extends Error {
811
828
  constructor(adapterName, methodName) {
@@ -1157,7 +1174,10 @@ var BaseCommerceClient = class {
1157
1174
  async fetchRequest(params) {
1158
1175
  try {
1159
1176
  const { url, ...fetchOptions } = params;
1160
- const response = await fetch(url, fetchOptions);
1177
+ const response = await fetch(url, {
1178
+ ...fetchOptions,
1179
+ signal: resolveRequestSignal(fetchOptions)
1180
+ });
1161
1181
  const data = await response.json();
1162
1182
  if (response.ok) {
1163
1183
  return formatResponse({
@@ -4284,7 +4304,7 @@ var getCommonHeaders = (config) => {
4284
4304
  // src/adapters/custom/services/base.ts
4285
4305
  var BaseCustomService = class {
4286
4306
  constructor(baseUrl, config, logger2) {
4287
- this.timeout = 5e3;
4307
+ this.timeout = DEFAULT_REQUEST_TIMEOUT_MS;
4288
4308
  this.baseUrl = baseUrl;
4289
4309
  this.config = config;
4290
4310
  this.logger = logger2 || createDomainLogger("custom", "custom", { enabled: false });
@@ -4321,7 +4341,10 @@ var BaseCustomService = class {
4321
4341
  }
4322
4342
  const requestOptions = {
4323
4343
  method,
4324
- headers
4344
+ headers,
4345
+ // Bound the upstream wait — see core/request-timeout.ts for the policy and
4346
+ // rationale (Bblunt prod memory-leak postmortem, Jun 2026).
4347
+ signal: resolveRequestSignal(options, this.timeout)
4325
4348
  };
4326
4349
  if (data && method !== "GET") {
4327
4350
  requestOptions.body = JSON.stringify(data);
@@ -5530,6 +5553,138 @@ var EFulfillmentStatus = /* @__PURE__ */ ((EFulfillmentStatus2) => {
5530
5553
  return EFulfillmentStatus2;
5531
5554
  })(EFulfillmentStatus || {});
5532
5555
 
5556
+ // src/static-params/index.ts
5557
+ var log = logger.child({ module: "static-params" });
5558
+ async function withConcurrency(thunks, limit) {
5559
+ const results = new Array(thunks.length);
5560
+ let next = 0;
5561
+ async function worker() {
5562
+ while (next < thunks.length) {
5563
+ const i = next++;
5564
+ results[i] = await thunks[i]().catch(() => []);
5565
+ }
5566
+ }
5567
+ await Promise.all(Array.from({ length: Math.min(limit, thunks.length) }, worker));
5568
+ return results;
5569
+ }
5570
+ async function traverseCollectionProducts(client, collectionsLimit, productsPerCollection, concurrency) {
5571
+ const collectionsResult = await client.getCollections({ first: collectionsLimit });
5572
+ const collections = Array.isArray(collectionsResult?.data) ? collectionsResult.data : [];
5573
+ if (collections.length === 0) return [];
5574
+ if (collections.length >= collectionsLimit) {
5575
+ log.warn(
5576
+ "getCollections hit the collections limit \u2014 some collections may be missing from static build; increase options.collectionsLimit if needed",
5577
+ { count: collections.length, limit: collectionsLimit }
5578
+ );
5579
+ }
5580
+ const thunks = collections.map((collection) => async () => {
5581
+ const collectionname = collection?.handle;
5582
+ if (!collectionname) return [];
5583
+ try {
5584
+ const result = await client.getCollection({
5585
+ handle: collectionname,
5586
+ productLimit: productsPerCollection
5587
+ });
5588
+ const col = result?.data;
5589
+ const products = Array.isArray(col?.products) ? col.products : [];
5590
+ return products.map((p) => p?.handle).filter((h) => Boolean(h)).map((productHandle) => ({ collectionname, productHandle }));
5591
+ } catch (err) {
5592
+ log.warn(
5593
+ "Skipping collection during static generation \u2014 getCollection failed",
5594
+ { collection: collectionname, err: err instanceof Error ? err.message : String(err) }
5595
+ );
5596
+ return [];
5597
+ }
5598
+ });
5599
+ const pairsNested = await withConcurrency(thunks, concurrency);
5600
+ return pairsNested.flat();
5601
+ }
5602
+ function createCollectionStaticParams(getClient, options) {
5603
+ return async function generateStaticParams() {
5604
+ const limit = options?.limit ?? 250;
5605
+ try {
5606
+ const result = await getClient().getCollections({ first: limit });
5607
+ const collections = Array.isArray(result?.data) ? result.data : [];
5608
+ if (collections.length >= limit) {
5609
+ log.warn(
5610
+ "getCollections returned max limit \u2014 some collections may be missing from static build; increase options.limit if needed",
5611
+ { count: collections.length, limit }
5612
+ );
5613
+ }
5614
+ return collections.map((c) => c?.handle).filter((h) => Boolean(h)).map((handle) => ({ collectionname: handle }));
5615
+ } catch (error) {
5616
+ log.error("getCollections failed during static generation", error instanceof Error ? error : new Error(String(error)));
5617
+ return [];
5618
+ }
5619
+ };
5620
+ }
5621
+ function createProductStaticParams(getClient, options) {
5622
+ return async function generateStaticParams() {
5623
+ const limit = options?.limit ?? 250;
5624
+ try {
5625
+ const result = await getClient().getProducts({ first: limit });
5626
+ const products = Array.isArray(result?.data) ? result.data : [];
5627
+ if (products.length >= limit) {
5628
+ log.warn(
5629
+ "getProducts returned max limit \u2014 some products may be missing from static build; increase options.limit if needed",
5630
+ { count: products.length, limit }
5631
+ );
5632
+ }
5633
+ return products.map((p) => p?.handle).filter((h) => Boolean(h)).map((handle) => ({ handle }));
5634
+ } catch (error) {
5635
+ log.error("getProducts failed during static generation", error instanceof Error ? error : new Error(String(error)));
5636
+ return [];
5637
+ }
5638
+ };
5639
+ }
5640
+ function createProductViaCollectionsStaticParams(getClient, options) {
5641
+ return async function generateStaticParams() {
5642
+ try {
5643
+ const pairs = await traverseCollectionProducts(
5644
+ getClient(),
5645
+ options?.collectionsLimit ?? 250,
5646
+ options?.productsPerCollection ?? 100,
5647
+ options?.concurrency ?? 10
5648
+ );
5649
+ const seen = /* @__PURE__ */ new Set();
5650
+ return pairs.filter(({ productHandle }) => {
5651
+ if (seen.has(productHandle)) return false;
5652
+ seen.add(productHandle);
5653
+ return true;
5654
+ }).map(({ productHandle }) => ({ handle: productHandle }));
5655
+ } catch (error) {
5656
+ log.error("getProductHandlesViaCollections failed during static generation", error instanceof Error ? error : new Error(String(error)));
5657
+ return [];
5658
+ }
5659
+ };
5660
+ }
5661
+ function createCollectionProductStaticParams(getClient, options) {
5662
+ return async function generateStaticParams() {
5663
+ try {
5664
+ const pairs = await traverseCollectionProducts(
5665
+ getClient(),
5666
+ options?.collectionsLimit ?? 50,
5667
+ options?.productsPerCollection ?? 20,
5668
+ options?.concurrency ?? 10
5669
+ );
5670
+ const seen = /* @__PURE__ */ new Set();
5671
+ return pairs.filter(({ collectionname, productHandle }) => {
5672
+ const key = `${collectionname}:${productHandle}`;
5673
+ if (seen.has(key)) return false;
5674
+ seen.add(key);
5675
+ return true;
5676
+ }).map(({ collectionname, productHandle }) => ({
5677
+ collectionname,
5678
+ handle: productHandle
5679
+ }));
5680
+ } catch (error) {
5681
+ log.error("getCollectionProducts failed during static generation", error instanceof Error ? error : new Error(String(error)));
5682
+ return [];
5683
+ }
5684
+ };
5685
+ }
5686
+
5687
+ exports.DEFAULT_REQUEST_TIMEOUT_MS = DEFAULT_REQUEST_TIMEOUT_MS;
5533
5688
  exports.EAvailability = EAvailability;
5534
5689
  exports.ECollectionSortKey = ECollectionSortKey;
5535
5690
  exports.EFulfillmentStatus = EFulfillmentStatus;
@@ -5537,8 +5692,13 @@ exports.EOrderSortKey = EOrderSortKey;
5537
5692
  exports.EOrderStatus = EOrderStatus;
5538
5693
  exports.EPaymentStatus = EPaymentStatus;
5539
5694
  exports.EProductSortKey = EProductSortKey;
5695
+ exports.createCollectionProductStaticParams = createCollectionProductStaticParams;
5696
+ exports.createCollectionStaticParams = createCollectionStaticParams;
5540
5697
  exports.createCommerceClient = createCommerceClient;
5541
5698
  exports.createCustomClient = createCustomClient;
5699
+ exports.createProductStaticParams = createProductStaticParams;
5700
+ exports.createProductViaCollectionsStaticParams = createProductViaCollectionsStaticParams;
5542
5701
  exports.createShopifyClient = createShopifyClient;
5702
+ exports.resolveRequestSignal = resolveRequestSignal;
5543
5703
  //# sourceMappingURL=index.js.map
5544
5704
  //# sourceMappingURL=index.js.map