@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.34 → 1.4.0-alpha.36

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.
@@ -10,3 +10,24 @@ export declare const extractErrorMessage: (error: unknown) => string;
10
10
  export declare const getValueByPath: (obj: Record<string, unknown>, path: string) => unknown;
11
11
  /** Check whether the response for a given reqIndex has an empty array at the specified path. */
12
12
  export declare const isEmptyAtPath: (multiQueryData: Record<string, unknown>, reqIndex: number, path: string) => boolean;
13
+ export type TResultStatus = '403' | '404' | '500' | 'error';
14
+ export declare const STATUS_SEVERITY: Record<string, number>;
15
+ export declare const httpStatusToResultStatus: (statusCode: number | undefined) => TResultStatus;
16
+ export declare const getDefaultTitle: (status: string | number) => string;
17
+ /** Resolve the itemsPath for a specific position in the reqIndex array.
18
+ * - string → same path for all requests
19
+ * - string[] → positional mapping (itemsPath[index] for reqIndex at that position)
20
+ * - undefined → default ".items" */
21
+ export declare const resolveItemsPath: (itemsPath: string | string[] | undefined, index: number) => string;
22
+ /** Check a single reqIndex for errors/empty state. Returns null if OK. */
23
+ export declare const checkReqIndex: (reqIndex: number, multiQueryData: Record<string, unknown>, getErrorForReq: (i: number) => unknown, shouldCheckEmpty: boolean, itemsPath: string) => {
24
+ resultStatus: TResultStatus;
25
+ severity: number;
26
+ message: string;
27
+ } | null;
28
+ /** Find the worst error across an array of reqIndexes. Returns null if all OK.
29
+ * itemsPath can be a string (same for all) or string[] (per-position). */
30
+ export declare const findWorstError: (reqIndexes: number[], multiQueryData: Record<string, unknown>, getErrorForReq: (i: number) => unknown, shouldCheckEmpty: boolean, itemsPath: string | string[] | undefined) => {
31
+ resultStatus: TResultStatus;
32
+ message: string;
33
+ } | null;
@@ -43,11 +43,13 @@ export type TAntdIconsProps = {
43
43
  };
44
44
  export type TAntdResultProps = {
45
45
  id: number | string;
46
- reqIndex?: number;
46
+ reqIndex?: number | number[];
47
47
  /** Dot-separated path to the array in the response to check for emptiness.
48
48
  * Default: ".items" (K8s list response format). Can be changed for non-K8s
49
- * APIs, e.g. ".data.results" */
50
- itemsPath?: string;
49
+ * APIs, e.g. ".data.results".
50
+ * When reqIndex is an array, itemsPath can also be an array — each position
51
+ * maps to the corresponding reqIndex (e.g. reqIndex: [0,1], itemsPath: [".items", ".data.results"]). */
52
+ itemsPath?: string | string[];
51
53
  /** Whether to check if the array at `itemsPath` is empty and show 404 when
52
54
  * it is. Default: true — antdResult reacts to empty responses by default.
53
55
  * Set to false to explicitly disable this check. */
@@ -8,4 +8,6 @@ export declare const DynamicRendererWithProviders: <T extends TItemTypeMap>(prop
8
8
  theme: 'dark' | 'light';
9
9
  nodeTerminalDefaultProfile?: string | undefined;
10
10
  disableEventBubbling?: boolean | undefined;
11
+ effectiveReqIndexes?: number[] | undefined;
12
+ effectiveItemsPath?: string | string[] | undefined;
11
13
  }) => ReactElement;
@@ -0,0 +1,8 @@
1
+ import { FC, ReactNode } from 'react';
2
+ type TEffectiveAntdResultWrapperProps = {
3
+ effectiveReqIndexes: number[];
4
+ itemsPath?: string | string[];
5
+ children: ReactNode;
6
+ };
7
+ export declare const EffectiveAntdResultWrapper: FC<TEffectiveAntdResultWrapperProps>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export { EffectiveAntdResultWrapper } from './EffectiveAntdResultWrapper';
@@ -18,6 +18,10 @@ export type TFactoryDataK8s<T extends TItemTypeMap> = {
18
18
  key: string;
19
19
  urlsToFetch: (string | TUseK8sSmartResourceParams<any>)[];
20
20
  withScrollableMainContentCard?: boolean;
21
+ effectiveReqIndexes?: number[];
22
+ /** Per-request itemsPath for effectiveReqIndexes empty-check.
23
+ * String → same path for all; string[] → positional mapping per reqIndex. */
24
+ effectiveItemsPath?: string | string[];
21
25
  data: TRenderableItem<T>[];
22
26
  forcedSidebarId?: string;
23
27
  sidebarTags?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prorobotech/openapi-k8s-toolkit",
3
- "version": "1.4.0-alpha.34",
3
+ "version": "1.4.0-alpha.36",
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",