@k8slens/extensions 5.3.1-git.6e543961ac.0 → 5.3.1-git.7965649521.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 (27) hide show
  1. package/dist/src/common/k8s-api/kube-api-parse.d.ts +2 -2
  2. package/dist/src/common/k8s-api/kube-api.d.ts +29 -5
  3. package/dist/src/common/protocol-handler/error.d.ts +3 -3
  4. package/dist/src/common/protocol-handler/router.d.ts +5 -5
  5. package/dist/src/extensions/extension-api.js +157 -27
  6. package/dist/src/extensions/registries/status-bar-registry.d.ts +6 -0
  7. package/dist/src/main/protocol-handler/router.d.ts +3 -3
  8. package/dist/src/renderer/components/cluster-manager/active-hotbar-name.d.ts +21 -0
  9. package/dist/src/renderer/components/cluster-manager/bottom-bar.d.ts +0 -1
  10. package/dist/src/renderer/components/dialog/dialog.d.ts +1 -0
  11. package/dist/src/renderer/components/kube-object-menu/dependencies/api-manager.injectable.d.ts +24 -0
  12. package/dist/src/renderer/components/kube-object-menu/dependencies/cluster-name.injectable.d.ts +27 -0
  13. package/dist/src/renderer/components/kube-object-menu/dependencies/cluster.injectable.d.ts +4 -0
  14. package/dist/src/renderer/components/kube-object-menu/dependencies/edit-resource-tab.injectable.d.ts +24 -0
  15. package/dist/src/renderer/components/kube-object-menu/dependencies/hide-details.injectable.d.ts +24 -0
  16. package/dist/src/renderer/components/kube-object-menu/dependencies/kube-object-menu-items/get-kube-object-menu-items.d.ts +29 -0
  17. package/dist/src/renderer/components/kube-object-menu/dependencies/kube-object-menu-items/kube-object-menu-items.injectable.d.ts +24 -0
  18. package/dist/src/renderer/components/kube-object-menu/dependencies/kube-object-menu-items/kube-object-menu-registry.injectable.d.ts +24 -0
  19. package/dist/src/renderer/components/kube-object-menu/index.d.ts +2 -1
  20. package/dist/src/renderer/components/kube-object-menu/kube-object-menu-container.d.ts +2 -0
  21. package/dist/src/renderer/components/kube-object-menu/kube-object-menu.d.ts +14 -4
  22. package/dist/src/renderer/components/kube-object-menu/kube-object-menu.injectable.d.ts +5 -0
  23. package/dist/src/renderer/components/kube-object-menu/kube-object-menu.test.d.ts +21 -0
  24. package/dist/src/renderer/components/test-utils/renderFor.d.ts +27 -0
  25. package/dist/src/renderer/initializers/index.d.ts +1 -0
  26. package/dist/src/renderer/initializers/status-bar-registry.d.ts +21 -0
  27. package/package.json +1 -1
@@ -28,7 +28,7 @@ export interface IKubeApiLinkRef {
28
28
  apiPrefix?: string;
29
29
  apiVersion: string;
30
30
  resource: string;
31
- name: string;
31
+ name?: string;
32
32
  namespace?: string;
33
33
  }
