@k8slens/extensions 5.4.0-git.76f48df56b.0 → 5.4.0-git.8088d3b5c2.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 (47) hide show
  1. package/dist/src/common/catalog/catalog-category-registry.d.ts +2 -2
  2. package/dist/src/common/catalog-entities/kubernetes-cluster.d.ts +1 -1
  3. package/dist/src/common/cluster/authorization-review.injectable.d.ts +13 -0
  4. package/dist/src/common/cluster/cluster.d.ts +11 -21
  5. package/dist/src/common/cluster/list-namespaces.injectable.d.ts +10 -0
  6. package/dist/src/common/item.store.d.ts +3 -1
  7. package/dist/src/common/k8s-api/kube-object.store.d.ts +1 -0
  8. package/dist/src/common/user-store/user-store.d.ts +1 -1
  9. package/dist/src/common/utils/collection-functions.d.ts +18 -4
  10. package/dist/src/common/utils/index.d.ts +0 -1
  11. package/dist/src/common/utils/objects.d.ts +2 -3
  12. package/dist/src/extensions/common-api/registrations.d.ts +2 -1
  13. package/dist/src/extensions/extension-api.js +37 -37
  14. package/dist/src/extensions/lens-extension.d.ts +1 -1
  15. package/dist/src/extensions/lens-main-extension.d.ts +15 -0
  16. package/dist/src/extensions/lens-renderer-extension.d.ts +1 -1
  17. package/dist/src/extensions/main-api/index.d.ts +2 -1
  18. package/dist/src/extensions/main-api/power.d.ts +24 -0
  19. package/dist/src/main/cluster-manager.d.ts +20 -2
  20. package/dist/src/main/create-cluster/create-cluster.injectable.d.ts +1 -2
  21. package/dist/src/main/helm/helm-repo-manager.d.ts +8 -9
  22. package/dist/src/main/shell-session/local-shell-session/local-shell-session.d.ts +6 -0
  23. package/dist/src/main/shell-session/shell-env-modifier/shell-env-modifier-registration.d.ts +9 -0
  24. package/dist/src/main/shell-session/shell-env-modifier/terminal-shell-env-modifiers.d.ts +12 -0
  25. package/dist/src/main/shell-session/shell-env-modifier/terminal-shell-env-modify.injectable.d.ts +7 -0
  26. package/dist/src/renderer/api/websocket-api.d.ts +1 -1
  27. package/dist/src/renderer/components/+catalog/custom-category-columns.d.ts +1 -1
  28. package/dist/src/renderer/components/+config-secrets/secret-details.d.ts +1 -1
  29. package/dist/src/renderer/components/+custom-resources/route-tabs.injectable.d.ts +1 -1
  30. package/dist/src/renderer/components/+custom-resources/route.d.ts +1 -4
  31. package/dist/src/renderer/components/+preferences/add-helm-repo-dialog.d.ts +0 -1
  32. package/dist/src/renderer/components/+preferences/helm-charts.d.ts +4 -2
  33. package/dist/src/renderer/components/item-object-list/content.d.ts +1 -1
  34. package/dist/src/renderer/components/item-object-list/list-layout.d.ts +2 -4
  35. package/dist/src/renderer/components/kube-object-list-layout/kube-object-list-layout.d.ts +5 -1
  36. package/dist/src/renderer/components/layout/tab-routes-sidebar-items.d.ts +8 -4
  37. package/dist/src/renderer/components/status-bar/registered-status-bar-items.injectable.d.ts +14 -0
  38. package/dist/src/renderer/components/status-bar/status-bar-items.injectable.d.ts +3 -0
  39. package/dist/src/renderer/components/status-bar/status-bar-registration.d.ts +38 -0
  40. package/dist/src/renderer/components/{cluster-manager/bottom-bar.d.ts → status-bar/status-bar.d.ts} +3 -1
  41. package/dist/src/renderer/components/{cluster-manager/bottom-bar.test.d.ts → status-bar/status-bar.test.d.ts} +0 -0
  42. package/dist/src/renderer/create-cluster/create-cluster.injectable.d.ts +1 -2
  43. package/dist/src/renderer/port-forward/port-forward-store/port-forward-store.d.ts +1 -1
  44. package/package.json +1 -1
  45. package/dist/src/common/utils/extended-map.d.ts +0 -30
  46. package/dist/src/renderer/components/cluster-manager/bottom-bar-items.injectable.d.ts +0 -4
  47. package/dist/src/renderer/components/cluster-manager/status-bar-registration.d.ts +0 -24
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) OpenLens Authors. All rights reserved.
3
3
  * Licensed under MIT License. See LICENSE in root directory for more information.
4
4
  */
