@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.80 → 0.0.1-alpha.81
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.
|
@@ -45839,42 +45839,50 @@ const parsePartsOfUrl = ({
|
|
|
45839
45839
|
};
|
|
45840
45840
|
const parseMutliqueryText = ({ text, multiQueryData }) => {
|
|
45841
45841
|
if (!text) return "";
|
|
45842
|
-
return text.replace(
|
|
45843
|
-
|
|
45844
|
-
|
|
45845
|
-
|
|
45846
|
-
(
|
|
45847
|
-
|
|
45848
|
-
|
|
45849
|
-
|
|
45850
|
-
|
|
45851
|
-
|
|
45842
|
+
return text.replace(
|
|
45843
|
+
/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\](?:\[\s*['"]([^'"]+)['"]\s*\])?\}/g,
|
|
45844
|
+
(_match, reqIndexStr, rawPath, fallback) => {
|
|
45845
|
+
try {
|
|
45846
|
+
const reqIndex = parseInt(reqIndexStr, 10);
|
|
45847
|
+
const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
|
|
45848
|
+
(m) => m[1]
|
|
45849
|
+
);
|
|
45850
|
+
const value = _$1.get(multiQueryData[`req${reqIndex}`], path, fallback !== void 0 ? fallback : void 0);
|
|
45851
|
+
if (value == null) {
|
|
45852
|
+
return fallback ?? "Undefined with no fallback";
|
|
45853
|
+
}
|
|
45854
|
+
return String(value);
|
|
45855
|
+
} catch {
|
|
45856
|
+
return _match;
|
|
45857
|
+
}
|
|
45852
45858
|
}
|
|
45853
|
-
|
|
45859
|
+
);
|
|
45854
45860
|
};
|
|
45855
45861
|
const parseJsonPathTemplate = ({
|
|
45856
45862
|
text,
|
|
45857
45863
|
multiQueryData
|
|
45858
45864
|
}) => {
|
|
45859
45865
|
if (!text) return "";
|
|
45860
|
-
const placeholderRegex = /\{reqsJsonPath\[(\d+)\]\s*\[\s*(['"])([^'"]+)\2\s*\]\}/g;
|
|
45861
|
-
return text.replace(
|
|
45862
|
-
|
|
45863
|
-
|
|
45864
|
-
|
|
45865
|
-
|
|
45866
|
-
|
|
45867
|
-
|
|
45868
|
-
|
|
45869
|
-
|
|
45870
|
-
|
|
45866
|
+
const placeholderRegex = /\{reqsJsonPath\[(\d+)\]\s*\[\s*(['"])([^'"]+)\2\s*\](?:\s*\[\s*(['"])([^'"]*)\4\s*\])?\}/g;
|
|
45867
|
+
return text.replace(
|
|
45868
|
+
placeholderRegex,
|
|
45869
|
+
(match, reqIndexStr, _quote, jsonPathExpr, _smth, fallback = "Undefined with no fallback") => {
|
|
45870
|
+
try {
|
|
45871
|
+
const reqIndex = parseInt(reqIndexStr, 10);
|
|
45872
|
+
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
45873
|
+
if (jsonRoot === void 0) {
|
|
45874
|
+
return fallback;
|
|
45875
|
+
}
|
|
45876
|
+
const results = jp.query(jsonRoot, `$${jsonPathExpr}`);
|
|
45877
|
+
if (results.length === 0 || results[0] == null || results[0] === void 0) {
|
|
45878
|
+
return fallback;
|
|
45879
|
+
}
|
|
45880
|
+
return String(results[0]);
|
|
45881
|
+
} catch {
|
|
45882
|
+
return match;
|
|
45871
45883
|
}
|
|
45872
|
-
const value = results[0];
|
|
45873
|
-
return value != null ? String(value) : "";
|
|
45874
|
-
} catch {
|
|
45875
|
-
return match;
|
|
45876
45884
|
}
|
|
45877
|
-
|
|
45885
|
+
);
|
|
45878
45886
|
};
|
|
45879
45887
|
const parseAll = ({
|
|
45880
45888
|
text,
|