@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.17 → 1.2.0-alpha.18

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.
@@ -8615,10 +8615,6 @@ const ManageableBreadcrumbs = ({ data }) => {
8615
8615
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$y.HeightDiv, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleBreadcrumb, { items: data.breadcrumbItems }) });
8616
8616
  };
8617
8617
 
8618
- const getKinds = async ({ cluster }) => {
8619
- return axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
8620
- };
8621
-
8622
8618
  const kindByGvr = (entries) => (gvr) => {
8623
8619
  const [group = "", v = "", resource = ""] = gvr.split("~", 3);
8624
8620
  const norm = (s) => s.trim();
@@ -8627,6 +8623,10 @@ const kindByGvr = (entries) => (gvr) => {
8627
8623
  return uniq.length === 1 ? uniq[0] : void 0;
8628
8624
  };
8629
8625
 
8626
+ const getKinds = async ({ cluster }) => {
8627
+ return axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
8628
+ };
8629
+
8630
8630
  const parseK8sVersion$1 = (raw) => {
8631
8631
  const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
8632
8632
  if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
@@ -8671,6 +8671,23 @@ const getSortedKindsAll = (index) => {
8671
8671
  );
8672
8672
  };
8673
8673
 
8674
+ const useKinds = ({
8675
+ cluster,
8676
+ refetchInterval,
8677
+ isEnabled
8678
+ }) => {
8679
+ return useQuery({
8680
+ queryKey: ["useKinds", cluster],
8681
+ queryFn: () => getKinds({ cluster }),
8682
+ select: (data) => ({
8683
+ kindIndex: data.data,
8684
+ kindsWithVersion: getSortedKindsAll(data.data)
8685
+ }),
8686
+ refetchInterval: refetchInterval !== void 0 ? refetchInterval : 6e4,
8687
+ enabled: isEnabled
8688
+ });
8689
+ };
8690
+
8674
8691
  const getDirectUnknownResource = async ({ uri }) => {
8675
8692
  return axios.get(uri);
8676
8693
  };
@@ -9377,27 +9394,11 @@ const hasItemsArray = (value) => {
9377
9394
  const useK8sSmartResource = (params) => {
9378
9395
  const { cluster, apiGroup, apiVersion, plural } = params;
9379
9396
  const base = useK8sSmartResourceWithoutKinds(params);
9380
- const [kindsWithVersion, setKindsWithVersion] = useState(void 0);
9381
- useEffect(() => {
9382
- let cancelled = false;
9383
- if (!cluster) {
9384
- setKindsWithVersion(void 0);
9385
- return void 0;
9386
- }
9387
- getKinds({ cluster }).then((data) => {
9388
- if (cancelled) {
9389
- return;
9390
- }
9391
- setKindsWithVersion(getSortedKindsAll(data.data));
9392
- }).catch(() => {
9393
- if (!cancelled) {
9394
- setKindsWithVersion(void 0);
9395
- }
9396
- });
9397
- return () => {
9398
- cancelled = true;
9399
- };
9400
- }, [cluster]);
9397
+ const { data: kindsData } = useKinds({
9398
+ cluster,
9399
+ isEnabled: !!cluster
9400
+ });
9401
+ const kindsWithVersion = kindsData?.kindsWithVersion;
9401
9402
  const resolveKindByGvr = useMemo(
9402
9403
  () => kindsWithVersion ? kindByGvr(kindsWithVersion) : void 0,
9403
9404
  [kindsWithVersion]
@@ -46496,23 +46497,6 @@ const pluralByKind = (entries) => (kind, apiVersion) => {
46496
46497
  return uniq.length === 1 ? uniq[0] : void 0;
46497
46498
  };
46498
46499
 
46499
- const useKinds = ({
46500
- cluster,
46501
- refetchInterval,
46502
- isEnabled
46503
- }) => {
46504
- return useQuery({
46505
- queryKey: ["useKinds", cluster],
46506
- queryFn: () => getKinds({ cluster }),
46507
- select: (data) => ({
46508
- kindIndex: data.data,
46509
- kindsWithVersion: getSortedKindsAll(data.data)
46510
- }),
46511
- refetchInterval: refetchInterval !== void 0 ? refetchInterval : 6e4,
46512
- enabled: isEnabled
46513
- });
46514
- };
46515
-
46516
46500
  const findOwnerReferencePath = (rawObject, jsonPathToArrayOfRefs, reference) => {
46517
46501
  if (!rawObject || !jsonPathToArrayOfRefs) return void 0;
46518
46502
  let arrayJsonPath = jsonPathToArrayOfRefs.trim();