5
- import { Disposer, ExtendedMap } from "../utils";
5
+ import type { Disposer } from "../utils";
6
6
  import { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
7
7
  export declare type CategoryFilter = (category: CatalogCategory) => any;
8
8
  export declare class CatalogCategoryRegistry {
9
9
  protected categories: import("mobx").ObservableSet<CatalogCategory>;
10
- protected groupKinds: ExtendedMap<string, ExtendedMap<string, CatalogCategory>>;
10
+ protected groupKinds: Map<string, Map<string, CatalogCategory>>;
11
11
  protected filters: import("mobx").ObservableSet<CategoryFilter>;
12
12
  constructor();
13
13
  add(category: CatalogCategory): Disposer;
@@ -43,7 +43,7 @@ export interface KubernetesClusterMetadata extends CatalogEntityMetadata {
43
43
  export declare type KubernetesClusterStatusPhase = "connected" | "connecting" | "disconnected" | "deleting";
44
44
  export interface KubernetesClusterStatus extends CatalogEntityStatus {
45
45
  }
46
- export declare class KubernetesCluster extends CatalogEntity<KubernetesClusterMetadata, KubernetesClusterStatus, KubernetesClusterSpec> {
46
+ export declare class KubernetesCluster<Metadata extends KubernetesClusterMetadata = KubernetesClusterMetadata, Status extends KubernetesClusterStatus = KubernetesClusterStatus, Spec extends KubernetesClusterSpec = KubernetesClusterSpec> extends CatalogEntity<Metadata, Status, Spec> {
47
47
  static readonly apiVersion: string;
48
48
  static readonly kind: string;
49
49
  readonly apiVersion: string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ /// <reference types="@ogre-tools/injectable" />
6
+ import { KubeConfig, V1ResourceAttributes } from "@kubernetes/client-node";
7
+ export declare type CanI = (resourceAttributes: V1ResourceAttributes) => Promise<boolean>;
8
+ /**
9
+ * @param proxyConfig This config's `currentContext` field must be set, and will be used as the target cluster
10
+ */
11
+ export declare function authorizationReview(proxyConfig: KubeConfig): CanI;
12
+ declare const authorizationReviewInjectable: import("@ogre-tools/injectable").Injectable<import("@ogre-tools/injectable").InjectionToken<typeof authorizationReview, unknown>, typeof authorizationReview, unknown>;
13
+ export default authorizationReviewInjectable;
@@ -3,17 +3,21 @@
3
3
  * Licensed under MIT License. See LICENSE in root directory for more information.
4
4
  */
5
5
  import type { ContextHandler } from "../../main/context-handler/context-handler";
6
- import { KubeConfig, V1ResourceAttributes } from "@kubernetes/client-node";
6
+ import { KubeConfig } from "@kubernetes/client-node";
7
7
  import type { Kubectl } from "../../main/kubectl/kubectl";
8
8
  import type { KubeconfigManager } from "../../main/kubeconfig-manager/kubeconfig-manager";
9
9
  import { KubeResource } from "../rbac";
10
10
  import type { ClusterState, ClusterRefreshOptions, ClusterMetricsResourceType, ClusterId, ClusterMetadata, ClusterModel, ClusterPreferences, ClusterPrometheusPreferences, UpdateClusterModel } from "../cluster-types";
11
11
  import { ClusterStatus } from "../cluster-types";
12
- interface Dependencies {
13
- directoryForKubeConfigs: string;
12
+ import type { CanI } from "./authorization-review.injectable";
13
+ import type { ListNamespaces } from "./list-namespaces.injectable";
14
+ export interface ClusterDependencies {
15
+ readonly directoryForKubeConfigs: string;
14
16
  createKubeconfigManager: (cluster: Cluster) => KubeconfigManager;
15
17
  createContextHandler: (cluster: Cluster) => ContextHandler;
16
18
  createKubectl: (clusterVersion: string) => Kubectl;
19
+ createAuthorizationReview: (config: KubeConfig) => CanI;
20
+ createListNamespaces: (config: KubeConfig) => ListNamespaces;
17
21
  }
18
22
  /**
19
23
  * Cluster
@@ -21,7 +25,7 @@ interface Dependencies {
21
25
  * @beta
22
26
  */
23
27
  export declare class Cluster implements ClusterModel, ClusterState {
24
- private dependencies;
28
+ private readonly dependencies;
25
29
  /** Unique id for a cluster */
26
30
  readonly id: ClusterId;
27
31
  private kubeCtl;
@@ -175,7 +179,7 @@ export declare class Cluster implements ClusterModel, ClusterState {
175
179
  * @internal
176
180
  */
177
181
  get defaultNamespace(): string;
178
- constructor(dependencies: Dependencies, model: ClusterModel);
182
+ constructor(dependencies: ClusterDependencies, model: ClusterModel);
179
183
  /**
180
184
  * Update cluster data model
181
185
  *
@@ -234,19 +238,6 @@ export declare class Cluster implements ClusterModel, ClusterState {
234
238
  */
235
239
  getProxyKubeconfigPath(): Promise<string>;
236
240
  protected getConnectionStatus(): Promise<ClusterStatus>;
237
- /**
238
- * @internal
239
- * @param resourceAttributes resource attributes
240
- */
241
- canI(resourceAttributes: V1ResourceAttributes): Promise<boolean>;
242
- /**
243
- * @internal
244
- */
245
- isClusterAdmin(): Promise<boolean>;
246
- /**
247
- * @internal
248
- */
249
- canUseWatchApi(customizeResource?: V1ResourceAttributes): Promise<boolean>;
250
241
  toJSON(): ClusterModel;
251
242
  /**
252
243
  * Serializable cluster-state used for sync btw main <-> renderer
@@ -275,12 +266,11 @@ export declare class Cluster implements ClusterModel, ClusterState {
275
266
  * @internal
276
267
  */
277
268
  broadcastConnectUpdate(message: string, isError?: boolean): void;
278
- protected getAllowedNamespaces(): Promise<string[]>;
279
- protected getAllowedResources(): Promise<KubeResource[]>;
269
+ protected getAllowedNamespaces(proxyConfig: KubeConfig): Promise<string[]>;
270
+ protected getAllowedResources(canI: CanI): Promise<KubeResource[]>;
280
271
  isAllowedResource(kind: string): boolean;
281
272
  isMetricHidden(resource: ClusterMetricsResourceType): boolean;
282
273
  get nodeShellImage(): string;
283
274
  get imagePullSecret(): string | undefined;
284
275
  isInLocalKubeconfig(): boolean;
285
276
  }
286
- export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="@ogre-tools/injectable" />
2
+ /**
3
+ * Copyright (c) OpenLens Authors. All rights reserved.
4
+ * Licensed under MIT License. See LICENSE in root directory for more information.
5
+ */
6
+ import { KubeConfig } from "@kubernetes/client-node";
7
+ export declare type ListNamespaces = () => Promise<string[]>;
8
+ export declare function listNamespaces(config: KubeConfig): ListNamespaces;
9
+ declare const listNamespacesInjectable: import("@ogre-tools/injectable").Injectable<import("@ogre-tools/injectable").InjectionToken<typeof listNamespaces, unknown>, typeof listNamespaces, unknown>;
10
+ export default listNamespacesInjectable;
@@ -13,9 +13,10 @@ export declare abstract class ItemStore<Item extends ItemObject> {
13
13
  isLoading: boolean;
14
14
  isLoaded: boolean;
15
15
  items: import("mobx").IObservableArray<Item>;
16
- selectedItemsIds: import("mobx").ObservableMap<string, boolean>;
16
+ selectedItemsIds: import("mobx").ObservableSet<string>;
17
17
  constructor();
18
18
  get selectedItems(): Item[];
19
+ pickOnlySelected(items: Item[]): Item[];
19
20
  getItems(): Item[];
20
21
  getTotalCount(): number;
21
22
  getByName(name: string, ...args: any[]): Item;
@@ -44,5 +45,6 @@ export declare abstract class ItemStore<Item extends ItemObject> {
44
45
  resetSelection(): void;
45
46
  reset(): void;
46
47
  removeSelectedItems?(): Promise<any>;
48
+ removeItems?(items: Item[]): Promise<void>;
47
49
  [Symbol.iterator](): Generator<Item, void, undefined>;
48
50
  }
@@ -104,6 +104,7 @@ export declare abstract class KubeObjectStore<T extends KubeObject> extends Item
104
104
  update(item: T, data: Partial<T>): Promise<T>;
105
105
  remove(item: T): Promise<void>;
106
106
  removeSelectedItems(): Promise<void[]>;
107
+ removeItems(items: T[]): Promise<void>;
107
108
  protected eventsBuffer: import("mobx").IObservableArray<IKubeWatchEvent<KubeJsonApiData>>;
108
109
  protected bindWatchEventsUpdater(delay?: number): void;
109
110
  subscribe({ onLoadFailure, abortController }?: KubeObjectStoreSubscribeParams): Disposer;
@@ -3,7 +3,7 @@
3
3
  * Licensed under MIT License. See LICENSE in root directory for more information.
4
4
  */
5
5
  import { BaseStore } from "../base-store";
6
- import { EditorConfiguration, ExtensionRegistry, KubeconfigSyncValue, UserPreferencesModel, TerminalConfig } from "./preferences-helpers";
6
+ import type { EditorConfiguration, ExtensionRegistry, KubeconfigSyncValue, UserPreferencesModel, TerminalConfig } from "./preferences-helpers";
7
7
  export interface UserStoreModel {
8
8
  lastSeenAppVersion: string;
9
9
  preferences: UserPreferencesModel;
@@ -11,8 +11,8 @@
11
11
  */
12
12
  export declare function getOrInsert<K, V>(map: Map<K, V>, key: K, value: V): V;
13
13
  /**
14
- * Like `getOrInsert` but specifically for when `V` is `Map<any, any>` so that
15
- * the typings are inferred.
14
+ * Like `getOrInsert` but specifically for when `V` is `Map<MK, MV>` so that
15
+ * the typings are inferred correctly.
16
16
  */
17
17
  export declare function getOrInsertMap<K, MK, MV>(map: Map<K, Map<MK, MV>>, key: K): Map<MK, MV>;
18
18
  /**
@@ -21,9 +21,23 @@ export declare function getOrInsertMap<K, MK, MV>(map: Map<K, Map<MK, MV>>, key:
21
21
  */
22
22
  export declare function getOrInsertSet<K, SK>(map: Map<K, Set<SK>>, key: K): Set<SK>;
23
23
  /**
24
- * Like `getOrInsert` but with delayed creation of the item
24
+ * Like `getOrInsert` but with delayed creation of the item. Which is useful
25
+ * if it is very expensive to create the initial value.
26
+ */
27
+ export declare function getOrInsertWith<K, V>(map: Map<K, V>, key: K, builder: () => V): V;
28
+ /**
29
+ * Set the value associated with `key` iff there was not a previous value
30
+ * @param map The map to interact with
31
+ * @throws if `key` already in map
32
+ * @returns `this` so that `strictSet` can be chained
33
+ */
34
+ export declare function strictSet<K, V>(map: Map<K, V>, key: K, val: V): typeof map;
35
+ /**
36
+ * Get the value associated with `key`
37
+ * @param map The map to interact with
38
+ * @throws if `key` did not a value associated with it
25
39
  */
26
- export declare function getOrInsertWith<K, V>(map: Map<K, V>, key: K, value: () => V): V;
40
+ export declare function strictGet<K, V>(map: Map<K, V>, key: K): V;
27
41
  /**
28
42
  * If `key` is in `set`, remove it otherwise add it.
29
43
  * @param set The set to manipulate
@@ -21,7 +21,6 @@ export * from "./delay";
21
21
  export * from "./disposer";
22
22
  export * from "./downloadFile";
23
23
  export * from "./escapeRegExp";
24
- export * from "./extended-map";
25
24
  export * from "./formatDuration";
26
25
  export * from "./getRandId";
27
26
  export * from "./hash-set";
@@ -6,6 +6,5 @@
6
6
  * A better typed version of `Object.fromEntries` where the keys are known to
7
7
  * be a specific subset
8
8
  */
9
- export declare function fromEntries<T, Key extends string>(entries: Iterable<readonly [Key, T]>): {
10
- [k in Key]: T;
11
- };
9
+ export declare function fromEntries<T, Key extends string>(entries: Iterable<readonly [Key, T]>): Record<Key, T>;
10
+ export declare function entries<T extends Record<string, any>>(obj: T): [keyof T, T[keyof T]][];
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) OpenLens Authors. All rights reserved.
3
3
  * Licensed under MIT License. See LICENSE in root directory for more information.
4
4
  */
5
- export type { StatusBarRegistration } from "../../renderer/components/cluster-manager/status-bar-registration";
5
+ export type { StatusBarRegistration } from "../../renderer/components/status-bar/status-bar-registration";
6
6
  export type { KubeObjectMenuRegistration, KubeObjectMenuComponents } from "../../renderer/components/kube-object-menu/dependencies/kube-object-menu-items/kube-object-menu-registration";
7
7
  export type { AppPreferenceRegistration, AppPreferenceComponents } from "../../renderer/components/+preferences/app-preferences/app-preference-registration";
8
8
  export type { KubeObjectDetailRegistration, KubeObjectDetailComponents } from "../registries/kube-object-detail-registry";
@@ -11,3 +11,4 @@ export type { PageRegistration, RegisteredPage, PageParams, PageComponentProps,
11
11
  export type { ClusterPageMenuRegistration, ClusterPageMenuComponents } from "../registries/page-menu-registry";
12
12
  export type { ProtocolHandlerRegistration, RouteParams as ProtocolRouteParams, RouteHandler as ProtocolRouteHandler } from "../registries/protocol-handler";
13
13
  export type { CustomCategoryViewProps, CustomCategoryViewComponents, CustomCategoryViewRegistration } from "../../renderer/components/+catalog/custom-views";
14
+ export type { ShellEnvModifier, ShellEnvContext } from "../../main/shell-session/shell-env-modifier/shell-env-modifier-registration";