@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.9 → 1.2.0-alpha.10

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.
Files changed (95) hide show
  1. package/README.md +119 -0
  2. package/dist/openapi-k8s-toolkit.es.js +13172 -12249
  3. package/dist/openapi-k8s-toolkit.es.js.map +1 -1
  4. package/dist/openapi-k8s-toolkit.umd.js +13182 -12246
  5. package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
  6. package/dist/types/api/bff/scopes/checkScopes.d.ts +6 -6
  7. package/dist/types/api/bff/scopes/filterScopes.d.ts +4 -4
  8. package/dist/types/api/bff/search/getKinds.d.ts +2 -2
  9. package/dist/types/api/bff/swagger/getSwagger.d.ts +2 -2
  10. package/dist/types/api/forms.d.ts +4 -0
  11. package/dist/types/api/getApiResource.d.ts +8 -8
  12. package/dist/types/api/getApiResourceTypes.d.ts +4 -4
  13. package/dist/types/api/getBuiltinResource.d.ts +8 -8
  14. package/dist/types/api/getBuiltinResourceTypes.d.ts +2 -2
  15. package/dist/types/api/getCrdData.d.ts +2 -2
  16. package/dist/types/api/getCrdResource.d.ts +5 -5
  17. package/dist/types/api/permissions.d.ts +4 -4
  18. package/dist/types/components/molecules/BlackholeForm/index.d.ts +0 -1
  19. package/dist/types/components/molecules/BlackholeForm/molecules/index.d.ts +0 -1
  20. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/BlackholeForm.d.ts +3 -3
  21. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeFormProvider/BlackholeFormProvider.d.ts +3 -3
  22. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/EnrichedTable.d.ts +2 -1
  23. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/types.d.ts +2 -2
  24. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.d.ts +4 -2
  25. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/EnrichedTableProvider.d.ts +2 -2
  26. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/utils.d.ts +1 -1
  27. package/dist/types/components/molecules/Events/Events.d.ts +2 -2
  28. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/ManageableSidebarProvider.d.ts +1 -0
  29. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/utils.d.ts +2 -1
  30. package/dist/types/components/molecules/MarketPlace/MarketPlace.d.ts +3 -3
  31. package/dist/types/components/molecules/MarketPlace/molecules/AddEditFormModal/AddEditFormModal.d.ts +3 -3
  32. package/dist/types/components/molecules/MarketPlace/molecules/MarketplaceCard/MarketplaceCard.d.ts +1 -1
  33. package/dist/types/components/molecules/MarketPlace/molecules/MarketplaceCard/utils.d.ts +9 -9
  34. package/dist/types/components/molecules/ProjectInfoCard/ProjectInfoCard.d.ts +3 -3
  35. package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/YamlEditorSingleton.d.ts +2 -2
  36. package/dist/types/components/molecules/index.d.ts +2 -1
  37. package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/ConverterBytes.d.ts +13 -0
  38. package/dist/types/components/organisms/DynamicComponents/molecules/ConverterCores/ConverterCores.d.ts +19 -0
  39. package/dist/types/components/organisms/DynamicComponents/molecules/ConverterCores/index.d.ts +1 -0
  40. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/RefsList.d.ts +3 -2
  41. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/molecules/RefElement/RefElement.d.ts +1 -0
  42. package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/MemoryChart.d.ts +6 -0
  43. package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/MemoryChartMulti.d.ts +6 -0
  44. package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/usePrometheusQueryRange.d.ts +7 -0
  45. package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/usePrometheusQueryRangeMulti.d.ts +7 -0
  46. package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/prometheus.d.ts +10 -0
  47. package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/prometheus.test.d.ts +1 -0
  48. package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/prometheusAdapter.d.ts +21 -0
  49. package/dist/types/components/organisms/DynamicComponents/molecules/Toggler/Toggler.d.ts +6 -0
  50. package/dist/types/components/organisms/DynamicComponents/molecules/Toggler/index.d.ts +1 -0
  51. package/dist/types/components/organisms/DynamicComponents/molecules/TogglerSegmented/TogglerSegmented.d.ts +6 -0
  52. package/dist/types/components/organisms/DynamicComponents/molecules/TogglerSegmented/index.d.ts +1 -0
  53. package/dist/types/components/organisms/DynamicComponents/molecules/index.d.ts +3 -0
  54. package/dist/types/components/organisms/DynamicComponents/molecules/utils.d.ts +2 -1
  55. package/dist/types/components/organisms/DynamicComponents/molecules/utils.test.d.ts +1 -0
  56. package/dist/types/components/organisms/DynamicComponents/types.d.ts +89 -20
  57. package/dist/types/hooks/useApiResource.d.ts +8 -8
  58. package/dist/types/hooks/useApisResourceTypes.d.ts +4 -4
  59. package/dist/types/hooks/useBuiltinResource.d.ts +8 -8
  60. package/dist/types/hooks/useBuiltinResourceTypes.d.ts +2 -2
  61. package/dist/types/hooks/useCrdData.d.ts +2 -2
  62. package/dist/types/hooks/useCrdResource.d.ts +5 -5
  63. package/dist/types/hooks/useK8sSmartResource/index.d.ts +4 -0
  64. package/dist/types/hooks/useK8sSmartResource/useK8sSmartResource.d.ts +29 -0
  65. package/dist/types/hooks/{useK8sSmartResource.d.ts → useK8sSmartResource/useK8sSmartResourceWithoutKinds.d.ts} +5 -4
  66. package/dist/types/hooks/useK8sSmartResource/useManyK8sSmartResource.d.ts +18 -0
  67. package/dist/types/hooks/useK8sSmartResource/useSmartResourceParams.d.ts +9 -0
  68. package/dist/types/hooks/useListThenWatch/useListWatch.d.ts +1 -0
  69. package/dist/types/hooks/usePermissions.d.ts +4 -4
  70. package/dist/types/hooks/useResourceScope/index.d.ts +1 -0
  71. package/dist/types/hooks/useResourceScope/useResourceScope.d.ts +12 -0
  72. package/dist/types/index.d.ts +2 -1
  73. package/dist/types/localTypes/bff/form.d.ts +5 -5
  74. package/dist/types/localTypes/bff/scopes.d.ts +6 -6
  75. package/dist/types/localTypes/bff/table.d.ts +4 -3
  76. package/dist/types/localTypes/factories/converterBytes.d.ts +10 -0
  77. package/dist/types/localTypes/factories/converterCores.d.ts +7 -0
  78. package/dist/types/localTypes/form.d.ts +2 -2
  79. package/dist/types/localTypes/marketplace.d.ts +1 -1
  80. package/dist/types/localTypes/navigations.d.ts +3 -0
  81. package/dist/types/localTypes/richTable.d.ts +4 -0
  82. package/dist/types/utils/converterBytes/converterBytes.d.ts +32 -0
  83. package/dist/types/utils/converterBytes/converterBytes.test.d.ts +1 -0
  84. package/dist/types/utils/converterBytes/index.d.ts +1 -0
  85. package/dist/types/utils/converterCores/converterCores.d.ts +45 -0
  86. package/dist/types/utils/converterCores/converterCores.test.d.ts +1 -0
  87. package/dist/types/utils/converterCores/index.d.ts +1 -0
  88. package/dist/types/utils/getGroupsByCategory/getGroupsByCategory.d.ts +2 -2
  89. package/dist/types/utils/index.d.ts +2 -0
  90. package/dist/types/utils/tableLocations/tableLocations.d.ts +5 -5
  91. package/package.json +2 -1
  92. package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/types.d.ts +0 -10
  93. package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/utils.d.ts +0 -15
  94. /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/index.d.ts +0 -0
  95. /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/styled.d.ts +0 -0
