norn-cli 1.5.0 → 1.5.1
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/.norn-cache/swagger-body-intellisense.json +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/cli.js +423 -230
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8881,11 +8881,11 @@ var require_mime_types = __commonJS({
|
|
|
8881
8881
|
}
|
|
8882
8882
|
return exts[0];
|
|
8883
8883
|
}
|
|
8884
|
-
function lookup(
|
|
8885
|
-
if (!
|
|
8884
|
+
function lookup(path6) {
|
|
8885
|
+
if (!path6 || typeof path6 !== "string") {
|
|
8886
8886
|
return false;
|
|
8887
8887
|
}
|
|
8888
|
-
var extension2 = extname2("x." +
|
|
8888
|
+
var extension2 = extname2("x." + path6).toLowerCase().substr(1);
|
|
8889
8889
|
if (!extension2) {
|
|
8890
8890
|
return false;
|
|
8891
8891
|
}
|
|
@@ -9990,11 +9990,11 @@ var require_form_data = __commonJS({
|
|
|
9990
9990
|
"use strict";
|
|
9991
9991
|
var CombinedStream = require_combined_stream();
|
|
9992
9992
|
var util3 = require("util");
|
|
9993
|
-
var
|
|
9993
|
+
var path6 = require("path");
|
|
9994
9994
|
var http3 = require("http");
|
|
9995
9995
|
var https2 = require("https");
|
|
9996
9996
|
var parseUrl = require("url").parse;
|
|
9997
|
-
var
|
|
9997
|
+
var fs7 = require("fs");
|
|
9998
9998
|
var Stream = require("stream").Stream;
|
|
9999
9999
|
var crypto2 = require("crypto");
|
|
10000
10000
|
var mime = require_mime_types();
|
|
@@ -10061,7 +10061,7 @@ var require_form_data = __commonJS({
|
|
|
10061
10061
|
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
10062
10062
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
10063
10063
|
} else {
|
|
10064
|
-
|
|
10064
|
+
fs7.stat(value.path, function(err, stat) {
|
|
10065
10065
|
if (err) {
|
|
10066
10066
|
callback(err);
|
|
10067
10067
|
return;
|
|
@@ -10118,11 +10118,11 @@ var require_form_data = __commonJS({
|
|
|
10118
10118
|
FormData3.prototype._getContentDisposition = function(value, options) {
|
|
10119
10119
|
var filename;
|
|
10120
10120
|
if (typeof options.filepath === "string") {
|
|
10121
|
-
filename =
|
|
10121
|
+
filename = path6.normalize(options.filepath).replace(/\\/g, "/");
|
|
10122
10122
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
10123
|
-
filename =
|
|
10123
|
+
filename = path6.basename(options.filename || value && (value.name || value.path));
|
|
10124
10124
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
10125
|
-
filename =
|
|
10125
|
+
filename = path6.basename(value.client._httpMessage.path || "");
|
|
10126
10126
|
}
|
|
10127
10127
|
if (filename) {
|
|
10128
10128
|
return 'filename="' + filename + '"';
|
|
@@ -11599,8 +11599,8 @@ var require_follow_redirects = __commonJS({
|
|
|
11599
11599
|
}
|
|
11600
11600
|
return parsed;
|
|
11601
11601
|
}
|
|
11602
|
-
function resolveUrl(
|
|
11603
|
-
return useNativeURL ? new URL2(
|
|
11602
|
+
function resolveUrl(relative3, base) {
|
|
11603
|
+
return useNativeURL ? new URL2(relative3, base) : parseUrl(url2.resolve(base, relative3));
|
|
11604
11604
|
}
|
|
11605
11605
|
function validateUrl(input) {
|
|
11606
11606
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -15089,7 +15089,7 @@ var require_compile = __commonJS({
|
|
|
15089
15089
|
const schOrFunc = root.refs[ref];
|
|
15090
15090
|
if (schOrFunc)
|
|
15091
15091
|
return schOrFunc;
|
|
15092
|
-
let _sch =
|
|
15092
|
+
let _sch = resolve6.call(this, root, ref);
|
|
15093
15093
|
if (_sch === void 0) {
|
|
15094
15094
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
15095
15095
|
const { schemaId } = this.opts;
|
|
@@ -15116,7 +15116,7 @@ var require_compile = __commonJS({
|
|
|
15116
15116
|
function sameSchemaEnv(s1, s2) {
|
|
15117
15117
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
15118
15118
|
}
|
|
15119
|
-
function
|
|
15119
|
+
function resolve6(root, ref) {
|
|
15120
15120
|
let sch;
|
|
15121
15121
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
15122
15122
|
ref = sch;
|
|
@@ -15331,8 +15331,8 @@ var require_utils = __commonJS({
|
|
|
15331
15331
|
}
|
|
15332
15332
|
return ind;
|
|
15333
15333
|
}
|
|
15334
|
-
function removeDotSegments(
|
|
15335
|
-
let input =
|
|
15334
|
+
function removeDotSegments(path6) {
|
|
15335
|
+
let input = path6;
|
|
15336
15336
|
const output = [];
|
|
15337
15337
|
let nextSlash = -1;
|
|
15338
15338
|
let len = 0;
|
|
@@ -15531,8 +15531,8 @@ var require_schemes = __commonJS({
|
|
|
15531
15531
|
wsComponent.secure = void 0;
|
|
15532
15532
|
}
|
|
15533
15533
|
if (wsComponent.resourceName) {
|
|
15534
|
-
const [
|
|
15535
|
-
wsComponent.path =
|
|
15534
|
+
const [path6, query] = wsComponent.resourceName.split("?");
|
|
15535
|
+
wsComponent.path = path6 && path6 !== "/" ? path6 : void 0;
|
|
15536
15536
|
wsComponent.query = query;
|
|
15537
15537
|
wsComponent.resourceName = void 0;
|
|
15538
15538
|
}
|
|
@@ -15691,55 +15691,55 @@ var require_fast_uri = __commonJS({
|
|
|
15691
15691
|
}
|
|
15692
15692
|
return uri;
|
|
15693
15693
|
}
|
|
15694
|
-
function
|
|
15694
|
+
function resolve6(baseURI, relativeURI, options) {
|
|
15695
15695
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
15696
15696
|
const resolved = resolveComponent(parse2(baseURI, schemelessOptions), parse2(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
15697
15697
|
schemelessOptions.skipEscape = true;
|
|
15698
15698
|
return serialize(resolved, schemelessOptions);
|
|
15699
15699
|
}
|
|
15700
|
-
function resolveComponent(base,
|
|
15700
|
+
function resolveComponent(base, relative3, options, skipNormalization) {
|
|
15701
15701
|
const target = {};
|
|
15702
15702
|
if (!skipNormalization) {
|
|
15703
15703
|
base = parse2(serialize(base, options), options);
|
|
15704
|
-
|
|
15704
|
+
relative3 = parse2(serialize(relative3, options), options);
|
|
15705
15705
|
}
|
|
15706
15706
|
options = options || {};
|
|
15707
|
-
if (!options.tolerant &&
|
|
15708
|
-
target.scheme =
|
|
15709
|
-
target.userinfo =
|
|
15710
|
-
target.host =
|
|
15711
|
-
target.port =
|
|
15712
|
-
target.path = removeDotSegments(
|
|
15713
|
-
target.query =
|
|
15707
|
+
if (!options.tolerant && relative3.scheme) {
|
|
15708
|
+
target.scheme = relative3.scheme;
|
|
15709
|
+
target.userinfo = relative3.userinfo;
|
|
15710
|
+
target.host = relative3.host;
|
|
15711
|
+
target.port = relative3.port;
|
|
15712
|
+
target.path = removeDotSegments(relative3.path || "");
|
|
15713
|
+
target.query = relative3.query;
|
|
15714
15714
|
} else {
|
|
15715
|
-
if (
|
|
15716
|
-
target.userinfo =
|
|
15717
|
-
target.host =
|
|
15718
|
-
target.port =
|
|
15719
|
-
target.path = removeDotSegments(
|
|
15720
|
-
target.query =
|
|
15715
|
+
if (relative3.userinfo !== void 0 || relative3.host !== void 0 || relative3.port !== void 0) {
|
|
15716
|
+
target.userinfo = relative3.userinfo;
|
|
15717
|
+
target.host = relative3.host;
|
|
15718
|
+
target.port = relative3.port;
|
|
15719
|
+
target.path = removeDotSegments(relative3.path || "");
|
|
15720
|
+
target.query = relative3.query;
|
|
15721
15721
|
} else {
|
|
15722
|
-
if (!
|
|
15722
|
+
if (!relative3.path) {
|
|
15723
15723
|
target.path = base.path;
|
|
15724
|
-
if (
|
|
15725
|
-
target.query =
|
|
15724
|
+
if (relative3.query !== void 0) {
|
|
15725
|
+
target.query = relative3.query;
|
|
15726
15726
|
} else {
|
|
15727
15727
|
target.query = base.query;
|
|
15728
15728
|
}
|
|
15729
15729
|
} else {
|
|
15730
|
-
if (
|
|
15731
|
-
target.path = removeDotSegments(
|
|
15730
|
+
if (relative3.path[0] === "/") {
|
|
15731
|
+
target.path = removeDotSegments(relative3.path);
|
|
15732
15732
|
} else {
|
|
15733
15733
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
15734
|
-
target.path = "/" +
|
|
15734
|
+
target.path = "/" + relative3.path;
|
|
15735
15735
|
} else if (!base.path) {
|
|
15736
|
-
target.path =
|
|
15736
|
+
target.path = relative3.path;
|
|
15737
15737
|
} else {
|
|
15738
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
15738
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative3.path;
|
|
15739
15739
|
}
|
|
15740
15740
|
target.path = removeDotSegments(target.path);
|
|
15741
15741
|
}
|
|
15742
|
-
target.query =
|
|
15742
|
+
target.query = relative3.query;
|
|
15743
15743
|
}
|
|
15744
15744
|
target.userinfo = base.userinfo;
|
|
15745
15745
|
target.host = base.host;
|
|
@@ -15747,7 +15747,7 @@ var require_fast_uri = __commonJS({
|
|
|
15747
15747
|
}
|
|
15748
15748
|
target.scheme = base.scheme;
|
|
15749
15749
|
}
|
|
15750
|
-
target.fragment =
|
|
15750
|
+
target.fragment = relative3.fragment;
|
|
15751
15751
|
return target;
|
|
15752
15752
|
}
|
|
15753
15753
|
function equal(uriA, uriB, options) {
|
|
@@ -15918,7 +15918,7 @@ var require_fast_uri = __commonJS({
|
|
|
15918
15918
|
var fastUri = {
|
|
15919
15919
|
SCHEMES,
|
|
15920
15920
|
normalize,
|
|
15921
|
-
resolve:
|
|
15921
|
+
resolve: resolve6,
|
|
15922
15922
|
resolveComponent,
|
|
15923
15923
|
equal,
|
|
15924
15924
|
serialize,
|
|
@@ -18738,8 +18738,8 @@ function validateAgainstSchemaDetailed(value, schemaPath, basePath, workspaceRoo
|
|
|
18738
18738
|
if (!valid && validate2.errors) {
|
|
18739
18739
|
const errors = validate2.errors.map((err) => convertAjvError(err, value));
|
|
18740
18740
|
const errorStrings = validate2.errors.map((err) => {
|
|
18741
|
-
const
|
|
18742
|
-
return `${
|
|
18741
|
+
const path6 = err.instancePath || "(root)";
|
|
18742
|
+
return `${path6}: ${err.message}`;
|
|
18743
18743
|
});
|
|
18744
18744
|
return {
|
|
18745
18745
|
valid: false,
|
|
@@ -18868,7 +18868,7 @@ function resolveValue(expr, responses, variables, getValueByPath2, responseIndex
|
|
|
18868
18868
|
if (refMatch) {
|
|
18869
18869
|
const responseIdx = parseInt(refMatch[1], 10);
|
|
18870
18870
|
const responseIndex = responseIdx - 1;
|
|
18871
|
-
const
|
|
18871
|
+
const path6 = refMatch[2];
|
|
18872
18872
|
if (responseIndex < 0 || responseIndex >= responses.length) {
|
|
18873
18873
|
return {
|
|
18874
18874
|
value: void 0,
|
|
@@ -18876,12 +18876,12 @@ function resolveValue(expr, responses, variables, getValueByPath2, responseIndex
|
|
|
18876
18876
|
};
|
|
18877
18877
|
}
|
|
18878
18878
|
const response = responses[responseIndex];
|
|
18879
|
-
const value = getValueByPath2(response,
|
|
18879
|
+
const value = getValueByPath2(response, path6);
|
|
18880
18880
|
return {
|
|
18881
18881
|
value,
|
|
18882
18882
|
responseIndex: responseIdx,
|
|
18883
18883
|
response,
|
|
18884
|
-
jsonPath:
|
|
18884
|
+
jsonPath: path6,
|
|
18885
18885
|
variableName: responseIndexToVariable?.get(responseIdx)
|
|
18886
18886
|
};
|
|
18887
18887
|
}
|
|
@@ -18898,22 +18898,22 @@ function resolveValue(expr, responses, variables, getValueByPath2, responseIndex
|
|
|
18898
18898
|
if (varName in variables) {
|
|
18899
18899
|
const varValue = variables[varName];
|
|
18900
18900
|
if (typeof varValue === "object" && varValue !== null) {
|
|
18901
|
-
const
|
|
18902
|
-
const value = getNestedValue2(varValue,
|
|
18901
|
+
const path6 = pathPart.replace(/^\./, "");
|
|
18902
|
+
const value = getNestedValue2(varValue, path6);
|
|
18903
18903
|
const isHttpResponse = "status" in varValue && "body" in varValue;
|
|
18904
18904
|
return {
|
|
18905
18905
|
value,
|
|
18906
18906
|
variableName: varName,
|
|
18907
|
-
jsonPath:
|
|
18907
|
+
jsonPath: path6,
|
|
18908
18908
|
response: isHttpResponse ? varValue : void 0
|
|
18909
18909
|
};
|
|
18910
18910
|
}
|
|
18911
18911
|
if (typeof varValue === "string") {
|
|
18912
18912
|
try {
|
|
18913
18913
|
const parsed = JSON.parse(varValue);
|
|
18914
|
-
const
|
|
18915
|
-
const value = getNestedValue2(parsed,
|
|
18916
|
-
return { value, variableName: varName, jsonPath:
|
|
18914
|
+
const path6 = pathPart.replace(/^\./, "");
|
|
18915
|
+
const value = getNestedValue2(parsed, path6);
|
|
18916
|
+
return { value, variableName: varName, jsonPath: path6 };
|
|
18917
18917
|
} catch {
|
|
18918
18918
|
return { value: void 0, error: `Cannot access path on non-object variable: ${varName}` };
|
|
18919
18919
|
}
|
|
@@ -18969,11 +18969,11 @@ function resolveValue(expr, responses, variables, getValueByPath2, responseIndex
|
|
|
18969
18969
|
}
|
|
18970
18970
|
return { value: void 0, error: `Cannot resolve expression: ${trimmed}` };
|
|
18971
18971
|
}
|
|
18972
|
-
function getNestedValue2(obj,
|
|
18973
|
-
if (!
|
|
18972
|
+
function getNestedValue2(obj, path6) {
|
|
18973
|
+
if (!path6 || obj === null || obj === void 0) {
|
|
18974
18974
|
return obj;
|
|
18975
18975
|
}
|
|
18976
|
-
const parts =
|
|
18976
|
+
const parts = path6.replace(/\[(\d+)\]/g, ".$1").split(".").filter((p) => p !== "");
|
|
18977
18977
|
let current = obj;
|
|
18978
18978
|
for (const part of parts) {
|
|
18979
18979
|
if (current === null || current === void 0) {
|
|
@@ -19769,16 +19769,16 @@ var init_source = __esm({
|
|
|
19769
19769
|
});
|
|
19770
19770
|
|
|
19771
19771
|
// src/cli.ts
|
|
19772
|
-
var
|
|
19772
|
+
var fs6 = __toESM(require("fs"));
|
|
19773
19773
|
var fsPromises = __toESM(require("fs/promises"));
|
|
19774
|
-
var
|
|
19774
|
+
var path5 = __toESM(require("path"));
|
|
19775
19775
|
|
|
19776
19776
|
// src/nornapiParser.ts
|
|
19777
|
-
function extractPathParameters(
|
|
19777
|
+
function extractPathParameters(path6) {
|
|
19778
19778
|
const params = [];
|
|
19779
19779
|
const regex = /(?<!\{)\{([a-zA-Z_][a-zA-Z0-9_]*)\}(?!\})/g;
|
|
19780
19780
|
let match;
|
|
19781
|
-
while ((match = regex.exec(
|
|
19781
|
+
while ((match = regex.exec(path6)) !== null) {
|
|
19782
19782
|
params.push(match[1]);
|
|
19783
19783
|
}
|
|
19784
19784
|
return params;
|
|
@@ -19828,12 +19828,12 @@ function parseNornApiFile(content) {
|
|
|
19828
19828
|
if (inEndpointsBlock) {
|
|
19829
19829
|
const endpointMatch = trimmed.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*:\s*(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+(.+)$/i);
|
|
19830
19830
|
if (endpointMatch) {
|
|
19831
|
-
const
|
|
19831
|
+
const path6 = endpointMatch[3].trim();
|
|
19832
19832
|
endpoints.push({
|
|
19833
19833
|
name: endpointMatch[1],
|
|
19834
19834
|
method: endpointMatch[2].toUpperCase(),
|
|
19835
|
-
path:
|
|
19836
|
-
parameters: extractPathParameters(
|
|
19835
|
+
path: path6,
|
|
19836
|
+
parameters: extractPathParameters(path6)
|
|
19837
19837
|
});
|
|
19838
19838
|
}
|
|
19839
19839
|
continue;
|
|
@@ -20123,11 +20123,11 @@ function extractFileLevelVariables(text) {
|
|
|
20123
20123
|
}
|
|
20124
20124
|
return variables;
|
|
20125
20125
|
}
|
|
20126
|
-
function getNestedValue(obj,
|
|
20127
|
-
if (!
|
|
20126
|
+
function getNestedValue(obj, path6) {
|
|
20127
|
+
if (!path6 || obj === null || obj === void 0) {
|
|
20128
20128
|
return obj;
|
|
20129
20129
|
}
|
|
20130
|
-
const parts =
|
|
20130
|
+
const parts = path6.replace(/\[(\d+)\]/g, ".$1").split(".").filter((p) => p !== "");
|
|
20131
20131
|
let current = obj;
|
|
20132
20132
|
for (const part of parts) {
|
|
20133
20133
|
if (current === null || current === void 0) {
|
|
@@ -20159,8 +20159,8 @@ function substituteVariables(text, variables) {
|
|
|
20159
20159
|
const value = variables[varName];
|
|
20160
20160
|
if (typeof value === "object" && value !== null) {
|
|
20161
20161
|
if (pathPart) {
|
|
20162
|
-
const
|
|
20163
|
-
const nestedValue = getNestedValue(value,
|
|
20162
|
+
const path6 = pathPart.replace(/^\./, "");
|
|
20163
|
+
const nestedValue = getNestedValue(value, path6);
|
|
20164
20164
|
return valueToString(nestedValue);
|
|
20165
20165
|
}
|
|
20166
20166
|
return valueToString(value);
|
|
@@ -20168,8 +20168,8 @@ function substituteVariables(text, variables) {
|
|
|
20168
20168
|
if (pathPart && typeof value === "string") {
|
|
20169
20169
|
try {
|
|
20170
20170
|
const parsed = JSON.parse(value);
|
|
20171
|
-
const
|
|
20172
|
-
const nestedValue = getNestedValue(parsed,
|
|
20171
|
+
const path6 = pathPart.replace(/^\./, "");
|
|
20172
|
+
const nestedValue = getNestedValue(parsed, path6);
|
|
20173
20173
|
return valueToString(nestedValue);
|
|
20174
20174
|
} catch {
|
|
20175
20175
|
return value;
|
|
@@ -20285,8 +20285,8 @@ async function resolveImports(text, baseDir, readFile2, alreadyImported = /* @__
|
|
|
20285
20285
|
const namedRequestSources = /* @__PURE__ */ new Map();
|
|
20286
20286
|
const sequenceSources = /* @__PURE__ */ new Map();
|
|
20287
20287
|
for (const imp of imports) {
|
|
20288
|
-
const
|
|
20289
|
-
const absolutePath =
|
|
20288
|
+
const path6 = await import("path");
|
|
20289
|
+
const absolutePath = path6.resolve(baseDir, imp.path);
|
|
20290
20290
|
if (importStack.has(absolutePath)) {
|
|
20291
20291
|
errors.push({
|
|
20292
20292
|
path: imp.path,
|
|
@@ -20333,7 +20333,7 @@ async function resolveImports(text, baseDir, readFile2, alreadyImported = /* @__
|
|
|
20333
20333
|
}
|
|
20334
20334
|
continue;
|
|
20335
20335
|
}
|
|
20336
|
-
const importDir =
|
|
20336
|
+
const importDir = path6.dirname(absolutePath);
|
|
20337
20337
|
const nestedResult = await resolveImports(content, importDir, readFile2, alreadyImported, importStack);
|
|
20338
20338
|
errors.push(...nestedResult.errors);
|
|
20339
20339
|
resolvedPaths.push(...nestedResult.resolvedPaths);
|
|
@@ -20932,9 +20932,9 @@ function isVisitable(thing) {
|
|
|
20932
20932
|
function removeBrackets(key) {
|
|
20933
20933
|
return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
20934
20934
|
}
|
|
20935
|
-
function renderKey(
|
|
20936
|
-
if (!
|
|
20937
|
-
return
|
|
20935
|
+
function renderKey(path6, key, dots) {
|
|
20936
|
+
if (!path6) return key;
|
|
20937
|
+
return path6.concat(key).map(function each(token, i) {
|
|
20938
20938
|
token = removeBrackets(token);
|
|
20939
20939
|
return !dots && i ? "[" + token + "]" : token;
|
|
20940
20940
|
}).join(dots ? "." : "");
|
|
@@ -20982,9 +20982,9 @@ function toFormData(obj, formData, options) {
|
|
|
20982
20982
|
}
|
|
20983
20983
|
return value;
|
|
20984
20984
|
}
|
|
20985
|
-
function defaultVisitor(value, key,
|
|
20985
|
+
function defaultVisitor(value, key, path6) {
|
|
20986
20986
|
let arr = value;
|
|
20987
|
-
if (value && !
|
|
20987
|
+
if (value && !path6 && typeof value === "object") {
|
|
20988
20988
|
if (utils_default.endsWith(key, "{}")) {
|
|
20989
20989
|
key = metaTokens ? key : key.slice(0, -2);
|
|
20990
20990
|
value = JSON.stringify(value);
|
|
@@ -21003,7 +21003,7 @@ function toFormData(obj, formData, options) {
|
|
|
21003
21003
|
if (isVisitable(value)) {
|
|
21004
21004
|
return true;
|
|
21005
21005
|
}
|
|
21006
|
-
formData.append(renderKey(
|
|
21006
|
+
formData.append(renderKey(path6, key, dots), convertValue(value));
|
|
21007
21007
|
return false;
|
|
21008
21008
|
}
|
|
21009
21009
|
const stack = [];
|
|
@@ -21012,10 +21012,10 @@ function toFormData(obj, formData, options) {
|
|
|
21012
21012
|
convertValue,
|
|
21013
21013
|
isVisitable
|
|
21014
21014
|
});
|
|
21015
|
-
function build(value,
|
|
21015
|
+
function build(value, path6) {
|
|
21016
21016
|
if (utils_default.isUndefined(value)) return;
|
|
21017
21017
|
if (stack.indexOf(value) !== -1) {
|
|
21018
|
-
throw Error("Circular reference detected in " +
|
|
21018
|
+
throw Error("Circular reference detected in " + path6.join("."));
|
|
21019
21019
|
}
|
|
21020
21020
|
stack.push(value);
|
|
21021
21021
|
utils_default.forEach(value, function each(el, key) {
|
|
@@ -21023,11 +21023,11 @@ function toFormData(obj, formData, options) {
|
|
|
21023
21023
|
formData,
|
|
21024
21024
|
el,
|
|
21025
21025
|
utils_default.isString(key) ? key.trim() : key,
|
|
21026
|
-
|
|
21026
|
+
path6,
|
|
21027
21027
|
exposedHelpers
|
|
21028
21028
|
);
|
|
21029
21029
|
if (result === true) {
|
|
21030
|
-
build(el,
|
|
21030
|
+
build(el, path6 ? path6.concat(key) : [key]);
|
|
21031
21031
|
}
|
|
21032
21032
|
});
|
|
21033
21033
|
stack.pop();
|
|
@@ -21239,7 +21239,7 @@ var platform_default = {
|
|
|
21239
21239
|
// node_modules/axios/lib/helpers/toURLEncodedForm.js
|
|
21240
21240
|
function toURLEncodedForm(data, options) {
|
|
21241
21241
|
return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
|
|
21242
|
-
visitor: function(value, key,
|
|
21242
|
+
visitor: function(value, key, path6, helpers) {
|
|
21243
21243
|
if (platform_default.isNode && utils_default.isBuffer(value)) {
|
|
21244
21244
|
this.append(key, value.toString("base64"));
|
|
21245
21245
|
return false;
|
|
@@ -21269,11 +21269,11 @@ function arrayToObject(arr) {
|
|
|
21269
21269
|
return obj;
|
|
21270
21270
|
}
|
|
21271
21271
|
function formDataToJSON(formData) {
|
|
21272
|
-
function buildPath(
|
|
21273
|
-
let name =
|
|
21272
|
+
function buildPath(path6, value, target, index) {
|
|
21273
|
+
let name = path6[index++];
|
|
21274
21274
|
if (name === "__proto__") return true;
|
|
21275
21275
|
const isNumericKey = Number.isFinite(+name);
|
|
21276
|
-
const isLast = index >=
|
|
21276
|
+
const isLast = index >= path6.length;
|
|
21277
21277
|
name = !name && utils_default.isArray(target) ? target.length : name;
|
|
21278
21278
|
if (isLast) {
|
|
21279
21279
|
if (utils_default.hasOwnProp(target, name)) {
|
|
@@ -21286,7 +21286,7 @@ function formDataToJSON(formData) {
|
|
|
21286
21286
|
if (!target[name] || !utils_default.isObject(target[name])) {
|
|
21287
21287
|
target[name] = [];
|
|
21288
21288
|
}
|
|
21289
|
-
const result = buildPath(
|
|
21289
|
+
const result = buildPath(path6, value, target[name], index);
|
|
21290
21290
|
if (result && utils_default.isArray(target[name])) {
|
|
21291
21291
|
target[name] = arrayToObject(target[name]);
|
|
21292
21292
|
}
|
|
@@ -21715,10 +21715,10 @@ utils_default.inherits(CanceledError, AxiosError_default, {
|
|
|
21715
21715
|
var CanceledError_default = CanceledError;
|
|
21716
21716
|
|
|
21717
21717
|
// node_modules/axios/lib/core/settle.js
|
|
21718
|
-
function settle(
|
|
21718
|
+
function settle(resolve6, reject, response) {
|
|
21719
21719
|
const validateStatus2 = response.config.validateStatus;
|
|
21720
21720
|
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
21721
|
-
|
|
21721
|
+
resolve6(response);
|
|
21722
21722
|
} else {
|
|
21723
21723
|
reject(new AxiosError_default(
|
|
21724
21724
|
"Request failed with status code " + response.status,
|
|
@@ -22341,7 +22341,7 @@ function setProxy(options, configProxy, location) {
|
|
|
22341
22341
|
}
|
|
22342
22342
|
var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
|
|
22343
22343
|
var wrapAsync = (asyncExecutor) => {
|
|
22344
|
-
return new Promise((
|
|
22344
|
+
return new Promise((resolve6, reject) => {
|
|
22345
22345
|
let onDone;
|
|
22346
22346
|
let isDone;
|
|
22347
22347
|
const done = (value, isRejected) => {
|
|
@@ -22351,7 +22351,7 @@ var wrapAsync = (asyncExecutor) => {
|
|
|
22351
22351
|
};
|
|
22352
22352
|
const _resolve = (value) => {
|
|
22353
22353
|
done(value);
|
|
22354
|
-
|
|
22354
|
+
resolve6(value);
|
|
22355
22355
|
};
|
|
22356
22356
|
const _reject = (reason) => {
|
|
22357
22357
|
done(reason, true);
|
|
@@ -22403,7 +22403,7 @@ var http2Transport = {
|
|
|
22403
22403
|
}
|
|
22404
22404
|
};
|
|
22405
22405
|
var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
22406
|
-
return wrapAsync(async function dispatchHttpRequest(
|
|
22406
|
+
return wrapAsync(async function dispatchHttpRequest(resolve6, reject, onDone) {
|
|
22407
22407
|
let { data, lookup, family, httpVersion = 1, http2Options } = config;
|
|
22408
22408
|
const { responseType, responseEncoding } = config;
|
|
22409
22409
|
const method = config.method.toUpperCase();
|
|
@@ -22488,7 +22488,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
22488
22488
|
}
|
|
22489
22489
|
let convertedData;
|
|
22490
22490
|
if (method !== "GET") {
|
|
22491
|
-
return settle(
|
|
22491
|
+
return settle(resolve6, reject, {
|
|
22492
22492
|
status: 405,
|
|
22493
22493
|
statusText: "method not allowed",
|
|
22494
22494
|
headers: {},
|
|
@@ -22510,7 +22510,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
22510
22510
|
} else if (responseType === "stream") {
|
|
22511
22511
|
convertedData = import_stream4.default.Readable.from(convertedData);
|
|
22512
22512
|
}
|
|
22513
|
-
return settle(
|
|
22513
|
+
return settle(resolve6, reject, {
|
|
22514
22514
|
data: convertedData,
|
|
22515
22515
|
status: 200,
|
|
22516
22516
|
statusText: "OK",
|
|
@@ -22608,9 +22608,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
22608
22608
|
auth = urlUsername + ":" + urlPassword;
|
|
22609
22609
|
}
|
|
22610
22610
|
auth && headers.delete("authorization");
|
|
22611
|
-
let
|
|
22611
|
+
let path6;
|
|
22612
22612
|
try {
|
|
22613
|
-
|
|
22613
|
+
path6 = buildURL(
|
|
22614
22614
|
parsed.pathname + parsed.search,
|
|
22615
22615
|
config.params,
|
|
22616
22616
|
config.paramsSerializer
|
|
@@ -22628,7 +22628,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
22628
22628
|
false
|
|
22629
22629
|
);
|
|
22630
22630
|
const options = {
|
|
22631
|
-
path:
|
|
22631
|
+
path: path6,
|
|
22632
22632
|
method,
|
|
22633
22633
|
headers: headers.toJSON(),
|
|
22634
22634
|
agents: { http: config.httpAgent, https: config.httpsAgent },
|
|
@@ -22729,7 +22729,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
22729
22729
|
};
|
|
22730
22730
|
if (responseType === "stream") {
|
|
22731
22731
|
response.data = responseStream;
|
|
22732
|
-
settle(
|
|
22732
|
+
settle(resolve6, reject, response);
|
|
22733
22733
|
} else {
|
|
22734
22734
|
const responseBuffer = [];
|
|
22735
22735
|
let totalResponseBytes = 0;
|
|
@@ -22777,7 +22777,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
22777
22777
|
} catch (err) {
|
|
22778
22778
|
return reject(AxiosError_default.from(err, null, config, response.request, response));
|
|
22779
22779
|
}
|
|
22780
|
-
settle(
|
|
22780
|
+
settle(resolve6, reject, response);
|
|
22781
22781
|
});
|
|
22782
22782
|
}
|
|
22783
22783
|
abortEmitter.once("abort", (err) => {
|
|
@@ -22864,14 +22864,14 @@ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PUR
|
|
|
22864
22864
|
var cookies_default = platform_default.hasStandardBrowserEnv ? (
|
|
22865
22865
|
// Standard browser envs support document.cookie
|
|
22866
22866
|
{
|
|
22867
|
-
write(name, value, expires,
|
|
22867
|
+
write(name, value, expires, path6, domain, secure, sameSite) {
|
|
22868
22868
|
if (typeof document === "undefined") return;
|
|
22869
22869
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
22870
22870
|
if (utils_default.isNumber(expires)) {
|
|
22871
22871
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
22872
22872
|
}
|
|
22873
|
-
if (utils_default.isString(
|
|
22874
|
-
cookie.push(`path=${
|
|
22873
|
+
if (utils_default.isString(path6)) {
|
|
22874
|
+
cookie.push(`path=${path6}`);
|
|
22875
22875
|
}
|
|
22876
22876
|
if (utils_default.isString(domain)) {
|
|
22877
22877
|
cookie.push(`domain=${domain}`);
|
|
@@ -23026,7 +23026,7 @@ var resolveConfig_default = (config) => {
|
|
|
23026
23026
|
// node_modules/axios/lib/adapters/xhr.js
|
|
23027
23027
|
var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
23028
23028
|
var xhr_default = isXHRAdapterSupported && function(config) {
|
|
23029
|
-
return new Promise(function dispatchXhrRequest(
|
|
23029
|
+
return new Promise(function dispatchXhrRequest(resolve6, reject) {
|
|
23030
23030
|
const _config = resolveConfig_default(config);
|
|
23031
23031
|
let requestData = _config.data;
|
|
23032
23032
|
const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
|
|
@@ -23060,7 +23060,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
|
|
|
23060
23060
|
request
|
|
23061
23061
|
};
|
|
23062
23062
|
settle(function _resolve(value) {
|
|
23063
|
-
|
|
23063
|
+
resolve6(value);
|
|
23064
23064
|
done();
|
|
23065
23065
|
}, function _reject(err) {
|
|
23066
23066
|
reject(err);
|
|
@@ -23431,8 +23431,8 @@ var factory = (env3) => {
|
|
|
23431
23431
|
responseType = responseType || "text";
|
|
23432
23432
|
let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
|
|
23433
23433
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
23434
|
-
return await new Promise((
|
|
23435
|
-
settle(
|
|
23434
|
+
return await new Promise((resolve6, reject) => {
|
|
23435
|
+
settle(resolve6, reject, {
|
|
23436
23436
|
data: responseData,
|
|
23437
23437
|
headers: AxiosHeaders_default.from(response.headers),
|
|
23438
23438
|
status: response.status,
|
|
@@ -23828,8 +23828,8 @@ var CancelToken = class _CancelToken {
|
|
|
23828
23828
|
throw new TypeError("executor must be a function.");
|
|
23829
23829
|
}
|
|
23830
23830
|
let resolvePromise;
|
|
23831
|
-
this.promise = new Promise(function promiseExecutor(
|
|
23832
|
-
resolvePromise =
|
|
23831
|
+
this.promise = new Promise(function promiseExecutor(resolve6) {
|
|
23832
|
+
resolvePromise = resolve6;
|
|
23833
23833
|
});
|
|
23834
23834
|
const token = this;
|
|
23835
23835
|
this.promise.then((cancel) => {
|
|
@@ -23842,9 +23842,9 @@ var CancelToken = class _CancelToken {
|
|
|
23842
23842
|
});
|
|
23843
23843
|
this.promise.then = (onfulfilled) => {
|
|
23844
23844
|
let _resolve;
|
|
23845
|
-
const promise = new Promise((
|
|
23846
|
-
token.subscribe(
|
|
23847
|
-
_resolve =
|
|
23845
|
+
const promise = new Promise((resolve6) => {
|
|
23846
|
+
token.subscribe(resolve6);
|
|
23847
|
+
_resolve = resolve6;
|
|
23848
23848
|
}).then(onfulfilled);
|
|
23849
23849
|
promise.cancel = function reject() {
|
|
23850
23850
|
token.unsubscribe(_resolve);
|
|
@@ -24215,10 +24215,10 @@ var safeToStringImpl = (val, seenArrays = /* @__PURE__ */ new WeakSet()) => {
|
|
|
24215
24215
|
var safeToString = (val) => safeToStringImpl(val);
|
|
24216
24216
|
function createPromiseCallback(cb) {
|
|
24217
24217
|
let callback;
|
|
24218
|
-
let
|
|
24218
|
+
let resolve6;
|
|
24219
24219
|
let reject;
|
|
24220
24220
|
const promise = new Promise((_resolve, _reject) => {
|
|
24221
|
-
|
|
24221
|
+
resolve6 = _resolve;
|
|
24222
24222
|
reject = _reject;
|
|
24223
24223
|
});
|
|
24224
24224
|
if (typeof cb === "function") {
|
|
@@ -24234,7 +24234,7 @@ function createPromiseCallback(cb) {
|
|
|
24234
24234
|
callback = (err, result) => {
|
|
24235
24235
|
try {
|
|
24236
24236
|
if (err) reject(err);
|
|
24237
|
-
else
|
|
24237
|
+
else resolve6(result);
|
|
24238
24238
|
} catch (e) {
|
|
24239
24239
|
reject(e instanceof Error ? e : new Error());
|
|
24240
24240
|
}
|
|
@@ -24268,18 +24268,18 @@ var MemoryCookieStore = class extends Store {
|
|
|
24268
24268
|
/**
|
|
24269
24269
|
* @internal No doc because this is an overload that supports the implementation
|
|
24270
24270
|
*/
|
|
24271
|
-
findCookie(domain,
|
|
24271
|
+
findCookie(domain, path6, key, callback) {
|
|
24272
24272
|
const promiseCallback = createPromiseCallback(callback);
|
|
24273
|
-
if (domain == null ||
|
|
24273
|
+
if (domain == null || path6 == null || key == null) {
|
|
24274
24274
|
return promiseCallback.resolve(void 0);
|
|
24275
24275
|
}
|
|
24276
|
-
const result = this.idx[domain]?.[
|
|
24276
|
+
const result = this.idx[domain]?.[path6]?.[key];
|
|
24277
24277
|
return promiseCallback.resolve(result);
|
|
24278
24278
|
}
|
|
24279
24279
|
/**
|
|
24280
24280
|
* @internal No doc because this is an overload that supports the implementation
|
|
24281
24281
|
*/
|
|
24282
|
-
findCookies(domain,
|
|
24282
|
+
findCookies(domain, path6, allowSpecialUseDomain = false, callback) {
|
|
24283
24283
|
if (typeof allowSpecialUseDomain === "function") {
|
|
24284
24284
|
callback = allowSpecialUseDomain;
|
|
24285
24285
|
allowSpecialUseDomain = true;
|
|
@@ -24290,7 +24290,7 @@ var MemoryCookieStore = class extends Store {
|
|
|
24290
24290
|
return promiseCallback.resolve([]);
|
|
24291
24291
|
}
|
|
24292
24292
|
let pathMatcher;
|
|
24293
|
-
if (!
|
|
24293
|
+
if (!path6) {
|
|
24294
24294
|
pathMatcher = function matchAll2(domainIndex) {
|
|
24295
24295
|
for (const curPath in domainIndex) {
|
|
24296
24296
|
const pathIndex = domainIndex[curPath];
|
|
@@ -24305,7 +24305,7 @@ var MemoryCookieStore = class extends Store {
|
|
|
24305
24305
|
} else {
|
|
24306
24306
|
pathMatcher = function matchRFC(domainIndex) {
|
|
24307
24307
|
for (const cookiePath in domainIndex) {
|
|
24308
|
-
if (pathMatch(
|
|
24308
|
+
if (pathMatch(path6, cookiePath)) {
|
|
24309
24309
|
const pathIndex = domainIndex[cookiePath];
|
|
24310
24310
|
for (const key in pathIndex) {
|
|
24311
24311
|
const value = pathIndex[key];
|
|
@@ -24333,14 +24333,14 @@ var MemoryCookieStore = class extends Store {
|
|
|
24333
24333
|
*/
|
|
24334
24334
|
putCookie(cookie, callback) {
|
|
24335
24335
|
const promiseCallback = createPromiseCallback(callback);
|
|
24336
|
-
const { domain, path:
|
|
24337
|
-
if (domain == null ||
|
|
24336
|
+
const { domain, path: path6, key } = cookie;
|
|
24337
|
+
if (domain == null || path6 == null || key == null) {
|
|
24338
24338
|
return promiseCallback.resolve(void 0);
|
|
24339
24339
|
}
|
|
24340
24340
|
const domainEntry = this.idx[domain] ?? /* @__PURE__ */ Object.create(null);
|
|
24341
24341
|
this.idx[domain] = domainEntry;
|
|
24342
|
-
const pathEntry = domainEntry[
|
|
24343
|
-
domainEntry[
|
|
24342
|
+
const pathEntry = domainEntry[path6] ?? /* @__PURE__ */ Object.create(null);
|
|
24343
|
+
domainEntry[path6] = pathEntry;
|
|
24344
24344
|
pathEntry[key] = cookie;
|
|
24345
24345
|
return promiseCallback.resolve(void 0);
|
|
24346
24346
|
}
|
|
@@ -24354,20 +24354,20 @@ var MemoryCookieStore = class extends Store {
|
|
|
24354
24354
|
/**
|
|
24355
24355
|
* @internal No doc because this is an overload that supports the implementation
|
|
24356
24356
|
*/
|
|
24357
|
-
removeCookie(domain,
|
|
24357
|
+
removeCookie(domain, path6, key, callback) {
|
|
24358
24358
|
const promiseCallback = createPromiseCallback(callback);
|
|
24359
|
-
delete this.idx[domain]?.[
|
|
24359
|
+
delete this.idx[domain]?.[path6]?.[key];
|
|
24360
24360
|
return promiseCallback.resolve(void 0);
|
|
24361
24361
|
}
|
|
24362
24362
|
/**
|
|
24363
24363
|
* @internal No doc because this is an overload that supports the implementation
|
|
24364
24364
|
*/
|
|
24365
|
-
removeCookies(domain,
|
|
24365
|
+
removeCookies(domain, path6, callback) {
|
|
24366
24366
|
const promiseCallback = createPromiseCallback(callback);
|
|
24367
24367
|
const domainEntry = this.idx[domain];
|
|
24368
24368
|
if (domainEntry) {
|
|
24369
|
-
if (
|
|
24370
|
-
delete domainEntry[
|
|
24369
|
+
if (path6) {
|
|
24370
|
+
delete domainEntry[path6];
|
|
24371
24371
|
} else {
|
|
24372
24372
|
delete this.idx[domain];
|
|
24373
24373
|
}
|
|
@@ -24393,8 +24393,8 @@ var MemoryCookieStore = class extends Store {
|
|
|
24393
24393
|
domains.forEach((domain) => {
|
|
24394
24394
|
const domainEntry = idx[domain] ?? {};
|
|
24395
24395
|
const paths = Object.keys(domainEntry);
|
|
24396
|
-
paths.forEach((
|
|
24397
|
-
const pathEntry = domainEntry[
|
|
24396
|
+
paths.forEach((path6) => {
|
|
24397
|
+
const pathEntry = domainEntry[path6] ?? {};
|
|
24398
24398
|
const keys = Object.keys(pathEntry);
|
|
24399
24399
|
keys.forEach((key) => {
|
|
24400
24400
|
const keyEntry = pathEntry[key];
|
|
@@ -25278,18 +25278,18 @@ function cookieCompare(a, b) {
|
|
|
25278
25278
|
cmp = (a.creationIndex || 0) - (b.creationIndex || 0);
|
|
25279
25279
|
return cmp;
|
|
25280
25280
|
}
|
|
25281
|
-
function defaultPath(
|
|
25282
|
-
if (!
|
|
25281
|
+
function defaultPath(path6) {
|
|
25282
|
+
if (!path6 || path6.slice(0, 1) !== "/") {
|
|
25283
25283
|
return "/";
|
|
25284
25284
|
}
|
|
25285
|
-
if (
|
|
25286
|
-
return
|
|
25285
|
+
if (path6 === "/") {
|
|
25286
|
+
return path6;
|
|
25287
25287
|
}
|
|
25288
|
-
const rightSlash =
|
|
25288
|
+
const rightSlash = path6.lastIndexOf("/");
|
|
25289
25289
|
if (rightSlash === 0) {
|
|
25290
25290
|
return "/";
|
|
25291
25291
|
}
|
|
25292
|
-
return
|
|
25292
|
+
return path6.slice(0, rightSlash);
|
|
25293
25293
|
}
|
|
25294
25294
|
var IP_REGEX_LOWERCASE = /(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/;
|
|
25295
25295
|
function domainMatch(domain, cookieDomain, canonicalize) {
|
|
@@ -25691,7 +25691,7 @@ var CookieJar = class _CookieJar {
|
|
|
25691
25691
|
return promiseCallback.reject(parameterError);
|
|
25692
25692
|
}
|
|
25693
25693
|
const host = canonicalDomain(context.hostname);
|
|
25694
|
-
const
|
|
25694
|
+
const path6 = context.pathname || "/";
|
|
25695
25695
|
const potentiallyTrustworthy = isPotentiallyTrustworthy(
|
|
25696
25696
|
url2,
|
|
25697
25697
|
this.allowSecureOnLocal
|
|
@@ -25722,7 +25722,7 @@ var CookieJar = class _CookieJar {
|
|
|
25722
25722
|
return false;
|
|
25723
25723
|
}
|
|
25724
25724
|
}
|
|
25725
|
-
if (!allPaths && typeof c.path === "string" && !pathMatch(
|
|
25725
|
+
if (!allPaths && typeof c.path === "string" && !pathMatch(path6, c.path)) {
|
|
25726
25726
|
return false;
|
|
25727
25727
|
}
|
|
25728
25728
|
if (c.secure && !potentiallyTrustworthy) {
|
|
@@ -25754,7 +25754,7 @@ var CookieJar = class _CookieJar {
|
|
|
25754
25754
|
}
|
|
25755
25755
|
store.findCookies(
|
|
25756
25756
|
host,
|
|
25757
|
-
allPaths ? null :
|
|
25757
|
+
allPaths ? null : path6,
|
|
25758
25758
|
this.allowSpecialUseDomain,
|
|
25759
25759
|
(err, cookies) => {
|
|
25760
25760
|
if (err) {
|
|
@@ -26253,7 +26253,7 @@ async function sendRequest(request, retryOptions) {
|
|
|
26253
26253
|
return sendRequestWithJar(request, sharedCookieJar, retryOptions);
|
|
26254
26254
|
}
|
|
26255
26255
|
function sleep(ms) {
|
|
26256
|
-
return new Promise((
|
|
26256
|
+
return new Promise((resolve6) => setTimeout(resolve6, ms));
|
|
26257
26257
|
}
|
|
26258
26258
|
function shouldRetry(response, error) {
|
|
26259
26259
|
if (error) return true;
|
|
@@ -26664,7 +26664,7 @@ async function runScript(type, scriptPath, args, workingDir, variables = {}, cap
|
|
|
26664
26664
|
captureVar
|
|
26665
26665
|
};
|
|
26666
26666
|
}
|
|
26667
|
-
return new Promise((
|
|
26667
|
+
return new Promise((resolve6) => {
|
|
26668
26668
|
const env3 = {
|
|
26669
26669
|
...process.env,
|
|
26670
26670
|
// Pass variables as environment variables with NORN_ prefix
|
|
@@ -26688,7 +26688,7 @@ async function runScript(type, scriptPath, args, workingDir, variables = {}, cap
|
|
|
26688
26688
|
stderr += data.toString();
|
|
26689
26689
|
});
|
|
26690
26690
|
child.on("error", (err) => {
|
|
26691
|
-
|
|
26691
|
+
resolve6({
|
|
26692
26692
|
success: false,
|
|
26693
26693
|
output: cleanScriptOutput(stdout),
|
|
26694
26694
|
error: `Failed to execute script: ${err.message}`,
|
|
@@ -26702,7 +26702,7 @@ async function runScript(type, scriptPath, args, workingDir, variables = {}, cap
|
|
|
26702
26702
|
child.on("close", (code) => {
|
|
26703
26703
|
const exitCode = code ?? 0;
|
|
26704
26704
|
const cleanedOutput = cleanScriptOutput(stdout);
|
|
26705
|
-
|
|
26705
|
+
resolve6({
|
|
26706
26706
|
success: exitCode === 0,
|
|
26707
26707
|
output: cleanedOutput,
|
|
26708
26708
|
error: stderr.trim(),
|
|
@@ -26767,11 +26767,11 @@ function readJsonFile(filePath, workingDir) {
|
|
|
26767
26767
|
};
|
|
26768
26768
|
}
|
|
26769
26769
|
}
|
|
26770
|
-
function setNestedValue(obj,
|
|
26771
|
-
if (!
|
|
26770
|
+
function setNestedValue(obj, path6, value) {
|
|
26771
|
+
if (!path6 || obj === null || obj === void 0 || typeof obj !== "object") {
|
|
26772
26772
|
return false;
|
|
26773
26773
|
}
|
|
26774
|
-
const parts =
|
|
26774
|
+
const parts = path6.replace(/\[(\d+)\]/g, ".$1").split(".").filter((p) => p !== "");
|
|
26775
26775
|
if (parts.length === 0) {
|
|
26776
26776
|
return false;
|
|
26777
26777
|
}
|
|
@@ -27273,8 +27273,8 @@ function bindSequenceArguments(params, args, runtimeVariables) {
|
|
|
27273
27273
|
}
|
|
27274
27274
|
return { variables: result };
|
|
27275
27275
|
}
|
|
27276
|
-
function getVariableValueByPath(
|
|
27277
|
-
const parts =
|
|
27276
|
+
function getVariableValueByPath(path6, variables) {
|
|
27277
|
+
const parts = path6.split(".");
|
|
27278
27278
|
let current = variables;
|
|
27279
27279
|
for (const part of parts) {
|
|
27280
27280
|
if (current === null || current === void 0) {
|
|
@@ -27639,8 +27639,8 @@ function evaluateValueExpression(expr, runtimeVariables) {
|
|
|
27639
27639
|
} else {
|
|
27640
27640
|
return { value: String(varValue), error: `Cannot access path on non-object value` };
|
|
27641
27641
|
}
|
|
27642
|
-
const
|
|
27643
|
-
const parts =
|
|
27642
|
+
const path6 = pathPart.replace(/^\./, "").replace(/\[(\d+)\]/g, ".$1");
|
|
27643
|
+
const parts = path6.split(".").filter((p) => p !== "");
|
|
27644
27644
|
let current = dataToNavigate;
|
|
27645
27645
|
for (const part of parts) {
|
|
27646
27646
|
if (current === null || current === void 0) {
|
|
@@ -27719,8 +27719,8 @@ function resolveBareVariables(text, variables) {
|
|
|
27719
27719
|
if (varName in variables) {
|
|
27720
27720
|
const value = variables[varName];
|
|
27721
27721
|
if (pathPart) {
|
|
27722
|
-
const
|
|
27723
|
-
const nestedValue = getNestedValueFromObject(value,
|
|
27722
|
+
const path6 = pathPart.replace(/^\./, "");
|
|
27723
|
+
const nestedValue = getNestedValueFromObject(value, path6);
|
|
27724
27724
|
return valueToString2(nestedValue);
|
|
27725
27725
|
}
|
|
27726
27726
|
return valueToString2(value);
|
|
@@ -27740,8 +27740,8 @@ function resolveBareVariables(text, variables) {
|
|
|
27740
27740
|
if (varName in variables) {
|
|
27741
27741
|
const value = variables[varName];
|
|
27742
27742
|
if (pathPart) {
|
|
27743
|
-
const
|
|
27744
|
-
return valueToString2(getNestedValueFromObject(value,
|
|
27743
|
+
const path6 = pathPart.replace(/^\./, "");
|
|
27744
|
+
return valueToString2(getNestedValueFromObject(value, path6));
|
|
27745
27745
|
}
|
|
27746
27746
|
return valueToString2(value);
|
|
27747
27747
|
}
|
|
@@ -27778,11 +27778,11 @@ function splitExpressionParts(expr) {
|
|
|
27778
27778
|
}
|
|
27779
27779
|
return parts;
|
|
27780
27780
|
}
|
|
27781
|
-
function getNestedValueFromObject(obj,
|
|
27782
|
-
if (!
|
|
27781
|
+
function getNestedValueFromObject(obj, path6) {
|
|
27782
|
+
if (!path6) {
|
|
27783
27783
|
return obj;
|
|
27784
27784
|
}
|
|
27785
|
-
const parts =
|
|
27785
|
+
const parts = path6.split(/\.|\[(\d+)\]/).filter((p) => p !== "" && p !== void 0);
|
|
27786
27786
|
let current = obj;
|
|
27787
27787
|
for (const part of parts) {
|
|
27788
27788
|
if (current === null || current === void 0) {
|
|
@@ -27805,7 +27805,7 @@ function valueToString2(value) {
|
|
|
27805
27805
|
return String(value);
|
|
27806
27806
|
}
|
|
27807
27807
|
function sleep2(ms) {
|
|
27808
|
-
return new Promise((
|
|
27808
|
+
return new Promise((resolve6) => setTimeout(resolve6, ms));
|
|
27809
27809
|
}
|
|
27810
27810
|
function isIfCommand(line2) {
|
|
27811
27811
|
return /^if\s+.+$/i.test(line2.trim());
|
|
@@ -28127,24 +28127,24 @@ function extractCaptureDirectives(content) {
|
|
|
28127
28127
|
for (const line2 of content.split("\n")) {
|
|
28128
28128
|
const match = line2.trim().match(captureRegex);
|
|
28129
28129
|
if (match) {
|
|
28130
|
-
let
|
|
28131
|
-
if (
|
|
28132
|
-
|
|
28130
|
+
let path6 = match[3] || "";
|
|
28131
|
+
if (path6.startsWith(".")) {
|
|
28132
|
+
path6 = path6.substring(1);
|
|
28133
28133
|
}
|
|
28134
28134
|
captures.push({
|
|
28135
28135
|
varName: match[1],
|
|
28136
28136
|
afterRequest: parseInt(match[2], 10),
|
|
28137
|
-
path:
|
|
28137
|
+
path: path6
|
|
28138
28138
|
});
|
|
28139
28139
|
}
|
|
28140
28140
|
}
|
|
28141
28141
|
return captures;
|
|
28142
28142
|
}
|
|
28143
|
-
function getValueByPath(response,
|
|
28144
|
-
if (!
|
|
28143
|
+
function getValueByPath(response, path6) {
|
|
28144
|
+
if (!path6) {
|
|
28145
28145
|
return void 0;
|
|
28146
28146
|
}
|
|
28147
|
-
const parts =
|
|
28147
|
+
const parts = path6.replace(/\[(\d+)\]/g, ".$1").split(".").filter((p) => p !== "");
|
|
28148
28148
|
if (parts.length === 0) {
|
|
28149
28149
|
return void 0;
|
|
28150
28150
|
}
|
|
@@ -28448,8 +28448,8 @@ async function runSequenceWithJar(sequenceContent, fileVariables, cookieJar, wor
|
|
|
28448
28448
|
}
|
|
28449
28449
|
}
|
|
28450
28450
|
if (pathPart) {
|
|
28451
|
-
const
|
|
28452
|
-
newValue = getNestedValueFromObject(value,
|
|
28451
|
+
const path6 = pathPart.replace(/^\./, "");
|
|
28452
|
+
newValue = getNestedValueFromObject(value, path6);
|
|
28453
28453
|
} else {
|
|
28454
28454
|
newValue = value;
|
|
28455
28455
|
}
|
|
@@ -28811,8 +28811,8 @@ ${indentMultiline(userMessage)}`;
|
|
|
28811
28811
|
if (sequenceSources) {
|
|
28812
28812
|
const sourceFile = sequenceSources.get(targetName.toLowerCase());
|
|
28813
28813
|
if (sourceFile) {
|
|
28814
|
-
const
|
|
28815
|
-
subWorkingDir =
|
|
28814
|
+
const path6 = await import("path");
|
|
28815
|
+
subWorkingDir = path6.dirname(sourceFile);
|
|
28816
28816
|
}
|
|
28817
28817
|
}
|
|
28818
28818
|
const subResult = await runSequenceWithJar(
|
|
@@ -29165,8 +29165,8 @@ ${indentMultiline(userMessage)}`;
|
|
|
29165
29165
|
if (sequenceSources) {
|
|
29166
29166
|
const sourceFile = sequenceSources.get(sequenceName.toLowerCase());
|
|
29167
29167
|
if (sourceFile) {
|
|
29168
|
-
const
|
|
29169
|
-
subWorkingDir =
|
|
29168
|
+
const path6 = await import("path");
|
|
29169
|
+
subWorkingDir = path6.dirname(sourceFile);
|
|
29170
29170
|
}
|
|
29171
29171
|
}
|
|
29172
29172
|
const subResult = await runSequenceWithJar(
|
|
@@ -30570,49 +30570,44 @@ function generateHtmlReportFromResponse(response, testName, options) {
|
|
|
30570
30570
|
generateHtmlReport([mockResult], options);
|
|
30571
30571
|
}
|
|
30572
30572
|
|
|
30573
|
-
// src/
|
|
30573
|
+
// src/environmentParser.ts
|
|
30574
|
+
var fs5 = __toESM(require("fs"));
|
|
30575
|
+
var path4 = __toESM(require("path"));
|
|
30574
30576
|
var ENV_FILENAME = ".nornenv";
|
|
30575
|
-
|
|
30576
|
-
|
|
30577
|
-
|
|
30578
|
-
|
|
30579
|
-
return stats.isDirectory() ? resolvedPath : path4.dirname(resolvedPath);
|
|
30580
|
-
} catch {
|
|
30581
|
-
return path4.dirname(resolvedPath);
|
|
30582
|
-
}
|
|
30583
|
-
}
|
|
30584
|
-
function findEnvFileFromPath(filePath) {
|
|
30585
|
-
let dir = getEnvSearchStartDirectory(filePath);
|
|
30586
|
-
while (true) {
|
|
30587
|
-
const envPath = path4.join(dir, ENV_FILENAME);
|
|
30588
|
-
if (fs5.existsSync(envPath)) {
|
|
30589
|
-
return envPath;
|
|
30590
|
-
}
|
|
30591
|
-
const parentDir = path4.dirname(dir);
|
|
30592
|
-
if (parentDir === dir) {
|
|
30593
|
-
break;
|
|
30594
|
-
}
|
|
30595
|
-
dir = parentDir;
|
|
30596
|
-
}
|
|
30597
|
-
return void 0;
|
|
30598
|
-
}
|
|
30577
|
+
var importRegex = /^import\s+["']?(.+?)["']?\s*$/;
|
|
30578
|
+
var envRegex = /^\[env:([a-zA-Z_][a-zA-Z0-9_-]*)\]$/;
|
|
30579
|
+
var varRegex = /^var\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.+)$/;
|
|
30580
|
+
var secretRegex = /^secret\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.+)$/;
|
|
30599
30581
|
function parseEnvFile(content) {
|
|
30600
30582
|
const lines = content.split("\n");
|
|
30601
30583
|
const config = {
|
|
30602
30584
|
common: {},
|
|
30603
30585
|
environments: [],
|
|
30604
30586
|
secretNames: /* @__PURE__ */ new Set(),
|
|
30605
|
-
secretValues: /* @__PURE__ */ new Map()
|
|
30587
|
+
secretValues: /* @__PURE__ */ new Map(),
|
|
30588
|
+
imports: [],
|
|
30589
|
+
misplacedImports: []
|
|
30606
30590
|
};
|
|
30607
30591
|
let currentEnv = null;
|
|
30608
|
-
|
|
30609
|
-
|
|
30610
|
-
|
|
30611
|
-
for (const line2 of lines) {
|
|
30612
|
-
const trimmed = line2.trim();
|
|
30592
|
+
let seenContent = false;
|
|
30593
|
+
for (let i = 0; i < lines.length; i++) {
|
|
30594
|
+
const trimmed = lines[i].trim();
|
|
30613
30595
|
if (!trimmed || trimmed.startsWith("#")) {
|
|
30614
30596
|
continue;
|
|
30615
30597
|
}
|
|
30598
|
+
const importMatch = trimmed.match(importRegex);
|
|
30599
|
+
if (importMatch) {
|
|
30600
|
+
const importStatement = {
|
|
30601
|
+
path: importMatch[1],
|
|
30602
|
+
lineNumber: i
|
|
30603
|
+
};
|
|
30604
|
+
config.imports.push(importStatement);
|
|
30605
|
+
if (seenContent) {
|
|
30606
|
+
config.misplacedImports.push(importStatement);
|
|
30607
|
+
}
|
|
30608
|
+
continue;
|
|
30609
|
+
}
|
|
30610
|
+
seenContent = true;
|
|
30616
30611
|
const envMatch = trimmed.match(envRegex);
|
|
30617
30612
|
if (envMatch) {
|
|
30618
30613
|
currentEnv = {
|
|
@@ -30648,6 +30643,197 @@ function parseEnvFile(content) {
|
|
|
30648
30643
|
}
|
|
30649
30644
|
return config;
|
|
30650
30645
|
}
|
|
30646
|
+
function getEnvSearchStartDirectory(targetPath) {
|
|
30647
|
+
const resolvedPath = path4.resolve(targetPath);
|
|
30648
|
+
try {
|
|
30649
|
+
const stats = fs5.statSync(resolvedPath);
|
|
30650
|
+
return stats.isDirectory() ? resolvedPath : path4.dirname(resolvedPath);
|
|
30651
|
+
} catch {
|
|
30652
|
+
return path4.dirname(resolvedPath);
|
|
30653
|
+
}
|
|
30654
|
+
}
|
|
30655
|
+
function findEnvFileFromPath(filePath) {
|
|
30656
|
+
let dir = getEnvSearchStartDirectory(filePath);
|
|
30657
|
+
while (true) {
|
|
30658
|
+
const envPath = path4.join(dir, ENV_FILENAME);
|
|
30659
|
+
if (fs5.existsSync(envPath)) {
|
|
30660
|
+
return envPath;
|
|
30661
|
+
}
|
|
30662
|
+
const parentDir = path4.dirname(dir);
|
|
30663
|
+
if (parentDir === dir) {
|
|
30664
|
+
break;
|
|
30665
|
+
}
|
|
30666
|
+
dir = parentDir;
|
|
30667
|
+
}
|
|
30668
|
+
return void 0;
|
|
30669
|
+
}
|
|
30670
|
+
function resolveNornenvImports(config, baseDir, entryFilePath, readFile2, importStack, alreadyImported) {
|
|
30671
|
+
const errors = [];
|
|
30672
|
+
const resolvedPaths = [];
|
|
30673
|
+
const stack = importStack ?? [entryFilePath];
|
|
30674
|
+
const visited = alreadyImported ?? /* @__PURE__ */ new Set([entryFilePath]);
|
|
30675
|
+
const variableOrigins = /* @__PURE__ */ new Map();
|
|
30676
|
+
registerVariableOrigins(config, entryFilePath, variableOrigins);
|
|
30677
|
+
for (const imp of config.misplacedImports) {
|
|
30678
|
+
errors.push({
|
|
30679
|
+
message: `Import statements must appear at the top of the file (before any variable declarations or environment sections).`,
|
|
30680
|
+
filePath: entryFilePath,
|
|
30681
|
+
line: imp.lineNumber
|
|
30682
|
+
});
|
|
30683
|
+
}
|
|
30684
|
+
for (const imp of config.imports) {
|
|
30685
|
+
const resolvedImportPath = resolveImportPath(imp.path, baseDir);
|
|
30686
|
+
if (!resolvedImportPath || !fs5.existsSync(resolvedImportPath)) {
|
|
30687
|
+
errors.push({
|
|
30688
|
+
message: `Imported file not found: '${imp.path}'`,
|
|
30689
|
+
filePath: entryFilePath,
|
|
30690
|
+
line: imp.lineNumber
|
|
30691
|
+
});
|
|
30692
|
+
continue;
|
|
30693
|
+
}
|
|
30694
|
+
if (!resolvedImportPath.endsWith(".nornenv")) {
|
|
30695
|
+
errors.push({
|
|
30696
|
+
message: `Import must reference a .nornenv file: '${imp.path}'`,
|
|
30697
|
+
filePath: entryFilePath,
|
|
30698
|
+
line: imp.lineNumber
|
|
30699
|
+
});
|
|
30700
|
+
continue;
|
|
30701
|
+
}
|
|
30702
|
+
const normalizedPath = path4.resolve(resolvedImportPath);
|
|
30703
|
+
if (stack.includes(normalizedPath)) {
|
|
30704
|
+
const entryDir = path4.dirname(stack[0]);
|
|
30705
|
+
const cycle = [...stack, normalizedPath].map((p) => path4.relative(entryDir, p) || path4.basename(p)).join(" \u2192 ");
|
|
30706
|
+
errors.push({
|
|
30707
|
+
message: `Circular import detected: ${cycle}`,
|
|
30708
|
+
filePath: entryFilePath,
|
|
30709
|
+
line: imp.lineNumber
|
|
30710
|
+
});
|
|
30711
|
+
continue;
|
|
30712
|
+
}
|
|
30713
|
+
if (visited.has(normalizedPath)) {
|
|
30714
|
+
resolvedPaths.push(normalizedPath);
|
|
30715
|
+
continue;
|
|
30716
|
+
}
|
|
30717
|
+
visited.add(normalizedPath);
|
|
30718
|
+
let importedContent;
|
|
30719
|
+
try {
|
|
30720
|
+
importedContent = readFile2(normalizedPath);
|
|
30721
|
+
} catch {
|
|
30722
|
+
errors.push({
|
|
30723
|
+
message: `Failed to read imported file: '${imp.path}'`,
|
|
30724
|
+
filePath: entryFilePath,
|
|
30725
|
+
line: imp.lineNumber
|
|
30726
|
+
});
|
|
30727
|
+
continue;
|
|
30728
|
+
}
|
|
30729
|
+
const importedConfig = parseEnvFile(importedContent);
|
|
30730
|
+
resolvedPaths.push(normalizedPath);
|
|
30731
|
+
if (importedConfig.imports.length > 0) {
|
|
30732
|
+
const childResult = resolveNornenvImports(
|
|
30733
|
+
importedConfig,
|
|
30734
|
+
path4.dirname(normalizedPath),
|
|
30735
|
+
normalizedPath,
|
|
30736
|
+
readFile2,
|
|
30737
|
+
[...stack, normalizedPath],
|
|
30738
|
+
visited
|
|
30739
|
+
);
|
|
30740
|
+
errors.push(...childResult.errors);
|
|
30741
|
+
resolvedPaths.push(...childResult.resolvedPaths);
|
|
30742
|
+
mergeConfigs(config, childResult.config, entryFilePath, normalizedPath, variableOrigins, errors);
|
|
30743
|
+
} else {
|
|
30744
|
+
mergeConfigs(config, importedConfig, entryFilePath, normalizedPath, variableOrigins, errors);
|
|
30745
|
+
}
|
|
30746
|
+
}
|
|
30747
|
+
return { config, errors, resolvedPaths };
|
|
30748
|
+
}
|
|
30749
|
+
function resolveImportPath(importPath, baseDir) {
|
|
30750
|
+
const cleaned = importPath.replace(/^["']|["']$/g, "");
|
|
30751
|
+
return path4.resolve(baseDir, cleaned);
|
|
30752
|
+
}
|
|
30753
|
+
function registerVariableOrigins(config, filePath, origins) {
|
|
30754
|
+
for (const varName of Object.keys(config.common)) {
|
|
30755
|
+
origins.set(`common:${varName}`, { filePath, line: -1, varName });
|
|
30756
|
+
}
|
|
30757
|
+
for (const env3 of config.environments) {
|
|
30758
|
+
for (const varName of Object.keys(env3.variables)) {
|
|
30759
|
+
origins.set(`env:${env3.name}:${varName}`, { filePath, line: -1, varName });
|
|
30760
|
+
}
|
|
30761
|
+
}
|
|
30762
|
+
}
|
|
30763
|
+
function mergeConfigs(target, source, targetFilePath, sourceFilePath, variableOrigins, errors) {
|
|
30764
|
+
for (const [varName, varValue] of Object.entries(source.common)) {
|
|
30765
|
+
const key = `common:${varName}`;
|
|
30766
|
+
const existing = variableOrigins.get(key);
|
|
30767
|
+
if (existing) {
|
|
30768
|
+
const sourceLabel = toDisplayPath(sourceFilePath, targetFilePath);
|
|
30769
|
+
const existingLabel = toDisplayPath(existing.filePath, targetFilePath);
|
|
30770
|
+
errors.push({
|
|
30771
|
+
message: `Duplicate variable '${varName}' in common section. Found in '${existingLabel}' and '${sourceLabel}'.`,
|
|
30772
|
+
filePath: sourceFilePath,
|
|
30773
|
+
line: -1
|
|
30774
|
+
// Line resolved by diagnostics provider
|
|
30775
|
+
});
|
|
30776
|
+
} else {
|
|
30777
|
+
target.common[varName] = varValue;
|
|
30778
|
+
variableOrigins.set(key, { filePath: sourceFilePath, line: -1, varName });
|
|
30779
|
+
}
|
|
30780
|
+
}
|
|
30781
|
+
for (const sourceEnv of source.environments) {
|
|
30782
|
+
let targetEnv = target.environments.find((e) => e.name === sourceEnv.name);
|
|
30783
|
+
if (!targetEnv) {
|
|
30784
|
+
targetEnv = { name: sourceEnv.name, variables: {} };
|
|
30785
|
+
target.environments.push(targetEnv);
|
|
30786
|
+
}
|
|
30787
|
+
for (const [varName, varValue] of Object.entries(sourceEnv.variables)) {
|
|
30788
|
+
const key = `env:${sourceEnv.name}:${varName}`;
|
|
30789
|
+
const existing = variableOrigins.get(key);
|
|
30790
|
+
if (existing) {
|
|
30791
|
+
const sourceLabel = toDisplayPath(sourceFilePath, targetFilePath);
|
|
30792
|
+
const existingLabel = toDisplayPath(existing.filePath, targetFilePath);
|
|
30793
|
+
errors.push({
|
|
30794
|
+
message: `Duplicate variable '${varName}' in [env:${sourceEnv.name}] section. Found in '${existingLabel}' and '${sourceLabel}'.`,
|
|
30795
|
+
filePath: sourceFilePath,
|
|
30796
|
+
line: -1
|
|
30797
|
+
});
|
|
30798
|
+
} else {
|
|
30799
|
+
targetEnv.variables[varName] = varValue;
|
|
30800
|
+
variableOrigins.set(key, { filePath: sourceFilePath, line: -1, varName });
|
|
30801
|
+
}
|
|
30802
|
+
}
|
|
30803
|
+
}
|
|
30804
|
+
for (const name of source.secretNames) {
|
|
30805
|
+
target.secretNames.add(name);
|
|
30806
|
+
}
|
|
30807
|
+
for (const [name, value] of source.secretValues) {
|
|
30808
|
+
target.secretValues.set(name, value);
|
|
30809
|
+
}
|
|
30810
|
+
}
|
|
30811
|
+
function toDisplayPath(filePath, entryFilePath) {
|
|
30812
|
+
const entryDir = path4.dirname(entryFilePath);
|
|
30813
|
+
const relative3 = path4.relative(entryDir, filePath);
|
|
30814
|
+
return relative3 && relative3 !== "" ? relative3 : path4.basename(filePath);
|
|
30815
|
+
}
|
|
30816
|
+
function loadAndResolveEnvFile(filePath) {
|
|
30817
|
+
const content = fs5.readFileSync(filePath, "utf-8");
|
|
30818
|
+
const config = parseEnvFile(content);
|
|
30819
|
+
if (config.imports.length === 0) {
|
|
30820
|
+
return { config, errors: [], resolvedPaths: [] };
|
|
30821
|
+
}
|
|
30822
|
+
return resolveNornenvImports(
|
|
30823
|
+
config,
|
|
30824
|
+
path4.dirname(filePath),
|
|
30825
|
+
filePath,
|
|
30826
|
+
(p) => fs5.readFileSync(p, "utf-8")
|
|
30827
|
+
);
|
|
30828
|
+
}
|
|
30829
|
+
|
|
30830
|
+
// src/cli.ts
|
|
30831
|
+
function formatNornenvErrorLocation(rootEnvFilePath, errorFilePath, line2) {
|
|
30832
|
+
const baseDir = path5.dirname(rootEnvFilePath);
|
|
30833
|
+
const relativePath = path5.relative(baseDir, errorFilePath);
|
|
30834
|
+
const fileLabel = relativePath && relativePath !== "" ? relativePath : path5.basename(errorFilePath);
|
|
30835
|
+
return line2 >= 0 ? `${fileLabel}:${line2 + 1}` : fileLabel;
|
|
30836
|
+
}
|
|
30651
30837
|
function resolveEnvironmentForPath(targetPath, selectedEnv) {
|
|
30652
30838
|
const envFilePath = findEnvFileFromPath(targetPath);
|
|
30653
30839
|
if (!envFilePath) {
|
|
@@ -30658,8 +30844,15 @@ function resolveEnvironmentForPath(targetPath, selectedEnv) {
|
|
|
30658
30844
|
availableEnvironments: []
|
|
30659
30845
|
};
|
|
30660
30846
|
}
|
|
30661
|
-
const
|
|
30662
|
-
const
|
|
30847
|
+
const { config: envConfig, errors: importErrors } = loadAndResolveEnvFile(envFilePath);
|
|
30848
|
+
for (const err of importErrors) {
|
|
30849
|
+
const location = formatNornenvErrorLocation(envFilePath, err.filePath, err.line);
|
|
30850
|
+
console.error(`Error in ${location}: ${err.message}`);
|
|
30851
|
+
}
|
|
30852
|
+
if (importErrors.length > 0) {
|
|
30853
|
+
console.error(`Fix .nornenv import errors before running tests.`);
|
|
30854
|
+
process.exit(1);
|
|
30855
|
+
}
|
|
30663
30856
|
const variables = { ...envConfig.common };
|
|
30664
30857
|
const secretNames = new Set(envConfig.secretNames);
|
|
30665
30858
|
const secretValues = new Map(envConfig.secretValues);
|
|
@@ -30717,10 +30910,10 @@ function generateTimestamp() {
|
|
|
30717
30910
|
return `${year}-${month}-${day}-${hours}${minutes}${seconds}`;
|
|
30718
30911
|
}
|
|
30719
30912
|
function generateReportPaths(outputDir, inputFile, timestamp) {
|
|
30720
|
-
const baseName =
|
|
30913
|
+
const baseName = path5.basename(inputFile, path5.extname(inputFile));
|
|
30721
30914
|
return {
|
|
30722
|
-
junitPath:
|
|
30723
|
-
htmlPath:
|
|
30915
|
+
junitPath: path5.join(outputDir, `${baseName}-${timestamp}-results.xml`),
|
|
30916
|
+
htmlPath: path5.join(outputDir, `${baseName}-${timestamp}-report.html`)
|
|
30724
30917
|
};
|
|
30725
30918
|
}
|
|
30726
30919
|
function parseArgs(args) {
|
|
@@ -30979,9 +31172,9 @@ async function runSingleRequest(fileContent, variables, cookieJar, apiDefinition
|
|
|
30979
31172
|
function discoverNornFiles(dirPath) {
|
|
30980
31173
|
const files = [];
|
|
30981
31174
|
function walkDir(currentPath) {
|
|
30982
|
-
const entries =
|
|
31175
|
+
const entries = fs6.readdirSync(currentPath, { withFileTypes: true });
|
|
30983
31176
|
for (const entry of entries) {
|
|
30984
|
-
const fullPath =
|
|
31177
|
+
const fullPath = path5.join(currentPath, entry.name);
|
|
30985
31178
|
if (entry.isDirectory()) {
|
|
30986
31179
|
if (!entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
30987
31180
|
walkDir(fullPath);
|
|
@@ -31001,7 +31194,7 @@ function countTestSequences(fileContent, tagFilterOptions) {
|
|
|
31001
31194
|
return { total: testSequences.length, filtered };
|
|
31002
31195
|
}
|
|
31003
31196
|
async function loadTheoryFile(theoryPath, workingDir) {
|
|
31004
|
-
const absolutePath =
|
|
31197
|
+
const absolutePath = path5.resolve(workingDir, theoryPath);
|
|
31005
31198
|
const content = await fsPromises.readFile(absolutePath, "utf-8");
|
|
31006
31199
|
return JSON.parse(content);
|
|
31007
31200
|
}
|
|
@@ -31106,12 +31299,12 @@ async function main() {
|
|
|
31106
31299
|
process.exit(1);
|
|
31107
31300
|
}
|
|
31108
31301
|
const colors = await initColors();
|
|
31109
|
-
const inputPath =
|
|
31110
|
-
if (!
|
|
31302
|
+
const inputPath = path5.resolve(options.file);
|
|
31303
|
+
if (!fs6.existsSync(inputPath)) {
|
|
31111
31304
|
console.error(`Error: Path not found: ${inputPath}`);
|
|
31112
31305
|
process.exit(1);
|
|
31113
31306
|
}
|
|
31114
|
-
const isDirectory =
|
|
31307
|
+
const isDirectory = fs6.statSync(inputPath).isDirectory();
|
|
31115
31308
|
let filesToRun;
|
|
31116
31309
|
if (isDirectory) {
|
|
31117
31310
|
filesToRun = discoverNornFiles(inputPath);
|
|
@@ -31163,11 +31356,11 @@ async function main() {
|
|
|
31163
31356
|
}
|
|
31164
31357
|
mergeSecrets(combinedSecretNames, combinedSecretValues, resolvedEnv.secretNames, resolvedEnv.secretValues);
|
|
31165
31358
|
const redaction2 = createRedactionOptions(combinedSecretNames, combinedSecretValues, !options.noRedact);
|
|
31166
|
-
const fileContent =
|
|
31359
|
+
const fileContent = fs6.readFileSync(filePath, "utf-8");
|
|
31167
31360
|
const fileVariables = extractFileLevelVariables(fileContent);
|
|
31168
31361
|
const variables = { ...resolvedEnv.variables, ...fileVariables };
|
|
31169
31362
|
const cookieJar = createCookieJar();
|
|
31170
|
-
const workingDir =
|
|
31363
|
+
const workingDir = path5.dirname(filePath);
|
|
31171
31364
|
const importResult = await resolveImports(
|
|
31172
31365
|
fileContent,
|
|
31173
31366
|
workingDir,
|
|
@@ -31268,7 +31461,7 @@ ${fileContent}` : fileContent;
|
|
|
31268
31461
|
let totalTestCount = 0;
|
|
31269
31462
|
let filteredTestCount = 0;
|
|
31270
31463
|
for (const filePath of filesToRun) {
|
|
31271
|
-
const fileContent =
|
|
31464
|
+
const fileContent = fs6.readFileSync(filePath, "utf-8");
|
|
31272
31465
|
const counts = countTestSequences(fileContent, tagFilterOptions);
|
|
31273
31466
|
totalTestCount += counts.total;
|
|
31274
31467
|
filteredTestCount += counts.filtered;
|
|
@@ -31295,16 +31488,16 @@ ${fileContent}` : fileContent;
|
|
|
31295
31488
|
process.exit(1);
|
|
31296
31489
|
}
|
|
31297
31490
|
if (!resolvedEnv.envFilePath && options.env) {
|
|
31298
|
-
const relPath = isDirectory ?
|
|
31491
|
+
const relPath = isDirectory ? path5.relative(inputPath, filePath) : path5.basename(filePath);
|
|
31299
31492
|
console.error(colors.warning(`Warning: --env specified but no .nornenv file found for ${relPath}`));
|
|
31300
31493
|
}
|
|
31301
31494
|
mergeSecrets(combinedSecretNames, combinedSecretValues, resolvedEnv.secretNames, resolvedEnv.secretValues);
|
|
31302
31495
|
const redaction2 = createRedactionOptions(combinedSecretNames, combinedSecretValues, !options.noRedact);
|
|
31303
|
-
const fileContent =
|
|
31496
|
+
const fileContent = fs6.readFileSync(filePath, "utf-8");
|
|
31304
31497
|
const fileVariables = extractFileLevelVariables(fileContent);
|
|
31305
31498
|
const variables = { ...resolvedEnv.variables, ...fileVariables };
|
|
31306
31499
|
const cookieJar = createCookieJar();
|
|
31307
|
-
const workingDir =
|
|
31500
|
+
const workingDir = path5.dirname(filePath);
|
|
31308
31501
|
const importResult = await resolveImports(
|
|
31309
31502
|
fileContent,
|
|
31310
31503
|
workingDir,
|
|
@@ -31336,7 +31529,7 @@ ${fileContent}` : fileContent;
|
|
|
31336
31529
|
continue;
|
|
31337
31530
|
}
|
|
31338
31531
|
if (isDirectory && options.output !== "json") {
|
|
31339
|
-
const relPath =
|
|
31532
|
+
const relPath = path5.relative(inputPath, filePath);
|
|
31340
31533
|
console.log(colors.info(`
|
|
31341
31534
|
\u2501\u2501\u2501 ${relPath} \u2501\u2501\u2501`));
|
|
31342
31535
|
}
|
|
@@ -31380,7 +31573,7 @@ ${fileContent}` : fileContent;
|
|
|
31380
31573
|
let htmlOutputPath = options.htmlOutput;
|
|
31381
31574
|
if (options.outputDir) {
|
|
31382
31575
|
const timestamp = generateTimestamp();
|
|
31383
|
-
const baseName = isDirectory ?
|
|
31576
|
+
const baseName = isDirectory ? path5.basename(inputPath) : path5.basename(inputPath, path5.extname(inputPath));
|
|
31384
31577
|
const generatedPaths = generateReportPaths(options.outputDir, baseName + ".norn", timestamp);
|
|
31385
31578
|
if (!junitOutputPath) {
|
|
31386
31579
|
junitOutputPath = generatedPaths.junitPath;
|
|
@@ -31388,12 +31581,12 @@ ${fileContent}` : fileContent;
|
|
|
31388
31581
|
if (!htmlOutputPath) {
|
|
31389
31582
|
htmlOutputPath = generatedPaths.htmlPath;
|
|
31390
31583
|
}
|
|
31391
|
-
if (!
|
|
31392
|
-
|
|
31584
|
+
if (!fs6.existsSync(options.outputDir)) {
|
|
31585
|
+
fs6.mkdirSync(options.outputDir, { recursive: true });
|
|
31393
31586
|
}
|
|
31394
31587
|
}
|
|
31395
31588
|
if (junitOutputPath) {
|
|
31396
|
-
const suiteName = isDirectory ?
|
|
31589
|
+
const suiteName = isDirectory ? path5.basename(inputPath) : path5.basename(inputPath, path5.extname(inputPath));
|
|
31397
31590
|
if (result.type === "request") {
|
|
31398
31591
|
generateJUnitReportFromResponse(
|
|
31399
31592
|
result.results[0],
|
|
@@ -31409,11 +31602,11 @@ ${fileContent}` : fileContent;
|
|
|
31409
31602
|
console.log(colors.info(`JUnit report written to: ${junitOutputPath}`));
|
|
31410
31603
|
}
|
|
31411
31604
|
if (htmlOutputPath) {
|
|
31412
|
-
const title = `Norn Test Report - ${
|
|
31605
|
+
const title = `Norn Test Report - ${path5.basename(inputPath)}`;
|
|
31413
31606
|
if (result.type === "request") {
|
|
31414
31607
|
generateHtmlReportFromResponse(
|
|
31415
31608
|
result.results[0],
|
|
31416
|
-
options.request ||
|
|
31609
|
+
options.request || path5.basename(inputPath),
|
|
31417
31610
|
{ outputPath: htmlOutputPath, redaction, title }
|
|
31418
31611
|
);
|
|
31419
31612
|
} else {
|