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