| author | |
| committer | |
| log | 938b19a6bb2e361845cb5a497174d4062549c39c |
| tree | 6186ca27ae6ee3b061588661e26bca5c589915d8 |
| parent | 3b56dc17a5550de0f3ffd376ed2785cc12fbb96b |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: codex <codex@users.noreply.github.com>9 files changed, 76 insertions(+), 74 deletions(-)
apps/desktop/src/ipc/DesktopIpc.ts+16-14| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | import * as Context from "effect/Context"; |
| 2 | 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Layer from "effect/Layer"; | |
| 3 | 4 | import * as Schema from "effect/Schema"; |
| 4 | 5 | import * as Scope from "effect/Scope"; |
| 5 | 6 | |
| ... | ... | @@ -33,20 +34,19 @@ export interface DesktopSyncIpcMethod<E, R> { |
| 33 | 34 | readonly handler: () => Effect.Effect<unknown, E, R>; |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | export interface DesktopIpcShape { | |
| 37 | readonly handle: <E, R>( | |
| 38 | input: DesktopIpcMethod<E, R>, | |
| 39 | ) => Effect.Effect<void, never, R | Scope.Scope>; | |
| 40 | readonly handleSync: <E, R>( | |
| 41 | input: DesktopSyncIpcMethod<E, R>, | |
| 42 | ) => Effect.Effect<void, never, R | Scope.Scope>; | |
| 43 | } | |
| 44 | ||
| 45 | export class DesktopIpc extends Context.Service<DesktopIpc, DesktopIpcShape>()( | |
| 46 | "@t3tools/desktop/ipc/DesktopIpc", | |
| 47 | ) {} | |
| 48 | ||
| 49 | export const make = (ipcMain: DesktopIpcMain): DesktopIpcShape => | |
| 37 | export class DesktopIpc extends Context.Service< | |
| 38 | DesktopIpc, | |
| 39 | { | |
| 40 | readonly handle: <E, R>( | |
| 41 | input: DesktopIpcMethod<E, R>, | |
| 42 | ) => Effect.Effect<void, never, R | Scope.Scope>; | |
| 43 | readonly handleSync: <E, R>( | |
| 44 | input: DesktopSyncIpcMethod<E, R>, | |
| 45 | ) => Effect.Effect<void, never, R | Scope.Scope>; | |
| 46 | } | |
| 47 | >()("@t3tools/desktop/ipc/DesktopIpc") {} | |
| 48 | ||
| 49 | export const make = (ipcMain: DesktopIpcMain): DesktopIpc["Service"] => | |
| 50 | 50 | DesktopIpc.of({ |
| 51 | 51 | handle: Effect.fn("desktop.ipc.registerInvoke")(function* <E, R>({ |
| 52 | 52 | channel, |
| ... | ... | @@ -97,6 +97,8 @@ export const make = (ipcMain: DesktopIpcMain): DesktopIpcShape => |
| 97 | 97 | }), |
| 98 | 98 | }); |
| 99 | 99 | |
| 100 | export const layer = (ipcMain: DesktopIpcMain) => Layer.succeed(DesktopIpc, make(ipcMain)); | |
| 101 | ||
| 100 | 102 | /** |
| 101 | 103 | * Convenience helpers for creating IPC methods |
| 102 | 104 | */ |
apps/desktop/src/ipc/methods/clientSettings.ts+3-3| ... | ... | @@ -5,9 +5,9 @@ import * as Schema from "effect/Schema"; |
| 5 | 5 | |
| 6 | 6 | import * as DesktopClientSettings from "../../settings/DesktopClientSettings.ts"; |
| 7 | 7 | import * as IpcChannels from "../channels.ts"; |
| 8 | import { makeIpcMethod } from "../DesktopIpc.ts"; | |
| 8 | import * as DesktopIpc from "../DesktopIpc.ts"; | |
| 9 | 9 | |
| 10 | export const getClientSettings = makeIpcMethod({ | |
| 10 | export const getClientSettings = DesktopIpc.makeIpcMethod({ | |
| 11 | 11 | channel: IpcChannels.GET_CLIENT_SETTINGS_CHANNEL, |
| 12 | 12 | payload: Schema.Void, |
| 13 | 13 | result: Schema.NullOr(ClientSettingsSchema), |
| ... | ... | @@ -17,7 +17,7 @@ export const getClientSettings = makeIpcMethod({ |
| 17 | 17 | }), |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | export const setClientSettings = makeIpcMethod({ | |
| 20 | export const setClientSettings = DesktopIpc.makeIpcMethod({ | |
| 21 | 21 | channel: IpcChannels.SET_CLIENT_SETTINGS_CHANNEL, |
| 22 | 22 | payload: ClientSettingsSchema, |
| 23 | 23 | result: Schema.Void, |
apps/desktop/src/ipc/methods/connectionCatalog.ts+4-4| ... | ... | @@ -4,9 +4,9 @@ import * as Schema from "effect/Schema"; |
| 4 | 4 | |
| 5 | 5 | import * as DesktopConnectionCatalogStore from "../../app/DesktopConnectionCatalogStore.ts"; |
| 6 | 6 | import * as IpcChannels from "../channels.ts"; |
| 7 | import { makeIpcMethod } from "../DesktopIpc.ts"; | |
| 7 | import * as DesktopIpc from "../DesktopIpc.ts"; | |
| 8 | 8 | |
| 9 | export const getConnectionCatalog = makeIpcMethod({ | |
| 9 | export const getConnectionCatalog = DesktopIpc.makeIpcMethod({ | |
| 10 | 10 | channel: IpcChannels.GET_CONNECTION_CATALOG_CHANNEL, |
| 11 | 11 | payload: Schema.Void, |
| 12 | 12 | result: Schema.NullOr(Schema.String), |
| ... | ... | @@ -16,7 +16,7 @@ export const getConnectionCatalog = makeIpcMethod({ |
| 16 | 16 | }), |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | export const setConnectionCatalog = makeIpcMethod({ | |
| 19 | export const setConnectionCatalog = DesktopIpc.makeIpcMethod({ | |
| 20 | 20 | channel: IpcChannels.SET_CONNECTION_CATALOG_CHANNEL, |
| 21 | 21 | payload: Schema.String, |
| 22 | 22 | result: Schema.Boolean, |
| ... | ... | @@ -26,7 +26,7 @@ export const setConnectionCatalog = makeIpcMethod({ |
| 26 | 26 | }), |
| 27 | 27 | }); |
| 28 | 28 | |
| 29 | export const clearConnectionCatalog = makeIpcMethod({ | |
| 29 | export const clearConnectionCatalog = DesktopIpc.makeIpcMethod({ | |
| 30 | 30 | channel: IpcChannels.CLEAR_CONNECTION_CATALOG_CHANNEL, |
| 31 | 31 | payload: Schema.Void, |
| 32 | 32 | result: Schema.Void, |
apps/desktop/src/ipc/methods/preview.ts+23-23| ... | ... | @@ -27,7 +27,7 @@ import { pathToFileURL } from "node:url"; |
| 27 | 27 | import * as PreviewManager from "../../preview/Manager.ts"; |
| 28 | 28 | import { PREVIEW_WEBVIEW_PREFERENCES } from "../../preview/WebviewPreferences.ts"; |
| 29 | 29 | import * as IpcChannels from "../channels.ts"; |
| 30 | import { makeIpcMethod } from "../DesktopIpc.ts"; | |
| 30 | import * as DesktopIpc from "../DesktopIpc.ts"; | |
| 31 | 31 | |
| 32 | 32 | const broadcast = (channel: string, ...args: ReadonlyArray<unknown>): void => { |
| 33 | 33 | for (const window of BrowserWindow.getAllWindows()) { |
| ... | ... | @@ -52,7 +52,7 @@ export const installPreviewEventForwarding = Effect.fn( |
| 52 | 52 | }); |
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | export const createTab = makeIpcMethod({ | |
| 55 | export const createTab = DesktopIpc.makeIpcMethod({ | |
| 56 | 56 | channel: IpcChannels.PREVIEW_CREATE_TAB_CHANNEL, |
| 57 | 57 | payload: DesktopPreviewTabInputSchema, |
| 58 | 58 | result: Schema.Void, |
| ... | ... | @@ -62,7 +62,7 @@ export const createTab = makeIpcMethod({ |
| 62 | 62 | }), |
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | export const closeTab = makeIpcMethod({ | |
| 65 | export const closeTab = DesktopIpc.makeIpcMethod({ | |
| 66 | 66 | channel: IpcChannels.PREVIEW_CLOSE_TAB_CHANNEL, |
| 67 | 67 | payload: DesktopPreviewTabInputSchema, |
| 68 | 68 | result: Schema.Void, |
| ... | ... | @@ -72,7 +72,7 @@ export const closeTab = makeIpcMethod({ |
| 72 | 72 | }), |
| 73 | 73 | }); |
| 74 | 74 | |
| 75 | export const registerWebview = makeIpcMethod({ | |
| 75 | export const registerWebview = DesktopIpc.makeIpcMethod({ | |
| 76 | 76 | channel: IpcChannels.PREVIEW_REGISTER_WEBVIEW_CHANNEL, |
| 77 | 77 | payload: DesktopPreviewRegisterWebviewInputSchema, |
| 78 | 78 | result: Schema.Void, |
| ... | ... | @@ -82,7 +82,7 @@ export const registerWebview = makeIpcMethod({ |
| 82 | 82 | }), |
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | export const navigate = makeIpcMethod({ | |
| 85 | export const navigate = DesktopIpc.makeIpcMethod({ | |
| 86 | 86 | channel: IpcChannels.PREVIEW_NAVIGATE_CHANNEL, |
| 87 | 87 | payload: DesktopPreviewNavigateInputSchema, |
| 88 | 88 | result: Schema.Void, |
| ... | ... | @@ -100,7 +100,7 @@ const tabMethod = ( |
| 100 | 100 | tabId: string, |
| 101 | 101 | ) => Effect.Effect<void, PreviewManager.PreviewManagerError>, |
| 102 | 102 | ) => |
| 103 | makeIpcMethod({ | |
| 103 | DesktopIpc.makeIpcMethod({ | |
| 104 | 104 | channel, |
| 105 | 105 | payload: DesktopPreviewTabInputSchema, |
| 106 | 106 | result: Schema.Void, |
| ... | ... | @@ -166,7 +166,7 @@ export const stopRecording = tabMethod( |
| 166 | 166 | (manager, tabId) => manager.stopRecording(tabId), |
| 167 | 167 | ); |
| 168 | 168 | |
| 169 | export const clearCookies = makeIpcMethod({ | |
| 169 | export const clearCookies = DesktopIpc.makeIpcMethod({ | |
| 170 | 170 | channel: IpcChannels.PREVIEW_CLEAR_COOKIES_CHANNEL, |
| 171 | 171 | payload: Schema.Void, |
| 172 | 172 | result: Schema.Void, |
| ... | ... | @@ -176,7 +176,7 @@ export const clearCookies = makeIpcMethod({ |
| 176 | 176 | }), |
| 177 | 177 | }); |
| 178 | 178 | |
| 179 | export const clearCache = makeIpcMethod({ | |
| 179 | export const clearCache = DesktopIpc.makeIpcMethod({ | |
| 180 | 180 | channel: IpcChannels.PREVIEW_CLEAR_CACHE_CHANNEL, |
| 181 | 181 | payload: Schema.Void, |
| 182 | 182 | result: Schema.Void, |
| ... | ... | @@ -186,7 +186,7 @@ export const clearCache = makeIpcMethod({ |
| 186 | 186 | }), |
| 187 | 187 | }); |
| 188 | 188 | |
| 189 | export const getPreviewConfig = makeIpcMethod({ | |
| 189 | export const getPreviewConfig = DesktopIpc.makeIpcMethod({ | |
| 190 | 190 | channel: IpcChannels.PREVIEW_GET_CONFIG_CHANNEL, |
| 191 | 191 | payload: DesktopPreviewConfigInputSchema, |
| 192 | 192 | result: DesktopPreviewWebviewConfigSchema, |
| ... | ... | @@ -201,7 +201,7 @@ export const getPreviewConfig = makeIpcMethod({ |
| 201 | 201 | }), |
| 202 | 202 | }); |
| 203 | 203 | |
| 204 | export const setAnnotationTheme = makeIpcMethod({ | |
| 204 | export const setAnnotationTheme = DesktopIpc.makeIpcMethod({ | |
| 205 | 205 | channel: IpcChannels.PREVIEW_SET_ANNOTATION_THEME_CHANNEL, |
| 206 | 206 | payload: DesktopPreviewAnnotationThemeInputSchema, |
| 207 | 207 | result: Schema.Void, |
| ... | ... | @@ -211,7 +211,7 @@ export const setAnnotationTheme = makeIpcMethod({ |
| 211 | 211 | }), |
| 212 | 212 | }); |
| 213 | 213 | |
| 214 | export const pickElement = makeIpcMethod({ | |
| 214 | export const pickElement = DesktopIpc.makeIpcMethod({ | |
| 215 | 215 | channel: IpcChannels.PREVIEW_PICK_ELEMENT_CHANNEL, |
| 216 | 216 | payload: DesktopPreviewTabInputSchema, |
| 217 | 217 | result: Schema.NullOr(PreviewAnnotationPayloadSchema), |
| ... | ... | @@ -221,7 +221,7 @@ export const pickElement = makeIpcMethod({ |
| 221 | 221 | }), |
| 222 | 222 | }); |
| 223 | 223 | |
| 224 | export const captureScreenshot = makeIpcMethod({ | |
| 224 | export const captureScreenshot = DesktopIpc.makeIpcMethod({ | |
| 225 | 225 | channel: IpcChannels.PREVIEW_CAPTURE_SCREENSHOT_CHANNEL, |
| 226 | 226 | payload: DesktopPreviewTabInputSchema, |
| 227 | 227 | result: DesktopPreviewScreenshotArtifactSchema, |
| ... | ... | @@ -231,7 +231,7 @@ export const captureScreenshot = makeIpcMethod({ |
| 231 | 231 | }), |
| 232 | 232 | }); |
| 233 | 233 | |
| 234 | export const revealArtifact = makeIpcMethod({ | |
| 234 | export const revealArtifact = DesktopIpc.makeIpcMethod({ | |
| 235 | 235 | channel: IpcChannels.PREVIEW_REVEAL_ARTIFACT_CHANNEL, |
| 236 | 236 | payload: DesktopPreviewArtifactInputSchema, |
| 237 | 237 | result: Schema.Void, |
| ... | ... | @@ -241,7 +241,7 @@ export const revealArtifact = makeIpcMethod({ |
| 241 | 241 | }), |
| 242 | 242 | }); |
| 243 | 243 | |
| 244 | export const copyArtifactToClipboard = makeIpcMethod({ | |
| 244 | export const copyArtifactToClipboard = DesktopIpc.makeIpcMethod({ | |
| 245 | 245 | channel: IpcChannels.PREVIEW_COPY_ARTIFACT_CHANNEL, |
| 246 | 246 | payload: DesktopPreviewArtifactInputSchema, |
| 247 | 247 | result: Schema.Void, |
| ... | ... | @@ -251,7 +251,7 @@ export const copyArtifactToClipboard = makeIpcMethod({ |
| 251 | 251 | }), |
| 252 | 252 | }); |
| 253 | 253 | |
| 254 | export const automationStatus = makeIpcMethod({ | |
| 254 | export const automationStatus = DesktopIpc.makeIpcMethod({ | |
| 255 | 255 | channel: IpcChannels.PREVIEW_AUTOMATION_STATUS_CHANNEL, |
| 256 | 256 | payload: DesktopPreviewTabInputSchema, |
| 257 | 257 | result: PreviewAutomationStatus, |
| ... | ... | @@ -261,7 +261,7 @@ export const automationStatus = makeIpcMethod({ |
| 261 | 261 | }), |
| 262 | 262 | }); |
| 263 | 263 | |
| 264 | export const automationSnapshot = makeIpcMethod({ | |
| 264 | export const automationSnapshot = DesktopIpc.makeIpcMethod({ | |
| 265 | 265 | channel: IpcChannels.PREVIEW_AUTOMATION_SNAPSHOT_CHANNEL, |
| 266 | 266 | payload: DesktopPreviewTabInputSchema, |
| 267 | 267 | result: PreviewAutomationSnapshot, |
| ... | ... | @@ -271,7 +271,7 @@ export const automationSnapshot = makeIpcMethod({ |
| 271 | 271 | }), |
| 272 | 272 | }); |
| 273 | 273 | |
| 274 | export const automationClick = makeIpcMethod({ | |
| 274 | export const automationClick = DesktopIpc.makeIpcMethod({ | |
| 275 | 275 | channel: IpcChannels.PREVIEW_AUTOMATION_CLICK_CHANNEL, |
| 276 | 276 | payload: DesktopPreviewAutomationClickInputSchema, |
| 277 | 277 | result: Schema.Void, |
| ... | ... | @@ -281,7 +281,7 @@ export const automationClick = makeIpcMethod({ |
| 281 | 281 | }), |
| 282 | 282 | }); |
| 283 | 283 | |
| 284 | export const automationType = makeIpcMethod({ | |
| 284 | export const automationType = DesktopIpc.makeIpcMethod({ | |
| 285 | 285 | channel: IpcChannels.PREVIEW_AUTOMATION_TYPE_CHANNEL, |
| 286 | 286 | payload: DesktopPreviewAutomationTypeInputSchema, |
| 287 | 287 | result: Schema.Void, |
| ... | ... | @@ -291,7 +291,7 @@ export const automationType = makeIpcMethod({ |
| 291 | 291 | }), |
| 292 | 292 | }); |
| 293 | 293 | |
| 294 | export const automationPress = makeIpcMethod({ | |
| 294 | export const automationPress = DesktopIpc.makeIpcMethod({ | |
| 295 | 295 | channel: IpcChannels.PREVIEW_AUTOMATION_PRESS_CHANNEL, |
| 296 | 296 | payload: DesktopPreviewAutomationPressInputSchema, |
| 297 | 297 | result: Schema.Void, |
| ... | ... | @@ -301,7 +301,7 @@ export const automationPress = makeIpcMethod({ |
| 301 | 301 | }), |
| 302 | 302 | }); |
| 303 | 303 | |
| 304 | export const automationScroll = makeIpcMethod({ | |
| 304 | export const automationScroll = DesktopIpc.makeIpcMethod({ | |
| 305 | 305 | channel: IpcChannels.PREVIEW_AUTOMATION_SCROLL_CHANNEL, |
| 306 | 306 | payload: DesktopPreviewAutomationScrollInputSchema, |
| 307 | 307 | result: Schema.Void, |
| ... | ... | @@ -311,7 +311,7 @@ export const automationScroll = makeIpcMethod({ |
| 311 | 311 | }), |
| 312 | 312 | }); |
| 313 | 313 | |
| 314 | export const automationEvaluate = makeIpcMethod({ | |
| 314 | export const automationEvaluate = DesktopIpc.makeIpcMethod({ | |
| 315 | 315 | channel: IpcChannels.PREVIEW_AUTOMATION_EVALUATE_CHANNEL, |
| 316 | 316 | payload: DesktopPreviewAutomationEvaluateInputSchema, |
| 317 | 317 | result: Schema.Unknown, |
| ... | ... | @@ -321,7 +321,7 @@ export const automationEvaluate = makeIpcMethod({ |
| 321 | 321 | }), |
| 322 | 322 | }); |
| 323 | 323 | |
| 324 | export const automationWaitFor = makeIpcMethod({ | |
| 324 | export const automationWaitFor = DesktopIpc.makeIpcMethod({ | |
| 325 | 325 | channel: IpcChannels.PREVIEW_AUTOMATION_WAIT_FOR_CHANNEL, |
| 326 | 326 | payload: DesktopPreviewAutomationWaitForInputSchema, |
| 327 | 327 | result: Schema.Void, |
| ... | ... | @@ -331,7 +331,7 @@ export const automationWaitFor = makeIpcMethod({ |
| 331 | 331 | }), |
| 332 | 332 | }); |
| 333 | 333 | |
| 334 | export const saveRecording = makeIpcMethod({ | |
| 334 | export const saveRecording = DesktopIpc.makeIpcMethod({ | |
| 335 | 335 | channel: IpcChannels.PREVIEW_RECORDING_SAVE_CHANNEL, |
| 336 | 336 | payload: DesktopPreviewRecordingSaveInputSchema, |
| 337 | 337 | result: DesktopPreviewRecordingArtifactSchema, |
apps/desktop/src/ipc/methods/serverExposure.ts+5-5| ... | ... | @@ -9,14 +9,14 @@ import * as Schema from "effect/Schema"; |
| 9 | 9 | import * as DesktopLifecycle from "../../app/DesktopLifecycle.ts"; |
| 10 | 10 | import * as DesktopServerExposure from "../../backend/DesktopServerExposure.ts"; |
| 11 | 11 | import * as IpcChannels from "../channels.ts"; |
| 12 | import { makeIpcMethod } from "../DesktopIpc.ts"; | |
| 12 | import * as DesktopIpc from "../DesktopIpc.ts"; | |
| 13 | 13 | |
| 14 | 14 | const SetTailscaleServeEnabledInput = Schema.Struct({ |
| 15 | 15 | enabled: Schema.Boolean, |
| 16 | 16 | port: Schema.optionalKey(Schema.Number), |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | export const getServerExposureState = makeIpcMethod({ | |
| 19 | export const getServerExposureState = DesktopIpc.makeIpcMethod({ | |
| 20 | 20 | channel: IpcChannels.GET_SERVER_EXPOSURE_STATE_CHANNEL, |
| 21 | 21 | payload: Schema.Void, |
| 22 | 22 | result: DesktopServerExposureStateSchema, |
| ... | ... | @@ -26,7 +26,7 @@ export const getServerExposureState = makeIpcMethod({ |
| 26 | 26 | }), |
| 27 | 27 | }); |
| 28 | 28 | |
| 29 | export const setServerExposureMode = makeIpcMethod({ | |
| 29 | export const setServerExposureMode = DesktopIpc.makeIpcMethod({ | |
| 30 | 30 | channel: IpcChannels.SET_SERVER_EXPOSURE_MODE_CHANNEL, |
| 31 | 31 | payload: DesktopServerExposureModeSchema, |
| 32 | 32 | result: DesktopServerExposureStateSchema, |
| ... | ... | @@ -41,7 +41,7 @@ export const setServerExposureMode = makeIpcMethod({ |
| 41 | 41 | }), |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | export const setTailscaleServeEnabled = makeIpcMethod({ | |
| 44 | export const setTailscaleServeEnabled = DesktopIpc.makeIpcMethod({ | |
| 45 | 45 | channel: IpcChannels.SET_TAILSCALE_SERVE_ENABLED_CHANNEL, |
| 46 | 46 | payload: SetTailscaleServeEnabledInput, |
| 47 | 47 | result: DesktopServerExposureStateSchema, |
| ... | ... | @@ -58,7 +58,7 @@ export const setTailscaleServeEnabled = makeIpcMethod({ |
| 58 | 58 | }), |
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | export const getAdvertisedEndpoints = makeIpcMethod({ | |
| 61 | export const getAdvertisedEndpoints = DesktopIpc.makeIpcMethod({ | |
| 62 | 62 | channel: IpcChannels.GET_ADVERTISED_ENDPOINTS_CHANNEL, |
| 63 | 63 | payload: Schema.Void, |
| 64 | 64 | result: Schema.Array(AdvertisedEndpoint), |
apps/desktop/src/ipc/methods/sshEnvironment.ts+9-9| ... | ... | @@ -33,7 +33,7 @@ import * as Effect from "effect/Effect"; |
| 33 | 33 | import * as Schema from "effect/Schema"; |
| 34 | 34 | |
| 35 | 35 | import * as IpcChannels from "../channels.ts"; |
| 36 | import { makeIpcMethod } from "../DesktopIpc.ts"; | |
| 36 | import * as DesktopIpc from "../DesktopIpc.ts"; | |
| 37 | 37 | import * as DesktopSshEnvironment from "../../ssh/DesktopSshEnvironment.ts"; |
| 38 | 38 | import * as DesktopSshPasswordPrompts from "../../ssh/DesktopSshPasswordPrompts.ts"; |
| 39 | 39 | |
| ... | ... | @@ -107,7 +107,7 @@ const withLoopbackSshApi = |
| 107 | 107 | ), |
| 108 | 108 | ); |
| 109 | 109 | |
| 110 | export const discoverSshHosts = makeIpcMethod({ | |
| 110 | export const discoverSshHosts = DesktopIpc.makeIpcMethod({ | |
| 111 | 111 | channel: IpcChannels.DISCOVER_SSH_HOSTS_CHANNEL, |
| 112 | 112 | payload: Schema.Void, |
| 113 | 113 | result: Schema.Array(DesktopDiscoveredSshHostSchema), |
| ... | ... | @@ -117,7 +117,7 @@ export const discoverSshHosts = makeIpcMethod({ |
| 117 | 117 | }), |
| 118 | 118 | }); |
| 119 | 119 | |
| 120 | export const ensureSshEnvironment = makeIpcMethod({ | |
| 120 | export const ensureSshEnvironment = DesktopIpc.makeIpcMethod({ | |
| 121 | 121 | channel: IpcChannels.ENSURE_SSH_ENVIRONMENT_CHANNEL, |
| 122 | 122 | payload: DesktopSshEnvironmentEnsureInputSchema, |
| 123 | 123 | result: DesktopSshEnvironmentEnsureResultSchema, |
| ... | ... | @@ -139,7 +139,7 @@ export const ensureSshEnvironment = makeIpcMethod({ |
| 139 | 139 | }), |
| 140 | 140 | }); |
| 141 | 141 | |
| 142 | export const disconnectSshEnvironment = makeIpcMethod({ | |
| 142 | export const disconnectSshEnvironment = DesktopIpc.makeIpcMethod({ | |
| 143 | 143 | channel: IpcChannels.DISCONNECT_SSH_ENVIRONMENT_CHANNEL, |
| 144 | 144 | payload: DesktopSshEnvironmentTargetSchema, |
| 145 | 145 | result: Schema.Void, |
| ... | ... | @@ -149,7 +149,7 @@ export const disconnectSshEnvironment = makeIpcMethod({ |
| 149 | 149 | }), |
| 150 | 150 | }); |
| 151 | 151 | |
| 152 | export const fetchSshEnvironmentDescriptor = makeIpcMethod({ | |
| 152 | export const fetchSshEnvironmentDescriptor = DesktopIpc.makeIpcMethod({ | |
| 153 | 153 | channel: IpcChannels.FETCH_SSH_ENVIRONMENT_DESCRIPTOR_CHANNEL, |
| 154 | 154 | payload: DesktopSshHttpBaseUrlInputSchema, |
| 155 | 155 | result: ExecutionEnvironmentDescriptor, |
| ... | ... | @@ -160,7 +160,7 @@ export const fetchSshEnvironmentDescriptor = makeIpcMethod({ |
| 160 | 160 | }), |
| 161 | 161 | }); |
| 162 | 162 | |
| 163 | export const bootstrapSshBearerSession = makeIpcMethod({ | |
| 163 | export const bootstrapSshBearerSession = DesktopIpc.makeIpcMethod({ | |
| 164 | 164 | channel: IpcChannels.BOOTSTRAP_SSH_BEARER_SESSION_CHANNEL, |
| 165 | 165 | payload: DesktopSshBearerBootstrapInputSchema, |
| 166 | 166 | result: AuthAccessTokenResult, |
| ... | ... | @@ -177,7 +177,7 @@ export const bootstrapSshBearerSession = makeIpcMethod({ |
| 177 | 177 | }), |
| 178 | 178 | }); |
| 179 | 179 | |
| 180 | export const fetchSshSessionState = makeIpcMethod({ | |
| 180 | export const fetchSshSessionState = DesktopIpc.makeIpcMethod({ | |
| 181 | 181 | channel: IpcChannels.FETCH_SSH_SESSION_STATE_CHANNEL, |
| 182 | 182 | payload: DesktopSshBearerRequestInputSchema, |
| 183 | 183 | result: AuthSessionState, |
| ... | ... | @@ -194,7 +194,7 @@ export const fetchSshSessionState = makeIpcMethod({ |
| 194 | 194 | }), |
| 195 | 195 | }); |
| 196 | 196 | |
| 197 | export const issueSshWebSocketTicket = makeIpcMethod({ | |
| 197 | export const issueSshWebSocketTicket = DesktopIpc.makeIpcMethod({ | |
| 198 | 198 | channel: IpcChannels.ISSUE_SSH_WEBSOCKET_TOKEN_CHANNEL, |
| 199 | 199 | payload: DesktopSshBearerRequestInputSchema, |
| 200 | 200 | result: AuthWebSocketTicketResult, |
| ... | ... | @@ -211,7 +211,7 @@ export const issueSshWebSocketTicket = makeIpcMethod({ |
| 211 | 211 | }), |
| 212 | 212 | }); |
| 213 | 213 | |
| 214 | export const resolveSshPasswordPrompt = makeIpcMethod({ | |
| 214 | export const resolveSshPasswordPrompt = DesktopIpc.makeIpcMethod({ | |
| 215 | 215 | channel: IpcChannels.RESOLVE_SSH_PASSWORD_PROMPT_CHANNEL, |
| 216 | 216 | payload: DesktopSshPasswordPromptResolutionInputSchema, |
| 217 | 217 | result: Schema.Void, |
apps/desktop/src/ipc/methods/updates.ts+6-6| ... | ... | @@ -9,9 +9,9 @@ import * as Schema from "effect/Schema"; |
| 9 | 9 | |
| 10 | 10 | import * as DesktopUpdates from "../../updates/DesktopUpdates.ts"; |
| 11 | 11 | import * as IpcChannels from "../channels.ts"; |
| 12 | import { makeIpcMethod } from "../DesktopIpc.ts"; | |
| 12 | import * as DesktopIpc from "../DesktopIpc.ts"; | |
| 13 | 13 | |
| 14 | export const getUpdateState = makeIpcMethod({ | |
| 14 | export const getUpdateState = DesktopIpc.makeIpcMethod({ | |
| 15 | 15 | channel: IpcChannels.UPDATE_GET_STATE_CHANNEL, |
| 16 | 16 | payload: Schema.Void, |
| 17 | 17 | result: DesktopUpdateStateSchema, |
| ... | ... | @@ -21,7 +21,7 @@ export const getUpdateState = makeIpcMethod({ |
| 21 | 21 | }), |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | export const setUpdateChannel = makeIpcMethod({ | |
| 24 | export const setUpdateChannel = DesktopIpc.makeIpcMethod({ | |
| 25 | 25 | channel: IpcChannels.UPDATE_SET_CHANNEL_CHANNEL, |
| 26 | 26 | payload: DesktopUpdateChannelSchema, |
| 27 | 27 | result: DesktopUpdateStateSchema, |
| ... | ... | @@ -31,7 +31,7 @@ export const setUpdateChannel = makeIpcMethod({ |
| 31 | 31 | }), |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | export const downloadUpdate = makeIpcMethod({ | |
| 34 | export const downloadUpdate = DesktopIpc.makeIpcMethod({ | |
| 35 | 35 | channel: IpcChannels.UPDATE_DOWNLOAD_CHANNEL, |
| 36 | 36 | payload: Schema.Void, |
| 37 | 37 | result: DesktopUpdateActionResultSchema, |
| ... | ... | @@ -41,7 +41,7 @@ export const downloadUpdate = makeIpcMethod({ |
| 41 | 41 | }), |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | export const installUpdate = makeIpcMethod({ | |
| 44 | export const installUpdate = DesktopIpc.makeIpcMethod({ | |
| 45 | 45 | channel: IpcChannels.UPDATE_INSTALL_CHANNEL, |
| 46 | 46 | payload: Schema.Void, |
| 47 | 47 | result: DesktopUpdateActionResultSchema, |
| ... | ... | @@ -51,7 +51,7 @@ export const installUpdate = makeIpcMethod({ |
| 51 | 51 | }), |
| 52 | 52 | }); |
| 53 | 53 | |
| 54 | export const checkForUpdate = makeIpcMethod({ | |
| 54 | export const checkForUpdate = DesktopIpc.makeIpcMethod({ | |
| 55 | 55 | channel: IpcChannels.UPDATE_CHECK_CHANNEL, |
| 56 | 56 | payload: Schema.Void, |
| 57 | 57 | result: DesktopUpdateCheckResultSchema, |
apps/desktop/src/ipc/methods/window.ts+9-9| ... | ... | @@ -18,7 +18,7 @@ import * as ElectronShell from "../../electron/ElectronShell.ts"; |
| 18 | 18 | import * as ElectronTheme from "../../electron/ElectronTheme.ts"; |
| 19 | 19 | import * as ElectronWindow from "../../electron/ElectronWindow.ts"; |
| 20 | 20 | import * as IpcChannels from "../channels.ts"; |
| 21 | import { makeIpcMethod, makeSyncIpcMethod } from "../DesktopIpc.ts"; | |
| 21 | import * as DesktopIpc from "../DesktopIpc.ts"; | |
| 22 | 22 | |
| 23 | 23 | const ContextMenuPosition = Schema.Struct({ |
| 24 | 24 | x: Schema.Number, |
| ... | ... | @@ -36,7 +36,7 @@ function toWebSocketBaseUrl(httpBaseUrl: URL): string { |
| 36 | 36 | return url.href; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | export const getAppBranding = makeSyncIpcMethod({ | |
| 39 | export const getAppBranding = DesktopIpc.makeSyncIpcMethod({ | |
| 40 | 40 | channel: IpcChannels.GET_APP_BRANDING_CHANNEL, |
| 41 | 41 | result: Schema.NullOr(DesktopAppBrandingSchema), |
| 42 | 42 | handler: Effect.fn("desktop.ipc.window.getAppBranding")(function* () { |
| ... | ... | @@ -45,7 +45,7 @@ export const getAppBranding = makeSyncIpcMethod({ |
| 45 | 45 | }), |
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | export const getLocalEnvironmentBootstrap = makeSyncIpcMethod({ | |
| 48 | export const getLocalEnvironmentBootstrap = DesktopIpc.makeSyncIpcMethod({ | |
| 49 | 49 | channel: IpcChannels.GET_LOCAL_ENVIRONMENT_BOOTSTRAP_CHANNEL, |
| 50 | 50 | result: Schema.NullOr(DesktopEnvironmentBootstrapSchema), |
| 51 | 51 | handler: Effect.fn("desktop.ipc.window.getLocalEnvironmentBootstrap")(function* () { |
| ... | ... | @@ -65,7 +65,7 @@ export const getLocalEnvironmentBootstrap = makeSyncIpcMethod({ |
| 65 | 65 | }), |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | export const getLocalEnvironmentBearerToken = makeIpcMethod({ | |
| 68 | export const getLocalEnvironmentBearerToken = DesktopIpc.makeIpcMethod({ | |
| 69 | 69 | channel: IpcChannels.GET_LOCAL_ENVIRONMENT_BEARER_TOKEN_CHANNEL, |
| 70 | 70 | payload: Schema.Void, |
| 71 | 71 | result: Schema.String, |
| ... | ... | @@ -75,7 +75,7 @@ export const getLocalEnvironmentBearerToken = makeIpcMethod({ |
| 75 | 75 | }), |
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | export const pickFolder = makeIpcMethod({ | |
| 78 | export const pickFolder = DesktopIpc.makeIpcMethod({ | |
| 79 | 79 | channel: IpcChannels.PICK_FOLDER_CHANNEL, |
| 80 | 80 | payload: Schema.UndefinedOr(PickFolderOptionsSchema), |
| 81 | 81 | result: Schema.NullOr(Schema.String), |
| ... | ... | @@ -91,7 +91,7 @@ export const pickFolder = makeIpcMethod({ |
| 91 | 91 | }), |
| 92 | 92 | }); |
| 93 | 93 | |
| 94 | export const confirm = makeIpcMethod({ | |
| 94 | export const confirm = DesktopIpc.makeIpcMethod({ | |
| 95 | 95 | channel: IpcChannels.CONFIRM_CHANNEL, |
| 96 | 96 | payload: Schema.String, |
| 97 | 97 | result: Schema.Boolean, |
| ... | ... | @@ -104,7 +104,7 @@ export const confirm = makeIpcMethod({ |
| 104 | 104 | }), |
| 105 | 105 | }); |
| 106 | 106 | |
| 107 | export const setTheme = makeIpcMethod({ | |
| 107 | export const setTheme = DesktopIpc.makeIpcMethod({ | |
| 108 | 108 | channel: IpcChannels.SET_THEME_CHANNEL, |
| 109 | 109 | payload: DesktopThemeSchema, |
| 110 | 110 | result: Schema.Void, |
| ... | ... | @@ -114,7 +114,7 @@ export const setTheme = makeIpcMethod({ |
| 114 | 114 | }), |
| 115 | 115 | }); |
| 116 | 116 | |
| 117 | export const showContextMenu = makeIpcMethod({ | |
| 117 | export const showContextMenu = DesktopIpc.makeIpcMethod({ | |
| 118 | 118 | channel: IpcChannels.CONTEXT_MENU_CHANNEL, |
| 119 | 119 | payload: ContextMenuInput, |
| 120 | 120 | result: Schema.NullOr(Schema.String), |
| ... | ... | @@ -135,7 +135,7 @@ export const showContextMenu = makeIpcMethod({ |
| 135 | 135 | }), |
| 136 | 136 | }); |
| 137 | 137 | |
| 138 | export const openExternal = makeIpcMethod({ | |
| 138 | export const openExternal = DesktopIpc.makeIpcMethod({ | |
| 139 | 139 | channel: IpcChannels.OPEN_EXTERNAL_CHANNEL, |
| 140 | 140 | payload: Schema.String, |
| 141 | 141 | result: Schema.Boolean, |
apps/desktop/src/main.ts+1-1| ... | ... | @@ -109,7 +109,7 @@ const electronLayer = Layer.mergeAll( |
| 109 | 109 | ElectronTheme.layer, |
| 110 | 110 | ElectronUpdater.layer, |
| 111 | 111 | ElectronWindow.layer, |
| 112 | Layer.succeed(DesktopIpc.DesktopIpc, DesktopIpc.make(Electron.ipcMain)), | |
| 112 | DesktopIpc.layer(Electron.ipcMain), | |
| 113 | 113 | ); |
| 114 | 114 | |
| 115 | 115 | const desktopFoundationLayer = Layer.mergeAll( |