@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.79 → 0.0.1-alpha.80

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.
@@ -45831,7 +45831,13 @@ const partsOfUrlContext = createContextFactory();
45831
45831
  const PartsOfUrlProvider = partsOfUrlContext.Provider;
45832
45832
  const usePartsOfUrl = partsOfUrlContext.useTypedContext;
45833
45833
 
45834
- const parseMutliqueryText$5 = ({ text, multiQueryData }) => {
45834
+ const parsePartsOfUrl = ({
45835
+ template,
45836
+ replaceValues
45837
+ }) => {
45838
+ return prepareTemplate({ template, replaceValues });
45839
+ };
45840
+ const parseMutliqueryText = ({ text, multiQueryData }) => {
45835
45841
  if (!text) return "";
45836
45842
  return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
45837
45843
  try {
@@ -45846,6 +45852,46 @@ const parseMutliqueryText$5 = ({ text, multiQueryData }) => {
45846
45852
  }
45847
45853
  });
45848
45854
  };
45855
+ const parseJsonPathTemplate = ({
45856
+ text,
45857
+ multiQueryData
45858
+ }) => {
45859
+ 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 "";
45871
+ }
45872
+ const value = results[0];
45873
+ return value != null ? String(value) : "";
45874
+ } catch {
45875
+ return match;
45876
+ }
45877
+ });
45878
+ };
45879
+ const parseAll = ({
45880
+ text,
45881
+ replaceValues,
45882
+ multiQueryData
45883
+ }) => {
45884
+ return parsePartsOfUrl({
45885
+ template: parseJsonPathTemplate({
45886
+ text: parseMutliqueryText({
45887
+ text,
45888
+ multiQueryData
45889
+ }),
45890
+ multiQueryData
45891
+ }),
45892
+ replaceValues
45893
+ });
45894
+ };
45849
45895
 
45850
45896
  const AntdLink = ({
45851
45897
  data,
@@ -45858,14 +45904,8 @@ const AntdLink = ({
45858
45904
  acc[index.toString()] = value;
45859
45905
  return acc;
45860
45906
  }, {});
45861
- const textPrepared = prepareTemplate({
45862
- template: parseMutliqueryText$5({ text, multiQueryData }),
45863
- replaceValues
45864
- });
45865
- const hrefPrepared = prepareTemplate({
45866
- template: parseMutliqueryText$5({ text: href, multiQueryData }),
45867
- replaceValues
45868
- });
45907
+ const textPrepared = parseAll({ text, replaceValues, multiQueryData });
45908
+ const hrefPrepared = parseAll({ text: href, replaceValues, multiQueryData });
45869
45909
  if (isMultiqueryLoading) {
45870
45910
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
45871
45911
  }
@@ -45935,21 +45975,7 @@ const PartsOfUrl = ({ data }) => {
45935
45975
 
45936
45976
  const MultiQuery = ({ data }) => {
45937
45977
  const { data: multiQueryData, isLoading, isError, errors } = useMultiQuery();
45938
- const preparedText = useMemo(() => {
45939
- if (!data?.text) return "";
45940
- return data.text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
45941
- try {
45942
- const reqIndex = parseInt(reqIndexStr, 10);
45943
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
45944
- (m) => m[1]
45945
- );
45946
- const value = lodashExports.get(multiQueryData[`req${reqIndex}`], path);
45947
- return value != null ? String(value) : "";
45948
- } catch {
45949
- return match;
45950
- }
45951
- });
45952
- }, [data?.text, multiQueryData]);
45978
+ const preparedText = parseMutliqueryText({ text: data.text, multiQueryData });
45953
45979
  if (isLoading) {
45954
45980
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
45955
45981
  }
@@ -45965,21 +45991,6 @@ const MultiQuery = ({ data }) => {
45965
45991
  const ParsedText = ({ data }) => {
45966
45992
  const { data: multiQueryData, isLoading, isError, errors } = useMultiQuery();
45967
45993
  const partsOfUrl = usePartsOfUrl();
45968
- const preparedText = useMemo(() => {
45969
- if (!data?.text) return "";
45970
- return data.text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
45971
- try {
45972
- const reqIndex = parseInt(reqIndexStr, 10);
45973
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
45974
- (m) => m[1]
45975
- );
45976
- const value = lodashExports.get(multiQueryData[`req${reqIndex}`], path);
45977
- return value != null ? String(value) : "";
45978
- } catch {
45979
- return match;
45980
- }
45981
- });
45982
- }, [data?.text, multiQueryData]);
45983
45994
  if (isLoading) {
45984
45995
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
45985
45996
  }
