Skip to content
TypeScript

refactor(desktop): classify app exports (#10267)

Julius Marminge89dd9ab32b4a
diff --git a/apps/desktop/src/app/DesktopAppActivation.ts b/apps/desktop/src/app/DesktopAppActivation.ts
index f63fdffedae..ba00ecbf0ee 100644
--- a/apps/desktop/src/app/DesktopAppActivation.ts
+++ b/apps/desktop/src/app/DesktopAppActivation.ts
@@ -213,6 +213,7 @@ export class DesktopAppActivation extends Context.Service<
const { logWarning } = makeComponentLogger("desktop-app-activation");
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const desktopEnvironment = yield* DesktopEnvironment.DesktopEnvironment;
const desktopWindow = yield* DesktopWindow.DesktopWindow;
diff --git a/apps/desktop/src/app/DesktopAppIdentity.ts b/apps/desktop/src/app/DesktopAppIdentity.ts
index c5adb8574a5..9df14250f1a 100644
--- a/apps/desktop/src/app/DesktopAppIdentity.ts
+++ b/apps/desktop/src/app/DesktopAppIdentity.ts
@@ -66,6 +66,7 @@ export const resolveUserDataPath = Effect.gen(function* () {
: environment.path.join(environment.appDataDirectory, environment.userDataDirName);
}).pipe(Effect.withSpan("desktop.appIdentity.resolveUserDataPath"));
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const assets = yield* DesktopAssets.DesktopAssets;
const electronApp = yield* ElectronApp.ElectronApp;
diff --git a/apps/desktop/src/app/DesktopAssets.ts b/apps/desktop/src/app/DesktopAssets.ts
index f1c6f1bb8f1..9abb013d0f7 100644
--- a/apps/desktop/src/app/DesktopAssets.ts
+++ b/apps/desktop/src/app/DesktopAssets.ts
@@ -119,6 +119,7 @@ const resolveIconPath = Effect.fn("desktop.assets.resolveIconPath")(function* (
return yield* resolveResourcePath(`icon.${ext}`);
});
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const context = yield* Effect.context<
FileSystem.FileSystem | DesktopEnvironment.DesktopEnvironment
diff --git a/apps/desktop/src/app/DesktopClerk.ts b/apps/desktop/src/app/DesktopClerk.ts
index d3c99e5e1d2..57a042ca177 100644
--- a/apps/desktop/src/app/DesktopClerk.ts
+++ b/apps/desktop/src/app/DesktopClerk.ts
@@ -83,6 +83,7 @@ function createDesktopClerkBridge(stateDir: string, isDevelopment: boolean) {
});
}
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const environment = yield* DesktopEnvironment.DesktopEnvironment;
const electronApp = yield* ElectronApp.ElectronApp;
diff --git a/apps/desktop/src/app/DesktopConnectionCatalogStore.ts b/apps/desktop/src/app/DesktopConnectionCatalogStore.ts
index 5ec2edb595f..e94af7c16b3 100644
--- a/apps/desktop/src/app/DesktopConnectionCatalogStore.ts
+++ b/apps/desktop/src/app/DesktopConnectionCatalogStore.ts
@@ -375,6 +375,7 @@ const migrateSavedEnvironmentRecords = Effect.fn(
};
});
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const environment = yield* DesktopEnvironment.DesktopEnvironment;
const fileSystem = yield* FileSystem.FileSystem;
diff --git a/apps/desktop/src/app/DesktopLifecycle.ts b/apps/desktop/src/app/DesktopLifecycle.ts
index 0a0cc6dca93..6c7008a58ee 100644
--- a/apps/desktop/src/app/DesktopLifecycle.ts
+++ b/apps/desktop/src/app/DesktopLifecycle.ts
@@ -159,6 +159,7 @@ function quitFromSignal(
);
}
+/** @public Service construction is part of the canonical Effect module API. */
export const make = DesktopLifecycle.of({
relaunch: Effect.fn("desktop.lifecycle.relaunch")(function* (reason) {
const electronApp = yield* ElectronApp.ElectronApp;
diff --git a/apps/desktop/src/app/DesktopLinuxUrlHandler.ts b/apps/desktop/src/app/DesktopLinuxUrlHandler.ts
index e531a54dfce..626bf00eced 100644
--- a/apps/desktop/src/app/DesktopLinuxUrlHandler.ts
+++ b/apps/desktop/src/app/DesktopLinuxUrlHandler.ts
@@ -20,7 +20,7 @@ import { makeComponentLogger } from "./DesktopObservability.ts";
// our own handler entry pointing at the current AppImage and claim the
// scheme default via xdg-mime, exactly what the file manager's "set as
// default" checkbox would record in mimeapps.list.
-export const URL_HANDLER_DESKTOP_ENTRY_NAME = "t3code-url-handler.desktop";
+const URL_HANDLER_DESKTOP_ENTRY_NAME = "t3code-url-handler.desktop";
const { logInfo, logWarning } = makeComponentLogger("desktop-linux-url-handler");
@@ -92,6 +92,7 @@ export class DesktopLinuxUrlHandler extends Context.Service<
}
>()("@t3tools/desktop/app/DesktopLinuxUrlHandler") {}
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const environment = yield* DesktopEnvironment.DesktopEnvironment;
const fileSystem = yield* FileSystem.FileSystem;
diff --git a/apps/desktop/src/app/DesktopPreReadyPlatform.ts b/apps/desktop/src/app/DesktopPreReadyPlatform.ts
index 718f5411506..151d754fa2f 100644
--- a/apps/desktop/src/app/DesktopPreReadyPlatform.ts
+++ b/apps/desktop/src/app/DesktopPreReadyPlatform.ts
@@ -46,6 +46,7 @@ export class DesktopPreReadyElectronOptions extends Context.Service<
}
>()("@t3tools/desktop/app/DesktopPreReadyPlatform/DesktopPreReadyElectronOptions") {}
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const platform = yield* HostProcessPlatform;
return yield* Effect.sync((): DesktopPreReadyElectronOptions["Service"] => {
diff --git a/apps/desktop/src/shell/DesktopShellEnvironment.ts b/apps/desktop/src/shell/DesktopShellEnvironment.ts
index b4610eee5c8..90ad739dbed 100644
--- a/apps/desktop/src/shell/DesktopShellEnvironment.ts
+++ b/apps/desktop/src/shell/DesktopShellEnvironment.ts
@@ -533,6 +533,7 @@ const installShellEnvironment = (
return Effect.void;
};
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const environment = yield* DesktopEnvironment.DesktopEnvironment;
const fileSystem = yield* FileSystem.FileSystem;
diff --git a/apps/desktop/src/ssh/DesktopSshEnvironment.ts b/apps/desktop/src/ssh/DesktopSshEnvironment.ts
index 2c9ab0c03e4..3b135eb2508 100644
--- a/apps/desktop/src/ssh/DesktopSshEnvironment.ts
+++ b/apps/desktop/src/ssh/DesktopSshEnvironment.ts
@@ -128,6 +128,7 @@ const makePasswordPrompt = (
prompts.request(request).pipe(Effect.mapError(toSshPasswordPromptError)),
});
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const manager = yield* SshTunnel.SshEnvironmentManager;
const prompts = yield* DesktopSshPasswordPrompts.DesktopSshPasswordPrompts;
diff --git a/apps/desktop/src/ssh/DesktopSshPasswordPrompts.ts b/apps/desktop/src/ssh/DesktopSshPasswordPrompts.ts
index aa25d8135c7..31baabc6c35 100644
--- a/apps/desktop/src/ssh/DesktopSshPasswordPrompts.ts
+++ b/apps/desktop/src/ssh/DesktopSshPasswordPrompts.ts
@@ -222,6 +222,7 @@ const failPending = (
error: DesktopSshPasswordPromptRequestError,
) => Deferred.fail(pending.deferred, error).pipe(Effect.asVoid);
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.fn("desktop.sshPasswordPrompts.make")(function* (
options: DesktopSshPasswordPromptsOptions = {},
) {
diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts
index 344d135a102..a78a20b11b9 100644
--- a/apps/desktop/src/updates/DesktopUpdates.ts
+++ b/apps/desktop/src/updates/DesktopUpdates.ts
@@ -271,6 +271,7 @@ function isArm64HostRunningIntelBuild(runtimeInfo: DesktopRuntimeInfo): boolean
return runtimeInfo.hostArch === "arm64" && runtimeInfo.appArch === "x64";
}
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const config = yield* DesktopConfig.DesktopConfig;
const pool = yield* DesktopBackendPool.DesktopBackendPool;
diff --git a/apps/desktop/src/updates/remoteUpdateFlow.ts b/apps/desktop/src/updates/remoteUpdateFlow.ts
index 50b07731333..20043ba22cc 100644
--- a/apps/desktop/src/updates/remoteUpdateFlow.ts
+++ b/apps/desktop/src/updates/remoteUpdateFlow.ts
@@ -31,7 +31,7 @@ export const MAX_REMOTE_UPDATE_CHECKS = 2;
export const MAX_REMOTE_UPDATE_DOWNLOADS = 3;
/** Same predicate DesktopUpdates.installDownloadedUpdate uses for admission. */
-export function isInstallableDesktopUpdateState(state: DesktopUpdateState): boolean {
+function isInstallableDesktopUpdateState(state: DesktopUpdateState): boolean {
return (
state.downloadedVersion !== null &&
(state.status === "downloaded" ||
diff --git a/apps/desktop/src/updates/updateMachine.ts b/apps/desktop/src/updates/updateMachine.ts
index 2e9ed5199a3..85d8782ea66 100644
--- a/apps/desktop/src/updates/updateMachine.ts
+++ b/apps/desktop/src/updates/updateMachine.ts
@@ -5,13 +5,13 @@ import type {
DesktopUpdateState,
} from "@t3tools/contracts";
-export function nextStatusAfterDownloadFailure(
+function nextStatusAfterDownloadFailure(
currentState: DesktopUpdateState,
): DesktopUpdateState["status"] {
return currentState.availableVersion ? "available" : "error";
}
-export function getCanRetryAfterDownloadFailure(currentState: DesktopUpdateState): boolean {
+function getCanRetryAfterDownloadFailure(currentState: DesktopUpdateState): boolean {
return currentState.availableVersion !== null;
}
diff --git a/apps/desktop/src/window/DesktopApplicationMenu.ts b/apps/desktop/src/window/DesktopApplicationMenu.ts
index 66244534deb..3ef9318bd4a 100644
--- a/apps/desktop/src/window/DesktopApplicationMenu.ts
+++ b/apps/desktop/src/window/DesktopApplicationMenu.ts
@@ -103,6 +103,7 @@ const handleCheckForUpdatesMenuClick = Effect.gen(function* () {
yield* checkForUpdatesFromMenu;
}).pipe(Effect.withSpan("desktop.menu.handleCheckForUpdatesClick"));
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const electronApp = yield* ElectronApp.ElectronApp;
const electronMenu = yield* ElectronMenu.ElectronMenu;
diff --git a/apps/desktop/src/window/DesktopWindow.ts b/apps/desktop/src/window/DesktopWindow.ts
index d87c74428a9..f4c8debb8b1 100644
--- a/apps/desktop/src/window/DesktopWindow.ts
+++ b/apps/desktop/src/window/DesktopWindow.ts
@@ -278,6 +278,7 @@ function bindFirstRevealTrigger(
}
}
+/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
const environment = yield* DesktopEnvironment.DesktopEnvironment;
const assets = yield* DesktopAssets.DesktopAssets;