@k8slens/extensions 5.3.0-git.81b972a2d0.0 → 5.3.0-git.820b2d1b7a.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.
Files changed (65) hide show
  1. package/dist/src/common/{utils/makeCss.d.ts → __tests__/base-store.test.d.ts} +1 -9
  2. package/dist/src/common/base-store.d.ts +3 -2
  3. package/dist/src/common/cluster-store.d.ts +2 -3
  4. package/dist/src/common/cluster-types.d.ts +7 -1
  5. package/dist/src/common/hotbar-store.d.ts +1 -0
  6. package/dist/src/common/k8s-api/endpoints/ingress.api.d.ts +10 -7
  7. package/dist/src/common/k8s-api/endpoints/job.api.d.ts +0 -1
  8. package/dist/src/common/k8s-api/kube-api.d.ts +12 -3
  9. package/dist/src/common/k8s-api/kube-object.d.ts +9 -1
  10. package/dist/src/common/k8s-api/kube-object.store.d.ts +25 -7
  11. package/dist/src/common/k8s-api/kube-watch-api.d.ts +29 -8
  12. package/dist/src/common/user-store/user-store.d.ts +1 -0
  13. package/dist/src/common/utils/paths.d.ts +1 -0
  14. package/dist/src/common/weblink-store.d.ts +1 -0
  15. package/dist/src/extensions/extension-api.js +219 -184
  16. package/dist/src/extensions/extension-store.d.ts +1 -0
  17. package/dist/src/extensions/extensions-store.d.ts +1 -0
  18. package/dist/src/extensions/main-api/k8s-api.d.ts +1 -1
  19. package/dist/src/extensions/registries/workloads-overview-detail-registry.d.ts +6 -3
  20. package/dist/src/extensions/renderer-api/k8s-api.d.ts +1 -1
  21. package/dist/src/main/catalog/catalog-entity-registry.d.ts +2 -2
  22. package/dist/src/main/cluster-manager.d.ts +2 -0
  23. package/dist/src/main/cluster.d.ts +5 -10
  24. package/dist/src/main/context-handler.d.ts +8 -5
  25. package/dist/src/main/extension-filesystem.d.ts +1 -0
  26. package/dist/src/main/kube-auth-proxy.d.ts +1 -8
  27. package/dist/src/main/lens-proxy.d.ts +1 -1
  28. package/dist/src/main/prometheus/helm.d.ts +1 -1
  29. package/dist/src/main/prometheus/lens.d.ts +1 -1
  30. package/dist/src/main/prometheus/operator.d.ts +1 -1
  31. package/dist/src/main/prometheus/provider-registry.d.ts +2 -1
  32. package/dist/src/main/prometheus/stacklight.d.ts +1 -1
  33. package/dist/src/main/proxy-functions/kube-api-request.d.ts +1 -1
  34. package/dist/src/main/proxy-functions/types.d.ts +2 -0
  35. package/dist/src/main/shell-session/node-shell-session.d.ts +2 -2
  36. package/dist/src/main/shell-session/shell-session.d.ts +8 -3
  37. package/dist/src/main/utils/shell-env.d.ts +1 -3
  38. package/dist/src/renderer/api/terminal-api.d.ts +29 -15
  39. package/dist/src/renderer/api/websocket-api.d.ts +55 -32
  40. package/dist/src/renderer/bootstrap.d.ts +1 -1
  41. package/dist/src/renderer/{components/app.d.ts → cluster-frame.d.ts} +6 -4
  42. package/dist/src/renderer/components/+catalog/catalog.d.ts +0 -1
  43. package/dist/src/renderer/components/+user-management/{select-options.d.ts → +cluster-role-bindings/__tests__/dialog.test.d.ts} +1 -7
  44. package/dist/src/renderer/components/+user-management/+cluster-role-bindings/dialog.d.ts +2 -3
  45. package/dist/src/renderer/components/+user-management/+role-bindings/__tests__/dialog.test.d.ts +21 -0
  46. package/dist/src/renderer/components/+user-management/+role-bindings/dialog.d.ts +2 -3
  47. package/dist/src/renderer/components/+workloads-daemonsets/daemonsets.d.ts +0 -1
  48. package/dist/src/renderer/components/+workloads-overview/overview.d.ts +3 -0
  49. package/dist/src/renderer/components/badge/badge.d.ts +1 -0
  50. package/dist/src/renderer/components/cluster-manager/cluster-status.d.ts +6 -7
  51. package/dist/src/renderer/components/cluster-manager/lens-views.d.ts +12 -8
  52. package/dist/src/renderer/components/cluster-settings/components/__tests__/cluster-local-terminal-settings.test.d.ts +21 -0
  53. package/dist/src/renderer/components/cluster-settings/components/{cluster-home-dir-setting.d.ts → cluster-local-terminal-settings.d.ts} +1 -12
  54. package/dist/src/renderer/components/cluster-settings/components/index.d.ts +1 -1
  55. package/dist/src/renderer/components/dialog/dialog.d.ts +1 -0
  56. package/dist/src/renderer/components/dock/edit-resource.d.ts +1 -1
  57. package/dist/src/renderer/components/dock/terminal.d.ts +7 -11
  58. package/dist/src/renderer/components/item-object-list/item-list-layout.d.ts +6 -0
  59. package/dist/src/renderer/components/kube-object-list-layout/kube-object-list-layout.d.ts +4 -0
  60. package/dist/src/renderer/components/layout/sidebar.d.ts +1 -1
  61. package/dist/src/renderer/components/switch/switcher.d.ts +1 -1
  62. package/dist/src/renderer/components/table/table-cell.d.ts +1 -0
  63. package/dist/src/renderer/initializers/kube-object-detail-registry.d.ts +1 -1
  64. package/dist/src/renderer/{lens-app.d.ts → root-frame.d.ts} +4 -1
  65. package/package.json +1 -1