@@ -45993,10 +46004,7 @@ const ParsedText = ({ data }) => {
45993
46004
  acc[index.toString()] = value;
45994
46005
  return acc;
45995
46006
  }, {});
45996
- const preparedTextWithPartsOfUrl = prepareTemplate({
45997
- template: preparedText,
45998
- replaceValues
45999
- });
46007
+ const preparedTextWithPartsOfUrl = parseAll({ text: data.text, replaceValues, multiQueryData });
46000
46008
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: data.style, children: preparedTextWithPartsOfUrl });
46001
46009
  };
46002
46010
 
@@ -46019,28 +46027,9 @@ const ProjectInfoCard = ({
46019
46027
  template: namespacePartOfUrl,
46020
46028
  replaceValues
46021
46029
  });
46022
- const parsedAccessGroups = accessGroups.map((accessGroup) => {
46023
- const parsedMultiQueryAccessGroup = accessGroup.replace(
46024
- /\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g,
46025
- (match, reqIndexStr, rawPath) => {
46026
- try {
46027
- const reqIndex = parseInt(reqIndexStr, 10);
46028
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
46029
- (m) => m[1]
46030
- );
46031
- const value = lodashExports.get(multiQueryData[`req${reqIndex}`], path);
46032
- return value != null ? String(value) : "";
46033
- } catch {
46034
- return match;
46035
- }
46036
- }
46037
- );
46038
- const parsedPartsOfUrlAccessGroup = prepareTemplate({
46039
- template: parsedMultiQueryAccessGroup,
46040
- replaceValues
46041
- });
46042
- return parsedPartsOfUrlAccessGroup;
46043
- });
46030
+ const parsedAccessGroups = accessGroups.map(
46031
+ (accessGroup) => parseAll({ text: accessGroup, replaceValues, multiQueryData })
46032
+ );
46044
46033
  if (isError) {
46045
46034
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
46046
46035
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
@@ -46146,21 +46135,6 @@ const useTheme = () => {
46146
46135
  return useContext(ThemeContext);
46147
46136
  };
46148
46137
 
46149
- const parseMutliqueryText$4 = ({ text, multiQueryData }) => {
46150
- if (!text) return "";
46151
- return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
46152
- try {
46153
- const reqIndex = parseInt(reqIndexStr, 10);
46154
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
46155
- (m) => m[1]
46156
- );
46157
- const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
46158
- return value != null ? String(value) : "";
46159
- } catch {
46160
- return match;
46161
- }
46162
- });
46163
- };
46164
46138
  const serializeLabels = (input) => {
46165
46139
  if (typeof input !== "object" || input === null || Array.isArray(input) || Object.getPrototypeOf(input) !== Object.prototype) {
46166
46140
  return "Expected a plain object";
@@ -46199,15 +46173,12 @@ const EnrichedTable = ({
46199
46173
  template: clusterNamePartOfUrl,
46200
46174
  replaceValues
46201
46175
  });
46202
- const fetchUrlPrepared = prepareTemplate({
46203
- template: parseMutliqueryText$4({ text: fetchUrl, multiQueryData }),
46204
- replaceValues
46205
- });
46176
+ const fetchUrlPrepared = parseAll({ text: fetchUrl, replaceValues, multiQueryData });
46206
46177
  let labelsSuffix;
46207
46178
  if (labelsSelector) {
46208
46179
  const parsedObject = Object.fromEntries(
46209
46180
  Object.entries(labelsSelector).map(
46210
- ([key, value]) => [key, prepareTemplate({ template: parseMutliqueryText$4({ text: value, multiQueryData }), replaceValues })]
46181
+ ([key, value]) => [key, parseAll({ text: value, replaceValues, multiQueryData })]
46211
46182
  )
46212
46183
  );
46213
46184
  const serializedLabels = serializeLabels(parsedObject);
@@ -46220,7 +46191,7 @@ const EnrichedTable = ({
46220
46191
  }
46221
46192
  let fieldSelectorSuffix;
46222
46193
  if (fieldSelector) {
46223
- const preparedFieldSelectorValueText = parseMutliqueryText$4({ text: fieldSelector?.parsedText, multiQueryData });
46194
+ const preparedFieldSelectorValueText = parseAll({ text: fieldSelector?.parsedText, replaceValues, multiQueryData });
46224
46195
  const preparedFieldSelectorValueTextWithPartsOfUrl = prepareTemplate({
46225
46196
  template: preparedFieldSelectorValueText,
46226
46197
  replaceValues
@@ -46283,21 +46254,6 @@ const EnrichedTable = ({
46283
46254
  ] });
46284
46255
  };
46285
46256
 
46286
- const parseMutliqueryText$3 = ({ text, multiQueryData }) => {
46287
- if (!text) return "";
46288
- return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
46289
- try {
46290
- const reqIndex = parseInt(reqIndexStr, 10);
46291
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
46292
- (m) => m[1]
46293
- );
46294
- const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
46295
- return value != null ? String(value) : "";
46296
- } catch {
46297
- return match;
46298
- }
46299
- });
46300
- };
46301
46257
  const getRunningContainerNames$1 = (pod) => (pod.status?.containerStatuses ?? []).filter((st) => Boolean(st.state?.running)).map((st) => st.name);
46302
46258
 
46303
46259
  const PodTerminal = ({
@@ -46320,18 +46276,9 @@ const PodTerminal = ({
46320
46276
  acc[index.toString()] = value;
46321
46277
  return acc;
46322
46278
  }, {});
46323
- const clusterPrepared = prepareTemplate({
46324
- template: parseMutliqueryText$3({ text: cluster, multiQueryData }),
46325
- replaceValues
46326
- });
46327
- const namespacePrepared = prepareTemplate({
46328
- template: parseMutliqueryText$3({ text: namespace, multiQueryData }),
46329
- replaceValues
46330
- });
46331
- const podNamePrepared = prepareTemplate({
46332
- template: parseMutliqueryText$3({ text: podName, multiQueryData }),
46333
- replaceValues
46334
- });
46279
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
46280
+ const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
46281
+ const podNamePrepared = parseAll({ text: podName, replaceValues, multiQueryData });
46335
46282
  const {
46336
46283
  data: podInfo,
46337
46284
  isError: isPodInfoError,
@@ -46378,22 +46325,6 @@ const factoryConfigContext = createContextFactory();
46378
46325
  const FactoryConfigContextProvider = factoryConfigContext.Provider;
46379
46326
  const useFactoryConfig = factoryConfigContext.useTypedContext;
46380
46327
 
46381
- const parseMutliqueryText$2 = ({ text, multiQueryData }) => {
46382
- if (!text) return "";
46383
- return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
46384
- try {
46385
- const reqIndex = parseInt(reqIndexStr, 10);
46386
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
46387
- (m) => m[1]
46388
- );
46389
- const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
46390
- return value != null ? String(value) : "";
46391
- } catch {
46392
- return match;
46393
- }
46394
- });
46395
- };
46396
-
46397
46328
  const NodeTerminal = ({
46398
46329
  data,
46399
46330
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -46414,14 +46345,8 @@ const NodeTerminal = ({
46414
46345
  acc[index.toString()] = value;
46415
46346
  return acc;
46416
46347
  }, {});
46417
- const clusterPrepared = prepareTemplate({
46418
- template: parseMutliqueryText$2({ text: cluster, multiQueryData }),
46419
- replaceValues
46420
- });
46421
- const nodeNamePrepared = prepareTemplate({
46422
- template: parseMutliqueryText$2({ text: nodeName, multiQueryData }),
46423
- replaceValues
46424
- });
46348
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
46349
+ const nodeNamePrepared = parseAll({ text: nodeName, replaceValues, multiQueryData });
46425
46350
  if (isMultiqueryLoading) {
46426
46351
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
46427
46352
  }
@@ -46440,21 +46365,6 @@ const NodeTerminal = ({
46440
46365
  ] });
46441
46366
  };
46442
46367
 
46443
- const parseMutliqueryText$1 = ({ text, multiQueryData }) => {
46444
- if (!text) return "";
46445
- return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
46446
- try {
46447
- const reqIndex = parseInt(reqIndexStr, 10);
46448
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
46449
- (m) => m[1]
46450
- );
46451
- const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
46452
- return value != null ? String(value) : "";
46453
- } catch {
46454
- return match;
46455
- }
46456
- });
46457
- };
46458
46368
  const getRunningContainerNames = (pod) => {
46459
46369
  const containers = (pod.status?.containerStatuses ?? []).filter((st) => Boolean(st.state?.running)).map((st) => st.name);
46460
46370
  const initContainers = (pod.status?.initContainerStatuses ?? []).map((st) => st.name);
@@ -46482,18 +46392,9 @@ const PodLogs = ({
46482
46392
  acc[index.toString()] = value;
46483
46393
  return acc;
46484
46394
  }, {});
46485
- const clusterPrepared = prepareTemplate({
46486
- template: parseMutliqueryText$1({ text: cluster, multiQueryData }),
46487
- replaceValues
46488
- });
46489
- const namespacePrepared = prepareTemplate({
46490
- template: parseMutliqueryText$1({ text: namespace, multiQueryData }),
46491
- replaceValues
46492
- });
46493
- const podNamePrepared = prepareTemplate({
46494
- template: parseMutliqueryText$1({ text: podName, multiQueryData }),
46495
- replaceValues
46496
- });
46395
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
46396
+ const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
46397
+ const podNamePrepared = parseAll({ text: podName, replaceValues, multiQueryData });
46497
46398
  const {
46498
46399
  data: podInfo,
46499
46400
  isError: isPodInfoError,
@@ -46539,22 +46440,6 @@ const PodLogs = ({
46539
46440
  ] });
46540
46441
  };
