electron-effect-rpc 0.4.0 → 0.6.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.
- package/README.md +69 -20
- package/dist/contract.d.ts +24 -2
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +35 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/kit.d.ts +12 -8
- package/dist/kit.d.ts.map +1 -1
- package/dist/kit.js +20 -2
- package/dist/main.d.ts +3 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +230 -24
- package/dist/preload.d.ts +1 -0
- package/dist/preload.d.ts.map +1 -1
- package/dist/preload.js +29 -7
- package/dist/protocol.d.ts +26 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +43 -1
- package/dist/renderer.d.ts +5 -4
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +161 -9
- package/dist/types.d.ts +37 -15
- package/dist/types.d.ts.map +1 -1
- package/package.json +29 -23
package/dist/renderer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as S from "@effect/schema/Schema";
|
|
2
|
-
import { Cause, Effect, Exit } from "effect";
|
|
2
|
+
import { Cause, Effect, Exit, Stream } from "effect";
|
|
3
3
|
import { exitSchemaFor, isNoErrorSchema, } from "./contract.js";
|
|
4
|
-
import { formatUnknown, parseRpcResponseEnvelope, safelyCall, } from "./protocol.js";
|
|
4
|
+
import { extractStreamIdFromRaw, formatUnknown, isRecord, parseRpcResponseEnvelope, parseStreamFrame, safelyCall, } from "./protocol.js";
|
|
5
5
|
import { RpcDefectError, } from "./types.js";
|
|
6
6
|
function requireInvoke(options) {
|
|
7
7
|
if (!options?.invoke) {
|
|
@@ -18,6 +18,12 @@ function requireSubscribe(options) {
|
|
|
18
18
|
function rpcDefect(code, message, cause) {
|
|
19
19
|
return new RpcDefectError(code, message, cause);
|
|
20
20
|
}
|
|
21
|
+
function decodeNonEmptyError(schema, data) {
|
|
22
|
+
if (isNoErrorSchema(schema)) {
|
|
23
|
+
throw new Error("unreachable: caller must check isNoErrorSchema first");
|
|
24
|
+
}
|
|
25
|
+
return S.decodeUnknownSync(schema)(data);
|
|
26
|
+
}
|
|
21
27
|
function decodeLegacyExit(method, raw) {
|
|
22
28
|
return Effect.try({
|
|
23
29
|
try: () => S.decodeUnknownSync(exitSchemaFor(method))(raw),
|
|
@@ -62,9 +68,8 @@ export function createRpcClient(contract, options) {
|
|
|
62
68
|
if (isNoErrorSchema(method.err)) {
|
|
63
69
|
return Effect.fail(rpcDefect("noerror_contract_violation", `RPC ${method.name} received a failure for a method that declares NoError`, envelope.error));
|
|
64
70
|
}
|
|
65
|
-
const errorSchema = method.err;
|
|
66
71
|
return Effect.try({
|
|
67
|
-
try: () =>
|
|
72
|
+
try: () => decodeNonEmptyError(method.err, envelope.error.data),
|
|
68
73
|
catch: (cause) => {
|
|
69
74
|
safelyCall(diagnostics?.onDecodeFailure, {
|
|
70
75
|
scope: "rpc-response",
|
|
@@ -107,8 +112,7 @@ export function createRpcClient(contract, options) {
|
|
|
107
112
|
}
|
|
108
113
|
if (decodeMode === "dual") {
|
|
109
114
|
return decodeLegacyExit(method, raw).pipe(Effect.tapError((cause) => {
|
|
110
|
-
if (cause instanceof RpcDefectError &&
|
|
111
|
-
cause.code === "legacy_decode_failed") {
|
|
115
|
+
if (cause instanceof RpcDefectError && cause.code === "legacy_decode_failed") {
|
|
112
116
|
return Effect.sync(() => safelyCall(diagnostics?.onProtocolError, {
|
|
113
117
|
method: method.name,
|
|
114
118
|
response: raw,
|
|
@@ -130,9 +134,7 @@ export function createRpcClient(contract, options) {
|
|
|
130
134
|
const clientRecord = client;
|
|
131
135
|
for (const method of contract.methods) {
|
|
132
136
|
const caller = (...args) => {
|
|
133
|
-
const payload = args.length === 0
|
|
134
|
-
? {}
|
|
135
|
-
: args[0];
|
|
137
|
+
const payload = args.length === 0 ? {} : args[0];
|
|
136
138
|
return call(method, payload);
|
|
137
139
|
};
|
|
138
140
|
clientRecord[method.name] = caller;
|
|
@@ -221,4 +223,154 @@ export function createEventSubscriber(contract, options) {
|
|
|
221
223
|
dispose,
|
|
222
224
|
};
|
|
223
225
|
}
|
|
226
|
+
function isStreamStartedResponse(value) {
|
|
227
|
+
if (!isRecord(value))
|
|
228
|
+
return false;
|
|
229
|
+
if (value.type === "success" && isRecord(value.data)) {
|
|
230
|
+
return value.data.type === "stream_started";
|
|
231
|
+
}
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
export function createStreamRpcClient(contract, options) {
|
|
235
|
+
const invoke = options.invoke;
|
|
236
|
+
const onStreamFrame = options.onStreamFrame;
|
|
237
|
+
const diagnostics = options.diagnostics;
|
|
238
|
+
const frameDispatcher = new Map();
|
|
239
|
+
// Set up central frame listener
|
|
240
|
+
const centralCleanup = onStreamFrame((raw) => {
|
|
241
|
+
const frame = parseStreamFrame(raw);
|
|
242
|
+
if (!frame) {
|
|
243
|
+
// Best-effort: extract streamId from malformed frame to fail the active stream
|
|
244
|
+
const rawStreamId = extractStreamIdFromRaw(raw);
|
|
245
|
+
if (rawStreamId) {
|
|
246
|
+
const handler = frameDispatcher.get(rawStreamId);
|
|
247
|
+
if (handler) {
|
|
248
|
+
handler.defect("Malformed stream frame received");
|
|
249
|
+
frameDispatcher.delete(rawStreamId);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
safelyCall(diagnostics?.onProtocolError, {
|
|
253
|
+
method: "stream-frame",
|
|
254
|
+
response: raw,
|
|
255
|
+
cause: null,
|
|
256
|
+
});
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const handler = frameDispatcher.get(frame.streamId);
|
|
260
|
+
if (!handler)
|
|
261
|
+
return; // stale frame for completed/cancelled stream
|
|
262
|
+
switch (frame.type) {
|
|
263
|
+
case "data":
|
|
264
|
+
handler.data(frame.payload);
|
|
265
|
+
break;
|
|
266
|
+
case "end":
|
|
267
|
+
handler.end();
|
|
268
|
+
frameDispatcher.delete(frame.streamId);
|
|
269
|
+
break;
|
|
270
|
+
case "error":
|
|
271
|
+
handler.error(frame.error);
|
|
272
|
+
frameDispatcher.delete(frame.streamId);
|
|
273
|
+
break;
|
|
274
|
+
case "defect":
|
|
275
|
+
handler.defect(frame.message);
|
|
276
|
+
frameDispatcher.delete(frame.streamId);
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
const streamMethods = contract.streamMethods ?? [];
|
|
281
|
+
const client = Object.create(null);
|
|
282
|
+
const clientRecord = client;
|
|
283
|
+
for (const method of streamMethods) {
|
|
284
|
+
const decodeChunk = S.decodeUnknownSync(method.chunk);
|
|
285
|
+
const encodeInput = S.encodeSync(method.req);
|
|
286
|
+
const decodeTypedError = isNoErrorSchema(method.err) ? null : S.decodeUnknownSync(method.err);
|
|
287
|
+
const caller = (...args) => {
|
|
288
|
+
const payload = args.length === 0 ? {} : args[0];
|
|
289
|
+
return Stream.asyncPush((emit) => Effect.gen(function* () {
|
|
290
|
+
const streamId = crypto.randomUUID();
|
|
291
|
+
// 1. Register in dispatch map BEFORE calling invoke
|
|
292
|
+
frameDispatcher.set(streamId, {
|
|
293
|
+
data: (rawPayload) => {
|
|
294
|
+
let decoded;
|
|
295
|
+
try {
|
|
296
|
+
decoded = decodeChunk(rawPayload);
|
|
297
|
+
}
|
|
298
|
+
catch (cause) {
|
|
299
|
+
const context = {
|
|
300
|
+
scope: "stream-chunk",
|
|
301
|
+
name: method.name,
|
|
302
|
+
payload: rawPayload,
|
|
303
|
+
cause,
|
|
304
|
+
};
|
|
305
|
+
safelyCall(diagnostics?.onDecodeFailure, context);
|
|
306
|
+
emit.fail(rpcDefect("stream_chunk_decode_failed", `Stream ${method.name} chunk decode failed: ${formatUnknown(cause)}`, cause));
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
emit.single(decoded);
|
|
310
|
+
},
|
|
311
|
+
end: () => emit.end(),
|
|
312
|
+
error: (err) => {
|
|
313
|
+
if (!decodeTypedError) {
|
|
314
|
+
emit.fail(rpcDefect("stream_error_decode_failed", `Stream ${method.name} received typed error but declares NoError`, err));
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
const decoded = decodeNonEmptyError(method.err, err.data);
|
|
319
|
+
emit.fail(decoded);
|
|
320
|
+
}
|
|
321
|
+
catch (cause) {
|
|
322
|
+
const errContext = {
|
|
323
|
+
scope: "stream-error",
|
|
324
|
+
name: method.name,
|
|
325
|
+
payload: err,
|
|
326
|
+
cause,
|
|
327
|
+
};
|
|
328
|
+
safelyCall(diagnostics?.onDecodeFailure, errContext);
|
|
329
|
+
emit.fail(rpcDefect("stream_error_decode_failed", `Stream ${method.name} error decode failed: ${formatUnknown(cause)}`, cause));
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
defect: (message) => emit.fail(rpcDefect("remote_defect", message, undefined)),
|
|
333
|
+
});
|
|
334
|
+
// 2. Register cleanup finalizer
|
|
335
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
336
|
+
frameDispatcher.delete(streamId);
|
|
337
|
+
}).pipe(Effect.andThen(Effect.tryPromise(() => invoke(`stream-cancel`, { streamId })).pipe(Effect.ignore))));
|
|
338
|
+
// 3. Encode input
|
|
339
|
+
const encodedInput = yield* Effect.try({
|
|
340
|
+
try: () => encodeInput(payload),
|
|
341
|
+
catch: (cause) => rpcDefect("request_encoding_failed", `Stream ${method.name} request encoding failed: ${formatUnknown(cause)}`, cause),
|
|
342
|
+
});
|
|
343
|
+
// 4. Initiate the stream on main
|
|
344
|
+
const response = yield* Effect.tryPromise({
|
|
345
|
+
try: () => invoke(`stream/${method.name}`, {
|
|
346
|
+
data: encodedInput,
|
|
347
|
+
streamId,
|
|
348
|
+
}),
|
|
349
|
+
catch: (cause) => rpcDefect("stream_invoke_failed", `Stream ${method.name} invoke failed: ${formatUnknown(cause)}`, cause),
|
|
350
|
+
});
|
|
351
|
+
// 5. Validate handshake response
|
|
352
|
+
const envelope = parseRpcResponseEnvelope(response);
|
|
353
|
+
if (envelope?.type === "defect") {
|
|
354
|
+
return yield* Effect.fail(rpcDefect("remote_defect", envelope.message, envelope.cause));
|
|
355
|
+
}
|
|
356
|
+
if (!isStreamStartedResponse(response)) {
|
|
357
|
+
return yield* Effect.fail(rpcDefect("stream_handshake_invalid", `Stream ${method.name} unexpected handshake response`, response));
|
|
358
|
+
}
|
|
359
|
+
}), { bufferSize: 16, strategy: "dropping" });
|
|
360
|
+
};
|
|
361
|
+
clientRecord[method.name] = caller;
|
|
362
|
+
}
|
|
363
|
+
function dispose() {
|
|
364
|
+
// Fail all active streams so consumers don't hang
|
|
365
|
+
for (const [streamId, handler] of frameDispatcher) {
|
|
366
|
+
handler.defect("Stream client disposed");
|
|
367
|
+
frameDispatcher.delete(streamId);
|
|
368
|
+
}
|
|
369
|
+
centralCleanup();
|
|
370
|
+
}
|
|
371
|
+
return {
|
|
372
|
+
client,
|
|
373
|
+
dispose,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
224
376
|
export { RpcDefectError } from "./types.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type * as Effect from "effect/Effect";
|
|
2
2
|
import type * as Runtime from "effect/Runtime";
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
export type
|
|
3
|
+
import type * as Stream from "effect/Stream";
|
|
4
|
+
import type { AnyEvent, AnyMethod, AnyStreamMethod, ExtractMethod, ExtractStreamMethod, RpcContract, RpcError, RpcEventPayload, RpcInput, RpcOutput, StreamChunk, StreamError, StreamInput } from "./contract.ts";
|
|
5
|
+
export type { AnyEvent, AnyMethod, AnyStreamMethod, ErrorSchema, ExtractMethod, ExtractStreamMethod, RpcContract, RpcError, RpcEvent, RpcEventPayload, RpcInput, RpcMethod, RpcOutput, SchemaNoContext, StreamChunk, StreamError, StreamInput, StreamRpcMethod, } from "./contract.ts";
|
|
6
|
+
export type Implementations<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly AnyStreamMethod[]>, R = never> = {
|
|
6
7
|
readonly [Name in C["methods"][number]["name"]]: (input: RpcInput<ExtractMethod<C["methods"], Name>>) => Effect.Effect<RpcOutput<ExtractMethod<C["methods"], Name>>, RpcError<ExtractMethod<C["methods"], Name>>, R>;
|
|
7
8
|
};
|
|
8
|
-
type
|
|
9
|
-
|
|
9
|
+
export type StreamImplementations<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly AnyStreamMethod[]>, R = never> = {
|
|
10
|
+
readonly [Name in C["streamMethods"][number]["name"]]: (input: StreamInput<ExtractStreamMethod<C["streamMethods"], Name>>) => Stream.Stream<StreamChunk<ExtractStreamMethod<C["streamMethods"], Name>>, StreamError<ExtractStreamMethod<C["streamMethods"], Name>>, R>;
|
|
11
|
+
};
|
|
12
|
+
export type WebContentsLike = {
|
|
13
|
+
readonly id: number;
|
|
14
|
+
readonly isDestroyed: () => boolean;
|
|
15
|
+
readonly send: (channel: string, payload: unknown) => void;
|
|
16
|
+
};
|
|
17
|
+
type IsEmptyObject<T> = T extends object ? (keyof T extends never ? true : false) : false;
|
|
18
|
+
export type RpcDefectCode = "request_encoding_failed" | "invoke_failed" | "success_payload_decoding_failed" | "failure_payload_decoding_failed" | "noerror_contract_violation" | "invalid_response_envelope" | "legacy_decode_failed" | "remote_defect" | "stream_invoke_failed" | "stream_handshake_invalid" | "stream_chunk_decode_failed" | "stream_error_decode_failed";
|
|
10
19
|
export declare class RpcDefectError extends Error {
|
|
11
20
|
readonly code: RpcDefectCode;
|
|
12
21
|
readonly cause: unknown;
|
|
@@ -15,15 +24,20 @@ export declare class RpcDefectError extends Error {
|
|
|
15
24
|
}
|
|
16
25
|
export type RpcMethodError<M extends AnyMethod> = RpcError<M> | RpcDefectError;
|
|
17
26
|
export type RpcCaller<M extends AnyMethod> = IsEmptyObject<RpcInput<M>> extends true ? () => Effect.Effect<RpcOutput<M>, RpcMethodError<M>> : (input: RpcInput<M>) => Effect.Effect<RpcOutput<M>, RpcMethodError<M>>;
|
|
18
|
-
export type RpcClient<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[]>> = {
|
|
27
|
+
export type RpcClient<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly AnyStreamMethod[]>> = {
|
|
19
28
|
readonly [Name in C["methods"][number]["name"]]: RpcCaller<ExtractMethod<C["methods"], Name>>;
|
|
20
29
|
};
|
|
30
|
+
export type StreamMethodError<M extends AnyStreamMethod> = StreamError<M> | RpcDefectError;
|
|
31
|
+
export type StreamRpcCaller<M extends AnyStreamMethod> = IsEmptyObject<StreamInput<M>> extends true ? () => Stream.Stream<StreamChunk<M>, StreamMethodError<M>> : (input: StreamInput<M>) => Stream.Stream<StreamChunk<M>, StreamMethodError<M>>;
|
|
32
|
+
export type StreamRpcClient<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly AnyStreamMethod[]>> = {
|
|
33
|
+
readonly [Name in C["streamMethods"][number]["name"]]: StreamRpcCaller<ExtractStreamMethod<C["streamMethods"], Name>>;
|
|
34
|
+
};
|
|
21
35
|
export type ChannelPrefix = {
|
|
22
36
|
readonly rpc: string;
|
|
23
37
|
readonly event: string;
|
|
24
38
|
};
|
|
25
39
|
export declare const defaultChannelPrefix: ChannelPrefix;
|
|
26
|
-
export type DecodeFailureScope = "rpc-request" | "rpc-response" | "event-payload";
|
|
40
|
+
export type DecodeFailureScope = "rpc-request" | "rpc-response" | "event-payload" | "stream-request" | "stream-chunk" | "stream-error";
|
|
27
41
|
export type DecodeFailureContext = {
|
|
28
42
|
readonly scope: DecodeFailureScope;
|
|
29
43
|
readonly name: string;
|
|
@@ -73,13 +87,11 @@ export interface RpcEndpoint {
|
|
|
73
87
|
readonly dispose: () => void;
|
|
74
88
|
readonly isRunning: () => boolean;
|
|
75
89
|
}
|
|
76
|
-
|
|
77
|
-
* Runtime used to execute handler effects.
|
|
78
|
-
*/
|
|
79
|
-
export type RpcEndpointOptions<R = never> = {
|
|
90
|
+
export type RpcEndpointOptions<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly AnyStreamMethod[]> = RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly []>, R = never> = {
|
|
80
91
|
readonly channelPrefix?: ChannelPrefix;
|
|
81
92
|
readonly runtime: Runtime.Runtime<R>;
|
|
82
93
|
readonly diagnostics?: RpcEndpointDiagnostics;
|
|
94
|
+
readonly streamHandlers?: StreamImplementations<C, R>;
|
|
83
95
|
};
|
|
84
96
|
export type EventPublisherDiagnostics = {
|
|
85
97
|
readonly onDecodeFailure?: (context: DecodeFailureContext) => void;
|
|
@@ -94,11 +106,11 @@ export type RendererWindowLike = {
|
|
|
94
106
|
};
|
|
95
107
|
export type EventPublisherOptions = {
|
|
96
108
|
readonly channelPrefix?: ChannelPrefix;
|
|
97
|
-
readonly
|
|
109
|
+
readonly getWindows: () => ReadonlyArray<RendererWindowLike>;
|
|
98
110
|
readonly maxQueueSize?: number;
|
|
99
111
|
readonly diagnostics?: EventPublisherDiagnostics;
|
|
100
112
|
};
|
|
101
|
-
export interface RpcEventPublisher<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[]>> {
|
|
113
|
+
export interface RpcEventPublisher<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly AnyStreamMethod[]>> {
|
|
102
114
|
readonly publish: <E extends C["events"][number]>(event: E, payload: RpcEventPayload<E>) => Effect.Effect<void, never>;
|
|
103
115
|
readonly start: () => void;
|
|
104
116
|
readonly stop: () => void;
|
|
@@ -119,10 +131,20 @@ export type EventSubscriberOptions = {
|
|
|
119
131
|
readonly decodeMode?: EventDecodeMode;
|
|
120
132
|
readonly diagnostics?: EventSubscriberDiagnostics;
|
|
121
133
|
};
|
|
122
|
-
export interface EventSubscriber<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[]>> {
|
|
134
|
+
export interface EventSubscriber<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly AnyStreamMethod[]>> {
|
|
123
135
|
readonly subscribe: <E extends C["events"][number]>(event: E, handler: (payload: RpcEventPayload<E>) => void) => () => void;
|
|
124
136
|
readonly subscribeByName: (name: string, handler: (payload: unknown) => void) => () => void;
|
|
125
137
|
readonly dispose: () => void;
|
|
126
138
|
}
|
|
127
|
-
export type
|
|
139
|
+
export type OnStreamFrame = (listener: (frame: unknown) => void) => () => void;
|
|
140
|
+
export type StreamRpcClientOptions = {
|
|
141
|
+
readonly invoke: RpcInvoke;
|
|
142
|
+
readonly onStreamFrame: OnStreamFrame;
|
|
143
|
+
readonly diagnostics?: RpcClientDiagnostics;
|
|
144
|
+
};
|
|
145
|
+
export interface StreamRpcClientHandle<C extends RpcContract<readonly AnyMethod[], readonly AnyEvent[], readonly AnyStreamMethod[]>> {
|
|
146
|
+
readonly client: StreamRpcClient<C>;
|
|
147
|
+
readonly dispose: () => void;
|
|
148
|
+
}
|
|
149
|
+
export type { IpcBridge, IpcBridgeGlobal, IpcKit, IpcKitOptions, IpcMainHandle } from "./kit.ts";
|
|
128
150
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,eAAe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,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-effect-rpc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Typed IPC RPC for Electron, built on Effect and @effect/schema",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"effect",
|
|
7
|
+
"electron",
|
|
8
|
+
"ipc",
|
|
9
|
+
"rpc",
|
|
10
|
+
"schema",
|
|
11
|
+
"typed"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/joaoeira/electron-effect-rpc"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
5
21
|
"type": "module",
|
|
6
22
|
"exports": {
|
|
7
23
|
".": {
|
|
@@ -33,9 +49,6 @@
|
|
|
33
49
|
"default": "./dist/testing.js"
|
|
34
50
|
}
|
|
35
51
|
},
|
|
36
|
-
"files": [
|
|
37
|
-
"dist"
|
|
38
|
-
],
|
|
39
52
|
"scripts": {
|
|
40
53
|
"build": "tsc",
|
|
41
54
|
"prepublishOnly": "bun run build",
|
|
@@ -46,25 +59,11 @@
|
|
|
46
59
|
"test:stress": "bun test __tests__/stress.test.ts",
|
|
47
60
|
"test:full": "bun run test:unit && bun run test:types && bun run test:packaging && bun run test:integration && bun run test:stress",
|
|
48
61
|
"test": "bun test",
|
|
49
|
-
"typecheck": "tsc --noEmit"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"rpc",
|
|
55
|
-
"ipc",
|
|
56
|
-
"typed",
|
|
57
|
-
"schema"
|
|
58
|
-
],
|
|
59
|
-
"license": "MIT",
|
|
60
|
-
"repository": {
|
|
61
|
-
"type": "git",
|
|
62
|
-
"url": "https://github.com/joaoeira/electron-effect-rpc"
|
|
63
|
-
},
|
|
64
|
-
"peerDependencies": {
|
|
65
|
-
"@effect/schema": ">=0.69.0",
|
|
66
|
-
"effect": ">=3.0.0",
|
|
67
|
-
"electron": ">=28.0.0"
|
|
62
|
+
"typecheck": "tsc --noEmit",
|
|
63
|
+
"lint": "oxlint",
|
|
64
|
+
"lint:fix": "oxlint --fix",
|
|
65
|
+
"fmt": "oxfmt --write .",
|
|
66
|
+
"fmt:check": "oxfmt --check ."
|
|
68
67
|
},
|
|
69
68
|
"devDependencies": {
|
|
70
69
|
"@effect/schema": "^0.69.0",
|
|
@@ -72,6 +71,13 @@
|
|
|
72
71
|
"bun-types": "^1.1.0",
|
|
73
72
|
"effect": "^3.11.0",
|
|
74
73
|
"electron": "^38.0.0",
|
|
74
|
+
"oxfmt": "^0.34.0",
|
|
75
|
+
"oxlint": "^1.49.0",
|
|
75
76
|
"typescript": "^5.7.0"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"@effect/schema": ">=0.69.0",
|
|
80
|
+
"effect": ">=3.0.0",
|
|
81
|
+
"electron": ">=28.0.0"
|
|
76
82
|
}
|
|
77
83
|
}
|