@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.78 → 0.0.1-alpha.79
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 +107 -63
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +107 -63
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/AntdLink/AntdLink.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/AntdLink/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/AntdLink/utils.d.ts +8 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +8 -1
- package/package.json +1 -1
|
@@ -45620,7 +45620,6 @@ const MonacoEditor = ({
|
|
|
45620
45620
|
};
|
|
45621
45621
|
|
|
45622
45622
|
const TopRowContent = st.div`
|
|
45623
|
-
width: 100%;
|
|
45624
45623
|
height: 35px;
|
|
45625
45624
|
margin-left: 202px;
|
|
45626
45625
|
display: flex;
|
|
@@ -45771,6 +45770,111 @@ const AntdText = ({
|
|
|
45771
45770
|
] });
|
|
45772
45771
|
};
|
|
45773
45772
|
|
|
45773
|
+
const MultiQueryContext = createContext(void 0);
|
|
45774
|
+
const MultiQueryProvider = ({ urls, children }) => {
|
|
45775
|
+
const queries = useQueries({
|
|
45776
|
+
queries: urls.map((url, index) => ({
|
|
45777
|
+
queryKey: ["multi", index, url],
|
|
45778
|
+
queryFn: async () => {
|
|
45779
|
+
const response = await axios.get(url);
|
|
45780
|
+
return response.data;
|
|
45781
|
+
}
|
|
45782
|
+
}))
|
|
45783
|
+
});
|
|
45784
|
+
const data = {};
|
|
45785
|
+
const errors = [];
|
|
45786
|
+
queries.forEach((q, i) => {
|
|
45787
|
+
data[`req${i}`] = q.data;
|
|
45788
|
+
errors[i] = q.error ?? null;
|
|
45789
|
+
});
|
|
45790
|
+
const isLoading = queries.some((q) => q.isLoading);
|
|
45791
|
+
const isError = queries.some((q) => q.isError);
|
|
45792
|
+
const value = useMemo(
|
|
45793
|
+
() => ({ data, isLoading, isError, errors }),
|
|
45794
|
+
/*
|
|
45795
|
+
We use JSON.stringify(data) and JSON.stringify(errors) as dependencies to safely memoize when values deeply change (since data is a new object every render).
|
|
45796
|
+
Alternatively, you could use a deep comparison hook or lodash.isEqual if needed.
|
|
45797
|
+
*/
|
|
45798
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45799
|
+
[JSON.stringify(data), isLoading, isError, JSON.stringify(errors)]
|
|
45800
|
+
);
|
|
45801
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiQueryContext.Provider, { value, children });
|
|
45802
|
+
};
|
|
45803
|
+
const useMultiQuery = () => {
|
|
45804
|
+
const context = useContext(MultiQueryContext);
|
|
45805
|
+
if (!context) {
|
|
45806
|
+
throw new Error("useMultiQuery must be used within a MultiQueryProvider");
|
|
45807
|
+
}
|
|
45808
|
+
return context;
|
|
45809
|
+
};
|
|
45810
|
+
|
|
45811
|
+
const createContextFactory = () => {
|
|
45812
|
+
const Context = createContext(null);
|
|
45813
|
+
const useTypedContext = () => {
|
|
45814
|
+
const context = useContext(Context);
|
|
45815
|
+
if (!context) {
|
|
45816
|
+
throw new Error("useTypedContext must be used within a Provider");
|
|
45817
|
+
}
|
|
45818
|
+
return context;
|
|
45819
|
+
};
|
|
45820
|
+
const Provider = ({ children, value }) => {
|
|
45821
|
+
const memoizedValue = useMemo(() => value, Object.values(value));
|
|
45822
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value: memoizedValue, children });
|
|
45823
|
+
};
|
|
45824
|
+
return {
|
|
45825
|
+
Provider,
|
|
45826
|
+
useTypedContext
|
|
45827
|
+
};
|
|
45828
|
+
};
|
|
45829
|
+
|
|
45830
|
+
const partsOfUrlContext = createContextFactory();
|
|
45831
|
+
const PartsOfUrlProvider = partsOfUrlContext.Provider;
|
|
45832
|
+
const usePartsOfUrl = partsOfUrlContext.useTypedContext;
|
|
45833
|
+
|
|
45834
|
+
const parseMutliqueryText$5 = ({ text, multiQueryData }) => {
|
|
45835
|
+
if (!text) return "";
|
|
45836
|
+
return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
|
|
45837
|
+
try {
|
|
45838
|
+
const reqIndex = parseInt(reqIndexStr, 10);
|
|
45839
|
+
const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
|
|
45840
|
+
(m) => m[1]
|
|
45841
|
+
);
|
|
45842
|
+
const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
|
|
45843
|
+
return value != null ? String(value) : "";
|
|
45844
|
+
} catch {
|
|
45845
|
+
return match;
|
|
45846
|
+
}
|
|
45847
|
+
});
|
|
45848
|
+
};
|
|
45849
|
+
|
|
45850
|
+
const AntdLink = ({
|
|
45851
|
+
data,
|
|
45852
|
+
children
|
|
45853
|
+
}) => {
|
|
45854
|
+
const { data: multiQueryData, isLoading: isMultiqueryLoading } = useMultiQuery();
|
|
45855
|
+
const partsOfUrl = usePartsOfUrl();
|
|
45856
|
+
const { id, text, href, ...linkProps } = data;
|
|
45857
|
+
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
45858
|
+
acc[index.toString()] = value;
|
|
45859
|
+
return acc;
|
|
45860
|
+
}, {});
|
|
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
|
+
});
|
|
45869
|
+
if (isMultiqueryLoading) {
|
|
45870
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
45871
|
+
}
|
|
45872
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography.Link, { href: hrefPrepared, ...linkProps, children: [
|
|
45873
|
+
textPrepared,
|
|
45874
|
+
children
|
|
45875
|
+
] });
|
|
45876
|
+
};
|
|
45877
|
+
|
|
45774
45878
|
const AntdCard = ({
|
|
45775
45879
|
data,
|
|
45776
45880
|
children
|
|
@@ -45816,29 +45920,6 @@ const AntdButton = ({
|
|
|
45816
45920
|
] });
|
|
45817
45921
|
};
|
|
45818
45922
|
|
|
45819
|
-
const createContextFactory = () => {
|
|
45820
|
-
const Context = createContext(null);
|
|
45821
|
-
const useTypedContext = () => {
|
|
45822
|
-
const context = useContext(Context);
|
|
45823
|
-
if (!context) {
|
|
45824
|
-
throw new Error("useTypedContext must be used within a Provider");
|
|
45825
|
-
}
|
|
45826
|
-
return context;
|
|
45827
|
-
};
|
|
45828
|
-
const Provider = ({ children, value }) => {
|
|
45829
|
-
const memoizedValue = useMemo(() => value, Object.values(value));
|
|
45830
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value: memoizedValue, children });
|
|
45831
|
-
};
|
|
45832
|
-
return {
|
|
45833
|
-
Provider,
|
|
45834
|
-
useTypedContext
|
|
45835
|
-
};
|
|
45836
|
-
};
|
|
45837
|
-
|
|
45838
|
-
const partsOfUrlContext = createContextFactory();
|
|
45839
|
-
const PartsOfUrlProvider = partsOfUrlContext.Provider;
|
|
45840
|
-
const usePartsOfUrl = partsOfUrlContext.useTypedContext;
|
|
45841
|
-
|
|
45842
45923
|
const PartsOfUrl = ({ data }) => {
|
|
45843
45924
|
const partsOfUrl = usePartsOfUrl();
|
|
45844
45925
|
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
@@ -45852,44 +45933,6 @@ const PartsOfUrl = ({ data }) => {
|
|
|
45852
45933
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: preparedText });
|
|
45853
45934
|
};
|
|
45854
45935
|
|
|
45855
|
-
const MultiQueryContext = createContext(void 0);
|
|
45856
|
-
const MultiQueryProvider = ({ urls, children }) => {
|
|
45857
|
-
const queries = useQueries({
|
|
45858
|
-
queries: urls.map((url, index) => ({
|
|
45859
|
-
queryKey: ["multi", index, url],
|
|
45860
|
-
queryFn: async () => {
|
|
45861
|
-
const response = await axios.get(url);
|
|
45862
|
-
return response.data;
|
|
45863
|
-
}
|
|
45864
|
-
}))
|
|
45865
|
-
});
|
|
45866
|
-
const data = {};
|
|
45867
|
-
const errors = [];
|
|
45868
|
-
queries.forEach((q, i) => {
|
|
45869
|
-
data[`req${i}`] = q.data;
|
|
45870
|
-
errors[i] = q.error ?? null;
|
|
45871
|
-
});
|
|
45872
|
-
const isLoading = queries.some((q) => q.isLoading);
|
|
45873
|
-
const isError = queries.some((q) => q.isError);
|
|
45874
|
-
const value = useMemo(
|
|
45875
|
-
() => ({ data, isLoading, isError, errors }),
|
|
45876
|
-
/*
|
|
45877
|
-
We use JSON.stringify(data) and JSON.stringify(errors) as dependencies to safely memoize when values deeply change (since data is a new object every render).
|
|
45878
|
-
Alternatively, you could use a deep comparison hook or lodash.isEqual if needed.
|
|
45879
|
-
*/
|
|
45880
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45881
|
-
[JSON.stringify(data), isLoading, isError, JSON.stringify(errors)]
|
|
45882
|
-
);
|
|
45883
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiQueryContext.Provider, { value, children });
|
|
45884
|
-
};
|
|
45885
|
-
const useMultiQuery = () => {
|
|
45886
|
-
const context = useContext(MultiQueryContext);
|
|
45887
|
-
if (!context) {
|
|
45888
|
-
throw new Error("useMultiQuery must be used within a MultiQueryProvider");
|
|
45889
|
-
}
|
|
45890
|
-
return context;
|
|
45891
|
-
};
|
|
45892
|
-
|
|
45893
45936
|
const MultiQuery = ({ data }) => {
|
|
45894
45937
|
const { data: multiQueryData, isLoading, isError, errors } = useMultiQuery();
|
|
45895
45938
|
const preparedText = useMemo(() => {
|
|
@@ -45954,7 +45997,7 @@ const ParsedText = ({ data }) => {
|
|
|
45954
45997
|
template: preparedText,
|
|
45955
45998
|
replaceValues
|
|
45956
45999
|
});
|
|
45957
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: preparedTextWithPartsOfUrl });
|
|
46000
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: data.style, children: preparedTextWithPartsOfUrl });
|
|
45958
46001
|
};
|
|
45959
46002
|
|
|
45960
46003
|
const ProjectInfoCard = ({
|
|
@@ -46594,6 +46637,7 @@ const YamlEditorSingleton = ({
|
|
|
46594
46637
|
const DynamicComponents = {
|
|
46595
46638
|
DefaultDiv,
|
|
46596
46639
|
antdText: AntdText,
|
|
46640
|
+
antdLink: AntdLink,
|
|
46597
46641
|
antdCard: AntdCard,
|
|
46598
46642
|
antdFlex: AntdFlex,
|
|
46599
46643
|
antdRow: AntdRow,
|