@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.17 → 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.
@@ -0,0 +1,2 @@
1
+ export { useK8sSmartResource } from './useK8sSmartResource';
2
+ export type { TUseK8sSmartResourceParams } from './useK8sSmartResourceWithoutKinds';
@@ -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 '../localTypes/k8s';
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 useK8sSmartResource: <T>({ cluster, apiGroup, apiVersion, plural, namespace, fieldSelector, labelSelector, isEnabled, listRefetchInterval, limit, mapListWatchState, }: TUseK8sSmartResourceParams<T>) => SmartResult<T>;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prorobotech/openapi-k8s-toolkit",
3
- "version": "1.1.0-alpha.17",
3
+ "version": "1.1.0-alpha.18",
4
4
  "description": "ProRobotech OpenAPI k8s tools",
5
5
  "main": "dist/openapi-k8s-toolkit.cjs.js",
6
6
  "module": "dist/openapi-k8s-toolkit.es.js",