@@ -18,12 +18,4 @@
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
- /**
22
- * Function expands generic CSS Modules literal types and adds dictionary with arbitrary
23
- * indexes.
24
- * @param styles Styles imported from CSS Module having only literal types
25
- * @returns Passed style list with expanded typescript types
26
- */
27
- export declare function makeCss<T>(styles: T): T & {
28
- [key: string]: string;
29
- };
21
+ export {};
@@ -32,6 +32,7 @@ export declare abstract class BaseStore<T> extends Singleton {
32
32
  protected params: BaseStoreParams<T>;
33
33
  protected storeConfig?: Config<T>;
34
34
  protected syncDisposers: Disposer[];
35
+ readonly displayName: string;
35
36
  protected constructor(params: BaseStoreParams<T>);
36
37
  /**
37
38
  * This must be called after the last child's constructor is finished (or just before it finishes)
@@ -42,14 +43,14 @@ export declare abstract class BaseStore<T> extends Singleton {
42
43
  protected get syncMainChannel(): string;
43
44
  get path(): string;
44
45
  protected cwd(): string;
45
- protected saveToFile(model: T): Promise<void>;
46
+ protected saveToFile(model: T): void;
46
47
  enableSync(): void;
47
48
  protected onSyncFromMain(model: T): void;
48
49
  unregisterIpcListener(): void;
49
50
  disableSync(): void;
50
51
  protected applyWithoutSync(callback: () => void): void;
51
52
  protected onSync(model: T): void;
52
- protected onModelChange(model: T): Promise<void>;
53
+ protected onModelChange(model: T): void;
53
54
  /**
54
55
  * fromStore is called internally when a child class syncs with the file
55
56
  * system.
@@ -20,19 +20,18 @@
20
20
  */
21
21
  import { BaseStore } from "./base-store";
22
22
  import { Cluster } from "../main/cluster";
23
- import type { ClusterModel, ClusterId, ClusterState } from "./cluster-types";
23
+ import type { ClusterModel, ClusterId } from "./cluster-types";
24
24
  export interface ClusterStoreModel {
25
25
  clusters?: ClusterModel[];
26
26
  }
27
27
  export declare class ClusterStore extends BaseStore<ClusterStoreModel> {
28
- private static StateChannel;
28
+ readonly displayName = "ClusterStore";
29
29
  clusters: import("mobx").ObservableMap<string, Cluster>;
30
30
  protected disposer: import("./utils").ExtendableDisposer;
31
31
  constructor();
32
32
  loadInitialOnRenderer(): Promise<void>;
33
33
  provideInitialFromMain(): void;
34
34
  protected pushStateToViewsAutomatically(): void;
35
- handleStateChange: (event: any, clusterId: string, state: ClusterState) => void;
36
35
  registerIpcListener(): void;
37
36
  unregisterIpcListener(): void;
38
37
  pushState(): void;
@@ -105,6 +105,13 @@ export declare enum ClusterStatus {
105
105
  AccessDenied = 1,
106
106
  Offline = 0
107
107
  }
108
+ /**
109
+ * The message format for the "cluster:<cluster-id>:connection-update" channels
110
+ */
111
+ export interface KubeAuthUpdate {
112
+ message: string;
113
+ isError: boolean;
114
+ }
108
115
  /**
109
116
  * The OpenLens known static metadata keys
110
117
  */
@@ -152,7 +159,6 @@ export interface ClusterState {
152
159
  disconnected: boolean;
153
160
  accessible: boolean;
154
161
  ready: boolean;
155
- failureReason: string;
156
162
  isAdmin: boolean;
157
163
  allowedNamespaces: string[];
158
164
  allowedResources: string[];
@@ -26,6 +26,7 @@ export interface HotbarStoreModel {
26
26
  activeHotbarId: string;
27
27
  }
28
28
  export declare class HotbarStore extends BaseStore<HotbarStoreModel> {
29
+ readonly displayName = "HotbarStore";
29
30
  hotbars: Hotbar[];
30
31
  private _activeHotbarId;
31
32
  constructor();
@@ -22,6 +22,7 @@ import { KubeObject } from "../kube-object";
22
22
  import { IMetrics } from "./metrics.api";
23
23
  import { KubeApi } from "../kube-api";
24
24
  import type { KubeJsonApiData } from "../kube-json-api";
25
+ import type { RequireExactlyOne } from "type-fest";
25
26
  export declare class IngressApi extends KubeApi<Ingress> {
26
27
  }
27
28
  export declare function getMetricsForIngress(ingress: string, namespace: string): Promise<IIngressMetrics>;
@@ -38,7 +39,7 @@ export interface ILoadBalancerIngress {
38
39
  }
39
40
  interface IExtensionsBackend {
40
41
  serviceName: string;
41
- servicePort: number;
42
+ servicePort: number | string;
42
43
  }
43
44
  interface INetworkingBackend {
44
45
  service: IIngressService;
@@ -70,13 +71,18 @@ export interface Ingress {
70
71
  };
71
72
  }[];
72
73
  backend?: IExtensionsBackend;
73
- defaultBackend?: INetworkingBackend & {
74
+ /**
75
+ * The default backend which is exactly on of:
76
+ * - service
77
+ * - resource
78
+ */
79
+ defaultBackend?: RequireExactlyOne<INetworkingBackend & {
74
80
  resource: {
75
81
  apiGroup: string;
76
82
  kind: string;
77
83
  name: string;
78
84
  };
79
- };
85
+ }>;
80
86
  };
81
87
  status: {
82
88
  loadBalancer: {
@@ -90,10 +96,7 @@ export declare class Ingress extends KubeObject {
90
96
  static apiBase: string;
91
97
  constructor(data: KubeJsonApiData);
92
98
  getRoutes(): string[];
93
- getServiceNamePort(): {
94
- serviceName: string;
95
- servicePort: string | number;
96
- };
99
+ getServiceNamePort(): IExtensionsBackend;
97
100
  getHosts(): string[];
98
101
  getPorts(): string;
99
102
  getLoadBalancers(): string[];
@@ -96,7 +96,6 @@ export declare class Job extends WorkloadKubeObject {
96
96
  message?: string;
97
97
  };
98
98
  getImages(): string[];
99
- delete(): Promise<KubeJsonApiData>;
100
99
  }
101
100
  export declare class JobApi extends KubeApi<Job> {
102
101
  }
@@ -23,6 +23,7 @@ import type { IKubeWatchEvent } from "./kube-watch-api";
23
23
  import { KubeJsonApi, KubeJsonApiData } from "./kube-json-api";
24
24
  import type { RequestInit } from "node-fetch";
25
25
  import AbortController from "abort-controller";
26
+ import type { Patch } from "rfc6902";
26
27
  export interface IKubeApiOptions<T extends KubeObject> {
27
28
  /**
28
29
  * base api-path for listing all resources, e.g. "/api/v1/pods"
@@ -74,6 +75,7 @@ export interface ILocalKubeApiConfig {
74
75
  uid: string;
75
76
  };
76
77
  }
78
+ export declare type PropagationPolicy = undefined | "Orphan" | "Foreground" | "Background";
77
79
  /**
78
80
  * @deprecated
79
81
  */
@@ -91,8 +93,8 @@ export interface IRemoteKubeApiConfig {
91
93
  clientKeyData?: string;
92
94
  };
93
95
  }
94
- export declare function forCluster<T extends KubeObject>(cluster: ILocalKubeApiConfig, kubeClass: KubeObjectConstructor<T>): KubeApi<T>;
95
- export declare function forRemoteCluster<T extends KubeObject>(config: IRemoteKubeApiConfig, kubeClass: KubeObjectConstructor<T>): KubeApi<T>;
96
+ export declare function forCluster<T extends KubeObject, Y extends KubeApi<T> = KubeApi<T>>(cluster: ILocalKubeApiConfig, kubeClass: KubeObjectConstructor<T>, apiClass?: new (apiOpts: IKubeApiOptions<T>) => Y): KubeApi<T>;
97
+ export declare function forRemoteCluster<T extends KubeObject, Y extends KubeApi<T> = KubeApi<T>>(config: IRemoteKubeApiConfig, kubeClass: KubeObjectConstructor<T>, apiClass?: new (apiOpts: IKubeApiOptions<T>) => Y): Y;
96
98
  export declare function ensureObjectSelfLink(api: KubeApi<KubeObject>, object: KubeJsonApiData): void;
97
99
  export declare type KubeApiWatchCallback = (data: IKubeWatchEvent<KubeJsonApiData>, error: any) => void;
98
100
  export declare type KubeApiWatchOptions = {
@@ -101,7 +103,9 @@ export declare type KubeApiWatchOptions = {
101
103
  abortController?: AbortController;
102
104
  watchId?: string;
103
105
  retry?: boolean;
106
+ timeout?: number;
104
107
  };
108
+ export declare type KubeApiPatchType = "merge" | "json" | "strategic";
105
109
  export declare class KubeApi<T extends KubeObject> {
106
110
  protected options: IKubeApiOptions<T>;
107
111
  readonly kind: string;
@@ -151,9 +155,14 @@ export declare class KubeApi<T extends KubeObject> {
151
155
  name?: string;
152
156
  namespace?: string;
153
157
  }, data?: Partial<T>): Promise<T | null>;
154
- delete({ name, namespace }: {
158
+ patch({ name, namespace }?: {
155
159
  name?: string;
156
160
  namespace?: string;
161
+ }, data?: Partial<T> | Patch, strategy?: KubeApiPatchType): Promise<T | null>;
162
+ delete({ name, namespace, propagationPolicy }: {
163
+ name: string;
164
+ namespace?: string;
165
+ propagationPolicy?: PropagationPolicy;
157
166
  }): Promise<KubeJsonApiData>;
158
167
  getWatchUrl(namespace?: string, query?: IKubeApiQueryParams): string;
159
168
  watch(opts?: KubeApiWatchOptions): () => void;
@@ -104,7 +104,7 @@ export declare class KubeObject<Metadata extends KubeObjectMetadata = KubeObject
104
104
  /**
105
105
  * These must be RFC6902 compliant paths
106
106
  */
107
- private static readonly nonEditiablePathPrefixes;
107
+ private static readonly nonEditablePathPrefixes;
108
108
  private static readonly nonEditablePaths;
109
109
  constructor(data: KubeJsonApiData);
110
110
  get selfLink(): string;
@@ -128,6 +128,9 @@ export declare class KubeObject<Metadata extends KubeObjectMetadata = KubeObject
128
128
  }[];
129
129
  getSearchFields(): string[];
130
130
  toPlainObject(): object;
131
+ /**
132
+ * @deprecated use KubeApi.patch instead
133
+ */
131
134
  patch(patch: Patch): Promise<KubeJsonApiData | null>;
132
135
  /**
133
136
  * Perform a full update (or more specifically a replace)
@@ -135,7 +138,12 @@ export declare class KubeObject<Metadata extends KubeObjectMetadata = KubeObject
135
138
  * Note: this is brittle if `data` is not actually partial (but instead whole).
136
139
  * As fields such as `resourceVersion` will probably out of date. This is a
137
140
  * common race condition.
141
+ *
142
+ * @deprecated use KubeApi.update instead
138
143
  */
139
144
  update(data: Partial<this>): Promise<KubeJsonApiData | null>;
145
+ /**
146
+ * @deprecated use KubeApi.delete instead
147
+ */
140
148
  delete(params?: JsonApiParams): Promise<KubeJsonApiData>;
141
149
  }
@@ -30,6 +30,28 @@ export interface KubeObjectStoreLoadingParams<K extends KubeObject> {
30
30
  namespaces: string[];
31
31
  api?: KubeApi<K>;
32
32
  reqInit?: RequestInit;
33
+ /**
34
+ * A function that is called when listing fails. If set then blocks errors
35
+ * being rejected with
36
+ */
37
+ onLoadFailure?: (err: any) => void;
38
+ }
39
+ export interface KubeObjectStoreLoadAllParams {
40
+ namespaces?: string[];
41
+ merge?: boolean;
42
+ reqInit?: RequestInit;
43
+ /**
44
+ * A function that is called when listing fails. If set then blocks errors
45
+ * being rejected with
46
+ */
47
+ onLoadFailure?: (err: any) => void;
48
+ }
49
+ export interface KubeObjectStoreSubscribeParams {
50
+ /**
51
+ * A function that is called when listing fails. If set then blocks errors
52
+ * being rejected with
53
+ */
54
+ onLoadFailure?: (err: any) => void;
33
55
  }
34
56
  export declare abstract class KubeObjectStore<T extends KubeObject> extends ItemStore<T> {
35
57
  static defaultContext: import("mobx").IObservableValue<ClusterContext>;
@@ -56,13 +78,9 @@ export declare abstract class KubeObjectStore<T extends KubeObject> extends Item
56
78
  getByLabel(labels: string[] | {
57
79
  [label: string]: string;
58
80
  }): T[];
59
- protected loadItems({ namespaces, api, reqInit }: KubeObjectStoreLoadingParams<T>): Promise<T[]>;
81
+ protected loadItems({ namespaces, api, reqInit, onLoadFailure }: KubeObjectStoreLoadingParams<T>): Promise<T[]>;
60
82
  protected filterItemsOnLoad(items: T[]): T[];
61
- loadAll(options?: {
62
- namespaces?: string[];
63
- merge?: boolean;
64
- reqInit?: RequestInit;
65
- }): Promise<void | T[]>;
83
+ loadAll(options?: KubeObjectStoreLoadAllParams): Promise<void | T[]>;
66
84
  reloadAll(opts?: {
67
85
  force?: boolean;
68
86
  namespaces?: string[];
@@ -99,7 +117,7 @@ export declare abstract class KubeObjectStore<T extends KubeObject> extends Item
99
117
  removeSelectedItems(): Promise<void[]>;
100
118
  protected eventsBuffer: import("mobx").IObservableArray<IKubeWatchEvent<KubeJsonApiData>>;
101
119
  protected bindWatchEventsUpdater(delay?: number): void;
102
- subscribe(): () => void;
120
+ subscribe(opts?: KubeObjectStoreSubscribeParams): () => void;
103
121
  private watchNamespace;
104
122
  protected updateFromEventsBuffer(): void;
105
123
  }
@@ -28,11 +28,34 @@ export interface IKubeWatchEvent<T extends KubeJsonApiData> {
28
28
  type: "ADDED" | "MODIFIED" | "DELETED" | "ERROR";
29
29
  object?: T;
30
30
  }
31
- export interface IKubeWatchSubscribeStoreOptions {
31
+ interface KubeWatchPreloadOptions {
32
+ /**
33
+ * The namespaces to watch
34
+ * @default all-accessible
35
+ */
32
36
  namespaces?: string[];
33
- preload?: boolean;
34
- waitUntilLoaded?: boolean;
37
+ /**
38
+ * Whether to skip loading if the store is already loaded
39
+ * @default false
40
+ */
35
41
  loadOnce?: boolean;
42
+ /**
43
+ * A function that is called when listing fails. If set then blocks errors
44
+ * being rejected with
45
+ */
46
+ onLoadFailure?: (err: any) => void;
47
+ }
48
+ export interface KubeWatchSubscribeStoreOptions extends KubeWatchPreloadOptions {
49
+ /**
50
+ * Whether to subscribe only after loading all stores
51
+ * @default true
52
+ */
53
+ waitUntilLoaded?: boolean;
54
+ /**
55
+ * Whether to preload the stores before watching
56
+ * @default true
57
+ */
58
+ preload?: boolean;
36
59
  }
37
60
  export interface IKubeWatchLog {
38
61
  message: string | string[] | Error;
@@ -43,14 +66,12 @@ export declare class KubeWatchApi {
43
66
  context: ClusterContext;
44
67
  constructor();
45
68
  isAllowedApi(api: KubeApi<KubeObject>): boolean;
46
- preloadStores(stores: KubeObjectStore<KubeObject>[], opts?: {
47
- namespaces?: string[];
48
- loadOnce?: boolean;
49
- }): {
69
+ preloadStores(stores: KubeObjectStore<KubeObject>[], { loadOnce, namespaces, onLoadFailure }?: KubeWatchPreloadOptions): {
50
70
  loading: Promise<PromiseSettledResult<any>[]>;
51
71
  cancelLoading: () => void;
52
72
  };
53
- subscribeStores(stores: KubeObjectStore<KubeObject>[], opts?: IKubeWatchSubscribeStoreOptions): Disposer;
73
+ subscribeStores(stores: KubeObjectStore<KubeObject>[], opts?: KubeWatchSubscribeStoreOptions): Disposer;
54
74
  protected log({ message, cssStyle, meta }: IKubeWatchLog): void;
55
75
  }
56
76
  export declare const kubeWatchApi: KubeWatchApi;
77
+ export {};
@@ -26,6 +26,7 @@ export interface UserStoreModel {
26
26
  preferences: UserPreferencesModel;
27
27
  }
28
28
  export declare class UserStore extends BaseStore<UserStoreModel> {
29
+ readonly displayName = "UserStore";
29
30
  constructor();
30
31
  lastSeenAppVersion: string;
31
32
  /**
@@ -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
+ export declare function resolveTilde(filePath: string): string;
21
22
  export declare function resolvePath(filePath: string): string;
22
23
  /**
23
24
  * Checks if `testPath` represents a potential filesystem entry that would be
@@ -33,6 +33,7 @@ export interface WeblinkStoreModel {
33
33
  weblinks: WeblinkData[];
34
34
  }
35
35
  export declare class WeblinkStore extends BaseStore<WeblinkStoreModel> {
36
+ readonly displayName = "WeblinkStore";
36
37
  weblinks: WeblinkData[];
37
38
  constructor();
38
39
  protected fromStore(data?: Partial<WeblinkStoreModel>): void;