-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIPC.ts
More file actions
75 lines (66 loc) · 2.42 KB
/
IPC.ts
File metadata and controls
75 lines (66 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* @module Effect/IPC
* @description
* Atomic IPC service using Effect-TS.
* Wraps Tauri IPC with typed effects and streams.
*
* @category Service
*/
// ============================================================================
// Re-exports from atomic modules
// ============================================================================
// Error types for backward compatibility
export class IPCInvokeError extends Error {
readonly _tag = "IPCInvokeError";
readonly _channel: string;
readonly _cause: unknown;
constructor(channel: string, cause: unknown) {
super(`IPC invoke failed on channel '${channel}': ${String(cause)}`);
this._channel = channel;
this._cause = cause;
Object.setPrototypeOf(this, IPCInvokeError.prototype);
}
override get name() { return "IPCInvokeError"; }
get channel() { return this._channel; }
override get cause() { return this._cause; }
}
export class IPCSendError extends Error {
readonly _tag = "IPCSendError";
readonly _channel: string;
readonly _cause: unknown;
constructor(channel: string, cause: unknown) {
super(`IPC send failed on channel '${channel}': ${String(cause)}`);
this._channel = channel;
this._cause = cause;
Object.setPrototypeOf(this, IPCSendError.prototype);
}
override get name() { return "IPCSendError"; }
get channel() { return this._channel; }
override get cause() { return this._cause; }
}
export class IPCSubscriptionError extends Error {
readonly _tag = "IPCSubscriptionError";
readonly _channel: string;
readonly _cause: unknown;
constructor(channel: string, cause: unknown) {
super(`IPC subscription failed on channel '${channel}': ${String(cause)}`);
this._channel = channel;
this._cause = cause;
Object.setPrototypeOf(this, IPCSubscriptionError.prototype);
}
override get name() { return "IPCSubscriptionError"; }
get channel() { return this._channel; }
override get cause() { return this._cause; }
}
// Service interface
export type { IPCService } from "./IPC/Interface/IPCService.js";
// Tag
export { IPCTag, IPC } from "./IPC/Tag/IPCTag.js";
// Implementations
export { TauriIPCLive } from "./IPC/Implementation/TauriIPC.js";
// Layers - import from index
import { default as IPCTauriLiveLayer, IPCElectronLive, MockIPCLive } from "./IPC/index.js";
export { IPCTauriLiveLayer, IPCElectronLive, MockIPCLive };
// Backward compatibility - export as IPCTauriLive
export { IPCTauriLiveLayer as IPCTauriLive };
export { MockIPCLive as IPCMockLive };