@shopkit/data-layer 1.2.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.
@@ -1,4 +1,4 @@
1
- // ../../node_modules/@shopify/graphql-client/dist/graphql-client/constants.mjs
1
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/graphql-client/constants.mjs
2
2
  var CLIENT = "GraphQL Client";
3
3
  var MIN_RETRIES = 0;
4
4
  var MAX_RETRIES = 3;
@@ -12,7 +12,7 @@ var CONTENT_TYPES = {
12
12
  var SDK_VARIANT_HEADER = "X-SDK-Variant";
13
13
  var SDK_VERSION_HEADER = "X-SDK-Version";
14
14
  var DEFAULT_SDK_VARIANT = "shopify-graphql-client";
15
- var DEFAULT_CLIENT_VERSION = "1.4.1";
15
+ var DEFAULT_CLIENT_VERSION = "1.4.2";
16
16
  var RETRY_WAIT_TIME = 1e3;
17
17
  var RETRIABLE_STATUS_CODES = [429, 503];
18
18
  var DEFER_OPERATION_REGEX = /@(defer)\b/i;
@@ -20,7 +20,7 @@ var NEWLINE_SEPARATOR = "\r\n";
20
20
  var BOUNDARY_HEADER_REGEX = /boundary="?([^=";]+)"?/i;
21
21
  var HEADER_SEPARATOR = NEWLINE_SEPARATOR + NEWLINE_SEPARATOR;
22
22
 
23
- // ../../node_modules/@shopify/graphql-client/dist/graphql-client/utilities.mjs
23
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/graphql-client/utilities.mjs
24
24
  function formatErrorMessage(message, client = CLIENT) {
25
25
  return message.startsWith(`${client}`) ? message : `${client}: ${message}`;
26
26
  }
@@ -70,7 +70,7 @@ function buildCombinedDataObject([initialDatum, ...remainingData]) {
70
70
  return remainingData.reduce(combineObjects, { ...initialDatum });
71
71
  }
72
72
 
