@reactionary/feeds 0.10.53 → 0.10.55

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.
Files changed (2) hide show
  1. package/cli.cjs +1187 -350
  2. package/package.json +9 -9
package/cli.cjs CHANGED
@@ -3328,17 +3328,17 @@ var require_generic_transformers = __commonJS({
3328
3328
  }
3329
3329
  }
3330
3330
  exports2.transformStreamsMessagesReplyResp3 = transformStreamsMessagesReplyResp3;
3331
- function transformRedisJsonArgument(json) {
3332
- return JSON.stringify(json);
3331
+ function transformRedisJsonArgument(json2) {
3332
+ return JSON.stringify(json2);
3333
3333
  }
3334
3334
  exports2.transformRedisJsonArgument = transformRedisJsonArgument;
3335
- function transformRedisJsonReply(json) {
3336
- const res = JSON.parse(json.toString());
3335
+ function transformRedisJsonReply(json2) {
3336
+ const res = JSON.parse(json2.toString());
3337
3337
  return res;
3338
3338
  }
3339
3339
  exports2.transformRedisJsonReply = transformRedisJsonReply;
3340
- function transformRedisJsonNullReply(json) {
3341
- return isNullReply(json) ? json : transformRedisJsonReply(json);
3340
+ function transformRedisJsonNullReply(json2) {
3341
+ return isNullReply(json2) ? json2 : transformRedisJsonReply(json2);
3342
3342
  }
3343
3343
  exports2.transformRedisJsonNullReply = transformRedisJsonNullReply;
3344
3344
  }
@@ -15913,16 +15913,16 @@ var require_enterprise_maintenance_manager = __commonJS({
15913
15913
  "moving-endpoint-type",
15914
15914
  movingEndpointType
15915
15915
  ],
15916
- errorHandler: (error6) => {
15917
- (0, exports2.dbgMaintenance)("handshake failed:", error6);
15916
+ errorHandler: (error5) => {
15917
+ (0, exports2.dbgMaintenance)("handshake failed:", error5);
15918
15918
  (0, tracing_1.publish)(tracing_1.CHANNELS.ERROR, () => ({
15919
- error: error6,
15919
+ error: error5,
15920
15920
  origin: "client",
15921
15921
  internal: true,
15922
15922
  clientId
15923
15923
  }));
15924
15924
  if (options.maintNotifications === "enabled") {
15925
- throw error6;
15925
+ throw error5;
15926
15926
  }
15927
15927
  }
15928
15928
  };
@@ -16026,8 +16026,8 @@ var require_enterprise_maintenance_manager = __commonJS({
16026
16026
  };
16027
16027
  }
16028
16028
  const tmpClient = this.#client.duplicate();
16029
- tmpClient.on("error", (error6) => {
16030
- (0, exports2.dbgMaintenance)(`[ERR]`, error6);
16029
+ tmpClient.on("error", (error5) => {
16030
+ (0, exports2.dbgMaintenance)(`[ERR]`, error5);
16031
16031
  });
16032
16032
  (0, exports2.dbgMaintenance)(`Tmp client created in ${(performance.now() - start).toFixed(2)}ms`);
16033
16033
  (0, exports2.dbgMaintenance)(`Set timeout for tmp client to ${this.#options.maintRelaxedSocketTimeout}`);
@@ -16427,8 +16427,8 @@ var require_socket = __commonJS({
16427
16427
  }
16428
16428
  if (this.#socketTimeout) {
16429
16429
  socket.once("timeout", () => {
16430
- const error6 = this.#maintenanceTimeout ? new errors_1.SocketTimeoutDuringMaintenanceError(this.#maintenanceTimeout) : new errors_1.SocketTimeoutError(this.#socketTimeout);
16431
- socket.destroy(error6);
16430
+ const error5 = this.#maintenanceTimeout ? new errors_1.SocketTimeoutDuringMaintenanceError(this.#maintenanceTimeout) : new errors_1.SocketTimeoutError(this.#socketTimeout);
16431
+ socket.destroy(error5);
16432
16432
  });
16433
16433
  socket.setTimeout(this.#socketTimeout);
16434
16434
  }
@@ -16614,7 +16614,7 @@ var require_token_manager = __commonJS({
16614
16614
  let result = Math.max(0, Math.floor(delay));
16615
16615
  return result;
16616
16616
  }
16617
- shouldRetry(error6) {
16617
+ shouldRetry(error5) {
16618
16618
  if (!this.config.retry)
16619
16619
  return false;
16620
16620
  const { maxAttempts, isRetryable: isRetryable2 } = this.config.retry;
@@ -16622,7 +16622,7 @@ var require_token_manager = __commonJS({
16622
16622
  return false;
16623
16623
  }
16624
16624
  if (isRetryable2) {
16625
- return isRetryable2(error6, this.retryAttempt);
16625
+ return isRetryable2(error5, this.retryAttempt);
16626
16626
  }
16627
16627
  return false;
16628
16628
  }
@@ -16636,14 +16636,14 @@ var require_token_manager = __commonJS({
16636
16636
  try {
16637
16637
  await this.identityProvider.requestToken().then(this.handleNewToken);
16638
16638
  this.retryAttempt = 0;
16639
- } catch (error6) {
16640
- if (this.shouldRetry(error6)) {
16639
+ } catch (error5) {
16640
+ if (this.shouldRetry(error5)) {
16641
16641
  this.retryAttempt++;
16642
16642
  const retryDelay = this.calculateRetryDelay();
16643
- this.notifyError(`Token refresh failed (attempt ${this.retryAttempt}), retrying in ${retryDelay}ms: ${error6}`, true);
16643
+ this.notifyError(`Token refresh failed (attempt ${this.retryAttempt}), retrying in ${retryDelay}ms: ${error5}`, true);
16644
16644
  this.scheduleNextRefresh(retryDelay);
16645
16645
  } else {
16646
- this.notifyError(error6, false);
16646
+ this.notifyError(error5, false);
16647
16647
  this.stop();
16648
16648
  }
16649
16649
  }
@@ -16708,8 +16708,8 @@ var require_token_manager = __commonJS({
16708
16708
  getCurrentToken() {
16709
16709
  return this.currentToken;
16710
16710
  }
16711
- notifyError(error6, isRetryable2) {
16712
- const errorMessage = error6 instanceof Error ? error6.message : String(error6);
16711
+ notifyError(error5, isRetryable2) {
16712
+ const errorMessage = error5 instanceof Error ? error5.message : String(error5);
16713
16713
  if (!this.listener) {
16714
16714
  throw new Error(`TokenManager is not running but received an error: ${errorMessage}`);
16715
16715
  }
@@ -19823,11 +19823,11 @@ var require_error_util = __commonJS({
19823
19823
  var types_1 = require_types();
19824
19824
  var errors_1 = require_errors();
19825
19825
  var REDIS_ERROR_PREFIX_REGEX = /^([A-Z][A-Z0-9_]*)\s/;
19826
- function extractRedisStatusCode(error6) {
19827
- if (!(error6 instanceof errors_1.ErrorReply)) {
19826
+ function extractRedisStatusCode(error5) {
19827
+ if (!(error5 instanceof errors_1.ErrorReply)) {
19828
19828
  return void 0;
19829
19829
  }
19830
- const match = REDIS_ERROR_PREFIX_REGEX.exec(error6.message);
19830
+ const match = REDIS_ERROR_PREFIX_REGEX.exec(error5.message);
19831
19831
  return match?.[1];
19832
19832
  }
19833
19833
  var NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
@@ -19891,15 +19891,15 @@ var require_error_util = __commonJS({
19891
19891
  "WRONGPASS",
19892
19892
  "WRONGTYPE"
19893
19893
  ]);
19894
- function isNodeRedisNetworkError(error6) {
19895
- return error6 instanceof errors_1.ConnectionTimeoutError || error6 instanceof errors_1.SocketTimeoutError || error6 instanceof errors_1.SocketClosedUnexpectedlyError || error6 instanceof errors_1.SocketTimeoutDuringMaintenanceError || error6 instanceof errors_1.CommandTimeoutDuringMaintenanceError;
19894
+ function isNodeRedisNetworkError(error5) {
19895
+ return error5 instanceof errors_1.ConnectionTimeoutError || error5 instanceof errors_1.SocketTimeoutError || error5 instanceof errors_1.SocketClosedUnexpectedlyError || error5 instanceof errors_1.SocketTimeoutDuringMaintenanceError || error5 instanceof errors_1.CommandTimeoutDuringMaintenanceError;
19896
19896
  }
19897
19897
  function isTlsErrorMessage(message) {
19898
19898
  const lowerMessage = message.toLowerCase();
19899
19899
  return lowerMessage.includes("certificate") || lowerMessage.includes("handshake") || lowerMessage.includes("ssl") || lowerMessage.includes("tls");
19900
19900
  }
19901
- function categorizeRedisError(error6) {
19902
- const prefix = extractRedisStatusCode(error6);
19901
+ function categorizeRedisError(error5) {
19902
+ const prefix = extractRedisStatusCode(error5);
19903
19903
  if (!prefix) {
19904
19904
  return void 0;
19905
19905
  }
@@ -19911,11 +19911,11 @@ var require_error_util = __commonJS({
19911
19911
  }
19912
19912
  return void 0;
19913
19913
  }
19914
- function getCategory(error6) {
19915
- if (isNodeRedisNetworkError(error6)) {
19914
+ function getCategory(error5) {
19915
+ if (isNodeRedisNetworkError(error5)) {
19916
19916
  return types_1.ERROR_CATEGORY.NETWORK;
19917
19917
  }
19918
- const errorCode = error6.code;
19918
+ const errorCode = error5.code;
19919
19919
  if (errorCode) {
19920
19920
  if (NETWORK_ERROR_CODES.has(errorCode)) {
19921
19921
  return types_1.ERROR_CATEGORY.NETWORK;
@@ -19924,24 +19924,24 @@ var require_error_util = __commonJS({
19924
19924
  return types_1.ERROR_CATEGORY.TLS;
19925
19925
  }
19926
19926
  }
19927
- if (isTlsErrorMessage(error6.message)) {
19927
+ if (isTlsErrorMessage(error5.message)) {
19928
19928
  return types_1.ERROR_CATEGORY.TLS;
19929
19929
  }
19930
- const category = categorizeRedisError(error6);
19930
+ const category = categorizeRedisError(error5);
19931
19931
  if (category) {
19932
19932
  return category;
19933
19933
  }
19934
19934
  return types_1.ERROR_CATEGORY.OTHER;
19935
19935
  }
19936
- function getErrorInfo(error6) {
19937
- if (!(error6 instanceof Error)) {
19936
+ function getErrorInfo(error5) {
19937
+ if (!(error5 instanceof Error)) {
19938
19938
  return {
19939
19939
  errorType: "unknown",
19940
19940
  category: types_1.ERROR_CATEGORY.OTHER,
19941
19941
  statusCode: void 0
19942
19942
  };
19943
19943
  }
19944
- const actualError = error6 instanceof errors_1.ReconnectStrategyError ? error6.originalError : error6;
19944
+ const actualError = error5 instanceof errors_1.ReconnectStrategyError ? error5.originalError : error5;
19945
19945
  return {
19946
19946
  errorType: actualError.constructor.name,
19947
19947
  category: getCategory(actualError),
@@ -20218,9 +20218,9 @@ var require_metrics = __commonJS({
20218
20218
  });
20219
20219
  });
20220
20220
  }
20221
- #recordError(error6, clientId, extra) {
20221
+ #recordError(error5, clientId, extra) {
20222
20222
  const clientAttributes = resolveClientAttributes(clientId);
20223
- const errorInfo = (0, utils_1.getErrorInfo)(error6);
20223
+ const errorInfo = (0, utils_1.getErrorInfo)(error5);
20224
20224
  this.#instruments.redisClientErrors.add(1, {
20225
20225
  ...this.#options.attributes,
20226
20226
  ...(0, utils_1.parseClientAttributes)(clientAttributes),
@@ -21112,8 +21112,8 @@ var require_client = __commonJS({
21112
21112
  #subscribeForStreamingCredentials(cp) {
21113
21113
  return cp.subscribe({
21114
21114
  onNext: (credentials) => {
21115
- this.reAuthenticate(credentials).catch((error6) => {
21116
- const errorMessage = error6 instanceof Error ? error6.message : String(error6);
21115
+ this.reAuthenticate(credentials).catch((error5) => {
21116
+ const errorMessage = error5 instanceof Error ? error5.message : String(error5);
21117
21117
  cp.onReAuthenticationError(new authx_1.CredentialsError(errorMessage));
21118
21118
  });
21119
21119
  },
@@ -21256,8 +21256,8 @@ var require_client = __commonJS({
21256
21256
  const socketInitiator = async () => {
21257
21257
  const promises = [], chainId = /* @__PURE__ */ Symbol("Socket Initiator");
21258
21258
  const resubscribePromise = this.#queue.resubscribe(chainId);
21259
- resubscribePromise?.catch((error6) => {
21260
- if (error6.message && error6.message.startsWith("MOVED")) {
21259
+ resubscribePromise?.catch((error5) => {
21260
+ if (error5.message && error5.message.startsWith("MOVED")) {
21261
21261
  this.emit("__MOVED", this._self.#queue.removeAllPubSubListeners());
21262
21262
  }
21263
21263
  });
@@ -22155,7 +22155,7 @@ var require_cluster_slots = __commonJS({
22155
22155
  readonly: readonly2
22156
22156
  }));
22157
22157
  client._setIdentity(identity_1.ClientRole.CLUSTER_NODE, this.#clusterClientId);
22158
- client.on("error", (error6) => emit("node-error", error6, clientInfo)).on("reconnecting", () => emit("node-reconnecting", clientInfo)).once("ready", () => emit("node-ready", clientInfo)).once("connect", () => emit("node-connect", clientInfo)).once("end", () => emit("node-disconnect", clientInfo)).on(enterprise_maintenance_manager_1.SMIGRATED_EVENT, this.#handleSmigrated).on("__MOVED", async (allPubSubListeners) => {
22158
+ client.on("error", (error5) => emit("node-error", error5, clientInfo)).on("reconnecting", () => emit("node-reconnecting", clientInfo)).once("ready", () => emit("node-ready", clientInfo)).once("connect", () => emit("node-connect", clientInfo)).once("end", () => emit("node-disconnect", clientInfo)).on(enterprise_maintenance_manager_1.SMIGRATED_EVENT, this.#handleSmigrated).on("__MOVED", async (allPubSubListeners) => {
22159
22159
  await this.rediscover(client);
22160
22160
  this.#emit(exports2.RESUBSCRIBE_LISTENERS_EVENT, allPubSubListeners);
22161
22161
  });
@@ -25252,10 +25252,10 @@ var require_INITBYPROB = __commonJS({
25252
25252
  * @param error - Estimate error, as a decimal between 0 and 1
25253
25253
  * @param probability - The desired probability for inflated count, as a decimal between 0 and 1
25254
25254
  */
25255
- parseCommand(parser, key, error6, probability) {
25255
+ parseCommand(parser, key, error5, probability) {
25256
25256
  parser.push("CMS.INITBYPROB");
25257
25257
  parser.pushKey(key);
25258
- parser.push(error6.toString(), probability.toString());
25258
+ parser.push(error5.toString(), probability.toString());
25259
25259
  },
25260
25260
  transformReply: void 0
25261
25261
  };
@@ -26479,10 +26479,10 @@ var require_ARRAPPEND = __commonJS({
26479
26479
  * @param json - The first value to append
26480
26480
  * @param jsons - Additional values to append
26481
26481
  */
26482
- parseCommand(parser, key, path2, json, ...jsons) {
26482
+ parseCommand(parser, key, path2, json2, ...jsons) {
26483
26483
  parser.push("JSON.ARRAPPEND");
26484
26484
  parser.pushKey(key);
26485
- parser.push(path2, (0, generic_transformers_1.transformRedisJsonArgument)(json));
26485
+ parser.push(path2, (0, generic_transformers_1.transformRedisJsonArgument)(json2));
26486
26486
  for (let i3 = 0; i3 < jsons.length; i3++) {
26487
26487
  parser.push((0, generic_transformers_1.transformRedisJsonArgument)(jsons[i3]));
26488
26488
  }
@@ -26512,10 +26512,10 @@ var require_ARRINDEX = __commonJS({
26512
26512
  * @param options.range.start - Starting index for the search
26513
26513
  * @param options.range.stop - Optional ending index for the search
26514
26514
  */
26515
- parseCommand(parser, key, path2, json, options) {
26515
+ parseCommand(parser, key, path2, json2, options) {
26516
26516
  parser.push("JSON.ARRINDEX");
26517
26517
  parser.pushKey(key);
26518
- parser.push(path2, (0, generic_transformers_1.transformRedisJsonArgument)(json));
26518
+ parser.push(path2, (0, generic_transformers_1.transformRedisJsonArgument)(json2));
26519
26519
  if (options?.range) {
26520
26520
  parser.push(options.range.start.toString());
26521
26521
  if (options.range.stop !== void 0) {
@@ -26547,10 +26547,10 @@ var require_ARRINSERT = __commonJS({
26547
26547
  * @param json - The first value to insert
26548
26548
  * @param jsons - Additional values to insert
26549
26549
  */
26550
- parseCommand(parser, key, path2, index, json, ...jsons) {
26550
+ parseCommand(parser, key, path2, index, json2, ...jsons) {
26551
26551
  parser.push("JSON.ARRINSERT");
26552
26552
  parser.pushKey(key);
26553
- parser.push(path2, index.toString(), (0, generic_transformers_1.transformRedisJsonArgument)(json));
26553
+ parser.push(path2, index.toString(), (0, generic_transformers_1.transformRedisJsonArgument)(json2));
26554
26554
  for (let i3 = 0; i3 < jsons.length; i3++) {
26555
26555
  parser.push((0, generic_transformers_1.transformRedisJsonArgument)(jsons[i3]));
26556
26556
  }
@@ -26840,7 +26840,7 @@ var require_MGET2 = __commonJS({
26840
26840
  parser.push(path2);
26841
26841
  },
26842
26842
  transformReply(reply) {
26843
- return reply.map((json) => (0, generic_transformers_1.transformRedisJsonNullReply)(json));
26843
+ return reply.map((json2) => (0, generic_transformers_1.transformRedisJsonNullReply)(json2));
26844
26844
  }
26845
26845
  };
26846
26846
  }
@@ -27014,10 +27014,10 @@ var require_SET2 = __commonJS({
27014
27014
  * @deprecated options.NX - Use options.condition instead
27015
27015
  * @deprecated options.XX - Use options.condition instead
27016
27016
  */
27017
- parseCommand(parser, key, path2, json, options) {
27017
+ parseCommand(parser, key, path2, json2, options) {
27018
27018
  parser.push("JSON.SET");
27019
27019
  parser.pushKey(key);
27020
- parser.push(path2, (0, generic_transformers_1.transformRedisJsonArgument)(json));
27020
+ parser.push(path2, (0, generic_transformers_1.transformRedisJsonArgument)(json2));
27021
27021
  if (options?.condition) {
27022
27022
  parser.push(options?.condition);
27023
27023
  } else if (options?.NX) {
@@ -32038,10 +32038,10 @@ var init_util = __esm({
32038
32038
  });
32039
32039
 
32040
32040
  // node_modules/.pnpm/zod@4.1.9/node_modules/zod/v4/core/errors.js
32041
- function flattenError(error6, mapper = (issue2) => issue2.message) {
32041
+ function flattenError(error5, mapper = (issue2) => issue2.message) {
32042
32042
  const fieldErrors = {};
32043
32043
  const formErrors = [];
32044
- for (const sub of error6.issues) {
32044
+ for (const sub of error5.issues) {
32045
32045
  if (sub.path.length > 0) {
32046
32046
  fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
32047
32047
  fieldErrors[sub.path[0]].push(mapper(sub));
@@ -32051,13 +32051,13 @@ function flattenError(error6, mapper = (issue2) => issue2.message) {
32051
32051
  }
32052
32052
  return { formErrors, fieldErrors };
32053
32053
  }
32054
- function formatError(error6, _mapper) {
32054
+ function formatError(error5, _mapper) {
32055
32055
  const mapper = _mapper || function(issue2) {
32056
32056
  return issue2.message;
32057
32057
  };
32058
32058
  const fieldErrors = { _errors: [] };
32059
- const processError = (error7) => {
32060
- for (const issue2 of error7.issues) {
32059
+ const processError = (error6) => {
32060
+ for (const issue2 of error6.issues) {
32061
32061
  if (issue2.code === "invalid_union" && issue2.errors.length) {
32062
32062
  issue2.errors.map((issues) => processError({ issues }));
32063
32063
  } else if (issue2.code === "invalid_key") {
@@ -32084,7 +32084,7 @@ function formatError(error6, _mapper) {
32084
32084
  }
32085
32085
  }
32086
32086
  };
32087
- processError(error6);
32087
+ processError(error5);
32088
32088
  return fieldErrors;
32089
32089
  }
32090
32090
  var initializer, $ZodError, $ZodRealError;
@@ -32221,7 +32221,7 @@ function datetime(args) {
32221
32221
  const timeRegex = `${time3}(?:${opts.join("|")})`;
32222
32222
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
32223
32223
  }
32224
- var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid, email, _emoji, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, hostname, e164, dateSource, date, string, bigint, integer, number, boolean, lowercase, uppercase;
32224
+ var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid, email, _emoji, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, hostname, e164, dateSource, date, string, bigint, integer, number, boolean, _null, lowercase, uppercase;
32225
32225
  var init_regexes = __esm({
32226
32226
  "node_modules/.pnpm/zod@4.1.9/node_modules/zod/v4/core/regexes.js"() {
32227
32227
  cuid = /^[cC][^\s-]{8,}$/;
@@ -32257,6 +32257,7 @@ var init_regexes = __esm({
32257
32257
  integer = /^-?\d+$/;
32258
32258
  number = /^-?\d+(?:\.\d+)?/;
32259
32259
  boolean = /^(?:true|false)$/i;
32260
+ _null = /^null$/i;
32260
32261
  lowercase = /^[^A-Z]*$/;
32261
32262
  uppercase = /^[^a-z]*$/;
32262
32263
  }
@@ -32947,7 +32948,7 @@ function handleRefineResult(result, payload, input, inst) {
32947
32948
  payload.issues.push(issue(_iss));
32948
32949
  }
32949
32950
  }
32950
- var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodCustom;
32951
+ var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodNull, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodLazy, $ZodCustom;
32951
32952
  var init_schemas = __esm({
32952
32953
  "node_modules/.pnpm/zod@4.1.9/node_modules/zod/v4/core/schemas.js"() {
32953
32954
  init_checks();
@@ -33398,6 +33399,23 @@ var init_schemas = __esm({
33398
33399
  return payload;
33399
33400
  };
33400
33401
  });
33402
+ $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
33403
+ $ZodType.init(inst, def);
33404
+ inst._zod.pattern = _null;
33405
+ inst._zod.values = /* @__PURE__ */ new Set([null]);
33406
+ inst._zod.parse = (payload, _ctx) => {
33407
+ const input = payload.value;
33408
+ if (input === null)
33409
+ return payload;
33410
+ payload.issues.push({
33411
+ expected: "null",
33412
+ code: "invalid_type",
33413
+ input,
33414
+ inst
33415
+ });
33416
+ return payload;
33417
+ };
33418
+ });
33401
33419
  $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
33402
33420
  $ZodType.init(inst, def);
33403
33421
  inst._zod.parse = (payload) => payload;
@@ -34043,6 +34061,18 @@ var init_schemas = __esm({
34043
34061
  return handleReadonlyResult(result);
34044
34062
  };
34045
34063
  });
34064
+ $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
34065
+ $ZodType.init(inst, def);
34066
+ defineLazy(inst._zod, "innerType", () => def.getter());
34067
+ defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
34068
+ defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
34069
+ defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? void 0);
34070
+ defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? void 0);
34071
+ inst._zod.parse = (payload, ctx) => {
34072
+ const inner = inst._zod.innerType;
34073
+ return inner._zod.run(payload, ctx);
34074
+ };
34075
+ });
34046
34076
  $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
34047
34077
  $ZodCheck.init(inst, def);
34048
34078
  $ZodType.init(inst, def);
@@ -34902,6 +34932,12 @@ function _coercedBigint(Class2, params) {
34902
34932
  ...normalizeParams(params)
34903
34933
  });
34904
34934
  }
34935
+ function _null2(Class2, params) {
34936
+ return new Class2({
34937
+ type: "null",
34938
+ ...normalizeParams(params)
34939
+ });
34940
+ }
34905
34941
  function _unknown(Class2) {
34906
34942
  return new Class2({
34907
34943
  type: "unknown"
@@ -35266,6 +35302,9 @@ function int(params) {
35266
35302
  function boolean2(params) {
35267
35303
  return _boolean(ZodBoolean, params);
35268
35304
  }
35305
+ function _null3(params) {
35306
+ return _null2(ZodNull, params);
35307
+ }
35269
35308
  function unknown() {
35270
35309
  return _unknown(ZodUnknown);
35271
35310
  }
@@ -35406,13 +35445,25 @@ function readonly(innerType) {
35406
35445
  innerType
35407
35446
  });
35408
35447
  }
35448
+ function lazy(getter) {
35449
+ return new ZodLazy({
35450
+ type: "lazy",
35451
+ getter
35452
+ });
35453
+ }
35409
35454
  function refine(fn, _params = {}) {
35410
35455
  return _refine(ZodCustom, fn, _params);
35411
35456
  }
35412
35457
  function superRefine(fn) {
35413
35458
  return _superRefine(fn);
35414
35459
  }
35415
- var ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodUnknown, ZodNever, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodReadonly, ZodCustom;
35460
+ function json(params) {
35461
+ const jsonSchema = lazy(() => {
35462
+ return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
35463
+ });
35464
+ return jsonSchema;
35465
+ }
35466
+ var ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodNull, ZodUnknown, ZodNever, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodReadonly, ZodLazy, ZodCustom;
35416
35467
  var init_schemas2 = __esm({
35417
35468
  "node_modules/.pnpm/zod@4.1.9/node_modules/zod/v4/classic/schemas.js"() {
35418
35469
  init_core2();
@@ -35682,6 +35733,10 @@ var init_schemas2 = __esm({
35682
35733
  inst.maxValue = bag.maximum ?? null;
35683
35734
  inst.format = bag.format ?? null;
35684
35735
  });
35736
+ ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
35737
+ $ZodNull.init(inst, def);
35738
+ ZodType.init(inst, def);
35739
+ });
35685
35740
  ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
35686
35741
  $ZodUnknown.init(inst, def);
35687
35742
  ZodType.init(inst, def);
@@ -35874,6 +35929,11 @@ var init_schemas2 = __esm({
35874
35929
  ZodType.init(inst, def);
35875
35930
  inst.unwrap = () => inst._zod.def.innerType;
35876
35931
  });
35932
+ ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
35933
+ $ZodLazy.init(inst, def);
35934
+ ZodType.init(inst, def);
35935
+ inst.unwrap = () => inst._zod.def.getter();
35936
+ });
35877
35937
  ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
35878
35938
  $ZodCustom.init(inst, def);
35879
35939
  ZodType.init(inst, def);
@@ -36590,10 +36650,10 @@ var require_stringifiers = __commonJS({
36590
36650
  return "";
36591
36651
  }
36592
36652
  exports2._nullCoerce = _nullCoerce;
36593
- function _null3() {
36653
+ function _null4() {
36594
36654
  return exports2.PREFIX.null;
36595
36655
  }
36596
- exports2._null = _null3;
36656
+ exports2._null = _null4;
36597
36657
  function _functionCoerce(obj) {
36598
36658
  return obj.name + "=>" + obj.toString();
36599
36659
  }
@@ -37362,7 +37422,7 @@ var init_profile_model = __esm({
37362
37422
  });
37363
37423
 
37364
37424
  // packages/core/src/schemas/models/shipping-method.model.ts
37365
- var PickupPointSchema, ShippingMethodSchema, ShippingInstructionSchema;
37425
+ var ShippingFulfillmentTypeSchema, ShippingProtocolDataSchema, SHIPPING_PROTOCOL_DATA_KEYS, PickupPointSchema, ShippingMethodSchema, ShippingInstructionSchema;
37366
37426
  var init_shipping_method_model = __esm({
37367
37427
  "packages/core/src/schemas/models/shipping-method.model.ts"() {
37368
37428
  "use strict";
@@ -37371,6 +37431,18 @@ var init_shipping_method_model = __esm({
37371
37431
  init_price_model();
37372
37432
  init_base_model();
37373
37433
  init_profile_model();
37434
+ ShippingFulfillmentTypeSchema = _enum(["delivery", "pickup"]);
37435
+ ShippingProtocolDataSchema = looseObject({
37436
+ key: string2().meta({ description: 'The protocol-specific key, e.g. "timeSlotId".' }),
37437
+ value: union([string2(), record(string2(), json())]).meta({ description: "The protocol-specific value: either a plain string, or a JSON-serializable object for richer structures." })
37438
+ });
37439
+ SHIPPING_PROTOCOL_DATA_KEYS = {
37440
+ /**
37441
+ * The identifier (Store.identifier.key) of the brand's own store an
37442
+ * in-store pickup (BOPIS) shipping method is fulfilled from.
37443
+ */
37444
+ pickupStore: "pickup_store"
37445
+ };
37374
37446
  PickupPointSchema = looseObject({
37375
37447
  identifier: object({
37376
37448
  key: string2()
@@ -37390,30 +37462,38 @@ var init_shipping_method_model = __esm({
37390
37462
  logo: ImageSchema.optional(),
37391
37463
  price: MonetaryAmountSchema,
37392
37464
  deliveryTime: string2(),
37393
- carrier: string2().optional()
37465
+ carrier: string2().optional(),
37466
+ fulfillmentType: ShippingFulfillmentTypeSchema.optional().meta({ description: `How this shipping method fulfills the order: "delivery" for shipment to an address (including third-party carrier service points selected via the shipping instruction's pickupPoint), "pickup" for collection at one of the brand's own stores (BOPIS). When absent, "delivery" can be assumed.` }),
37467
+ protocolData: array(ShippingProtocolDataSchema).optional().meta({ description: `Additional provider-populated, protocol-specific data for this shipping method, e.g. available pickup time slots. Conventional keys (see SHIPPING_PROTOCOL_DATA_KEYS) include "pickup_store": the identifier of the brand's own store a pickup method is fulfilled from.` })
37394
37468
  });
37395
37469
  ShippingInstructionSchema = BaseModelSchema.extend({
37396
37470
  shippingMethod: ShippingMethodIdentifierSchema,
37397
- pickupPoint: string2().meta({ description: "An optional pickup point for the shipping method. This could be a physical store, a locker, or similar. If not set, it means home delivery to the shipping address." }),
37471
+ pickupPoint: string2().meta({ description: "An optional third-party carrier service point for the shipping method (e.g. a GLS or PostNord parcel shop, or a locker). Reserved for the carrier-service-point case; for pickup at one of the brand's own stores (BOPIS), use the store field instead. If neither is set, it means home delivery to the shipping address." }),
37398
37472
  instructions: string2().meta({ description: "Optional instructions for the shipping. This could be delivery instructions, or similar." }),
37399
- consentForUnattendedDelivery: boolean2().meta({ description: "Indicates if the customer has given consent for unattended delivery, if applicable." })
37473
+ consentForUnattendedDelivery: boolean2().meta({ description: "Indicates if the customer has given consent for unattended delivery, if applicable." }),
37474
+ store: StoreIdentifierSchema.optional().meta({ description: "An optional reference to one of the brand's own stores where the order will be picked up (BOPIS). Distinct from pickupPoint, which is reserved for third-party carrier service points." }),
37475
+ protocolData: array(ShippingProtocolDataSchema).optional().meta({ description: "Additional client-set, protocol-specific data for the shipping instruction, e.g. a selected pickup time slot." })
37400
37476
  });
37401
37477
  }
37402
37478
  });
37403
37479
 
37404
37480
  // packages/core/src/schemas/models/store.model.ts
37405
- var StoreSchema;
37481
+ var StoreSchema, StorePaginatedResultSchema;
37406
37482
  var init_store_model = __esm({
37407
37483
  "packages/core/src/schemas/models/store.model.ts"() {
37408
37484
  "use strict";
37409
37485
  init_zod();
37410
37486
  init_base_model();
37411
37487
  init_identifiers_model();
37488
+ init_profile_model();
37412
37489
  StoreSchema = BaseModelSchema.extend({
37413
37490
  identifier: StoreIdentifierSchema,
37414
37491
  name: string2(),
37415
- fulfillmentCenter: FulfillmentCenterIdentifierSchema
37492
+ fulfillmentCenter: FulfillmentCenterIdentifierSchema,
37493
+ address: AddressSchema.optional().meta({ description: "The physical address of the store, if known. Useful for showing the store on a map, and as the shipping address for in-store pickup (BOPIS)." }),
37494
+ openingHours: string2().optional().meta({ description: 'The opening hours of the store, if known. This could be a string like "Mon-Fri 9am-5pm".' })
37416
37495
  });
37496
+ StorePaginatedResultSchema = createPaginatedResponseSchema(StoreSchema);
37417
37497
  }
37418
37498
  });
37419
37499
 
@@ -38508,18 +38588,26 @@ var init_product_reviews_query = __esm({
38508
38588
  });
38509
38589
 
38510
38590
  // packages/core/src/schemas/queries/store.query.ts
38511
- var StoreQueryByProximitySchema;
38591
+ var StoreQueryByProximitySchema, StoreQueryByIdSchema, StoreQueryForListSchema;
38512
38592
  var init_store_query = __esm({
38513
38593
  "packages/core/src/schemas/queries/store.query.ts"() {
38514
38594
  "use strict";
38515
38595
  init_zod();
38516
38596
  init_base_query();
38597
+ init_identifiers_model();
38598
+ init_base_model();
38517
38599
  StoreQueryByProximitySchema = BaseQuerySchema.extend({
38518
38600
  longitude: number2(),
38519
38601
  latitude: number2(),
38520
38602
  distance: number2(),
38521
38603
  limit: number2()
38522
38604
  });
38605
+ StoreQueryByIdSchema = BaseQuerySchema.extend({
38606
+ identifier: StoreIdentifierSchema
38607
+ });
38608
+ StoreQueryForListSchema = BaseQuerySchema.extend({
38609
+ paginationOptions: PaginationOptionsSchema
38610
+ });
38523
38611
  }
38524
38612
  });
38525
38613
 
@@ -38848,10 +38936,10 @@ function success(value) {
38848
38936
  }
38849
38937
  };
38850
38938
  }
38851
- function error2(error6) {
38939
+ function error2(error5) {
38852
38940
  return {
38853
38941
  success: false,
38854
- error: error6,
38942
+ error: error5,
38855
38943
  meta: {
38856
38944
  trace: trace.getActiveSpan()?.spanContext().traceId || ""
38857
38945
  }
@@ -42018,8 +42106,8 @@ var require_lib7 = __commonJS({
42018
42106
  exports2.byteSequence = byteSequence;
42019
42107
  var codePoint = __importStar(require_CodePoints());
42020
42108
  exports2.codePoint = codePoint;
42021
- var json = __importStar(require_JSON());
42022
- exports2.json = json;
42109
+ var json2 = __importStar(require_JSON());
42110
+ exports2.json = json2;
42023
42111
  var list = __importStar(require_List());
42024
42112
  exports2.list = list;
42025
42113
  var map = __importStar(require_Map());
@@ -60427,7 +60515,7 @@ var require_sax = __commonJS({
60427
60515
  parser.script = "";
60428
60516
  break;
60429
60517
  default:
60430
- error6(parser, "Max buffer length exceeded: " + buffers[i3]);
60518
+ error5(parser, "Max buffer length exceeded: " + buffers[i3]);
60431
60519
  }
60432
60520
  }
60433
60521
  maxActual = Math.max(maxActual, len);
@@ -61027,7 +61115,7 @@ var require_sax = __commonJS({
61027
61115
  if (opt.normalize) text2 = text2.replace(/\s+/g, " ");
61028
61116
  return text2;
61029
61117
  }
61030
- function error6(parser, er3) {
61118
+ function error5(parser, er3) {
61031
61119
  closeText(parser);
61032
61120
  if (parser.trackPosition) {
61033
61121
  er3 += "\nLine: " + parser.line + "\nColumn: " + parser.column + "\nChar: " + parser.c;
@@ -61041,7 +61129,7 @@ var require_sax = __commonJS({
61041
61129
  if (parser.sawRoot && !parser.closedRoot)
61042
61130
  strictFail(parser, "Unclosed root tag");
61043
61131
  if (parser.state !== S4.BEGIN && parser.state !== S4.BEGIN_WHITESPACE && parser.state !== S4.TEXT) {
61044
- error6(parser, "Unexpected end");
61132
+ error5(parser, "Unexpected end");
61045
61133
  }
61046
61134
  closeText(parser);
61047
61135
  parser.c = "";
@@ -61055,7 +61143,7 @@ var require_sax = __commonJS({
61055
61143
  throw new Error("bad call to strictFail");
61056
61144
  }
61057
61145
  if (parser.strict) {
61058
- error6(parser, message);
61146
+ error5(parser, message);
61059
61147
  }
61060
61148
  }
61061
61149
  function newTag(parser) {
@@ -61300,7 +61388,7 @@ var require_sax = __commonJS({
61300
61388
  throw this.error;
61301
61389
  }
61302
61390
  if (parser.closed) {
61303
- return error6(
61391
+ return error5(
61304
61392
  parser,
61305
61393
  "Cannot write after close. Assign an onready handler."
61306
61394
  );
@@ -61696,7 +61784,7 @@ var require_sax = __commonJS({
61696
61784
  parser.state = S4.ATTRIB_VALUE_QUOTED;
61697
61785
  } else {
61698
61786
  if (!parser.opt.unquotedAttributeValues) {
61699
- error6(parser, "Unquoted attribute value");
61787
+ error5(parser, "Unquoted attribute value");
61700
61788
  }
61701
61789
  parser.state = S4.ATTRIB_VALUE_UNQUOTED;
61702
61790
  parser.attribValue = c3;
@@ -61809,13 +61897,13 @@ var require_sax = __commonJS({
61809
61897
  var parsedEntity = parseEntity(parser);
61810
61898
  if (parser.opt.unparsedEntities && !Object.values(sax3.XML_ENTITIES).includes(parsedEntity)) {
61811
61899
  if ((parser.entityCount += 1) > parser.opt.maxEntityCount) {
61812
- error6(
61900
+ error5(
61813
61901
  parser,
61814
61902
  "Parsed entity count exceeds max entity count"
61815
61903
  );
61816
61904
  }
61817
61905
  if ((parser.entityDepth += 1) > parser.opt.maxEntityDepth) {
61818
- error6(
61906
+ error5(
61819
61907
  parser,
61820
61908
  "Parsed entity depth exceeds max entity depth"
61821
61909
  );
@@ -61980,7 +62068,7 @@ function createIterablePromise({
61980
62068
  func,
61981
62069
  validate: validate2,
61982
62070
  aggregator,
61983
- error: error6,
62071
+ error: error5,
61984
62072
  timeout = () => 0
61985
62073
  }) {
61986
62074
  const retry = (previousResponse) => {
@@ -61992,8 +62080,8 @@ function createIterablePromise({
61992
62080
  if (await validate2(response)) {
61993
62081
  return resolve2(response);
61994
62082
  }
61995
- if (error6 && await error6.validate(response)) {
61996
- return reject(new Error(await error6.message(response)));
62083
+ if (error5 && await error5.validate(response)) {
62084
+ return reject(new Error(await error5.message(response)));
61997
62085
  }
61998
62086
  return setTimeout(
61999
62087
  () => {
@@ -62579,9 +62667,9 @@ var init_common = __esm({
62579
62667
  };
62580
62668
  DetailedApiError = class extends ApiError {
62581
62669
  error;
62582
- constructor(message, status, error6, stackTrace) {
62670
+ constructor(message, status, error5, stackTrace) {
62583
62671
  super(message, status, stackTrace, "DetailedApiError");
62584
- this.error = error6;
62672
+ this.error = error5;
62585
62673
  }
62586
62674
  };
62587
62675
  }
@@ -62643,10 +62731,10 @@ function createHttpRequester({
62643
62731
  isTimedOut: false
62644
62732
  });
62645
62733
  });
62646
- response.on("error", (error6) => {
62734
+ response.on("error", (error5) => {
62647
62735
  clearTimeout(connectTimeout);
62648
62736
  clearTimeout(responseTimeout);
62649
- resolve2({ status: 0, content: error6.message, isTimedOut: false });
62737
+ resolve2({ status: 0, content: error5.message, isTimedOut: false });
62650
62738
  });
62651
62739
  });
62652
62740
  const createTimeout = (timeout, content) => {
@@ -62660,10 +62748,10 @@ function createHttpRequester({
62660
62748
  }, timeout);
62661
62749
  };
62662
62750
  connectTimeout = createTimeout(request.connectTimeout, "Connection timeout");
62663
- req.on("error", (error6) => {
62751
+ req.on("error", (error5) => {
62664
62752
  clearTimeout(connectTimeout);
62665
62753
  clearTimeout(responseTimeout);
62666
- resolve2({ status: 0, content: error6.message, isTimedOut: false });
62754
+ resolve2({ status: 0, content: error5.message, isTimedOut: false });
62667
62755
  });
62668
62756
  req.once("response", () => {
62669
62757
  clearTimeout(connectTimeout);
@@ -62707,8 +62795,8 @@ function createHttpRequester({
62707
62795
  }
62708
62796
  resolve2(import_stream.Readable.toWeb(response));
62709
62797
  });
62710
- req.on("error", (error6) => {
62711
- reject(error6);
62798
+ req.on("error", (error5) => {
62799
+ reject(error5);
62712
62800
  });
62713
62801
  if (request.data !== void 0) {
62714
62802
  req.write(request.data);
@@ -65698,11 +65786,11 @@ function createSearchClient({
65698
65786
  }
65699
65787
  return createIterablePromise({
65700
65788
  ...baseIteratorOptions,
65701
- func: () => this.getApiKey({ key }, requestOptions).catch((error6) => {
65702
- if (error6.status === 404) {
65789
+ func: () => this.getApiKey({ key }, requestOptions).catch((error5) => {
65790
+ if (error5.status === 404) {
65703
65791
  return void 0;
65704
65792
  }
65705
- throw error6;
65793
+ throw error5;
65706
65794
  }),
65707
65795
  validate: (response) => operation === "add" ? response !== void 0 : response === void 0
65708
65796
  });
@@ -65992,19 +66080,19 @@ function createSearchClient({
65992
66080
  maxRetries
65993
66081
  });
65994
66082
  return { copyOperationResponse, batchResponses, moveOperationResponse };
65995
- } catch (error6) {
66083
+ } catch (error5) {
65996
66084
  await this.deleteIndex({ indexName: tmpIndexName });
65997
- throw error6;
66085
+ throw error5;
65998
66086
  }
65999
66087
  },
66000
66088
  async indexExists({ indexName }) {
66001
66089
  try {
66002
66090
  await this.getSettings({ indexName });
66003
- } catch (error6) {
66004
- if (error6 instanceof ApiError && error6.status === 404) {
66091
+ } catch (error5) {
66092
+ if (error5 instanceof ApiError && error5.status === 404) {
66005
66093
  return false;
66006
66094
  }
66007
- throw error6;
66095
+ throw error5;
66008
66096
  }
66009
66097
  return true;
66010
66098
  },
@@ -67963,11 +68051,11 @@ function createIngestionClient({
67963
68051
  if (resp.eventID === void 0 || !resp.eventID) {
67964
68052
  throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
67965
68053
  }
67966
- return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((error6) => {
67967
- if (error6.status === 404) {
68054
+ return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((error5) => {
68055
+ if (error5.status === 404) {
67968
68056
  return void 0;
67969
68057
  }
67970
- throw error6;
68058
+ throw error5;
67971
68059
  });
67972
68060
  },
67973
68061
  validate: (response) => response !== void 0,
@@ -70749,9 +70837,9 @@ function algoliasearch(appId, apiKey, options) {
70749
70837
  maxRetries
70750
70838
  });
70751
70839
  return { copyOperationResponse, watchResponses, moveOperationResponse };
70752
- } catch (error6) {
70840
+ } catch (error5) {
70753
70841
  await this.deleteIndex({ indexName: tmpIndexName });
70754
- throw error6;
70842
+ throw error5;
70755
70843
  }
70756
70844
  },
70757
70845
  /**
@@ -71411,8 +71499,8 @@ var init_product_recommendations_capability2 = __esm({
71411
71499
  }
71412
71500
  }
71413
71501
  return result;
71414
- } catch (error6) {
71415
- console.error("Error fetching frequently bought together recommendations:", error6);
71502
+ } catch (error5) {
71503
+ console.error("Error fetching frequently bought together recommendations:", error5);
71416
71504
  return [];
71417
71505
  }
71418
71506
  }
@@ -71444,8 +71532,8 @@ var init_product_recommendations_capability2 = __esm({
71444
71532
  }
71445
71533
  }
71446
71534
  return result;
71447
- } catch (error6) {
71448
- console.error("Error fetching similar product recommendations:", error6);
71535
+ } catch (error5) {
71536
+ console.error("Error fetching similar product recommendations:", error5);
71449
71537
  return [];
71450
71538
  }
71451
71539
  }
@@ -71477,8 +71565,8 @@ var init_product_recommendations_capability2 = __esm({
71477
71565
  }
71478
71566
  }
71479
71567
  return result;
71480
- } catch (error6) {
71481
- console.error("Error fetching related product recommendations:", error6);
71568
+ } catch (error5) {
71569
+ console.error("Error fetching related product recommendations:", error5);
71482
71570
  return [];
71483
71571
  }
71484
71572
  }
@@ -71511,8 +71599,8 @@ var init_product_recommendations_capability2 = __esm({
71511
71599
  }
71512
71600
  }
71513
71601
  return result;
71514
- } catch (error6) {
71515
- console.error("Error fetching trending in category recommendations:", error6);
71602
+ } catch (error5) {
71603
+ console.error("Error fetching trending in category recommendations:", error5);
71516
71604
  return [];
71517
71605
  }
71518
71606
  }
@@ -71992,7 +72080,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
71992
72080
  });
71993
72081
  return response;
71994
72082
  }
71995
- return sendRequest().catch((error6) => Promise.reject(error6));
72083
+ return sendRequest().catch((error5) => Promise.reject(error5));
71996
72084
  }
71997
72085
  async function executor(request) {
71998
72086
  const {
@@ -72461,8 +72549,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
72461
72549
  message: response.data.message,
72462
72550
  error: response.data.errors
72463
72551
  });
72464
- } catch (error6) {
72465
- throw error6;
72552
+ } catch (error5) {
72553
+ throw error5;
72466
72554
  }
72467
72555
  }
72468
72556
  async function authProcessor(request, tokenFetchPromise = null, tokenCacheObject, tokenCacheKey, tokenCache, builder, options, next) {
@@ -72621,11 +72709,11 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
72621
72709
  const response = await next(request);
72622
72710
  if (response.error) {
72623
72711
  const {
72624
- error: error6
72712
+ error: error5
72625
72713
  } = response;
72626
72714
  if (options.handler && typeof options.handler == "function") {
72627
72715
  return options.handler({
72628
- error: error6,
72716
+ error: error5,
72629
72717
  request,
72630
72718
  response,
72631
72719
  next
@@ -72633,10 +72721,10 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
72633
72721
  }
72634
72722
  return {
72635
72723
  ...response,
72636
- statusCode: error6.statusCode || 0,
72637
- headers: error6.headers || getHeaders({}),
72638
- body: error6,
72639
- error: error6
72724
+ statusCode: error5.statusCode || 0,
72725
+ headers: error5.headers || getHeaders({}),
72726
+ body: error5,
72727
+ error: error5
72640
72728
  };
72641
72729
  }
72642
72730
  return response;
@@ -72682,7 +72770,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
72682
72770
  headers: getHeaders(response.headers)
72683
72771
  };
72684
72772
  }
72685
- const error6 = createError({
72773
+ const error5 = createError({
72686
72774
  code: response.data?.errors?.[0].code,
72687
72775
  message: response?.data?.message || response?.message,
72688
72776
  statusCode: response.statusCode || response?.data?.statusCode,
@@ -72701,14 +72789,14 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
72701
72789
  }
72702
72790
  });
72703
72791
  return {
72704
- ...error6,
72705
- error: error6
72792
+ ...error5,
72793
+ error: error5
72706
72794
  };
72707
72795
  } catch (e2) {
72708
72796
  const headers = includeResponseHeaders ? getHeaders(e2.response?.headers) : null;
72709
72797
  const statusCode = e2.response?.status || e2.response?.statusCode || e2.response?.data.statusCode || 0;
72710
72798
  const message = e2.response?.data?.message;
72711
- const error6 = createError({
72799
+ const error5 = createError({
72712
72800
  statusCode,
72713
72801
  code: "NetworkError",
72714
72802
  status: statusCode,
@@ -72728,7 +72816,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
72728
72816
  throw {
72729
72817
  // because body and error should be mutually exclusive
72730
72818
  body: null,
72731
- error: error6
72819
+ error: error5
72732
72820
  };
72733
72821
  }
72734
72822
  }
@@ -72850,8 +72938,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
72850
72938
  request.resolve(data);
72851
72939
  freeSlot();
72852
72940
  },
72853
- reject(error6) {
72854
- request.reject(error6);
72941
+ reject(error5) {
72942
+ request.reject(error5);
72855
72943
  freeSlot();
72856
72944
  }
72857
72945
  };
@@ -73028,8 +73116,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
73028
73116
  const last = results[resultsLength - 1];
73029
73117
  const newLastId = last && last.id;
73030
73118
  processPage(newLastId, accumulated);
73031
- } catch (error6) {
73032
- reject(error6);
73119
+ } catch (error5) {
73120
+ reject(error5);
73033
73121
  }
73034
73122
  };
73035
73123
  processPage();
@@ -73425,7 +73513,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
73425
73513
  });
73426
73514
  return response;
73427
73515
  }
73428
- return sendRequest().catch((error6) => Promise.reject(error6));
73516
+ return sendRequest().catch((error5) => Promise.reject(error5));
73429
73517
  }
73430
73518
  async function executor(request) {
73431
73519
  const {
@@ -73894,8 +73982,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
73894
73982
  message: response.data.message,
73895
73983
  error: response.data.errors
73896
73984
  });
73897
- } catch (error6) {
73898
- throw error6;
73985
+ } catch (error5) {
73986
+ throw error5;
73899
73987
  }
73900
73988
  }
73901
73989
  async function authProcessor(request, tokenFetchPromise = null, tokenCacheObject, tokenCacheKey, tokenCache, builder, options, next) {
@@ -74054,11 +74142,11 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
74054
74142
  const response = await next(request);
74055
74143
  if (response.error) {
74056
74144
  const {
74057
- error: error6
74145
+ error: error5
74058
74146
  } = response;
74059
74147
  if (options.handler && typeof options.handler == "function") {
74060
74148
  return options.handler({
74061
- error: error6,
74149
+ error: error5,
74062
74150
  request,
74063
74151
  response,
74064
74152
  next
@@ -74066,10 +74154,10 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
74066
74154
  }
74067
74155
  return {
74068
74156
  ...response,
74069
- statusCode: error6.statusCode || 0,
74070
- headers: error6.headers || getHeaders({}),
74071
- body: error6,
74072
- error: error6
74157
+ statusCode: error5.statusCode || 0,
74158
+ headers: error5.headers || getHeaders({}),
74159
+ body: error5,
74160
+ error: error5
74073
74161
  };
74074
74162
  }
74075
74163
  return response;
@@ -74115,7 +74203,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
74115
74203
  headers: getHeaders(response.headers)
74116
74204
  };
74117
74205
  }
74118
- const error6 = createError({
74206
+ const error5 = createError({
74119
74207
  code: response.data?.errors?.[0].code,
74120
74208
  message: response?.data?.message || response?.message,
74121
74209
  statusCode: response.statusCode || response?.data?.statusCode,
@@ -74134,14 +74222,14 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
74134
74222
  }
74135
74223
  });
74136
74224
  return {
74137
- ...error6,
74138
- error: error6
74225
+ ...error5,
74226
+ error: error5
74139
74227
  };
74140
74228
  } catch (e2) {
74141
74229
  const headers = includeResponseHeaders ? getHeaders(e2.response?.headers) : null;
74142
74230
  const statusCode = e2.response?.status || e2.response?.statusCode || e2.response?.data.statusCode || 0;
74143
74231
  const message = e2.response?.data?.message;
74144
- const error6 = createError({
74232
+ const error5 = createError({
74145
74233
  statusCode,
74146
74234
  code: "NetworkError",
74147
74235
  status: statusCode,
@@ -74161,7 +74249,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
74161
74249
  throw {
74162
74250
  // because body and error should be mutually exclusive
74163
74251
  body: null,
74164
- error: error6
74252
+ error: error5
74165
74253
  };
74166
74254
  }
74167
74255
  }
@@ -74283,8 +74371,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
74283
74371
  request.resolve(data);
74284
74372
  freeSlot();
74285
74373
  },
74286
- reject(error6) {
74287
- request.reject(error6);
74374
+ reject(error5) {
74375
+ request.reject(error5);
74288
74376
  freeSlot();
74289
74377
  }
74290
74378
  };
@@ -74461,8 +74549,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
74461
74549
  const last = results[resultsLength - 1];
74462
74550
  const newLastId = last && last.id;
74463
74551
  processPage(newLastId, accumulated);
74464
- } catch (error6) {
74465
- reject(error6);
74552
+ } catch (error5) {
74553
+ reject(error5);
74466
74554
  }
74467
74555
  };
74468
74556
  processPage();
@@ -111591,46 +111679,46 @@ var require_ms = __commonJS({
111591
111679
  var require_common2 = __commonJS({
111592
111680
  "node_modules/.pnpm/debug@4.4.3_supports-color@7.2.0/node_modules/debug/src/common.js"(exports2, module2) {
111593
111681
  function setup(env) {
111594
- createDebug40.debug = createDebug40;
111595
- createDebug40.default = createDebug40;
111596
- createDebug40.coerce = coerce;
111597
- createDebug40.disable = disable;
111598
- createDebug40.enable = enable;
111599
- createDebug40.enabled = enabled;
111600
- createDebug40.humanize = require_ms();
111601
- createDebug40.destroy = destroy;
111682
+ createDebug41.debug = createDebug41;
111683
+ createDebug41.default = createDebug41;
111684
+ createDebug41.coerce = coerce;
111685
+ createDebug41.disable = disable;
111686
+ createDebug41.enable = enable;
111687
+ createDebug41.enabled = enabled;
111688
+ createDebug41.humanize = require_ms();
111689
+ createDebug41.destroy = destroy;
111602
111690
  Object.keys(env).forEach((key) => {
111603
- createDebug40[key] = env[key];
111691
+ createDebug41[key] = env[key];
111604
111692
  });
111605
- createDebug40.names = [];
111606
- createDebug40.skips = [];
111607
- createDebug40.formatters = {};
111693
+ createDebug41.names = [];
111694
+ createDebug41.skips = [];
111695
+ createDebug41.formatters = {};
111608
111696
  function selectColor(namespace) {
111609
111697
  let hash2 = 0;
111610
111698
  for (let i3 = 0; i3 < namespace.length; i3++) {
111611
111699
  hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i3);
111612
111700
  hash2 |= 0;
111613
111701
  }
111614
- return createDebug40.colors[Math.abs(hash2) % createDebug40.colors.length];
111702
+ return createDebug41.colors[Math.abs(hash2) % createDebug41.colors.length];
111615
111703
  }
111616
- createDebug40.selectColor = selectColor;
111617
- function createDebug40(namespace) {
111704
+ createDebug41.selectColor = selectColor;
111705
+ function createDebug41(namespace) {
111618
111706
  let prevTime;
111619
111707
  let enableOverride = null;
111620
111708
  let namespacesCache;
111621
111709
  let enabledCache;
111622
- function debug40(...args) {
111623
- if (!debug40.enabled) {
111710
+ function debug41(...args) {
111711
+ if (!debug41.enabled) {
111624
111712
  return;
111625
111713
  }
111626
- const self2 = debug40;
111714
+ const self2 = debug41;
111627
111715
  const curr = Number(/* @__PURE__ */ new Date());
111628
111716
  const ms = curr - (prevTime || curr);
111629
111717
  self2.diff = ms;
111630
111718
  self2.prev = prevTime;
111631
111719
  self2.curr = curr;
111632
111720
  prevTime = curr;
111633
- args[0] = createDebug40.coerce(args[0]);
111721
+ args[0] = createDebug41.coerce(args[0]);
111634
111722
  if (typeof args[0] !== "string") {
111635
111723
  args.unshift("%O");
111636
111724
  }
@@ -111640,7 +111728,7 @@ var require_common2 = __commonJS({
111640
111728
  return "%";
111641
111729
  }
111642
111730
  index++;
111643
- const formatter = createDebug40.formatters[format];
111731
+ const formatter = createDebug41.formatters[format];
111644
111732
  if (typeof formatter === "function") {
111645
111733
  const val = args[index];
111646
111734
  match = formatter.call(self2, val);
@@ -111649,25 +111737,25 @@ var require_common2 = __commonJS({
111649
111737
  }
111650
111738
  return match;
111651
111739
  });
111652
- createDebug40.formatArgs.call(self2, args);
111653
- const logFn = self2.log || createDebug40.log;
111740
+ createDebug41.formatArgs.call(self2, args);
111741
+ const logFn = self2.log || createDebug41.log;
111654
111742
  logFn.apply(self2, args);
111655
111743
  }
111656
- debug40.namespace = namespace;
111657
- debug40.useColors = createDebug40.useColors();
111658
- debug40.color = createDebug40.selectColor(namespace);
111659
- debug40.extend = extend2;
111660
- debug40.destroy = createDebug40.destroy;
111661
- Object.defineProperty(debug40, "enabled", {
111744
+ debug41.namespace = namespace;
111745
+ debug41.useColors = createDebug41.useColors();
111746
+ debug41.color = createDebug41.selectColor(namespace);
111747
+ debug41.extend = extend2;
111748
+ debug41.destroy = createDebug41.destroy;
111749
+ Object.defineProperty(debug41, "enabled", {
111662
111750
  enumerable: true,
111663
111751
  configurable: false,
111664
111752
  get: () => {
111665
111753
  if (enableOverride !== null) {
111666
111754
  return enableOverride;
111667
111755
  }
111668
- if (namespacesCache !== createDebug40.namespaces) {
111669
- namespacesCache = createDebug40.namespaces;
111670
- enabledCache = createDebug40.enabled(namespace);
111756
+ if (namespacesCache !== createDebug41.namespaces) {
111757
+ namespacesCache = createDebug41.namespaces;
111758
+ enabledCache = createDebug41.enabled(namespace);
111671
111759
  }
111672
111760
  return enabledCache;
111673
111761
  },
@@ -111675,27 +111763,27 @@ var require_common2 = __commonJS({
111675
111763
  enableOverride = v4;
111676
111764
  }
111677
111765
  });
111678
- if (typeof createDebug40.init === "function") {
111679
- createDebug40.init(debug40);
111766
+ if (typeof createDebug41.init === "function") {
111767
+ createDebug41.init(debug41);
111680
111768
  }
111681
- return debug40;
111769
+ return debug41;
111682
111770
  }
111683
111771
  function extend2(namespace, delimiter) {
111684
- const newDebug = createDebug40(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
111772
+ const newDebug = createDebug41(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
111685
111773
  newDebug.log = this.log;
111686
111774
  return newDebug;
111687
111775
  }
111688
111776
  function enable(namespaces) {
111689
- createDebug40.save(namespaces);
111690
- createDebug40.namespaces = namespaces;
111691
- createDebug40.names = [];
111692
- createDebug40.skips = [];
111777
+ createDebug41.save(namespaces);
111778
+ createDebug41.namespaces = namespaces;
111779
+ createDebug41.names = [];
111780
+ createDebug41.skips = [];
111693
111781
  const split2 = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
111694
111782
  for (const ns of split2) {
111695
111783
  if (ns[0] === "-") {
111696
- createDebug40.skips.push(ns.slice(1));
111784
+ createDebug41.skips.push(ns.slice(1));
111697
111785
  } else {
111698
- createDebug40.names.push(ns);
111786
+ createDebug41.names.push(ns);
111699
111787
  }
111700
111788
  }
111701
111789
  }
@@ -111729,19 +111817,19 @@ var require_common2 = __commonJS({
111729
111817
  }
111730
111818
  function disable() {
111731
111819
  const namespaces = [
111732
- ...createDebug40.names,
111733
- ...createDebug40.skips.map((namespace) => "-" + namespace)
111820
+ ...createDebug41.names,
111821
+ ...createDebug41.skips.map((namespace) => "-" + namespace)
111734
111822
  ].join(",");
111735
- createDebug40.enable("");
111823
+ createDebug41.enable("");
111736
111824
  return namespaces;
111737
111825
  }
111738
111826
  function enabled(name) {
111739
- for (const skip of createDebug40.skips) {
111827
+ for (const skip of createDebug41.skips) {
111740
111828
  if (matchesTemplate(name, skip)) {
111741
111829
  return false;
111742
111830
  }
111743
111831
  }
111744
- for (const ns of createDebug40.names) {
111832
+ for (const ns of createDebug41.names) {
111745
111833
  if (matchesTemplate(name, ns)) {
111746
111834
  return true;
111747
111835
  }
@@ -111757,8 +111845,8 @@ var require_common2 = __commonJS({
111757
111845
  function destroy() {
111758
111846
  console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
111759
111847
  }
111760
- createDebug40.enable(createDebug40.load());
111761
- return createDebug40;
111848
+ createDebug41.enable(createDebug41.load());
111849
+ return createDebug41;
111762
111850
  }
111763
111851
  module2.exports = setup;
111764
111852
  }
@@ -111902,14 +111990,14 @@ var require_browser = __commonJS({
111902
111990
  } else {
111903
111991
  exports2.storage.removeItem("debug");
111904
111992
  }
111905
- } catch (error6) {
111993
+ } catch (error5) {
111906
111994
  }
111907
111995
  }
111908
111996
  function load() {
111909
111997
  let r3;
111910
111998
  try {
111911
111999
  r3 = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
111912
- } catch (error6) {
112000
+ } catch (error5) {
111913
112001
  }
111914
112002
  if (!r3 && typeof process !== "undefined" && "env" in process) {
111915
112003
  r3 = process.env.DEBUG;
@@ -111919,7 +112007,7 @@ var require_browser = __commonJS({
111919
112007
  function localstorage() {
111920
112008
  try {
111921
112009
  return localStorage;
111922
- } catch (error6) {
112010
+ } catch (error5) {
111923
112011
  }
111924
112012
  }
111925
112013
  module2.exports = require_common2()(exports2);
@@ -111927,8 +112015,8 @@ var require_browser = __commonJS({
111927
112015
  formatters.j = function(v4) {
111928
112016
  try {
111929
112017
  return JSON.stringify(v4);
111930
- } catch (error6) {
111931
- return "[UnexpectedJSONParseError]: " + error6.message;
112018
+ } catch (error5) {
112019
+ return "[UnexpectedJSONParseError]: " + error5.message;
111932
112020
  }
111933
112021
  };
111934
112022
  }
@@ -112148,7 +112236,7 @@ var require_node = __commonJS({
112148
112236
  221
112149
112237
  ];
112150
112238
  }
112151
- } catch (error6) {
112239
+ } catch (error5) {
112152
112240
  }
112153
112241
  exports2.inspectOpts = Object.keys(process.env).filter((key) => {
112154
112242
  return /^debug_/i.test(key);
@@ -112203,11 +112291,11 @@ var require_node = __commonJS({
112203
112291
  function load() {
112204
112292
  return process.env.DEBUG;
112205
112293
  }
112206
- function init(debug40) {
112207
- debug40.inspectOpts = {};
112294
+ function init(debug41) {
112295
+ debug41.inspectOpts = {};
112208
112296
  const keys = Object.keys(exports2.inspectOpts);
112209
112297
  for (let i3 = 0; i3 < keys.length; i3++) {
112210
- debug40.inspectOpts[keys[i3]] = exports2.inspectOpts[keys[i3]];
112298
+ debug41.inspectOpts[keys[i3]] = exports2.inspectOpts[keys[i3]];
112211
112299
  }
112212
112300
  }
112213
112301
  module2.exports = require_common2()(exports2);
@@ -112761,7 +112849,10 @@ var init_configuration_schema2 = __esm({
112761
112849
  paymentMethods: PaymentMethodSchema.array().optional().default(() => []),
112762
112850
  facetFieldsForSearch: array(string2()).default(() => []),
112763
112851
  listPriceChannelKey: string2().optional(),
112764
- customerPriceChannelKey: string2().optional()
112852
+ customerPriceChannelKey: string2().optional(),
112853
+ bopis: looseObject({
112854
+ shippingMethodKeys: array(string2()).default(() => []).meta({ description: 'The keys of the commercetools shipping methods that represent in-store pickup (BOPIS). Shipping methods with these keys are tagged with fulfillmentType "pickup"; all others are tagged "delivery".' })
112855
+ }).optional().meta({ description: "Optional buy-online-pickup-in-store (BOPIS) configuration." })
112765
112856
  });
112766
112857
  }
112767
112858
  });
@@ -113104,6 +113195,41 @@ var init_payment_protocol_data = __esm({
113104
113195
  }
113105
113196
  });
113106
113197
 
113198
+ // packages/commercetools/src/core/shipping-protocol-data.ts
113199
+ function serializeShippingProtocolData(entries) {
113200
+ return JSON.stringify(Object.fromEntries(entries.map((entry) => [entry.key, entry.value])));
113201
+ }
113202
+ function parseShippingProtocolDataField(value) {
113203
+ if (typeof value !== "string" || value.length === 0) {
113204
+ return void 0;
113205
+ }
113206
+ try {
113207
+ const parsed = JSON.parse(value);
113208
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
113209
+ return void 0;
113210
+ }
113211
+ const entries = [];
113212
+ for (const [key, entry] of Object.entries(parsed)) {
113213
+ if (typeof entry === "string") {
113214
+ entries.push({ key, value: entry });
113215
+ } else if (typeof entry === "object" && entry !== null && !Array.isArray(entry)) {
113216
+ entries.push({ key, value: entry });
113217
+ }
113218
+ }
113219
+ return entries.length > 0 ? entries : void 0;
113220
+ } catch {
113221
+ return void 0;
113222
+ }
113223
+ }
113224
+ var SHIPPING_PROTOCOL_DATA_FIELD, PICKUP_STORE_FIELD;
113225
+ var init_shipping_protocol_data = __esm({
113226
+ "packages/commercetools/src/core/shipping-protocol-data.ts"() {
113227
+ "use strict";
113228
+ SHIPPING_PROTOCOL_DATA_FIELD = "shippingProtocolData";
113229
+ PICKUP_STORE_FIELD = "pickupStoreKey";
113230
+ }
113231
+ });
113232
+
113107
113233
  // packages/commercetools/src/factories/checkout/checkout.factory.ts
113108
113234
  var CommercetoolsCheckoutFactory;
113109
113235
  var init_checkout_factory2 = __esm({
@@ -113112,6 +113238,7 @@ var init_checkout_factory2 = __esm({
113112
113238
  init_payment_protocol_data();
113113
113239
  init_src();
113114
113240
  init_locale_utils();
113241
+ init_shipping_protocol_data();
113115
113242
  CommercetoolsCheckoutFactory = class {
113116
113243
  checkoutSchema;
113117
113244
  shippingMethodSchema;
@@ -113330,13 +113457,20 @@ var init_checkout_factory2 = __esm({
113330
113457
  const instructions = data.custom?.fields["shippingInstruction"] || "";
113331
113458
  const consentForUnattendedDelivery = data.custom?.fields["consentForUnattendedDelivery"] === "true";
113332
113459
  const pickupPoint = data.custom?.fields["pickupPointId"] || "";
113460
+ const pickupStoreKey = data.custom?.fields[PICKUP_STORE_FIELD];
113461
+ const store = typeof pickupStoreKey === "string" && pickupStoreKey.length > 0 ? { key: pickupStoreKey } : void 0;
113462
+ const protocolData = parseShippingProtocolDataField(
113463
+ data.custom?.fields[SHIPPING_PROTOCOL_DATA_FIELD]
113464
+ );
113333
113465
  const result = {
113334
113466
  shippingMethod: {
113335
113467
  key: data.shippingInfo.shippingMethod?.obj?.key || ""
113336
113468
  },
113337
113469
  pickupPoint,
113338
113470
  instructions,
113339
- consentForUnattendedDelivery
113471
+ consentForUnattendedDelivery,
113472
+ store,
113473
+ protocolData
113340
113474
  };
113341
113475
  return result;
113342
113476
  }
@@ -114800,10 +114934,10 @@ var init_category_capability2 = __esm({
114800
114934
  }
114801
114935
  }
114802
114936
  path2.push(category);
114803
- } catch (error6) {
114937
+ } catch (error5) {
114804
114938
  console.error(
114805
114939
  `Error fetching category path for ${payload.id.key}:`,
114806
- error6
114940
+ error5
114807
114941
  );
114808
114942
  }
114809
114943
  return success(path2);
@@ -114825,10 +114959,10 @@ var init_category_capability2 = __esm({
114825
114959
  }).execute();
114826
114960
  const result = this.factory.parseCategoryPaginatedResult(this.context, response.body, payload);
114827
114961
  return success(result);
114828
- } catch (error6) {
114962
+ } catch (error5) {
114829
114963
  console.error(
114830
114964
  `Error fetching category path for ${payload.parentId.key}:`,
114831
- error6
114965
+ error5
114832
114966
  );
114833
114967
  }
114834
114968
  const empty = {
@@ -114854,8 +114988,8 @@ var init_category_capability2 = __esm({
114854
114988
  }).execute();
114855
114989
  const result = this.factory.parseCategoryPaginatedResult(this.context, response.body, payload);
114856
114990
  return success(result);
114857
- } catch (error6) {
114858
- console.error(`Error fetching category top categories:`, error6);
114991
+ } catch (error5) {
114992
+ console.error(`Error fetching category top categories:`, error5);
114859
114993
  }
114860
114994
  const empty = {
114861
114995
  items: [],
@@ -114904,6 +115038,16 @@ var init_category_capability2 = __esm({
114904
115038
  }
114905
115039
  });
114906
115040
 
115041
+ // packages/commercetools/src/core/shipping-fulfillment.ts
115042
+ function resolveShippingFulfillmentType(shippingMethod, bopisShippingMethodKeys) {
115043
+ return shippingMethod.key && (bopisShippingMethodKeys || []).includes(shippingMethod.key) ? "pickup" : "delivery";
115044
+ }
115045
+ var init_shipping_fulfillment = __esm({
115046
+ "packages/commercetools/src/core/shipping-fulfillment.ts"() {
115047
+ "use strict";
115048
+ }
115049
+ });
115050
+
114907
115051
  // packages/commercetools/src/schema/commercetools.schema.ts
114908
115052
  var CommercetoolsCartIdentifierSchema, CommercetoolsProductListIdentifierSchema, CommercetoolsCartItemIdentifierSchema, CommercetoolsOrderIdentifierSchema, CommercetoolsCheckoutIdentifierSchema, CommercetoolsResolveCategoryQueryByKeySchema, CommercetoolsResolveCategoryQueryByIdSchema, CommercetoolsCategoryLookupSchema, CommercetoolsEmployeeInviteCustomObjectValueSchema, CommercetoolsEmployeeInviteCustomObjectSchema;
114909
115053
  var init_commercetools_schema = __esm({
@@ -114964,6 +115108,8 @@ var init_checkout_capability2 = __esm({
114964
115108
  "packages/commercetools/src/capabilities/checkout.capability.ts"() {
114965
115109
  "use strict";
114966
115110
  init_payment_protocol_data();
115111
+ init_shipping_protocol_data();
115112
+ init_shipping_fulfillment();
114967
115113
  init_src();
114968
115114
  init_zod();
114969
115115
  init_locale_utils();
@@ -115110,10 +115256,25 @@ var init_checkout_capability2 = __esm({
115110
115256
  client.carts.withId({ ID: payload.checkout.key }).get().execute()
115111
115257
  ]);
115112
115258
  const result = shippingMethodsResponse.body.results.map(
115113
- (shippingMethod) => this.factory.parseShippingMethod(this.context, this.withFreeShipping(shippingMethod, cartResponse.body))
115259
+ (shippingMethod) => this.withFulfillmentType(
115260
+ this.factory.parseShippingMethod(this.context, this.withFreeShipping(shippingMethod, cartResponse.body)),
115261
+ shippingMethod
115262
+ )
115114
115263
  );
115115
115264
  return success(result);
115116
115265
  }
115266
+ /**
115267
+ * Tags a parsed shipping method with its fulfillment type: methods whose
115268
+ * key is listed in the `bopis.shippingMethodKeys` configuration are
115269
+ * in-store pickup (BOPIS), everything else is a delivery. The tagging lives
115270
+ * here rather than in the factory, so factories stay configuration-free.
115271
+ */
115272
+ withFulfillmentType(shippingMethod, remote) {
115273
+ return {
115274
+ ...shippingMethod,
115275
+ fulfillmentType: resolveShippingFulfillmentType(remote, this.config.bopis?.shippingMethodKeys)
115276
+ };
115277
+ }
115117
115278
  /**
115118
115279
  * Quotes the matching shipping rates as free where the cart reaches the
115119
115280
  * rate's free-above threshold. commercetools' matching-cart query returns
@@ -115225,6 +115386,20 @@ var init_checkout_capability2 = __esm({
115225
115386
  name: "pickupPointId",
115226
115387
  value: payload.shippingInstruction.pickupPoint
115227
115388
  });
115389
+ if (payload.shippingInstruction.store?.key) {
115390
+ actions.push({
115391
+ action: "setCustomField",
115392
+ name: PICKUP_STORE_FIELD,
115393
+ value: payload.shippingInstruction.store.key
115394
+ });
115395
+ }
115396
+ if (payload.shippingInstruction.protocolData && payload.shippingInstruction.protocolData.length > 0) {
115397
+ actions.push({
115398
+ action: "setCustomField",
115399
+ name: SHIPPING_PROTOCOL_DATA_FIELD,
115400
+ value: serializeShippingProtocolData(payload.shippingInstruction.protocolData)
115401
+ });
115402
+ }
115228
115403
  const result = await this.applyActions(
115229
115404
  payload.checkout,
115230
115405
  actions
@@ -116800,9 +116975,9 @@ var init_product_search_capability3 = __esm({
116800
116975
  continue;
116801
116976
  }
116802
116977
  facetValue.name = category.name[this.languageCode] || category.id;
116803
- } catch (error6) {
116978
+ } catch (error5) {
116804
116979
  if (debug3.enabled) {
116805
- debug3(`Error resolving category key for id ${facetValue.identifier.key}:`, error6);
116980
+ debug3(`Error resolving category key for id ${facetValue.identifier.key}:`, error5);
116806
116981
  }
116807
116982
  }
116808
116983
  }
@@ -117199,6 +117374,48 @@ var init_store_capability2 = __esm({
117199
117374
  }
117200
117375
  return success(results);
117201
117376
  }
117377
+ /**
117378
+ * The channel predicate selecting the channels that represent the brand's
117379
+ * own stores. Override in a subclass if a project models stores differently.
117380
+ */
117381
+ getStoreChannelPredicate() {
117382
+ return 'roles contains any ("InventorySupply")';
117383
+ }
117384
+ async list(payload) {
117385
+ const client = await this.getClient();
117386
+ const { pageNumber, pageSize } = payload.paginationOptions;
117387
+ const remote = await client.channels().get({
117388
+ queryArgs: {
117389
+ limit: pageSize,
117390
+ offset: (pageNumber - 1) * pageSize,
117391
+ withTotal: true,
117392
+ where: this.getStoreChannelPredicate()
117393
+ }
117394
+ }).execute();
117395
+ const totalCount = remote.body.total ?? remote.body.results.length;
117396
+ return success({
117397
+ pageNumber,
117398
+ pageSize,
117399
+ totalCount,
117400
+ totalPages: Math.ceil(totalCount / pageSize),
117401
+ items: remote.body.results.map((r3) => this.factory.parseStore(this.context, r3))
117402
+ });
117403
+ }
117404
+ async getById(payload) {
117405
+ const client = await this.getClient();
117406
+ const remote = await client.channels().get({
117407
+ queryArgs: {
117408
+ limit: 1,
117409
+ where: `key = :key AND ${this.getStoreChannelPredicate()}`,
117410
+ "var.key": payload.identifier.key
117411
+ }
117412
+ }).execute();
117413
+ const channel = remote.body.results[0];
117414
+ if (!channel) {
117415
+ return error2({ type: "NotFound", identifier: payload.identifier });
117416
+ }
117417
+ return success(this.factory.parseStore(this.context, channel));
117418
+ }
117202
117419
  };
117203
117420
  __decorateClass([
117204
117421
  Reactionary({
@@ -117206,6 +117423,18 @@ var init_store_capability2 = __esm({
117206
117423
  outputSchema: array(StoreSchema)
117207
117424
  })
117208
117425
  ], CommercetoolsStoreCapability.prototype, "queryByProximity", 1);
117426
+ __decorateClass([
117427
+ Reactionary({
117428
+ inputSchema: StoreQueryForListSchema,
117429
+ outputSchema: StorePaginatedResultSchema
117430
+ })
117431
+ ], CommercetoolsStoreCapability.prototype, "list", 1);
117432
+ __decorateClass([
117433
+ Reactionary({
117434
+ inputSchema: StoreQueryByIdSchema,
117435
+ outputSchema: StoreSchema
117436
+ })
117437
+ ], CommercetoolsStoreCapability.prototype, "getById", 1);
117209
117438
  }
117210
117439
  });
117211
117440
 
@@ -117302,11 +117531,11 @@ var init_company_registration_capability2 = __esm({
117302
117531
  message: "Only registered users can check company registration status"
117303
117532
  });
117304
117533
  }
117305
- const response = await client.businessUnits().withId({ ID: payload.requestIdentifier.key }).get().execute().catch((error6) => {
117306
- if (error6?.statusCode === 404) {
117534
+ const response = await client.businessUnits().withId({ ID: payload.requestIdentifier.key }).get().execute().catch((error5) => {
117535
+ if (error5?.statusCode === 404) {
117307
117536
  return null;
117308
117537
  }
117309
- throw error6;
117538
+ throw error5;
117310
117539
  });
117311
117540
  if (!response) {
117312
117541
  return error2({
@@ -118216,11 +118445,11 @@ var init_employee_invitation_capability2 = __esm({
118216
118445
  const response = await adminClient.customObjects().withContainerAndKey({
118217
118446
  container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS_INDEX,
118218
118447
  key
118219
- }).get().execute().catch((error6) => {
118220
- if (error6?.statusCode === 404) {
118448
+ }).get().execute().catch((error5) => {
118449
+ if (error5?.statusCode === 404) {
118221
118450
  return null;
118222
118451
  }
118223
- throw error6;
118452
+ throw error5;
118224
118453
  });
118225
118454
  if (!response) {
118226
118455
  return [];
@@ -118279,11 +118508,11 @@ var init_employee_invitation_capability2 = __esm({
118279
118508
  allInviteIds = allInviteIds.slice(start, end);
118280
118509
  }
118281
118510
  for (const invitationId of allInviteIds) {
118282
- const invitationResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationId }).get().execute().catch((error6) => {
118283
- if (error6?.statusCode === 404) {
118511
+ const invitationResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationId }).get().execute().catch((error5) => {
118512
+ if (error5?.statusCode === 404) {
118284
118513
  return null;
118285
118514
  }
118286
- throw error6;
118515
+ throw error5;
118287
118516
  });
118288
118517
  const invitation = invitationResponse?.body;
118289
118518
  if (!invitation) {
@@ -118306,11 +118535,11 @@ var init_employee_invitation_capability2 = __esm({
118306
118535
  return this.fetchInvitations(adminClient, this.makeKeyFromEmail(userEmail), onlyActive, paginationOptions);
118307
118536
  }
118308
118537
  async fetchInvitationByKey(adminClient, invitationKey) {
118309
- const inviteResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationKey }).get().execute().catch((error6) => {
118310
- if (error6?.statusCode === 404) {
118538
+ const inviteResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationKey }).get().execute().catch((error5) => {
118539
+ if (error5?.statusCode === 404) {
118311
118540
  return null;
118312
118541
  }
118313
- throw error6;
118542
+ throw error5;
118314
118543
  });
118315
118544
  if (!inviteResponse) {
118316
118545
  return null;
@@ -118414,11 +118643,11 @@ var init_employee_invitation_capability2 = __esm({
118414
118643
  error: `Invitation token is invalid.`
118415
118644
  });
118416
118645
  }
118417
- const businessUnit = await adminClient.businessUnits().withKey({ key: invitation.value.company.taxIdentifier }).get().execute().catch((error6) => {
118418
- if (error6?.statusCode === 404) {
118646
+ const businessUnit = await adminClient.businessUnits().withKey({ key: invitation.value.company.taxIdentifier }).get().execute().catch((error5) => {
118647
+ if (error5?.statusCode === 404) {
118419
118648
  return null;
118420
118649
  }
118421
- throw error6;
118650
+ throw error5;
118422
118651
  });
118423
118652
  if (!businessUnit) {
118424
118653
  return error2({
@@ -123052,6 +123281,7 @@ var init_store_capability3 = __esm({
123052
123281
  init_src();
123053
123282
  init_zod();
123054
123283
  init_dist();
123284
+ init_seed();
123055
123285
  FakeStoreCapability = class extends StoreCapability {
123056
123286
  config;
123057
123287
  factory;
@@ -123060,26 +123290,82 @@ var init_store_capability3 = __esm({
123060
123290
  this.config = config3;
123061
123291
  this.factory = factory;
123062
123292
  }
123063
- async queryByProximity(payload) {
123293
+ /**
123294
+ * The countries the fake brand has physical stores in.
123295
+ */
123296
+ getStoreCountries() {
123297
+ return ["DK", "SE", "NO", "FI", "US"];
123298
+ }
123299
+ /**
123300
+ * How many physical stores the seed generates per country.
123301
+ */
123302
+ getStoresPerCountry() {
123303
+ return 3;
123304
+ }
123305
+ /**
123306
+ * The seeded set of physical stores: a fixed number per country, generated
123307
+ * deterministically from the store key.
123308
+ */
123309
+ getSeededStores() {
123310
+ const stores = [];
123311
+ for (const country of this.getStoreCountries()) {
123312
+ for (let i3 = 1; i3 <= this.getStoresPerCountry(); i3++) {
123313
+ stores.push(this.generateStore(`${country.toLowerCase()}-${i3}`, country));
123314
+ }
123315
+ }
123316
+ return stores;
123317
+ }
123318
+ generateStore(key, countryCode) {
123064
123319
  const generator = new Qe2({
123065
- seed: 42,
123320
+ seed: calcSeed(key),
123066
123321
  locale: [ys, Oi]
123067
123322
  });
123068
- const results = [];
123069
- for (let i3 = 0; i3 < payload.limit; i3++) {
123070
- results.push(
123071
- this.factory.parseStore(this.context, {
123072
- identifier: {
123073
- key: `${i3}`
123074
- },
123075
- fulfillmentCenter: {
123076
- key: `${i3}`
123077
- },
123078
- name: generator.company.name()
123079
- })
123080
- );
123323
+ const city = generator.location.city();
123324
+ return this.factory.parseStore(this.context, {
123325
+ identifier: {
123326
+ key
123327
+ },
123328
+ fulfillmentCenter: {
123329
+ key
123330
+ },
123331
+ name: `${generator.company.name()} ${city}`,
123332
+ address: {
123333
+ identifier: { nickName: key },
123334
+ firstName: "",
123335
+ lastName: "",
123336
+ streetAddress: generator.location.streetAddress(),
123337
+ streetNumber: "",
123338
+ city,
123339
+ region: "",
123340
+ postalCode: generator.location.zipCode("####"),
123341
+ countryCode
123342
+ },
123343
+ openingHours: "Mon-Fri 10am-6pm, Sat 10am-3pm"
123344
+ });
123345
+ }
123346
+ async queryByProximity(payload) {
123347
+ return success(this.getSeededStores().slice(0, payload.limit));
123348
+ }
123349
+ async list(payload) {
123350
+ const stores = this.getSeededStores();
123351
+ const { pageNumber, pageSize } = payload.paginationOptions;
123352
+ const startIndex = (pageNumber - 1) * pageSize;
123353
+ return success({
123354
+ pageNumber,
123355
+ pageSize,
123356
+ totalCount: stores.length,
123357
+ totalPages: Math.ceil(stores.length / pageSize),
123358
+ items: stores.slice(startIndex, startIndex + pageSize)
123359
+ });
123360
+ }
123361
+ async getById(payload) {
123362
+ const store = this.getSeededStores().find(
123363
+ (candidate) => candidate.identifier.key === payload.identifier.key
123364
+ );
123365
+ if (!store) {
123366
+ return error2({ type: "NotFound", identifier: payload.identifier });
123081
123367
  }
123082
- return success(results);
123368
+ return success(store);
123083
123369
  }
123084
123370
  };
123085
123371
  __decorateClass([
@@ -123088,6 +123374,18 @@ var init_store_capability3 = __esm({
123088
123374
  outputSchema: array(StoreSchema)
123089
123375
  })
123090
123376
  ], FakeStoreCapability.prototype, "queryByProximity", 1);
123377
+ __decorateClass([
123378
+ Reactionary({
123379
+ inputSchema: StoreQueryForListSchema,
123380
+ outputSchema: StorePaginatedResultSchema
123381
+ })
123382
+ ], FakeStoreCapability.prototype, "list", 1);
123383
+ __decorateClass([
123384
+ Reactionary({
123385
+ inputSchema: StoreQueryByIdSchema,
123386
+ outputSchema: StoreSchema
123387
+ })
123388
+ ], FakeStoreCapability.prototype, "getById", 1);
123091
123389
  }
123092
123390
  });
123093
123391
 
@@ -128406,7 +128704,8 @@ var init_medusa_schema = __esm({
128406
128704
  token: string2().optional(),
128407
128705
  expires: string2().optional(),
128408
128706
  allRegions: array(MedusaRegionSchema).optional(),
128409
- selectedRegion: MedusaRegionSchema.optional()
128707
+ selectedRegion: MedusaRegionSchema.optional(),
128708
+ finalizedOrders: record(string2(), MedusaOrderIdentifierSchema).optional().meta({ description: "Orders created by finalizing a checkout in this session, keyed by the originating cart id. Lets checkout reads report the resulting order when the Medusa store cart endpoint does not expose the cart-to-order relation." })
128410
128709
  });
128411
128710
  }
128412
128711
  });
@@ -128442,7 +128741,8 @@ var init_capabilities_schema6 = __esm({
128442
128741
  profile: true,
128443
128742
  productAssociations: true,
128444
128743
  personalizationProfile: true,
128445
- company: true
128744
+ company: true,
128745
+ store: true
128446
128746
  }).extend({
128447
128747
  product: OverridableCapabilitySchema4.optional(),
128448
128748
  productSearch: OverridableCapabilitySchema4.optional(),
@@ -128461,7 +128761,8 @@ var init_capabilities_schema6 = __esm({
128461
128761
  profile: OverridableCapabilitySchema4.optional(),
128462
128762
  productAssociations: OverridableCapabilitySchema4.optional(),
128463
128763
  productRecommendations: DirectCapabilitySchema2.optional(),
128464
- personalizationProfile: OverridableCapabilitySchema4.optional()
128764
+ personalizationProfile: OverridableCapabilitySchema4.optional(),
128765
+ store: OverridableCapabilitySchema4.optional()
128465
128766
  }).partial();
128466
128767
  }
128467
128768
  });
@@ -138020,9 +138321,9 @@ var init_client5 = __esm({
138020
138321
  return __asyncGenerator(this, arguments, function* () {
138021
138322
  const res = yield __await(fetchPromise);
138022
138323
  if (!res.ok) {
138023
- const error6 = new Error(`Stream failed with status ${res.status}`);
138024
- error6.name = "HttpError";
138025
- throw error6;
138324
+ const error5 = new Error(`Stream failed with status ${res.status}`);
138325
+ error5.name = "HttpError";
138326
+ throw error5;
138026
138327
  }
138027
138328
  yield __await(yield* __asyncDelegator(__asyncValues(events(res, abortController.signal))));
138028
138329
  });
@@ -158181,10 +158482,10 @@ var init_client6 = __esm({
158181
158482
  });
158182
158483
  const identity = await this.login(email3, password, reqCtx);
158183
158484
  return identity;
158184
- } catch (error6) {
158185
- debug21("Registration failed:", error6);
158485
+ } catch (error5) {
158486
+ debug21("Registration failed:", error5);
158186
158487
  throw new Error(
158187
- `Registration failed: ${error6 instanceof Error ? error6.message : "Unknown error"}`
158488
+ `Registration failed: ${error5 instanceof Error ? error5.message : "Unknown error"}`
158188
158489
  );
158189
158490
  }
158190
158491
  }
@@ -158214,10 +158515,10 @@ var init_client6 = __esm({
158214
158515
  return {
158215
158516
  type: "Anonymous"
158216
158517
  };
158217
- } catch (error6) {
158218
- debug21("Login failed:", error6);
158518
+ } catch (error5) {
158519
+ debug21("Login failed:", error5);
158219
158520
  throw new Error(
158220
- `Login failed: ${error6 instanceof Error ? error6.message : "Unknown error"}`
158521
+ `Login failed: ${error5 instanceof Error ? error5.message : "Unknown error"}`
158221
158522
  );
158222
158523
  }
158223
158524
  }
@@ -158230,8 +158531,8 @@ var init_client6 = __esm({
158230
158531
  await client.auth.logout();
158231
158532
  await client.client.clearToken();
158232
158533
  return identity;
158233
- } catch (error6) {
158234
- debug21("Logout failed:", error6);
158534
+ } catch (error5) {
158535
+ debug21("Logout failed:", error5);
158235
158536
  await client.client.clearToken();
158236
158537
  return identity;
158237
158538
  }
@@ -158258,8 +158559,8 @@ var init_client6 = __esm({
158258
158559
  });
158259
158560
 
158260
158561
  // packages/medusa/src/utils/medusa-helpers.ts
158261
- function isNotFoundFetchError(error6) {
158262
- return error6 instanceof FetchError && error6.status === 404;
158562
+ function isNotFoundFetchError(error5) {
158563
+ return error5 instanceof FetchError && error5.status === 404;
158263
158564
  }
158264
158565
  function parseMedusaCostBreakdown(remote) {
158265
158566
  const grandTotal = remote.total || 0;
@@ -158318,12 +158619,12 @@ function parseMedusaItemPrice(remoteItem, currency) {
158318
158619
  }
158319
158620
  };
158320
158621
  }
158321
- function handleProviderError(action, error6) {
158622
+ function handleProviderError(action, error5) {
158322
158623
  if (debug22.enabled) {
158323
- debug22(`Failed to ${action}:`, error6);
158624
+ debug22(`Failed to ${action}:`, error5);
158324
158625
  }
158325
158626
  throw new Error(
158326
- `Failed to ${action}: ${error6 instanceof Error ? error6.message : "Unknown error"}`
158627
+ `Failed to ${action}: ${error5 instanceof Error ? error5.message : "Unknown error"}`
158327
158628
  );
158328
158629
  }
158329
158630
  function safeBoolConvert(val) {
@@ -158616,8 +158917,8 @@ var init_cart_capability5 = __esm({
158616
158917
  return success(this.factory.parseCart(this.context, response.cart));
158617
158918
  }
158618
158919
  throw new Error("Failed to add item to cart");
158619
- } catch (error6) {
158620
- handleProviderError("add item to cart", error6);
158920
+ } catch (error5) {
158921
+ handleProviderError("add item to cart", error5);
158621
158922
  }
158622
158923
  }
158623
158924
  async renameCart(payload) {
@@ -158748,8 +159049,8 @@ var init_cart_capability5 = __esm({
158748
159049
  return success(this.factory.parseCart(this.context, response.cart));
158749
159050
  }
158750
159051
  throw new Error("Failed to create cart");
158751
- } catch (error6) {
158752
- handleProviderError("create cart", error6);
159052
+ } catch (error5) {
159053
+ handleProviderError("create cart", error5);
158753
159054
  }
158754
159055
  }
158755
159056
  async remove(payload) {
@@ -158767,8 +159068,8 @@ var init_cart_capability5 = __esm({
158767
159068
  return success(this.factory.parseCart(this.context, response.parent));
158768
159069
  }
158769
159070
  throw new Error("Failed to remove item from cart");
158770
- } catch (error6) {
158771
- handleProviderError("remove item from cart", error6);
159071
+ } catch (error5) {
159072
+ handleProviderError("remove item from cart", error5);
158772
159073
  }
158773
159074
  }
158774
159075
  /**
@@ -158802,8 +159103,8 @@ var init_cart_capability5 = __esm({
158802
159103
  return success(this.factory.parseCart(this.context, response.cart));
158803
159104
  }
158804
159105
  throw new Error("Failed to change item quantity");
158805
- } catch (error6) {
158806
- handleProviderError("change item quantity", error6);
159106
+ } catch (error5) {
159107
+ handleProviderError("change item quantity", error5);
158807
159108
  }
158808
159109
  }
158809
159110
  async getActiveCartId() {
@@ -158896,8 +159197,8 @@ var init_cart_capability5 = __esm({
158896
159197
  return success(this.factory.parseCart(this.context, response.cart));
158897
159198
  }
158898
159199
  throw new Error("Failed to apply coupon code");
158899
- } catch (error6) {
158900
- handleProviderError("apply coupon code", error6);
159200
+ } catch (error5) {
159201
+ handleProviderError("apply coupon code", error5);
158901
159202
  }
158902
159203
  }
158903
159204
  /**
@@ -158928,8 +159229,8 @@ var init_cart_capability5 = __esm({
158928
159229
  return success(this.factory.parseCart(this.context, response.cart));
158929
159230
  }
158930
159231
  throw new Error("Failed to remove coupon code");
158931
- } catch (error6) {
158932
- handleProviderError("remove coupon code", error6);
159232
+ } catch (error5) {
159233
+ handleProviderError("remove coupon code", error5);
158933
159234
  }
158934
159235
  }
158935
159236
  /**
@@ -158961,8 +159262,8 @@ var init_cart_capability5 = __esm({
158961
159262
  return success(this.factory.parseCart(this.context, updatedCartResponse.cart));
158962
159263
  }
158963
159264
  throw new Error("Failed to change currency");
158964
- } catch (error6) {
158965
- handleProviderError("change currency", error6);
159265
+ } catch (error5) {
159266
+ handleProviderError("change currency", error5);
158966
159267
  }
158967
159268
  }
158968
159269
  async getClient() {
@@ -159219,6 +159520,7 @@ var init_checkout_capability5 = __esm({
159219
159520
  init_src();
159220
159521
  import_debug24 = __toESM(require_src(), 1);
159221
159522
  init_zod();
159523
+ init_client6();
159222
159524
  init_medusa_helpers();
159223
159525
  debug24 = (0, import_debug24.default)("reactionary:medusa:checkout");
159224
159526
  CheckoutNotReadyForFinalizationError3 = class extends Error {
@@ -159247,7 +159549,17 @@ var init_checkout_capability5 = __esm({
159247
159549
  *
159248
159550
  * example: this.includedFields = [includedFields, '+discounts.*'].join(',');
159249
159551
  */
159250
- includedFields = ["+items.*", "+order.id", "+order.display_id", "+order.custom_display_id"].join(",");
159552
+ includedFields = ["+items.*", "+order.id", "+order.display_id", "+order.custom_display_id", "+shipping_methods.data"].join(",");
159553
+ /**
159554
+ * This controls which fields are requested for the cart's shipping options.
159555
+ * You can override this in a subclass to add more fields as needed.
159556
+ *
159557
+ * The service zone's fulfillment set tells us whether an option is in-store
159558
+ * pickup (BOPIS) or a delivery, and the option data is the fulfillment
159559
+ * provider's payload (e.g. nShift option/carrier ids) that is mapped to the
159560
+ * shipping method's protocolData.
159561
+ */
159562
+ shippingOptionFields = ["*service_zone.fulfillment_set", "+data"].join(",");
159251
159563
  initiateCheckoutForCartPayload(payload) {
159252
159564
  return {
159253
159565
  billing_address: payload.billingAddress ? this.mapAddressToStoreAddress(payload.billingAddress) : void 0,
@@ -159280,7 +159592,9 @@ var init_checkout_capability5 = __esm({
159280
159592
  const response = await client.store.cart.retrieve(payload.identifier.key, {
159281
159593
  fields: this.includedFields
159282
159594
  });
159283
- return success(this.factory.parseCheckout(this.context, response.cart));
159595
+ return success(
159596
+ this.hydrateResultingOrder(this.factory.parseCheckout(this.context, response.cart))
159597
+ );
159284
159598
  } catch (err) {
159285
159599
  if (isNotFoundFetchError(err)) {
159286
159600
  return error2({
@@ -159309,7 +159623,8 @@ var init_checkout_capability5 = __esm({
159309
159623
  }
159310
159624
  getAvailableShippingMethodsPayload(payload) {
159311
159625
  return {
159312
- cart_id: payload.checkout.key
159626
+ cart_id: payload.checkout.key,
159627
+ fields: this.shippingOptionFields
159313
159628
  };
159314
159629
  }
159315
159630
  /**
@@ -159438,10 +159753,10 @@ var init_checkout_capability5 = __esm({
159438
159753
  }
159439
159754
  );
159440
159755
  return success(this.factory.parseCheckout(this.context, updatedCartResponse.cart));
159441
- } catch (error6) {
159442
- debug24("Failed to add payment instruction: {0}", [error6]);
159756
+ } catch (error5) {
159757
+ debug24("Failed to add payment instruction: {0}", [error5]);
159443
159758
  throw new Error(
159444
- `Failed to add payment instruction: ${error6 instanceof Error ? error6.message : "Unknown error"}`
159759
+ `Failed to add payment instruction: ${error5 instanceof Error ? error5.message : "Unknown error"}`
159445
159760
  );
159446
159761
  }
159447
159762
  }
@@ -159449,14 +159764,65 @@ var init_checkout_capability5 = __esm({
159449
159764
  throw new Error("Method not implemented.");
159450
159765
  }
159451
159766
  setShippingInstructionPayload(payload) {
159767
+ const data = {
159768
+ consent_for_unattended_delivery: payload.shippingInstruction.consentForUnattendedDelivery + "",
159769
+ instructions: payload.shippingInstruction.instructions || ""
159770
+ };
159771
+ for (const entry of payload.shippingInstruction.protocolData ?? []) {
159772
+ data[entry.key] = entry.value;
159773
+ }
159774
+ if (payload.shippingInstruction.pickupPoint) {
159775
+ data["pickup_point"] = payload.shippingInstruction.pickupPoint;
159776
+ }
159452
159777
  return {
159453
159778
  option_id: payload.shippingInstruction.shippingMethod.key,
159454
- data: {
159455
- consent_for_unattended_delivery: payload.shippingInstruction.consentForUnattendedDelivery + "",
159456
- instructions: payload.shippingInstruction.instructions || ""
159457
- }
159779
+ data
159458
159780
  };
159459
159781
  }
159782
+ /**
159783
+ * Serializes the client-set shipping protocol data as a JSON object string
159784
+ * for persistence in the cart metadata, or undefined when none is set.
159785
+ */
159786
+ serializeShippingProtocolData(protocolData) {
159787
+ if (!protocolData || protocolData.length === 0) {
159788
+ return void 0;
159789
+ }
159790
+ return JSON.stringify(
159791
+ Object.fromEntries(protocolData.map((entry) => [entry.key, entry.value]))
159792
+ );
159793
+ }
159794
+ /**
159795
+ * Resolves the shipping address to use for in-store pickup (BOPIS): the
159796
+ * address of the selected store, so the order ships to the store. Returns
159797
+ * undefined when the store or its address is unknown, leaving the cart's
159798
+ * shipping address untouched.
159799
+ */
159800
+ async resolveStorePickupAddress(store) {
159801
+ try {
159802
+ const adminClient = await new MedusaAdminAPI(this.config, this.context).getClient();
159803
+ const response = await adminClient.admin.stockLocation.retrieve(store.key, {
159804
+ fields: "*address"
159805
+ });
159806
+ const address = response.stock_location?.address;
159807
+ if (!address) {
159808
+ return void 0;
159809
+ }
159810
+ return {
159811
+ firstName: "",
159812
+ lastName: response.stock_location.name,
159813
+ streetAddress: address.address_1 || "",
159814
+ streetNumber: address.address_2 || "",
159815
+ city: address.city || "",
159816
+ postalCode: address.postal_code || "",
159817
+ countryCode: address.country_code || ""
159818
+ };
159819
+ } catch (err) {
159820
+ if (debug24.enabled) {
159821
+ debug24(`Unable to resolve address for pickup store ${store.key}`, err);
159822
+ }
159823
+ return void 0;
159824
+ }
159825
+ }
159460
159826
  async setShippingInstruction(payload) {
159461
159827
  const client = await this.medusaApi.getClient();
159462
159828
  const medusaId = payload.checkout;
@@ -159464,13 +159830,22 @@ var init_checkout_capability5 = __esm({
159464
159830
  if (payload.shippingInstruction.shippingMethod) {
159465
159831
  await client.store.cart.addShippingMethod(medusaId.key, this.setShippingInstructionPayload(payload));
159466
159832
  }
159467
- await client.store.cart.update(medusaId.key, {
159833
+ const cartUpdate = {
159468
159834
  metadata: {
159469
159835
  consent_for_unattended_delivery: payload.shippingInstruction.consentForUnattendedDelivery + "",
159470
159836
  instructions: payload.shippingInstruction.instructions || "",
159471
- pickup_point: payload.shippingInstruction.pickupPoint || ""
159837
+ pickup_point: payload.shippingInstruction.pickupPoint || "",
159838
+ pickup_store: payload.shippingInstruction.store?.key || "",
159839
+ shipping_protocol_data: this.serializeShippingProtocolData(payload.shippingInstruction.protocolData) || ""
159472
159840
  }
159473
- });
159841
+ };
159842
+ if (payload.shippingInstruction.store?.key) {
159843
+ const storeAddress = await this.resolveStorePickupAddress(payload.shippingInstruction.store);
159844
+ if (storeAddress) {
159845
+ cartUpdate.shipping_address = this.mapAddressToStoreAddress(storeAddress);
159846
+ }
159847
+ }
159848
+ await client.store.cart.update(medusaId.key, cartUpdate);
159474
159849
  const response = await client.store.cart.retrieve(medusaId.key, {
159475
159850
  fields: this.includedFields
159476
159851
  });
@@ -159478,8 +159853,8 @@ var init_checkout_capability5 = __esm({
159478
159853
  return success(this.factory.parseCheckout(this.context, response.cart));
159479
159854
  }
159480
159855
  throw new Error("Failed to set shipping method");
159481
- } catch (error6) {
159482
- handleProviderError("set shipping method", error6);
159856
+ } catch (error5) {
159857
+ handleProviderError("set shipping method", error5);
159483
159858
  }
159484
159859
  }
159485
159860
  async finalizeCheckout(payload) {
@@ -159493,14 +159868,24 @@ var init_checkout_capability5 = __esm({
159493
159868
  if (!checkout.value.resultingOrder) {
159494
159869
  const client = await this.medusaApi.getClient();
159495
159870
  const medusaId = payload.checkout;
159871
+ await client.store.cart.update(medusaId.key, {
159872
+ metadata: {
159873
+ cart_id: medusaId.key
159874
+ }
159875
+ });
159496
159876
  const response = await client.store.cart.complete(medusaId.key);
159497
159877
  if (response.type === "order") {
159878
+ const resultingOrder = this.parseCompletedOrderIdentifier(response.order);
159879
+ this.rememberFinalizedOrder(medusaId.key, resultingOrder);
159498
159880
  checkout = await this.getById({
159499
159881
  identifier: payload.checkout
159500
159882
  });
159501
159883
  if (!checkout.success) {
159502
159884
  throw new Error(`Unable to reload checkout ${payload.checkout.key} after completion`);
159503
159885
  }
159886
+ if (!checkout.value.resultingOrder) {
159887
+ checkout = success({ ...checkout.value, resultingOrder });
159888
+ }
159504
159889
  } else {
159505
159890
  throw new Error(`Failed to finalize checkout ${payload.checkout.key}. Expected order, got ${response.type}`);
159506
159891
  }
@@ -159520,6 +159905,48 @@ var init_checkout_capability5 = __esm({
159520
159905
  }
159521
159906
  return success(checkout.value);
159522
159907
  }
159908
+ /**
159909
+ * Builds the order identifier from a completed-cart response's order,
159910
+ * following the same display-id precedence as the checkout factory
159911
+ * (custom_display_id over display_id).
159912
+ */
159913
+ parseCompletedOrderIdentifier(order) {
159914
+ const rawDisplayId = order.custom_display_id ?? order.display_id;
159915
+ const displayId = rawDisplayId != null ? Number(`${rawDisplayId}`) : void 0;
159916
+ return {
159917
+ key: order.id,
159918
+ display_id: displayId != null && Number.isFinite(displayId) ? displayId : void 0
159919
+ };
159920
+ }
159921
+ /**
159922
+ * Remembers which order a finalized cart produced, so later checkout reads
159923
+ * in the same session can report the resulting order even when the Medusa
159924
+ * store cart endpoint does not expose the cart->order relation.
159925
+ */
159926
+ rememberFinalizedOrder(cartKey, order) {
159927
+ const sessionData = this.medusaApi.getSessionData();
159928
+ this.medusaApi.setSessionData({
159929
+ finalizedOrders: {
159930
+ ...sessionData.finalizedOrders || {},
159931
+ [cartKey]: order
159932
+ }
159933
+ });
159934
+ }
159935
+ /**
159936
+ * Fills in a missing resultingOrder from the session's finalized-orders map.
159937
+ * Checkouts that already carry a resulting order (older Medusa versions
159938
+ * still hydrate the +order.* fields) are returned unchanged.
159939
+ */
159940
+ hydrateResultingOrder(checkout) {
159941
+ if (checkout.resultingOrder) {
159942
+ return checkout;
159943
+ }
159944
+ const remembered = this.medusaApi.getSessionData().finalizedOrders?.[checkout.identifier.key];
159945
+ if (!remembered) {
159946
+ return checkout;
159947
+ }
159948
+ return { ...checkout, resultingOrder: remembered };
159949
+ }
159523
159950
  /**
159524
159951
  * Extension point to map an Address to a Store Address
159525
159952
  * @param address
@@ -160523,8 +160950,8 @@ var init_identity_capability5 = __esm({
160523
160950
  const identity = this.createAnonymousIdentity();
160524
160951
  this.updateIdentityContext(identity);
160525
160952
  return success(identity);
160526
- } catch (error6) {
160527
- debug29("getSelf failed, returning anonymous identity:", error6);
160953
+ } catch (error5) {
160954
+ debug29("getSelf failed, returning anonymous identity:", error5);
160528
160955
  const identity = this.createAnonymousIdentity();
160529
160956
  this.updateIdentityContext(identity);
160530
160957
  return success(identity);
@@ -160861,10 +161288,10 @@ var init_price_capability5 = __esm({
160861
161288
  return this.createEmptyPriceResult(sku);
160862
161289
  }
160863
161290
  return this.factory.parsePrice(this.context, { variant, mode });
160864
- } catch (error6) {
161291
+ } catch (error5) {
160865
161292
  if (debug33.enabled) {
160866
161293
  debug33(
160867
- `Error fetching price for SKU ${sku}: ${error6.message}`
161294
+ `Error fetching price for SKU ${sku}: ${error5.message}`
160868
161295
  );
160869
161296
  }
160870
161297
  return this.createEmptyPriceResult(sku);
@@ -160925,9 +161352,9 @@ var init_product_search_capability6 = __esm({
160925
161352
  break;
160926
161353
  }
160927
161354
  offset += limit;
160928
- } catch (error6) {
161355
+ } catch (error5) {
160929
161356
  throw new Error(
160930
- "Category not found " + externalId + " due to error: " + error6
161357
+ "Category not found " + externalId + " due to error: " + error5
160931
161358
  );
160932
161359
  break;
160933
161360
  }
@@ -161112,11 +161539,11 @@ var init_product_recommendations_capability4 = __esm({
161112
161539
  debug35(`Returning ${recommendations.length} recommendations`);
161113
161540
  }
161114
161541
  return success(recommendations);
161115
- } catch (error6) {
161542
+ } catch (error5) {
161116
161543
  if (debug35.enabled) {
161117
- debug35(`Error fetching collection recommendations: %O`, error6);
161544
+ debug35(`Error fetching collection recommendations: %O`, error5);
161118
161545
  }
161119
- console.error("Error fetching collection recommendations:", error6);
161546
+ console.error("Error fetching collection recommendations:", error5);
161120
161547
  return success([]);
161121
161548
  }
161122
161549
  }
@@ -161730,6 +162157,173 @@ var init_personalization_profile_capability4 = __esm({
161730
162157
  }
161731
162158
  });
161732
162159
 
162160
+ // packages/medusa/src/utils/geo.ts
162161
+ function haversineDistanceKm(latitude1, longitude1, latitude2, longitude2) {
162162
+ const toRadians = (degrees) => degrees * Math.PI / 180;
162163
+ const deltaLatitude = toRadians(latitude2 - latitude1);
162164
+ const deltaLongitude = toRadians(longitude2 - longitude1);
162165
+ const a3 = Math.sin(deltaLatitude / 2) ** 2 + Math.cos(toRadians(latitude1)) * Math.cos(toRadians(latitude2)) * Math.sin(deltaLongitude / 2) ** 2;
162166
+ return 2 * EARTH_RADIUS_KM * Math.asin(Math.sqrt(a3));
162167
+ }
162168
+ var EARTH_RADIUS_KM;
162169
+ var init_geo = __esm({
162170
+ "packages/medusa/src/utils/geo.ts"() {
162171
+ "use strict";
162172
+ EARTH_RADIUS_KM = 6371;
162173
+ }
162174
+ });
162175
+
162176
+ // packages/medusa/src/capabilities/store.capability.ts
162177
+ var import_debug39, debug39, MedusaStoreCapability;
162178
+ var init_store_capability4 = __esm({
162179
+ "packages/medusa/src/capabilities/store.capability.ts"() {
162180
+ "use strict";
162181
+ init_src();
162182
+ import_debug39 = __toESM(require_src(), 1);
162183
+ init_zod();
162184
+ init_client6();
162185
+ init_geo();
162186
+ debug39 = (0, import_debug39.default)("reactionary:medusa:store");
162187
+ MedusaStoreCapability = class extends StoreCapability {
162188
+ constructor(config3, cache, context2, medusaApi, factory) {
162189
+ super(cache, context2);
162190
+ this.medusaApi = medusaApi;
162191
+ this.config = config3;
162192
+ this.factory = factory;
162193
+ }
162194
+ medusaApi;
162195
+ config;
162196
+ factory;
162197
+ /**
162198
+ * The fields requested for stock locations. Override in a subclass if a
162199
+ * project needs more relations.
162200
+ */
162201
+ stockLocationFields = "*address,*fulfillment_sets";
162202
+ /**
162203
+ * Whether a stock location is a store customers can pick up orders from,
162204
+ * i.e. it has a fulfillment set of type "pickup".
162205
+ */
162206
+ isPickupLocation(location) {
162207
+ return (location.fulfillment_sets || []).some((set) => set.type === "pickup");
162208
+ }
162209
+ /**
162210
+ * Fetches all stock locations that are pickup stores. Medusa installations
162211
+ * have a small, bounded number of stock locations, so fetching them all and
162212
+ * filtering client-side is acceptable.
162213
+ */
162214
+ async fetchPickupLocations() {
162215
+ const adminClient = await new MedusaAdminAPI(this.config, this.context).getClient();
162216
+ const pageSize = 200;
162217
+ let offset = 0;
162218
+ const locations = [];
162219
+ for (; ; ) {
162220
+ const response = await adminClient.admin.stockLocation.list({
162221
+ fields: this.stockLocationFields,
162222
+ limit: pageSize,
162223
+ offset
162224
+ });
162225
+ locations.push(...response.stock_locations || []);
162226
+ offset += pageSize;
162227
+ if (offset >= response.count || (response.stock_locations || []).length === 0) {
162228
+ break;
162229
+ }
162230
+ }
162231
+ return locations.filter((location) => this.isPickupLocation(location));
162232
+ }
162233
+ async list(payload) {
162234
+ const pickupLocations = await this.fetchPickupLocations();
162235
+ if (debug39.enabled) {
162236
+ debug39(`Found ${pickupLocations.length} pickup stock locations`);
162237
+ }
162238
+ const { pageNumber, pageSize } = payload.paginationOptions;
162239
+ const startIndex = (pageNumber - 1) * pageSize;
162240
+ const pagedLocations = pickupLocations.slice(startIndex, startIndex + pageSize);
162241
+ return success({
162242
+ pageNumber,
162243
+ pageSize,
162244
+ totalCount: pickupLocations.length,
162245
+ totalPages: Math.ceil(pickupLocations.length / pageSize),
162246
+ items: pagedLocations.map(
162247
+ (location) => this.factory.parseStore(this.context, location)
162248
+ )
162249
+ });
162250
+ }
162251
+ async getById(payload) {
162252
+ const adminClient = await new MedusaAdminAPI(this.config, this.context).getClient();
162253
+ try {
162254
+ const response = await adminClient.admin.stockLocation.retrieve(payload.identifier.key, {
162255
+ fields: this.stockLocationFields
162256
+ });
162257
+ if (!response.stock_location || !this.isPickupLocation(response.stock_location)) {
162258
+ return error2({ type: "NotFound", identifier: payload.identifier });
162259
+ }
162260
+ return success(this.factory.parseStore(this.context, response.stock_location));
162261
+ } catch (err) {
162262
+ if (debug39.enabled) {
162263
+ debug39(`Error fetching stock location ${payload.identifier.key}`, err);
162264
+ }
162265
+ return error2({ type: "NotFound", identifier: payload.identifier });
162266
+ }
162267
+ }
162268
+ /**
162269
+ * Extension point resolving a stock location's geo coordinates. Medusa
162270
+ * stock locations carry no first-class coordinates, so by default they are
162271
+ * read from the location metadata keys `latitude` and `longitude`. Returns
162272
+ * undefined when the location has no usable coordinates.
162273
+ */
162274
+ parseLocationCoordinates(location) {
162275
+ const latitude = Number(location.metadata?.["latitude"]);
162276
+ const longitude = Number(location.metadata?.["longitude"]);
162277
+ if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) {
162278
+ return void 0;
162279
+ }
162280
+ return { latitude, longitude };
162281
+ }
162282
+ async queryByProximity(payload) {
162283
+ const pickupLocations = await this.fetchPickupLocations();
162284
+ const withinDistance = [];
162285
+ for (const location of pickupLocations) {
162286
+ const coordinates = this.parseLocationCoordinates(location);
162287
+ if (!coordinates) {
162288
+ continue;
162289
+ }
162290
+ const distance = haversineDistanceKm(
162291
+ payload.latitude,
162292
+ payload.longitude,
162293
+ coordinates.latitude,
162294
+ coordinates.longitude
162295
+ );
162296
+ if (distance <= payload.distance) {
162297
+ withinDistance.push({ location, distance });
162298
+ }
162299
+ }
162300
+ withinDistance.sort((a3, b3) => a3.distance - b3.distance);
162301
+ return success(
162302
+ withinDistance.slice(0, payload.limit).map((entry) => this.factory.parseStore(this.context, entry.location))
162303
+ );
162304
+ }
162305
+ };
162306
+ __decorateClass([
162307
+ Reactionary({
162308
+ inputSchema: StoreQueryForListSchema,
162309
+ outputSchema: StorePaginatedResultSchema
162310
+ })
162311
+ ], MedusaStoreCapability.prototype, "list", 1);
162312
+ __decorateClass([
162313
+ Reactionary({
162314
+ inputSchema: StoreQueryByIdSchema,
162315
+ outputSchema: StoreSchema
162316
+ })
162317
+ ], MedusaStoreCapability.prototype, "getById", 1);
162318
+ __decorateClass([
162319
+ Reactionary({
162320
+ inputSchema: StoreQueryByProximitySchema,
162321
+ outputSchema: array(StoreSchema)
162322
+ })
162323
+ ], MedusaStoreCapability.prototype, "queryByProximity", 1);
162324
+ }
162325
+ });
162326
+
161733
162327
  // packages/medusa/src/factories/cart/cart.factory.ts
161734
162328
  var MedusaCartFactory;
161735
162329
  var init_cart_factory5 = __esm({
@@ -162062,15 +162656,23 @@ var init_checkout_factory5 = __esm({
162062
162656
  const backupUnattendedDelivery = data.metadata?.["consent_for_unattended_delivery"] !== void 0 ? data.metadata?.["consent_for_unattended_delivery"] === "true" : void 0;
162063
162657
  const backupInstructions = data.metadata?.["instructions"] != null ? String(data.metadata["instructions"]) : void 0;
162064
162658
  const backupPickupPoint = data.metadata?.["pickup_point"] != null ? String(data.metadata["pickup_point"]) : void 0;
162659
+ const backupPickupStore = data.metadata?.["pickup_store"] != null && data.metadata["pickup_store"] !== "" ? String(data.metadata["pickup_store"]) : void 0;
162660
+ const backupShippingProtocolData = this.parseShippingProtocolData(
162661
+ data.metadata?.["shipping_protocol_data"]
162662
+ );
162065
162663
  let shippingInstruction;
162066
162664
  data.shipping_methods?.forEach((sm) => {
162067
162665
  let pickupPoint = "";
162068
162666
  let instructions = "";
162069
162667
  let consentForUnattendedDelivery = false;
162668
+ let pickupStore;
162669
+ let protocolData;
162070
162670
  if (sm.data) {
162071
162671
  pickupPoint = sm.data["pickup_point"] != null ? String(sm.data["pickup_point"]) : "";
162072
162672
  instructions = sm.data["instructions"] != null ? String(sm.data["instructions"]) : "";
162073
162673
  consentForUnattendedDelivery = sm.data["consent_for_unattended_delivery"] === "true";
162674
+ pickupStore = sm.data["pickup_store"] != null && sm.data["pickup_store"] !== "" ? String(sm.data["pickup_store"]) : void 0;
162675
+ protocolData = this.parseInstructionProtocolData(sm.data);
162074
162676
  }
162075
162677
  if (!pickupPoint) {
162076
162678
  pickupPoint = backupPickupPoint || "";
@@ -162081,11 +162683,19 @@ var init_checkout_factory5 = __esm({
162081
162683
  if (!consentForUnattendedDelivery) {
162082
162684
  consentForUnattendedDelivery = backupUnattendedDelivery || false;
162083
162685
  }
162686
+ if (!pickupStore) {
162687
+ pickupStore = backupPickupStore;
162688
+ }
162689
+ if (!protocolData) {
162690
+ protocolData = backupShippingProtocolData;
162691
+ }
162084
162692
  shippingInstruction = {
162085
- shippingMethod: { key: sm.shipping_option_id },
162693
+ shippingMethod: { key: sm.shipping_option_id || "" },
162086
162694
  consentForUnattendedDelivery,
162087
162695
  instructions,
162088
- pickupPoint
162696
+ pickupPoint,
162697
+ store: pickupStore ? { key: pickupStore } : void 0,
162698
+ protocolData
162089
162699
  };
162090
162700
  });
162091
162701
  const paymentInstructions = new Array();
@@ -162149,10 +162759,164 @@ var init_checkout_factory5 = __esm({
162149
162759
  value: data.calculated_price.calculated_amount || 0,
162150
162760
  currency: data.calculated_price.currency_code?.toUpperCase() || _context.languageContext.currencyCode
162151
162761
  }),
162152
- deliveryTime: ""
162762
+ deliveryTime: "",
162763
+ carrier: this.parseShippingMethodCarrier(_context, data),
162764
+ fulfillmentType: this.parseFulfillmentType(_context, data),
162765
+ protocolData: this.mergeShippingMethodProtocolData(
162766
+ this.parseShippingMethodProtocolData(_context, data),
162767
+ this.parseShippingMethodStoreReference(_context, data)
162768
+ )
162153
162769
  };
162154
162770
  return this.shippingMethodSchema.parse(sm);
162155
162771
  }
162772
+ /**
162773
+ * Appends a conventional entry to the provider-derived protocol data,
162774
+ * unless the provider data already carries the same key (explicit provider
162775
+ * data wins).
162776
+ */
162777
+ mergeShippingMethodProtocolData(protocolData, entry) {
162778
+ if (!entry) {
162779
+ return protocolData;
162780
+ }
162781
+ if ((protocolData ?? []).some((existing) => existing.key === entry.key)) {
162782
+ return protocolData;
162783
+ }
162784
+ return [...protocolData ?? [], entry];
162785
+ }
162786
+ /**
162787
+ * Extension point emitting the conventional "pickup_store" protocol data
162788
+ * entry for in-store pickup options: the stock location id of the service
162789
+ * zone's fulfillment set, which equals the store capability's
162790
+ * Store.identifier.key. Delivery options also carry a location (the
162791
+ * warehouse), so the entry is emitted for pickup options only.
162792
+ */
162793
+ parseShippingMethodStoreReference(_context, data) {
162794
+ if (this.parseFulfillmentType(_context, data) !== "pickup") {
162795
+ return void 0;
162796
+ }
162797
+ const locationId = data.service_zone?.fulfillment_set?.location?.id;
162798
+ if (!locationId) {
162799
+ return void 0;
162800
+ }
162801
+ return { key: SHIPPING_PROTOCOL_DATA_KEYS.pickupStore, value: locationId };
162802
+ }
162803
+ /**
162804
+ * Extension point to control how a Medusa shipping option maps to the core
162805
+ * fulfillment type. A shipping option belonging to a fulfillment set of type
162806
+ * "pickup" is in-store pickup (BOPIS); everything else is a delivery.
162807
+ */
162808
+ parseFulfillmentType(_context, data) {
162809
+ return data.service_zone?.fulfillment_set?.type === "pickup" ? "pickup" : "delivery";
162810
+ }
162811
+ /**
162812
+ * Extension point mapping a Medusa shipping option's `data` - the payload
162813
+ * the fulfillment provider works with (e.g. nShift's option/carrier ids) -
162814
+ * to the shipping method's protocolData, so provider-protocol data reaches
162815
+ * the client. String and JSON-object values are kept as-is, other
162816
+ * primitives are stringified, and arrays/null entries are skipped.
162817
+ *
162818
+ * Option `metadata` is deliberately NOT mapped: it is merchant free-form
162819
+ * annotation, not protocol data. Override this hook to surface it.
162820
+ */
162821
+ parseShippingMethodProtocolData(_context, data) {
162822
+ if (!data.data) {
162823
+ return void 0;
162824
+ }
162825
+ const entries = this.convertToProtocolDataEntries(data.data);
162826
+ return entries.length > 0 ? entries : void 0;
162827
+ }
162828
+ /**
162829
+ * Converts a Medusa key-value record into protocol data entries: string and
162830
+ * JSON-object values are kept as-is, other primitives are stringified, and
162831
+ * arrays/null entries are skipped. Keys listed in skipKeys are left out.
162832
+ */
162833
+ convertToProtocolDataEntries(record2, skipKeys = []) {
162834
+ const entries = [];
162835
+ for (const [key, value] of Object.entries(record2)) {
162836
+ if (skipKeys.includes(key)) {
162837
+ continue;
162838
+ }
162839
+ if (typeof value === "string") {
162840
+ entries.push({ key, value });
162841
+ } else if (typeof value === "number" || typeof value === "boolean") {
162842
+ entries.push({ key, value: String(value) });
162843
+ } else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
162844
+ entries.push({ key, value });
162845
+ }
162846
+ }
162847
+ return entries;
162848
+ }
162849
+ /**
162850
+ * Extension point resolving the carrier of a shipping option from its
162851
+ * provider data (e.g. nShift's carrier_id), when present.
162852
+ */
162853
+ parseShippingMethodCarrier(_context, data) {
162854
+ const carrierId = data.data?.["carrier_id"];
162855
+ return typeof carrierId === "string" && carrierId.length > 0 ? carrierId : void 0;
162856
+ }
162857
+ /**
162858
+ * The persisted shipping method data keys that are NOT surfaced as
162859
+ * instruction protocol data: keys already represented as first-class
162860
+ * instruction fields, the legacy JSON blob, and provider-side values that
162861
+ * would mislead (nShift's data.price is not the charged amount).
162862
+ */
162863
+ instructionProtocolDataSkipKeys = [
162864
+ "pickup_store",
162865
+ "pickup_point",
162866
+ "instructions",
162867
+ "consent_for_unattended_delivery",
162868
+ "shipping_protocol_data",
162869
+ "price",
162870
+ "currency_code"
162871
+ ];
162872
+ /**
162873
+ * Builds the shipping instruction's protocolData from the persisted
162874
+ * shipping method data: the provider payload enriched by the backend (e.g.
162875
+ * nShift's session_id, carrier ids and optional delivery_time) merged with
162876
+ * whatever the client sent when setting the instruction. First-class and
162877
+ * misleading keys are skipped; the legacy shipping_protocol_data JSON blob
162878
+ * still contributes entries whose keys are not already present.
162879
+ */
162880
+ parseInstructionProtocolData(smData) {
162881
+ const entries = this.convertToProtocolDataEntries(
162882
+ smData,
162883
+ this.instructionProtocolDataSkipKeys
162884
+ );
162885
+ for (const legacyEntry of this.parseShippingProtocolData(smData["shipping_protocol_data"]) ?? []) {
162886
+ if (!entries.some((entry) => entry.key === legacyEntry.key)) {
162887
+ entries.push(legacyEntry);
162888
+ }
162889
+ }
162890
+ return entries.length > 0 ? entries : void 0;
162891
+ }
162892
+ /**
162893
+ * Parses shipping protocol data persisted as a JSON object string (keys
162894
+ * mapping to string or JSON-object values) back into protocol data entries.
162895
+ * Returns undefined when nothing (valid) is stored, keeping the field absent
162896
+ * for carts that never set it.
162897
+ */
162898
+ parseShippingProtocolData(raw) {
162899
+ if (typeof raw !== "string" || raw.length === 0) {
162900
+ return void 0;
162901
+ }
162902
+ try {
162903
+ const parsed = JSON.parse(raw);
162904
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
162905
+ return void 0;
162906
+ }
162907
+ const entries = [];
162908
+ for (const [key, value] of Object.entries(parsed)) {
162909
+ if (typeof value === "string") {
162910
+ entries.push({ key, value });
162911
+ } else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
162912
+ entries.push({ key, value });
162913
+ }
162914
+ }
162915
+ return entries.length > 0 ? entries : void 0;
162916
+ } catch {
162917
+ return void 0;
162918
+ }
162919
+ }
162156
162920
  parsePaymentInstruction(_context, remotePayment, checkout) {
162157
162921
  const mainSession = (remotePayment.payment_sessions || []).find(
162158
162922
  (session) => session.status !== "canceled" && session.status !== "error"
@@ -162735,15 +163499,15 @@ var init_price_factory5 = __esm({
162735
163499
  });
162736
163500
 
162737
163501
  // packages/medusa/src/factories/product/product.factory.ts
162738
- var import_debug39, debug39, MedusaProductFactory;
163502
+ var import_debug40, debug40, MedusaProductFactory;
162739
163503
  var init_product_factory5 = __esm({
162740
163504
  "packages/medusa/src/factories/product/product.factory.ts"() {
162741
163505
  "use strict";
162742
163506
  init_src();
162743
- import_debug39 = __toESM(require_src(), 1);
163507
+ import_debug40 = __toESM(require_src(), 1);
162744
163508
  init_medusa_helpers();
162745
163509
  init_product_compliance();
162746
- debug39 = (0, import_debug39.default)("reactionary:medusa:product");
163510
+ debug40 = (0, import_debug40.default)("reactionary:medusa:product");
162747
163511
  MedusaProductFactory = class {
162748
163512
  productSchema;
162749
163513
  constructor(productSchema) {
@@ -162912,7 +163676,7 @@ var init_product_factory5 = __esm({
162912
163676
  const sharedAttributes = this.parseAttributes(context2, data);
162913
163677
  const complianceData = this.parseComplianceData(context2, data);
162914
163678
  if (!data.variants) {
162915
- debug39("Product has no variants", data);
163679
+ debug40("Product has no variants", data);
162916
163680
  throw new Error("Product has no variants " + data.external_id);
162917
163681
  }
162918
163682
  const mainVariant = this.parseVariant(context2, data.variants[0], data);
@@ -163156,6 +163920,60 @@ var init_personalization_profile_factory4 = __esm({
163156
163920
  }
163157
163921
  });
163158
163922
 
163923
+ // packages/medusa/src/factories/store/store.factory.ts
163924
+ var MedusaStoreFactory;
163925
+ var init_store_factory4 = __esm({
163926
+ "packages/medusa/src/factories/store/store.factory.ts"() {
163927
+ "use strict";
163928
+ init_src();
163929
+ MedusaStoreFactory = class {
163930
+ storeSchema;
163931
+ constructor(storeSchema) {
163932
+ this.storeSchema = storeSchema;
163933
+ }
163934
+ /**
163935
+ * Extension point to control the parsing of the stock location address
163936
+ * into the store's address.
163937
+ */
163938
+ parseAddress(_context, data) {
163939
+ if (!data.address) {
163940
+ return void 0;
163941
+ }
163942
+ return {
163943
+ identifier: AddressIdentifierSchema.parse({
163944
+ nickName: data.address.id
163945
+ }),
163946
+ firstName: "",
163947
+ lastName: data.address.company || data.name,
163948
+ streetAddress: data.address.address_1 || "",
163949
+ streetNumber: data.address.address_2 || "",
163950
+ city: data.address.city || "",
163951
+ region: data.address.province || "",
163952
+ postalCode: data.address.postal_code || "",
163953
+ countryCode: data.address.country_code || ""
163954
+ };
163955
+ }
163956
+ parseStore(context2, data) {
163957
+ const identifier = {
163958
+ key: data.id
163959
+ };
163960
+ const fulfillmentCenter = {
163961
+ key: data.name
163962
+ };
163963
+ const openingHours = data.metadata?.["opening_hours"] != null ? String(data.metadata["opening_hours"]) : void 0;
163964
+ const result = {
163965
+ identifier,
163966
+ name: data.name,
163967
+ fulfillmentCenter,
163968
+ address: this.parseAddress(context2, data),
163969
+ openingHours
163970
+ };
163971
+ return this.storeSchema.parse(result);
163972
+ }
163973
+ };
163974
+ }
163975
+ });
163976
+
163159
163977
  // packages/medusa/src/factories/index.ts
163160
163978
  var init_factories5 = __esm({
163161
163979
  "packages/medusa/src/factories/index.ts"() {
@@ -163177,6 +163995,7 @@ var init_factories5 = __esm({
163177
163995
  init_product_search_factory6();
163178
163996
  init_profile_factory5();
163179
163997
  init_personalization_profile_factory4();
163998
+ init_store_factory4();
163180
163999
  }
163181
164000
  });
163182
164001
 
@@ -163499,6 +164318,22 @@ function withMedusaCapabilities(configuration, capabilities) {
163499
164318
  buildCapabilityArgs
163500
164319
  );
163501
164320
  }
164321
+ if (caps.store?.enabled) {
164322
+ client.store = resolveCapabilityWithFactory5(
164323
+ capabilities.store,
164324
+ {
164325
+ factory: new MedusaStoreFactory(StoreSchema),
164326
+ capability: (args) => new MedusaStoreCapability(
164327
+ args.config,
164328
+ args.cache,
164329
+ args.context,
164330
+ args.medusaApi,
164331
+ args.factory
164332
+ )
164333
+ },
164334
+ buildCapabilityArgs
164335
+ );
164336
+ }
163502
164337
  if (caps.personalizationProfile?.enabled) {
163503
164338
  client.personalizationProfile = resolveCapabilityWithFactory5(
163504
164339
  capabilities.personalizationProfile,
@@ -163540,6 +164375,7 @@ var init_initialize5 = __esm({
163540
164375
  init_product_associations_capability5();
163541
164376
  init_profile_capability5();
163542
164377
  init_personalization_profile_capability4();
164378
+ init_store_capability4();
163543
164379
  init_capabilities_schema6();
163544
164380
  init_configuration_schema5();
163545
164381
  init_client6();
@@ -163577,6 +164413,7 @@ var init_src6 = __esm({
163577
164413
  init_checkout_capability5();
163578
164414
  init_product_capability5();
163579
164415
  init_personalization_profile_capability4();
164416
+ init_store_capability4();
163580
164417
  }
163581
164418
  });
163582
164419
 
@@ -164997,8 +165834,8 @@ var init_product_recommendations_capability5 = __esm({
164997
165834
  try {
164998
165835
  const response = await index.searchSimilarDocuments(this.getSimilarProductsRecommendationsPayload(query));
164999
165836
  return this.parseRecommendations(response, "similar");
165000
- } catch (error6) {
165001
- console.error("Error fetching similar product recommendations:", error6);
165837
+ } catch (error5) {
165838
+ console.error("Error fetching similar product recommendations:", error5);
165002
165839
  return [];
165003
165840
  }
165004
165841
  }
@@ -165464,9 +166301,9 @@ var require_main = __commonJS({
165464
166301
  const attrs = _instructions(result, key);
165465
166302
  decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
165466
166303
  break;
165467
- } catch (error6) {
166304
+ } catch (error5) {
165468
166305
  if (i3 + 1 >= length) {
165469
- throw error6;
166306
+ throw error5;
165470
166307
  }
165471
166308
  }
165472
166309
  }
@@ -165494,13 +166331,13 @@ var require_main = __commonJS({
165494
166331
  let uri;
165495
166332
  try {
165496
166333
  uri = new URL(dotenvKey);
165497
- } catch (error6) {
165498
- if (error6.code === "ERR_INVALID_URL") {
166334
+ } catch (error5) {
166335
+ if (error5.code === "ERR_INVALID_URL") {
165499
166336
  const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
165500
166337
  err.code = "INVALID_DOTENV_KEY";
165501
166338
  throw err;
165502
166339
  }
165503
- throw error6;
166340
+ throw error5;
165504
166341
  }
165505
166342
  const key = uri.password;
165506
166343
  if (!key) {
@@ -165547,9 +166384,9 @@ var require_main = __commonJS({
165547
166384
  return envPath[0] === "~" ? path2.join(os.homedir(), envPath.slice(1)) : envPath;
165548
166385
  }
165549
166386
  function _configVault(options) {
165550
- const debug40 = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
166387
+ const debug41 = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
165551
166388
  const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
165552
- if (debug40 || !quiet) {
166389
+ if (debug41 || !quiet) {
165553
166390
  _log("loading env from encrypted .env.vault");
165554
166391
  }
165555
166392
  const parsed = DotenvModule._parseVault(options);
@@ -165567,12 +166404,12 @@ var require_main = __commonJS({
165567
166404
  if (options && options.processEnv != null) {
165568
166405
  processEnv = options.processEnv;
165569
166406
  }
165570
- let debug40 = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
166407
+ let debug41 = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
165571
166408
  let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
165572
166409
  if (options && options.encoding) {
165573
166410
  encoding = options.encoding;
165574
166411
  } else {
165575
- if (debug40) {
166412
+ if (debug41) {
165576
166413
  _debug("no encoding is specified (UTF-8 is used by default)");
165577
166414
  }
165578
166415
  }
@@ -165594,16 +166431,16 @@ var require_main = __commonJS({
165594
166431
  const parsed = DotenvModule.parse(fs2.readFileSync(path3, { encoding }));
165595
166432
  DotenvModule.populate(parsedAll, parsed, options);
165596
166433
  } catch (e2) {
165597
- if (debug40) {
166434
+ if (debug41) {
165598
166435
  _debug(`failed to load ${path3} ${e2.message}`);
165599
166436
  }
165600
166437
  lastError = e2;
165601
166438
  }
165602
166439
  }
165603
166440
  const populated = DotenvModule.populate(processEnv, parsedAll, options);
165604
- debug40 = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug40);
166441
+ debug41 = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug41);
165605
166442
  quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
165606
- if (debug40 || !quiet) {
166443
+ if (debug41 || !quiet) {
165607
166444
  const keysCount = Object.keys(populated).length;
165608
166445
  const shortPaths = [];
165609
166446
  for (const filePath of optionPaths) {
@@ -165611,7 +166448,7 @@ var require_main = __commonJS({
165611
166448
  const relative = path2.relative(process.cwd(), filePath);
165612
166449
  shortPaths.push(relative);
165613
166450
  } catch (e2) {
165614
- if (debug40) {
166451
+ if (debug41) {
165615
166452
  _debug(`failed to load ${filePath} ${e2.message}`);
165616
166453
  }
165617
166454
  lastError = e2;
@@ -165646,10 +166483,10 @@ var require_main = __commonJS({
165646
166483
  const aesgcm = crypto4.createDecipheriv("aes-256-gcm", key, nonce);
165647
166484
  aesgcm.setAuthTag(authTag);
165648
166485
  return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
165649
- } catch (error6) {
165650
- const isRange = error6 instanceof RangeError;
165651
- const invalidKeyLength = error6.message === "Invalid key length";
165652
- const decryptionFailed = error6.message === "Unsupported state or unable to authenticate data";
166486
+ } catch (error5) {
166487
+ const isRange = error5 instanceof RangeError;
166488
+ const invalidKeyLength = error5.message === "Invalid key length";
166489
+ const decryptionFailed = error5.message === "Unsupported state or unable to authenticate data";
165653
166490
  if (isRange || invalidKeyLength) {
165654
166491
  const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
165655
166492
  err.code = "INVALID_DOTENV_KEY";
@@ -165659,12 +166496,12 @@ var require_main = __commonJS({
165659
166496
  err.code = "DECRYPTION_FAILED";
165660
166497
  throw err;
165661
166498
  } else {
165662
- throw error6;
166499
+ throw error5;
165663
166500
  }
165664
166501
  }
165665
166502
  }
165666
166503
  function populate(processEnv, parsed, options = {}) {
165667
- const debug40 = Boolean(options && options.debug);
166504
+ const debug41 = Boolean(options && options.debug);
165668
166505
  const override = Boolean(options && options.override);
165669
166506
  const populated = {};
165670
166507
  if (typeof parsed !== "object") {
@@ -165678,7 +166515,7 @@ var require_main = __commonJS({
165678
166515
  processEnv[key] = parsed[key];
165679
166516
  populated[key] = parsed[key];
165680
166517
  }
165681
- if (debug40) {
166518
+ if (debug41) {
165682
166519
  if (override === true) {
165683
166520
  _debug(`"${key}" is already defined and WAS overwritten`);
165684
166521
  } else {
@@ -169125,11 +169962,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
169125
169962
  */
169126
169963
  _getOutputContext(contextOptions) {
169127
169964
  contextOptions = contextOptions || {};
169128
- const error6 = !!contextOptions.error;
169965
+ const error5 = !!contextOptions.error;
169129
169966
  let baseWrite;
169130
169967
  let hasColors;
169131
169968
  let helpWidth;
169132
- if (error6) {
169969
+ if (error5) {
169133
169970
  baseWrite = (str) => this._outputConfiguration.writeErr(str);
169134
169971
  hasColors = this._outputConfiguration.getErrHasColors();
169135
169972
  helpWidth = this._outputConfiguration.getErrHelpWidth();
@@ -169142,7 +169979,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
169142
169979
  if (!hasColors) str = this._outputConfiguration.stripColor(str);
169143
169980
  return baseWrite(str);
169144
169981
  };
169145
- return { error: error6, write, hasColors, helpWidth };
169982
+ return { error: error5, write, hasColors, helpWidth };
169146
169983
  }
169147
169984
  /**
169148
169985
  * Output help information for this command.
@@ -170841,11 +171678,11 @@ function validate(subject, name, url2, level) {
170841
171678
  }
170842
171679
  });
170843
171680
  }
170844
- function handleError(error6, level) {
171681
+ function handleError(error5, level) {
170845
171682
  if (level === ErrorLevel.THROW) {
170846
- throw error6;
171683
+ throw error5;
170847
171684
  } else if (level === ErrorLevel.WARN) {
170848
- console.warn(error6.name, error6.message);
171685
+ console.warn(error5.name, error5.message);
170849
171686
  }
170850
171687
  }
170851
171688
  function validateSMIOptions(conf, level = ErrorLevel.WARN, errorHandler = handleError) {
@@ -171388,7 +172225,7 @@ function fanoutAsyncIterable(source, consumerCount) {
171388
172225
  const waiters = Array.from({ length: consumerCount }, () => []);
171389
172226
  const capacityWaiters = [];
171390
172227
  let done = false;
171391
- let error6 = void 0;
172228
+ let error5 = void 0;
171392
172229
  const producer = (async () => {
171393
172230
  try {
171394
172231
  for await (const item of source) {
@@ -171405,7 +172242,7 @@ function fanoutAsyncIterable(source, consumerCount) {
171405
172242
  }
171406
172243
  }
171407
172244
  } catch (caught) {
171408
- error6 = caught;
172245
+ error5 = caught;
171409
172246
  } finally {
171410
172247
  done = true;
171411
172248
  for (const queueWaiters of waiters) {
@@ -171423,8 +172260,8 @@ function fanoutAsyncIterable(source, consumerCount) {
171423
172260
  continue;
171424
172261
  }
171425
172262
  if (done) {
171426
- if (error6) {
171427
- throw error6;
172263
+ if (error5) {
172264
+ throw error5;
171428
172265
  }
171429
172266
  await producer;
171430
172267
  return;
@@ -171578,8 +172415,8 @@ function parseProductConcurrency(value, fallback2) {
171578
172415
  }
171579
172416
  return Math.floor(parsed);
171580
172417
  }
171581
- main().catch((error6) => {
171582
- console.error(error6);
172418
+ main().catch((error5) => {
172419
+ console.error(error5);
171583
172420
  process.exit(1);
171584
172421
  });
171585
172422
  /*! Bundled license information: