@igoforth/ws-rpc 1.1.0 → 1.1.1
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 +3 -3
- package/dist/adapters/client.d.ts +9 -9
- package/dist/adapters/cloudflare-do.d.ts +7 -7
- package/dist/adapters/index.d.ts +7 -7
- package/dist/adapters/server.d.ts +7 -7
- package/dist/adapters/types.d.ts +9 -9
- package/dist/codecs/cbor.d.ts +2 -2
- package/dist/codecs/factory.d.ts +2 -2
- package/dist/codecs/index.d.ts +3 -3
- package/dist/codecs/json.d.ts +3 -3
- package/dist/codecs/msgpack.d.ts +2 -2
- package/dist/{default-DOftsqyK.d.ts → default-DY19RYXA.d.ts} +6 -6
- package/dist/{factory-BGezZgAP.d.ts → factory-Dapk2aA3.d.ts} +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/{interface-CuTDe_Pq.d.ts → interface-CoVQ0KnO.d.ts} +1 -1
- package/dist/{json-BZzd4eNj.d.ts → json-ZQ5sjEbW.d.ts} +1 -1
- package/dist/{memory-BbN1TQZi.d.ts → memory-DSlJL2of.d.ts} +2 -2
- package/dist/peers/default.d.ts +6 -6
- package/dist/peers/durable.d.ts +7 -7
- package/dist/peers/index.d.ts +7 -7
- package/dist/{protocol-ipDMUaRc.d.ts → protocol-4AgHYQBE.d.ts} +1 -1
- package/dist/protocol.d.ts +4 -4
- package/dist/{schema-BPJJ9slm.d.ts → schema-BzaFWzeV.d.ts} +21 -21
- package/dist/schema.d.ts +1 -1
- package/dist/{server-BJm2ViQB.d.ts → server-Dp8DSL5I.d.ts} +7 -7
- package/dist/{sql-BpEL9udW.d.ts → sql-bFsho2vn.d.ts} +2 -2
- package/dist/storage/index.d.ts +6 -6
- package/dist/storage/interface.d.ts +2 -2
- package/dist/storage/memory.d.ts +5 -5
- package/dist/storage/sql.d.ts +5 -5
- package/dist/{types-BGM8eZe5.d.ts → types-NYBscFQZ.d.ts} +5 -5
- package/dist/types.d.ts +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -305,9 +305,9 @@ Real WebSocket RPC round-trip benchmarks (GitHub Actions runner, Node.js 22):
|
|
|
305
305
|
**Throughput (ops/sec):**
|
|
306
306
|
| Payload | JSON | MessagePack | CBOR | Fastest |
|
|
307
307
|
|---------|------|-------------|------|---------|
|
|
308
|
-
| Small |
|
|
309
|
-
| Medium |
|
|
310
|
-
| Large |
|
|
308
|
+
| Small | 0 | 0 | 0 | JSON |
|
|
309
|
+
| Medium | 0 | 0 | 0 | JSON |
|
|
310
|
+
| Large | 0 | 0 | 0 | JSON |
|
|
311
311
|
|
|
312
312
|
> Benchmarks run automatically via GitHub Actions. Results may vary based on runner load.
|
|
313
313
|
> Run locally with `pnpm bench` for your environment.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as InferEventData, h as StringKeys, m as RpcSchema, n as EventDef, p as Provider, t as Driver } from "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import { a as InferEventData, h as StringKeys, m as RpcSchema, n as EventDef, p as Provider, t as Driver } from "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import { u as RpcProtocol } from "../protocol-
|
|
6
|
-
import { a as IRpcOptions, c as WebSocketOptions, o as IWebSocket } from "../types-
|
|
7
|
-
import "../default-
|
|
5
|
+
import { u as RpcProtocol } from "../protocol-4AgHYQBE.js";
|
|
6
|
+
import { a as IRpcOptions, c as WebSocketOptions, o as IWebSocket } from "../types-NYBscFQZ.js";
|
|
7
|
+
import "../default-DY19RYXA.js";
|
|
8
8
|
import { t as ReconnectOptions } from "../reconnect-DbcN0R_1.js";
|
|
9
9
|
import { IAdapterHooks, IConnectionAdapter } from "./types.js";
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ interface RpcClientOptions<TLocalSchema extends RpcSchema, TRemoteSchema extends
|
|
|
17
17
|
/** WebSocket URL to connect to */
|
|
18
18
|
url: string;
|
|
19
19
|
/** Implementation of local methods */
|
|
20
|
-
provider: Provider<TLocalSchema>;
|
|
20
|
+
provider: Provider<TLocalSchema["methods"]>;
|
|
21
21
|
/** Auto-reconnect options (set to false to disable) */
|
|
22
22
|
reconnect?: ReconnectOptions | false;
|
|
23
23
|
/** Automatically connect when client is created (default: false) */
|
|
@@ -43,7 +43,7 @@ declare class RpcClient<TLocalSchema extends RpcSchema, TRemoteSchema extends Rp
|
|
|
43
43
|
readonly remoteSchema: TRemoteSchema;
|
|
44
44
|
readonly timeout: number;
|
|
45
45
|
readonly protocol?: RpcProtocol;
|
|
46
|
-
readonly provider: Provider<TLocalSchema>;
|
|
46
|
+
readonly provider: Provider<TLocalSchema["methods"]>;
|
|
47
47
|
readonly hooks: IAdapterHooks<TRemoteSchema>;
|
|
48
48
|
private readonly reconnectOptions;
|
|
49
49
|
private readonly createWebSocket;
|
|
@@ -68,7 +68,7 @@ declare class RpcClient<TLocalSchema extends RpcSchema, TRemoteSchema extends Rp
|
|
|
68
68
|
* @returns Driver proxy for calling remote methods
|
|
69
69
|
* @throws Error if not connected
|
|
70
70
|
*/
|
|
71
|
-
get driver(): Driver<TRemoteSchema>;
|
|
71
|
+
get driver(): Driver<TRemoteSchema["methods"]>;
|
|
72
72
|
/**
|
|
73
73
|
* Emit an event to the server (fire-and-forget)
|
|
74
74
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as InferEventData, h as StringKeys, m as RpcSchema, n as EventDef, p as Provider } from "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import { a as InferEventData, h as StringKeys, m as RpcSchema, n as EventDef, p as Provider } from "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import { a as IRpcOptions } from "../types-
|
|
7
|
-
import { t as RpcPeer } from "../default-
|
|
5
|
+
import "../protocol-4AgHYQBE.js";
|
|
6
|
+
import { a as IRpcOptions } from "../types-NYBscFQZ.js";
|
|
7
|
+
import { t as RpcPeer } from "../default-DY19RYXA.js";
|
|
8
8
|
import { IMultiAdapterHooks, IMultiConnectionAdapter } from "./types.js";
|
|
9
9
|
import { Constructor } from "type-fest";
|
|
10
10
|
import { Actor } from "@cloudflare/actors";
|
|
@@ -87,7 +87,7 @@ type RpcActorConstructor<TBase extends Constructor<Actor<unknown>>, TLocalSchema
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
declare function withRpc<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcSchema, TEnv, TBase extends Constructor<Actor<TEnv>> & {
|
|
90
|
-
prototype: Provider<TLocalSchema>;
|
|
90
|
+
prototype: Provider<TLocalSchema["methods"]>;
|
|
91
91
|
}>(Base: TBase, options: IRpcOptions<TLocalSchema, TRemoteSchema>): RpcActorConstructor<TBase, TLocalSchema, TRemoteSchema>;
|
|
92
92
|
//#endregion
|
|
93
93
|
export { IDOHooks, IRpcActorHooks, RpcActorConstructor, withRpc };
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import "../default-
|
|
5
|
+
import "../protocol-4AgHYQBE.js";
|
|
6
|
+
import "../types-NYBscFQZ.js";
|
|
7
|
+
import "../default-DY19RYXA.js";
|
|
8
8
|
import { n as calculateReconnectDelay, r as defaultReconnectOptions, t as ReconnectOptions } from "../reconnect-DbcN0R_1.js";
|
|
9
9
|
import { IAdapterHooks, IConnectionAdapter, IMultiAdapterHooks, IMultiConnectionAdapter, MultiCallOptions, MultiCallResult, MultiDriver } from "./types.js";
|
|
10
10
|
import { ConnectionState, RpcClient, RpcClientOptions } from "./client.js";
|
|
11
11
|
import { IDOHooks, IRpcActorHooks, RpcActorConstructor, withRpc } from "./cloudflare-do.js";
|
|
12
|
-
import { n as RpcServerOptions, r as MultiPeerBase, t as RpcServer } from "../server-
|
|
12
|
+
import { n as RpcServerOptions, r as MultiPeerBase, t as RpcServer } from "../server-Dp8DSL5I.js";
|
|
13
13
|
export { type ConnectionState, IAdapterHooks, IConnectionAdapter, type IDOHooks, IMultiAdapterHooks, IMultiConnectionAdapter, type IRpcActorHooks, MultiCallOptions, MultiCallResult, MultiDriver, MultiPeerBase, ReconnectOptions, type RpcActorConstructor, RpcClient, type RpcClientOptions, RpcServer, type RpcServerOptions, calculateReconnectDelay, defaultReconnectOptions, withRpc };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import "../default-
|
|
5
|
+
import "../protocol-4AgHYQBE.js";
|
|
6
|
+
import "../types-NYBscFQZ.js";
|
|
7
|
+
import "../default-DY19RYXA.js";
|
|
8
8
|
import "./types.js";
|
|
9
|
-
import { n as RpcServerOptions, t as RpcServer } from "../server-
|
|
9
|
+
import { n as RpcServerOptions, t as RpcServer } from "../server-Dp8DSL5I.js";
|
|
10
10
|
export { RpcServer, RpcServerOptions };
|
package/dist/adapters/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { f as MethodDef, h as StringKeys, i as EventHandler, l as InferOutput, m as RpcSchema, s as InferInput, t as Driver } from "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import { f as MethodDef, h as StringKeys, i as EventHandler, l as InferOutput, m as RpcSchema, s as InferInput, t as Driver } from "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import { a as IRpcOptions, n as IMethodController, t as IEventController } from "../types-
|
|
7
|
-
import { t as RpcPeer } from "../default-
|
|
5
|
+
import "../protocol-4AgHYQBE.js";
|
|
6
|
+
import { a as IRpcOptions, n as IMethodController, t as IEventController } from "../types-NYBscFQZ.js";
|
|
7
|
+
import { t as RpcPeer } from "../default-DY19RYXA.js";
|
|
8
8
|
import { n as calculateReconnectDelay, r as defaultReconnectOptions, t as ReconnectOptions } from "../reconnect-DbcN0R_1.js";
|
|
9
9
|
|
|
10
10
|
//#region src/adapters/types.d.ts
|
|
@@ -88,7 +88,7 @@ interface IAdapterHooks<TRemoteSchema extends RpcSchema> {
|
|
|
88
88
|
/** Called when reconnection fails after max attempts */
|
|
89
89
|
onReconnectFailed?(): void;
|
|
90
90
|
/** Called when receiving an event from the server */
|
|
91
|
-
onEvent?: EventHandler<TRemoteSchema>;
|
|
91
|
+
onEvent?: EventHandler<TRemoteSchema["events"]>;
|
|
92
92
|
}
|
|
93
93
|
interface IMultiAdapterHooks<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcSchema> {
|
|
94
94
|
/** Called when a peer connects */
|
|
@@ -96,14 +96,14 @@ interface IMultiAdapterHooks<TLocalSchema extends RpcSchema, TRemoteSchema exten
|
|
|
96
96
|
/** Called when a peer disconnects */
|
|
97
97
|
onDisconnect?(peer: RpcPeer<TLocalSchema, TRemoteSchema>): void;
|
|
98
98
|
/** Called when an event is received from a peer */
|
|
99
|
-
onEvent?: EventHandler<TRemoteSchema, [peer: RpcPeer<TLocalSchema, TRemoteSchema>]>;
|
|
99
|
+
onEvent?: EventHandler<TRemoteSchema["events"], [peer: RpcPeer<TLocalSchema, TRemoteSchema>]>;
|
|
100
100
|
/** Called when a peer encounters an error */
|
|
101
101
|
onError?(peer: RpcPeer<TLocalSchema, TRemoteSchema> | null, error: Error): void;
|
|
102
102
|
onClose?(): void;
|
|
103
103
|
}
|
|
104
104
|
interface IConnectionAdapter<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcSchema> extends IRpcOptions<TLocalSchema, TRemoteSchema>, IMethodController<TLocalSchema>, IEventController<TLocalSchema, TRemoteSchema> {
|
|
105
105
|
/** Driver for calling remote methods on connected peer */
|
|
106
|
-
readonly driver: Driver<TRemoteSchema>;
|
|
106
|
+
readonly driver: Driver<TRemoteSchema["methods"]>;
|
|
107
107
|
readonly hooks: IAdapterHooks<TRemoteSchema>;
|
|
108
108
|
}
|
|
109
109
|
/**
|
package/dist/codecs/cbor.d.ts
CHANGED
package/dist/codecs/factory.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import { a as WireCodec, c as createStringCodecFactory, i as StringCodec, l as isBinaryCodec, n as CodecFactory, o as WireData, r as CodecOptions, s as createBinaryCodecFactory, t as BinaryCodec, u as isStringCodec } from "../factory-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import { a as WireCodec, c as createStringCodecFactory, i as StringCodec, l as isBinaryCodec, n as CodecFactory, o as WireData, r as CodecOptions, s as createBinaryCodecFactory, t as BinaryCodec, u as isStringCodec } from "../factory-Dapk2aA3.js";
|
|
3
3
|
export { BinaryCodec, CodecFactory, CodecOptions, StringCodec, WireCodec, WireData, createBinaryCodecFactory, createStringCodecFactory, isBinaryCodec, isStringCodec };
|
package/dist/codecs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import { a as WireCodec, c as createStringCodecFactory, i as StringCodec, l as isBinaryCodec, n as CodecFactory, o as WireData, r as CodecOptions, s as createBinaryCodecFactory, t as BinaryCodec, u as isStringCodec } from "../factory-
|
|
3
|
-
import { n as createJsonCodec, t as JsonCodec } from "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import { a as WireCodec, c as createStringCodecFactory, i as StringCodec, l as isBinaryCodec, n as CodecFactory, o as WireData, r as CodecOptions, s as createBinaryCodecFactory, t as BinaryCodec, u as isStringCodec } from "../factory-Dapk2aA3.js";
|
|
3
|
+
import { n as createJsonCodec, t as JsonCodec } from "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
5
|
export { BinaryCodec, CodecFactory, CodecOptions, JsonCodec, StringCodec, WireCodec, WireData, createBinaryCodecFactory, createJsonCodec, createStringCodecFactory, isBinaryCodec, isStringCodec };
|
package/dist/codecs/json.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import { n as createJsonCodec, t as JsonCodec } from "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import { n as createJsonCodec, t as JsonCodec } from "../json-ZQ5sjEbW.js";
|
|
4
4
|
export { JsonCodec, createJsonCodec };
|
package/dist/codecs/msgpack.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as InferEventData, h as StringKeys, i as EventHandler, m as RpcSchema, n as EventDef, p as Provider, t as Driver } from "./schema-
|
|
2
|
-
import { g as WireInput, u as RpcProtocol } from "./protocol-
|
|
3
|
-
import { a as IRpcOptions, r as IMinWebSocket } from "./types-
|
|
1
|
+
import { a as InferEventData, h as StringKeys, i as EventHandler, m as RpcSchema, n as EventDef, p as Provider, t as Driver } from "./schema-BzaFWzeV.js";
|
|
2
|
+
import { g as WireInput, u as RpcProtocol } from "./protocol-4AgHYQBE.js";
|
|
3
|
+
import { a as IRpcOptions, r as IMinWebSocket } from "./types-NYBscFQZ.js";
|
|
4
4
|
|
|
5
5
|
//#region src/peers/default.d.ts
|
|
6
6
|
|
|
@@ -13,9 +13,9 @@ interface RpcPeerOptions<TLocalSchema extends RpcSchema, TRemoteSchema extends R
|
|
|
13
13
|
/** WebSocket instance */
|
|
14
14
|
ws: IMinWebSocket;
|
|
15
15
|
/** Implementation of local methods */
|
|
16
|
-
provider: Partial<Provider<TLocalSchema>>;
|
|
16
|
+
provider: Partial<Provider<TLocalSchema["methods"]>>;
|
|
17
17
|
/** Handler for incoming events */
|
|
18
|
-
onEvent?: EventHandler<TRemoteSchema> | undefined;
|
|
18
|
+
onEvent?: EventHandler<TRemoteSchema["events"]> | undefined;
|
|
19
19
|
/** Generate unique request IDs */
|
|
20
20
|
generateId?: (() => string) | undefined;
|
|
21
21
|
}
|
|
@@ -42,7 +42,7 @@ declare class RpcPeer<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcS
|
|
|
42
42
|
private requestCounter;
|
|
43
43
|
private closed;
|
|
44
44
|
/** Proxy for calling remote methods */
|
|
45
|
-
readonly driver: Driver<TRemoteSchema>;
|
|
45
|
+
readonly driver: Driver<TRemoteSchema["methods"]>;
|
|
46
46
|
constructor(options: RpcPeerOptions<TLocalSchema, TRemoteSchema>);
|
|
47
47
|
/**
|
|
48
48
|
* Create a proxy that allows calling remote methods
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { _ as method, a as InferEventData, c as InferMethods, f as MethodDef, g as event, i as EventHandler, l as InferOutput, m as RpcSchema, n as EventDef, o as InferEvents, p as Provider, s as InferInput, t as Driver } from "./schema-
|
|
2
|
-
import "./factory-
|
|
3
|
-
import "./json-
|
|
1
|
+
import { _ as method, a as InferEventData, c as InferMethods, f as MethodDef, g as event, i as EventHandler, l as InferOutput, m as RpcSchema, n as EventDef, o as InferEvents, p as Provider, s as InferInput, t as Driver } from "./schema-BzaFWzeV.js";
|
|
2
|
+
import "./factory-Dapk2aA3.js";
|
|
3
|
+
import "./json-ZQ5sjEbW.js";
|
|
4
4
|
import "./index-Be7jjS77.js";
|
|
5
|
-
import { _ as createProtocol, a as RpcEvent, c as RpcMessageCodec, d as RpcRequest, f as RpcRequestSchema, h as RpcWireCodec, i as RpcErrorSchema, l as RpcMessageSchema, m as RpcResponseSchema, n as RpcError$1, o as RpcEventSchema, p as RpcResponse, r as RpcErrorCodes, s as RpcMessage, t as JsonProtocol, u as RpcProtocol } from "./protocol-
|
|
6
|
-
import { a as IRpcOptions, c as WebSocketOptions, i as IRpcConnection, l as WebSocketReadyState, n as IMethodController, o as IWebSocket, r as IMinWebSocket, s as IWebSocketServer, t as IEventController, u as WebSocketServerOptions } from "./types-
|
|
5
|
+
import { _ as createProtocol, a as RpcEvent, c as RpcMessageCodec, d as RpcRequest, f as RpcRequestSchema, h as RpcWireCodec, i as RpcErrorSchema, l as RpcMessageSchema, m as RpcResponseSchema, n as RpcError$1, o as RpcEventSchema, p as RpcResponse, r as RpcErrorCodes, s as RpcMessage, t as JsonProtocol, u as RpcProtocol } from "./protocol-4AgHYQBE.js";
|
|
6
|
+
import { a as IRpcOptions, c as WebSocketOptions, i as IRpcConnection, l as WebSocketReadyState, n as IMethodController, o as IWebSocket, r as IMinWebSocket, s as IWebSocketServer, t as IEventController, u as WebSocketServerOptions } from "./types-NYBscFQZ.js";
|
|
7
7
|
import { n as calculateReconnectDelay, r as defaultReconnectOptions, t as ReconnectOptions } from "./reconnect-DbcN0R_1.js";
|
|
8
8
|
import { RpcConnectionClosed, RpcError, RpcMethodNotFoundError, RpcRemoteError, RpcTimeoutError, RpcValidationError } from "./errors.js";
|
|
9
|
-
import { a as PendingCallStorage, i as PendingCall, o as StorageMode, r as MaybePromise, s as SyncPendingCallStorage, t as AsyncPendingCallStorage } from "./interface-
|
|
10
|
-
import { t as MemoryPendingCallStorage } from "./memory-
|
|
11
|
-
import { t as SqlPendingCallStorage } from "./sql-
|
|
9
|
+
import { a as PendingCallStorage, i as PendingCall, o as StorageMode, r as MaybePromise, s as SyncPendingCallStorage, t as AsyncPendingCallStorage } from "./interface-CoVQ0KnO.js";
|
|
10
|
+
import { t as MemoryPendingCallStorage } from "./memory-DSlJL2of.js";
|
|
11
|
+
import { t as SqlPendingCallStorage } from "./sql-bFsho2vn.js";
|
|
12
12
|
import "./storage/index.js";
|
|
13
13
|
import "./utils/index.js";
|
|
14
14
|
export { type AsyncPendingCallStorage, type Driver, type EventDef, type EventHandler, type IEventController, type IMethodController, type IMinWebSocket, type IRpcConnection, type IRpcOptions, type IWebSocket, type IWebSocketServer, type InferEventData, type InferEvents, type InferInput, type InferMethods, type InferOutput, JsonProtocol, type MaybePromise, MemoryPendingCallStorage, type MethodDef, type PendingCall, type PendingCallStorage, type Provider, type ReconnectOptions, RpcConnectionClosed, RpcError, RpcErrorCodes, type RpcError$1 as RpcErrorMessage, RpcErrorSchema, type RpcEvent, RpcEventSchema, type RpcMessage, RpcMessageCodec, RpcMessageSchema, RpcMethodNotFoundError, type RpcProtocol, RpcRemoteError, type RpcRequest, RpcRequestSchema, type RpcResponse, RpcResponseSchema, type RpcSchema, RpcTimeoutError, RpcValidationError, type RpcWireCodec, SqlPendingCallStorage, type StorageMode, type SyncPendingCallStorage, type WebSocketOptions, WebSocketReadyState, type WebSocketServerOptions, calculateReconnectDelay, createProtocol, defaultReconnectOptions, event, method };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as StringCodec } from "./factory-
|
|
2
|
-
import { i as PendingCall, s as SyncPendingCallStorage } from "./interface-
|
|
1
|
+
import { i as StringCodec } from "./factory-Dapk2aA3.js";
|
|
2
|
+
import { i as PendingCall, s as SyncPendingCallStorage } from "./interface-CoVQ0KnO.js";
|
|
3
3
|
|
|
4
4
|
//#region src/storage/memory.d.ts
|
|
5
5
|
|
package/dist/peers/default.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import { n as RpcPeerOptions, t as RpcPeer } from "../default-
|
|
5
|
+
import "../protocol-4AgHYQBE.js";
|
|
6
|
+
import "../types-NYBscFQZ.js";
|
|
7
|
+
import { n as RpcPeerOptions, t as RpcPeer } from "../default-DY19RYXA.js";
|
|
8
8
|
export { RpcPeer, RpcPeerOptions };
|
package/dist/peers/durable.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { m as RpcSchema } from "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import { m as RpcSchema } from "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import { g as WireInput } from "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import { n as RpcPeerOptions, t as RpcPeer } from "../default-
|
|
8
|
-
import { i as PendingCall, s as SyncPendingCallStorage } from "../interface-
|
|
5
|
+
import { g as WireInput } from "../protocol-4AgHYQBE.js";
|
|
6
|
+
import "../types-NYBscFQZ.js";
|
|
7
|
+
import { n as RpcPeerOptions, t as RpcPeer } from "../default-DY19RYXA.js";
|
|
8
|
+
import { i as PendingCall, s as SyncPendingCallStorage } from "../interface-CoVQ0KnO.js";
|
|
9
9
|
|
|
10
10
|
//#region src/peers/durable.d.ts
|
|
11
11
|
|
package/dist/peers/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import { n as RpcPeerOptions, t as RpcPeer } from "../default-
|
|
8
|
-
import "../interface-
|
|
5
|
+
import "../protocol-4AgHYQBE.js";
|
|
6
|
+
import "../types-NYBscFQZ.js";
|
|
7
|
+
import { n as RpcPeerOptions, t as RpcPeer } from "../default-DY19RYXA.js";
|
|
8
|
+
import "../interface-CoVQ0KnO.js";
|
|
9
9
|
import { CallContext, DurableRpcPeer, DurableRpcPeerOptions } from "./durable.js";
|
|
10
10
|
export { type CallContext, DurableRpcPeer, type DurableRpcPeerOptions, RpcPeer, type RpcPeerOptions };
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./schema-
|
|
2
|
-
import "./factory-
|
|
3
|
-
import "./json-
|
|
1
|
+
import "./schema-BzaFWzeV.js";
|
|
2
|
+
import "./factory-Dapk2aA3.js";
|
|
3
|
+
import "./json-ZQ5sjEbW.js";
|
|
4
4
|
import "./index-Be7jjS77.js";
|
|
5
|
-
import { _ as createProtocol, a as RpcEvent, c as RpcMessageCodec, d as RpcRequest, f as RpcRequestSchema, g as WireInput, h as RpcWireCodec, i as RpcErrorSchema, l as RpcMessageSchema, m as RpcResponseSchema, n as RpcError, o as RpcEventSchema, p as RpcResponse, r as RpcErrorCodes, s as RpcMessage, t as JsonProtocol, u as RpcProtocol } from "./protocol-
|
|
5
|
+
import { _ as createProtocol, a as RpcEvent, c as RpcMessageCodec, d as RpcRequest, f as RpcRequestSchema, g as WireInput, h as RpcWireCodec, i as RpcErrorSchema, l as RpcMessageSchema, m as RpcResponseSchema, n as RpcError, o as RpcEventSchema, p as RpcResponse, r as RpcErrorCodes, s as RpcMessage, t as JsonProtocol, u as RpcProtocol } from "./protocol-4AgHYQBE.js";
|
|
6
6
|
export { JsonProtocol, RpcError, RpcErrorCodes, RpcErrorSchema, RpcEvent, RpcEventSchema, RpcMessage, RpcMessageCodec, RpcMessageSchema, RpcProtocol, RpcRequest, RpcRequestSchema, RpcResponse, RpcResponseSchema, RpcWireCodec, WireInput, createProtocol };
|
|
@@ -9,17 +9,17 @@ type LiteralStringUnion<T> = LiteralUnion<T, string>;
|
|
|
9
9
|
/**
|
|
10
10
|
* Method definition with input and output schemas
|
|
11
11
|
*/
|
|
12
|
-
interface MethodDef<TInput
|
|
12
|
+
interface MethodDef<TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType> {
|
|
13
13
|
_type: "method";
|
|
14
|
-
input: TInput
|
|
15
|
-
output: TOutput
|
|
14
|
+
input: TInput;
|
|
15
|
+
output: TOutput;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Event definition with data schema
|
|
19
19
|
*/
|
|
20
|
-
interface EventDef<TData
|
|
20
|
+
interface EventDef<TData extends z.ZodType = z.ZodType> {
|
|
21
21
|
_type: "event";
|
|
22
|
-
data: TData
|
|
22
|
+
data: TData;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Define an RPC method with input/output schemas
|
|
@@ -35,10 +35,10 @@ interface EventDef<TData$1 extends z.ZodType = z.ZodType> {
|
|
|
35
35
|
* });
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
declare function method<TInput
|
|
39
|
-
input: TInput
|
|
40
|
-
output: TOutput
|
|
41
|
-
}): MethodDef<TInput
|
|
38
|
+
declare function method<TInput extends z.ZodType, TOutput extends z.ZodType>(def: {
|
|
39
|
+
input: TInput;
|
|
40
|
+
output: TOutput;
|
|
41
|
+
}): MethodDef<TInput, TOutput>;
|
|
42
42
|
/**
|
|
43
43
|
* Define a fire-and-forget event with data schema
|
|
44
44
|
*
|
|
@@ -52,9 +52,9 @@ declare function method<TInput$1 extends z.ZodType, TOutput$1 extends z.ZodType>
|
|
|
52
52
|
* });
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
declare function event<TData
|
|
56
|
-
data: TData
|
|
57
|
-
}): EventDef<TData
|
|
55
|
+
declare function event<TData extends z.ZodType>(def: {
|
|
56
|
+
data: TData;
|
|
57
|
+
}): EventDef<TData>;
|
|
58
58
|
/**
|
|
59
59
|
* Schema definition containing methods and events
|
|
60
60
|
*/
|
|
@@ -67,42 +67,42 @@ interface RpcSchema {
|
|
|
67
67
|
*
|
|
68
68
|
* @typeParam T - A MethodDef type to extract the input from
|
|
69
69
|
*/
|
|
70
|
-
type InferInput<T
|
|
70
|
+
type InferInput<T extends MethodDef> = z.input<T["input"]>;
|
|
71
71
|
/**
|
|
72
72
|
* Infer the output type from a method definition
|
|
73
73
|
*
|
|
74
74
|
* @typeParam T - A MethodDef type to extract the output from
|
|
75
75
|
*/
|
|
76
|
-
type InferOutput<T
|
|
76
|
+
type InferOutput<T extends MethodDef> = z.output<T["output"]>;
|
|
77
77
|
/**
|
|
78
78
|
* Infer the data type from an event definition
|
|
79
79
|
*
|
|
80
80
|
* @typeParam T - An EventDef type to extract the data type from
|
|
81
81
|
*/
|
|
82
|
-
type InferEventData<T
|
|
82
|
+
type InferEventData<T extends EventDef> = z.infer<T["data"]>;
|
|
83
83
|
/**
|
|
84
84
|
* Infer method signatures from a schema's methods
|
|
85
85
|
*/
|
|
86
|
-
type InferMethods<T extends
|
|
86
|
+
type InferMethods<T extends Record<string, MethodDef>> = { [K in StringKeys<T>]: (input: z.input<T[K]["input"]>) => z.output<T[K]["output"]> | Promise<z.output<T[K]["output"]>> };
|
|
87
87
|
/**
|
|
88
88
|
* Infer event emitter signatures from a schema's events
|
|
89
89
|
*/
|
|
90
|
-
type InferEvents<T extends
|
|
90
|
+
type InferEvents<T extends Record<string, EventDef>> = { [K in StringKeys<T>]: InferEventData<T[K]> };
|
|
91
91
|
/**
|
|
92
92
|
* Provider type - implements the local methods defined in a schema
|
|
93
93
|
*/
|
|
94
|
-
type Provider<T extends RpcSchema> = InferMethods<T
|
|
94
|
+
type Provider<T extends RpcSchema["methods"]> = T extends Record<string, MethodDef> ? InferMethods<T> : {};
|
|
95
95
|
/**
|
|
96
96
|
* Driver type - proxy to call remote methods defined in a schema
|
|
97
97
|
*/
|
|
98
|
-
type Driver<T extends RpcSchema> = InferMethods<T
|
|
98
|
+
type Driver<T extends RpcSchema["methods"]> = T extends Record<string, MethodDef> ? InferMethods<T> : {};
|
|
99
99
|
/**
|
|
100
100
|
* Event handler type - handles incoming events
|
|
101
101
|
*/
|
|
102
|
-
type EventHandler<T extends RpcSchema, ExtraArgs extends any[] = []> = <K$1 extends StringKeys<T
|
|
102
|
+
type EventHandler<T extends RpcSchema["events"], ExtraArgs extends any[] = []> = <K$1 extends StringKeys<T>>(...args: [...ExtraArgs, event: K$1, data: T extends Record<string, EventDef> ? InferEventData<T[K$1]> : never]) => void;
|
|
103
103
|
/**
|
|
104
104
|
* Event emitter type - emits outgoing events
|
|
105
105
|
*/
|
|
106
|
-
type EventEmitter<T extends RpcSchema, ExtraArgs extends any[] = []> = <K$1 extends StringKeys<T
|
|
106
|
+
type EventEmitter<T extends RpcSchema["events"], ExtraArgs extends any[] = []> = <K$1 extends StringKeys<T>>(...args: [event: K$1, data: T extends Record<string, EventDef> ? InferEventData<T[K$1]> : never, ...ExtraArgs]) => void;
|
|
107
107
|
//#endregion
|
|
108
108
|
export { method as _, InferEventData as a, InferMethods as c, LiteralStringUnion as d, MethodDef as f, event as g, StringKeys as h, EventHandler as i, InferOutput as l, RpcSchema as m, EventDef as n, InferEvents as o, Provider as p, EventEmitter as r, InferInput as s, Driver as t, LiteralString as u };
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as method, a as InferEventData, c as InferMethods, d as LiteralStringUnion, f as MethodDef, g as event, h as StringKeys, i as EventHandler, l as InferOutput, m as RpcSchema, n as EventDef, o as InferEvents, p as Provider, r as EventEmitter, s as InferInput, t as Driver, u as LiteralString } from "./schema-
|
|
1
|
+
import { _ as method, a as InferEventData, c as InferMethods, d as LiteralStringUnion, f as MethodDef, g as event, h as StringKeys, i as EventHandler, l as InferOutput, m as RpcSchema, n as EventDef, o as InferEvents, p as Provider, r as EventEmitter, s as InferInput, t as Driver, u as LiteralString } from "./schema-BzaFWzeV.js";
|
|
2
2
|
export { Driver, EventDef, EventEmitter, EventHandler, InferEventData, InferEvents, InferInput, InferMethods, InferOutput, LiteralString, LiteralStringUnion, MethodDef, Provider, RpcSchema, StringKeys, event, method };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as InferEventData, h as StringKeys, m as RpcSchema, n as EventDef, p as Provider } from "./schema-
|
|
2
|
-
import { u as RpcProtocol } from "./protocol-
|
|
3
|
-
import { a as IRpcOptions, o as IWebSocket, r as IMinWebSocket, s as IWebSocketServer, u as WebSocketServerOptions } from "./types-
|
|
4
|
-
import { t as RpcPeer } from "./default-
|
|
1
|
+
import { a as InferEventData, h as StringKeys, m as RpcSchema, n as EventDef, p as Provider } from "./schema-BzaFWzeV.js";
|
|
2
|
+
import { u as RpcProtocol } from "./protocol-4AgHYQBE.js";
|
|
3
|
+
import { a as IRpcOptions, o as IWebSocket, r as IMinWebSocket, s as IWebSocketServer, u as WebSocketServerOptions } from "./types-NYBscFQZ.js";
|
|
4
|
+
import { t as RpcPeer } from "./default-DY19RYXA.js";
|
|
5
5
|
import { IMultiAdapterHooks, IMultiConnectionAdapter, MultiDriver } from "./adapters/types.js";
|
|
6
6
|
|
|
7
7
|
//#region src/adapters/multi-peer.d.ts
|
|
@@ -15,7 +15,7 @@ interface MultiPeerOptions<TLocalSchema extends RpcSchema, TRemoteSchema extends
|
|
|
15
15
|
/** Schema defining remote methods we can call */
|
|
16
16
|
remoteSchema: TRemoteSchema;
|
|
17
17
|
/** Implementation of local methods */
|
|
18
|
-
provider: Provider<TLocalSchema>;
|
|
18
|
+
provider: Provider<TLocalSchema["methods"]>;
|
|
19
19
|
/** Default timeout for RPC calls in ms */
|
|
20
20
|
timeout?: number;
|
|
21
21
|
/** Protocol for encoding/decoding messages */
|
|
@@ -43,7 +43,7 @@ declare abstract class MultiPeerBase<TLocalSchema extends RpcSchema, TRemoteSche
|
|
|
43
43
|
/** Remote schema */
|
|
44
44
|
readonly remoteSchema: TRemoteSchema;
|
|
45
45
|
/** Implementation of local methods */
|
|
46
|
-
readonly provider: Provider<TLocalSchema>;
|
|
46
|
+
readonly provider: Provider<TLocalSchema["methods"]>;
|
|
47
47
|
/** Default timeout for RPC calls */
|
|
48
48
|
readonly timeout: number;
|
|
49
49
|
/** Protocol for encoding/decoding messages */
|
|
@@ -148,7 +148,7 @@ declare abstract class MultiPeerBase<TLocalSchema extends RpcSchema, TRemoteSche
|
|
|
148
148
|
*/
|
|
149
149
|
interface RpcServerOptions<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcSchema> extends IRpcOptions<TLocalSchema, TRemoteSchema> {
|
|
150
150
|
/** Implementation of local methods */
|
|
151
|
-
provider: Provider<TLocalSchema>;
|
|
151
|
+
provider: Provider<TLocalSchema["methods"]>;
|
|
152
152
|
/** WebSocket server instance or options to create one */
|
|
153
153
|
wss: IWebSocketServer | WebSocketServerOptions;
|
|
154
154
|
/** WebSocket server constructor (required when passing options instead of server instance) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as StringCodec } from "./factory-
|
|
2
|
-
import { i as PendingCall, s as SyncPendingCallStorage } from "./interface-
|
|
1
|
+
import { i as StringCodec } from "./factory-Dapk2aA3.js";
|
|
2
|
+
import { i as PendingCall, s as SyncPendingCallStorage } from "./interface-CoVQ0KnO.js";
|
|
3
3
|
|
|
4
4
|
//#region src/storage/sql.d.ts
|
|
5
5
|
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import { a as PendingCallStorage, i as PendingCall, o as StorageMode, r as MaybePromise, s as SyncPendingCallStorage, t as AsyncPendingCallStorage } from "../interface-
|
|
6
|
-
import { n as MemoryPendingCallStorageOptions, t as MemoryPendingCallStorage } from "../memory-
|
|
7
|
-
import { n as SqlPendingCallStorageOptions, t as SqlPendingCallStorage } from "../sql-
|
|
5
|
+
import { a as PendingCallStorage, i as PendingCall, o as StorageMode, r as MaybePromise, s as SyncPendingCallStorage, t as AsyncPendingCallStorage } from "../interface-CoVQ0KnO.js";
|
|
6
|
+
import { n as MemoryPendingCallStorageOptions, t as MemoryPendingCallStorage } from "../memory-DSlJL2of.js";
|
|
7
|
+
import { n as SqlPendingCallStorageOptions, t as SqlPendingCallStorage } from "../sql-bFsho2vn.js";
|
|
8
8
|
export { type AsyncPendingCallStorage, type MaybePromise, MemoryPendingCallStorage, type MemoryPendingCallStorageOptions, type PendingCall, type PendingCallStorage, SqlPendingCallStorage, type SqlPendingCallStorageOptions, type StorageMode, type SyncPendingCallStorage };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import { a as PendingCallStorage, i as PendingCall, n as IContinuationHandler, o as StorageMode, r as MaybePromise, s as SyncPendingCallStorage, t as AsyncPendingCallStorage } from "../interface-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import { a as PendingCallStorage, i as PendingCall, n as IContinuationHandler, o as StorageMode, r as MaybePromise, s as SyncPendingCallStorage, t as AsyncPendingCallStorage } from "../interface-CoVQ0KnO.js";
|
|
3
3
|
export { AsyncPendingCallStorage, IContinuationHandler, MaybePromise, PendingCall, PendingCallStorage, StorageMode, SyncPendingCallStorage };
|
package/dist/storage/memory.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import "../interface-
|
|
6
|
-
import { n as MemoryPendingCallStorageOptions, t as MemoryPendingCallStorage } from "../memory-
|
|
5
|
+
import "../interface-CoVQ0KnO.js";
|
|
6
|
+
import { n as MemoryPendingCallStorageOptions, t as MemoryPendingCallStorage } from "../memory-DSlJL2of.js";
|
|
7
7
|
export { MemoryPendingCallStorage, MemoryPendingCallStorageOptions };
|
package/dist/storage/sql.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BzaFWzeV.js";
|
|
2
|
+
import "../factory-Dapk2aA3.js";
|
|
3
|
+
import "../json-ZQ5sjEbW.js";
|
|
4
4
|
import "../index-Be7jjS77.js";
|
|
5
|
-
import "../interface-
|
|
6
|
-
import { i as SqlStorageCursor, n as SqlPendingCallStorageOptions, r as SqlStorage, t as SqlPendingCallStorage } from "../sql-
|
|
5
|
+
import "../interface-CoVQ0KnO.js";
|
|
6
|
+
import { i as SqlStorageCursor, n as SqlPendingCallStorageOptions, r as SqlStorage, t as SqlPendingCallStorage } from "../sql-bFsho2vn.js";
|
|
7
7
|
export { SqlPendingCallStorage, SqlPendingCallStorageOptions, SqlStorage, SqlStorageCursor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as EventHandler, m as RpcSchema, p as Provider, r as EventEmitter } from "./schema-
|
|
2
|
-
import { g as WireInput, u as RpcProtocol } from "./protocol-
|
|
1
|
+
import { i as EventHandler, m as RpcSchema, p as Provider, r as EventEmitter } from "./schema-BzaFWzeV.js";
|
|
2
|
+
import { g as WireInput, u as RpcProtocol } from "./protocol-4AgHYQBE.js";
|
|
3
3
|
|
|
4
4
|
//#region src/types.d.ts
|
|
5
5
|
|
|
@@ -85,7 +85,7 @@ interface IRpcOptions<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcS
|
|
|
85
85
|
*/
|
|
86
86
|
interface IMethodController<TLocalSchema extends RpcSchema> {
|
|
87
87
|
/** Implementation of local methods */
|
|
88
|
-
readonly provider: Provider<TLocalSchema>;
|
|
88
|
+
readonly provider: Provider<TLocalSchema["methods"]>;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Interface for types that can emit and receive events
|
|
@@ -97,9 +97,9 @@ interface IMethodController<TLocalSchema extends RpcSchema> {
|
|
|
97
97
|
*/
|
|
98
98
|
interface IEventController<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcSchema, EmitArgs extends any[] = [], EventArgs extends any[] = []> {
|
|
99
99
|
/** Emit an event to the connected peer */
|
|
100
|
-
emit: EventEmitter<TLocalSchema, EmitArgs>;
|
|
100
|
+
emit: EventEmitter<TLocalSchema["events"], EmitArgs>;
|
|
101
101
|
/** Called when receiving an event from the connected peer */
|
|
102
|
-
onEvent?: EventHandler<TRemoteSchema, EventArgs>;
|
|
102
|
+
onEvent?: EventHandler<TRemoteSchema["events"], EventArgs>;
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* Base interface for RPC connections (1-1)
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./schema-
|
|
2
|
-
import "./factory-
|
|
3
|
-
import "./json-
|
|
1
|
+
import "./schema-BzaFWzeV.js";
|
|
2
|
+
import "./factory-Dapk2aA3.js";
|
|
3
|
+
import "./json-ZQ5sjEbW.js";
|
|
4
4
|
import "./index-Be7jjS77.js";
|
|
5
|
-
import "./protocol-
|
|
6
|
-
import { a as IRpcOptions, c as WebSocketOptions, i as IRpcConnection, l as WebSocketReadyState, n as IMethodController, o as IWebSocket, r as IMinWebSocket, s as IWebSocketServer, t as IEventController, u as WebSocketServerOptions } from "./types-
|
|
5
|
+
import "./protocol-4AgHYQBE.js";
|
|
6
|
+
import { a as IRpcOptions, c as WebSocketOptions, i as IRpcConnection, l as WebSocketReadyState, n as IMethodController, o as IWebSocket, r as IMinWebSocket, s as IWebSocketServer, t as IEventController, u as WebSocketServerOptions } from "./types-NYBscFQZ.js";
|
|
7
7
|
export { IEventController, IMethodController, IMinWebSocket, IRpcConnection, IRpcOptions, IWebSocket, IWebSocketServer, WebSocketOptions, WebSocketReadyState, WebSocketServerOptions };
|
package/package.json
CHANGED