73
- // ../../node_modules/@shopify/graphql-client/dist/graphql-client/http-fetch.mjs
73
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/graphql-client/http-fetch.mjs
74
74
  function generateHttpFetch({ clientLogger, customFetchApi = fetch, client = CLIENT, defaultRetryWaitTime = RETRY_WAIT_TIME, retriableCodes = RETRIABLE_STATUS_CODES }) {
75
75
  const httpFetch = async (requestParams, count, maxRetries) => {
76
76
  const nextCount = count + 1;
@@ -123,7 +123,7 @@ async function sleep(waitTime) {
123
123
  return new Promise((resolve) => setTimeout(resolve, waitTime));
124
124
  }
125
125
 
126
- // ../../node_modules/@shopify/graphql-client/dist/graphql-client/graphql-client.mjs
126
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/graphql-client/graphql-client.mjs
127
127
  function createGraphQLClient({ headers, url, customFetchApi = fetch, retries = 0, logger: logger2 }) {
128
128
  validateRetries({ client: CLIENT, retries });
129
129
  const config = {
@@ -294,11 +294,22 @@ function readStreamChunk(streamBodyIterator, boundary) {
294
294
  function createJsonResponseAsyncIterator(response) {
295
295
  return {
296
296
  async *[Symbol.asyncIterator]() {
297
- const processedResponse = await processJSONResponse(response);
298
- yield {
299
- ...processedResponse,
300
- hasNext: false
301
- };
297
+ try {
298
+ const processedResponse = await processJSONResponse(response);
299
+ yield {
300
+ ...processedResponse,
301
+ hasNext: false
302
+ };
303
+ } catch (error) {
304
+ yield {
305
+ errors: {
306
+ message: formatErrorMessage(getErrorMessage(error)),
307
+ networkStatusCode: response.status,
308
+ response
309
+ },
310
+ hasNext: false
311
+ };
312
+ }
302
313
  }
303
314
  };
304
315
  }
@@ -435,7 +446,7 @@ function generateRequestStream(fetchFn) {
435
446
  };
436
447
  }
437
448
 
438
- // ../../node_modules/@shopify/graphql-client/dist/api-client-utilities/validations.mjs
449
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/api-client-utilities/validations.mjs
439
450
  function validateDomainAndGetStoreUrl({ client, storeDomain }) {
440
451
  try {
441
452
  if (!storeDomain || typeof storeDomain !== "string") {
@@ -472,7 +483,7 @@ function validateApiVersion({ client, currentSupportedApiVersions, apiVersion, l
472
483
  }
473
484
  }
474
485
 
475
- // ../../node_modules/@shopify/graphql-client/dist/api-client-utilities/api-versions.mjs
486
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/api-client-utilities/api-versions.mjs
476
487
  function getQuarterMonth(quarter) {
477
488
  const month = quarter * 3 - 2;
478
489
  return month === 10 ? month : `0${month}`;
@@ -508,7 +519,7 @@ function getCurrentSupportedApiVersions() {
508
519
  ];
509
520
  }
510
521
 
511
- // ../../node_modules/@shopify/graphql-client/dist/api-client-utilities/utilities.mjs
522
+ // ../../node_modules/.bun/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/api-client-utilities/utilities.mjs
512
523
  function generateGetHeaders(config) {
513
524
  return (customHeaders) => {
514
525
  return { ...customHeaders ?? {}, ...config.headers };
@@ -531,10 +542,10 @@ function generateGetGQLClientParams({ getHeaders, getApiUrl }) {
531
542
  };
532
543
  }
533
544
 
534
- // ../../node_modules/@shopify/storefront-api-client/dist/constants.mjs
545
+ // ../../node_modules/.bun/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/constants.mjs
535
546
  var DEFAULT_CONTENT_TYPE = "application/json";
536
547
  var DEFAULT_SDK_VARIANT2 = "storefront-api-client";
537
- var DEFAULT_CLIENT_VERSION2 = "1.0.9";
548
+ var DEFAULT_CLIENT_VERSION2 = "1.0.10";
538
549
  var PUBLIC_ACCESS_TOKEN_HEADER = "X-Shopify-Storefront-Access-Token";
539
550
  var PRIVATE_ACCESS_TOKEN_HEADER = "Shopify-Storefront-Private-Token";
540
551
  var SDK_VARIANT_HEADER2 = "X-SDK-Variant";
@@ -542,7 +553,7 @@ var SDK_VERSION_HEADER2 = "X-SDK-Version";
542
553
  var SDK_VARIANT_SOURCE_HEADER = "X-SDK-Variant-Source";
543
554
  var CLIENT2 = "Storefront API Client";
544
555
 
545
- // ../../node_modules/@shopify/storefront-api-client/dist/validations.mjs
556
+ // ../../node_modules/.bun/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/validations.mjs
546
557
  function validatePrivateAccessTokenUsage(privateAccessToken) {
547
558
  if (privateAccessToken && typeof window !== "undefined") {
548
559
  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.`);
@@ -557,7 +568,7 @@ function validateRequiredAccessTokens(publicAccessToken, privateAccessToken) {
557
568
  }
558
569
  }
559
570
 
560
- // ../../node_modules/@shopify/storefront-api-client/dist/storefront-api-client.mjs
571
+ // ../../node_modules/.bun/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/storefront-api-client.mjs
561
572
  function createStorefrontApiClient({ storeDomain, apiVersion, publicAccessToken, privateAccessToken, clientName, retries = 0, customFetchApi, logger: logger2 }) {
562
573
  const currentSupportedApiVersions = getCurrentSupportedApiVersions();
563
574
  const storeUrl = validateDomainAndGetStoreUrl({
@@ -804,6 +815,12 @@ function formatResponse(params) {
804
815
  };
805
816
  }
806
817
 
818
+ // src/core/request-timeout.ts
819
+ var DEFAULT_REQUEST_TIMEOUT_MS = 1e4;
820
+ function resolveRequestSignal(options, defaultMs = DEFAULT_REQUEST_TIMEOUT_MS) {
821
+ return options?.signal ?? AbortSignal.timeout(options?.timeoutMs ?? defaultMs);
822
+ }
823
+
807
824
  // src/core/client.ts
808
825
  var NotImplementedError = class extends Error {
809
826
  constructor(adapterName, methodName) {
@@ -1155,7 +1172,10 @@ var BaseCommerceClient = class {
1155
1172
  async fetchRequest(params) {
1156
1173
  try {
1157
1174
  const { url, ...fetchOptions } = params;
1158
- const response = await fetch(url, fetchOptions);
1175
+ const response = await fetch(url, {
1176
+ ...fetchOptions,
1177
+ signal: resolveRequestSignal(fetchOptions)
1178
+ });
1159
1179
  const data = await response.json();
1160
1180
  if (response.ok) {
1161
1181
  return formatResponse({
@@ -4287,7 +4307,7 @@ var getCommonHeaders = (config) => {
4287
4307
  // src/adapters/custom/services/base.ts
4288
4308
  var BaseCustomService = class {
4289
4309
  constructor(baseUrl, config, logger2) {
4290
- this.timeout = 5e3;
4310
+ this.timeout = DEFAULT_REQUEST_TIMEOUT_MS;
4291
4311
  this.baseUrl = baseUrl;
4292
4312
  this.config = config;
4293
4313
  this.logger = logger2 || createDomainLogger("custom", "custom", { enabled: false });
@@ -4324,7 +4344,10 @@ var BaseCustomService = class {
4324
4344
  }
4325
4345
  const requestOptions = {
4326
4346
  method,
4327
- headers
4347
+ headers,
4348
+ // Bound the upstream wait — see core/request-timeout.ts for the policy and
4349
+ // rationale (Bblunt prod memory-leak postmortem, Jun 2026).
4350
+ signal: resolveRequestSignal(options, this.timeout)
4328
4351
  };
4329
4352
  if (data && method !== "GET") {
4330
4353
  requestOptions.body = JSON.stringify(data);