@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(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
45843
- try {
45844
- const reqIndex = parseInt(reqIndexStr, 10);
45845
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
45846
- (m) => m[1]
45847
- );
45848
- const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
45849
- return value != null ? String(value) : "";
45850
- } catch {
45851
- return match;
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(placeholderRegex, (match, reqIndexStr, _quote, jsonPathExpr) => {
45862
- try {
45863
- const reqIndex = parseInt(reqIndexStr, 10);
45864
- const jsonRoot = multiQueryData[`req${reqIndex}`];
45865
- if (jsonRoot === void 0) {
45866
- return "";
45867
- }
45868
- const results = jp.query(jsonRoot, `$${jsonPathExpr}`);
45869
- if (results.length === 0) {
45870
- return "";
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,