@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.1 → 1.2.0-alpha.2
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/dist/openapi-k8s-toolkit.es.js +36 -17
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +36 -17
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/utils.d.ts +2 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/utils.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -34167,35 +34167,53 @@ const parseMutliqueryText = ({
|
|
|
34167
34167
|
const parseJsonPathTemplate = ({
|
|
34168
34168
|
text,
|
|
34169
34169
|
multiQueryData,
|
|
34170
|
-
customFallback
|
|
34170
|
+
customFallback,
|
|
34171
|
+
replaceValues
|
|
34171
34172
|
}) => {
|
|
34172
34173
|
if (!text) return "";
|
|
34173
34174
|
const placeholderRegex = /\{reqsJsonPath\[(\d+)\]\s*\[\s*(['"])([\s\S]*?)\2\s*\](?:\s*\[\s*(['"])([\s\S]*?)\4\s*\])?\}/g;
|
|
34174
|
-
|
|
34175
|
+
const resolve = (input) => input.replace(
|
|
34175
34176
|
placeholderRegex,
|
|
34176
|
-
(match, reqIndexStr, _quote,
|
|
34177
|
+
(match, reqIndexStr, _quote, rawJsonPathExpr, _fallbackQuote, inlineFallback = "Undefined with no fallback") => {
|
|
34177
34178
|
try {
|
|
34178
|
-
const reqIndex =
|
|
34179
|
+
const reqIndex = Number(reqIndexStr);
|
|
34179
34180
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
34180
|
-
|
|
34181
|
-
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34181
|
+
let jsonPathExpr = rawJsonPathExpr;
|
|
34182
|
+
let previous2 = null;
|
|
34183
|
+
let loopGuard = 0;
|
|
34184
|
+
while (previous2 !== jsonPathExpr && loopGuard < 10) {
|
|
34185
|
+
previous2 = jsonPathExpr;
|
|
34186
|
+
jsonPathExpr = resolve(jsonPathExpr);
|
|
34187
|
+
loopGuard++;
|
|
34188
|
+
}
|
|
34189
|
+
if (replaceValues) {
|
|
34190
|
+
jsonPathExpr = prepareTemplate({
|
|
34191
|
+
template: jsonPathExpr,
|
|
34192
|
+
replaceValues
|
|
34193
|
+
});
|
|
34185
34194
|
}
|
|
34186
|
-
|
|
34187
|
-
if (
|
|
34188
|
-
|
|
34189
|
-
|
|
34190
|
-
|
|
34191
|
-
return
|
|
34195
|
+
if (jsonRoot === void 0 && customFallback) return customFallback;
|
|
34196
|
+
if (jsonRoot === void 0) return inlineFallback;
|
|
34197
|
+
const results = jp.query(jsonRoot, `$${jsonPathExpr}`);
|
|
34198
|
+
const value = results?.[0];
|
|
34199
|
+
if (value == null) {
|
|
34200
|
+
return customFallback ?? inlineFallback;
|
|
34192
34201
|
}
|
|
34193
|
-
return String(
|
|
34202
|
+
return String(value);
|
|
34194
34203
|
} catch {
|
|
34195
34204
|
return match;
|
|
34196
34205
|
}
|
|
34197
34206
|
}
|
|
34198
34207
|
);
|
|
34208
|
+
let result = text;
|
|
34209
|
+
let previous = null;
|
|
34210
|
+
let iterations = 0;
|
|
34211
|
+
while (result !== previous && iterations < 10) {
|
|
34212
|
+
previous = result;
|
|
34213
|
+
result = resolve(result);
|
|
34214
|
+
iterations++;
|
|
34215
|
+
}
|
|
34216
|
+
return result;
|
|
34199
34217
|
};
|
|
34200
34218
|
const parseWithoutPartsOfUrl = ({
|
|
34201
34219
|
text,
|
|
@@ -34223,7 +34241,8 @@ const parseAll = ({
|
|
|
34223
34241
|
text,
|
|
34224
34242
|
multiQueryData
|
|
34225
34243
|
}),
|
|
34226
|
-
multiQueryData
|
|
34244
|
+
multiQueryData,
|
|
34245
|
+
replaceValues
|
|
34227
34246
|
}),
|
|
34228
34247
|
replaceValues
|
|
34229
34248
|
});
|