@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.1 → 1.1.0-alpha.2

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.
@@ -7,7 +7,7 @@ export type TManageableBreadcrumbsProps = {
7
7
  };
8
8
  export declare const ManageableBreadcrumbs: FC<TManageableBreadcrumbsProps>;
9
9
  export type TManageableBreadcrumbsWithDataProviderProps = {
10
- wsUrl: string;
10
+ cluster: string;
11
11
  apiGroup: string;
12
12
  apiVersion: string;
13
13
  plural: string;
@@ -9,7 +9,7 @@ export type TManageableSidebarProps = {
9
9
  };
10
10
  export declare const ManageableSidebar: FC<TManageableSidebarProps>;
11
11
  export type TManageableSidebarWithDataProviderProps = {
12
- wsUrl: string;
12
+ cluster: string;
13
13
  apiGroup: string;
14
14
  apiVersion: string;
15
15
  plural: string;
@@ -0,0 +1,29 @@
1
+ import { AxiosError } from 'axios';
2
+ import { TSingleResource } from '../localTypes/k8s';
3
+ type UseK8sSmartResourceParams<T> = {
4
+ cluster: string;
5
+ group?: string;
6
+ version: string;
7
+ plural: string;
8
+ namespace?: string;
9
+ fieldSelector?: string;
10
+ labelSelector?: string;
11
+ limit?: number;
12
+ isEnabled?: boolean;
13
+ listRefetchInterval?: number | false;
14
+ mapListWatchState?: (state: {
15
+ order: string[];
16
+ byKey: Record<string, TSingleResource>;
17
+ }) => T;
18
+ };
19
+ type SmartResult<T> = {
20
+ data: T | undefined;
21
+ isLoading: boolean;
22
+ isError: boolean;
23
+ error: AxiosError | Error | string | undefined;
24
+ _meta?: {
25
+ used: 'list' | 'watch' | 'disabled' | 'verbs-loading' | 'verbs-error';
26
+ };
27
+ };
28
+ export declare const useK8sSmartResource: <T>({ cluster, group, version, plural, namespace, fieldSelector, labelSelector, isEnabled, listRefetchInterval, limit, mapListWatchState, }: UseK8sSmartResourceParams<T>) => SmartResult<T>;
29
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare const useK8sVerbs: ({ cluster, group, version, plural, isEnabled, }: {
2
+ cluster: string;
3
+ group?: string | undefined;
4
+ version: string;
5
+ plural: string;
6
+ isEnabled?: boolean | undefined;
7
+ }) => {
8
+ canList: boolean;
9
+ canWatch: boolean;
10
+ isError: boolean;
11
+ isLoading: boolean;
12
+ error: Error | null;
13
+ };
@@ -25,6 +25,8 @@ export { useDirectUnknownResource } from './hooks/useDirectUnknownResource';
25
25
  export { usePermissions } from './hooks/usePermissions';
26
26
  export { useListWatch, useInfiniteSentinel } from './hooks/useListThenWatch';
27
27
  export type { TConnStatus, TUseListWatchQuery, TUseListWatchOptions, TUseListWatchReturn, } from './hooks/useListThenWatch';
28
+ export { useK8sVerbs } from './hooks/useK8sVerbs';
29
+ export { useK8sSmartResource } from './hooks/useK8sSmartResource';
28
30
  export type { TRequestError } from './localTypes/api';
29
31
  export type { TClusterList } from './localTypes/clusterList';
30
32
  export type { TItemTypeMap, TRenderableItem, TRendererComponents, TFactoryDataK8s, TFactoryResponse, TFactoryResource, } from './localTypes/dynamicRender';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prorobotech/openapi-k8s-toolkit",
3
- "version": "1.1.0-alpha.1",
3
+ "version": "1.1.0-alpha.2",
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",