@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.2 → 1.1.0-alpha.4
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 +124 -54
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +124 -54
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicRendererWithProviders/DynamicRendererWithProviders.d.ts +2 -1
- package/dist/types/components/organisms/DynamicRendererWithProviders/hybridDataProvider.d.ts +22 -0
- package/dist/types/components/organisms/DynamicRendererWithProviders/multiK8sProvider.d.ts +22 -0
- package/dist/types/hooks/useK8sSmartResource.d.ts +2 -2
- package/dist/types/localTypes/dynamicRender.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { TItemTypeMap } from '../../../localTypes/dynamicRender';
|
|
3
|
+
import { TUseK8sSmartResourceParams } from '../../../hooks/useK8sSmartResource';
|
|
3
4
|
import { TDynamicRendererProps } from '../DynamicRenderer';
|
|
4
5
|
export declare const DynamicRendererWithProviders: <T extends TItemTypeMap>(props: TDynamicRendererProps<T> & {
|
|
5
|
-
urlsToFetch: string[];
|
|
6
|
+
urlsToFetch: (string | TUseK8sSmartResourceParams<any>)[];
|
|
6
7
|
dataToApplyToContext?: unknown;
|
|
7
8
|
theme: 'dark' | 'light';
|
|
8
9
|
nodeTerminalDefaultProfile?: string | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { AxiosError } from 'axios';
|
|
3
|
+
import { TUseK8sSmartResourceParams } from '../../../hooks/useK8sSmartResource';
|
|
4
|
+
type DataMap = Record<string, unknown>;
|
|
5
|
+
type MultiQueryContextValue = {
|
|
6
|
+
data: DataMap;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
isError: boolean;
|
|
9
|
+
errors: ReadonlyArray<AxiosError | Error | string | null>;
|
|
10
|
+
};
|
|
11
|
+
type MultiQueryProviderProps = {
|
|
12
|
+
/** Mixed array: first (any number of) K8s resources, then (any number of) URL strings */
|
|
13
|
+
items: ReadonlyArray<string | TUseK8sSmartResourceParams<unknown>>;
|
|
14
|
+
/** Optional short-circuit to set data.req0 directly */
|
|
15
|
+
dataToApplyToContext?: unknown;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
/** ------------------------------ Provider -------------------------------- */
|
|
19
|
+
export declare const MultiQueryProvider: FC<MultiQueryProviderProps>;
|
|
20
|
+
/** Consumer hook */
|
|
21
|
+
export declare const useMultiQuery: () => MultiQueryContextValue;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import type { AxiosError } from 'axios';
|
|
3
|
+
import { useK8sSmartResource } from '../../../hooks/useK8sSmartResource';
|
|
4
|
+
/** Reuse your hook's param type */
|
|
5
|
+
export type UseK8sSmartResourceParams<T> = Parameters<typeof useK8sSmartResource<T>>[0];
|
|
6
|
+
type DataMap = Record<string, unknown>;
|
|
7
|
+
type MultiK8sContextValue = {
|
|
8
|
+
data: DataMap;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
isError: boolean;
|
|
11
|
+
errors: ReadonlyArray<AxiosError | Error | string | null>;
|
|
12
|
+
};
|
|
13
|
+
type MultiK8sProviderProps = {
|
|
14
|
+
resources: ReadonlyArray<UseK8sSmartResourceParams<unknown>>;
|
|
15
|
+
dataToApplyToContext?: unknown;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
/** --- Provider ----------------------------------------------------------- */
|
|
19
|
+
export declare const MultiK8sProvider: FC<MultiK8sProviderProps>;
|
|
20
|
+
/** --- Consumer Hook ------------------------------------------------------ */
|
|
21
|
+
export declare const useMultiK8s: () => MultiK8sContextValue;
|
|
22
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosError } from 'axios';
|
|
2
2
|
import { TSingleResource } from '../localTypes/k8s';
|
|
3
|
-
type
|
|
3
|
+
export type TUseK8sSmartResourceParams<T> = {
|
|
4
4
|
cluster: string;
|
|
5
5
|
group?: string;
|
|
6
6
|
version: 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, group, version, plural, namespace, fieldSelector, labelSelector, isEnabled, listRefetchInterval, limit, mapListWatchState, }:
|
|
28
|
+
export declare const useK8sSmartResource: <T>({ cluster, group, version, plural, namespace, fieldSelector, labelSelector, isEnabled, listRefetchInterval, limit, mapListWatchState, }: TUseK8sSmartResourceParams<T>) => SmartResult<T>;
|
|
29
29
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { TUseK8sSmartResourceParams } from '../hooks/useK8sSmartResource';
|
|
2
3
|
export type TItemTypeMap = Record<string, unknown>;
|
|
3
4
|
export type TRenderableItem<T extends TItemTypeMap> = {
|
|
4
5
|
[K in keyof T]: {
|
|
@@ -15,7 +16,7 @@ export type TRendererComponents<T extends TItemTypeMap> = {
|
|
|
15
16
|
};
|
|
16
17
|
export type TFactoryDataK8s<T extends TItemTypeMap> = {
|
|
17
18
|
key: string;
|
|
18
|
-
urlsToFetch: string[];
|
|
19
|
+
urlsToFetch: (string | TUseK8sSmartResourceParams<any>)[];
|
|
19
20
|
withScrollableMainContentCard?: boolean;
|
|
20
21
|
data: TRenderableItem<T>[];
|
|
21
22
|
sidebarTags?: string[];
|
package/package.json
CHANGED