Switch to using messaging and startable stoppable from NPM package (#7368)

* Add custom jest resolver to fix requiring "uuid" module

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Update dependencies

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Introduce test utils for rendering and running with thrown mobx reactions

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Extract startable-stoppable to NPM package

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Extract messaging to NPM package

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Switch to using startable-stoppable from NPM package

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Switch to using messaging from the Feature

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Remove old implementation of messaging

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Make setupping app paths happen earlier in renderer

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Fix typo

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Add kludge to make testing-library work properly from test-utils package

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Fix code style

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Add lint:fix -root script

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Fix unrelated failing unit tests

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Turn of no-floating-promises from typescript linting for being broken

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Make linting not happen for dist -directories

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Make linting failures appear as failure

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Stop running prettier twice

It already gets ran as eslint-plugin.

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Make CI run unit tests for all packages by consolidating name of NPM script

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Add missing unit tests for coverage

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Skip coverage for test utils

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Remove check for coverage in packages which are not ready for it

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Stop collecting coverage from index.ts files them being indirections to the implementation

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Implement sending message to channel in main

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Add missing feature dependencies

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Add dummy implementations for requesting in main from renderer

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Re-enable communicating from main to cluster frames

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Ignore trivial files from coverage

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Update package-lock

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Extract message-bridge to separate NPM package to prevent dev dependencies being in the production bundle

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Extract computed channel to own NPM package for clear dependencies

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Consolidate electron related stuff to a directory

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Add missing publish configurations

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Ignore test implementation from coverage being not interesting

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

---------

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne SavolainenandMikko Aspiala authored and GitHub committed 2023-03-21 11:38:43 +02:00
1 parent df49ff9b96
commit 0f1f030a06
261 files changed
+4447 -1795

No files matched your search

@@ -4,9 +4,9 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import appPathsStateInjectable from "../../common/app-paths/app-paths-state.injectable";
import { beforeFrameStartsFirstInjectionToken } from "../before-frame-starts/tokens";
import { appPathsChannel } from "../../common/app-paths/app-paths-channel";
import { requestFromChannelInjectionToken } from "../../common/utils/channel/request-from-channel-injection-token";
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
import { beforeApplicationIsLoadingInjectionToken } from "@k8slens/application";
const setupAppPathsInjectable = getInjectable({
id: "setup-app-paths",
@@ -21,7 +21,7 @@ const setupAppPathsInjectable = getInjectable({
},
}),
injectionToken: beforeFrameStartsFirstInjectionToken,
injectionToken: beforeApplicationIsLoadingInjectionToken,
});
export default setupAppPathsInjectable;
@@ -5,7 +5,7 @@
import { getInjectable } from "@ogre-tools/injectable";
import { reaction } from "mobx";
import { currentClusterMessageChannel } from "../../../common/cluster/current-cluster-channel";
import { sendMessageToChannelInjectionToken } from "../../../common/utils/channel/message-to-channel-injection-token";
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
import matchedClusterIdInjectable from "../../navigation/matched-cluster-id.injectable";
import { beforeMainFrameStartsFirstInjectionToken } from "../tokens";
@@ -4,12 +4,12 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import { lensProxyCertificateChannel } from "../../common/certificate/lens-proxy-certificate-channel";
import requestFromChannelInjectable from "../utils/channel/request-from-channel.injectable";
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
const requestLensProxyCertificateInjectable = getInjectable({
id: "request-lens-proxy-certificate",
instantiate: (di) => {
const requestFromChannel = di.inject(requestFromChannelInjectable);
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
return () => requestFromChannel(lensProxyCertificateChannel);
},
@@ -26,6 +26,7 @@ export interface ExtensionInfo {
requireConfirmation?: boolean;
}
// @ts-ignore
interface NpmPackageVersionDescriptor extends PackageJson {
dist: {
integrity: string;
@@ -10,7 +10,6 @@ import { onceDefined } from "@k8slens/utilities";
import assert from "assert";
import type { Logger } from "../../../common/logger";
import type { GetClusterById } from "../../../common/cluster-store/get-by-id.injectable";
import type { EmitClusterVisibility } from "./emit-cluster-visibility.injectable";
import { getClusterFrameUrl } from "../../../common/utils";
export interface LensView {
@@ -21,7 +20,7 @@ export interface LensView {
interface Dependencies {
readonly logger: Logger;
getClusterById: GetClusterById;
emitClusterVisibility: EmitClusterVisibility;
emitClusterVisibility: (clusterId: ClusterId | null) => void;
}
export class ClusterFrameHandler {
@@ -3,18 +3,16 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import type { MessageChannelHandler } from "../../../common/utils/channel/message-channel-listener-injection-token";
import { sendMessageToChannelInjectionToken } from "../../../common/utils/channel/message-to-channel-injection-token";
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
import { clusterVisibilityChannel } from "../../../common/cluster/visibility-channel";
export type EmitClusterVisibility = MessageChannelHandler<typeof clusterVisibilityChannel>;
import type { ClusterId } from "../../../common/cluster-types";
const emitClusterVisibilityInjectable = getInjectable({
id: "emit-cluster-visibility",
instantiate: (di): EmitClusterVisibility => {
instantiate: (di) => {
const sendMessageToChannel = di.inject(sendMessageToChannelInjectionToken);
return (id) => sendMessageToChannel(clusterVisibilityChannel, id);
return (id: ClusterId | null) => sendMessageToChannel(clusterVisibilityChannel, id);
},
});
@@ -29,7 +29,6 @@ import type { MinimalTrayMenuItem } from "../../../main/tray/electron-tray/elect
import electronTrayInjectable from "../../../main/tray/electron-tray/electron-tray.injectable";
import { getDiForUnitTesting as getRendererDi } from "../../getDiForUnitTesting";
import { getDiForUnitTesting as getMainDi } from "../../../main/getDiForUnitTesting";
import { overrideChannels } from "../../../test-utils/channel-fakes/override-channels";
import assert from "assert";
import { openMenu } from "react-select-event";
import userEvent from "@testing-library/user-event";
@@ -40,7 +39,7 @@ import { navigateToRouteInjectionToken } from "../../../common/front-end-routing
import type { LensMainExtension } from "../../../extensions/lens-main-extension";
import type { LensExtension } from "../../../extensions/lens-extension";
import extensionInjectable from "../../../extensions/extension-loader/extension/extension.injectable";
import { renderFor } from "./renderFor";
import { renderFor } from "@k8slens/test-utils";
import { RootFrame } from "../../frames/root-frame/root-frame";
import { ClusterFrame } from "../../frames/cluster-frame/cluster-frame";
import hostedClusterIdInjectable from "../../cluster-frame-context/hosted-cluster-id.injectable";
@@ -71,6 +70,8 @@ import { registerFeature } from "@k8slens/feature-core";
import { applicationFeatureForElectronMain, testUtils as applicationForElectronTestUtils } from "@k8slens/application-for-electron-main";
import { applicationFeature, startApplicationInjectionToken } from "@k8slens/application";
import { testUsingFakeTime } from "../../../test-utils/use-fake-time";
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
import { getMessageBridgeFake } from "@k8slens/messaging-fake-bridge";
type MainDiCallback = (container: { mainDi: DiContainer }) => void | Promise<void>;
type WindowDiCallback = (container: { windowDi: DiContainer }) => void | Promise<void>;
@@ -179,7 +180,9 @@ export const getApplicationBuilder = () => {
testUsingFakeTime();
const { overrideForWindow, sendToWindow } = overrideChannels(mainDi);
const messageBridgeFake = getMessageBridgeFake();
messageBridgeFake.involve(mainDi);
const beforeApplicationStartCallbacks: MainDiCallback[] = [];
const afterApplicationStartCallbacks: MainDiCallback[] = [];
@@ -229,7 +232,8 @@ export const getApplicationBuilder = () => {
const windowDi = getRendererDi();
overrideForWindow(windowDi, windowId);
messageBridgeFake.involve(windowDi);
overrideFsWithFakes(windowDi);
runInAction(() => {
@@ -284,8 +288,10 @@ export const getApplicationBuilder = () => {
);
},
send: (arg) => {
sendToWindow(windowId, arg);
send: ({ channel: channelId, data }) => {
const sendMessageToChannel = mainDi.inject(sendMessageToChannelInjectionToken);
sendMessageToChannel({ id: channelId }, data);
},
reload: () => {
@@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { sendMessageToChannelInjectionToken } from "../../../common/utils/channel/message-to-channel-injection-token";
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
import { rootFrameHasRenderedChannel } from "../../../common/root-frame/root-frame-rendered-channel";
const broadcastThatRootFrameIsRenderedInjectable = getInjectable({
@@ -5,7 +5,6 @@
import { noop, chunk } from "lodash/fp";
import { createContainer, isInjectable } from "@ogre-tools/injectable";
import requestFromChannelInjectable from "./utils/channel/request-from-channel.injectable";
import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes";
import terminalSpawningPoolInjectable from "./components/dock/terminal/terminal-spawning-pool.injectable";
import hostedClusterIdInjectable from "./cluster-frame-context/hosted-cluster-id.injectable";
@@ -18,6 +17,8 @@ import type { GlobalOverride } from "@k8slens/test-utils";
import { setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
import { registerInjectableReact } from "@ogre-tools/injectable-react";
import { registerFeature } from "@k8slens/feature-core";
import { messagingFeature, testUtils as messagingTestUtils } from "@k8slens/messaging";
export const getDiForUnitTesting = () => {
const environment = "renderer";
@@ -27,6 +28,10 @@ export const getDiForUnitTesting = () => {
registerInjectableReact(di);
setLegacyGlobalDiForExtensionApi(di, environment);
runInAction(() => {
registerFeature(di, messagingFeature, messagingTestUtils.messagingFeatureForUnitTesting);
});
di.preventSideEffects();
runInAction(() => {
@@ -63,8 +68,6 @@ export const getDiForUnitTesting = () => {
di.override(requestAnimationFrameInjectable, () => (callback) => callback());
di.override(watchHistoryStateInjectable, () => () => () => {});
di.override(requestFromChannelInjectable, () => () => Promise.resolve(undefined as never));
getOverrideFsWithFakes()(di);
return di;
@@ -4,12 +4,12 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import { kubectlApplyAllChannel, kubectlApplyAllInjectionToken } from "../../common/kube-helpers/channels";
import requestFromChannelInjectable from "../utils/channel/request-from-channel.injectable";
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
const kubectlApplyAllInjectable = getInjectable({
id: "kubectl-apply-all",
instantiate: (di) => {
const requestFromChannel = di.inject(requestFromChannelInjectable);
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
return (req) => requestFromChannel(kubectlApplyAllChannel, req);
},
@@ -4,12 +4,12 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import { kubectlDeleteAllChannel, kubectlDeleteAllInjectionToken } from "../../common/kube-helpers/channels";
import requestFromChannelInjectable from "../utils/channel/request-from-channel.injectable";
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
const kubectlDeleteAllInjectable = getInjectable({
id: "kubectl-delete-all",
instantiate: (di) => {
const requestFromChannel = di.inject(requestFromChannelInjectable);
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
return (req) => requestFromChannel(kubectlDeleteAllChannel, req);
},
@@ -2,25 +2,25 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { InjectionToken } from "@ogre-tools/injectable";
import { getInjectable } from "@ogre-tools/injectable";
import currentlyInClusterFrameInjectable from "../routes/currently-in-cluster-frame.injectable";
import { appNavigationChannel } from "../../common/front-end-routing/app-navigation-channel";
import { clusterFrameNavigationChannel } from "../../common/front-end-routing/cluster-frame-navigation-channel";
import focusWindowInjectable from "./focus-window.injectable";
import { navigateToUrlInjectionToken } from "../../common/front-end-routing/navigate-to-url-injection-token";
import type { MessageChannel, MessageChannelListener } from "../../common/utils/channel/message-channel-listener-injection-token";
import { messageChannelListenerInjectionToken } from "../../common/utils/channel/message-channel-listener-injection-token";
import type { MessageChannel, MessageChannelListener } from "@k8slens/messaging";
import { messageChannelListenerInjectionToken } from "@k8slens/messaging";
const navigationChannelListenerInjectable = getInjectable({
id: "navigation-channel-listener",
instantiate: (di) => {
instantiate: (di): MessageChannelListener<MessageChannel<string>> => {
const currentlyInClusterFrame = di.inject(currentlyInClusterFrameInjectable);
const focusWindow = di.inject(focusWindowInjectable);
const navigateToUrl = di.inject(navigateToUrlInjectionToken);
return {
id: "navigation-channel-listener",
channel: currentlyInClusterFrame
? clusterFrameNavigationChannel
: appNavigationChannel,
@@ -34,7 +34,8 @@ const navigationChannelListenerInjectable = getInjectable({
},
};
},
injectionToken: messageChannelListenerInjectionToken as InjectionToken<MessageChannelListener<MessageChannel<string>>, void>,
injectionToken: messageChannelListenerInjectionToken,
});
export default navigationChannelListenerInjectable;
@@ -1,32 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import ipcRendererInjectable from "../ipc-renderer.injectable";
import { getInjectable } from "@ogre-tools/injectable";
import type { IpcRendererEvent } from "electron";
import { enlistMessageChannelListenerInjectionToken } from "../../../../common/utils/channel/enlist-message-channel-listener-injection-token";
const enlistMessageChannelListenerInjectable = getInjectable({
id: "enlist-message-channel-listener-for-renderer",
instantiate: (di) => {
const ipcRenderer = di.inject(ipcRendererInjectable);
return ({ channel, handler }) => {
const nativeCallback = (_: IpcRendererEvent, message: unknown) => {
handler(message);
};
ipcRenderer.on(channel.id, nativeCallback);
return () => {
ipcRenderer.off(channel.id, nativeCallback);
};
};
},
injectionToken: enlistMessageChannelListenerInjectionToken,
});
export default enlistMessageChannelListenerInjectable;
@@ -1,97 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getDiForUnitTesting } from "../../../getDiForUnitTesting";
import type { EnlistMessageChannelListener } from "../../../../common/utils/channel/enlist-message-channel-listener-injection-token";
import { enlistMessageChannelListenerInjectionToken } from "../../../../common/utils/channel/enlist-message-channel-listener-injection-token";
import type { IpcRendererEvent, IpcRenderer } from "electron";
import ipcRendererInjectable from "../ipc-renderer.injectable";
describe("enlist message channel listener in renderer", () => {
let enlistMessageChannelListener: EnlistMessageChannelListener;
let ipcRendererStub: IpcRenderer;
let onMock: jest.Mock;
let offMock: jest.Mock;
beforeEach(() => {
const di = getDiForUnitTesting();
onMock = jest.fn();
offMock = jest.fn();
ipcRendererStub = {
on: onMock,
off: offMock,
} as unknown as IpcRenderer;
di.override(ipcRendererInjectable, () => ipcRendererStub);
enlistMessageChannelListener = di.inject(
enlistMessageChannelListenerInjectionToken,
);
});
describe("when called", () => {
let handlerMock: jest.Mock;
let disposer: () => void;
beforeEach(() => {
handlerMock = jest.fn();
disposer = enlistMessageChannelListener({
channel: { id: "some-channel-id" },
handler: handlerMock,
});
});
it("does not call handler yet", () => {
expect(handlerMock).not.toHaveBeenCalled();
});
it("registers the listener", () => {
expect(onMock).toHaveBeenCalledWith(
"some-channel-id",
expect.any(Function),
);
});
it("does not de-register the listener yet", () => {
expect(offMock).not.toHaveBeenCalled();
});
describe("when message arrives", () => {
beforeEach(() => {
onMock.mock.calls[0][1]({} as IpcRendererEvent, "some-message");
});
it("calls the handler with the message", () => {
expect(handlerMock).toHaveBeenCalledWith("some-message");
});
it("when disposing the listener, de-registers the listener", () => {
disposer();
expect(offMock).toHaveBeenCalledWith("some-channel-id", expect.any(Function));
});
});
it("given number as message, when message arrives, calls the handler with the message", () => {
onMock.mock.calls[0][1]({} as IpcRendererEvent, 42);
expect(handlerMock).toHaveBeenCalledWith(42);
});
it("given boolean as message, when message arrives, calls the handler with the message", () => {
onMock.mock.calls[0][1]({} as IpcRendererEvent, true);
expect(handlerMock).toHaveBeenCalledWith(true);
});
it("given object as message, when message arrives, calls the handler with the message", () => {
onMock.mock.calls[0][1]({} as IpcRendererEvent, { some: "object" });
expect(handlerMock).toHaveBeenCalledWith({ some: "object" });
});
});
});
@@ -1,23 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { beforeFrameStartsSecondInjectionToken } from "../../../before-frame-starts/tokens";
import listeningOnMessageChannelsInjectable from "../../../../common/utils/channel/listening-on-message-channels.injectable";
const startListeningOfChannelsInjectable = getInjectable({
id: "start-listening-of-channels-renderer",
instantiate: (di) => ({
run: () => {
const listeningOfChannels = di.inject(listeningOnMessageChannelsInjectable);
listeningOfChannels.start();
},
}),
injectionToken: beforeFrameStartsSecondInjectionToken,
});
export default startListeningOfChannelsInjectable;
@@ -1,24 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import type { SendMessageToChannel } from "../../../common/utils/channel/message-to-channel-injection-token";
import { sendMessageToChannelInjectionToken } from "../../../common/utils/channel/message-to-channel-injection-token";
import sendToMainInjectable from "./send-to-main.injectable";
const messageToChannelInjectable = getInjectable({
id: "message-to-channel",
instantiate: (di) => {
const sendToMain = di.inject(sendToMainInjectable);
return ((channel, message) => {
sendToMain(channel.id, message);
}) as SendMessageToChannel;
},
injectionToken: sendMessageToChannelInjectionToken,
});
export default messageToChannelInjectable;
@@ -1,22 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import ipcRendererInjectable from "./ipc-renderer.injectable";
import type { RequestFromChannel } from "../../../common/utils/channel/request-from-channel-injection-token";
import { requestFromChannelInjectionToken } from "../../../common/utils/channel/request-from-channel-injection-token";
const requestFromChannelInjectable = getInjectable({
id: "request-from-channel",
instantiate: (di) => {
const ipcRenderer = di.inject(ipcRendererInjectable);
return ((channel, request) => ipcRenderer.invoke(channel.id, request)) as RequestFromChannel;
},
injectionToken: requestFromChannelInjectionToken,
});
export default requestFromChannelInjectable;
@@ -1,20 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import ipcRendererInjectable from "./ipc-renderer.injectable";
const sendToMainInjectable = getInjectable({
id: "send-to-main",
instantiate: (di) => {
const ipcRenderer = di.inject(ipcRendererInjectable);
return (channelId: string, message: any) => {
ipcRenderer.send(channelId, message);
};
},
});
export default sendToMainInjectable;
@@ -11,7 +11,7 @@ import writeJsonFileInjectable from "../../../common/fs/write-json-file.injectab
import loggerInjectable from "../../../common/logger.injectable";
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
import setupAppPathsInjectable from "../../app-paths/setup-app-paths.injectable";
import { beforeFrameStartsFirstInjectionToken } from "../../before-frame-starts/tokens";
import { beforeApplicationIsLoadingInjectionToken } from "@k8slens/application";
import hostedClusterIdInjectable from "../../cluster-frame-context/hosted-cluster-id.injectable";
import { storageHelperLogPrefix } from "../storage-helper";
import lensLocalStorageStateInjectable from "./state.injectable";
@@ -68,7 +68,7 @@ const initializeStateInjectable = getInjectable({
},
runAfter: setupAppPathsInjectable,
}),
injectionToken: beforeFrameStartsFirstInjectionToken,
injectionToken: beforeApplicationIsLoadingInjectionToken,
});
export default initializeStateInjectable;
@@ -4,14 +4,14 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import { resolveSystemProxyInjectionToken } from "../../../common/utils/resolve-system-proxy/resolve-system-proxy-injection-token";
import requestFromChannelInjectable from "../channel/request-from-channel.injectable";
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
import { resolveSystemProxyChannel } from "../../../common/utils/resolve-system-proxy/resolve-system-proxy-channel";
const resolveSystemProxyInjectable = getInjectable({
id: "resolve-system-proxy-for-renderer",
instantiate: (di) => {
const requestFromChannel = di.inject(requestFromChannelInjectable);
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
return async (url) => requestFromChannel(resolveSystemProxyChannel, url);
},
@@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
import { beforeFrameStartsSecondInjectionToken } from "../../before-frame-starts/tokens";
import { syncBoxInitialValueChannel } from "../../../common/utils/sync-box/channels";
import createSyncBoxStateInjectable from "../../../common/utils/sync-box/sync-box-state.injectable";
import { requestFromChannelInjectionToken } from "../../../common/utils/channel/request-from-channel-injection-token";
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
import { runInAction } from "mobx";
import { syncBoxInjectionToken } from "../../../common/utils/sync-box/sync-box-injection-token";
import assert from "assert";
@@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { createInitializableState } from "../../../common/initializable-state/create";
import { requestFromChannelInjectionToken } from "../../../common/utils/channel/request-from-channel-injection-token";
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
import { buildVersionChannel, buildVersionInjectionToken } from "../../../common/vars/build-semantic-version.injectable";
const buildVersionInjectable = createInitializableState({