34
34
  export interface IKubeApiParsed extends IKubeApiLinkRef {
@@ -37,4 +37,4 @@ export interface IKubeApiParsed extends IKubeApiLinkRef {
37
37
  apiVersionWithGroup: string;
38
38
  }
39
39
  export declare function parseKubeApi(path: string): IKubeApiParsed;
40
- export declare function createKubeApiURL(ref: IKubeApiLinkRef): string;
40
+ export declare function createKubeApiURL({ apiPrefix, resource, apiVersion, name, namespace }: IKubeApiLinkRef): string;
@@ -24,9 +24,14 @@ import { KubeJsonApi, KubeJsonApiData } from "./kube-json-api";
24
24
  import type { RequestInit } from "node-fetch";
25
25
  import AbortController from "abort-controller";
26
26
  import type { Patch } from "rfc6902";
27
+ /**
28
+ * The options used for creating a `KubeApi`
29
+ */
27
30
  export interface IKubeApiOptions<T extends KubeObject> {
28
31
  /**
29
32
  * base api-path for listing all resources, e.g. "/api/v1/pods"
33
+ *
34
+ * If not specified then will be the one on the `objectConstructor`
30
35
  */
31
36
  apiBase?: string;
32
37
  /**
@@ -36,11 +41,29 @@ export interface IKubeApiOptions<T extends KubeObject> {
36
41
  * This option only has effect if checkPreferredVersion is true.
37
42
  */
38
43
  fallbackApiBases?: string[];
44
+ /**
45
+ * If `true` then will check all declared apiBases against the kube api server
46
+ * for the first accepted one.
47
+ */
48
+ checkPreferredVersion?: boolean;
49
+ /**
50
+ * The constructor for the kube objects returned from the API
51
+ */
39
52
  objectConstructor: KubeObjectConstructor<T>;
53
+ /**
54
+ * The api instance to use for making requests
55
+ *
56
+ * @default apiKube
57
+ */
40
58
  request?: KubeJsonApi;
59
+ /**
60
+ * @deprecated should be specified by `objectConstructor`
61
+ */
41
62
  isNamespaced?: boolean;
63
+ /**
64
+ * @deprecated should be specified by `objectConstructor`
65
+ */
42
66
  kind?: string;
43
- checkPreferredVersion?: boolean;
44
67
  }
45
68
  export interface IKubeApiQueryParams {
46
69
  watch?: boolean | number;
@@ -132,11 +155,11 @@ export interface DeleteResourceDescriptor extends ResourceDescriptor {
132
155
  export declare class KubeApi<T extends KubeObject> {
133
156
  protected options: IKubeApiOptions<T>;
134
157
  readonly kind: string;
135
- readonly apiBase: string;
136
- readonly apiPrefix: string;
137
- readonly apiGroup: string;
138
158
  readonly apiVersion: string;
139
- readonly apiVersionPreferred?: string;
159
+ apiBase: string;
160
+ apiPrefix: string;
161
+ apiGroup: string;
162
+ apiVersionPreferred?: string;
140
163
  readonly apiResource: string;
141
164
  readonly isNamespaced: boolean;
142
165
  objectConstructor: KubeObjectConstructor<T>;
@@ -159,6 +182,7 @@ export declare class KubeApi<T extends KubeObject> {
159
182
  setResourceVersion(namespace: string, newVersion: string): void;
160
183
  getResourceVersion(namespace?: string): string;
161
184
  refreshResourceVersion(params?: KubeApiListOptions): Promise<T[]>;
185
+ private computeApiBase;
162
186
  getUrl({ name, namespace }?: Partial<ResourceDescriptor>, query?: Partial<IKubeApiQueryParams>): string;
163
187
  protected normalizeQuery(query?: Partial<IKubeApiQueryParams>): Partial<IKubeApiQueryParams>;
164
188
  protected parseResponse(data: unknown, namespace?: string): T | T[] | null;
@@ -27,13 +27,13 @@ export declare enum RoutingErrorType {
27
27
  NO_EXTENSION_ID = "no-ext-id",
28
28
  MISSING_EXTENSION = "missing-ext"
29
29
  }
30
- export declare class RoutingError extends Error {
30
+ export declare class RoutingError<Query> extends Error {
31
31
  type: RoutingErrorType;
32
- url: Url;
32
+ url: Url<Query>;
33
33
  /**
34
34
  * Will be set if the routing error originated in an extension route table
35
35
  */
36
36
  extensionName?: string;
37
- constructor(type: RoutingErrorType, url: Url);
37
+ constructor(type: RoutingErrorType, url: Url<Query>);
38
38
  toString(): string;
39
39
  }
@@ -63,20 +63,20 @@ export declare abstract class LensProtocolRouter extends Singleton {
63
63
  * @param url the parsed URL that initiated the `lens://` protocol
64
64
  * @returns true if a route has been found
65
65
  */
66
- protected _routeToInternal(url: Url): RouteAttempt;
66
+ protected _routeToInternal(url: Url<Record<string, string>>): RouteAttempt;
67
67
  /**
68
68
  * match against all matched URIs, returning either the first exact match or
69
69
  * the most specific match if none are exact.
70
70
  * @param routes the array of path schemas, handler pairs to match against
71
71
  * @param url the url (in its current state)
72
72
  */
73
- protected _findMatchingRoute(routes: Iterable<[string, RouteHandler]>, url: Url): null | [match<Record<string, string>>, RouteHandler];
73
+ protected _findMatchingRoute(routes: Iterable<[string, RouteHandler]>, url: Url<Record<string, string>>): null | [match<Record<string, string>>, RouteHandler];
74
74
  /**
75
75
  * find the most specific matching handler and call it
76
76
  * @param routes the array of (path schemas, handler) pairs to match against
77
77
  * @param url the url (in its current state)
78
78
  */
79
- protected _route(routes: Iterable<[string, RouteHandler]>, url: Url, extensionName?: string): RouteAttempt;
79
+ protected _route(routes: Iterable<[string, RouteHandler]>, url: Url<Record<string, string>>, extensionName?: string): RouteAttempt;
80
80
  /**
81
81
  * Tries to find the matching LensExtension instance
82
82
  *
@@ -84,7 +84,7 @@ export declare abstract class LensProtocolRouter extends Singleton {
84
84
  * @param url the protocol request URI that was "open"-ed
85
85
  * @returns either the found name or the instance of `LensExtension`
86
86
  */
87
- protected _findMatchingExtensionByName(url: Url): Promise<LensExtension | string>;
87
+ protected _findMatchingExtensionByName(url: Url<Record<string, string>>): Promise<LensExtension | string>;
88
88
  /**
89
89
  * Find a matching extension by the first one or two path segments of `url` and then try to `_route`
90
90
  * its correspondingly registered handlers.
@@ -95,7 +95,7 @@ export declare abstract class LensProtocolRouter extends Singleton {
95
95
  * Note: this function modifies its argument, do not reuse
96
96
  * @param url the protocol request URI that was "open"-ed
97
97
  */
98
- protected _routeToExtension(url: Url): Promise<RouteAttempt>;
98
+ protected _routeToExtension(url: Url<Record<string, string>>): Promise<RouteAttempt>;
99
99
  /**
100
100
  * Add a handler under the `lens://app` tree of routing.
101
101
  * @param pathSchema the URI path schema to match against for this handler