@@ -0,0 +1,7 @@
1
+ export type TCoreCanonicalUnit = 'core' | 'mcore' | 'ucore' | 'ncore';
2
+ export type TCoreUnitInput = string | TCoreCanonicalUnit;
3
+ export type TCoreConvertOptions = {
4
+ format?: boolean;
5
+ precision?: number;
6
+ locale?: string;
7
+ };
@@ -19,8 +19,8 @@ export type TPersistedControls = {
19
19
  persistedKeys: TFormName[];
20
20
  };
21
21
  export type TUrlParams = {
22
- clusterName?: string;
22
+ cluster?: string;
23
23
  namespace?: string;
24
24
  syntheticProject?: string;
25
- entryName?: string;
25
+ name?: string;
26
26
  };
@@ -5,7 +5,7 @@ export type TMarketPlacePanel = {
5
5
  type: 'crd' | 'nonCrd' | 'built-in' | 'direct';
6
6
  apiGroup?: string;
7
7
  apiVersion?: string;
8
- typeName?: string;
8
+ plural?: string;
9
9
  pathToNav?: string;
10
10
  tags: string[];
11
11
  disabled?: boolean;
@@ -9,15 +9,18 @@ export type TNavigationResource = unknown & {
9
9
  projects?: {
10
10
  clear: string;
11
11
  change: string;
12
+ aliasPath?: string;
12
13
  };
13
14
  instances?: {
14
15
  clear: string;
15
16
  change: string;
16
17
  mapOptionsPattern?: string;
18
+ aliasPath?: string;
17
19
  };
18
20
  namespaces?: {
19
21
  clear: string;
20
22
  change: string;
23
+ aliasPath?: string;
21
24
  };
22
25
  baseFactoriesMapping?: Record<string, string>;
23
26
  };
@@ -20,3 +20,7 @@ export type TAdditionalPrinterColumnsKeyTypeProps = Record<string, {
20
20
  type: string;
21
21
  customProps?: unknown;
22
22
  }>;
23
+ export type TAdditionalPrinterColumnsCustomSortersAndFilters = {
24
+ key: string;
25
+ type: string;
26
+ }[];
@@ -0,0 +1,32 @@
1
+ import { TUnitInput, TConvertOptions } from '../../localTypes/factories/converterBytes';
2
+ /**
3
+ * Convert bytes -> target unit.
4
+ * @returns number by default (e.g., 1.5), or "1.50 GiB" if format=true
5
+ */
6
+ export declare const convertBytes: (bytes: number, unit: TUnitInput, opts?: TConvertOptions) => number | string;
7
+ /**
8
+ * Optional helper: auto-scale bytes to the "best" unit in SI or IEC.
9
+ * standard: "si" (powers of 1000) or "iec" (powers of 1024). Default "si".
10
+ */
11
+ export declare const formatBytesAuto: (bytes: number, options?: {
12
+ standard?: 'si' | 'iec';
13
+ precision?: number;
14
+ locale?: string;
15
+ }) => string;
16
+ /** Internal helper: convert value in given unit -> bytes (number) */
17
+ export declare const toBytes: (value: number, from: TUnitInput) => number;
18
+ /**
19
+ * Generic helper: convert value in some unit -> target unit.
20
+ * Uses bytes as intermediate.
21
+ */
22
+ export declare const convertStorage: (value: number, from: TUnitInput, to: TUnitInput, opts?: TConvertOptions) => number | string;
23
+ /**
24
+ * Try to parse a string like:
25
+ * "12312312Ki"
26
+ * " 12.5 GiB"
27
+ * "1000" (no unit -> unit undefined)
28
+ */
29
+ export declare const parseValueWithUnit: (input: string) => {
30
+ value: number;
31
+ unit?: TUnitInput | undefined;
32
+ } | null;
@@ -0,0 +1 @@
1
+ export { convertBytes, formatBytesAuto, toBytes, convertStorage, parseValueWithUnit } from './converterBytes';
@@ -0,0 +1,45 @@
1
+ import type { TCoreUnitInput, TCoreConvertOptions } from '../../localTypes/factories/converterCores';
2
+ /**
3
+ * Convert cores -> target unit (core/mcore/ucore/ncore).
4
+ * The input `cores` is ALWAYS in **cores** (base unit).
5
+ *
6
+ * @returns number by default (e.g., 0.5 -> 500 when unit="mcore"),
7
+ * or "500 mcore" if format=true
8
+ */
9
+ export declare const convertCores: (cores: number, unit: TCoreUnitInput, opts?: TCoreConvertOptions) => number | string;
10
+ /**
11
+ * Auto-scale cores across core/mcore/ucore/ncore.
12
+ *
13
+ * - cores >= 1 -> core
14
+ * - 1e-3 <= cores < 1 -> mcore
15
+ * - 1e-6 <= cores < 1e-3 -> ucore
16
+ * - cores < 1e-6 -> ncore
17
+ */
18
+ export declare const formatCoresAuto: (cores: number, options?: {
19
+ precision?: number;
20
+ locale?: string;
21
+ }) => string;
22
+ /** Internal helper: convert value in given unit -> cores (number). */
23
+ export declare const toCores: (value: number, from: TCoreUnitInput) => number;
24
+ /**
25
+ * Generic helper: convert value in some unit -> target unit.
26
+ * Uses cores as intermediate.
27
+ *
28
+ * Examples:
29
+ * convertCompute(500, "m", "core") // 0.5
30
+ * convertCompute(2, "core", "m", {format: true}) // "2,000 mcore" (or locale variant)
31
+ * convertCompute(1_000_000, "n", "core") // 0.001
32
+ */
33
+ export declare const convertCompute: (value: number, from: TCoreUnitInput, to: TCoreUnitInput, opts?: TCoreConvertOptions) => number | string;
34
+ /**
35
+ * Try to parse a string like:
36
+ * "500m"
37
+ * " 0.5 core"
38
+ * "2 vcpu"
39
+ * "1000000n"
40
+ * "1.5" (no unit -> unit undefined, treated as raw number-of-cores upstream)
41
+ */
42
+ export declare const parseCoresWithUnit: (input: string) => {
43
+ value: number;
44
+ unit?: string | undefined;
45
+ } | null;
@@ -0,0 +1 @@
1
+ export { convertCores, formatCoresAuto, toCores, convertCompute, parseCoresWithUnit } from './converterCores';
@@ -1,6 +1,6 @@
1
1
  import { TApiGroupList, TBuiltinResourceTypeList } from '../../localTypes/k8s';
2
- export declare const getGroupsByCategory: ({ clusterName, apiGroupListData, builtinResourceTypesData, namespace, noncrds, }: {
3
- clusterName: string;
2
+ export declare const getGroupsByCategory: ({ cluster, apiGroupListData, builtinResourceTypesData, namespace, noncrds, }: {
3
+ cluster: string;
4
4
  namespace?: string | undefined;
5
5
  apiGroupListData?: {
6
6
  apiVersion: string;
@@ -23,3 +23,5 @@ export { getLinkToBuiltinForm, getLinkToApiForm, getLinkToForm } from './tableLo
23
23
  export { isMultilineString, isMultilineFromYaml } from './isMultilineString';
24
24
  export { includesArray } from './nestedStringsArrayInclude';
25
25
  export { getResourceLink, getNamespaceLink } from './getResourceLink';
26
+ export { convertBytes, formatBytesAuto, toBytes, convertStorage, parseValueWithUnit } from './converterBytes';
27
+ export { convertCores, formatCoresAuto, toCores, convertCompute, parseCoresWithUnit } from './converterCores';
@@ -1,23 +1,23 @@
1
1
  export declare const getBackLinkToTable: ({ fullPath }: {
2
2
  fullPath: string;
3
3
  }) => string;
4
- export declare const getLinkToBuiltinForm: ({ cluster, baseprefix, namespace, syntheticProject, typeName, inside, fullPath, }: {
4
+ export declare const getLinkToBuiltinForm: ({ cluster, baseprefix, namespace, syntheticProject, plural, inside, fullPath, }: {
5
5
  cluster: string;
6
6
  baseprefix?: string | undefined;
7
7
  namespace?: string | undefined;
8
8
  syntheticProject?: string | undefined;
9
- typeName: string;
9
+ plural: string;
10
10
  inside?: boolean | undefined;
11
11
  fullPath: string;
12
12
  }) => string;
13
- export declare const getLinkToApiForm: ({ cluster, baseprefix, namespace, syntheticProject, apiGroup, apiVersion, typeName, inside, fullPath, }: {
13
+ export declare const getLinkToApiForm: ({ cluster, baseprefix, namespace, syntheticProject, apiGroup, apiVersion, plural, inside, fullPath, }: {
14
14
  cluster: string;
15
15
  baseprefix?: string | undefined;
16
16
  namespace?: string | undefined;
17
17
  syntheticProject?: string | undefined;
18
18
  apiGroup?: string | undefined;
19
19
  apiVersion?: string | undefined;
20
- typeName: string;
20
+ plural: string;
21
21
  inside?: boolean | undefined;
22
22
  fullPath: string;
23
23
  searchMount?: boolean | undefined;
@@ -29,7 +29,7 @@ export declare const getLinkToForm: ({ apiGroup, ...rest }: {
29
29
  syntheticProject?: string | undefined;
30
30
  apiGroup?: string | undefined;
31
31
  apiVersion?: string | undefined;
32
- typeName: string;
32
+ plural: string;
33
33
  inside?: boolean | undefined;
34
34
  fullPath: string;
35
35
  searchMount?: boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prorobotech/openapi-k8s-toolkit",
3
- "version": "1.1.0-alpha.9",
3
+ "version": "1.2.0-alpha.10",
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",
@@ -54,6 +54,7 @@
54
54
  "lodash": "4.17.21",
55
55
  "openapi-types": "12.1.3",
56
56
  "react-redux": "9.1.2",
57
+ "recharts": "3.5.1",
57
58
  "spoiled": "0.4.0",
58
59
  "styled-components": "6.0.7",
59
60
  "typescript": "4.9.5",
@@ -1,10 +0,0 @@
1
- export type TCanonicalUnit = 'B' | 'kB' | 'MB' | 'GB' | 'TB' | 'PB' | 'EB' | 'KiB' | 'MiB' | 'GiB' | 'TiB' | 'PiB' | 'EiB';
2
- export type TUnitInput = TCanonicalUnit | 'k' | 'm' | 'g' | 't' | 'p' | 'e' | 'K' | 'M' | 'G' | 'T' | 'P' | 'E' | 'KB' | 'Mb' | 'MB' | 'Gb' | 'GB' | 'Tb' | 'TB' | 'Pb' | 'PB' | 'Eb' | 'EB' | 'Ki' | 'Mi' | 'Gi' | 'Ti' | 'Pi' | 'Ei' | 'KiB' | 'MiB' | 'GiB' | 'TiB' | 'PiB' | 'EiB';
3
- export type TConvertOptions = {
4
- /** If true, returns "12.3 GiB" instead of just 12.3 */
5
- format?: boolean;
6
- /** Max fraction digits when formatting (default 2) */
7
- precision?: number;
8
- /** Locale for number formatting (default: undefined => user agent) */
9
- locale?: string;
10
- };
@@ -1,15 +0,0 @@
1
- import { TUnitInput, TConvertOptions } from './types';
2
- /**
3
- * Convert bytes -> target unit.
4
- * @returns number by default (e.g., 1.5), or "1.50 GiB" if format=true
5
- */
6
- export declare const convertBytes: (bytes: number, unit: TUnitInput, opts?: TConvertOptions) => number | string;
7
- /**
8
- * Optional helper: auto-scale bytes to the "best" unit in SI or IEC.
9
- * standard: "si" (powers of 1000) or "iec" (powers of 1024). Default "si".
10
- */
11
- export declare const formatBytesAuto: (bytes: number, options?: {
12
- standard?: 'si' | 'iec';
13
- precision?: number;
14
- locale?: string;
15
- }) => string;