@k8slens/extensions 5.3.0-git.2d801478e1.0 → 5.3.0-git.30170163a6.0
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/__mocks__/electron.ts +0 -5
- package/dist/integration/helpers/utils.d.ts +1 -1
- package/dist/src/common/app-paths.d.ts +43 -0
- package/dist/src/common/catalog/catalog-entity.d.ts +4 -1
- package/dist/src/common/cluster-store.d.ts +0 -1
- package/dist/src/common/hotbar-store.d.ts +5 -0
- package/dist/src/common/hotbar-types.d.ts +1 -1
- package/dist/src/common/k8s-api/endpoints/nodes.api.d.ts +16 -32
- package/dist/src/common/k8s-api/endpoints/pods.api.d.ts +7 -6
- package/dist/src/common/k8s-api/endpoints/secret.api.d.ts +5 -6
- package/dist/src/common/k8s-api/endpoints/service.api.d.ts +1 -1
- package/dist/src/common/k8s-api/json-api.d.ts +2 -0
- package/dist/src/common/k8s-api/kube-api.d.ts +1 -1
- package/dist/src/common/routes/port-forwards.d.ts +1 -0
- package/dist/src/common/user-store/preferences-helpers.d.ts +8 -0
- package/dist/src/common/utils/__tests__/tuple.test.d.ts +21 -0
- package/dist/src/common/utils/{getPath.d.ts → array.d.ts} +4 -5
- package/dist/src/common/utils/index.d.ts +7 -5
- package/dist/src/common/utils/iter.d.ts +23 -9
- package/dist/src/common/utils/objects.d.ts +27 -0
- package/dist/src/common/utils/sort-compare.d.ts +50 -0
- package/dist/src/common/utils/tuple.d.ts +40 -0
- package/dist/src/extensions/extension-api.js +181 -1669
- package/dist/src/main/helm/helm-chart-manager.d.ts +5 -0
- package/dist/src/main/helm/helm-repo-manager.d.ts +1 -0
- package/dist/src/main/kube-auth-proxy.d.ts +1 -0
- package/dist/src/main/kubectl.d.ts +1 -1
- package/dist/src/renderer/bootstrap.d.ts +1 -1
- package/dist/src/renderer/components/+add-cluster/add-cluster.d.ts +1 -1
- package/dist/src/renderer/components/+apps-releases/release-menu.d.ts +3 -3
- package/dist/src/renderer/components/+catalog/catalog-entity-details.d.ts +0 -1
- package/dist/src/renderer/components/+catalog/catalog-entity-drawer-menu.d.ts +0 -1
- package/dist/src/renderer/components/+catalog/catalog.d.ts +2 -0
- package/dist/src/renderer/components/+catalog/hotbar-toggle-menu-item.d.ts +27 -0
- package/dist/src/renderer/components/+cluster/cluster-issues.d.ts +0 -1
- package/dist/src/renderer/components/+cluster/cluster-metric-switchers.d.ts +0 -1
- package/dist/src/renderer/components/+cluster/cluster-metrics.d.ts +0 -1
- package/dist/src/renderer/components/+cluster/cluster-overview.d.ts +0 -1
- package/dist/src/renderer/components/+cluster/cluster-pie-charts.d.ts +0 -1
- package/dist/src/renderer/components/+config-secrets/__tests__/secret-details.test.d.ts +21 -0
- package/dist/src/renderer/components/+config-secrets/secret-details.d.ts +4 -3
- package/dist/src/renderer/components/+namespaces/namespace-select-filter.d.ts +3 -0
- package/dist/src/renderer/components/+namespaces/namespace.store.d.ts +55 -2
- package/dist/src/renderer/components/+network-port-forwards/port-forward-details.d.ts +33 -0
- package/dist/src/renderer/components/+network-port-forwards/port-forward-menu.d.ts +1 -1
- package/dist/src/renderer/components/+network-port-forwards/port-forwards.d.ts +10 -1
- package/dist/src/renderer/components/+network-services/service-port-component.d.ts +0 -1
- package/dist/src/renderer/components/+workloads-pods/pod-container-port.d.ts +0 -1
- package/dist/src/renderer/components/+workloads-pods/pod-details-list.d.ts +0 -3
- package/dist/src/renderer/components/dock/create-resource.store.d.ts +3 -3
- package/dist/src/renderer/components/dock/log-list.d.ts +1 -1
- package/dist/src/renderer/components/dock/terminal.d.ts +1 -1
- package/dist/src/renderer/components/drawer/drawer.d.ts +1 -1
- package/dist/src/renderer/components/error-boundary/error-boundary.d.ts +13 -3
- package/dist/src/renderer/components/hotbar/hotbar-entity-icon.d.ts +0 -2
- package/dist/src/renderer/components/input/input.d.ts +1 -1
- package/dist/src/renderer/components/input/search-input-url.d.ts +1 -1
- package/dist/src/renderer/components/layout/sidebar-storage.d.ts +1 -0
- package/dist/src/renderer/components/layout/sidebar.d.ts +3 -1
- package/dist/src/renderer/components/resizing-anchor/resizing-anchor.d.ts +1 -1
- package/dist/src/renderer/components/switch/switcher.d.ts +1 -1
- package/dist/src/renderer/components/table/__tests__/getSorted.test.d.ts +21 -0
- package/dist/src/renderer/components/table/sorting.d.ts +22 -0
- package/dist/src/renderer/components/table/table.d.ts +20 -3
- package/dist/src/renderer/components/virtual-list/virtual-list.d.ts +7 -1
- package/dist/src/renderer/port-forward/index.d.ts +1 -0
- package/dist/src/renderer/port-forward/port-forward-dialog.d.ts +0 -1
- package/dist/src/renderer/port-forward/port-forward-item.d.ts +4 -0
- package/dist/src/renderer/port-forward/port-forward-utils.d.ts +24 -0
- package/dist/src/renderer/port-forward/port-forward.store.d.ts +1 -1
- package/dist/src/renderer/utils/__tests__/converted-name.test.d.ts +21 -0
- package/dist/src/renderer/utils/createStorage.d.ts +2 -3
- package/dist/src/renderer/utils/index.d.ts +9 -10
- package/dist/src/renderer/utils/name-parts.d.ts +27 -0
- package/dist/src/renderer/utils/storageHelper.d.ts +1 -0
- package/package.json +1 -1
package/__mocks__/electron.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="jest" />
|
|
3
3
|
import { ElectronApplication, Frame, Page } from "playwright";
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const appPaths: Partial<Record<NodeJS.Platform, string>>;
|
|
5
5
|
export declare function itIf(condition: boolean): jest.It;
|
|
6
6
|
export declare function describeIf(condition: boolean): jest.Describe;
|
|
7
7
|
export declare function start(): Promise<{
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 OpenLens Authors
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
6
|
+
* the Software without restriction, including without limitation the rights to
|
|
7
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
* subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
* copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
17
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
18
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
import { app } from "electron";
|
|
22
|
+
export declare type PathName = Parameters<typeof app["getPath"]>[0];
|
|
23
|
+
export declare class AppPaths {
|
|
24
|
+
private static paths;
|
|
25
|
+
private static readonly ipcChannel;
|
|
26
|
+
/**
|
|
27
|
+
* Initializes the local copy of the paths from electron.
|
|
28
|
+
*/
|
|
29
|
+
static init(): Promise<void>;
|
|
30
|
+
private static initMain;
|
|
31
|
+
private static initRenderer;
|
|
32
|
+
/**
|
|
33
|
+
* An alternative to `app.getPath()` for use in renderer and common.
|
|
34
|
+
* This function throws if called before initialization.
|
|
35
|
+
* @param name The name of the path field
|
|
36
|
+
*/
|
|
37
|
+
static get(name: PathName): string;
|
|
38
|
+
/**
|
|
39
|
+
* An async version of `AppPaths.get()` which waits for `AppPaths.init()` to
|
|
40
|
+
* be called before returning
|
|
41
|
+
*/
|
|
42
|
+
static getAsync(name: PathName): Promise<string>;
|
|
43
|
+
}
|
|
@@ -127,7 +127,10 @@ export interface CatalogEntitySettingsMenu {
|
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
export interface CatalogEntityContextMenuContext {
|
|
130
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Navigate to the specified pathname
|
|
132
|
+
*/
|
|
133
|
+
navigate: (pathname: string) => void;
|
|
131
134
|
menuItems: CatalogEntityContextMenu[];
|
|
132
135
|
}
|
|
133
136
|
export interface CatalogEntitySettingsContext {
|
|
@@ -27,7 +27,6 @@ export interface ClusterStoreModel {
|
|
|
27
27
|
export declare class ClusterStore extends BaseStore<ClusterStoreModel> {
|
|
28
28
|
private static StateChannel;
|
|
29
29
|
clusters: import("mobx").ObservableMap<string, Cluster>;
|
|
30
|
-
removedClusters: import("mobx").ObservableMap<string, Cluster>;
|
|
31
30
|
protected disposer: import("./utils").ExtendableDisposer;
|
|
32
31
|
constructor();
|
|
33
32
|
loadInitialOnRenderer(): Promise<void>;
|
|
@@ -55,4 +55,9 @@ export declare class HotbarStore extends BaseStore<HotbarStoreModel> {
|
|
|
55
55
|
restackItems(from: number, to: number): void;
|
|
56
56
|
switchToPrevious(): void;
|
|
57
57
|
switchToNext(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Checks if entity already pinned to hotbar
|
|
60
|
+
* @returns boolean
|
|
61
|
+
*/
|
|
62
|
+
isAddedToActive(entity: CatalogEntity): boolean;
|
|
58
63
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
19
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
*/
|
|
21
|
-
import
|
|
21
|
+
import { Tuple } from "./utils";
|
|
22
22
|
export interface HotbarItem {
|
|
23
23
|
entity: {
|
|
24
24
|
uid: string;
|
|
@@ -43,6 +43,14 @@ export interface NodeTaint {
|
|
|
43
43
|
timeAdded: string;
|
|
44
44
|
}
|
|
45
45
|
export declare function formatNodeTaint(taint: NodeTaint): string;
|
|
46
|
+
export interface NodeCondition {
|
|
47
|
+
type: string;
|
|
48
|
+
status: string;
|
|
49
|
+
lastHeartbeatTime?: string;
|
|
50
|
+
lastTransitionTime?: string;
|
|
51
|
+
reason?: string;
|
|
52
|
+
message?: string;
|
|
53
|
+
}
|
|
46
54
|
export interface Node {
|
|
47
55
|
spec: {
|
|
48
56
|
podCIDR?: string;
|
|
@@ -72,14 +80,7 @@ export interface Node {
|
|
|
72
80
|
memory: string;
|
|
73
81
|
pods: string;
|
|
74
82
|
};
|
|
75
|
-
conditions?:
|
|
76
|
-
type: string;
|
|
77
|
-
status: string;
|
|
78
|
-
lastHeartbeatTime?: string;
|
|
79
|
-
lastTransitionTime?: string;
|
|
80
|
-
reason?: string;
|
|
81
|
-
message?: string;
|
|
82
|
-
}[];
|
|
83
|
+
conditions?: NodeCondition[];
|
|
83
84
|
addresses?: {
|
|
84
85
|
type: string;
|
|
85
86
|
address: string;
|
|
@@ -117,35 +118,18 @@ export declare class Node extends KubeObject {
|
|
|
117
118
|
static namespaced: boolean;
|
|
118
119
|
static apiBase: string;
|
|
119
120
|
constructor(data: KubeJsonApiData);
|
|
121
|
+
/**
|
|
122
|
+
* Returns the concatination of all current condition types which have a status
|
|
123
|
+
* of `"True"`
|
|
124
|
+
*/
|
|
120
125
|
getNodeConditionText(): string;
|
|
121
126
|
getTaints(): NodeTaint[];
|
|
122
127
|
getRoleLabels(): string;
|
|
123
128
|
getCpuCapacity(): number;
|
|
124
129
|
getMemoryCapacity(): number;
|
|
125
|
-
getConditions():
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
lastHeartbeatTime?: string;
|
|
129
|
-
lastTransitionTime?: string;
|
|
130
|
-
reason?: string;
|
|
131
|
-
message?: string;
|
|
132
|
-
}[];
|
|
133
|
-
getActiveConditions(): {
|
|
134
|
-
type: string;
|
|
135
|
-
status: string;
|
|
136
|
-
lastHeartbeatTime?: string;
|
|
137
|
-
lastTransitionTime?: string;
|
|
138
|
-
reason?: string;
|
|
139
|
-
message?: string;
|
|
140
|
-
}[];
|
|
141
|
-
getWarningConditions(): {
|
|
142
|
-
type: string;
|
|
143
|
-
status: string;
|
|
144
|
-
lastHeartbeatTime?: string;
|
|
145
|
-
lastTransitionTime?: string;
|
|
146
|
-
reason?: string;
|
|
147
|
-
message?: string;
|
|
148
|
-
}[];
|
|
130
|
+
getConditions(): NodeCondition[];
|
|
131
|
+
getActiveConditions(): NodeCondition[];
|
|
132
|
+
getWarningConditions(): NodeCondition[];
|
|
149
133
|
getKubeletVersion(): string;
|
|
150
134
|
getOperatingSystem(): string;
|
|
151
135
|
isUnschedulable(): boolean;
|
|
@@ -57,7 +57,7 @@ export declare enum PodStatus {
|
|
|
57
57
|
SUCCEEDED = "Succeeded",
|
|
58
58
|
EVICTED = "Evicted"
|
|
59
59
|
}
|
|
60
|
-
export interface IPodContainer {
|
|
60
|
+
export interface IPodContainer extends Partial<Record<PodContainerProbe, IContainerProbe>> {
|
|
61
61
|
name: string;
|
|
62
62
|
image: string;
|
|
63
63
|
command?: string[];
|
|
@@ -108,15 +108,16 @@ export interface IPodContainer {
|
|
|
108
108
|
readOnly: boolean;
|
|
109
109
|
mountPath: string;
|
|
110
110
|
}[];
|
|
111
|
-
livenessProbe?: IContainerProbe;
|
|
112
|
-
readinessProbe?: IContainerProbe;
|
|
113
|
-
startupProbe?: IContainerProbe;
|
|
114
111
|
imagePullPolicy: string;
|
|
115
112
|
}
|
|
113
|
+
export declare type PodContainerProbe = "livenessProbe" | "readinessProbe" | "startupProbe";
|
|
116
114
|
interface IContainerProbe {
|
|
117
115
|
httpGet?: {
|
|
118
116
|
path?: string;
|
|
119
|
-
|
|
117
|
+
/**
|
|
118
|
+
* either a port number or an IANA_SVC_NAME string referring to a port defined in the container
|
|
119
|
+
*/
|
|
120
|
+
port: number | string;
|
|
120
121
|
scheme: string;
|
|
121
122
|
host?: string;
|
|
122
123
|
};
|
|
@@ -303,7 +304,7 @@ export declare class Pod extends WorkloadKubeObject {
|
|
|
303
304
|
getLivenessProbe(container: IPodContainer): string[];
|
|
304
305
|
getReadinessProbe(container: IPodContainer): string[];
|
|
305
306
|
getStartupProbe(container: IPodContainer): string[];
|
|
306
|
-
getProbe
|
|
307
|
+
private getProbe;
|
|
307
308
|
getNodeName(): string;
|
|
308
309
|
getSelectedNodeOs(): string | undefined;
|
|
309
310
|
getIPs(): string[];
|
|
@@ -35,18 +35,17 @@ export interface ISecretRef {
|
|
|
35
35
|
key?: string;
|
|
36
36
|
name: string;
|
|
37
37
|
}
|
|
38
|
-
export interface
|
|
38
|
+
export interface SecretData extends KubeJsonApiData {
|
|
39
39
|
type: SecretType;
|
|
40
|
-
data
|
|
41
|
-
[prop: string]: string;
|
|
42
|
-
token?: string;
|
|
43
|
-
};
|
|
40
|
+
data?: Record<string, string>;
|
|
44
41
|
}
|
|
45
42
|
export declare class Secret extends KubeObject {
|
|
46
43
|
static kind: string;
|
|
47
44
|
static namespaced: boolean;
|
|
48
45
|
static apiBase: string;
|
|
49
|
-
|
|
46
|
+
type: SecretType;
|
|
47
|
+
data: Record<string, string>;
|
|
48
|
+
constructor(data: SecretData);
|
|
50
49
|
getKeys(): string[];
|
|
51
50
|
getToken(): string;
|
|
52
51
|
}
|
|
@@ -48,6 +48,7 @@ export interface JsonApiConfig {
|
|
|
48
48
|
apiBase: string;
|
|
49
49
|
serverAddress: string;
|
|
50
50
|
debug?: boolean;
|
|
51
|
+
getRequestOptions?: () => Promise<RequestInit>;
|
|
51
52
|
}
|
|
52
53
|
export declare class JsonApi<D = JsonApiData, P extends JsonApiParams = JsonApiParams> {
|
|
53
54
|
readonly config: JsonApiConfig;
|
|
@@ -57,6 +58,7 @@ export declare class JsonApi<D = JsonApiData, P extends JsonApiParams = JsonApiP
|
|
|
57
58
|
constructor(config: JsonApiConfig, reqInit?: RequestInit);
|
|
58
59
|
onData: EventEmitter<[D, Response]>;
|
|
59
60
|
onError: EventEmitter<[JsonApiErrorParsed, Response]>;
|
|
61
|
+
private getRequestOptions;
|
|
60
62
|
get<T = D>(path: string, params?: P, reqInit?: RequestInit): Promise<T>;
|
|
61
63
|
getResponse(path: string, params?: P, init?: RequestInit): Promise<Response>;
|
|
62
64
|
post<T = D>(path: string, params?: P, reqInit?: RequestInit): Promise<T>;
|
|
@@ -21,5 +21,6 @@
|
|
|
21
21
|
import type { RouteProps } from "react-router";
|
|
22
22
|
export declare const portForwardsRoute: RouteProps;
|
|
23
23
|
export interface PortForwardsRouteParams {
|
|
24
|
+
forwardport?: string;
|
|
24
25
|
}
|
|
25
26
|
export declare const portForwardsURL: ({ params, query, fragment }?: import("../utils/buildUrl").URLParams<PortForwardsRouteParams, {}>) => string;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
19
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
*/
|
|
21
|
+
/// <reference types="node" />
|
|
21
22
|
import { ObservableToggleSet } from "../utils";
|
|
22
23
|
import type { monaco } from "react-monaco-editor";
|
|
23
24
|
export interface KubeconfigSyncEntry extends KubeconfigSyncValue {
|
|
@@ -35,6 +36,13 @@ interface PreferenceDescription<T, R = T> {
|
|
|
35
36
|
fromStore(val: T | undefined): R;
|
|
36
37
|
toStore(val: R): T | undefined;
|
|
37
38
|
}
|
|
39
|
+
export interface DownloadMirror {
|
|
40
|
+
url: string;
|
|
41
|
+
label: string;
|
|
42
|
+
platforms: Set<NodeJS.Platform>;
|
|
43
|
+
}
|
|
44
|
+
export declare const defaultPackageMirror = "default";
|
|
45
|
+
export declare const packageMirrors: Map<string, DownloadMirror>;
|
|
38
46
|
declare type PreferencesModelType<field extends keyof typeof DESCRIPTORS> = typeof DESCRIPTORS[field] extends PreferenceDescription<infer T, any> ? T : never;
|
|
39
47
|
declare type UserStoreModelType<field extends keyof typeof DESCRIPTORS> = typeof DESCRIPTORS[field] extends PreferenceDescription<any, infer T> ? T : never;
|
|
40
48
|
export declare type UserStoreFlatModel = {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 OpenLens Authors
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
6
|
+
* the Software without restriction, including without limitation the rights to
|
|
7
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
* subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
* copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
17
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
18
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
19
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
*/
|
|
21
|
-
import { app } from "electron";
|
|
22
21
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
22
|
+
* A inference typed version of `Array(length).fill(value)`
|
|
23
|
+
* @param length The number of entries
|
|
24
|
+
* @param value The value of each of the indices
|
|
26
25
|
*/
|
|
27
|
-
export declare function
|
|
26
|
+
export declare function filled<T>(length: number, value: T): T[];
|
|
@@ -28,19 +28,21 @@ export * from "./base64";
|
|
|
28
28
|
export * from "./camelCase";
|
|
29
29
|
export * from "./cloneJson";
|
|
30
30
|
export * from "./cluster-id-url-parsing";
|
|
31
|
+
export * from "./convertCpu";
|
|
32
|
+
export * from "./convertMemory";
|
|
31
33
|
export * from "./debouncePromise";
|
|
32
34
|
export * from "./defineGlobal";
|
|
33
35
|
export * from "./delay";
|
|
34
36
|
export * from "./disposer";
|
|
35
37
|
export * from "./downloadFile";
|
|
36
|
-
export * from "./formatDuration";
|
|
37
38
|
export * from "./escapeRegExp";
|
|
38
39
|
export * from "./extended-map";
|
|
39
|
-
export * from "./
|
|
40
|
+
export * from "./formatDuration";
|
|
40
41
|
export * from "./getRandId";
|
|
41
42
|
export * from "./hash-set";
|
|
42
43
|
export * from "./local-kubeconfig";
|
|
43
44
|
export * from "./n-fircate";
|
|
45
|
+
export * from "./objects";
|
|
44
46
|
export * from "./openExternal";
|
|
45
47
|
export * from "./paths";
|
|
46
48
|
export * from "./reject-promise";
|
|
@@ -52,7 +54,7 @@ export * from "./toggle-set";
|
|
|
52
54
|
export * from "./toJS";
|
|
53
55
|
export * from "./type-narrowing";
|
|
54
56
|
export * from "./types";
|
|
55
|
-
export * from "./convertMemory";
|
|
56
|
-
export * from "./convertCpu";
|
|
57
57
|
import * as iter from "./iter";
|
|
58
|
-
|
|
58
|
+
import * as array from "./array";
|
|
59
|
+
import * as tuple from "./tuple";
|
|
60
|
+
export { iter, array, tuple, };
|
|
@@ -23,54 +23,54 @@ export declare type Falsey = false | 0 | "" | null | undefined;
|
|
|
23
23
|
* Create a new type safe empty Iterable
|
|
24
24
|
* @returns An `Iterable` that yields 0 items
|
|
25
25
|
*/
|
|
26
|
-
export declare function newEmpty<T>():
|
|
26
|
+
export declare function newEmpty<T>(): IterableIterator<T>;
|
|
27
27
|
/**
|
|
28
28
|
* Creates a new `Iterable` that yields at most n items from src.
|
|
29
29
|
* Does not modify `src` which can be used later.
|
|
30
30
|
* @param src An initial iterator
|
|
31
31
|
* @param n The maximum number of elements to take from src. Yields up to the floor of `n` and 0 items if n < 0
|
|
32
32
|
*/
|
|
33
|
-
export declare function take<T>(src: Iterable<T>, n: number):
|
|
33
|
+
export declare function take<T>(src: Iterable<T>, n: number): IterableIterator<T>;
|
|
34
34
|
/**
|
|
35
35
|
* Creates a new iterator that iterates (lazily) over its input and yields the
|
|
36
36
|
* result of `fn` for each item.
|
|
37
37
|
* @param src A type that can be iterated over
|
|
38
38
|
* @param fn The function that is called for each value
|
|
39
39
|
*/
|
|
40
|
-
export declare function map<T, U>(src: Iterable<T>, fn: (from: T) => U):
|
|
40
|
+
export declare function map<T, U>(src: Iterable<T>, fn: (from: T) => U): IterableIterator<U>;
|
|
41
41
|
/**
|
|
42
42
|
* The single layer flattening of an iterator, discarding `Falsey` values.
|
|
43
43
|
* @param src A type that can be iterated over
|
|
44
44
|
* @param fn The function that returns either an iterable over items that should be filtered out or a `Falsey` value indicating that it should be ignored
|
|
45
45
|
*/
|
|
46
|
-
export declare function filterFlatMap<T, U>(src: Iterable<T>, fn: (from: T) => Iterable<U | Falsey> | Falsey):
|
|
46
|
+
export declare function filterFlatMap<T, U>(src: Iterable<T>, fn: (from: T) => Iterable<U | Falsey> | Falsey): IterableIterator<U>;
|
|
47
47
|
/**
|
|
48
48
|
* Returns a new iterator that yields the items that each call to `fn` would produce
|
|
49
49
|
* @param src A type that can be iterated over
|
|
50
50
|
* @param fn A function that returns an iterator
|
|
51
51
|
*/
|
|
52
|
-
export declare function flatMap<T, U>(src: Iterable<T>, fn: (from: T) => Iterable<U>):
|
|
52
|
+
export declare function flatMap<T, U>(src: Iterable<T>, fn: (from: T) => Iterable<U>): IterableIterator<U>;
|
|
53
53
|
/**
|
|
54
54
|
* Creates a new iterator that iterates (lazily) over its input and yields the
|
|
55
55
|
* items that return a `truthy` value from `fn`.
|
|
56
56
|
* @param src A type that can be iterated over
|
|
57
57
|
* @param fn The function that is called for each value
|
|
58
58
|
*/
|
|
59
|
-
export declare function filter<T>(src: Iterable<T>, fn: (from: T) => any):
|
|
59
|
+
export declare function filter<T>(src: Iterable<T>, fn: (from: T) => any): IterableIterator<T>;
|
|
60
60
|
/**
|
|
61
61
|
* Creates a new iterator that iterates (lazily) over its input and yields the
|
|
62
62
|
* result of `fn` when it is `truthy`
|
|
63
63
|
* @param src A type that can be iterated over
|
|
64
64
|
* @param fn The function that is called for each value
|
|
65
65
|
*/
|
|
66
|
-
export declare function filterMap<T, U>(src: Iterable<T>, fn: (from: T) => U | Falsey):
|
|
66
|
+
export declare function filterMap<T, U>(src: Iterable<T>, fn: (from: T) => U | Falsey): IterableIterator<U>;
|
|
67
67
|
/**
|
|
68
68
|
* Creates a new iterator that iterates (lazily) over its input and yields the
|
|
69
69
|
* result of `fn` when it is not null or undefined
|
|
70
70
|
* @param src A type that can be iterated over
|
|
71
71
|
* @param fn The function that is called for each value
|
|
72
72
|
*/
|
|
73
|
-
export declare function filterMapStrict<T, U>(src: Iterable<T>, fn: (from: T) => U | null | undefined):
|
|
73
|
+
export declare function filterMapStrict<T, U>(src: Iterable<T>, fn: (from: T) => U | null | undefined): IterableIterator<U>;
|
|
74
74
|
/**
|
|
75
75
|
* Iterate through `src` until `match` returns a truthy value
|
|
76
76
|
* @param src A type that can be iterated over
|
|
@@ -85,4 +85,18 @@ export declare function find<T>(src: Iterable<T>, match: (i: T) => any): T | und
|
|
|
85
85
|
* @param reducer A function for producing the next item from an accumilation and the current item
|
|
86
86
|
* @param initial The initial value for the iteration
|
|
87
87
|
*/
|
|
88
|
-
export declare function reduce<T, R
|
|
88
|
+
export declare function reduce<T, R extends Iterable<any>>(src: Iterable<T>, reducer: (acc: R, cur: T) => R, initial: R): R;
|
|
89
|
+
/**
|
|
90
|
+
* A convenience function for reducing over an iterator of strings and concatenating them together
|
|
91
|
+
* @param src The value to iterate over
|
|
92
|
+
* @param connector The string value to intersperse between the yielded values
|
|
93
|
+
* @returns The concatenated entries of `src` interspersed with copies of `connector`
|
|
94
|
+
*/
|
|
95
|
+
export declare function join(src: Iterable<string>, connector?: string): string;
|
|
96
|
+
/**
|
|
97
|
+
* Iterate through `src` and return `true` if `fn` returns a thruthy value for every yielded value.
|
|
98
|
+
* Otherwise, return `false`. This function short circuits.
|
|
99
|
+
* @param src The type to be iterated over
|
|
100
|
+
* @param fn A function to check each iteration
|
|
101
|
+
*/
|
|
102
|
+
export declare function every<T>(src: Iterable<T>, fn: (val: T) => any): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 OpenLens Authors
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
6
|
+
* the Software without restriction, including without limitation the rights to
|
|
7
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
* subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
* copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
17
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
18
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* A better typed version of `Object.fromEntries` where the keys are known to
|
|
23
|
+
* be a specific subset
|
|
24
|
+
*/
|
|
25
|
+
export declare function fromEntries<T, Key extends string>(entries: Iterable<readonly [Key, T]>): {
|
|
26
|
+
[k in Key]: T;
|
|
27
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 OpenLens Authors
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
6
|
+
* the Software without restriction, including without limitation the rights to
|
|
7
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
* subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
* copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
17
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
18
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
import { SemVer } from "semver";
|
|
22
|
+
import type { RawHelmChart } from "../k8s-api/endpoints/helm-charts.api";
|
|
23
|
+
export declare enum Ordering {
|
|
24
|
+
LESS = -1,
|
|
25
|
+
EQUAL = 0,
|
|
26
|
+
GREATER = 1
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This function switches the direction of `ordering` if `direction` is `"desc"`
|
|
30
|
+
* @param ordering The original ordering (assumed to be an "asc" ordering)
|
|
31
|
+
* @param direction The new desired direction
|
|
32
|
+
*/
|
|
33
|
+
export declare function rectifyOrdering(ordering: Ordering, direction: "asc" | "desc"): Ordering;
|
|
34
|
+
/**
|
|
35
|
+
* An ascending sorting function
|
|
36
|
+
* @param left An item from an array
|
|
37
|
+
* @param right An item from an array
|
|
38
|
+
* @returns The relative ordering in an ascending manner.
|
|
39
|
+
* - Less if left < right
|
|
40
|
+
* - Equal if left == right
|
|
41
|
+
* - Greater if left > right
|
|
42
|
+
*/
|
|
43
|
+
export declare function sortCompare<T>(left: T, right: T): Ordering;
|
|
44
|
+
interface ChartVersion {
|
|
45
|
+
version: string;
|
|
46
|
+
__version?: SemVer;
|
|
47
|
+
}
|
|
48
|
+
export declare function sortCompareChartVersions(left: ChartVersion, right: ChartVersion): Ordering;
|
|
49
|
+
export declare function sortCharts(charts: RawHelmChart[]): RawHelmChart[];
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 OpenLens Authors
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
6
|
+
* the Software without restriction, including without limitation the rights to
|
|
7
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
* subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
* copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
17
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
18
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* A strict N-tuple of type T
|
|
23
|
+
*/
|
|
24
|
+
export declare type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
|
|
25
|
+
declare type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _TupleOf<T, N, [T, ...R]>;
|
|
26
|
+
/**
|
|
27
|
+
* Iterates over `sources` yielding full tuples until one of the tuple arrays
|
|
28
|
+
* is empty. Then it returns a tuple with the rest of each of tuples
|
|
29
|
+
* @param sources The source arrays
|
|
30
|
+
* @yields A tuple of the next element from each of the sources
|
|
31
|
+
* @returns The tuple of all the sources as soon as at least one of the sources is exausted
|
|
32
|
+
*/
|
|
33
|
+
export declare function zip<T, N extends number>(...sources: Tuple<T[], N>): Iterator<Tuple<T, N>, Tuple<T[], N>>;
|
|
34
|
+
/**
|
|
35
|
+
* Returns a `length` tuple filled with copies of `value`
|
|
36
|
+
* @param length The size of the tuple
|
|
37
|
+
* @param value The value for each of the tuple entries
|
|
38
|
+
*/
|
|
39
|
+
export declare function filled<T, L extends number>(length: L, value: T): Tuple<T, L>;
|
|
40
|
+
export {};
|