46541
46442
 
46542
- const parseMutliqueryText = ({ text, multiQueryData }) => {
46543
- if (!text) return "";
46544
- return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
46545
- try {
46546
- const reqIndex = parseInt(reqIndexStr, 10);
46547
- const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
46548
- (m) => m[1]
46549
- );
46550
- const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
46551
- return value != null ? String(value) : "";
46552
- } catch {
46553
- return match;
46554
- }
46555
- });
46556
- };
46557
-
46558
46443
  const YamlEditorSingleton = ({
46559
46444
  data,
46560
46445
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -46592,22 +46477,10 @@ const YamlEditorSingleton = ({
46592
46477
  acc[index.toString()] = value;
46593
46478
  return acc;
46594
46479
  }, {});
46595
- const clusterPrepared = prepareTemplate({
46596
- template: parseMutliqueryText({ text: cluster, multiQueryData }),
46597
- replaceValues
46598
- });
46599
- const apiGroupPrepared = prepareTemplate({
46600
- template: parseMutliqueryText({ text: apiGroup, multiQueryData }),
46601
- replaceValues
46602
- });
46603
- const apiVersionPrepared = prepareTemplate({
46604
- template: parseMutliqueryText({ text: apiVersion, multiQueryData }),
46605
- replaceValues
46606
- });
46607
- const typeNamePrepared = prepareTemplate({
46608
- template: parseMutliqueryText({ text: typeName, multiQueryData }),
46609
- replaceValues
46610
- });
46480
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
46481
+ const apiGroupPrepared = apiGroup ? parseAll({ text: apiGroup, replaceValues, multiQueryData }) : "no-api-group";
46482
+ const apiVersionPrepared = apiVersion ? parseAll({ text: apiVersion, replaceValues, multiQueryData }) : "no-api-version";
46483
+ const typeNamePrepared = parseAll({ text: typeName, replaceValues, multiQueryData });
46611
46484
  const prefillValues = multiQueryData[`req${prefillValuesRequestIndex}`];
46612
46485
  if (isMultiqueryLoading) {
46613
46486
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });