@reactionary/feeds 0.10.52 → 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 +1084 -346
- 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
|
}
|
|
@@ -37347,6 +37407,8 @@ var init_profile_model = __esm({
|
|
|
37347
37407
|
ProfileSchema = BaseModelSchema.extend({
|
|
37348
37408
|
identifier: IdentityIdentifierSchema,
|
|
37349
37409
|
email: email2(),
|
|
37410
|
+
firstName: string2().optional(),
|
|
37411
|
+
lastName: string2().optional(),
|
|
37350
37412
|
phone: string2(),
|
|
37351
37413
|
emailVerified: boolean2(),
|
|
37352
37414
|
phoneVerified: boolean2(),
|
|
@@ -37360,7 +37422,7 @@ var init_profile_model = __esm({
|
|
|
37360
37422
|
});
|
|
37361
37423
|
|
|
37362
37424
|
// packages/core/src/schemas/models/shipping-method.model.ts
|
|
37363
|
-
var PickupPointSchema, ShippingMethodSchema, ShippingInstructionSchema;
|
|
37425
|
+
var ShippingFulfillmentTypeSchema, ShippingProtocolDataSchema, PickupPointSchema, ShippingMethodSchema, ShippingInstructionSchema;
|
|
37364
37426
|
var init_shipping_method_model = __esm({
|
|
37365
37427
|
"packages/core/src/schemas/models/shipping-method.model.ts"() {
|
|
37366
37428
|
"use strict";
|
|
@@ -37369,6 +37431,11 @@ var init_shipping_method_model = __esm({
|
|
|
37369
37431
|
init_price_model();
|
|
37370
37432
|
init_base_model();
|
|
37371
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
|
+
});
|
|
37372
37439
|
PickupPointSchema = looseObject({
|
|
37373
37440
|
identifier: object({
|
|
37374
37441
|
key: string2()
|
|
@@ -37388,30 +37455,38 @@ var init_shipping_method_model = __esm({
|
|
|
37388
37455
|
logo: ImageSchema.optional(),
|
|
37389
37456
|
price: MonetaryAmountSchema,
|
|
37390
37457
|
deliveryTime: string2(),
|
|
37391
|
-
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." })
|
|
37392
37461
|
});
|
|
37393
37462
|
ShippingInstructionSchema = BaseModelSchema.extend({
|
|
37394
37463
|
shippingMethod: ShippingMethodIdentifierSchema,
|
|
37395
|
-
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." }),
|
|
37396
37465
|
instructions: string2().meta({ description: "Optional instructions for the shipping. This could be delivery instructions, or similar." }),
|
|
37397
|
-
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." })
|
|
37398
37469
|
});
|
|
37399
37470
|
}
|
|
37400
37471
|
});
|
|
37401
37472
|
|
|
37402
37473
|
// packages/core/src/schemas/models/store.model.ts
|
|
37403
|
-
var StoreSchema;
|
|
37474
|
+
var StoreSchema, StorePaginatedResultSchema;
|
|
37404
37475
|
var init_store_model = __esm({
|
|
37405
37476
|
"packages/core/src/schemas/models/store.model.ts"() {
|
|
37406
37477
|
"use strict";
|
|
37407
37478
|
init_zod();
|
|
37408
37479
|
init_base_model();
|
|
37409
37480
|
init_identifiers_model();
|
|
37481
|
+
init_profile_model();
|
|
37410
37482
|
StoreSchema = BaseModelSchema.extend({
|
|
37411
37483
|
identifier: StoreIdentifierSchema,
|
|
37412
37484
|
name: string2(),
|
|
37413
|
-
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".' })
|
|
37414
37488
|
});
|
|
37489
|
+
StorePaginatedResultSchema = createPaginatedResponseSchema(StoreSchema);
|
|
37415
37490
|
}
|
|
37416
37491
|
});
|
|
37417
37492
|
|
|
@@ -38136,7 +38211,9 @@ var init_profile_mutation = __esm({
|
|
|
38136
38211
|
ProfileMutationUpdateSchema = BaseMutationSchema.extend({
|
|
38137
38212
|
identifier: IdentityIdentifierSchema,
|
|
38138
38213
|
email: email2().meta({ description: "The main contact email of the profile" }),
|
|
38139
|
-
phone: string2().meta({ description: "The main phone number of the profile" })
|
|
38214
|
+
phone: string2().meta({ description: "The main phone number of the profile" }),
|
|
38215
|
+
firstName: string2().optional().meta({ description: "The first name of the profile holder. Left unchanged when omitted" }),
|
|
38216
|
+
lastName: string2().optional().meta({ description: "The last name of the profile holder. Left unchanged when omitted" })
|
|
38140
38217
|
});
|
|
38141
38218
|
ProfileMutationAddShippingAddressSchema = BaseMutationSchema.extend({
|
|
38142
38219
|
identifier: IdentityIdentifierSchema,
|
|
@@ -38504,18 +38581,26 @@ var init_product_reviews_query = __esm({
|
|
|
38504
38581
|
});
|
|
38505
38582
|
|
|
38506
38583
|
// packages/core/src/schemas/queries/store.query.ts
|
|
38507
|
-
var StoreQueryByProximitySchema;
|
|
38584
|
+
var StoreQueryByProximitySchema, StoreQueryByIdSchema, StoreQueryForListSchema;
|
|
38508
38585
|
var init_store_query = __esm({
|
|
38509
38586
|
"packages/core/src/schemas/queries/store.query.ts"() {
|
|
38510
38587
|
"use strict";
|
|
38511
38588
|
init_zod();
|
|
38512
38589
|
init_base_query();
|
|
38590
|
+
init_identifiers_model();
|
|
38591
|
+
init_base_model();
|
|
38513
38592
|
StoreQueryByProximitySchema = BaseQuerySchema.extend({
|
|
38514
38593
|
longitude: number2(),
|
|
38515
38594
|
latitude: number2(),
|
|
38516
38595
|
distance: number2(),
|
|
38517
38596
|
limit: number2()
|
|
38518
38597
|
});
|
|
38598
|
+
StoreQueryByIdSchema = BaseQuerySchema.extend({
|
|
38599
|
+
identifier: StoreIdentifierSchema
|
|
38600
|
+
});
|
|
38601
|
+
StoreQueryForListSchema = BaseQuerySchema.extend({
|
|
38602
|
+
paginationOptions: PaginationOptionsSchema
|
|
38603
|
+
});
|
|
38519
38604
|
}
|
|
38520
38605
|
});
|
|
38521
38606
|
|
|
@@ -38844,10 +38929,10 @@ function success(value) {
|
|
|
38844
38929
|
}
|
|
38845
38930
|
};
|
|
38846
38931
|
}
|
|
38847
|
-
function error2(
|
|
38932
|
+
function error2(error5) {
|
|
38848
38933
|
return {
|
|
38849
38934
|
success: false,
|
|
38850
|
-
error:
|
|
38935
|
+
error: error5,
|
|
38851
38936
|
meta: {
|
|
38852
38937
|
trace: trace.getActiveSpan()?.spanContext().traceId || ""
|
|
38853
38938
|
}
|
|
@@ -42014,8 +42099,8 @@ var require_lib7 = __commonJS({
|
|
|
42014
42099
|
exports2.byteSequence = byteSequence;
|
|
42015
42100
|
var codePoint = __importStar(require_CodePoints());
|
|
42016
42101
|
exports2.codePoint = codePoint;
|
|
42017
|
-
var
|
|
42018
|
-
exports2.json =
|
|
42102
|
+
var json2 = __importStar(require_JSON());
|
|
42103
|
+
exports2.json = json2;
|
|
42019
42104
|
var list = __importStar(require_List());
|
|
42020
42105
|
exports2.list = list;
|
|
42021
42106
|
var map = __importStar(require_Map());
|
|
@@ -60423,7 +60508,7 @@ var require_sax = __commonJS({
|
|
|
60423
60508
|
parser.script = "";
|
|
60424
60509
|
break;
|
|
60425
60510
|
default:
|
|
60426
|
-
|
|
60511
|
+
error5(parser, "Max buffer length exceeded: " + buffers[i3]);
|
|
60427
60512
|
}
|
|
60428
60513
|
}
|
|
60429
60514
|
maxActual = Math.max(maxActual, len);
|
|
@@ -61023,7 +61108,7 @@ var require_sax = __commonJS({
|
|
|
61023
61108
|
if (opt.normalize) text2 = text2.replace(/\s+/g, " ");
|
|
61024
61109
|
return text2;
|
|
61025
61110
|
}
|
|
61026
|
-
function
|
|
61111
|
+
function error5(parser, er3) {
|
|
61027
61112
|
closeText(parser);
|
|
61028
61113
|
if (parser.trackPosition) {
|
|
61029
61114
|
er3 += "\nLine: " + parser.line + "\nColumn: " + parser.column + "\nChar: " + parser.c;
|
|
@@ -61037,7 +61122,7 @@ var require_sax = __commonJS({
|
|
|
61037
61122
|
if (parser.sawRoot && !parser.closedRoot)
|
|
61038
61123
|
strictFail(parser, "Unclosed root tag");
|
|
61039
61124
|
if (parser.state !== S4.BEGIN && parser.state !== S4.BEGIN_WHITESPACE && parser.state !== S4.TEXT) {
|
|
61040
|
-
|
|
61125
|
+
error5(parser, "Unexpected end");
|
|
61041
61126
|
}
|
|
61042
61127
|
closeText(parser);
|
|
61043
61128
|
parser.c = "";
|
|
@@ -61051,7 +61136,7 @@ var require_sax = __commonJS({
|
|
|
61051
61136
|
throw new Error("bad call to strictFail");
|
|
61052
61137
|
}
|
|
61053
61138
|
if (parser.strict) {
|
|
61054
|
-
|
|
61139
|
+
error5(parser, message);
|
|
61055
61140
|
}
|
|
61056
61141
|
}
|
|
61057
61142
|
function newTag(parser) {
|
|
@@ -61296,7 +61381,7 @@ var require_sax = __commonJS({
|
|
|
61296
61381
|
throw this.error;
|
|
61297
61382
|
}
|
|
61298
61383
|
if (parser.closed) {
|
|
61299
|
-
return
|
|
61384
|
+
return error5(
|
|
61300
61385
|
parser,
|
|
61301
61386
|
"Cannot write after close. Assign an onready handler."
|
|
61302
61387
|
);
|
|
@@ -61692,7 +61777,7 @@ var require_sax = __commonJS({
|
|
|
61692
61777
|
parser.state = S4.ATTRIB_VALUE_QUOTED;
|
|
61693
61778
|
} else {
|
|
61694
61779
|
if (!parser.opt.unquotedAttributeValues) {
|
|
61695
|
-
|
|
61780
|
+
error5(parser, "Unquoted attribute value");
|
|
61696
61781
|
}
|
|
61697
61782
|
parser.state = S4.ATTRIB_VALUE_UNQUOTED;
|
|
61698
61783
|
parser.attribValue = c3;
|
|
@@ -61805,13 +61890,13 @@ var require_sax = __commonJS({
|
|
|
61805
61890
|
var parsedEntity = parseEntity(parser);
|
|
61806
61891
|
if (parser.opt.unparsedEntities && !Object.values(sax3.XML_ENTITIES).includes(parsedEntity)) {
|
|
61807
61892
|
if ((parser.entityCount += 1) > parser.opt.maxEntityCount) {
|
|
61808
|
-
|
|
61893
|
+
error5(
|
|
61809
61894
|
parser,
|
|
61810
61895
|
"Parsed entity count exceeds max entity count"
|
|
61811
61896
|
);
|
|
61812
61897
|
}
|
|
61813
61898
|
if ((parser.entityDepth += 1) > parser.opt.maxEntityDepth) {
|
|
61814
|
-
|
|
61899
|
+
error5(
|
|
61815
61900
|
parser,
|
|
61816
61901
|
"Parsed entity depth exceeds max entity depth"
|
|
61817
61902
|
);
|
|
@@ -61976,7 +62061,7 @@ function createIterablePromise({
|
|
|
61976
62061
|
func,
|
|
61977
62062
|
validate: validate2,
|
|
61978
62063
|
aggregator,
|
|
61979
|
-
error:
|
|
62064
|
+
error: error5,
|
|
61980
62065
|
timeout = () => 0
|
|
61981
62066
|
}) {
|
|
61982
62067
|
const retry = (previousResponse) => {
|
|
@@ -61988,8 +62073,8 @@ function createIterablePromise({
|
|
|
61988
62073
|
if (await validate2(response)) {
|
|
61989
62074
|
return resolve2(response);
|
|
61990
62075
|
}
|
|
61991
|
-
if (
|
|
61992
|
-
return reject(new Error(await
|
|
62076
|
+
if (error5 && await error5.validate(response)) {
|
|
62077
|
+
return reject(new Error(await error5.message(response)));
|
|
61993
62078
|
}
|
|
61994
62079
|
return setTimeout(
|
|
61995
62080
|
() => {
|
|
@@ -62575,9 +62660,9 @@ var init_common = __esm({
|
|
|
62575
62660
|
};
|
|
62576
62661
|
DetailedApiError = class extends ApiError {
|
|
62577
62662
|
error;
|
|
62578
|
-
constructor(message, status,
|
|
62663
|
+
constructor(message, status, error5, stackTrace) {
|
|
62579
62664
|
super(message, status, stackTrace, "DetailedApiError");
|
|
62580
|
-
this.error =
|
|
62665
|
+
this.error = error5;
|
|
62581
62666
|
}
|
|
62582
62667
|
};
|
|
62583
62668
|
}
|
|
@@ -62639,10 +62724,10 @@ function createHttpRequester({
|
|
|
62639
62724
|
isTimedOut: false
|
|
62640
62725
|
});
|
|
62641
62726
|
});
|
|
62642
|
-
response.on("error", (
|
|
62727
|
+
response.on("error", (error5) => {
|
|
62643
62728
|
clearTimeout(connectTimeout);
|
|
62644
62729
|
clearTimeout(responseTimeout);
|
|
62645
|
-
resolve2({ status: 0, content:
|
|
62730
|
+
resolve2({ status: 0, content: error5.message, isTimedOut: false });
|
|
62646
62731
|
});
|
|
62647
62732
|
});
|
|
62648
62733
|
const createTimeout = (timeout, content) => {
|
|
@@ -62656,10 +62741,10 @@ function createHttpRequester({
|
|
|
62656
62741
|
}, timeout);
|
|
62657
62742
|
};
|
|
62658
62743
|
connectTimeout = createTimeout(request.connectTimeout, "Connection timeout");
|
|
62659
|
-
req.on("error", (
|
|
62744
|
+
req.on("error", (error5) => {
|
|
62660
62745
|
clearTimeout(connectTimeout);
|
|
62661
62746
|
clearTimeout(responseTimeout);
|
|
62662
|
-
resolve2({ status: 0, content:
|
|
62747
|
+
resolve2({ status: 0, content: error5.message, isTimedOut: false });
|
|
62663
62748
|
});
|
|
62664
62749
|
req.once("response", () => {
|
|
62665
62750
|
clearTimeout(connectTimeout);
|
|
@@ -62703,8 +62788,8 @@ function createHttpRequester({
|
|
|
62703
62788
|
}
|
|
62704
62789
|
resolve2(import_stream.Readable.toWeb(response));
|
|
62705
62790
|
});
|
|
62706
|
-
req.on("error", (
|
|
62707
|
-
reject(
|
|
62791
|
+
req.on("error", (error5) => {
|
|
62792
|
+
reject(error5);
|
|
62708
62793
|
});
|
|
62709
62794
|
if (request.data !== void 0) {
|
|
62710
62795
|
req.write(request.data);
|
|
@@ -65694,11 +65779,11 @@ function createSearchClient({
|
|
|
65694
65779
|
}
|
|
65695
65780
|
return createIterablePromise({
|
|
65696
65781
|
...baseIteratorOptions,
|
|
65697
|
-
func: () => this.getApiKey({ key }, requestOptions).catch((
|
|
65698
|
-
if (
|
|
65782
|
+
func: () => this.getApiKey({ key }, requestOptions).catch((error5) => {
|
|
65783
|
+
if (error5.status === 404) {
|
|
65699
65784
|
return void 0;
|
|
65700
65785
|
}
|
|
65701
|
-
throw
|
|
65786
|
+
throw error5;
|
|
65702
65787
|
}),
|
|
65703
65788
|
validate: (response) => operation === "add" ? response !== void 0 : response === void 0
|
|
65704
65789
|
});
|
|
@@ -65988,19 +66073,19 @@ function createSearchClient({
|
|
|
65988
66073
|
maxRetries
|
|
65989
66074
|
});
|
|
65990
66075
|
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
65991
|
-
} catch (
|
|
66076
|
+
} catch (error5) {
|
|
65992
66077
|
await this.deleteIndex({ indexName: tmpIndexName });
|
|
65993
|
-
throw
|
|
66078
|
+
throw error5;
|
|
65994
66079
|
}
|
|
65995
66080
|
},
|
|
65996
66081
|
async indexExists({ indexName }) {
|
|
65997
66082
|
try {
|
|
65998
66083
|
await this.getSettings({ indexName });
|
|
65999
|
-
} catch (
|
|
66000
|
-
if (
|
|
66084
|
+
} catch (error5) {
|
|
66085
|
+
if (error5 instanceof ApiError && error5.status === 404) {
|
|
66001
66086
|
return false;
|
|
66002
66087
|
}
|
|
66003
|
-
throw
|
|
66088
|
+
throw error5;
|
|
66004
66089
|
}
|
|
66005
66090
|
return true;
|
|
66006
66091
|
},
|
|
@@ -67959,11 +68044,11 @@ function createIngestionClient({
|
|
|
67959
68044
|
if (resp.eventID === void 0 || !resp.eventID) {
|
|
67960
68045
|
throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
|
|
67961
68046
|
}
|
|
67962
|
-
return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((
|
|
67963
|
-
if (
|
|
68047
|
+
return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((error5) => {
|
|
68048
|
+
if (error5.status === 404) {
|
|
67964
68049
|
return void 0;
|
|
67965
68050
|
}
|
|
67966
|
-
throw
|
|
68051
|
+
throw error5;
|
|
67967
68052
|
});
|
|
67968
68053
|
},
|
|
67969
68054
|
validate: (response) => response !== void 0,
|
|
@@ -70745,9 +70830,9 @@ function algoliasearch(appId, apiKey, options) {
|
|
|
70745
70830
|
maxRetries
|
|
70746
70831
|
});
|
|
70747
70832
|
return { copyOperationResponse, watchResponses, moveOperationResponse };
|
|
70748
|
-
} catch (
|
|
70833
|
+
} catch (error5) {
|
|
70749
70834
|
await this.deleteIndex({ indexName: tmpIndexName });
|
|
70750
|
-
throw
|
|
70835
|
+
throw error5;
|
|
70751
70836
|
}
|
|
70752
70837
|
},
|
|
70753
70838
|
/**
|
|
@@ -71407,8 +71492,8 @@ var init_product_recommendations_capability2 = __esm({
|
|
|
71407
71492
|
}
|
|
71408
71493
|
}
|
|
71409
71494
|
return result;
|
|
71410
|
-
} catch (
|
|
71411
|
-
console.error("Error fetching frequently bought together recommendations:",
|
|
71495
|
+
} catch (error5) {
|
|
71496
|
+
console.error("Error fetching frequently bought together recommendations:", error5);
|
|
71412
71497
|
return [];
|
|
71413
71498
|
}
|
|
71414
71499
|
}
|
|
@@ -71440,8 +71525,8 @@ var init_product_recommendations_capability2 = __esm({
|
|
|
71440
71525
|
}
|
|
71441
71526
|
}
|
|
71442
71527
|
return result;
|
|
71443
|
-
} catch (
|
|
71444
|
-
console.error("Error fetching similar product recommendations:",
|
|
71528
|
+
} catch (error5) {
|
|
71529
|
+
console.error("Error fetching similar product recommendations:", error5);
|
|
71445
71530
|
return [];
|
|
71446
71531
|
}
|
|
71447
71532
|
}
|
|
@@ -71473,8 +71558,8 @@ var init_product_recommendations_capability2 = __esm({
|
|
|
71473
71558
|
}
|
|
71474
71559
|
}
|
|
71475
71560
|
return result;
|
|
71476
|
-
} catch (
|
|
71477
|
-
console.error("Error fetching related product recommendations:",
|
|
71561
|
+
} catch (error5) {
|
|
71562
|
+
console.error("Error fetching related product recommendations:", error5);
|
|
71478
71563
|
return [];
|
|
71479
71564
|
}
|
|
71480
71565
|
}
|
|
@@ -71507,8 +71592,8 @@ var init_product_recommendations_capability2 = __esm({
|
|
|
71507
71592
|
}
|
|
71508
71593
|
}
|
|
71509
71594
|
return result;
|
|
71510
|
-
} catch (
|
|
71511
|
-
console.error("Error fetching trending in category recommendations:",
|
|
71595
|
+
} catch (error5) {
|
|
71596
|
+
console.error("Error fetching trending in category recommendations:", error5);
|
|
71512
71597
|
return [];
|
|
71513
71598
|
}
|
|
71514
71599
|
}
|
|
@@ -71988,7 +72073,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
71988
72073
|
});
|
|
71989
72074
|
return response;
|
|
71990
72075
|
}
|
|
71991
|
-
return sendRequest().catch((
|
|
72076
|
+
return sendRequest().catch((error5) => Promise.reject(error5));
|
|
71992
72077
|
}
|
|
71993
72078
|
async function executor(request) {
|
|
71994
72079
|
const {
|
|
@@ -72457,8 +72542,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72457
72542
|
message: response.data.message,
|
|
72458
72543
|
error: response.data.errors
|
|
72459
72544
|
});
|
|
72460
|
-
} catch (
|
|
72461
|
-
throw
|
|
72545
|
+
} catch (error5) {
|
|
72546
|
+
throw error5;
|
|
72462
72547
|
}
|
|
72463
72548
|
}
|
|
72464
72549
|
async function authProcessor(request, tokenFetchPromise = null, tokenCacheObject, tokenCacheKey, tokenCache, builder, options, next) {
|
|
@@ -72617,11 +72702,11 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72617
72702
|
const response = await next(request);
|
|
72618
72703
|
if (response.error) {
|
|
72619
72704
|
const {
|
|
72620
|
-
error:
|
|
72705
|
+
error: error5
|
|
72621
72706
|
} = response;
|
|
72622
72707
|
if (options.handler && typeof options.handler == "function") {
|
|
72623
72708
|
return options.handler({
|
|
72624
|
-
error:
|
|
72709
|
+
error: error5,
|
|
72625
72710
|
request,
|
|
72626
72711
|
response,
|
|
72627
72712
|
next
|
|
@@ -72629,10 +72714,10 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72629
72714
|
}
|
|
72630
72715
|
return {
|
|
72631
72716
|
...response,
|
|
72632
|
-
statusCode:
|
|
72633
|
-
headers:
|
|
72634
|
-
body:
|
|
72635
|
-
error:
|
|
72717
|
+
statusCode: error5.statusCode || 0,
|
|
72718
|
+
headers: error5.headers || getHeaders({}),
|
|
72719
|
+
body: error5,
|
|
72720
|
+
error: error5
|
|
72636
72721
|
};
|
|
72637
72722
|
}
|
|
72638
72723
|
return response;
|
|
@@ -72678,7 +72763,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72678
72763
|
headers: getHeaders(response.headers)
|
|
72679
72764
|
};
|
|
72680
72765
|
}
|
|
72681
|
-
const
|
|
72766
|
+
const error5 = createError({
|
|
72682
72767
|
code: response.data?.errors?.[0].code,
|
|
72683
72768
|
message: response?.data?.message || response?.message,
|
|
72684
72769
|
statusCode: response.statusCode || response?.data?.statusCode,
|
|
@@ -72697,14 +72782,14 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72697
72782
|
}
|
|
72698
72783
|
});
|
|
72699
72784
|
return {
|
|
72700
|
-
...
|
|
72701
|
-
error:
|
|
72785
|
+
...error5,
|
|
72786
|
+
error: error5
|
|
72702
72787
|
};
|
|
72703
72788
|
} catch (e2) {
|
|
72704
72789
|
const headers = includeResponseHeaders ? getHeaders(e2.response?.headers) : null;
|
|
72705
72790
|
const statusCode = e2.response?.status || e2.response?.statusCode || e2.response?.data.statusCode || 0;
|
|
72706
72791
|
const message = e2.response?.data?.message;
|
|
72707
|
-
const
|
|
72792
|
+
const error5 = createError({
|
|
72708
72793
|
statusCode,
|
|
72709
72794
|
code: "NetworkError",
|
|
72710
72795
|
status: statusCode,
|
|
@@ -72724,7 +72809,7 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72724
72809
|
throw {
|
|
72725
72810
|
// because body and error should be mutually exclusive
|
|
72726
72811
|
body: null,
|
|
72727
|
-
error:
|
|
72812
|
+
error: error5
|
|
72728
72813
|
};
|
|
72729
72814
|
}
|
|
72730
72815
|
}
|
|
@@ -72846,8 +72931,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
72846
72931
|
request.resolve(data);
|
|
72847
72932
|
freeSlot();
|
|
72848
72933
|
},
|
|
72849
|
-
reject(
|
|
72850
|
-
request.reject(
|
|
72934
|
+
reject(error5) {
|
|
72935
|
+
request.reject(error5);
|
|
72851
72936
|
freeSlot();
|
|
72852
72937
|
}
|
|
72853
72938
|
};
|
|
@@ -73024,8 +73109,8 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
|
|
|
73024
73109
|
const last = results[resultsLength - 1];
|
|
73025
73110
|
const newLastId = last && last.id;
|
|
73026
73111
|
processPage(newLastId, accumulated);
|
|
73027
|
-
} catch (
|
|
73028
|
-
reject(
|
|
73112
|
+
} catch (error5) {
|
|
73113
|
+
reject(error5);
|
|
73029
73114
|
}
|
|
73030
73115
|
};
|
|
73031
73116
|
processPage();
|
|
@@ -73421,7 +73506,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
73421
73506
|
});
|
|
73422
73507
|
return response;
|
|
73423
73508
|
}
|
|
73424
|
-
return sendRequest().catch((
|
|
73509
|
+
return sendRequest().catch((error5) => Promise.reject(error5));
|
|
73425
73510
|
}
|
|
73426
73511
|
async function executor(request) {
|
|
73427
73512
|
const {
|
|
@@ -73890,8 +73975,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
73890
73975
|
message: response.data.message,
|
|
73891
73976
|
error: response.data.errors
|
|
73892
73977
|
});
|
|
73893
|
-
} catch (
|
|
73894
|
-
throw
|
|
73978
|
+
} catch (error5) {
|
|
73979
|
+
throw error5;
|
|
73895
73980
|
}
|
|
73896
73981
|
}
|
|
73897
73982
|
async function authProcessor(request, tokenFetchPromise = null, tokenCacheObject, tokenCacheKey, tokenCache, builder, options, next) {
|
|
@@ -74050,11 +74135,11 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74050
74135
|
const response = await next(request);
|
|
74051
74136
|
if (response.error) {
|
|
74052
74137
|
const {
|
|
74053
|
-
error:
|
|
74138
|
+
error: error5
|
|
74054
74139
|
} = response;
|
|
74055
74140
|
if (options.handler && typeof options.handler == "function") {
|
|
74056
74141
|
return options.handler({
|
|
74057
|
-
error:
|
|
74142
|
+
error: error5,
|
|
74058
74143
|
request,
|
|
74059
74144
|
response,
|
|
74060
74145
|
next
|
|
@@ -74062,10 +74147,10 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74062
74147
|
}
|
|
74063
74148
|
return {
|
|
74064
74149
|
...response,
|
|
74065
|
-
statusCode:
|
|
74066
|
-
headers:
|
|
74067
|
-
body:
|
|
74068
|
-
error:
|
|
74150
|
+
statusCode: error5.statusCode || 0,
|
|
74151
|
+
headers: error5.headers || getHeaders({}),
|
|
74152
|
+
body: error5,
|
|
74153
|
+
error: error5
|
|
74069
74154
|
};
|
|
74070
74155
|
}
|
|
74071
74156
|
return response;
|
|
@@ -74111,7 +74196,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74111
74196
|
headers: getHeaders(response.headers)
|
|
74112
74197
|
};
|
|
74113
74198
|
}
|
|
74114
|
-
const
|
|
74199
|
+
const error5 = createError({
|
|
74115
74200
|
code: response.data?.errors?.[0].code,
|
|
74116
74201
|
message: response?.data?.message || response?.message,
|
|
74117
74202
|
statusCode: response.statusCode || response?.data?.statusCode,
|
|
@@ -74130,14 +74215,14 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74130
74215
|
}
|
|
74131
74216
|
});
|
|
74132
74217
|
return {
|
|
74133
|
-
...
|
|
74134
|
-
error:
|
|
74218
|
+
...error5,
|
|
74219
|
+
error: error5
|
|
74135
74220
|
};
|
|
74136
74221
|
} catch (e2) {
|
|
74137
74222
|
const headers = includeResponseHeaders ? getHeaders(e2.response?.headers) : null;
|
|
74138
74223
|
const statusCode = e2.response?.status || e2.response?.statusCode || e2.response?.data.statusCode || 0;
|
|
74139
74224
|
const message = e2.response?.data?.message;
|
|
74140
|
-
const
|
|
74225
|
+
const error5 = createError({
|
|
74141
74226
|
statusCode,
|
|
74142
74227
|
code: "NetworkError",
|
|
74143
74228
|
status: statusCode,
|
|
@@ -74157,7 +74242,7 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74157
74242
|
throw {
|
|
74158
74243
|
// because body and error should be mutually exclusive
|
|
74159
74244
|
body: null,
|
|
74160
|
-
error:
|
|
74245
|
+
error: error5
|
|
74161
74246
|
};
|
|
74162
74247
|
}
|
|
74163
74248
|
}
|
|
@@ -74279,8 +74364,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74279
74364
|
request.resolve(data);
|
|
74280
74365
|
freeSlot();
|
|
74281
74366
|
},
|
|
74282
|
-
reject(
|
|
74283
|
-
request.reject(
|
|
74367
|
+
reject(error5) {
|
|
74368
|
+
request.reject(error5);
|
|
74284
74369
|
freeSlot();
|
|
74285
74370
|
}
|
|
74286
74371
|
};
|
|
@@ -74457,8 +74542,8 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
|
|
|
74457
74542
|
const last = results[resultsLength - 1];
|
|
74458
74543
|
const newLastId = last && last.id;
|
|
74459
74544
|
processPage(newLastId, accumulated);
|
|
74460
|
-
} catch (
|
|
74461
|
-
reject(
|
|
74545
|
+
} catch (error5) {
|
|
74546
|
+
reject(error5);
|
|
74462
74547
|
}
|
|
74463
74548
|
};
|
|
74464
74549
|
processPage();
|
|
@@ -111587,46 +111672,46 @@ var require_ms = __commonJS({
|
|
|
111587
111672
|
var require_common2 = __commonJS({
|
|
111588
111673
|
"node_modules/.pnpm/debug@4.4.3_supports-color@7.2.0/node_modules/debug/src/common.js"(exports2, module2) {
|
|
111589
111674
|
function setup(env) {
|
|
111590
|
-
|
|
111591
|
-
|
|
111592
|
-
|
|
111593
|
-
|
|
111594
|
-
|
|
111595
|
-
|
|
111596
|
-
|
|
111597
|
-
|
|
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;
|
|
111598
111683
|
Object.keys(env).forEach((key) => {
|
|
111599
|
-
|
|
111684
|
+
createDebug41[key] = env[key];
|
|
111600
111685
|
});
|
|
111601
|
-
|
|
111602
|
-
|
|
111603
|
-
|
|
111686
|
+
createDebug41.names = [];
|
|
111687
|
+
createDebug41.skips = [];
|
|
111688
|
+
createDebug41.formatters = {};
|
|
111604
111689
|
function selectColor(namespace) {
|
|
111605
111690
|
let hash2 = 0;
|
|
111606
111691
|
for (let i3 = 0; i3 < namespace.length; i3++) {
|
|
111607
111692
|
hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i3);
|
|
111608
111693
|
hash2 |= 0;
|
|
111609
111694
|
}
|
|
111610
|
-
return
|
|
111695
|
+
return createDebug41.colors[Math.abs(hash2) % createDebug41.colors.length];
|
|
111611
111696
|
}
|
|
111612
|
-
|
|
111613
|
-
function
|
|
111697
|
+
createDebug41.selectColor = selectColor;
|
|
111698
|
+
function createDebug41(namespace) {
|
|
111614
111699
|
let prevTime;
|
|
111615
111700
|
let enableOverride = null;
|
|
111616
111701
|
let namespacesCache;
|
|
111617
111702
|
let enabledCache;
|
|
111618
|
-
function
|
|
111619
|
-
if (!
|
|
111703
|
+
function debug41(...args) {
|
|
111704
|
+
if (!debug41.enabled) {
|
|
111620
111705
|
return;
|
|
111621
111706
|
}
|
|
111622
|
-
const self2 =
|
|
111707
|
+
const self2 = debug41;
|
|
111623
111708
|
const curr = Number(/* @__PURE__ */ new Date());
|
|
111624
111709
|
const ms = curr - (prevTime || curr);
|
|
111625
111710
|
self2.diff = ms;
|
|
111626
111711
|
self2.prev = prevTime;
|
|
111627
111712
|
self2.curr = curr;
|
|
111628
111713
|
prevTime = curr;
|
|
111629
|
-
args[0] =
|
|
111714
|
+
args[0] = createDebug41.coerce(args[0]);
|
|
111630
111715
|
if (typeof args[0] !== "string") {
|
|
111631
111716
|
args.unshift("%O");
|
|
111632
111717
|
}
|
|
@@ -111636,7 +111721,7 @@ var require_common2 = __commonJS({
|
|
|
111636
111721
|
return "%";
|
|
111637
111722
|
}
|
|
111638
111723
|
index++;
|
|
111639
|
-
const formatter =
|
|
111724
|
+
const formatter = createDebug41.formatters[format];
|
|
111640
111725
|
if (typeof formatter === "function") {
|
|
111641
111726
|
const val = args[index];
|
|
111642
111727
|
match = formatter.call(self2, val);
|
|
@@ -111645,25 +111730,25 @@ var require_common2 = __commonJS({
|
|
|
111645
111730
|
}
|
|
111646
111731
|
return match;
|
|
111647
111732
|
});
|
|
111648
|
-
|
|
111649
|
-
const logFn = self2.log ||
|
|
111733
|
+
createDebug41.formatArgs.call(self2, args);
|
|
111734
|
+
const logFn = self2.log || createDebug41.log;
|
|
111650
111735
|
logFn.apply(self2, args);
|
|
111651
111736
|
}
|
|
111652
|
-
|
|
111653
|
-
|
|
111654
|
-
|
|
111655
|
-
|
|
111656
|
-
|
|
111657
|
-
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", {
|
|
111658
111743
|
enumerable: true,
|
|
111659
111744
|
configurable: false,
|
|
111660
111745
|
get: () => {
|
|
111661
111746
|
if (enableOverride !== null) {
|
|
111662
111747
|
return enableOverride;
|
|
111663
111748
|
}
|
|
111664
|
-
if (namespacesCache !==
|
|
111665
|
-
namespacesCache =
|
|
111666
|
-
enabledCache =
|
|
111749
|
+
if (namespacesCache !== createDebug41.namespaces) {
|
|
111750
|
+
namespacesCache = createDebug41.namespaces;
|
|
111751
|
+
enabledCache = createDebug41.enabled(namespace);
|
|
111667
111752
|
}
|
|
111668
111753
|
return enabledCache;
|
|
111669
111754
|
},
|
|
@@ -111671,27 +111756,27 @@ var require_common2 = __commonJS({
|
|
|
111671
111756
|
enableOverride = v4;
|
|
111672
111757
|
}
|
|
111673
111758
|
});
|
|
111674
|
-
if (typeof
|
|
111675
|
-
|
|
111759
|
+
if (typeof createDebug41.init === "function") {
|
|
111760
|
+
createDebug41.init(debug41);
|
|
111676
111761
|
}
|
|
111677
|
-
return
|
|
111762
|
+
return debug41;
|
|
111678
111763
|
}
|
|
111679
111764
|
function extend2(namespace, delimiter) {
|
|
111680
|
-
const newDebug =
|
|
111765
|
+
const newDebug = createDebug41(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
111681
111766
|
newDebug.log = this.log;
|
|
111682
111767
|
return newDebug;
|
|
111683
111768
|
}
|
|
111684
111769
|
function enable(namespaces) {
|
|
111685
|
-
|
|
111686
|
-
|
|
111687
|
-
|
|
111688
|
-
|
|
111770
|
+
createDebug41.save(namespaces);
|
|
111771
|
+
createDebug41.namespaces = namespaces;
|
|
111772
|
+
createDebug41.names = [];
|
|
111773
|
+
createDebug41.skips = [];
|
|
111689
111774
|
const split2 = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
111690
111775
|
for (const ns of split2) {
|
|
111691
111776
|
if (ns[0] === "-") {
|
|
111692
|
-
|
|
111777
|
+
createDebug41.skips.push(ns.slice(1));
|
|
111693
111778
|
} else {
|
|
111694
|
-
|
|
111779
|
+
createDebug41.names.push(ns);
|
|
111695
111780
|
}
|
|
111696
111781
|
}
|
|
111697
111782
|
}
|
|
@@ -111725,19 +111810,19 @@ var require_common2 = __commonJS({
|
|
|
111725
111810
|
}
|
|
111726
111811
|
function disable() {
|
|
111727
111812
|
const namespaces = [
|
|
111728
|
-
...
|
|
111729
|
-
...
|
|
111813
|
+
...createDebug41.names,
|
|
111814
|
+
...createDebug41.skips.map((namespace) => "-" + namespace)
|
|
111730
111815
|
].join(",");
|
|
111731
|
-
|
|
111816
|
+
createDebug41.enable("");
|
|
111732
111817
|
return namespaces;
|
|
111733
111818
|
}
|
|
111734
111819
|
function enabled(name) {
|
|
111735
|
-
for (const skip of
|
|
111820
|
+
for (const skip of createDebug41.skips) {
|
|
111736
111821
|
if (matchesTemplate(name, skip)) {
|
|
111737
111822
|
return false;
|
|
111738
111823
|
}
|
|
111739
111824
|
}
|
|
111740
|
-
for (const ns of
|
|
111825
|
+
for (const ns of createDebug41.names) {
|
|
111741
111826
|
if (matchesTemplate(name, ns)) {
|
|
111742
111827
|
return true;
|
|
111743
111828
|
}
|
|
@@ -111753,8 +111838,8 @@ var require_common2 = __commonJS({
|
|
|
111753
111838
|
function destroy() {
|
|
111754
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`.");
|
|
111755
111840
|
}
|
|
111756
|
-
|
|
111757
|
-
return
|
|
111841
|
+
createDebug41.enable(createDebug41.load());
|
|
111842
|
+
return createDebug41;
|
|
111758
111843
|
}
|
|
111759
111844
|
module2.exports = setup;
|
|
111760
111845
|
}
|
|
@@ -111898,14 +111983,14 @@ var require_browser = __commonJS({
|
|
|
111898
111983
|
} else {
|
|
111899
111984
|
exports2.storage.removeItem("debug");
|
|
111900
111985
|
}
|
|
111901
|
-
} catch (
|
|
111986
|
+
} catch (error5) {
|
|
111902
111987
|
}
|
|
111903
111988
|
}
|
|
111904
111989
|
function load() {
|
|
111905
111990
|
let r3;
|
|
111906
111991
|
try {
|
|
111907
111992
|
r3 = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
|
|
111908
|
-
} catch (
|
|
111993
|
+
} catch (error5) {
|
|
111909
111994
|
}
|
|
111910
111995
|
if (!r3 && typeof process !== "undefined" && "env" in process) {
|
|
111911
111996
|
r3 = process.env.DEBUG;
|
|
@@ -111915,7 +112000,7 @@ var require_browser = __commonJS({
|
|
|
111915
112000
|
function localstorage() {
|
|
111916
112001
|
try {
|
|
111917
112002
|
return localStorage;
|
|
111918
|
-
} catch (
|
|
112003
|
+
} catch (error5) {
|
|
111919
112004
|
}
|
|
111920
112005
|
}
|
|
111921
112006
|
module2.exports = require_common2()(exports2);
|
|
@@ -111923,8 +112008,8 @@ var require_browser = __commonJS({
|
|
|
111923
112008
|
formatters.j = function(v4) {
|
|
111924
112009
|
try {
|
|
111925
112010
|
return JSON.stringify(v4);
|
|
111926
|
-
} catch (
|
|
111927
|
-
return "[UnexpectedJSONParseError]: " +
|
|
112011
|
+
} catch (error5) {
|
|
112012
|
+
return "[UnexpectedJSONParseError]: " + error5.message;
|
|
111928
112013
|
}
|
|
111929
112014
|
};
|
|
111930
112015
|
}
|
|
@@ -112144,7 +112229,7 @@ var require_node = __commonJS({
|
|
|
112144
112229
|
221
|
|
112145
112230
|
];
|
|
112146
112231
|
}
|
|
112147
|
-
} catch (
|
|
112232
|
+
} catch (error5) {
|
|
112148
112233
|
}
|
|
112149
112234
|
exports2.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
112150
112235
|
return /^debug_/i.test(key);
|
|
@@ -112199,11 +112284,11 @@ var require_node = __commonJS({
|
|
|
112199
112284
|
function load() {
|
|
112200
112285
|
return process.env.DEBUG;
|
|
112201
112286
|
}
|
|
112202
|
-
function init(
|
|
112203
|
-
|
|
112287
|
+
function init(debug41) {
|
|
112288
|
+
debug41.inspectOpts = {};
|
|
112204
112289
|
const keys = Object.keys(exports2.inspectOpts);
|
|
112205
112290
|
for (let i3 = 0; i3 < keys.length; i3++) {
|
|
112206
|
-
|
|
112291
|
+
debug41.inspectOpts[keys[i3]] = exports2.inspectOpts[keys[i3]];
|
|
112207
112292
|
}
|
|
112208
112293
|
}
|
|
112209
112294
|
module2.exports = require_common2()(exports2);
|
|
@@ -112757,7 +112842,10 @@ var init_configuration_schema2 = __esm({
|
|
|
112757
112842
|
paymentMethods: PaymentMethodSchema.array().optional().default(() => []),
|
|
112758
112843
|
facetFieldsForSearch: array(string2()).default(() => []),
|
|
112759
112844
|
listPriceChannelKey: string2().optional(),
|
|
112760
|
-
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." })
|
|
112761
112849
|
});
|
|
112762
112850
|
}
|
|
112763
112851
|
});
|
|
@@ -113100,6 +113188,41 @@ var init_payment_protocol_data = __esm({
|
|
|
113100
113188
|
}
|
|
113101
113189
|
});
|
|
113102
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
|
+
|
|
113103
113226
|
// packages/commercetools/src/factories/checkout/checkout.factory.ts
|
|
113104
113227
|
var CommercetoolsCheckoutFactory;
|
|
113105
113228
|
var init_checkout_factory2 = __esm({
|
|
@@ -113108,6 +113231,7 @@ var init_checkout_factory2 = __esm({
|
|
|
113108
113231
|
init_payment_protocol_data();
|
|
113109
113232
|
init_src();
|
|
113110
113233
|
init_locale_utils();
|
|
113234
|
+
init_shipping_protocol_data();
|
|
113111
113235
|
CommercetoolsCheckoutFactory = class {
|
|
113112
113236
|
checkoutSchema;
|
|
113113
113237
|
shippingMethodSchema;
|
|
@@ -113326,13 +113450,20 @@ var init_checkout_factory2 = __esm({
|
|
|
113326
113450
|
const instructions = data.custom?.fields["shippingInstruction"] || "";
|
|
113327
113451
|
const consentForUnattendedDelivery = data.custom?.fields["consentForUnattendedDelivery"] === "true";
|
|
113328
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
|
+
);
|
|
113329
113458
|
const result = {
|
|
113330
113459
|
shippingMethod: {
|
|
113331
113460
|
key: data.shippingInfo.shippingMethod?.obj?.key || ""
|
|
113332
113461
|
},
|
|
113333
113462
|
pickupPoint,
|
|
113334
113463
|
instructions,
|
|
113335
|
-
consentForUnattendedDelivery
|
|
113464
|
+
consentForUnattendedDelivery,
|
|
113465
|
+
store,
|
|
113466
|
+
protocolData
|
|
113336
113467
|
};
|
|
113337
113468
|
return result;
|
|
113338
113469
|
}
|
|
@@ -114796,10 +114927,10 @@ var init_category_capability2 = __esm({
|
|
|
114796
114927
|
}
|
|
114797
114928
|
}
|
|
114798
114929
|
path2.push(category);
|
|
114799
|
-
} catch (
|
|
114930
|
+
} catch (error5) {
|
|
114800
114931
|
console.error(
|
|
114801
114932
|
`Error fetching category path for ${payload.id.key}:`,
|
|
114802
|
-
|
|
114933
|
+
error5
|
|
114803
114934
|
);
|
|
114804
114935
|
}
|
|
114805
114936
|
return success(path2);
|
|
@@ -114821,10 +114952,10 @@ var init_category_capability2 = __esm({
|
|
|
114821
114952
|
}).execute();
|
|
114822
114953
|
const result = this.factory.parseCategoryPaginatedResult(this.context, response.body, payload);
|
|
114823
114954
|
return success(result);
|
|
114824
|
-
} catch (
|
|
114955
|
+
} catch (error5) {
|
|
114825
114956
|
console.error(
|
|
114826
114957
|
`Error fetching category path for ${payload.parentId.key}:`,
|
|
114827
|
-
|
|
114958
|
+
error5
|
|
114828
114959
|
);
|
|
114829
114960
|
}
|
|
114830
114961
|
const empty = {
|
|
@@ -114850,8 +114981,8 @@ var init_category_capability2 = __esm({
|
|
|
114850
114981
|
}).execute();
|
|
114851
114982
|
const result = this.factory.parseCategoryPaginatedResult(this.context, response.body, payload);
|
|
114852
114983
|
return success(result);
|
|
114853
|
-
} catch (
|
|
114854
|
-
console.error(`Error fetching category top categories:`,
|
|
114984
|
+
} catch (error5) {
|
|
114985
|
+
console.error(`Error fetching category top categories:`, error5);
|
|
114855
114986
|
}
|
|
114856
114987
|
const empty = {
|
|
114857
114988
|
items: [],
|
|
@@ -114900,6 +115031,16 @@ var init_category_capability2 = __esm({
|
|
|
114900
115031
|
}
|
|
114901
115032
|
});
|
|
114902
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
|
+
|
|
114903
115044
|
// packages/commercetools/src/schema/commercetools.schema.ts
|
|
114904
115045
|
var CommercetoolsCartIdentifierSchema, CommercetoolsProductListIdentifierSchema, CommercetoolsCartItemIdentifierSchema, CommercetoolsOrderIdentifierSchema, CommercetoolsCheckoutIdentifierSchema, CommercetoolsResolveCategoryQueryByKeySchema, CommercetoolsResolveCategoryQueryByIdSchema, CommercetoolsCategoryLookupSchema, CommercetoolsEmployeeInviteCustomObjectValueSchema, CommercetoolsEmployeeInviteCustomObjectSchema;
|
|
114905
115046
|
var init_commercetools_schema = __esm({
|
|
@@ -114960,6 +115101,8 @@ var init_checkout_capability2 = __esm({
|
|
|
114960
115101
|
"packages/commercetools/src/capabilities/checkout.capability.ts"() {
|
|
114961
115102
|
"use strict";
|
|
114962
115103
|
init_payment_protocol_data();
|
|
115104
|
+
init_shipping_protocol_data();
|
|
115105
|
+
init_shipping_fulfillment();
|
|
114963
115106
|
init_src();
|
|
114964
115107
|
init_zod();
|
|
114965
115108
|
init_locale_utils();
|
|
@@ -115106,10 +115249,25 @@ var init_checkout_capability2 = __esm({
|
|
|
115106
115249
|
client.carts.withId({ ID: payload.checkout.key }).get().execute()
|
|
115107
115250
|
]);
|
|
115108
115251
|
const result = shippingMethodsResponse.body.results.map(
|
|
115109
|
-
(shippingMethod) => this.
|
|
115252
|
+
(shippingMethod) => this.withFulfillmentType(
|
|
115253
|
+
this.factory.parseShippingMethod(this.context, this.withFreeShipping(shippingMethod, cartResponse.body)),
|
|
115254
|
+
shippingMethod
|
|
115255
|
+
)
|
|
115110
115256
|
);
|
|
115111
115257
|
return success(result);
|
|
115112
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
|
+
}
|
|
115113
115271
|
/**
|
|
115114
115272
|
* Quotes the matching shipping rates as free where the cart reaches the
|
|
115115
115273
|
* rate's free-above threshold. commercetools' matching-cart query returns
|
|
@@ -115221,6 +115379,20 @@ var init_checkout_capability2 = __esm({
|
|
|
115221
115379
|
name: "pickupPointId",
|
|
115222
115380
|
value: payload.shippingInstruction.pickupPoint
|
|
115223
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
|
+
}
|
|
115224
115396
|
const result = await this.applyActions(
|
|
115225
115397
|
payload.checkout,
|
|
115226
115398
|
actions
|
|
@@ -116796,9 +116968,9 @@ var init_product_search_capability3 = __esm({
|
|
|
116796
116968
|
continue;
|
|
116797
116969
|
}
|
|
116798
116970
|
facetValue.name = category.name[this.languageCode] || category.id;
|
|
116799
|
-
} catch (
|
|
116971
|
+
} catch (error5) {
|
|
116800
116972
|
if (debug3.enabled) {
|
|
116801
|
-
debug3(`Error resolving category key for id ${facetValue.identifier.key}:`,
|
|
116973
|
+
debug3(`Error resolving category key for id ${facetValue.identifier.key}:`, error5);
|
|
116802
116974
|
}
|
|
116803
116975
|
}
|
|
116804
116976
|
}
|
|
@@ -117195,6 +117367,48 @@ var init_store_capability2 = __esm({
|
|
|
117195
117367
|
}
|
|
117196
117368
|
return success(results);
|
|
117197
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
|
+
}
|
|
117198
117412
|
};
|
|
117199
117413
|
__decorateClass([
|
|
117200
117414
|
Reactionary({
|
|
@@ -117202,6 +117416,18 @@ var init_store_capability2 = __esm({
|
|
|
117202
117416
|
outputSchema: array(StoreSchema)
|
|
117203
117417
|
})
|
|
117204
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);
|
|
117205
117431
|
}
|
|
117206
117432
|
});
|
|
117207
117433
|
|
|
@@ -117298,11 +117524,11 @@ var init_company_registration_capability2 = __esm({
|
|
|
117298
117524
|
message: "Only registered users can check company registration status"
|
|
117299
117525
|
});
|
|
117300
117526
|
}
|
|
117301
|
-
const response = await client.businessUnits().withId({ ID: payload.requestIdentifier.key }).get().execute().catch((
|
|
117302
|
-
if (
|
|
117527
|
+
const response = await client.businessUnits().withId({ ID: payload.requestIdentifier.key }).get().execute().catch((error5) => {
|
|
117528
|
+
if (error5?.statusCode === 404) {
|
|
117303
117529
|
return null;
|
|
117304
117530
|
}
|
|
117305
|
-
throw
|
|
117531
|
+
throw error5;
|
|
117306
117532
|
});
|
|
117307
117533
|
if (!response) {
|
|
117308
117534
|
return error2({
|
|
@@ -118212,11 +118438,11 @@ var init_employee_invitation_capability2 = __esm({
|
|
|
118212
118438
|
const response = await adminClient.customObjects().withContainerAndKey({
|
|
118213
118439
|
container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS_INDEX,
|
|
118214
118440
|
key
|
|
118215
|
-
}).get().execute().catch((
|
|
118216
|
-
if (
|
|
118441
|
+
}).get().execute().catch((error5) => {
|
|
118442
|
+
if (error5?.statusCode === 404) {
|
|
118217
118443
|
return null;
|
|
118218
118444
|
}
|
|
118219
|
-
throw
|
|
118445
|
+
throw error5;
|
|
118220
118446
|
});
|
|
118221
118447
|
if (!response) {
|
|
118222
118448
|
return [];
|
|
@@ -118275,11 +118501,11 @@ var init_employee_invitation_capability2 = __esm({
|
|
|
118275
118501
|
allInviteIds = allInviteIds.slice(start, end);
|
|
118276
118502
|
}
|
|
118277
118503
|
for (const invitationId of allInviteIds) {
|
|
118278
|
-
const invitationResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationId }).get().execute().catch((
|
|
118279
|
-
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) {
|
|
118280
118506
|
return null;
|
|
118281
118507
|
}
|
|
118282
|
-
throw
|
|
118508
|
+
throw error5;
|
|
118283
118509
|
});
|
|
118284
118510
|
const invitation = invitationResponse?.body;
|
|
118285
118511
|
if (!invitation) {
|
|
@@ -118302,11 +118528,11 @@ var init_employee_invitation_capability2 = __esm({
|
|
|
118302
118528
|
return this.fetchInvitations(adminClient, this.makeKeyFromEmail(userEmail), onlyActive, paginationOptions);
|
|
118303
118529
|
}
|
|
118304
118530
|
async fetchInvitationByKey(adminClient, invitationKey) {
|
|
118305
|
-
const inviteResponse = await adminClient.customObjects().withContainerAndKey({ container: COMMERCERTOOLS_CUSTOM_OBJECT_CONTAINER_EMPLOYEE_INVITATIONS, key: invitationKey }).get().execute().catch((
|
|
118306
|
-
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) {
|
|
118307
118533
|
return null;
|
|
118308
118534
|
}
|
|
118309
|
-
throw
|
|
118535
|
+
throw error5;
|
|
118310
118536
|
});
|
|
118311
118537
|
if (!inviteResponse) {
|
|
118312
118538
|
return null;
|
|
@@ -118410,11 +118636,11 @@ var init_employee_invitation_capability2 = __esm({
|
|
|
118410
118636
|
error: `Invitation token is invalid.`
|
|
118411
118637
|
});
|
|
118412
118638
|
}
|
|
118413
|
-
const businessUnit = await adminClient.businessUnits().withKey({ key: invitation.value.company.taxIdentifier }).get().execute().catch((
|
|
118414
|
-
if (
|
|
118639
|
+
const businessUnit = await adminClient.businessUnits().withKey({ key: invitation.value.company.taxIdentifier }).get().execute().catch((error5) => {
|
|
118640
|
+
if (error5?.statusCode === 404) {
|
|
118415
118641
|
return null;
|
|
118416
118642
|
}
|
|
118417
|
-
throw
|
|
118643
|
+
throw error5;
|
|
118418
118644
|
});
|
|
118419
118645
|
if (!businessUnit) {
|
|
118420
118646
|
return error2({
|
|
@@ -123048,6 +123274,7 @@ var init_store_capability3 = __esm({
|
|
|
123048
123274
|
init_src();
|
|
123049
123275
|
init_zod();
|
|
123050
123276
|
init_dist();
|
|
123277
|
+
init_seed();
|
|
123051
123278
|
FakeStoreCapability = class extends StoreCapability {
|
|
123052
123279
|
config;
|
|
123053
123280
|
factory;
|
|
@@ -123056,26 +123283,82 @@ var init_store_capability3 = __esm({
|
|
|
123056
123283
|
this.config = config3;
|
|
123057
123284
|
this.factory = factory;
|
|
123058
123285
|
}
|
|
123059
|
-
|
|
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) {
|
|
123060
123312
|
const generator = new Qe2({
|
|
123061
|
-
seed:
|
|
123313
|
+
seed: calcSeed(key),
|
|
123062
123314
|
locale: [ys, Oi]
|
|
123063
123315
|
});
|
|
123064
|
-
const
|
|
123065
|
-
|
|
123066
|
-
|
|
123067
|
-
|
|
123068
|
-
|
|
123069
|
-
|
|
123070
|
-
|
|
123071
|
-
|
|
123072
|
-
|
|
123073
|
-
|
|
123074
|
-
|
|
123075
|
-
|
|
123076
|
-
|
|
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 });
|
|
123077
123360
|
}
|
|
123078
|
-
return success(
|
|
123361
|
+
return success(store);
|
|
123079
123362
|
}
|
|
123080
123363
|
};
|
|
123081
123364
|
__decorateClass([
|
|
@@ -123084,6 +123367,18 @@ var init_store_capability3 = __esm({
|
|
|
123084
123367
|
outputSchema: array(StoreSchema)
|
|
123085
123368
|
})
|
|
123086
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);
|
|
123087
123382
|
}
|
|
123088
123383
|
});
|
|
123089
123384
|
|
|
@@ -124896,6 +125191,8 @@ var init_profile_capability4 = __esm({
|
|
|
124896
125191
|
const updated = await this.magentoApi.updateMe({
|
|
124897
125192
|
...customer,
|
|
124898
125193
|
email: payload.email ?? customer.email,
|
|
125194
|
+
firstname: payload.firstName ?? customer.firstname,
|
|
125195
|
+
lastname: payload.lastName ?? customer.lastname,
|
|
124899
125196
|
custom_attributes: customAttributes
|
|
124900
125197
|
});
|
|
124901
125198
|
return success(this.factory.parseProfile(this.context, updated));
|
|
@@ -127641,6 +127938,8 @@ var init_profile_factory4 = __esm({
|
|
|
127641
127938
|
userId: String(customer.id)
|
|
127642
127939
|
},
|
|
127643
127940
|
email: customer.email,
|
|
127941
|
+
firstName: customer.firstname,
|
|
127942
|
+
lastName: customer.lastname,
|
|
127644
127943
|
emailVerified: true,
|
|
127645
127944
|
phone,
|
|
127646
127945
|
phoneVerified: false,
|
|
@@ -128398,7 +128697,8 @@ var init_medusa_schema = __esm({
|
|
|
128398
128697
|
token: string2().optional(),
|
|
128399
128698
|
expires: string2().optional(),
|
|
128400
128699
|
allRegions: array(MedusaRegionSchema).optional(),
|
|
128401
|
-
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." })
|
|
128402
128702
|
});
|
|
128403
128703
|
}
|
|
128404
128704
|
});
|
|
@@ -128434,7 +128734,8 @@ var init_capabilities_schema6 = __esm({
|
|
|
128434
128734
|
profile: true,
|
|
128435
128735
|
productAssociations: true,
|
|
128436
128736
|
personalizationProfile: true,
|
|
128437
|
-
company: true
|
|
128737
|
+
company: true,
|
|
128738
|
+
store: true
|
|
128438
128739
|
}).extend({
|
|
128439
128740
|
product: OverridableCapabilitySchema4.optional(),
|
|
128440
128741
|
productSearch: OverridableCapabilitySchema4.optional(),
|
|
@@ -128453,7 +128754,8 @@ var init_capabilities_schema6 = __esm({
|
|
|
128453
128754
|
profile: OverridableCapabilitySchema4.optional(),
|
|
128454
128755
|
productAssociations: OverridableCapabilitySchema4.optional(),
|
|
128455
128756
|
productRecommendations: DirectCapabilitySchema2.optional(),
|
|
128456
|
-
personalizationProfile: OverridableCapabilitySchema4.optional()
|
|
128757
|
+
personalizationProfile: OverridableCapabilitySchema4.optional(),
|
|
128758
|
+
store: OverridableCapabilitySchema4.optional()
|
|
128457
128759
|
}).partial();
|
|
128458
128760
|
}
|
|
128459
128761
|
});
|
|
@@ -138012,9 +138314,9 @@ var init_client5 = __esm({
|
|
|
138012
138314
|
return __asyncGenerator(this, arguments, function* () {
|
|
138013
138315
|
const res = yield __await(fetchPromise);
|
|
138014
138316
|
if (!res.ok) {
|
|
138015
|
-
const
|
|
138016
|
-
|
|
138017
|
-
throw
|
|
138317
|
+
const error5 = new Error(`Stream failed with status ${res.status}`);
|
|
138318
|
+
error5.name = "HttpError";
|
|
138319
|
+
throw error5;
|
|
138018
138320
|
}
|
|
138019
138321
|
yield __await(yield* __asyncDelegator(__asyncValues(events(res, abortController.signal))));
|
|
138020
138322
|
});
|
|
@@ -158173,10 +158475,10 @@ var init_client6 = __esm({
|
|
|
158173
158475
|
});
|
|
158174
158476
|
const identity = await this.login(email3, password, reqCtx);
|
|
158175
158477
|
return identity;
|
|
158176
|
-
} catch (
|
|
158177
|
-
debug21("Registration failed:",
|
|
158478
|
+
} catch (error5) {
|
|
158479
|
+
debug21("Registration failed:", error5);
|
|
158178
158480
|
throw new Error(
|
|
158179
|
-
`Registration failed: ${
|
|
158481
|
+
`Registration failed: ${error5 instanceof Error ? error5.message : "Unknown error"}`
|
|
158180
158482
|
);
|
|
158181
158483
|
}
|
|
158182
158484
|
}
|
|
@@ -158206,10 +158508,10 @@ var init_client6 = __esm({
|
|
|
158206
158508
|
return {
|
|
158207
158509
|
type: "Anonymous"
|
|
158208
158510
|
};
|
|
158209
|
-
} catch (
|
|
158210
|
-
debug21("Login failed:",
|
|
158511
|
+
} catch (error5) {
|
|
158512
|
+
debug21("Login failed:", error5);
|
|
158211
158513
|
throw new Error(
|
|
158212
|
-
`Login failed: ${
|
|
158514
|
+
`Login failed: ${error5 instanceof Error ? error5.message : "Unknown error"}`
|
|
158213
158515
|
);
|
|
158214
158516
|
}
|
|
158215
158517
|
}
|
|
@@ -158222,8 +158524,8 @@ var init_client6 = __esm({
|
|
|
158222
158524
|
await client.auth.logout();
|
|
158223
158525
|
await client.client.clearToken();
|
|
158224
158526
|
return identity;
|
|
158225
|
-
} catch (
|
|
158226
|
-
debug21("Logout failed:",
|
|
158527
|
+
} catch (error5) {
|
|
158528
|
+
debug21("Logout failed:", error5);
|
|
158227
158529
|
await client.client.clearToken();
|
|
158228
158530
|
return identity;
|
|
158229
158531
|
}
|
|
@@ -158250,8 +158552,8 @@ var init_client6 = __esm({
|
|
|
158250
158552
|
});
|
|
158251
158553
|
|
|
158252
158554
|
// packages/medusa/src/utils/medusa-helpers.ts
|
|
158253
|
-
function isNotFoundFetchError(
|
|
158254
|
-
return
|
|
158555
|
+
function isNotFoundFetchError(error5) {
|
|
158556
|
+
return error5 instanceof FetchError && error5.status === 404;
|
|
158255
158557
|
}
|
|
158256
158558
|
function parseMedusaCostBreakdown(remote) {
|
|
158257
158559
|
const grandTotal = remote.total || 0;
|
|
@@ -158310,12 +158612,12 @@ function parseMedusaItemPrice(remoteItem, currency) {
|
|
|
158310
158612
|
}
|
|
158311
158613
|
};
|
|
158312
158614
|
}
|
|
158313
|
-
function handleProviderError(action,
|
|
158615
|
+
function handleProviderError(action, error5) {
|
|
158314
158616
|
if (debug22.enabled) {
|
|
158315
|
-
debug22(`Failed to ${action}:`,
|
|
158617
|
+
debug22(`Failed to ${action}:`, error5);
|
|
158316
158618
|
}
|
|
158317
158619
|
throw new Error(
|
|
158318
|
-
`Failed to ${action}: ${
|
|
158620
|
+
`Failed to ${action}: ${error5 instanceof Error ? error5.message : "Unknown error"}`
|
|
158319
158621
|
);
|
|
158320
158622
|
}
|
|
158321
158623
|
function safeBoolConvert(val) {
|
|
@@ -158608,8 +158910,8 @@ var init_cart_capability5 = __esm({
|
|
|
158608
158910
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158609
158911
|
}
|
|
158610
158912
|
throw new Error("Failed to add item to cart");
|
|
158611
|
-
} catch (
|
|
158612
|
-
handleProviderError("add item to cart",
|
|
158913
|
+
} catch (error5) {
|
|
158914
|
+
handleProviderError("add item to cart", error5);
|
|
158613
158915
|
}
|
|
158614
158916
|
}
|
|
158615
158917
|
async renameCart(payload) {
|
|
@@ -158740,8 +159042,8 @@ var init_cart_capability5 = __esm({
|
|
|
158740
159042
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158741
159043
|
}
|
|
158742
159044
|
throw new Error("Failed to create cart");
|
|
158743
|
-
} catch (
|
|
158744
|
-
handleProviderError("create cart",
|
|
159045
|
+
} catch (error5) {
|
|
159046
|
+
handleProviderError("create cart", error5);
|
|
158745
159047
|
}
|
|
158746
159048
|
}
|
|
158747
159049
|
async remove(payload) {
|
|
@@ -158759,8 +159061,8 @@ var init_cart_capability5 = __esm({
|
|
|
158759
159061
|
return success(this.factory.parseCart(this.context, response.parent));
|
|
158760
159062
|
}
|
|
158761
159063
|
throw new Error("Failed to remove item from cart");
|
|
158762
|
-
} catch (
|
|
158763
|
-
handleProviderError("remove item from cart",
|
|
159064
|
+
} catch (error5) {
|
|
159065
|
+
handleProviderError("remove item from cart", error5);
|
|
158764
159066
|
}
|
|
158765
159067
|
}
|
|
158766
159068
|
/**
|
|
@@ -158794,8 +159096,8 @@ var init_cart_capability5 = __esm({
|
|
|
158794
159096
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158795
159097
|
}
|
|
158796
159098
|
throw new Error("Failed to change item quantity");
|
|
158797
|
-
} catch (
|
|
158798
|
-
handleProviderError("change item quantity",
|
|
159099
|
+
} catch (error5) {
|
|
159100
|
+
handleProviderError("change item quantity", error5);
|
|
158799
159101
|
}
|
|
158800
159102
|
}
|
|
158801
159103
|
async getActiveCartId() {
|
|
@@ -158888,8 +159190,8 @@ var init_cart_capability5 = __esm({
|
|
|
158888
159190
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158889
159191
|
}
|
|
158890
159192
|
throw new Error("Failed to apply coupon code");
|
|
158891
|
-
} catch (
|
|
158892
|
-
handleProviderError("apply coupon code",
|
|
159193
|
+
} catch (error5) {
|
|
159194
|
+
handleProviderError("apply coupon code", error5);
|
|
158893
159195
|
}
|
|
158894
159196
|
}
|
|
158895
159197
|
/**
|
|
@@ -158920,8 +159222,8 @@ var init_cart_capability5 = __esm({
|
|
|
158920
159222
|
return success(this.factory.parseCart(this.context, response.cart));
|
|
158921
159223
|
}
|
|
158922
159224
|
throw new Error("Failed to remove coupon code");
|
|
158923
|
-
} catch (
|
|
158924
|
-
handleProviderError("remove coupon code",
|
|
159225
|
+
} catch (error5) {
|
|
159226
|
+
handleProviderError("remove coupon code", error5);
|
|
158925
159227
|
}
|
|
158926
159228
|
}
|
|
158927
159229
|
/**
|
|
@@ -158953,8 +159255,8 @@ var init_cart_capability5 = __esm({
|
|
|
158953
159255
|
return success(this.factory.parseCart(this.context, updatedCartResponse.cart));
|
|
158954
159256
|
}
|
|
158955
159257
|
throw new Error("Failed to change currency");
|
|
158956
|
-
} catch (
|
|
158957
|
-
handleProviderError("change currency",
|
|
159258
|
+
} catch (error5) {
|
|
159259
|
+
handleProviderError("change currency", error5);
|
|
158958
159260
|
}
|
|
158959
159261
|
}
|
|
158960
159262
|
async getClient() {
|
|
@@ -159211,6 +159513,7 @@ var init_checkout_capability5 = __esm({
|
|
|
159211
159513
|
init_src();
|
|
159212
159514
|
import_debug24 = __toESM(require_src(), 1);
|
|
159213
159515
|
init_zod();
|
|
159516
|
+
init_client6();
|
|
159214
159517
|
init_medusa_helpers();
|
|
159215
159518
|
debug24 = (0, import_debug24.default)("reactionary:medusa:checkout");
|
|
159216
159519
|
CheckoutNotReadyForFinalizationError3 = class extends Error {
|
|
@@ -159240,6 +159543,16 @@ var init_checkout_capability5 = __esm({
|
|
|
159240
159543
|
* example: this.includedFields = [includedFields, '+discounts.*'].join(',');
|
|
159241
159544
|
*/
|
|
159242
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(",");
|
|
159243
159556
|
initiateCheckoutForCartPayload(payload) {
|
|
159244
159557
|
return {
|
|
159245
159558
|
billing_address: payload.billingAddress ? this.mapAddressToStoreAddress(payload.billingAddress) : void 0,
|
|
@@ -159272,7 +159585,9 @@ var init_checkout_capability5 = __esm({
|
|
|
159272
159585
|
const response = await client.store.cart.retrieve(payload.identifier.key, {
|
|
159273
159586
|
fields: this.includedFields
|
|
159274
159587
|
});
|
|
159275
|
-
return success(
|
|
159588
|
+
return success(
|
|
159589
|
+
this.hydrateResultingOrder(this.factory.parseCheckout(this.context, response.cart))
|
|
159590
|
+
);
|
|
159276
159591
|
} catch (err) {
|
|
159277
159592
|
if (isNotFoundFetchError(err)) {
|
|
159278
159593
|
return error2({
|
|
@@ -159301,7 +159616,8 @@ var init_checkout_capability5 = __esm({
|
|
|
159301
159616
|
}
|
|
159302
159617
|
getAvailableShippingMethodsPayload(payload) {
|
|
159303
159618
|
return {
|
|
159304
|
-
cart_id: payload.checkout.key
|
|
159619
|
+
cart_id: payload.checkout.key,
|
|
159620
|
+
fields: this.shippingOptionFields
|
|
159305
159621
|
};
|
|
159306
159622
|
}
|
|
159307
159623
|
/**
|
|
@@ -159430,10 +159746,10 @@ var init_checkout_capability5 = __esm({
|
|
|
159430
159746
|
}
|
|
159431
159747
|
);
|
|
159432
159748
|
return success(this.factory.parseCheckout(this.context, updatedCartResponse.cart));
|
|
159433
|
-
} catch (
|
|
159434
|
-
debug24("Failed to add payment instruction: {0}", [
|
|
159749
|
+
} catch (error5) {
|
|
159750
|
+
debug24("Failed to add payment instruction: {0}", [error5]);
|
|
159435
159751
|
throw new Error(
|
|
159436
|
-
`Failed to add payment instruction: ${
|
|
159752
|
+
`Failed to add payment instruction: ${error5 instanceof Error ? error5.message : "Unknown error"}`
|
|
159437
159753
|
);
|
|
159438
159754
|
}
|
|
159439
159755
|
}
|
|
@@ -159449,6 +159765,50 @@ var init_checkout_capability5 = __esm({
|
|
|
159449
159765
|
}
|
|
159450
159766
|
};
|
|
159451
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
|
+
}
|
|
159452
159812
|
async setShippingInstruction(payload) {
|
|
159453
159813
|
const client = await this.medusaApi.getClient();
|
|
159454
159814
|
const medusaId = payload.checkout;
|
|
@@ -159456,13 +159816,22 @@ var init_checkout_capability5 = __esm({
|
|
|
159456
159816
|
if (payload.shippingInstruction.shippingMethod) {
|
|
159457
159817
|
await client.store.cart.addShippingMethod(medusaId.key, this.setShippingInstructionPayload(payload));
|
|
159458
159818
|
}
|
|
159459
|
-
|
|
159819
|
+
const cartUpdate = {
|
|
159460
159820
|
metadata: {
|
|
159461
159821
|
consent_for_unattended_delivery: payload.shippingInstruction.consentForUnattendedDelivery + "",
|
|
159462
159822
|
instructions: payload.shippingInstruction.instructions || "",
|
|
159463
|
-
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) || ""
|
|
159464
159826
|
}
|
|
159465
|
-
}
|
|
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);
|
|
159466
159835
|
const response = await client.store.cart.retrieve(medusaId.key, {
|
|
159467
159836
|
fields: this.includedFields
|
|
159468
159837
|
});
|
|
@@ -159470,8 +159839,8 @@ var init_checkout_capability5 = __esm({
|
|
|
159470
159839
|
return success(this.factory.parseCheckout(this.context, response.cart));
|
|
159471
159840
|
}
|
|
159472
159841
|
throw new Error("Failed to set shipping method");
|
|
159473
|
-
} catch (
|
|
159474
|
-
handleProviderError("set shipping method",
|
|
159842
|
+
} catch (error5) {
|
|
159843
|
+
handleProviderError("set shipping method", error5);
|
|
159475
159844
|
}
|
|
159476
159845
|
}
|
|
159477
159846
|
async finalizeCheckout(payload) {
|
|
@@ -159485,14 +159854,24 @@ var init_checkout_capability5 = __esm({
|
|
|
159485
159854
|
if (!checkout.value.resultingOrder) {
|
|
159486
159855
|
const client = await this.medusaApi.getClient();
|
|
159487
159856
|
const medusaId = payload.checkout;
|
|
159857
|
+
await client.store.cart.update(medusaId.key, {
|
|
159858
|
+
metadata: {
|
|
159859
|
+
cart_id: medusaId.key
|
|
159860
|
+
}
|
|
159861
|
+
});
|
|
159488
159862
|
const response = await client.store.cart.complete(medusaId.key);
|
|
159489
159863
|
if (response.type === "order") {
|
|
159864
|
+
const resultingOrder = this.parseCompletedOrderIdentifier(response.order);
|
|
159865
|
+
this.rememberFinalizedOrder(medusaId.key, resultingOrder);
|
|
159490
159866
|
checkout = await this.getById({
|
|
159491
159867
|
identifier: payload.checkout
|
|
159492
159868
|
});
|
|
159493
159869
|
if (!checkout.success) {
|
|
159494
159870
|
throw new Error(`Unable to reload checkout ${payload.checkout.key} after completion`);
|
|
159495
159871
|
}
|
|
159872
|
+
if (!checkout.value.resultingOrder) {
|
|
159873
|
+
checkout = success({ ...checkout.value, resultingOrder });
|
|
159874
|
+
}
|
|
159496
159875
|
} else {
|
|
159497
159876
|
throw new Error(`Failed to finalize checkout ${payload.checkout.key}. Expected order, got ${response.type}`);
|
|
159498
159877
|
}
|
|
@@ -159512,6 +159891,48 @@ var init_checkout_capability5 = __esm({
|
|
|
159512
159891
|
}
|
|
159513
159892
|
return success(checkout.value);
|
|
159514
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
|
+
}
|
|
159515
159936
|
/**
|
|
159516
159937
|
* Extension point to map an Address to a Store Address
|
|
159517
159938
|
* @param address
|
|
@@ -160515,8 +160936,8 @@ var init_identity_capability5 = __esm({
|
|
|
160515
160936
|
const identity = this.createAnonymousIdentity();
|
|
160516
160937
|
this.updateIdentityContext(identity);
|
|
160517
160938
|
return success(identity);
|
|
160518
|
-
} catch (
|
|
160519
|
-
debug29("getSelf failed, returning anonymous identity:",
|
|
160939
|
+
} catch (error5) {
|
|
160940
|
+
debug29("getSelf failed, returning anonymous identity:", error5);
|
|
160520
160941
|
const identity = this.createAnonymousIdentity();
|
|
160521
160942
|
this.updateIdentityContext(identity);
|
|
160522
160943
|
return success(identity);
|
|
@@ -160853,10 +161274,10 @@ var init_price_capability5 = __esm({
|
|
|
160853
161274
|
return this.createEmptyPriceResult(sku);
|
|
160854
161275
|
}
|
|
160855
161276
|
return this.factory.parsePrice(this.context, { variant, mode });
|
|
160856
|
-
} catch (
|
|
161277
|
+
} catch (error5) {
|
|
160857
161278
|
if (debug33.enabled) {
|
|
160858
161279
|
debug33(
|
|
160859
|
-
`Error fetching price for SKU ${sku}: ${
|
|
161280
|
+
`Error fetching price for SKU ${sku}: ${error5.message}`
|
|
160860
161281
|
);
|
|
160861
161282
|
}
|
|
160862
161283
|
return this.createEmptyPriceResult(sku);
|
|
@@ -160917,9 +161338,9 @@ var init_product_search_capability6 = __esm({
|
|
|
160917
161338
|
break;
|
|
160918
161339
|
}
|
|
160919
161340
|
offset += limit;
|
|
160920
|
-
} catch (
|
|
161341
|
+
} catch (error5) {
|
|
160921
161342
|
throw new Error(
|
|
160922
|
-
"Category not found " + externalId + " due to error: " +
|
|
161343
|
+
"Category not found " + externalId + " due to error: " + error5
|
|
160923
161344
|
);
|
|
160924
161345
|
break;
|
|
160925
161346
|
}
|
|
@@ -161104,11 +161525,11 @@ var init_product_recommendations_capability4 = __esm({
|
|
|
161104
161525
|
debug35(`Returning ${recommendations.length} recommendations`);
|
|
161105
161526
|
}
|
|
161106
161527
|
return success(recommendations);
|
|
161107
|
-
} catch (
|
|
161528
|
+
} catch (error5) {
|
|
161108
161529
|
if (debug35.enabled) {
|
|
161109
|
-
debug35(`Error fetching collection recommendations: %O`,
|
|
161530
|
+
debug35(`Error fetching collection recommendations: %O`, error5);
|
|
161110
161531
|
}
|
|
161111
|
-
console.error("Error fetching collection recommendations:",
|
|
161532
|
+
console.error("Error fetching collection recommendations:", error5);
|
|
161112
161533
|
return success([]);
|
|
161113
161534
|
}
|
|
161114
161535
|
}
|
|
@@ -161722,6 +162143,173 @@ var init_personalization_profile_capability4 = __esm({
|
|
|
161722
162143
|
}
|
|
161723
162144
|
});
|
|
161724
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
|
+
|
|
161725
162313
|
// packages/medusa/src/factories/cart/cart.factory.ts
|
|
161726
162314
|
var MedusaCartFactory;
|
|
161727
162315
|
var init_cart_factory5 = __esm({
|
|
@@ -162054,15 +162642,23 @@ var init_checkout_factory5 = __esm({
|
|
|
162054
162642
|
const backupUnattendedDelivery = data.metadata?.["consent_for_unattended_delivery"] !== void 0 ? data.metadata?.["consent_for_unattended_delivery"] === "true" : void 0;
|
|
162055
162643
|
const backupInstructions = data.metadata?.["instructions"] != null ? String(data.metadata["instructions"]) : void 0;
|
|
162056
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
|
+
);
|
|
162057
162649
|
let shippingInstruction;
|
|
162058
162650
|
data.shipping_methods?.forEach((sm) => {
|
|
162059
162651
|
let pickupPoint = "";
|
|
162060
162652
|
let instructions = "";
|
|
162061
162653
|
let consentForUnattendedDelivery = false;
|
|
162654
|
+
let pickupStore;
|
|
162655
|
+
let protocolData;
|
|
162062
162656
|
if (sm.data) {
|
|
162063
162657
|
pickupPoint = sm.data["pickup_point"] != null ? String(sm.data["pickup_point"]) : "";
|
|
162064
162658
|
instructions = sm.data["instructions"] != null ? String(sm.data["instructions"]) : "";
|
|
162065
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"]);
|
|
162066
162662
|
}
|
|
162067
162663
|
if (!pickupPoint) {
|
|
162068
162664
|
pickupPoint = backupPickupPoint || "";
|
|
@@ -162073,11 +162669,19 @@ var init_checkout_factory5 = __esm({
|
|
|
162073
162669
|
if (!consentForUnattendedDelivery) {
|
|
162074
162670
|
consentForUnattendedDelivery = backupUnattendedDelivery || false;
|
|
162075
162671
|
}
|
|
162672
|
+
if (!pickupStore) {
|
|
162673
|
+
pickupStore = backupPickupStore;
|
|
162674
|
+
}
|
|
162675
|
+
if (!protocolData) {
|
|
162676
|
+
protocolData = backupShippingProtocolData;
|
|
162677
|
+
}
|
|
162076
162678
|
shippingInstruction = {
|
|
162077
|
-
shippingMethod: { key: sm.shipping_option_id },
|
|
162679
|
+
shippingMethod: { key: sm.shipping_option_id || "" },
|
|
162078
162680
|
consentForUnattendedDelivery,
|
|
162079
162681
|
instructions,
|
|
162080
|
-
pickupPoint
|
|
162682
|
+
pickupPoint,
|
|
162683
|
+
store: pickupStore ? { key: pickupStore } : void 0,
|
|
162684
|
+
protocolData
|
|
162081
162685
|
};
|
|
162082
162686
|
});
|
|
162083
162687
|
const paymentInstructions = new Array();
|
|
@@ -162141,10 +162745,71 @@ var init_checkout_factory5 = __esm({
|
|
|
162141
162745
|
value: data.calculated_price.calculated_amount || 0,
|
|
162142
162746
|
currency: data.calculated_price.currency_code?.toUpperCase() || _context.languageContext.currencyCode
|
|
162143
162747
|
}),
|
|
162144
|
-
deliveryTime: ""
|
|
162748
|
+
deliveryTime: "",
|
|
162749
|
+
fulfillmentType: this.parseFulfillmentType(_context, data),
|
|
162750
|
+
protocolData: this.parseShippingMethodProtocolData(_context, data)
|
|
162145
162751
|
};
|
|
162146
162752
|
return this.shippingMethodSchema.parse(sm);
|
|
162147
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
|
+
}
|
|
162148
162813
|
parsePaymentInstruction(_context, remotePayment, checkout) {
|
|
162149
162814
|
const mainSession = (remotePayment.payment_sessions || []).find(
|
|
162150
162815
|
(session) => session.status !== "canceled" && session.status !== "error"
|
|
@@ -162727,15 +163392,15 @@ var init_price_factory5 = __esm({
|
|
|
162727
163392
|
});
|
|
162728
163393
|
|
|
162729
163394
|
// packages/medusa/src/factories/product/product.factory.ts
|
|
162730
|
-
var
|
|
163395
|
+
var import_debug40, debug40, MedusaProductFactory;
|
|
162731
163396
|
var init_product_factory5 = __esm({
|
|
162732
163397
|
"packages/medusa/src/factories/product/product.factory.ts"() {
|
|
162733
163398
|
"use strict";
|
|
162734
163399
|
init_src();
|
|
162735
|
-
|
|
163400
|
+
import_debug40 = __toESM(require_src(), 1);
|
|
162736
163401
|
init_medusa_helpers();
|
|
162737
163402
|
init_product_compliance();
|
|
162738
|
-
|
|
163403
|
+
debug40 = (0, import_debug40.default)("reactionary:medusa:product");
|
|
162739
163404
|
MedusaProductFactory = class {
|
|
162740
163405
|
productSchema;
|
|
162741
163406
|
constructor(productSchema) {
|
|
@@ -162904,7 +163569,7 @@ var init_product_factory5 = __esm({
|
|
|
162904
163569
|
const sharedAttributes = this.parseAttributes(context2, data);
|
|
162905
163570
|
const complianceData = this.parseComplianceData(context2, data);
|
|
162906
163571
|
if (!data.variants) {
|
|
162907
|
-
|
|
163572
|
+
debug40("Product has no variants", data);
|
|
162908
163573
|
throw new Error("Product has no variants " + data.external_id);
|
|
162909
163574
|
}
|
|
162910
163575
|
const mainVariant = this.parseVariant(context2, data.variants[0], data);
|
|
@@ -163148,6 +163813,60 @@ var init_personalization_profile_factory4 = __esm({
|
|
|
163148
163813
|
}
|
|
163149
163814
|
});
|
|
163150
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
|
+
|
|
163151
163870
|
// packages/medusa/src/factories/index.ts
|
|
163152
163871
|
var init_factories5 = __esm({
|
|
163153
163872
|
"packages/medusa/src/factories/index.ts"() {
|
|
@@ -163169,6 +163888,7 @@ var init_factories5 = __esm({
|
|
|
163169
163888
|
init_product_search_factory6();
|
|
163170
163889
|
init_profile_factory5();
|
|
163171
163890
|
init_personalization_profile_factory4();
|
|
163891
|
+
init_store_factory4();
|
|
163172
163892
|
}
|
|
163173
163893
|
});
|
|
163174
163894
|
|
|
@@ -163491,6 +164211,22 @@ function withMedusaCapabilities(configuration, capabilities) {
|
|
|
163491
164211
|
buildCapabilityArgs
|
|
163492
164212
|
);
|
|
163493
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
|
+
}
|
|
163494
164230
|
if (caps.personalizationProfile?.enabled) {
|
|
163495
164231
|
client.personalizationProfile = resolveCapabilityWithFactory5(
|
|
163496
164232
|
capabilities.personalizationProfile,
|
|
@@ -163532,6 +164268,7 @@ var init_initialize5 = __esm({
|
|
|
163532
164268
|
init_product_associations_capability5();
|
|
163533
164269
|
init_profile_capability5();
|
|
163534
164270
|
init_personalization_profile_capability4();
|
|
164271
|
+
init_store_capability4();
|
|
163535
164272
|
init_capabilities_schema6();
|
|
163536
164273
|
init_configuration_schema5();
|
|
163537
164274
|
init_client6();
|
|
@@ -163569,6 +164306,7 @@ var init_src6 = __esm({
|
|
|
163569
164306
|
init_checkout_capability5();
|
|
163570
164307
|
init_product_capability5();
|
|
163571
164308
|
init_personalization_profile_capability4();
|
|
164309
|
+
init_store_capability4();
|
|
163572
164310
|
}
|
|
163573
164311
|
});
|
|
163574
164312
|
|
|
@@ -164989,8 +165727,8 @@ var init_product_recommendations_capability5 = __esm({
|
|
|
164989
165727
|
try {
|
|
164990
165728
|
const response = await index.searchSimilarDocuments(this.getSimilarProductsRecommendationsPayload(query));
|
|
164991
165729
|
return this.parseRecommendations(response, "similar");
|
|
164992
|
-
} catch (
|
|
164993
|
-
console.error("Error fetching similar product recommendations:",
|
|
165730
|
+
} catch (error5) {
|
|
165731
|
+
console.error("Error fetching similar product recommendations:", error5);
|
|
164994
165732
|
return [];
|
|
164995
165733
|
}
|
|
164996
165734
|
}
|
|
@@ -165456,9 +166194,9 @@ var require_main = __commonJS({
|
|
|
165456
166194
|
const attrs = _instructions(result, key);
|
|
165457
166195
|
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
165458
166196
|
break;
|
|
165459
|
-
} catch (
|
|
166197
|
+
} catch (error5) {
|
|
165460
166198
|
if (i3 + 1 >= length) {
|
|
165461
|
-
throw
|
|
166199
|
+
throw error5;
|
|
165462
166200
|
}
|
|
165463
166201
|
}
|
|
165464
166202
|
}
|
|
@@ -165486,13 +166224,13 @@ var require_main = __commonJS({
|
|
|
165486
166224
|
let uri;
|
|
165487
166225
|
try {
|
|
165488
166226
|
uri = new URL(dotenvKey);
|
|
165489
|
-
} catch (
|
|
165490
|
-
if (
|
|
166227
|
+
} catch (error5) {
|
|
166228
|
+
if (error5.code === "ERR_INVALID_URL") {
|
|
165491
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");
|
|
165492
166230
|
err.code = "INVALID_DOTENV_KEY";
|
|
165493
166231
|
throw err;
|
|
165494
166232
|
}
|
|
165495
|
-
throw
|
|
166233
|
+
throw error5;
|
|
165496
166234
|
}
|
|
165497
166235
|
const key = uri.password;
|
|
165498
166236
|
if (!key) {
|
|
@@ -165539,9 +166277,9 @@ var require_main = __commonJS({
|
|
|
165539
166277
|
return envPath[0] === "~" ? path2.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
165540
166278
|
}
|
|
165541
166279
|
function _configVault(options) {
|
|
165542
|
-
const
|
|
166280
|
+
const debug41 = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
165543
166281
|
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
165544
|
-
if (
|
|
166282
|
+
if (debug41 || !quiet) {
|
|
165545
166283
|
_log("loading env from encrypted .env.vault");
|
|
165546
166284
|
}
|
|
165547
166285
|
const parsed = DotenvModule._parseVault(options);
|
|
@@ -165559,12 +166297,12 @@ var require_main = __commonJS({
|
|
|
165559
166297
|
if (options && options.processEnv != null) {
|
|
165560
166298
|
processEnv = options.processEnv;
|
|
165561
166299
|
}
|
|
165562
|
-
let
|
|
166300
|
+
let debug41 = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
165563
166301
|
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
165564
166302
|
if (options && options.encoding) {
|
|
165565
166303
|
encoding = options.encoding;
|
|
165566
166304
|
} else {
|
|
165567
|
-
if (
|
|
166305
|
+
if (debug41) {
|
|
165568
166306
|
_debug("no encoding is specified (UTF-8 is used by default)");
|
|
165569
166307
|
}
|
|
165570
166308
|
}
|
|
@@ -165586,16 +166324,16 @@ var require_main = __commonJS({
|
|
|
165586
166324
|
const parsed = DotenvModule.parse(fs2.readFileSync(path3, { encoding }));
|
|
165587
166325
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
165588
166326
|
} catch (e2) {
|
|
165589
|
-
if (
|
|
166327
|
+
if (debug41) {
|
|
165590
166328
|
_debug(`failed to load ${path3} ${e2.message}`);
|
|
165591
166329
|
}
|
|
165592
166330
|
lastError = e2;
|
|
165593
166331
|
}
|
|
165594
166332
|
}
|
|
165595
166333
|
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
165596
|
-
|
|
166334
|
+
debug41 = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug41);
|
|
165597
166335
|
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
165598
|
-
if (
|
|
166336
|
+
if (debug41 || !quiet) {
|
|
165599
166337
|
const keysCount = Object.keys(populated).length;
|
|
165600
166338
|
const shortPaths = [];
|
|
165601
166339
|
for (const filePath of optionPaths) {
|
|
@@ -165603,7 +166341,7 @@ var require_main = __commonJS({
|
|
|
165603
166341
|
const relative = path2.relative(process.cwd(), filePath);
|
|
165604
166342
|
shortPaths.push(relative);
|
|
165605
166343
|
} catch (e2) {
|
|
165606
|
-
if (
|
|
166344
|
+
if (debug41) {
|
|
165607
166345
|
_debug(`failed to load ${filePath} ${e2.message}`);
|
|
165608
166346
|
}
|
|
165609
166347
|
lastError = e2;
|
|
@@ -165638,10 +166376,10 @@ var require_main = __commonJS({
|
|
|
165638
166376
|
const aesgcm = crypto4.createDecipheriv("aes-256-gcm", key, nonce);
|
|
165639
166377
|
aesgcm.setAuthTag(authTag);
|
|
165640
166378
|
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
165641
|
-
} catch (
|
|
165642
|
-
const isRange =
|
|
165643
|
-
const invalidKeyLength =
|
|
165644
|
-
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";
|
|
165645
166383
|
if (isRange || invalidKeyLength) {
|
|
165646
166384
|
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
165647
166385
|
err.code = "INVALID_DOTENV_KEY";
|
|
@@ -165651,12 +166389,12 @@ var require_main = __commonJS({
|
|
|
165651
166389
|
err.code = "DECRYPTION_FAILED";
|
|
165652
166390
|
throw err;
|
|
165653
166391
|
} else {
|
|
165654
|
-
throw
|
|
166392
|
+
throw error5;
|
|
165655
166393
|
}
|
|
165656
166394
|
}
|
|
165657
166395
|
}
|
|
165658
166396
|
function populate(processEnv, parsed, options = {}) {
|
|
165659
|
-
const
|
|
166397
|
+
const debug41 = Boolean(options && options.debug);
|
|
165660
166398
|
const override = Boolean(options && options.override);
|
|
165661
166399
|
const populated = {};
|
|
165662
166400
|
if (typeof parsed !== "object") {
|
|
@@ -165670,7 +166408,7 @@ var require_main = __commonJS({
|
|
|
165670
166408
|
processEnv[key] = parsed[key];
|
|
165671
166409
|
populated[key] = parsed[key];
|
|
165672
166410
|
}
|
|
165673
|
-
if (
|
|
166411
|
+
if (debug41) {
|
|
165674
166412
|
if (override === true) {
|
|
165675
166413
|
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
165676
166414
|
} else {
|
|
@@ -169117,11 +169855,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
169117
169855
|
*/
|
|
169118
169856
|
_getOutputContext(contextOptions) {
|
|
169119
169857
|
contextOptions = contextOptions || {};
|
|
169120
|
-
const
|
|
169858
|
+
const error5 = !!contextOptions.error;
|
|
169121
169859
|
let baseWrite;
|
|
169122
169860
|
let hasColors;
|
|
169123
169861
|
let helpWidth;
|
|
169124
|
-
if (
|
|
169862
|
+
if (error5) {
|
|
169125
169863
|
baseWrite = (str) => this._outputConfiguration.writeErr(str);
|
|
169126
169864
|
hasColors = this._outputConfiguration.getErrHasColors();
|
|
169127
169865
|
helpWidth = this._outputConfiguration.getErrHelpWidth();
|
|
@@ -169134,7 +169872,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
169134
169872
|
if (!hasColors) str = this._outputConfiguration.stripColor(str);
|
|
169135
169873
|
return baseWrite(str);
|
|
169136
169874
|
};
|
|
169137
|
-
return { error:
|
|
169875
|
+
return { error: error5, write, hasColors, helpWidth };
|
|
169138
169876
|
}
|
|
169139
169877
|
/**
|
|
169140
169878
|
* Output help information for this command.
|
|
@@ -170833,11 +171571,11 @@ function validate(subject, name, url2, level) {
|
|
|
170833
171571
|
}
|
|
170834
171572
|
});
|
|
170835
171573
|
}
|
|
170836
|
-
function handleError(
|
|
171574
|
+
function handleError(error5, level) {
|
|
170837
171575
|
if (level === ErrorLevel.THROW) {
|
|
170838
|
-
throw
|
|
171576
|
+
throw error5;
|
|
170839
171577
|
} else if (level === ErrorLevel.WARN) {
|
|
170840
|
-
console.warn(
|
|
171578
|
+
console.warn(error5.name, error5.message);
|
|
170841
171579
|
}
|
|
170842
171580
|
}
|
|
170843
171581
|
function validateSMIOptions(conf, level = ErrorLevel.WARN, errorHandler = handleError) {
|
|
@@ -171380,7 +172118,7 @@ function fanoutAsyncIterable(source, consumerCount) {
|
|
|
171380
172118
|
const waiters = Array.from({ length: consumerCount }, () => []);
|
|
171381
172119
|
const capacityWaiters = [];
|
|
171382
172120
|
let done = false;
|
|
171383
|
-
let
|
|
172121
|
+
let error5 = void 0;
|
|
171384
172122
|
const producer = (async () => {
|
|
171385
172123
|
try {
|
|
171386
172124
|
for await (const item of source) {
|
|
@@ -171397,7 +172135,7 @@ function fanoutAsyncIterable(source, consumerCount) {
|
|
|
171397
172135
|
}
|
|
171398
172136
|
}
|
|
171399
172137
|
} catch (caught) {
|
|
171400
|
-
|
|
172138
|
+
error5 = caught;
|
|
171401
172139
|
} finally {
|
|
171402
172140
|
done = true;
|
|
171403
172141
|
for (const queueWaiters of waiters) {
|
|
@@ -171415,8 +172153,8 @@ function fanoutAsyncIterable(source, consumerCount) {
|
|
|
171415
172153
|
continue;
|
|
171416
172154
|
}
|
|
171417
172155
|
if (done) {
|
|
171418
|
-
if (
|
|
171419
|
-
throw
|
|
172156
|
+
if (error5) {
|
|
172157
|
+
throw error5;
|
|
171420
172158
|
}
|
|
171421
172159
|
await producer;
|
|
171422
172160
|
return;
|
|
@@ -171570,8 +172308,8 @@ function parseProductConcurrency(value, fallback2) {
|
|
|
171570
172308
|
}
|
|
171571
172309
|
return Math.floor(parsed);
|
|
171572
172310
|
}
|
|
171573
|
-
main().catch((
|
|
171574
|
-
console.error(
|
|
172311
|
+
main().catch((error5) => {
|
|
172312
|
+
console.error(error5);
|
|
171575
172313
|
process.exit(1);
|
|
171576
172314
|
});
|
|
171577
172315
|
/*! Bundled license information:
|