@reactionary/feeds 0.10.53 → 0.10.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +1075 -345
- 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(
|
|
3332
|
-
return JSON.stringify(
|
|
3331
|
+
function transformRedisJsonArgument(json2) {
|
|
3332
|
+
return JSON.stringify(json2);
|
|
3333
3333
|
}
|
|
3334
3334
|
exports2.transformRedisJsonArgument = transformRedisJsonArgument;
|
|
3335
|
-
function transformRedisJsonReply(
|
|
3336
|
-
const res = JSON.parse(
|
|
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(
|
|
3341
|
-
return isNullReply(
|
|
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: (
|
|
15917
|
-
(0, exports2.dbgMaintenance)("handshake failed:",
|
|
15916
|
+
errorHandler: (error5) => {
|
|
15917
|
+
(0, exports2.dbgMaintenance)("handshake failed:", error5);
|
|
15918
15918
|
(0, tracing_1.publish)(tracing_1.CHANNELS.ERROR, () => ({
|
|
15919
|
-
error:
|
|
15919
|
+
error: error5,
|
|
15920
15920
|
origin: "client",
|
|
15921
15921
|
internal: true,
|
|
15922
15922
|
clientId
|
|
15923
15923
|
}));
|
|
15924
15924
|
if (options.maintNotifications === "enabled") {
|
|
15925
|
-
throw
|
|
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", (
|
|
16030
|
-
(0, exports2.dbgMaintenance)(`[ERR]`,
|
|
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
|
|
16431
|
-
socket.destroy(
|
|
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(
|
|
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(
|
|
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 (
|
|
16640
|
-
if (this.shouldRetry(
|
|
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: ${
|
|
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(
|
|
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(
|
|
16712
|
-
const errorMessage =
|
|
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(
|
|
19827
|
-
if (!(
|
|
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(
|
|
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(
|
|
19895
|
-
return
|
|
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(
|
|
19902
|
-
const prefix = extractRedisStatusCode(
|
|
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(
|
|
19915
|
-
if (isNodeRedisNetworkError(
|
|
19914
|
+
function getCategory(error5) {
|
|
19915
|
+
if (isNodeRedisNetworkError(error5)) {
|
|
19916
19916
|
return types_1.ERROR_CATEGORY.NETWORK;
|
|
19917
19917
|
}
|
|
19918
|
-
const errorCode =
|
|
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(
|
|
19927
|
+
if (isTlsErrorMessage(error5.message)) {
|
|
19928
19928
|
return types_1.ERROR_CATEGORY.TLS;
|
|
19929
19929
|
}
|
|
19930
|
-
const category = categorizeRedisError(
|
|
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(
|
|
19937
|
-
if (!(
|
|
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 =
|
|
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(
|
|
20221
|
+
#recordError(error5, clientId, extra) {
|
|
20222
20222
|
const clientAttributes = resolveClientAttributes(clientId);
|
|
20223
|
-
const errorInfo = (0, utils_1.getErrorInfo)(
|
|
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((
|
|
21116
|
-
const errorMessage =
|
|
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((
|
|
21260
|
-
if (
|
|
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", (
|
|
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,
|
|
25255
|
+
parseCommand(parser, key, error5, probability) {
|
|
25256
25256
|
parser.push("CMS.INITBYPROB");
|
|
25257
25257
|
parser.pushKey(key);
|
|
25258
|
-
parser.push(
|
|
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,
|
|
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)(
|
|
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,
|
|
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)(
|
|
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,
|
|
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)(
|
|
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((
|
|
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,
|
|
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)(
|
|
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(
|
|
32041
|
+
function flattenError(error5, mapper = (issue2) => issue2.message) {
|
|
32042
32042
|
const fieldErrors = {};
|
|
32043
32043
|
const formErrors = [];
|
|
32044
|
-
for (const sub of
|
|
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(
|
|
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 = (
|
|
32060
|
-
for (const issue2 of
|
|
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(
|
|
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
|
-
|
|
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
|
|
36653
|
+
function _null4() {
|
|
36594
36654
|
return exports2.PREFIX.null;
|
|
36595
36655
|
}
|
|
36596
|
-
exports2._null =
|
|
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, 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,11 @@ 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
|
+
});
|
|
37374
37439
|
PickupPointSchema = looseObject({
|
|
37375
37440
|
identifier: object({
|
|
37376
37441
|
key: string2()
|
|
@@ -37390,30 +37455,38 @@ var init_shipping_method_model = __esm({
|
|
|
37390
37455
|
logo: ImageSchema.optional(),
|
|
37391
37456
|
price: MonetaryAmountSchema,
|
|
37392
37457
|
deliveryTime: string2(),
|
|
37393
|
-
carrier: string2().optional()
|
|
37458
|
+
carrier: string2().optional(),
|
|
37459
|
+
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.` }),
|
|
37460
|
+
protocolData: array(ShippingProtocolDataSchema).optional().meta({ description: "Additional provider-populated, protocol-specific data for this shipping method, e.g. available pickup time slots." })
|
|
37394
37461
|
});
|
|
37395
37462
|
ShippingInstructionSchema = BaseModelSchema.extend({
|
|
37396
37463
|
shippingMethod: ShippingMethodIdentifierSchema,
|
|
37397
|
-
pickupPoint: string2().meta({ description: "An optional
|
|
37464
|
+
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
37465
|
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." })
|
|
37466
|
+
consentForUnattendedDelivery: boolean2().meta({ description: "Indicates if the customer has given consent for unattended delivery, if applicable." }),
|
|
37467
|
+
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." }),
|
|
37468
|
+
protocolData: array(ShippingProtocolDataSchema).optional().meta({ description: "Additional client-set, protocol-specific data for the shipping instruction, e.g. a selected pickup time slot." })
|
|
37400
37469
|
});
|
|
37401
37470
|
}
|
|
37402
37471
|
});
|
|
37403
37472
|
|
|
37404
37473
|
// packages/core/src/schemas/models/store.model.ts
|
|
37405
|
-
var StoreSchema;
|
|
37474
|
+
var StoreSchema, StorePaginatedResultSchema;
|
|
37406
37475
|
var init_store_model = __esm({
|
|
37407
37476
|
"packages/core/src/schemas/models/store.model.ts"() {
|
|
37408
37477
|
"use strict";
|
|
37409
37478
|
init_zod();
|
|
37410
37479
|
init_base_model();
|
|
37411
37480
|
init_identifiers_model();
|
|
37481
|
+
init_profile_model();
|
|
37412
37482
|
StoreSchema = BaseModelSchema.extend({
|
|
37413
37483
|
identifier: StoreIdentifierSchema,
|
|
37414
37484
|
name: string2(),
|
|
37415
|
-
fulfillmentCenter: FulfillmentCenterIdentifierSchema
|
|
37485
|
+
fulfillmentCenter: FulfillmentCenterIdentifierSchema,
|
|
37486
|
+
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)." }),
|
|
37487
|
+
openingHours: string2().optional().meta({ description: 'The opening hours of the store, if known. This could be a string like "Mon-Fri 9am-5pm".' })
|
|
37416
37488
|
});
|
|
37489
|
+
StorePaginatedResultSchema = createPaginatedResponseSchema(StoreSchema);
|
|
37417
37490
|
}
|
|
37418
37491
|
});
|
|
37419
37492
|
|
|
@@ -38508,18 +38581,26 @@ var init_product_reviews_query = __esm({
|
|
|
38508
38581
|
});
|
|
38509
38582
|
|
|
38510
38583
|
// packages/core/src/schemas/queries/store.query.ts
|
|
38511
|
-
var StoreQueryByProximitySchema;
|
|
38584
|
+
var StoreQueryByProximitySchema, StoreQueryByIdSchema, StoreQueryForListSchema;
|
|
38512
38585
|
var init_store_query = __esm({
|
|
38513
38586
|
"packages/core/src/schemas/queries/store.query.ts"() {
|
|
38514
38587
|
"use strict";
|
|
38515
38588
|
init_zod();
|
|
38516
38589
|
init_base_query();
|
|
38590
|
+
init_identifiers_model();
|
|
38591
|
+
init_base_model();
|
|
38517
38592
|
StoreQueryByProximitySchema = BaseQuerySchema.extend({
|
|
38518
38593
|
longitude: number2(),
|
|
38519
38594
|
latitude: number2(),
|
|
38520
38595
|
distance: number2(),
|
|
38521
38596
|
limit: number2()
|
|
38522
38597
|
});
|
|
38598
|
+
StoreQueryByIdSchema = BaseQuerySchema.extend({
|
|
38599
|
+
identifier: StoreIdentifierSchema
|
|
38600
|
+
});
|
|
38601
|
+
StoreQueryForListSchema = BaseQuerySchema.extend({
|
|
38602
|
+
paginationOptions: PaginationOptionsSchema
|
|
38603
|
+
});
|
|
38523
38604
|
}
|
|
38524
38605
|
});
|
|
38525
38606
|
|
|
@@ -38848,10 +38929,10 @@ function success(value) {
|
|
|
38848
38929
|
}
|
|
38849
38930
|
};
|
|
38850
38931
|
}
|
|
38851
|
-
function error2(
|
|
38932
|
+
function error2(error5) {
|
|
38852
38933
|
return {
|
|
38853
38934
|
success: false,
|
|
38854
|
-
error:
|
|
38935
|
+
error: error5,
|
|
38855
38936
|
meta: {
|
|
38856
38937
|
trace: trace.getActiveSpan()?.spanContext().traceId || ""
|
|
38857
38938
|
}
|
|
@@ -42018,8 +42099,8 @@ var require_lib7 = __commonJS({
|
|
|
42018
42099
|
exports2.byteSequence = byteSequence;
|
|
42019
42100
|
var codePoint = __importStar(require_CodePoints());
|
|
42020
42101
|
exports2.codePoint = codePoint;
|
|
42021
|
-
var
|
|
42022
|
-
exports2.json =
|
|
42102
|
+
var json2 = __importStar(require_JSON());
|
|
42103
|
+
exports2.json = json2;
|
|
42023
42104
|
var list = __importStar(require_List());
|
|
42024
42105
|
exports2.list = list;
|
|
42025
42106
|
var map = __importStar(require_Map());
|
|
@@ -60427,7 +60508,7 @@ var require_sax = __commonJS({
|
|
|
60427
60508
|
parser.script = "";
|
|
60428
60509
|
break;
|
|
60429
60510
|
default:
|
|
60430
|
-
|
|
60511
|
+
error5(parser, "Max buffer length exceeded: " + buffers[i3]);
|
|
60431
60512
|
}
|
|
60432
60513
|
}
|
|
60433
60514
|
maxActual = Math.max(maxActual, len);
|
|
@@ -61027,7 +61108,7 @@ var require_sax = __commonJS({
|
|
|
61027
61108
|
if (opt.normalize) text2 = text2.replace(/\s+/g, " ");
|
|
61028
61109
|
return text2;
|
|
61029
61110
|
}
|
|
61030
|
-
function
|
|
61111
|
+
function error5(parser, er3) {
|
|
61031
61112
|
closeText(parser);
|
|
61032
61113
|
if (parser.trackPosition) {
|
|
61033
61114
|
er3 += "\nLine: " + parser.line + "\nColumn: " + parser.column + "\nChar: " + parser.c;
|
|
@@ -61041,7 +61122,7 @@ var require_sax = __commonJS({
|
|
|
61041
61122
|
if (parser.sawRoot && !parser.closedRoot)
|
|
61042
61123
|
strictFail(parser, "Unclosed root tag");
|
|
61043
61124
|
if (parser.state !== S4.BEGIN && parser.state !== S4.BEGIN_WHITESPACE && parser.state !== S4.TEXT) {
|
|
61044
|
-
|
|
61125
|
+
error5(parser, "Unexpected end");
|
|
61045
61126
|
}
|
|
61046
61127
|
closeText(parser);
|
|
61047
61128
|
parser.c = "";
|
|
@@ -61055,7 +61136,7 @@ var require_sax = __commonJS({
|
|
|
61055
61136
|
throw new Error("bad call to strictFail");
|
|
61056
61137
|
}
|
|
61057
61138
|
if (parser.strict) {
|
|
61058
|
-
|
|
61139
|
+
error5(parser, message);
|
|
61059
61140
|
}
|
|
61060
61141
|
}
|
|
61061
61142
|
function newTag(parser) {
|
|
@@ -61300,7 +61381,7 @@ var require_sax = __commonJS({
|
|
|
61300
61381
|
throw this.error;
|
|
61301
61382
|
}
|
|
61302
61383
|
if (parser.closed) {
|
|
61303
|
-
return
|
|
61384
|
+
return error5(
|
|
61304
61385
|
parser,
|
|
61305
61386
|
"Cannot write after close. Assign an onready handler."
|
|
61306
61387
|
);
|
|
@@ -61696,7 +61777,7 @@ var require_sax = __commonJS({
|
|
|
61696
61777
|
parser.state = S4.ATTRIB_VALUE_QUOTED;
|
|
61697
61778
|
} else {
|
|
61698
61779
|
if (!parser.opt.unquotedAttributeValues) {
|
|
61699
|
-
|
|
61780
|
+
error5(parser, "Unquoted attribute value");
|
|
61700
61781
|
}
|
|
61701
61782
|
parser.state = S4.ATTRIB_VALUE_UNQUOTED;
|
|
61702
61783
|
parser.attribValue = c3;
|
|
@@ -61809,13 +61890,13 @@ var require_sax = __commonJS({
|
|
|
61809
61890
|
var parsedEntity = parseEntity(parser);
|
|
61810
61891
|
if (parser.opt.unparsedEntities && !Object.values(sax3.XML_ENTITIES).includes(parsedEntity)) {
|
|
61811
61892
|
if ((parser.entityCount += 1) > parser.opt.maxEntityCount) {
|
|
61812
|
-
|
|
61893
|
+
error5(
|
|
61813
61894
|
parser,
|
|
61814
61895
|
"Parsed entity count exceeds max entity count"
|
|
61815
61896
|
);
|
|
61816
61897
|
}
|
|
61817
61898
|
if ((parser.entityDepth += 1) > parser.opt.maxEntityDepth) {
|
|
61818
|
-
|
|
61899
|
+
error5(
|
|
61819
61900
|
parser,
|
|
61820
61901
|
"Parsed entity depth exceeds max entity depth"
|
|
61821
61902
|
);
|
|
@@ -61980,7 +62061,7 @@ function createIterablePromise({
|
|
|
61980
62061
|
func,
|
|
61981
62062
|
validate: validate2,
|
|
61982
62063
|
aggregator,
|
|
61983
|
-
error:
|
|
62064
|
+
error: error5,
|
|
61984
62065
|
timeout = () => 0
|
|
61985
62066
|
}) {
|
|
61986
62067
|
const retry = (previousResponse) => {
|
|
@@ -61992,8 +62073,8 @@ function createIterablePromise({
|
|
|
61992
62073
|
if (await validate2(response)) {
|
|
61993
62074
|
return resolve2(response);
|
|
61994
62075
|
}
|
|
61995
|
-
if (
|
|
61996
|
-
return reject(new Error(await
|
|
62076
|
+
if (error5 && await error5.validate(response)) {
|
|
62077
|
+
return reject(new Error(await error5.message(response)));
|
|
61997
62078
|
}
|
|
61998
62079
|
return setTimeout(
|
|
61999
62080
|
() => {
|
|
@@ -62579,9 +62660,9 @@ var init_common = __esm({
|
|
|
62579
62660
|
};
|
|
62580
62661
|
DetailedApiError = class extends ApiError {
|
|
62581
62662
|
error;
|
|
62582
|
-
constructor(message, status,
|
|
62663
|
+
constructor(message, status, error5, stackTrace) {
|
|
62583
62664
|
super(message, status, stackTrace, "DetailedApiError");
|
|
62584
|
-
this.error =
|
|
62665
|
+
this.error = error5;
|
|
62585
62666
|
}
|
|
62586
62667
|
};
|
|
62587
62668
|
}
|
|
@@ -62643,10 +62724,10 @@ function createHttpRequester({
|
|
|
62643
62724
|
isTimedOut: false
|
|
62644
62725
|
});
|
|
62645
62726
|
});
|
|
62646
|
-
response.on("error", (
|
|
62727
|
+
response.on("error", (error5) => {
|
|
62647
62728
|
clearTimeout(connectTimeout);
|
|
62648
62729
|
clearTimeout(responseTimeout);
|
|
62649
|
-
resolve2({ status: 0, content:
|
|
62730
|
+
resolve2({ status: 0, content: error5.message, isTimedOut: false });
|
|
62650
62731
|
});
|
|
62651
62732
|
});
|
|
62652
62733
|
const createTimeout = (timeout, content) => {
|
|
@@ -62660,10 +62741,10 @@ function createHttpRequester({
|
|
|
62660
62741
|
}, timeout);
|
|
62661
62742
|
};
|
|
62662
62743
|
connectTimeout = createTimeout(request.connectTimeout, "Connection timeout");
|
|
62663
|
-
req.on("error", (
|
|
62744
|
+
req.on("error", (error5) => {
|
|
62664
62745
|
clearTimeout(connectTimeout);
|
|
62665
62746
|
clearTimeout(responseTimeout);
|
|
62666
|
-
resolve2({ status: 0, content:
|
|
62747
|
+
resolve2({ status: 0, content: error5.message, isTimedOut: false });
|
|
62667
62748
|
});
|
|
62668
62749
|
req.once("response", () => {
|
|
62669
62750
|
clearTimeout(connectTimeout);
|
|
@@ -62707,8 +62788,8 @@ function createHttpRequester({
|
|
|
62707
62788
|
}
|
|
62708
62789
|
resolve2(import_stream.Readable.toWeb(response));
|
|
62709
62790
|
});
|
|
62710
|
-
req.on("error", (
|
|
62711
|
-
reject(
|
|
62791
|
+
req.on("error", (error5) => {
|
|
62792
|
+
reject(error5);
|
|
62712
62793
|
});
|
|
62713
62794
|
if (request.data !== void 0) {
|
|
62714
62795
|
req.write(request.data);
|
|
@@ -65698,11 +65779,11 @@ function createSearchClient({
|
|
|
65698
65779
|
}
|
|
65699
65780
|
return createIterablePromise({
|
|
65700
65781
|
...baseIteratorOptions,
|
|
65701
|
-
func: () => this.getApiKey({ key }, requestOptions).catch((
|
|
65702
|
-
if (
|
|
65782
|
+
func: () => this.getApiKey({ key }, requestOptions).catch((error5) => {
|
|
65783
|
+
if (error5.status === 404) {
|
|
65703
65784
|
return void 0;
|
|
65704
65785
|
}
|
|
65705
|
-
throw
|
|
65786
|
+
throw error5;
|
|
65706
65787
|
}),
|
|
65707
65788
|
validate: (response) => operation === "add" ? response !== void 0 : response === void 0
|
|
65708
65789
|
});
|
|
@@ -65992,19 +66073,19 @@ function createSearchClient({
|
|
|
65992
66073
|
maxRetries
|
|
65993
66074
|
});
|
|
65994
66075
|
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
65995
|
-
} catch (
|
|
66076
|
+
} catch (error5) {
|
|
65996
66077
|
await this.deleteIndex({ indexName: tmpIndexName });
|
|
65997
|
-
throw
|
|
66078
|
+
throw error5;
|
|
65998
66079
|
}
|
|
65999
66080
|
},
|
|
66000
66081
|
async indexExists({ indexName }) {
|
|
66001
66082
|
try {
|
|
66002
66083
|
await this.getSettings({ indexName });
|
|
66003
|
-
} catch (
|
|
66004
|
-
if (
|
|
66084
|
+
} catch (error5) {
|
|
66085
|
+
if (error5 instanceof ApiError && error5.status === 404) {
|
|
66005
66086
|
return false;
|
|
66006
66087
|
}
|
|
66007
|
-
throw
|
|
66088
|
+
throw error5;
|
|
66008
66089
|
}
|
|
66009
66090
|
return true;
|
|
66010
66091
|
},
|
|
@@ -67963,11 +68044,11 @@ function createIngestionClient({
|
|
|
67963
68044
|
if (resp.eventID === void 0 || !resp.eventID) {
|
|
67964
68045
|
throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
|
|
67965
68046
|
}
|
|
67966
|
-
return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((
|
|
67967
|
-
if (
|
|
68047
|
+
return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((error5) => {
|
|
68048
|
+
if (error5.status === 404) {
|
|
67968
68049
|
return void 0;
|
|
67969
68050
|
}
|
|
67970
|
-
throw
|
|
68051
|
+
throw error5;
|
|
67971
68052
|
});
|
|
67972
68053
|
},
|
|
67973
68054
|
validate: (response) => response !== void 0,
|
|
@@ -70749,9 +70830,9 @@ function algoliasearch(appId, apiKey, options) {
|
|
|
70749
70830
|
maxRetries
|
|
70750
70831
|
});
|
|
70751
70832
|
return { copyOperationResponse, watchResponses, moveOperationResponse };
|
|
70752
|
-
} catch (
|
|
70833
|
+
} catch (error5) {
|
|
70753
70834
|
await this.deleteIndex({ indexName: tmpIndexName });
|
|
70754
|
-
throw
|
|
70835
|
+
throw error5;
|
|
70755
70836
|
}
|
|
70756
70837
|
},
|
|
70757
70838
|
/**
|
|
@@ -71411,8 +71492,8 @@ var init_product_recommendations_capability2 = __esm({
|
|
|
71411
71492
|
}
|
|
71412
71493
|
}
|
|
71413
71494
|
return result;
|
|
71414
|
-
} catch (
|
|
71415
|
-
console.error("Error fetching frequently bought together recommendations:",
|
|
71495
|
+
} catch (error5) {
|
|
71496
|
+
console.error("Error fetching frequently bought together recommendations:", error5);
|
|
71416
71497
|
return [];
|
|
71417
71498
|
}
|
|
71418
71499
|
}
|
|
@@ -71444,8 +71525,8 @@ var init_product_recommendations_capability2 = __esm({
|
|
|
71444
71525
|
}
|
|
71445
71526
|
}
|
|
71446
71527
|
return result;
|
|
71447
|
-
} catch (
|
|
71448
|
-
console.error("Error fetching similar product recommendations:",
|
|
71528
|
+
} catch (error5) {
|
|
71529
|
+
console.error("Error fetching similar product recommendations:", error5);
|
|
71449
71530
|
return [];
|
|
71450
71531
|
}
|
|
71451
71532
|
}
|
|
@@ -71477,8 +71558,8 @@ var init_product_recommendations_capability2 = __esm({
|
|
|
71477
71558
|
}
|
|
71478
71559
|
}
|
|
71479
71560
|
return result;
|
|
71480
|
-
} catch (
|
|
71481
|
-
console.error("Error fetching related product recommendations:",
|
|
71561
|
+
} catch (error5) {
|
|
71562
|
+
console.error("Error fetching related product recommendations:", error5);
|
|
71482
71563
|
return [];
|
|
71483
71564
|
}
|
|
71484
71565
|
}
|
|
@@ -71511,8 +71592,8 @@ var init_product_recommendations_capability2 = __esm({
|
|
|
71511
71592
|
}
|
|
71512
71593
|
}
|
|
71513
71594
|
return result;
|
|
71514
|
-
} catch (
|
|
71515
|
-
console.error("Error fetching trending in category recommendations:",
|
|
71595
|
+
} catch (error5) {
|
|
71596
|
+
console.error("Error fetching trending in category recommendations:", error5);
|
|
71516
71597
|
return [];
|
|
71517
71598
|
}
|
|
71518
71599
|
}
|
|
@@ -71992,7 +72073,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
71992
72073
|
});
|
|
71993
72074
|
return response;
|
|
71994
72075
|
}
|
|
71995
|
-
return sendRequest().catch((
|
|
72076
|
+
return sendRequest().catch((error5) => Promise.reject(error5));
|
|
71996
72077
|
}
|
|
71997
72078
|
async function executor(request) {
|
|
71998
72079
|
const {
|
|
@@ -72461,8 +72542,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72461
72542
|
message: response.data.message,
|
|
72462
72543
|
error: response.data.errors
|
|
72463
72544
|
});
|
|
72464
|
-
} catch (
|
|
72465
|
-
throw
|
|
72545
|
+
} catch (error5) {
|
|
72546
|
+
throw error5;
|
|
72466
72547
|
}
|
|
72467
72548
|
}
|
|
72468
72549
|
async function authProcessor(request, tokenFetchPromise = null, tokenCacheObject, tokenCacheKey, tokenCache, builder, options, next) {
|
|
@@ -72621,11 +72702,11 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72621
72702
|
const response = await next(request);
|
|
72622
72703
|
if (response.error) {
|
|
72623
72704
|
const {
|
|
72624
|
-
error:
|
|
72705
|
+
error: error5
|
|
72625
72706
|
} = response;
|
|
72626
72707
|
if (options.handler && typeof options.handler == "function") {
|
|
72627
72708
|
return options.handler({
|
|
72628
|
-
error:
|
|
72709
|
+
error: error5,
|
|
72629
72710
|
request,
|
|
72630
72711
|
response,
|
|
72631
72712
|
next
|
|
@@ -72633,10 +72714,10 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72633
72714
|
}
|
|
72634
72715
|
return {
|
|
72635
72716
|
...response,
|
|
72636
|
-
statusCode:
|
|
72637
|
-
headers:
|
|
72638
|
-
body:
|
|
72639
|
-
error:
|
|
72717
|
+
statusCode: error5.statusCode || 0,
|
|
72718
|
+
headers: error5.headers || getHeaders({}),
|
|
72719
|
+
body: error5,
|
|
72720
|
+
error: error5
|
|
72640
72721
|
};
|
|
72641
72722
|
}
|
|
72642
72723
|
return response;
|
|
@@ -72682,7 +72763,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72682
72763
|
headers: getHeaders(response.headers)
|
|
72683
72764
|
};
|
|
72684
72765
|
}
|
|
72685
|
-
const
|
|
72766
|
+
const error5 = createError({
|
|
72686
72767
|
code: response.data?.errors?.[0].code,
|
|
72687
72768
|
message: response?.data?.message || response?.message,
|
|
72688
72769
|
statusCode: response.statusCode || response?.data?.statusCode,
|
|
@@ -72701,14 +72782,14 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72701
72782
|
}
|
|
72702
72783
|
});
|
|
72703
72784
|
return {
|
|
72704
|
-
...
|
|
72705
|
-
error:
|
|
72785
|
+
...error5,
|
|
72786
|
+
error: error5
|
|
72706
72787
|
};
|
|
72707
72788
|
} catch (e2) {
|
|
72708
72789
|
const headers = includeResponseHeaders ? getHeaders(e2.response?.headers) : null;
|
|
72709
72790
|
const statusCode = e2.response?.status || e2.response?.statusCode || e2.response?.data.statusCode || 0;
|
|
72710
72791
|
const message = e2.response?.data?.message;
|
|
72711
|
-
const
|
|
72792
|
+
const error5 = createError({
|
|
72712
72793
|
statusCode,
|
|
72713
72794
|
code: "NetworkError",
|
|
72714
72795
|
status: statusCode,
|
|
@@ -72728,7 +72809,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72728
72809
|
throw {
|
|
72729
72810
|
// because body and error should be mutually exclusive
|
|
72730
72811
|
body: null,
|
|
72731
|
-
error:
|
|
72812
|
+
error: error5
|
|
72732
72813
|
};
|
|
72733
72814
|
}
|
|
72734
72815
|
}
|
|
@@ -72850,8 +72931,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72850
72931
|
request.resolve(data);
|
|
72851
72932
|
freeSlot();
|
|
72852
72933
|
},
|
|
72853
|
-
reject(
|
|
72854
|
-
request.reject(
|
|
72934
|
+
reject(error5) {
|
|
72935
|
+
request.reject(error5);
|
|
72855
72936
|
freeSlot();
|
|
72856
72937
|
}
|
|
72857
72938
|
};
|
|
@@ -73028,8 +73109,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
73028
73109
|
const last = results[resultsLength - 1];
|
|
73029
73110
|
const newLastId = last && last.id;
|
|
73030
73111
|
processPage(newLastId, accumulated);
|
|
73031
|
-
} catch (
|
|
73032
|
-
reject(
|
|
73112
|
+
} catch (error5) {
|
|
73113
|
+
reject(error5);
|
|
73033
73114
|
}
|
|
73034
73115
|
};
|
|
73035
73116
|
processPage();
|
|
@@ -73425,7 +73506,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
73425
73506
|
});
|
|
73426
73507
|
return response;
|
|
73427
73508
|
}
|
|
73428
|
-
return sendRequest().catch((
|
|
73509
|
+
return sendRequest().catch((error5) => Promise.reject(error5));
|
|
73429
73510
|
}
|
|
73430
73511
|
async function executor(request) {
|
|
73431
73512
|
const {
|
|
@@ -73894,8 +73975,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
73894
73975
|
message: response.data.message,
|
|
73895
73976
|
error: response.data.errors
|
|
73896
73977
|
});
|
|
73897
|
-
} catch (
|
|
73898
|
-
throw
|
|
73978
|
+
} catch (error5) {
|
|
73979
|
+
throw error5;
|
|
73899
73980
|
}
|
|
73900
73981
|
}
|
|
73901
73982
|
async function authProcessor(request, tokenFetchPromise = null, tokenCacheObject, tokenCacheKey, tokenCache, builder, options, next) {
|
|
@@ -74054,11 +74135,11 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74054
74135
|
const response = await next(request);
|
|
74055
74136
|
if (response.error) {
|
|
74056
74137
|
const {
|
|
74057
|
-
error:
|
|
74138
|
+
error: error5
|
|
74058
74139
|
} = response;
|
|
74059
74140
|
if (options.handler && typeof options.handler == "function") {
|
|
74060
74141
|
return options.handler({
|
|
74061
|
-
error:
|
|
74142
|
+
error: error5,
|
|
74062
74143
|
request,
|
|
74063
74144
|
response,
|
|
74064
74145
|
next
|
|
@@ -74066,10 +74147,10 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74066
74147
|
}
|
|
74067
74148
|
return {
|
|
74068
74149
|
...response,
|
|
74069
|
-
statusCode:
|
|
74070
|
-
headers:
|
|
74071
|
-
body:
|
|
74072
|
-
error:
|
|
74150
|
+
statusCode: error5.statusCode || 0,
|
|
74151
|
+
headers: error5.headers || getHeaders({}),
|
|
74152
|
+
body: error5,
|
|
74153
|
+
error: error5
|
|
74073
74154
|
};
|
|
74074
74155
|
}
|
|
74075
74156
|
return response;
|
|
@@ -74115,7 +74196,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74115
74196
|
headers: getHeaders(response.headers)
|
|
74116
74197
|
};
|
|
74117
74198
|
}
|
|
74118
|
-
const
|
|
74199
|
+
const error5 = createError({
|
|
74119
74200
|
code: response.data?.errors?.[0].code,
|
|
74120
74201
|
message: response?.data?.message || response?.message,
|
|
74121
74202
|
statusCode: response.statusCode || response?.data?.statusCode,
|
|
@@ -74134,14 +74215,14 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74134
74215
|
}
|
|
74135
74216
|
});
|
|
74136
74217
|
return {
|
|
74137
|
-
...
|
|
74138
|
-
error:
|
|
74218
|
+
...error5,
|
|
74219
|
+
error: error5
|
|
74139
74220
|
};
|
|
74140
74221
|
} catch (e2) {
|
|
74141
74222
|
const headers = includeResponseHeaders ? getHeaders(e2.response?.headers) : null;
|
|
74142
74223
|
const statusCode = e2.response?.status || e2.response?.statusCode || e2.response?.data.statusCode || 0;
|
|
74143
74224
|
const message = e2.response?.data?.message;
|
|
74144
|
-
const
|
|
74225
|
+
const error5 = createError({
|
|
74145
74226
|
statusCode,
|
|
74146
74227
|
code: "NetworkError",
|
|
74147
74228
|
status: statusCode,
|
|
@@ -74161,7 +74242,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74161
74242
|
throw {
|
|
74162
74243
|
// because body and error should be mutually exclusive
|
|
74163
74244
|
body: null,
|
|
74164
|
-
error:
|
|
74245
|
+
error: error5
|
|
74165
74246
|
};
|
|
74166
74247
|
}
|
|
74167
74248
|
}
|
|
@@ -74283,8 +74364,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74283
74364
|
request.resolve(data);
|
|
74284
74365
|
freeSlot();
|
|
74285
74366
|
},
|
|
74286
|
-
reject(
|
|
74287
|
-
request.reject(
|
|
74367
|
+
reject(error5) {
|
|
74368
|
+
request.reject(error5);
|
|
74288
74369
|
freeSlot();
|
|
74289
74370
|
}
|
|
74290
74371
|
};
|
|
@@ -74461,8 +74542,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74461
74542
|
const last = results[resultsLength - 1];
|
|
74462
74543
|
const newLastId = last && last.id;
|
|
74463
74544
|
processPage(newLastId, accumulated);
|
|
74464
|
-
} catch (
|
|
74465
|
-
reject(
|
|
74545
|
+
} catch (error5) {
|
|
74546
|
+
reject(error5);
|
|
74466
74547
|
}
|
|
74467
74548
|
};
|
|
74468
74549
|
processPage();
|
|
@@ -111591,46 +111672,46 @@ var require_ms = __commonJS({
|
|
|
111591
111672
|
var require_common2 = __commonJS({
|
|
111592
111673
|
"node_modules/.pnpm/debug@4.4.3_supports-color@7.2.0/node_modules/debug/src/common.js"(exports2, module2) {
|
|
111593
111674
|
function setup(env) {
|
|
111594
|
-
|
|
111595
|
-
|
|
111596
|
-
|
|
111597
|
-
|
|
111598
|
-
|
|
111599
|
-
|
|
111600
|
-
|
|
111601
|
-
|
|
111675
|
+
createDebug41.debug = createDebug41;
|
|
111676
|
+
createDebug41.default = createDebug41;
|
|
111677
|
+
createDebug41.coerce = coerce;
|
|
111678
|
+
createDebug41.disable = disable;
|
|
111679
|
+
createDebug41.enable = enable;
|
|
111680
|
+
createDebug41.enabled = enabled;
|
|
111681
|
+
createDebug41.humanize = require_ms();
|
|
111682
|
+
createDebug41.destroy = destroy;
|
|
111602
111683
|
Object.keys(env).forEach((key) => {
|
|
111603
|
-
|
|
111684
|
+
createDebug41[key] = env[key];
|
|
111604
111685
|
});
|
|
111605
|
-
|
|
111606
|
-
|
|
111607
|
-
|
|
111686
|
+
createDebug41.names = [];
|
|
111687
|
+
createDebug41.skips = [];
|
|
111688
|
+
createDebug41.formatters = {};
|
|
111608
111689
|
function selectColor(namespace) {
|
|
111609
111690
|
let hash2 = 0;
|
|
111610
111691
|
for (let i3 = 0; i3 < namespace.length; i3++) {
|
|
111611
111692
|
hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i3);
|
|
111612
111693
|
hash2 |= 0;
|
|
111613
111694
|
}
|
|
111614
|
-
return
|
|
111695
|
+
return createDebug41.colors[Math.abs(hash2) % createDebug41.colors.length];
|
|
111615
111696
|
}
|
|
111616
|
-
|
|
111617
|
-
function
|
|
111697
|
+
createDebug41.selectColor = selectColor;
|
|
111698
|
+
function createDebug41(namespace) {
|
|
111618
111699
|
let prevTime;
|
|
111619
111700
|
let enableOverride = null;
|
|
111620
111701
|
let namespacesCache;
|
|
111621
111702
|
let enabledCache;
|
|
111622
|
-
function
|
|
111623
|
-
if (!
|
|
111703
|
+
function debug41(...args) {
|
|
111704
|
+
if (!debug41.enabled) {
|
|
111624
111705
|
return;
|
|
111625
111706
|
}
|
|
111626
|
-
const self2 =
|
|
111707
|
+
const self2 = debug41;
|
|
111627
111708
|
const curr = Number(/* @__PURE__ */ new Date());
|
|
111628
111709
|
const ms = curr - (prevTime || curr);
|
|
111629
111710
|
self2.diff = ms;
|
|
111630
111711
|
self2.prev = prevTime;
|
|
111631
111712
|
self2.curr = curr;
|
|
111632
111713
|
prevTime = curr;
|
|
111633
|
-
args[0] =
|
|
111714
|
+
args[0] = createDebug41.coerce(args[0]);
|
|
111634
111715
|
if (typeof args[0] !== "string") {
|
|
111635
111716
|
args.unshift("%O");
|
|
111636
111717
|
}
|
|
@@ -111640,7 +111721,7 @@ var require_common2 = __commonJS({
|
|
|
111640
111721
|
return "%";
|
|
111641
111722
|
}
|
|
111642
111723
|
index++;
|
|
111643
|
-
const formatter =
|
|
111724
|
+
const formatter = createDebug41.formatters[format];
|
|
111644
111725
|
if (typeof formatter === "function") {
|
|
111645
111726
|
const val = args[index];
|
|
111646
111727
|
match = formatter.call(self2, val);
|
|
@@ -111649,25 +111730,25 @@ var require_common2 = __commonJS({
|
|
|
111649
111730
|
}
|
|
111650
111731
|
return match;
|
|
111651
111732
|
});
|
|
111652
|
-
|
|
111653
|
-
const logFn = self2.log ||
|
|
111733
|
+
createDebug41.formatArgs.call(self2, args);
|
|
111734
|
+
const logFn = self2.log || createDebug41.log;
|
|
111654
111735
|
logFn.apply(self2, args);
|
|
111655
111736
|
}
|
|
111656
|
-
|
|
111657
|
-
|
|
111658
|
-
|
|
111659
|
-
|
|
111660
|
-
|
|
111661
|
-
Object.defineProperty(
|
|
111737
|
+
debug41.namespace = namespace;
|
|
111738
|
+
debug41.useColors = createDebug41.useColors();
|
|
111739
|
+
debug41.color = createDebug41.selectColor(namespace);
|
|
111740
|
+
debug41.extend = extend2;
|
|
111741
|
+
debug41.destroy = createDebug41.destroy;
|
|
111742
|
+
Object.defineProperty(debug41, "enabled", {
|
|
111662
111743
|
enumerable: true,
|
|
111663
111744
|
configurable: false,
|
|
111664
111745
|
get: () => {
|
|
111665
111746
|
if (enableOverride !== null) {
|
|
111666
111747
|
return enableOverride;
|
|
111667
111748
|
}
|
|
111668
|
-
if (namespacesCache !==
|
|
111669
|
-
namespacesCache =
|
|
111670
|
-
enabledCache =
|
|
111749
|
+
if (namespacesCache !== createDebug41.namespaces) {
|
|
111750
|
+
namespacesCache = createDebug41.namespaces;
|
|
111751
|
+
enabledCache = createDebug41.enabled(namespace);
|
|
111671
111752
|
}
|
|
111672
111753
|
return enabledCache;
|
|
111673
111754
|
},
|
|
@@ -111675,27 +111756,27 @@ var require_common2 = __commonJS({
|
|
|
111675
111756
|
enableOverride = v4;
|
|
111676
111757
|
}
|
|
111677
111758
|
});
|
|
111678
|
-
if (typeof
|
|
111679
|
-
|
|
111759
|
+
if (typeof createDebug41.init === "function") {
|
|
111760
|
+
createDebug41.init(debug41);
|
|
111680
111761
|
}
|
|
111681
|
-
return
|
|
111762
|
+
return debug41;
|
|
111682
111763
|
}
|
|
111683
111764
|
function extend2(namespace, delimiter) {
|
|
111684
|
-
const newDebug =
|
|
111765
|
+
const newDebug = createDebug41(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
111685
111766
|
newDebug.log = this.log;
|
|
111686
111767
|
return newDebug;
|
|
111687
111768
|
}
|
|
111688
111769
|
function enable(namespaces) {
|
|
111689
|
-
|
|
111690
|
-
|
|
111691
|
-
|
|
111692
|
-
|
|
111770
|
+
createDebug41.save(namespaces);
|
|
111771
|
+
createDebug41.namespaces = namespaces;
|
|
111772
|
+
createDebug41.names = [];
|
|
111773
|
+
createDebug41.skips = [];
|
|
111693
111774
|
const split2 = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
111694
111775
|
for (const ns of split2) {
|
|
111695
111776
|
if (ns[0] === "-") {
|
|
111696
|
-
|
|
111777
|
+
createDebug41.skips.push(ns.slice(1));
|
|
111697
111778
|
} else {
|
|
111698
|
-
|
|
111779
|
+
createDebug41.names.push(ns);
|
|
111699
111780
|
}
|
|
111700
111781
|
}
|
|
111701
111782
|
}
|
|
@@ -111729,19 +111810,19 @@ var require_common2 = __commonJS({
|
|
|
111729
111810
|
}
|
|
111730
111811
|
function disable() {
|
|
111731
111812
|
const namespaces = [
|
|
111732
|
-
...
|
|
111733
|
-
...
|
|
111813
|
+
...createDebug41.names,
|
|
111814
|
+
...createDebug41.skips.map((namespace) => "-" + namespace)
|
|
111734
111815
|
].join(",");
|
|
111735
|
-
|
|
111816
|
+
createDebug41.enable("");
|
|
111736
111817
|
return namespaces;
|
|
111737
111818
|
}
|
|
111738
111819
|
function enabled(name) {
|
|
111739
|
-
for (const skip of
|
|
111820
|
+
for (const skip of createDebug41.skips) {
|
|
111740
111821
|
if (matchesTemplate(name, skip)) {
|
|
111741
111822
|
return false;
|
|
111742
111823
|
}
|
|
111743
111824
|
}
|
|
111744
|
-
for (const ns of
|
|
111825
|
+
for (const ns of createDebug41.names) {
|
|
111745
111826
|
if (matchesTemplate(name, ns)) {
|
|
111746
111827
|
return true;
|
|
111747
111828
|
}
|
|
@@ -111757,8 +111838,8 @@ var require_common2 = __commonJS({
|
|
|
111757
111838
|
function destroy() {
|
|
111758
111839
|
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
111840
|
}
|
|
111760
|
-
|
|
111761
|
-
return
|
|
111841
|
+
createDebug41.enable(createDebug41.load());
|
|
111842
|
+
return createDebug41;
|
|
111762
111843
|
}
|
|
111763
111844
|
module2.exports = setup;
|
|
111764
111845
|
}
|
|
@@ -111902,14 +111983,14 @@ var require_browser = __commonJS({
|
|
|
111902
111983
|
} else {
|
|
111903
111984
|
exports2.storage.removeItem("debug");
|
|
111904
111985
|
}
|
|
111905
|
-
} catch (
|
|
111986
|
+
} catch (error5) {
|
|
111906
111987
|
}
|
|
111907
111988
|
}
|
|
111908
111989
|
function load() {
|
|
111909
111990
|
let r3;
|
|
111910
111991
|
try {
|
|
111911
111992
|
r3 = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
|
|
111912
|
-
} catch (
|
|
111993
|
+
} catch (error5) {
|
|
111913
111994
|
}
|
|
111914
111995
|
if (!r3 && typeof process !== "undefined" && "env" in process) {
|
|
111915
111996
|
r3 = process.env.DEBUG;
|
|
@@ -111919,7 +112000,7 @@ var require_browser = __commonJS({
|
|
|
111919
112000
|
function localstorage() {
|
|
111920
112001
|
try {
|
|
111921
112002
|
return localStorage;
|
|
111922
|
-
} catch (
|
|
112003
|
+
} catch (error5) {
|
|
111923
112004
|
}
|
|
111924
112005
|
}
|
|
111925
112006
|
module2.exports = require_common2()(exports2);
|
|
@@ -111927,8 +112008,8 @@ var require_browser = __commonJS({
|
|
|
111927
112008
|
formatters.j = function(v4) {
|
|
111928
112009
|
try {
|
|
111929
112010
|
return JSON.stringify(v4);
|
|
111930
|
-
} catch (
|
|
111931
|
-
return "[UnexpectedJSONParseError]: " +
|
|
112011
|
+
} catch (error5) {
|
|
112012
|
+
return "[UnexpectedJSONParseError]: " + error5.message;
|
|
111932
112013
|
}
|
|
111933
112014
|
};
|
|
111934
112015
|
}
|
|
@@ -112148,7 +112229,7 @@ var require_node = __commonJS({
|
|
|
112148
112229
|
221
|
|
112149
112230
|
];
|
|
112150
112231
|
}
|
|
112151
|
-
} catch (
|
|
112232
|
+
} catch (error5) {
|
|
112152
112233
|
}
|
|
112153
112234
|
exports2.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
112154
112235
|
return /^debug_/i.test(key);
|
|
@@ -112203,11 +112284,11 @@ var require_node = __commonJS({
|
|
|
112203
112284
|
function load() {
|
|
112204
112285
|
return process.env.DEBUG;
|
|
112205
112286
|
}
|
|
112206
|
-
function init(
|
|
112207
|
-
|
|
112287
|
+
function init(debug41) {
|
|
112288
|
+
debug41.inspectOpts = {};
|
|
112208
112289
|
const keys = Object.keys(exports2.inspectOpts);
|
|
112209
112290
|
for (let i3 = 0; i3 < keys.length; i3++) {
|
|
112210
|
-
|
|
112291
|
+
debug41.inspectOpts[keys[i3]] = exports2.inspectOpts[keys[i3]];
|
|
112211
112292
|
}
|
|
112212
112293
|
}
|
|
112213
112294
|
module2.exports = require_common2()(exports2);
|
|
@@ -112761,7 +112842,10 @@ var init_configuration_schema2 = __esm({
|
|
|
112761
112842
|
paymentMethods: PaymentMethodSchema.array().optional().default(() => []),
|
|
112762
112843
|
facetFieldsForSearch: array(string2()).default(() => []),
|
|
112763
112844
|
listPriceChannelKey: string2().optional(),
|
|
112764
|
-
customerPriceChannelKey: string2().optional()
|
|
112845
|
+
customerPriceChannelKey: string2().optional(),
|
|
112846
|
+
bopis: looseObject({
|
|
112847
|
+
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".' })
|
|
112848
|
+
}).optional().meta({ description: "Optional buy-online-pickup-in-store (BOPIS) configuration." })
|
|
112765
112849
|
});
|
|
112766
112850
|
}
|
|
112767
112851
|
});
|
|
@@ -113104,6 +113188,41 @@ var init_payment_protocol_data = __esm({
|
|
|
113104
113188
|
}
|
|
113105
113189
|
});
|
|
113106
113190
|
|
|
113191
|
+
// packages/commercetools/src/core/shipping-protocol-data.ts
|
|
113192
|
+
function serializeShippingProtocolData(entries) {
|
|
113193
|
+
return JSON.stringify(Object.fromEntries(entries.map((entry) => [entry.key, entry.value])));
|
|
113194
|
+
}
|
|
113195
|
+
function parseShippingProtocolDataField(value) {
|
|
113196
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
113197
|
+
return void 0;
|
|
113198
|
+
}
|
|
113199
|
+
try {
|
|
113200
|
+
const parsed = JSON.parse(value);
|
|
113201
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
113202
|
+
return void 0;
|
|
113203
|
+
}
|
|
113204
|
+
const entries = [];
|
|
113205
|
+
for (const [key, entry] of Object.entries(parsed)) {
|
|
113206
|
+
if (typeof entry === "string") {
|
|
113207
|
+
entries.push({ key, value: entry });
|
|
113208
|
+
} else if (typeof entry === "object" && entry !== null && !Array.isArray(entry)) {
|
|
113209
|
+
entries.push({ key, value: entry });
|
|
113210
|
+
}
|
|
113211
|
+
}
|
|
113212
|
+
return entries.length > 0 ? entries : void 0;
|
|
113213
|
+
} catch {
|
|
113214
|
+
return void 0;
|
|
113215
|
+
}
|
|
113216
|
+
}
|
|
113217
|
+
var SHIPPING_PROTOCOL_DATA_FIELD, PICKUP_STORE_FIELD;
|
|
113218
|
+
var init_shipping_protocol_data = __esm({
|
|
113219
|
+
"packages/commercetools/src/core/shipping-protocol-data.ts"() {
|
|
113220
|
+
"use strict";
|
|
113221
|
+
SHIPPING_PROTOCOL_DATA_FIELD = "shippingProtocolData";
|
|
113222
|
+
PICKUP_STORE_FIELD = "pickupStoreKey";
|
|
113223
|
+
}
|
|
113224
|
+
});
|
|
113225
|
+
|
|
113107
113226
|
// packages/commercetools/src/factories/checkout/checkout.factory.ts
|
|
113108
113227
|
var CommercetoolsCheckoutFactory;
|
|
113109
113228
|
var init_checkout_factory2 = __esm({
|
|
@@ -113112,6 +113231,7 @@ var init_checkout_factory2 = __esm({
|
|
|
113112
113231
|
init_payment_protocol_data();
|
|
113113
113232
|
init_src();
|
|
113114
113233
|
init_locale_utils();
|
|
113234
|
+
init_shipping_protocol_data();
|
|
113115
113235
|
CommercetoolsCheckoutFactory = class {
|
|
113116
113236
|
checkoutSchema;
|
|
113117
113237
|
shippingMethodSchema;
|
|
@@ -113330,13 +113450,20 @@ var init_checkout_factory2 = __esm({
|
|
|
113330
113450
|
const instructions = data.custom?.fields["shippingInstruction"] || "";
|
|
113331
113451
|
const consentForUnattendedDelivery = data.custom?.fields["consentForUnattendedDelivery"] === "true";
|
|
113332
113452
|
const pickupPoint = data.custom?.fields["pickupPointId"] || "";
|
|
113453
|
+
const pickupStoreKey = data.custom?.fields[PICKUP_STORE_FIELD];
|
|
113454
|
+
const store = typeof pickupStoreKey === "string" && pickupStoreKey.length > 0 ? { key: pickupStoreKey } : void 0;
|
|
113455
|
+
const protocolData = parseShippingProtocolDataField(
|
|
113456
|
+
data.custom?.fields[SHIPPING_PROTOCOL_DATA_FIELD]
|
|
113457
|
+
);
|
|
113333
113458
|
const result = {
|
|
113334
113459
|
shippingMethod: {
|
|
113335
113460
|
key: data.shippingInfo.shippingMethod?.obj?.key || ""
|
|
113336
113461
|
},
|
|
113337
113462
|
pickupPoint,
|
|
113338
113463
|
instructions,
|
|
113339
|
-
consentForUnattendedDelivery
|
|
113464
|
+
consentForUnattendedDelivery,
|
|
113465
|
+
store,
|
|
113466
|
+
protocolData
|
|
113340
113467
|
};
|
|
113341
113468
|
return result;
|
|
113342
113469
|
}
|
|
@@ -114800,10 +114927,10 @@ var init_category_capability2 = __esm({
|
|
|
114800
114927
|
}
|
|
114801
114928
|
}
|
|
114802
114929
|
path2.push(category);
|
|
114803
|
-
} catch (
|
|
114930
|
+
} catch (error5) {
|
|
114804
114931
|
console.error(
|
|
114805
114932
|
`Error fetching category path for ${payload.id.key}:`,
|
|
114806
|
-
|
|
114933
|
+
error5
|
|
114807
114934
|
);
|
|
114808
114935
|
}
|
|
114809
114936
|
return success(path2);
|
|
@@ -114825,10 +114952,10 @@ var init_category_capability2 = __esm({
|
|
|
114825
114952
|
}).execute();
|
|
114826
114953
|
const result = this.factory.parseCategoryPaginatedResult(this.context, response.body, payload);
|
|
114827
114954
|
return success(result);
|
|
114828
|
-
} catch (
|
|
114955
|
+
} catch (error5) {
|
|
114829
114956
|
console.error(
|
|
114830
114957
|
`Error fetching category path for ${payload.parentId.key}:`,
|
|
114831
|
-
|
|
114958
|
+
error5
|
|
114832
114959
|
);
|
|
114833
114960
|
}
|
|
114834
114961
|
const empty = {
|
|
@@ -114854,8 +114981,8 @@ var init_category_capability2 = __esm({
|
|
|
114854
114981
|
}).execute();
|
|
114855
114982
|
const result = this.factory.parseCategoryPaginatedResult(this.context, response.body, payload);
|
|
114856
114983
|
return success(result);
|
|
114857
|
-
} catch (
|
|
114858
|
-
console.error(`Error fetching category top categories:`,
|
|
114984
|
+
} catch (error5) {
|
|
114985
|
+
console.error(`Error fetching category top categories:`, error5);
|
|
114859
114986
|
}
|
|
114860
114987
|
const empty = {
|
|
114861
114988
|
items: [],
|
|
@@ -114904,6 +115031,16 @@ var init_category_capability2 = __esm({
|
|
|
114904
115031
|
}
|
|
114905
115032
|
});
|
|
114906
115033
|
|
|
115034
|
+
// packages/commercetools/src/core/shipping-fulfillment.ts
|
|
115035
|
+
function resolveShippingFulfillmentType(shippingMethod, bopisShippingMethodKeys) {
|
|
115036
|
+
return shippingMethod.key && (bopisShippingMethodKeys || []).includes(shippingMethod.key) ? "pickup" : "delivery";
|
|
115037
|
+
}
|
|
115038
|
+
var init_shipping_fulfillment = __esm({
|
|
115039
|
+
"packages/commercetools/src/core/shipping-fulfillment.ts"() {
|
|
115040
|
+
"use strict";
|
|
115041
|
+
}
|
|
115042
|
+
});
|
|
115043
|
+
|
|
114907
115044
|
// packages/commercetools/src/schema/commercetools.schema.ts
|
|
114908
115045
|
var CommercetoolsCartIdentifierSchema, CommercetoolsProductListIdentifierSchema, CommercetoolsCartItemIdentifierSchema, CommercetoolsOrderIdentifierSchema, CommercetoolsCheckoutIdentifierSchema, CommercetoolsResolveCategoryQueryByKeySchema, CommercetoolsResolveCategoryQueryByIdSchema, CommercetoolsCategoryLookupSchema, CommercetoolsEmployeeInviteCustomObjectValueSchema, CommercetoolsEmployeeInviteCustomObjectSchema;
|
|
114909
115046
|
var init_commercetools_schema = __esm({
|
|
@@ -114964,6 +115101,8 @@ var init_checkout_capability2 = __esm({
|
|
|
114964
115101
|
"packages/commercetools/src/capabilities/checkout.capability.ts"() {
|
|
114965
115102
|
"use strict";
|
|
114966
115103
|
init_payment_protocol_data();
|
|
115104
|
+
init_shipping_protocol_data();
|
|
115105
|
+
init_shipping_fulfillment();
|
|
114967
115106
|
init_src();
|
|
114968
115107
|
init_zod();
|
|
114969
115108
|
init_locale_utils();
|
|
@@ -115110,10 +115249,25 @@ var init_checkout_capability2 = __esm({
|
|
|
115110
115249
|
client.carts.withId({ ID: payload.checkout.key }).get().execute()
|
|
115111
115250
|
]);
|
|
115112
115251
|
const result = shippingMethodsResponse.body.results.map(
|
|
115113
|
-
(shippingMethod) => this.
|
|
115252
|
+
(shippingMethod) => this.withFulfillmentType(
|
|
115253
|
+
this.factory.parseShippingMethod(this.context, this.withFreeShipping(shippingMethod, cartResponse.body)),
|
|
115254
|
+
shippingMethod
|
|
115255
|
+
)
|
|
115114
115256
|
);
|
|
115115
115257
|
return success(result);
|
|
115116
115258
|
}
|
|
115259
|
+
/**
|
|
115260
|
+
* Tags a parsed shipping method with its fulfillment type: methods whose
|
|
115261
|
+
* key is listed in the `bopis.shippingMethodKeys` configuration are
|
|
115262
|
+
* in-store pickup (BOPIS), everything else is a delivery. The tagging lives
|
|
115263
|
+
* here rather than in the factory, so factories stay configuration-free.
|
|
115264
|
+
*/
|
|
115265
|
+
withFulfillmentType(shippingMethod, remote) {
|
|
115266
|
+
return {
|
|
115267
|
+
...shippingMethod,
|
|
115268
|
+
fulfillmentType: resolveShippingFulfillmentType(remote, this.config.bopis?.shippingMethodKeys)
|
|
115269
|
+
};
|
|
115270
|
+
}
|
|
115117
115271
|
/**
|
|
115118
115272
|
* Quotes the matching shipping rates as free where the cart reaches the
|
|
115119
115273
|
* rate's free-above threshold. commercetools' matching-cart query returns
|
|
@@ -115225,6 +115379,20 @@ var init_checkout_capability2 = __esm({
|
|
|
115225
115379
|
name: "pickupPointId",
|
|
115226
115380
|
value: payload.shippingInstruction.pickupPoint
|
|
115227
115381
|
});
|
|
115382
|
+
if (payload.shippingInstruction.store?.key) {
|
|
115383
|
+
actions.push({
|
|
115384
|
+
action: "setCustomField",
|
|
115385
|
+
name: PICKUP_STORE_FIELD,
|
|
115386
|
+
value: payload.shippingInstruction.store.key
|
|
115387
|
+
});
|
|
115388
|
+
}
|
|
115389
|
+
if (payload.shippingInstruction.protocolData && payload.shippingInstruction.protocolData.length > 0) {
|
|
115390
|
+
actions.push({
|
|
115391
|
+
action: "setCustomField",
|
|
115392
|
+
name: SHIPPING_PROTOCOL_DATA_FIELD,
|
|
115393
|
+
value: serializeShippingProtocolData(payload.shippingInstruction.protocolData)
|
|
115394
|
+
});
|
|
115395
|
+
}
|
|
115228
115396
|
const result = await this.applyActions(
|
|
115229
115397
|
payload.checkout,
|
|
115230
115398
|
actions
|
|
@@ -116800,9 +116968,9 @@ var init_product_search_capability3 = __esm({
|
|
|
116800
116968
|
continue;
|
|
116801
116969
|
}
|
|
116802
116970
|
facetValue.name = category.name[this.languageCode] || category.id;
|
|
116803
|
-
} catch (
|
|
116971
|
+
} catch (error5) {
|
|
116804
116972
|
if (debug3.enabled) {
|
|
116805
|
-
debug3(`Error resolving category key for id ${facetValue.identifier.key}:`,
|
|
116973
|
+
debug3(`Error resolving category key for id ${facetValue.identifier.key}:`, error5);
|
|
116806
116974
|
}
|
|
116807
116975
|
}
|
|
116808
116976
|
}
|
|
@@ -117199,6 +117367,48 @@ var init_store_capability2 = __esm({
|
|
|
117199
117367
|
}
|
|
117200
117368
|
return success(results);
|
|
117201
117369
|
}
|
|
117370
|
+
/**
|
|
117371
|
+
* The channel predicate selecting the channels that represent the brand's
|
|
117372
|
+
* own stores. Override in a subclass if a project models stores differently.
|
|
117373
|
+
*/
|
|
117374
|
+
getStoreChannelPredicate() {
|
|
117375
|
+
return 'roles contains any ("InventorySupply")';
|
|
117376
|
+
}
|
|
117377
|
+
async list(payload) {
|
|
117378
|
+
const client = await this.getClient();
|
|
117379
|
+
const { pageNumber, pageSize } = payload.paginationOptions;
|
|
117380
|
+
const remote = await client.channels().get({
|
|
117381
|
+
queryArgs: {
|
|
117382
|
+
limit: pageSize,
|
|
117383
|
+
offset: (pageNumber - 1) * pageSize,
|
|
117384
|
+
withTotal: true,
|
|
117385
|
+
where: this.getStoreChannelPredicate()
|
|
117386
|
+
}
|
|
117387
|
+
}).execute();
|
|
117388
|
+
const totalCount = remote.body.total ?? remote.body.results.length;
|
|
117389
|
+
return success({
|
|
117390
|
+
pageNumber,
|
|
117391
|
+
pageSize,
|
|
117392
|
+
totalCount,
|
|
117393
|
+
totalPages: Math.ceil(totalCount / pageSize),
|
|
117394
|
+
items: remote.body.results.map((r3) => this.factory.parseStore(this.context, r3))
|
|
117395
|
+
});
|
|
117396
|
+
}
|
|
117397
|
+
async getById(payload) {
|
|
117398
|
+
const client = await this.getClient();
|
|
117399
|
+
const remote = await client.channels().get({
|
|
117400
|
+
queryArgs: {
|
|
117401
|
+
limit: 1,
|
|
117402
|
+
where: `key = :key AND ${this.getStoreChannelPredicate()}`,
|
|
117403
|
+
"var.key": payload.identifier.key
|
|
117404
|
+
}
|
|
117405
|
+
}).execute();
|
|
117406
|
+
const channel = remote.body.results[0];
|
|
117407
|
+
if (!channel) {
|
|
117408
|
+
return error2({ type: "NotFound", identifier: payload.identifier });
|
|
117409
|
+
}
|
|
117410
|
+
return success(this.factory.parseStore(this.context, channel));
|
|
117411
|
+
}
|
|
117202
117412
|
};
|
|
117203
117413
|
__decorateClass([
|
|
117204
117414
|
Reactionary({
|
|
@@ -117206,6 +117416,18 @@ var init_store_capability2 = __esm({
|
|
|
117206
117416
|
outputSchema: array(StoreSchema)
|
|
117207
117417
|
})
|
|
117208
117418
|
], CommercetoolsStoreCapability.prototype, "queryByProximity", 1);
|
|
117419
|
+
__decorateClass([
|
|
117420
|
+
Reactionary({
|
|
117421
|
+
inputSchema: StoreQueryForListSchema,
|
|
117422
|
+
outputSchema: StorePaginatedResultSchema
|
|
117423
|
+
})
|
|
117424
|
+
], CommercetoolsStoreCapability.prototype, "list", 1);
|
|
117425
|
+
__decorateClass([
|
|
117426
|
+
Reactionary({
|
|
117427
|
+
inputSchema: StoreQueryByIdSchema,
|
|
117428
|
+
outputSchema: StoreSchema
|
|
117429
|
+
})
|
|
117430
|
+
], CommercetoolsStoreCapability.prototype, "getById", 1);
|
|
117209
117431
|
}
|
|
117210
117432
|
});
|
|
117211
117433
|
|
|
@@ -117302,11 +117524,11 @@ var init_company_registration_capability2 = __esm({
|
|
|
117302
117524
|
message: "Only registered users can check company registration status"
|
|
117303
117525
|
});
|
|
117304
117526
|
}
|
|
117305
|
-
const response = await client.businessUnits().withId({ ID: payload.requestIdentifier.key }).get().execute().catch((
|
|
117306
|
-
if (
|
|
117527
|
+
const response = await client.businessUnits().withId({ ID: payload.requestIdentifier.key }).get().execute().catch((error5) => {
|
|
117528
|
+
if (error5?.statusCode === 404) {
|
|
117307
117529
|
return null;
|
|
117308
117530
|
}
|
|
117309
|
-
throw
|
|
117531
|
+
throw error5;
|
|
117310
117532
|
});
|
|
117311
117533
|
if (!response) {
|
|
117312
117534
|
return error2({
|
|
@@ -118216,11 +118438,11 @@ var init_employee_invitation_capability2 = __esm({
|
|
|
118216
118438
|
const response = await adminClient.customObjects().withContainerAndKey({
|
|
118217
118439
|
container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS_INDEX,
|
|
118218
118440
|
key
|
|
118219
|
-
}).get().execute().catch((
|
|
118220
|
-
if (
|
|
118441
|
+
}).get().execute().catch((error5) => {
|
|
118442
|
+
if (error5?.statusCode === 404) {
|
|
118221
118443
|
return null;
|
|
118222
118444
|
}
|
|
118223
|
-
throw
|
|
118445
|
+
throw error5;
|
|
118224
118446
|
});
|
|
118225
118447
|
if (!response) {
|
|
118226
118448
|
return [];
|
|
@@ -118279,11 +118501,11 @@ var init_employee_invitation_capability2 = __esm({
|
|
|
118279
118501
|
allInviteIds = allInviteIds.slice(start, end);
|
|
118280
118502
|
}
|
|
118281
118503
|
for (const invitationId of allInviteIds) {
|
|
118282
|
-
const invitationResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationId }).get().execute().catch((
|
|
118283
|
-
if (
|
|
118504
|
+
const invitationResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationId }).get().execute().catch((error5) => {
|
|
118505
|
+
if (error5?.statusCode === 404) {
|
|
118284
118506
|
return null;
|
|
118285
118507
|
}
|
|
118286
|
-
throw
|
|
118508
|
+
throw error5;
|
|
118287
118509
|
});
|
|
118288
118510
|
const invitation = invitationResponse?.body;
|
|
118289
118511
|
if (!invitation) {
|
|
@@ -118306,11 +118528,11 @@ var init_employee_invitation_capability2 = __esm({
|
|
|
118306
118528
|
return this.fetchInvitations(adminClient, this.makeKeyFromEmail(userEmail), onlyActive, paginationOptions);
|
|
118307
118529
|
}
|
|
118308
118530
|
async fetchInvitationByKey(adminClient, invitationKey) {
|
|
118309
|
-
const inviteResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationKey }).get().execute().catch((
|
|
118310
|
-
if (
|
|
118531
|
+
const inviteResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationKey }).get().execute().catch((error5) => {
|
|
118532
|
+
if (error5?.statusCode === 404) {
|
|
118311
118533
|
return null;
|
|
118312
118534
|
}
|
|
118313
|
-
throw
|
|
118535
|
+
throw error5;
|
|
118314
118536
|
});
|
|
118315
118537
|
if (!inviteResponse) {
|
|
118316
118538
|
return null;
|
|
@@ -118414,11 +118636,11 @@ var init_employee_invitation_capability2 = __esm({
|
|
|
118414
118636
|
error: `Invitation token is invalid.`
|
|
118415
118637
|
});
|
|
118416
118638
|
}
|
|
118417
|
-
const businessUnit = await adminClient.businessUnits().withKey({ key: invitation.value.company.taxIdentifier }).get().execute().catch((
|
|
118418
|
-
if (
|
|
118639
|
+
const businessUnit = await adminClient.businessUnits().withKey({ key: invitation.value.company.taxIdentifier }).get().execute().catch((error5) => {
|
|
118640
|
+
if (error5?.statusCode === 404) {
|
|
118419
118641
|
return null;
|
|
118420
118642
|
}
|
|
118421
|
-
throw
|
|
118643
|
+
throw error5;
|
|
118422
118644
|
});
|
|
118423
118645
|
if (!businessUnit) {
|
|
118424
118646
|
return error2({
|
|
@@ -123052,6 +123274,7 @@ var init_store_capability3 = __esm({
|
|
|
123052
123274
|
init_src();
|
|
123053
123275
|
init_zod();
|
|
123054
123276
|
init_dist();
|
|
123277
|
+
init_seed();
|
|
123055
123278
|
FakeStoreCapability = class extends StoreCapability {
|
|
123056
123279
|
config;
|
|
123057
123280
|
factory;
|
|
@@ -123060,26 +123283,82 @@ var init_store_capability3 = __esm({
|
|
|
123060
123283
|
this.config = config3;
|
|
123061
123284
|
this.factory = factory;
|
|
123062
123285
|
}
|
|
123063
|
-
|
|
123286
|
+
/**
|
|
123287
|
+
* The countries the fake brand has physical stores in.
|
|
123288
|
+
*/
|
|
123289
|
+
getStoreCountries() {
|
|
123290
|
+
return ["DK", "SE", "NO", "FI", "US"];
|
|
123291
|
+
}
|
|
123292
|
+
/**
|
|
123293
|
+
* How many physical stores the seed generates per country.
|
|
123294
|
+
*/
|
|
123295
|
+
getStoresPerCountry() {
|
|
123296
|
+
return 3;
|
|
123297
|
+
}
|
|
123298
|
+
/**
|
|
123299
|
+
* The seeded set of physical stores: a fixed number per country, generated
|
|
123300
|
+
* deterministically from the store key.
|
|
123301
|
+
*/
|
|
123302
|
+
getSeededStores() {
|
|
123303
|
+
const stores = [];
|
|
123304
|
+
for (const country of this.getStoreCountries()) {
|
|
123305
|
+
for (let i3 = 1; i3 <= this.getStoresPerCountry(); i3++) {
|
|
123306
|
+
stores.push(this.generateStore(`${country.toLowerCase()}-${i3}`, country));
|
|
123307
|
+
}
|
|
123308
|
+
}
|
|
123309
|
+
return stores;
|
|
123310
|
+
}
|
|
123311
|
+
generateStore(key, countryCode) {
|
|
123064
123312
|
const generator = new Qe2({
|
|
123065
|
-
seed:
|
|
123313
|
+
seed: calcSeed(key),
|
|
123066
123314
|
locale: [ys, Oi]
|
|
123067
123315
|
});
|
|
123068
|
-
const
|
|
123069
|
-
|
|
123070
|
-
|
|
123071
|
-
|
|
123072
|
-
|
|
123073
|
-
|
|
123074
|
-
|
|
123075
|
-
|
|
123076
|
-
|
|
123077
|
-
|
|
123078
|
-
|
|
123079
|
-
|
|
123080
|
-
|
|
123316
|
+
const city = generator.location.city();
|
|
123317
|
+
return this.factory.parseStore(this.context, {
|
|
123318
|
+
identifier: {
|
|
123319
|
+
key
|
|
123320
|
+
},
|
|
123321
|
+
fulfillmentCenter: {
|
|
123322
|
+
key
|
|
123323
|
+
},
|
|
123324
|
+
name: `${generator.company.name()} ${city}`,
|
|
123325
|
+
address: {
|
|
123326
|
+
identifier: { nickName: key },
|
|
123327
|
+
firstName: "",
|
|
123328
|
+
lastName: "",
|
|
123329
|
+
streetAddress: generator.location.streetAddress(),
|
|
123330
|
+
streetNumber: "",
|
|
123331
|
+
city,
|
|
123332
|
+
region: "",
|
|
123333
|
+
postalCode: generator.location.zipCode("####"),
|
|
123334
|
+
countryCode
|
|
123335
|
+
},
|
|
123336
|
+
openingHours: "Mon-Fri 10am-6pm, Sat 10am-3pm"
|
|
123337
|
+
});
|
|
123338
|
+
}
|
|
123339
|
+
async queryByProximity(payload) {
|
|
123340
|
+
return success(this.getSeededStores().slice(0, payload.limit));
|
|
123341
|
+
}
|
|
123342
|
+
async list(payload) {
|
|
123343
|
+
const stores = this.getSeededStores();
|
|
123344
|
+
const { pageNumber, pageSize } = payload.paginationOptions;
|
|
123345
|
+
const startIndex = (pageNumber - 1) * pageSize;
|
|
123346
|
+
return success({
|
|
123347
|
+
pageNumber,
|
|
123348
|
+
pageSize,
|
|
123349
|
+
totalCount: stores.length,
|
|
123350
|
+
totalPages: Math.ceil(stores.length / pageSize),
|
|
123351
|
+
items: stores.slice(startIndex, startIndex + pageSize)
|
|
123352
|
+
});
|
|
123353
|
+
}
|
|
123354
|
+
async getById(payload) {
|
|
123355
|
+
const store = this.getSeededStores().find(
|
|
123356
|
+
(candidate) => candidate.identifier.key === payload.identifier.key
|
|
123357
|
+
);
|
|
123358
|
+
if (!store) {
|
|
123359
|
+
return error2({ type: "NotFound", identifier: payload.identifier });
|
|
123081
123360
|
}
|
|
123082
|
-
return success(
|
|
123361
|
+
return success(store);
|
|
123083
123362
|
}
|
|
123084
123363
|
};
|
|
123085
123364
|
__decorateClass([
|
|
@@ -123088,6 +123367,18 @@ var init_store_capability3 = __esm({
|
|
|
123088
123367
|
outputSchema: array(StoreSchema)
|
|
123089
123368
|
})
|
|
123090
123369
|
], FakeStoreCapability.prototype, "queryByProximity", 1);
|
|
123370
|
+
__decorateClass([
|
|
123371
|
+
Reactionary({
|
|
123372
|
+
inputSchema: StoreQueryForListSchema,
|
|
123373
|
+
outputSchema: StorePaginatedResultSchema
|
|
123374
|
+
})
|
|
123375
|
+
], FakeStoreCapability.prototype, "list", 1);
|
|
123376
|
+
__decorateClass([
|
|
123377
|
+
Reactionary({
|
|
123378
|
+
inputSchema: StoreQueryByIdSchema,
|
|
123379
|
+
outputSchema: StoreSchema
|
|
123380
|
+
})
|
|
123381
|
+
], FakeStoreCapability.prototype, "getById", 1);
|
|
123091
123382
|
}
|
|
123092
123383
|
});
|
|
123093
123384
|
|
|
@@ -128406,7 +128697,8 @@ var init_medusa_schema = __esm({
|
|
|
128406
128697
|
token: string2().optional(),
|
|
128407
128698
|
expires: string2().optional(),
|
|
128408
128699
|
allRegions: array(MedusaRegionSchema).optional(),
|
|
128409
|
-
selectedRegion: MedusaRegionSchema.optional()
|
|
128700
|
+
selectedRegion: MedusaRegionSchema.optional(),
|
|
128701
|
+
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
128702
|
});
|
|
128411
128703
|
}
|
|
128412
128704
|
});
|
|
@@ -128442,7 +128734,8 @@ var init_capabilities_schema6 = __esm({
|
|
|
128442
128734
|
profile: true,
|
|
128443
128735
|
productAssociations: true,
|
|
128444
128736
|
personalizationProfile: true,
|
|
128445
|
-
company: true
|
|
128737
|
+
company: true,
|
|
128738
|
+
store: true
|
|
128446
128739
|
}).extend({
|
|
128447
128740
|
product: OverridableCapabilitySchema4.optional(),
|
|
128448
128741
|
productSearch: OverridableCapabilitySchema4.optional(),
|
|
@@ -128461,7 +128754,8 @@ var init_capabilities_schema6 = __esm({
|
|
|
128461
128754
|
profile: OverridableCapabilitySchema4.optional(),
|
|
128462
128755
|
productAssociations: OverridableCapabilitySchema4.optional(),
|
|
128463
128756
|
productRecommendations: DirectCapabilitySchema2.optional(),
|
|
128464
|
-
personalizationProfile: OverridableCapabilitySchema4.optional()
|
|
128757
|
+
personalizationProfile: OverridableCapabilitySchema4.optional(),
|
|
128758
|
+
store: OverridableCapabilitySchema4.optional()
|
|
128465
128759
|
}).partial();
|
|
128466
128760
|
}
|
|
128467
128761
|
});
|
|
@@ -138020,9 +138314,9 @@ var init_client5 = __esm({
|
|
|
138020
138314
|
return __asyncGenerator(this, arguments, function* () {
|
|
138021
138315
|
const res = yield __await(fetchPromise);
|
|
138022
138316
|
if (!res.ok) {
|
|
138023
|
-
const
|
|
138024
|
-
|
|
138025
|
-
throw
|
|
138317
|
+
const error5 = new Error(`Stream failed with status ${res.status}`);
|
|
138318
|
+
error5.name = "HttpError";
|
|
138319
|
+
throw error5;
|
|
138026
138320
|
}
|
|
138027
138321
|
yield __await(yield* __asyncDelegator(__asyncValues(events(res, abortController.signal))));
|
|
138028
138322
|
});
|
|
@@ -158181,10 +158475,10 @@ var init_client6 = __esm({
|
|
|
158181
158475
|
});
|
|
158182
158476
|
const identity = await this.login(email3, password, reqCtx);
|
|
158183
158477
|
return identity;
|
|
158184
|
-
} catch (
|
|
158185
|
-
debug21("Registration failed:",
|
|
158478
|
+
} catch (error5) {
|
|
158479
|
+
debug21("Registration failed:", error5);
|
|
158186
158480
|
throw new Error(
|
|
158187
|
-
`Registration failed: ${
|
|
158481
|
+
`Registration failed: ${error5 instanceof Error ? error5.message : "Unknown error"}`
|
|
158188
158482
|
);
|
|
158189
158483
|
}
|
|
158190
158484
|
}
|
|
@@ -158214,10 +158508,10 @@ var init_client6 = __esm({
|
|
|
158214
158508
|
return {
|
|
158215
158509
|
type: "Anonymous"
|
|
158216
158510
|
};
|
|
158217
|
-
} catch (
|
|
158218
|
-
debug21("Login failed:",
|
|
158511
|
+
} catch (error5) {
|
|
158512
|
+
debug21("Login failed:", error5);
|
|
158219
158513
|
throw new Error(
|
|
158220
|
-
`Login failed: ${
|
|
158514
|
+
`Login failed: ${error5 instanceof Error ? error5.message : "Unknown error"}`
|
|
158221
158515
|
);
|
|
158222
158516
|
}
|
|
158223
158517
|
}
|
|
@@ -158230,8 +158524,8 @@ var init_client6 = __esm({
|
|
|
158230
158524
|
await client.auth.logout();
|
|
158231
158525
|
await client.client.clearToken();
|
|
158232
158526
|
return identity;
|
|
158233
|
-
} catch (
|
|
158234
|
-
debug21("Logout failed:",
|
|
158527
|
+
} catch (error5) {
|
|
158528
|
+
debug21("Logout failed:", error5);
|
|
158235
158529
|
await client.client.clearToken();
|
|
158236
158530
|
return identity;
|
|
158237
158531
|
}
|
|
@@ -158258,8 +158552,8 @@ var init_client6 = __esm({
|
|
|
158258
158552
|
});
|
|
158259
158553
|
|
|
158260
158554
|
// packages/medusa/src/utils/medusa-helpers.ts
|
|
158261
|
-
function isNotFoundFetchError(
|
|
158262
|
-
return
|
|
158555
|
+
function isNotFoundFetchError(error5) {
|
|
158556
|
+
return error5 instanceof FetchError && error5.status === 404;
|
|
158263
158557
|
}
|
|
158264
158558
|
function parseMedusaCostBreakdown(remote) {
|
|
158265
158559
|
const grandTotal = remote.total || 0;
|
|
@@ -158318,12 +158612,12 @@ function parseMedusaItemPrice(remoteItem, currency) {
|
|
|
158318
158612
|
}
|
|
158319
158613
|
};
|
|
158320
158614
|
}
|
|
158321
|
-
function handleProviderError(action,
|
|
158615
|
+
function handleProviderError(action, error5) {
|
|
158322
158616
|
if (debug22.enabled) {
|
|
158323
|
-
debug22(`Failed to ${action}:`,
|
|
158617
|
+
debug22(`Failed to ${action}:`, error5);
|
|
158324
158618
|
}
|
|
158325
158619
|
throw new Error(
|
|
158326
|
-
`Failed to ${action}: ${
|
|
158620
|
+
`Failed to ${action}: ${error5 instanceof Error ? error5.message : "Unknown error"}`
|
|
158327
158621
|
);
|
|
158328
158622
|
}
|
|
158329
158623
|
function safeBoolConvert(val) {
|
|
@@ -158616,8 +158910,8 @@ var init_cart_capability5 = __esm({
|
|
|
158616
158910
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158617
158911
|
}
|
|
158618
158912
|
throw new Error("Failed to add item to cart");
|
|
158619
|
-
} catch (
|
|
158620
|
-
handleProviderError("add item to cart",
|
|
158913
|
+
} catch (error5) {
|
|
158914
|
+
handleProviderError("add item to cart", error5);
|
|
158621
158915
|
}
|
|
158622
158916
|
}
|
|
158623
158917
|
async renameCart(payload) {
|
|
@@ -158748,8 +159042,8 @@ var init_cart_capability5 = __esm({
|
|
|
158748
159042
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158749
159043
|
}
|
|
158750
159044
|
throw new Error("Failed to create cart");
|
|
158751
|
-
} catch (
|
|
158752
|
-
handleProviderError("create cart",
|
|
159045
|
+
} catch (error5) {
|
|
159046
|
+
handleProviderError("create cart", error5);
|
|
158753
159047
|
}
|
|
158754
159048
|
}
|
|
158755
159049
|
async remove(payload) {
|
|
@@ -158767,8 +159061,8 @@ var init_cart_capability5 = __esm({
|
|
|
158767
159061
|
return success(this.factory.parseCart(this.context, response.parent));
|
|
158768
159062
|
}
|
|
158769
159063
|
throw new Error("Failed to remove item from cart");
|
|
158770
|
-
} catch (
|
|
158771
|
-
handleProviderError("remove item from cart",
|
|
159064
|
+
} catch (error5) {
|
|
159065
|
+
handleProviderError("remove item from cart", error5);
|
|
158772
159066
|
}
|
|
158773
159067
|
}
|
|
158774
159068
|
/**
|
|
@@ -158802,8 +159096,8 @@ var init_cart_capability5 = __esm({
|
|
|
158802
159096
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158803
159097
|
}
|
|
158804
159098
|
throw new Error("Failed to change item quantity");
|
|
158805
|
-
} catch (
|
|
158806
|
-
handleProviderError("change item quantity",
|
|
159099
|
+
} catch (error5) {
|
|
159100
|
+
handleProviderError("change item quantity", error5);
|
|
158807
159101
|
}
|
|
158808
159102
|
}
|
|
158809
159103
|
async getActiveCartId() {
|
|
@@ -158896,8 +159190,8 @@ var init_cart_capability5 = __esm({
|
|
|
158896
159190
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158897
159191
|
}
|
|
158898
159192
|
throw new Error("Failed to apply coupon code");
|
|
158899
|
-
} catch (
|
|
158900
|
-
handleProviderError("apply coupon code",
|
|
159193
|
+
} catch (error5) {
|
|
159194
|
+
handleProviderError("apply coupon code", error5);
|
|
158901
159195
|
}
|
|
158902
159196
|
}
|
|
158903
159197
|
/**
|
|
@@ -158928,8 +159222,8 @@ var init_cart_capability5 = __esm({
|
|
|
158928
159222
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158929
159223
|
}
|
|
158930
159224
|
throw new Error("Failed to remove coupon code");
|
|
158931
|
-
} catch (
|
|
158932
|
-
handleProviderError("remove coupon code",
|
|
159225
|
+
} catch (error5) {
|
|
159226
|
+
handleProviderError("remove coupon code", error5);
|
|
158933
159227
|
}
|
|
158934
159228
|
}
|
|
158935
159229
|
/**
|
|
@@ -158961,8 +159255,8 @@ var init_cart_capability5 = __esm({
|
|
|
158961
159255
|
return success(this.factory.parseCart(this.context, updatedCartResponse.cart));
|
|
158962
159256
|
}
|
|
158963
159257
|
throw new Error("Failed to change currency");
|
|
158964
|
-
} catch (
|
|
158965
|
-
handleProviderError("change currency",
|
|
159258
|
+
} catch (error5) {
|
|
159259
|
+
handleProviderError("change currency", error5);
|
|
158966
159260
|
}
|
|
158967
159261
|
}
|
|
158968
159262
|
async getClient() {
|
|
@@ -159219,6 +159513,7 @@ var init_checkout_capability5 = __esm({
|
|
|
159219
159513
|
init_src();
|
|
159220
159514
|
import_debug24 = __toESM(require_src(), 1);
|
|
159221
159515
|
init_zod();
|
|
159516
|
+
init_client6();
|
|
159222
159517
|
init_medusa_helpers();
|
|
159223
159518
|
debug24 = (0, import_debug24.default)("reactionary:medusa:checkout");
|
|
159224
159519
|
CheckoutNotReadyForFinalizationError3 = class extends Error {
|
|
@@ -159248,6 +159543,16 @@ var init_checkout_capability5 = __esm({
|
|
|
159248
159543
|
* example: this.includedFields = [includedFields, '+discounts.*'].join(',');
|
|
159249
159544
|
*/
|
|
159250
159545
|
includedFields = ["+items.*", "+order.id", "+order.display_id", "+order.custom_display_id"].join(",");
|
|
159546
|
+
/**
|
|
159547
|
+
* This controls which fields are requested for the cart's shipping options.
|
|
159548
|
+
* You can override this in a subclass to add more fields as needed.
|
|
159549
|
+
*
|
|
159550
|
+
* The service zone's fulfillment set tells us whether an option is in-store
|
|
159551
|
+
* pickup (BOPIS) or a delivery, and the option metadata lets medusa-side
|
|
159552
|
+
* providers push additional data that is mapped to the shipping method's
|
|
159553
|
+
* protocolData.
|
|
159554
|
+
*/
|
|
159555
|
+
shippingOptionFields = ["*service_zone.fulfillment_set", "+metadata"].join(",");
|
|
159251
159556
|
initiateCheckoutForCartPayload(payload) {
|
|
159252
159557
|
return {
|
|
159253
159558
|
billing_address: payload.billingAddress ? this.mapAddressToStoreAddress(payload.billingAddress) : void 0,
|
|
@@ -159280,7 +159585,9 @@ var init_checkout_capability5 = __esm({
|
|
|
159280
159585
|
const response = await client.store.cart.retrieve(payload.identifier.key, {
|
|
159281
159586
|
fields: this.includedFields
|
|
159282
159587
|
});
|
|
159283
|
-
return success(
|
|
159588
|
+
return success(
|
|
159589
|
+
this.hydrateResultingOrder(this.factory.parseCheckout(this.context, response.cart))
|
|
159590
|
+
);
|
|
159284
159591
|
} catch (err) {
|
|
159285
159592
|
if (isNotFoundFetchError(err)) {
|
|
159286
159593
|
return error2({
|
|
@@ -159309,7 +159616,8 @@ var init_checkout_capability5 = __esm({
|
|
|
159309
159616
|
}
|
|
159310
159617
|
getAvailableShippingMethodsPayload(payload) {
|
|
159311
159618
|
return {
|
|
159312
|
-
cart_id: payload.checkout.key
|
|
159619
|
+
cart_id: payload.checkout.key,
|
|
159620
|
+
fields: this.shippingOptionFields
|
|
159313
159621
|
};
|
|
159314
159622
|
}
|
|
159315
159623
|
/**
|
|
@@ -159438,10 +159746,10 @@ var init_checkout_capability5 = __esm({
|
|
|
159438
159746
|
}
|
|
159439
159747
|
);
|
|
159440
159748
|
return success(this.factory.parseCheckout(this.context, updatedCartResponse.cart));
|
|
159441
|
-
} catch (
|
|
159442
|
-
debug24("Failed to add payment instruction: {0}", [
|
|
159749
|
+
} catch (error5) {
|
|
159750
|
+
debug24("Failed to add payment instruction: {0}", [error5]);
|
|
159443
159751
|
throw new Error(
|
|
159444
|
-
`Failed to add payment instruction: ${
|
|
159752
|
+
`Failed to add payment instruction: ${error5 instanceof Error ? error5.message : "Unknown error"}`
|
|
159445
159753
|
);
|
|
159446
159754
|
}
|
|
159447
159755
|
}
|
|
@@ -159457,6 +159765,50 @@ var init_checkout_capability5 = __esm({
|
|
|
159457
159765
|
}
|
|
159458
159766
|
};
|
|
159459
159767
|
}
|
|
159768
|
+
/**
|
|
159769
|
+
* Serializes the client-set shipping protocol data as a JSON object string
|
|
159770
|
+
* for persistence in the cart metadata, or undefined when none is set.
|
|
159771
|
+
*/
|
|
159772
|
+
serializeShippingProtocolData(protocolData) {
|
|
159773
|
+
if (!protocolData || protocolData.length === 0) {
|
|
159774
|
+
return void 0;
|
|
159775
|
+
}
|
|
159776
|
+
return JSON.stringify(
|
|
159777
|
+
Object.fromEntries(protocolData.map((entry) => [entry.key, entry.value]))
|
|
159778
|
+
);
|
|
159779
|
+
}
|
|
159780
|
+
/**
|
|
159781
|
+
* Resolves the shipping address to use for in-store pickup (BOPIS): the
|
|
159782
|
+
* address of the selected store, so the order ships to the store. Returns
|
|
159783
|
+
* undefined when the store or its address is unknown, leaving the cart's
|
|
159784
|
+
* shipping address untouched.
|
|
159785
|
+
*/
|
|
159786
|
+
async resolveStorePickupAddress(store) {
|
|
159787
|
+
try {
|
|
159788
|
+
const adminClient = await new MedusaAdminAPI(this.config, this.context).getClient();
|
|
159789
|
+
const response = await adminClient.admin.stockLocation.retrieve(store.key, {
|
|
159790
|
+
fields: "*address"
|
|
159791
|
+
});
|
|
159792
|
+
const address = response.stock_location?.address;
|
|
159793
|
+
if (!address) {
|
|
159794
|
+
return void 0;
|
|
159795
|
+
}
|
|
159796
|
+
return {
|
|
159797
|
+
firstName: "",
|
|
159798
|
+
lastName: response.stock_location.name,
|
|
159799
|
+
streetAddress: address.address_1 || "",
|
|
159800
|
+
streetNumber: address.address_2 || "",
|
|
159801
|
+
city: address.city || "",
|
|
159802
|
+
postalCode: address.postal_code || "",
|
|
159803
|
+
countryCode: address.country_code || ""
|
|
159804
|
+
};
|
|
159805
|
+
} catch (err) {
|
|
159806
|
+
if (debug24.enabled) {
|
|
159807
|
+
debug24(`Unable to resolve address for pickup store ${store.key}`, err);
|
|
159808
|
+
}
|
|
159809
|
+
return void 0;
|
|
159810
|
+
}
|
|
159811
|
+
}
|
|
159460
159812
|
async setShippingInstruction(payload) {
|
|
159461
159813
|
const client = await this.medusaApi.getClient();
|
|
159462
159814
|
const medusaId = payload.checkout;
|
|
@@ -159464,13 +159816,22 @@ var init_checkout_capability5 = __esm({
|
|
|
159464
159816
|
if (payload.shippingInstruction.shippingMethod) {
|
|
159465
159817
|
await client.store.cart.addShippingMethod(medusaId.key, this.setShippingInstructionPayload(payload));
|
|
159466
159818
|
}
|
|
159467
|
-
|
|
159819
|
+
const cartUpdate = {
|
|
159468
159820
|
metadata: {
|
|
159469
159821
|
consent_for_unattended_delivery: payload.shippingInstruction.consentForUnattendedDelivery + "",
|
|
159470
159822
|
instructions: payload.shippingInstruction.instructions || "",
|
|
159471
|
-
pickup_point: payload.shippingInstruction.pickupPoint || ""
|
|
159823
|
+
pickup_point: payload.shippingInstruction.pickupPoint || "",
|
|
159824
|
+
pickup_store: payload.shippingInstruction.store?.key || "",
|
|
159825
|
+
shipping_protocol_data: this.serializeShippingProtocolData(payload.shippingInstruction.protocolData) || ""
|
|
159472
159826
|
}
|
|
159473
|
-
}
|
|
159827
|
+
};
|
|
159828
|
+
if (payload.shippingInstruction.store?.key) {
|
|
159829
|
+
const storeAddress = await this.resolveStorePickupAddress(payload.shippingInstruction.store);
|
|
159830
|
+
if (storeAddress) {
|
|
159831
|
+
cartUpdate.shipping_address = this.mapAddressToStoreAddress(storeAddress);
|
|
159832
|
+
}
|
|
159833
|
+
}
|
|
159834
|
+
await client.store.cart.update(medusaId.key, cartUpdate);
|
|
159474
159835
|
const response = await client.store.cart.retrieve(medusaId.key, {
|
|
159475
159836
|
fields: this.includedFields
|
|
159476
159837
|
});
|
|
@@ -159478,8 +159839,8 @@ var init_checkout_capability5 = __esm({
|
|
|
159478
159839
|
return success(this.factory.parseCheckout(this.context, response.cart));
|
|
159479
159840
|
}
|
|
159480
159841
|
throw new Error("Failed to set shipping method");
|
|
159481
|
-
} catch (
|
|
159482
|
-
handleProviderError("set shipping method",
|
|
159842
|
+
} catch (error5) {
|
|
159843
|
+
handleProviderError("set shipping method", error5);
|
|
159483
159844
|
}
|
|
159484
159845
|
}
|
|
159485
159846
|
async finalizeCheckout(payload) {
|
|
@@ -159493,14 +159854,24 @@ var init_checkout_capability5 = __esm({
|
|
|
159493
159854
|
if (!checkout.value.resultingOrder) {
|
|
159494
159855
|
const client = await this.medusaApi.getClient();
|
|
159495
159856
|
const medusaId = payload.checkout;
|
|
159857
|
+
await client.store.cart.update(medusaId.key, {
|
|
159858
|
+
metadata: {
|
|
159859
|
+
cart_id: medusaId.key
|
|
159860
|
+
}
|
|
159861
|
+
});
|
|
159496
159862
|
const response = await client.store.cart.complete(medusaId.key);
|
|
159497
159863
|
if (response.type === "order") {
|
|
159864
|
+
const resultingOrder = this.parseCompletedOrderIdentifier(response.order);
|
|
159865
|
+
this.rememberFinalizedOrder(medusaId.key, resultingOrder);
|
|
159498
159866
|
checkout = await this.getById({
|
|
159499
159867
|
identifier: payload.checkout
|
|
159500
159868
|
});
|
|
159501
159869
|
if (!checkout.success) {
|
|
159502
159870
|
throw new Error(`Unable to reload checkout ${payload.checkout.key} after completion`);
|
|
159503
159871
|
}
|
|
159872
|
+
if (!checkout.value.resultingOrder) {
|
|
159873
|
+
checkout = success({ ...checkout.value, resultingOrder });
|
|
159874
|
+
}
|
|
159504
159875
|
} else {
|
|
159505
159876
|
throw new Error(`Failed to finalize checkout ${payload.checkout.key}. Expected order, got ${response.type}`);
|
|
159506
159877
|
}
|
|
@@ -159520,6 +159891,48 @@ var init_checkout_capability5 = __esm({
|
|
|
159520
159891
|
}
|
|
159521
159892
|
return success(checkout.value);
|
|
159522
159893
|
}
|
|
159894
|
+
/**
|
|
159895
|
+
* Builds the order identifier from a completed-cart response's order,
|
|
159896
|
+
* following the same display-id precedence as the checkout factory
|
|
159897
|
+
* (custom_display_id over display_id).
|
|
159898
|
+
*/
|
|
159899
|
+
parseCompletedOrderIdentifier(order) {
|
|
159900
|
+
const rawDisplayId = order.custom_display_id ?? order.display_id;
|
|
159901
|
+
const displayId = rawDisplayId != null ? Number(`${rawDisplayId}`) : void 0;
|
|
159902
|
+
return {
|
|
159903
|
+
key: order.id,
|
|
159904
|
+
display_id: displayId != null && Number.isFinite(displayId) ? displayId : void 0
|
|
159905
|
+
};
|
|
159906
|
+
}
|
|
159907
|
+
/**
|
|
159908
|
+
* Remembers which order a finalized cart produced, so later checkout reads
|
|
159909
|
+
* in the same session can report the resulting order even when the Medusa
|
|
159910
|
+
* store cart endpoint does not expose the cart->order relation.
|
|
159911
|
+
*/
|
|
159912
|
+
rememberFinalizedOrder(cartKey, order) {
|
|
159913
|
+
const sessionData = this.medusaApi.getSessionData();
|
|
159914
|
+
this.medusaApi.setSessionData({
|
|
159915
|
+
finalizedOrders: {
|
|
159916
|
+
...sessionData.finalizedOrders || {},
|
|
159917
|
+
[cartKey]: order
|
|
159918
|
+
}
|
|
159919
|
+
});
|
|
159920
|
+
}
|
|
159921
|
+
/**
|
|
159922
|
+
* Fills in a missing resultingOrder from the session's finalized-orders map.
|
|
159923
|
+
* Checkouts that already carry a resulting order (older Medusa versions
|
|
159924
|
+
* still hydrate the +order.* fields) are returned unchanged.
|
|
159925
|
+
*/
|
|
159926
|
+
hydrateResultingOrder(checkout) {
|
|
159927
|
+
if (checkout.resultingOrder) {
|
|
159928
|
+
return checkout;
|
|
159929
|
+
}
|
|
159930
|
+
const remembered = this.medusaApi.getSessionData().finalizedOrders?.[checkout.identifier.key];
|
|
159931
|
+
if (!remembered) {
|
|
159932
|
+
return checkout;
|
|
159933
|
+
}
|
|
159934
|
+
return { ...checkout, resultingOrder: remembered };
|
|
159935
|
+
}
|
|
159523
159936
|
/**
|
|
159524
159937
|
* Extension point to map an Address to a Store Address
|
|
159525
159938
|
* @param address
|
|
@@ -160523,8 +160936,8 @@ var init_identity_capability5 = __esm({
|
|
|
160523
160936
|
const identity = this.createAnonymousIdentity();
|
|
160524
160937
|
this.updateIdentityContext(identity);
|
|
160525
160938
|
return success(identity);
|
|
160526
|
-
} catch (
|
|
160527
|
-
debug29("getSelf failed, returning anonymous identity:",
|
|
160939
|
+
} catch (error5) {
|
|
160940
|
+
debug29("getSelf failed, returning anonymous identity:", error5);
|
|
160528
160941
|
const identity = this.createAnonymousIdentity();
|
|
160529
160942
|
this.updateIdentityContext(identity);
|
|
160530
160943
|
return success(identity);
|
|
@@ -160861,10 +161274,10 @@ var init_price_capability5 = __esm({
|
|
|
160861
161274
|
return this.createEmptyPriceResult(sku);
|
|
160862
161275
|
}
|
|
160863
161276
|
return this.factory.parsePrice(this.context, { variant, mode });
|
|
160864
|
-
} catch (
|
|
161277
|
+
} catch (error5) {
|
|
160865
161278
|
if (debug33.enabled) {
|
|
160866
161279
|
debug33(
|
|
160867
|
-
`Error fetching price for SKU ${sku}: ${
|
|
161280
|
+
`Error fetching price for SKU ${sku}: ${error5.message}`
|
|
160868
161281
|
);
|
|
160869
161282
|
}
|
|
160870
161283
|
return this.createEmptyPriceResult(sku);
|
|
@@ -160925,9 +161338,9 @@ var init_product_search_capability6 = __esm({
|
|
|
160925
161338
|
break;
|
|
160926
161339
|
}
|
|
160927
161340
|
offset += limit;
|
|
160928
|
-
} catch (
|
|
161341
|
+
} catch (error5) {
|
|
160929
161342
|
throw new Error(
|
|
160930
|
-
"Category not found " + externalId + " due to error: " +
|
|
161343
|
+
"Category not found " + externalId + " due to error: " + error5
|
|
160931
161344
|
);
|
|
160932
161345
|
break;
|
|
160933
161346
|
}
|
|
@@ -161112,11 +161525,11 @@ var init_product_recommendations_capability4 = __esm({
|
|
|
161112
161525
|
debug35(`Returning ${recommendations.length} recommendations`);
|
|
161113
161526
|
}
|
|
161114
161527
|
return success(recommendations);
|
|
161115
|
-
} catch (
|
|
161528
|
+
} catch (error5) {
|
|
161116
161529
|
if (debug35.enabled) {
|
|
161117
|
-
debug35(`Error fetching collection recommendations: %O`,
|
|
161530
|
+
debug35(`Error fetching collection recommendations: %O`, error5);
|
|
161118
161531
|
}
|
|
161119
|
-
console.error("Error fetching collection recommendations:",
|
|
161532
|
+
console.error("Error fetching collection recommendations:", error5);
|
|
161120
161533
|
return success([]);
|
|
161121
161534
|
}
|
|
161122
161535
|
}
|
|
@@ -161730,6 +162143,173 @@ var init_personalization_profile_capability4 = __esm({
|
|
|
161730
162143
|
}
|
|
161731
162144
|
});
|
|
161732
162145
|
|
|
162146
|
+
// packages/medusa/src/utils/geo.ts
|
|
162147
|
+
function haversineDistanceKm(latitude1, longitude1, latitude2, longitude2) {
|
|
162148
|
+
const toRadians = (degrees) => degrees * Math.PI / 180;
|
|
162149
|
+
const deltaLatitude = toRadians(latitude2 - latitude1);
|
|
162150
|
+
const deltaLongitude = toRadians(longitude2 - longitude1);
|
|
162151
|
+
const a3 = Math.sin(deltaLatitude / 2) ** 2 + Math.cos(toRadians(latitude1)) * Math.cos(toRadians(latitude2)) * Math.sin(deltaLongitude / 2) ** 2;
|
|
162152
|
+
return 2 * EARTH_RADIUS_KM * Math.asin(Math.sqrt(a3));
|
|
162153
|
+
}
|
|
162154
|
+
var EARTH_RADIUS_KM;
|
|
162155
|
+
var init_geo = __esm({
|
|
162156
|
+
"packages/medusa/src/utils/geo.ts"() {
|
|
162157
|
+
"use strict";
|
|
162158
|
+
EARTH_RADIUS_KM = 6371;
|
|
162159
|
+
}
|
|
162160
|
+
});
|
|
162161
|
+
|
|
162162
|
+
// packages/medusa/src/capabilities/store.capability.ts
|
|
162163
|
+
var import_debug39, debug39, MedusaStoreCapability;
|
|
162164
|
+
var init_store_capability4 = __esm({
|
|
162165
|
+
"packages/medusa/src/capabilities/store.capability.ts"() {
|
|
162166
|
+
"use strict";
|
|
162167
|
+
init_src();
|
|
162168
|
+
import_debug39 = __toESM(require_src(), 1);
|
|
162169
|
+
init_zod();
|
|
162170
|
+
init_client6();
|
|
162171
|
+
init_geo();
|
|
162172
|
+
debug39 = (0, import_debug39.default)("reactionary:medusa:store");
|
|
162173
|
+
MedusaStoreCapability = class extends StoreCapability {
|
|
162174
|
+
constructor(config3, cache, context2, medusaApi, factory) {
|
|
162175
|
+
super(cache, context2);
|
|
162176
|
+
this.medusaApi = medusaApi;
|
|
162177
|
+
this.config = config3;
|
|
162178
|
+
this.factory = factory;
|
|
162179
|
+
}
|
|
162180
|
+
medusaApi;
|
|
162181
|
+
config;
|
|
162182
|
+
factory;
|
|
162183
|
+
/**
|
|
162184
|
+
* The fields requested for stock locations. Override in a subclass if a
|
|
162185
|
+
* project needs more relations.
|
|
162186
|
+
*/
|
|
162187
|
+
stockLocationFields = "*address,*fulfillment_sets";
|
|
162188
|
+
/**
|
|
162189
|
+
* Whether a stock location is a store customers can pick up orders from,
|
|
162190
|
+
* i.e. it has a fulfillment set of type "pickup".
|
|
162191
|
+
*/
|
|
162192
|
+
isPickupLocation(location) {
|
|
162193
|
+
return (location.fulfillment_sets || []).some((set) => set.type === "pickup");
|
|
162194
|
+
}
|
|
162195
|
+
/**
|
|
162196
|
+
* Fetches all stock locations that are pickup stores. Medusa installations
|
|
162197
|
+
* have a small, bounded number of stock locations, so fetching them all and
|
|
162198
|
+
* filtering client-side is acceptable.
|
|
162199
|
+
*/
|
|
162200
|
+
async fetchPickupLocations() {
|
|
162201
|
+
const adminClient = await new MedusaAdminAPI(this.config, this.context).getClient();
|
|
162202
|
+
const pageSize = 200;
|
|
162203
|
+
let offset = 0;
|
|
162204
|
+
const locations = [];
|
|
162205
|
+
for (; ; ) {
|
|
162206
|
+
const response = await adminClient.admin.stockLocation.list({
|
|
162207
|
+
fields: this.stockLocationFields,
|
|
162208
|
+
limit: pageSize,
|
|
162209
|
+
offset
|
|
162210
|
+
});
|
|
162211
|
+
locations.push(...response.stock_locations || []);
|
|
162212
|
+
offset += pageSize;
|
|
162213
|
+
if (offset >= response.count || (response.stock_locations || []).length === 0) {
|
|
162214
|
+
break;
|
|
162215
|
+
}
|
|
162216
|
+
}
|
|
162217
|
+
return locations.filter((location) => this.isPickupLocation(location));
|
|
162218
|
+
}
|
|
162219
|
+
async list(payload) {
|
|
162220
|
+
const pickupLocations = await this.fetchPickupLocations();
|
|
162221
|
+
if (debug39.enabled) {
|
|
162222
|
+
debug39(`Found ${pickupLocations.length} pickup stock locations`);
|
|
162223
|
+
}
|
|
162224
|
+
const { pageNumber, pageSize } = payload.paginationOptions;
|
|
162225
|
+
const startIndex = (pageNumber - 1) * pageSize;
|
|
162226
|
+
const pagedLocations = pickupLocations.slice(startIndex, startIndex + pageSize);
|
|
162227
|
+
return success({
|
|
162228
|
+
pageNumber,
|
|
162229
|
+
pageSize,
|
|
162230
|
+
totalCount: pickupLocations.length,
|
|
162231
|
+
totalPages: Math.ceil(pickupLocations.length / pageSize),
|
|
162232
|
+
items: pagedLocations.map(
|
|
162233
|
+
(location) => this.factory.parseStore(this.context, location)
|
|
162234
|
+
)
|
|
162235
|
+
});
|
|
162236
|
+
}
|
|
162237
|
+
async getById(payload) {
|
|
162238
|
+
const adminClient = await new MedusaAdminAPI(this.config, this.context).getClient();
|
|
162239
|
+
try {
|
|
162240
|
+
const response = await adminClient.admin.stockLocation.retrieve(payload.identifier.key, {
|
|
162241
|
+
fields: this.stockLocationFields
|
|
162242
|
+
});
|
|
162243
|
+
if (!response.stock_location || !this.isPickupLocation(response.stock_location)) {
|
|
162244
|
+
return error2({ type: "NotFound", identifier: payload.identifier });
|
|
162245
|
+
}
|
|
162246
|
+
return success(this.factory.parseStore(this.context, response.stock_location));
|
|
162247
|
+
} catch (err) {
|
|
162248
|
+
if (debug39.enabled) {
|
|
162249
|
+
debug39(`Error fetching stock location ${payload.identifier.key}`, err);
|
|
162250
|
+
}
|
|
162251
|
+
return error2({ type: "NotFound", identifier: payload.identifier });
|
|
162252
|
+
}
|
|
162253
|
+
}
|
|
162254
|
+
/**
|
|
162255
|
+
* Extension point resolving a stock location's geo coordinates. Medusa
|
|
162256
|
+
* stock locations carry no first-class coordinates, so by default they are
|
|
162257
|
+
* read from the location metadata keys `latitude` and `longitude`. Returns
|
|
162258
|
+
* undefined when the location has no usable coordinates.
|
|
162259
|
+
*/
|
|
162260
|
+
parseLocationCoordinates(location) {
|
|
162261
|
+
const latitude = Number(location.metadata?.["latitude"]);
|
|
162262
|
+
const longitude = Number(location.metadata?.["longitude"]);
|
|
162263
|
+
if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) {
|
|
162264
|
+
return void 0;
|
|
162265
|
+
}
|
|
162266
|
+
return { latitude, longitude };
|
|
162267
|
+
}
|
|
162268
|
+
async queryByProximity(payload) {
|
|
162269
|
+
const pickupLocations = await this.fetchPickupLocations();
|
|
162270
|
+
const withinDistance = [];
|
|
162271
|
+
for (const location of pickupLocations) {
|
|
162272
|
+
const coordinates = this.parseLocationCoordinates(location);
|
|
162273
|
+
if (!coordinates) {
|
|
162274
|
+
continue;
|
|
162275
|
+
}
|
|
162276
|
+
const distance = haversineDistanceKm(
|
|
162277
|
+
payload.latitude,
|
|
162278
|
+
payload.longitude,
|
|
162279
|
+
coordinates.latitude,
|
|
162280
|
+
coordinates.longitude
|
|
162281
|
+
);
|
|
162282
|
+
if (distance <= payload.distance) {
|
|
162283
|
+
withinDistance.push({ location, distance });
|
|
162284
|
+
}
|
|
162285
|
+
}
|
|
162286
|
+
withinDistance.sort((a3, b3) => a3.distance - b3.distance);
|
|
162287
|
+
return success(
|
|
162288
|
+
withinDistance.slice(0, payload.limit).map((entry) => this.factory.parseStore(this.context, entry.location))
|
|
162289
|
+
);
|
|
162290
|
+
}
|
|
162291
|
+
};
|
|
162292
|
+
__decorateClass([
|
|
162293
|
+
Reactionary({
|
|
162294
|
+
inputSchema: StoreQueryForListSchema,
|
|
162295
|
+
outputSchema: StorePaginatedResultSchema
|
|
162296
|
+
})
|
|
162297
|
+
], MedusaStoreCapability.prototype, "list", 1);
|
|
162298
|
+
__decorateClass([
|
|
162299
|
+
Reactionary({
|
|
162300
|
+
inputSchema: StoreQueryByIdSchema,
|
|
162301
|
+
outputSchema: StoreSchema
|
|
162302
|
+
})
|
|
162303
|
+
], MedusaStoreCapability.prototype, "getById", 1);
|
|
162304
|
+
__decorateClass([
|
|
162305
|
+
Reactionary({
|
|
162306
|
+
inputSchema: StoreQueryByProximitySchema,
|
|
162307
|
+
outputSchema: array(StoreSchema)
|
|
162308
|
+
})
|
|
162309
|
+
], MedusaStoreCapability.prototype, "queryByProximity", 1);
|
|
162310
|
+
}
|
|
162311
|
+
});
|
|
162312
|
+
|
|
161733
162313
|
// packages/medusa/src/factories/cart/cart.factory.ts
|
|
161734
162314
|
var MedusaCartFactory;
|
|
161735
162315
|
var init_cart_factory5 = __esm({
|
|
@@ -162062,15 +162642,23 @@ var init_checkout_factory5 = __esm({
|
|
|
162062
162642
|
const backupUnattendedDelivery = data.metadata?.["consent_for_unattended_delivery"] !== void 0 ? data.metadata?.["consent_for_unattended_delivery"] === "true" : void 0;
|
|
162063
162643
|
const backupInstructions = data.metadata?.["instructions"] != null ? String(data.metadata["instructions"]) : void 0;
|
|
162064
162644
|
const backupPickupPoint = data.metadata?.["pickup_point"] != null ? String(data.metadata["pickup_point"]) : void 0;
|
|
162645
|
+
const backupPickupStore = data.metadata?.["pickup_store"] != null && data.metadata["pickup_store"] !== "" ? String(data.metadata["pickup_store"]) : void 0;
|
|
162646
|
+
const backupShippingProtocolData = this.parseShippingProtocolData(
|
|
162647
|
+
data.metadata?.["shipping_protocol_data"]
|
|
162648
|
+
);
|
|
162065
162649
|
let shippingInstruction;
|
|
162066
162650
|
data.shipping_methods?.forEach((sm) => {
|
|
162067
162651
|
let pickupPoint = "";
|
|
162068
162652
|
let instructions = "";
|
|
162069
162653
|
let consentForUnattendedDelivery = false;
|
|
162654
|
+
let pickupStore;
|
|
162655
|
+
let protocolData;
|
|
162070
162656
|
if (sm.data) {
|
|
162071
162657
|
pickupPoint = sm.data["pickup_point"] != null ? String(sm.data["pickup_point"]) : "";
|
|
162072
162658
|
instructions = sm.data["instructions"] != null ? String(sm.data["instructions"]) : "";
|
|
162073
162659
|
consentForUnattendedDelivery = sm.data["consent_for_unattended_delivery"] === "true";
|
|
162660
|
+
pickupStore = sm.data["pickup_store"] != null && sm.data["pickup_store"] !== "" ? String(sm.data["pickup_store"]) : void 0;
|
|
162661
|
+
protocolData = this.parseShippingProtocolData(sm.data["shipping_protocol_data"]);
|
|
162074
162662
|
}
|
|
162075
162663
|
if (!pickupPoint) {
|
|
162076
162664
|
pickupPoint = backupPickupPoint || "";
|
|
@@ -162081,11 +162669,19 @@ var init_checkout_factory5 = __esm({
|
|
|
162081
162669
|
if (!consentForUnattendedDelivery) {
|
|
162082
162670
|
consentForUnattendedDelivery = backupUnattendedDelivery || false;
|
|
162083
162671
|
}
|
|
162672
|
+
if (!pickupStore) {
|
|
162673
|
+
pickupStore = backupPickupStore;
|
|
162674
|
+
}
|
|
162675
|
+
if (!protocolData) {
|
|
162676
|
+
protocolData = backupShippingProtocolData;
|
|
162677
|
+
}
|
|
162084
162678
|
shippingInstruction = {
|
|
162085
|
-
shippingMethod: { key: sm.shipping_option_id },
|
|
162679
|
+
shippingMethod: { key: sm.shipping_option_id || "" },
|
|
162086
162680
|
consentForUnattendedDelivery,
|
|
162087
162681
|
instructions,
|
|
162088
|
-
pickupPoint
|
|
162682
|
+
pickupPoint,
|
|
162683
|
+
store: pickupStore ? { key: pickupStore } : void 0,
|
|
162684
|
+
protocolData
|
|
162089
162685
|
};
|
|
162090
162686
|
});
|
|
162091
162687
|
const paymentInstructions = new Array();
|
|
@@ -162149,10 +162745,71 @@ var init_checkout_factory5 = __esm({
|
|
|
162149
162745
|
value: data.calculated_price.calculated_amount || 0,
|
|
162150
162746
|
currency: data.calculated_price.currency_code?.toUpperCase() || _context.languageContext.currencyCode
|
|
162151
162747
|
}),
|
|
162152
|
-
deliveryTime: ""
|
|
162748
|
+
deliveryTime: "",
|
|
162749
|
+
fulfillmentType: this.parseFulfillmentType(_context, data),
|
|
162750
|
+
protocolData: this.parseShippingMethodProtocolData(_context, data)
|
|
162153
162751
|
};
|
|
162154
162752
|
return this.shippingMethodSchema.parse(sm);
|
|
162155
162753
|
}
|
|
162754
|
+
/**
|
|
162755
|
+
* Extension point to control how a Medusa shipping option maps to the core
|
|
162756
|
+
* fulfillment type. A shipping option belonging to a fulfillment set of type
|
|
162757
|
+
* "pickup" is in-store pickup (BOPIS); everything else is a delivery.
|
|
162758
|
+
*/
|
|
162759
|
+
parseFulfillmentType(_context, data) {
|
|
162760
|
+
return data.service_zone?.fulfillment_set?.type === "pickup" ? "pickup" : "delivery";
|
|
162761
|
+
}
|
|
162762
|
+
/**
|
|
162763
|
+
* Extension point mapping a Medusa shipping option's metadata to the
|
|
162764
|
+
* shipping method's protocolData, so medusa-side providers can push
|
|
162765
|
+
* additional data (e.g. available pickup time slots) that reaches the
|
|
162766
|
+
* client. String and JSON-object values are kept as-is, other primitives
|
|
162767
|
+
* are stringified, and arrays/null entries are skipped.
|
|
162768
|
+
*/
|
|
162769
|
+
parseShippingMethodProtocolData(_context, data) {
|
|
162770
|
+
if (!data.metadata) {
|
|
162771
|
+
return void 0;
|
|
162772
|
+
}
|
|
162773
|
+
const entries = [];
|
|
162774
|
+
for (const [key, value] of Object.entries(data.metadata)) {
|
|
162775
|
+
if (typeof value === "string") {
|
|
162776
|
+
entries.push({ key, value });
|
|
162777
|
+
} else if (typeof value === "number" || typeof value === "boolean") {
|
|
162778
|
+
entries.push({ key, value: String(value) });
|
|
162779
|
+
} else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
162780
|
+
entries.push({ key, value });
|
|
162781
|
+
}
|
|
162782
|
+
}
|
|
162783
|
+
return entries.length > 0 ? entries : void 0;
|
|
162784
|
+
}
|
|
162785
|
+
/**
|
|
162786
|
+
* Parses shipping protocol data persisted as a JSON object string (keys
|
|
162787
|
+
* mapping to string or JSON-object values) back into protocol data entries.
|
|
162788
|
+
* Returns undefined when nothing (valid) is stored, keeping the field absent
|
|
162789
|
+
* for carts that never set it.
|
|
162790
|
+
*/
|
|
162791
|
+
parseShippingProtocolData(raw) {
|
|
162792
|
+
if (typeof raw !== "string" || raw.length === 0) {
|
|
162793
|
+
return void 0;
|
|
162794
|
+
}
|
|
162795
|
+
try {
|
|
162796
|
+
const parsed = JSON.parse(raw);
|
|
162797
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
162798
|
+
return void 0;
|
|
162799
|
+
}
|
|
162800
|
+
const entries = [];
|
|
162801
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
162802
|
+
if (typeof value === "string") {
|
|
162803
|
+
entries.push({ key, value });
|
|
162804
|
+
} else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
162805
|
+
entries.push({ key, value });
|
|
162806
|
+
}
|
|
162807
|
+
}
|
|
162808
|
+
return entries.length > 0 ? entries : void 0;
|
|
162809
|
+
} catch {
|
|
162810
|
+
return void 0;
|
|
162811
|
+
}
|
|
162812
|
+
}
|
|
162156
162813
|
parsePaymentInstruction(_context, remotePayment, checkout) {
|
|
162157
162814
|
const mainSession = (remotePayment.payment_sessions || []).find(
|
|
162158
162815
|
(session) => session.status !== "canceled" && session.status !== "error"
|
|
@@ -162735,15 +163392,15 @@ var init_price_factory5 = __esm({
|
|
|
162735
163392
|
});
|
|
162736
163393
|
|
|
162737
163394
|
// packages/medusa/src/factories/product/product.factory.ts
|
|
162738
|
-
var
|
|
163395
|
+
var import_debug40, debug40, MedusaProductFactory;
|
|
162739
163396
|
var init_product_factory5 = __esm({
|
|
162740
163397
|
"packages/medusa/src/factories/product/product.factory.ts"() {
|
|
162741
163398
|
"use strict";
|
|
162742
163399
|
init_src();
|
|
162743
|
-
|
|
163400
|
+
import_debug40 = __toESM(require_src(), 1);
|
|
162744
163401
|
init_medusa_helpers();
|
|
162745
163402
|
init_product_compliance();
|
|
162746
|
-
|
|
163403
|
+
debug40 = (0, import_debug40.default)("reactionary:medusa:product");
|
|
162747
163404
|
MedusaProductFactory = class {
|
|
162748
163405
|
productSchema;
|
|
162749
163406
|
constructor(productSchema) {
|
|
@@ -162912,7 +163569,7 @@ var init_product_factory5 = __esm({
|
|
|
162912
163569
|
const sharedAttributes = this.parseAttributes(context2, data);
|
|
162913
163570
|
const complianceData = this.parseComplianceData(context2, data);
|
|
162914
163571
|
if (!data.variants) {
|
|
162915
|
-
|
|
163572
|
+
debug40("Product has no variants", data);
|
|
162916
163573
|
throw new Error("Product has no variants " + data.external_id);
|
|
162917
163574
|
}
|
|
162918
163575
|
const mainVariant = this.parseVariant(context2, data.variants[0], data);
|
|
@@ -163156,6 +163813,60 @@ var init_personalization_profile_factory4 = __esm({
|
|
|
163156
163813
|
}
|
|
163157
163814
|
});
|
|
163158
163815
|
|
|
163816
|
+
// packages/medusa/src/factories/store/store.factory.ts
|
|
163817
|
+
var MedusaStoreFactory;
|
|
163818
|
+
var init_store_factory4 = __esm({
|
|
163819
|
+
"packages/medusa/src/factories/store/store.factory.ts"() {
|
|
163820
|
+
"use strict";
|
|
163821
|
+
init_src();
|
|
163822
|
+
MedusaStoreFactory = class {
|
|
163823
|
+
storeSchema;
|
|
163824
|
+
constructor(storeSchema) {
|
|
163825
|
+
this.storeSchema = storeSchema;
|
|
163826
|
+
}
|
|
163827
|
+
/**
|
|
163828
|
+
* Extension point to control the parsing of the stock location address
|
|
163829
|
+
* into the store's address.
|
|
163830
|
+
*/
|
|
163831
|
+
parseAddress(_context, data) {
|
|
163832
|
+
if (!data.address) {
|
|
163833
|
+
return void 0;
|
|
163834
|
+
}
|
|
163835
|
+
return {
|
|
163836
|
+
identifier: AddressIdentifierSchema.parse({
|
|
163837
|
+
nickName: data.address.id
|
|
163838
|
+
}),
|
|
163839
|
+
firstName: "",
|
|
163840
|
+
lastName: data.address.company || data.name,
|
|
163841
|
+
streetAddress: data.address.address_1 || "",
|
|
163842
|
+
streetNumber: data.address.address_2 || "",
|
|
163843
|
+
city: data.address.city || "",
|
|
163844
|
+
region: data.address.province || "",
|
|
163845
|
+
postalCode: data.address.postal_code || "",
|
|
163846
|
+
countryCode: data.address.country_code || ""
|
|
163847
|
+
};
|
|
163848
|
+
}
|
|
163849
|
+
parseStore(context2, data) {
|
|
163850
|
+
const identifier = {
|
|
163851
|
+
key: data.id
|
|
163852
|
+
};
|
|
163853
|
+
const fulfillmentCenter = {
|
|
163854
|
+
key: data.name
|
|
163855
|
+
};
|
|
163856
|
+
const openingHours = data.metadata?.["opening_hours"] != null ? String(data.metadata["opening_hours"]) : void 0;
|
|
163857
|
+
const result = {
|
|
163858
|
+
identifier,
|
|
163859
|
+
name: data.name,
|
|
163860
|
+
fulfillmentCenter,
|
|
163861
|
+
address: this.parseAddress(context2, data),
|
|
163862
|
+
openingHours
|
|
163863
|
+
};
|
|
163864
|
+
return this.storeSchema.parse(result);
|
|
163865
|
+
}
|
|
163866
|
+
};
|
|
163867
|
+
}
|
|
163868
|
+
});
|
|
163869
|
+
|
|
163159
163870
|
// packages/medusa/src/factories/index.ts
|
|
163160
163871
|
var init_factories5 = __esm({
|
|
163161
163872
|
"packages/medusa/src/factories/index.ts"() {
|
|
@@ -163177,6 +163888,7 @@ var init_factories5 = __esm({
|
|
|
163177
163888
|
init_product_search_factory6();
|
|
163178
163889
|
init_profile_factory5();
|
|
163179
163890
|
init_personalization_profile_factory4();
|
|
163891
|
+
init_store_factory4();
|
|
163180
163892
|
}
|
|
163181
163893
|
});
|
|
163182
163894
|
|
|
@@ -163499,6 +164211,22 @@ function withMedusaCapabilities(configuration, capabilities) {
|
|
|
163499
164211
|
buildCapabilityArgs
|
|
163500
164212
|
);
|
|
163501
164213
|
}
|
|
164214
|
+
if (caps.store?.enabled) {
|
|
164215
|
+
client.store = resolveCapabilityWithFactory5(
|
|
164216
|
+
capabilities.store,
|
|
164217
|
+
{
|
|
164218
|
+
factory: new MedusaStoreFactory(StoreSchema),
|
|
164219
|
+
capability: (args) => new MedusaStoreCapability(
|
|
164220
|
+
args.config,
|
|
164221
|
+
args.cache,
|
|
164222
|
+
args.context,
|
|
164223
|
+
args.medusaApi,
|
|
164224
|
+
args.factory
|
|
164225
|
+
)
|
|
164226
|
+
},
|
|
164227
|
+
buildCapabilityArgs
|
|
164228
|
+
);
|
|
164229
|
+
}
|
|
163502
164230
|
if (caps.personalizationProfile?.enabled) {
|
|
163503
164231
|
client.personalizationProfile = resolveCapabilityWithFactory5(
|
|
163504
164232
|
capabilities.personalizationProfile,
|
|
@@ -163540,6 +164268,7 @@ var init_initialize5 = __esm({
|
|
|
163540
164268
|
init_product_associations_capability5();
|
|
163541
164269
|
init_profile_capability5();
|
|
163542
164270
|
init_personalization_profile_capability4();
|
|
164271
|
+
init_store_capability4();
|
|
163543
164272
|
init_capabilities_schema6();
|
|
163544
164273
|
init_configuration_schema5();
|
|
163545
164274
|
init_client6();
|
|
@@ -163577,6 +164306,7 @@ var init_src6 = __esm({
|
|
|
163577
164306
|
init_checkout_capability5();
|
|
163578
164307
|
init_product_capability5();
|
|
163579
164308
|
init_personalization_profile_capability4();
|
|
164309
|
+
init_store_capability4();
|
|
163580
164310
|
}
|
|
163581
164311
|
});
|
|
163582
164312
|
|
|
@@ -164997,8 +165727,8 @@ var init_product_recommendations_capability5 = __esm({
|
|
|
164997
165727
|
try {
|
|
164998
165728
|
const response = await index.searchSimilarDocuments(this.getSimilarProductsRecommendationsPayload(query));
|
|
164999
165729
|
return this.parseRecommendations(response, "similar");
|
|
165000
|
-
} catch (
|
|
165001
|
-
console.error("Error fetching similar product recommendations:",
|
|
165730
|
+
} catch (error5) {
|
|
165731
|
+
console.error("Error fetching similar product recommendations:", error5);
|
|
165002
165732
|
return [];
|
|
165003
165733
|
}
|
|
165004
165734
|
}
|
|
@@ -165464,9 +166194,9 @@ var require_main = __commonJS({
|
|
|
165464
166194
|
const attrs = _instructions(result, key);
|
|
165465
166195
|
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
165466
166196
|
break;
|
|
165467
|
-
} catch (
|
|
166197
|
+
} catch (error5) {
|
|
165468
166198
|
if (i3 + 1 >= length) {
|
|
165469
|
-
throw
|
|
166199
|
+
throw error5;
|
|
165470
166200
|
}
|
|
165471
166201
|
}
|
|
165472
166202
|
}
|
|
@@ -165494,13 +166224,13 @@ var require_main = __commonJS({
|
|
|
165494
166224
|
let uri;
|
|
165495
166225
|
try {
|
|
165496
166226
|
uri = new URL(dotenvKey);
|
|
165497
|
-
} catch (
|
|
165498
|
-
if (
|
|
166227
|
+
} catch (error5) {
|
|
166228
|
+
if (error5.code === "ERR_INVALID_URL") {
|
|
165499
166229
|
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
166230
|
err.code = "INVALID_DOTENV_KEY";
|
|
165501
166231
|
throw err;
|
|
165502
166232
|
}
|
|
165503
|
-
throw
|
|
166233
|
+
throw error5;
|
|
165504
166234
|
}
|
|
165505
166235
|
const key = uri.password;
|
|
165506
166236
|
if (!key) {
|
|
@@ -165547,9 +166277,9 @@ var require_main = __commonJS({
|
|
|
165547
166277
|
return envPath[0] === "~" ? path2.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
165548
166278
|
}
|
|
165549
166279
|
function _configVault(options) {
|
|
165550
|
-
const
|
|
166280
|
+
const debug41 = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
165551
166281
|
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
165552
|
-
if (
|
|
166282
|
+
if (debug41 || !quiet) {
|
|
165553
166283
|
_log("loading env from encrypted .env.vault");
|
|
165554
166284
|
}
|
|
165555
166285
|
const parsed = DotenvModule._parseVault(options);
|
|
@@ -165567,12 +166297,12 @@ var require_main = __commonJS({
|
|
|
165567
166297
|
if (options && options.processEnv != null) {
|
|
165568
166298
|
processEnv = options.processEnv;
|
|
165569
166299
|
}
|
|
165570
|
-
let
|
|
166300
|
+
let debug41 = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
165571
166301
|
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
165572
166302
|
if (options && options.encoding) {
|
|
165573
166303
|
encoding = options.encoding;
|
|
165574
166304
|
} else {
|
|
165575
|
-
if (
|
|
166305
|
+
if (debug41) {
|
|
165576
166306
|
_debug("no encoding is specified (UTF-8 is used by default)");
|
|
165577
166307
|
}
|
|
165578
166308
|
}
|
|
@@ -165594,16 +166324,16 @@ var require_main = __commonJS({
|
|
|
165594
166324
|
const parsed = DotenvModule.parse(fs2.readFileSync(path3, { encoding }));
|
|
165595
166325
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
165596
166326
|
} catch (e2) {
|
|
165597
|
-
if (
|
|
166327
|
+
if (debug41) {
|
|
165598
166328
|
_debug(`failed to load ${path3} ${e2.message}`);
|
|
165599
166329
|
}
|
|
165600
166330
|
lastError = e2;
|
|
165601
166331
|
}
|
|
165602
166332
|
}
|
|
165603
166333
|
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
165604
|
-
|
|
166334
|
+
debug41 = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug41);
|
|
165605
166335
|
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
165606
|
-
if (
|
|
166336
|
+
if (debug41 || !quiet) {
|
|
165607
166337
|
const keysCount = Object.keys(populated).length;
|
|
165608
166338
|
const shortPaths = [];
|
|
165609
166339
|
for (const filePath of optionPaths) {
|
|
@@ -165611,7 +166341,7 @@ var require_main = __commonJS({
|
|
|
165611
166341
|
const relative = path2.relative(process.cwd(), filePath);
|
|
165612
166342
|
shortPaths.push(relative);
|
|
165613
166343
|
} catch (e2) {
|
|
165614
|
-
if (
|
|
166344
|
+
if (debug41) {
|
|
165615
166345
|
_debug(`failed to load ${filePath} ${e2.message}`);
|
|
165616
166346
|
}
|
|
165617
166347
|
lastError = e2;
|
|
@@ -165646,10 +166376,10 @@ var require_main = __commonJS({
|
|
|
165646
166376
|
const aesgcm = crypto4.createDecipheriv("aes-256-gcm", key, nonce);
|
|
165647
166377
|
aesgcm.setAuthTag(authTag);
|
|
165648
166378
|
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
165649
|
-
} catch (
|
|
165650
|
-
const isRange =
|
|
165651
|
-
const invalidKeyLength =
|
|
165652
|
-
const decryptionFailed =
|
|
166379
|
+
} catch (error5) {
|
|
166380
|
+
const isRange = error5 instanceof RangeError;
|
|
166381
|
+
const invalidKeyLength = error5.message === "Invalid key length";
|
|
166382
|
+
const decryptionFailed = error5.message === "Unsupported state or unable to authenticate data";
|
|
165653
166383
|
if (isRange || invalidKeyLength) {
|
|
165654
166384
|
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
165655
166385
|
err.code = "INVALID_DOTENV_KEY";
|
|
@@ -165659,12 +166389,12 @@ var require_main = __commonJS({
|
|
|
165659
166389
|
err.code = "DECRYPTION_FAILED";
|
|
165660
166390
|
throw err;
|
|
165661
166391
|
} else {
|
|
165662
|
-
throw
|
|
166392
|
+
throw error5;
|
|
165663
166393
|
}
|
|
165664
166394
|
}
|
|
165665
166395
|
}
|
|
165666
166396
|
function populate(processEnv, parsed, options = {}) {
|
|
165667
|
-
const
|
|
166397
|
+
const debug41 = Boolean(options && options.debug);
|
|
165668
166398
|
const override = Boolean(options && options.override);
|
|
165669
166399
|
const populated = {};
|
|
165670
166400
|
if (typeof parsed !== "object") {
|
|
@@ -165678,7 +166408,7 @@ var require_main = __commonJS({
|
|
|
165678
166408
|
processEnv[key] = parsed[key];
|
|
165679
166409
|
populated[key] = parsed[key];
|
|
165680
166410
|
}
|
|
165681
|
-
if (
|
|
166411
|
+
if (debug41) {
|
|
165682
166412
|
if (override === true) {
|
|
165683
166413
|
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
165684
166414
|
} else {
|
|
@@ -169125,11 +169855,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
169125
169855
|
*/
|
|
169126
169856
|
_getOutputContext(contextOptions) {
|
|
169127
169857
|
contextOptions = contextOptions || {};
|
|
169128
|
-
const
|
|
169858
|
+
const error5 = !!contextOptions.error;
|
|
169129
169859
|
let baseWrite;
|
|
169130
169860
|
let hasColors;
|
|
169131
169861
|
let helpWidth;
|
|
169132
|
-
if (
|
|
169862
|
+
if (error5) {
|
|
169133
169863
|
baseWrite = (str) => this._outputConfiguration.writeErr(str);
|
|
169134
169864
|
hasColors = this._outputConfiguration.getErrHasColors();
|
|
169135
169865
|
helpWidth = this._outputConfiguration.getErrHelpWidth();
|
|
@@ -169142,7 +169872,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
169142
169872
|
if (!hasColors) str = this._outputConfiguration.stripColor(str);
|
|
169143
169873
|
return baseWrite(str);
|
|
169144
169874
|
};
|
|
169145
|
-
return { error:
|
|
169875
|
+
return { error: error5, write, hasColors, helpWidth };
|
|
169146
169876
|
}
|
|
169147
169877
|
/**
|
|
169148
169878
|
* Output help information for this command.
|
|
@@ -170841,11 +171571,11 @@ function validate(subject, name, url2, level) {
|
|
|
170841
171571
|
}
|
|
170842
171572
|
});
|
|
170843
171573
|
}
|
|
170844
|
-
function handleError(
|
|
171574
|
+
function handleError(error5, level) {
|
|
170845
171575
|
if (level === ErrorLevel.THROW) {
|
|
170846
|
-
throw
|
|
171576
|
+
throw error5;
|
|
170847
171577
|
} else if (level === ErrorLevel.WARN) {
|
|
170848
|
-
console.warn(
|
|
171578
|
+
console.warn(error5.name, error5.message);
|
|
170849
171579
|
}
|
|
170850
171580
|
}
|
|
170851
171581
|
function validateSMIOptions(conf, level = ErrorLevel.WARN, errorHandler = handleError) {
|
|
@@ -171388,7 +172118,7 @@ function fanoutAsyncIterable(source, consumerCount) {
|
|
|
171388
172118
|
const waiters = Array.from({ length: consumerCount }, () => []);
|
|
171389
172119
|
const capacityWaiters = [];
|
|
171390
172120
|
let done = false;
|
|
171391
|
-
let
|
|
172121
|
+
let error5 = void 0;
|
|
171392
172122
|
const producer = (async () => {
|
|
171393
172123
|
try {
|
|
171394
172124
|
for await (const item of source) {
|
|
@@ -171405,7 +172135,7 @@ function fanoutAsyncIterable(source, consumerCount) {
|
|
|
171405
172135
|
}
|
|
171406
172136
|
}
|
|
171407
172137
|
} catch (caught) {
|
|
171408
|
-
|
|
172138
|
+
error5 = caught;
|
|
171409
172139
|
} finally {
|
|
171410
172140
|
done = true;
|
|
171411
172141
|
for (const queueWaiters of waiters) {
|
|
@@ -171423,8 +172153,8 @@ function fanoutAsyncIterable(source, consumerCount) {
|
|
|
171423
172153
|
continue;
|
|
171424
172154
|
}
|
|
171425
172155
|
if (done) {
|
|
171426
|
-
if (
|
|
171427
|
-
throw
|
|
172156
|
+
if (error5) {
|
|
172157
|
+
throw error5;
|
|
171428
172158
|
}
|
|
171429
172159
|
await producer;
|
|
171430
172160
|
return;
|
|
@@ -171578,8 +172308,8 @@ function parseProductConcurrency(value, fallback2) {
|
|
|
171578
172308
|
}
|
|
171579
172309
|
return Math.floor(parsed);
|
|
171580
172310
|
}
|
|
171581
|
-
main().catch((
|
|
171582
|
-
console.error(
|
|
172311
|
+
main().catch((error5) => {
|
|
172312
|
+
console.error(error5);
|
|
171583
172313
|
process.exit(1);
|
|
171584
172314
|
});
|
|
171585
172315
|
/*! Bundled license information:
|