@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.16 → 1.1.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.
- package/dist/openapi-k8s-toolkit.es.js +174 -103
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +174 -103
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/hooks/useK8sSmartResource/index.d.ts +2 -0
- package/dist/types/hooks/useK8sSmartResource/useK8sSmartResource.d.ts +28 -0
- package/dist/types/hooks/{useK8sSmartResource.d.ts → useK8sSmartResource/useK8sSmartResourceWithoutKinds.d.ts} +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type TUseK8sSmartResourceParams } from './useK8sSmartResourceWithoutKinds';
|
|
2
|
+
/**
|
|
3
|
+
* If T has an `{ items: U[] }` field, we add `kind?: string` and `apiVersion?: string` to each item.
|
|
4
|
+
* Otherwise T is left unchanged.
|
|
5
|
+
*/
|
|
6
|
+
type TWithKindAndApiVersionOnItems<T> = T extends {
|
|
7
|
+
items: (infer U)[];
|
|
8
|
+
} ? Omit<T, 'items'> & {
|
|
9
|
+
items: (U & {
|
|
10
|
+
kind?: string;
|
|
11
|
+
apiVersion?: string;
|
|
12
|
+
})[];
|
|
13
|
+
} : T;
|
|
14
|
+
/**
|
|
15
|
+
* Same params as useK8sSmartResource.
|
|
16
|
+
* Returns the same shape as useK8sSmartResource,
|
|
17
|
+
* but if `data.items` exists, items are enriched with `kind`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useK8sSmartResource: <T>(params: TUseK8sSmartResourceParams<T>) => {
|
|
20
|
+
data: TWithKindAndApiVersionOnItems<T> | undefined;
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
isError: boolean;
|
|
23
|
+
error: string | Error | import("axios").AxiosError<unknown, any> | undefined;
|
|
24
|
+
_meta?: {
|
|
25
|
+
used: "disabled" | "list" | "watch" | "verbs-loading" | "verbs-error";
|
|
26
|
+
} | undefined;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosError } from 'axios';
|
|
2
|
-
import { TSingleResource } from '
|
|
2
|
+
import { TSingleResource } from '../../localTypes/k8s';
|
|
3
3
|
export type TUseK8sSmartResourceParams<T> = {
|
|
4
4
|
cluster: string;
|
|
5
5
|
apiGroup?: string;
|
|
@@ -25,5 +25,5 @@ type SmartResult<T> = {
|
|
|
25
25
|
used: 'list' | 'watch' | 'disabled' | 'verbs-loading' | 'verbs-error';
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
export declare const
|
|
28
|
+
export declare const useK8sSmartResourceWithoutKinds: <T>({ cluster, apiGroup, apiVersion, plural, namespace, fieldSelector, labelSelector, isEnabled, listRefetchInterval, limit, mapListWatchState, }: TUseK8sSmartResourceParams<T>) => SmartResult<T>;
|
|
29
29
|
export {};
|
package/package.json
CHANGED