@igoforth/ws-rpc 1.1.4 → 1.1.6
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 +0 -25
- package/dist/adapters/client.d.ts +7 -7
- package/dist/adapters/client.js +9 -11
- package/dist/adapters/cloudflare-do.d.ts +27 -10
- package/dist/adapters/cloudflare-do.js +16 -10
- package/dist/adapters/index.d.ts +7 -7
- package/dist/adapters/index.js +6 -5
- package/dist/adapters/server.d.ts +7 -7
- package/dist/adapters/server.js +7 -16
- package/dist/adapters/types.d.ts +6 -6
- 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-DwjN80sT.js → default-BXFwXL8g.js} +2 -2
- package/dist/{default-s4vvfkK4.d.ts → default-DYoo8pOJ.d.ts} +3 -3
- package/dist/{durable-BIdilnMO.js → durable-DUd5YAN_.js} +1 -1
- package/dist/{errors-C5IC-13X.js → errors-UHUwf6sp.js} +1 -1
- package/dist/errors.js +2 -2
- package/dist/{factory-uZbj772l.d.ts → factory-BEd16-Ao.d.ts} +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +2 -2
- package/dist/{interface-Dwr9zDR6.d.ts → interface-DYLQZys5.d.ts} +1 -1
- package/dist/{json-BBnW1n_D.d.ts → json-CDnAdySL.d.ts} +1 -1
- package/dist/{memory-CPEAGd76.d.ts → memory-DWpvxAue.d.ts} +2 -2
- package/dist/{multi-peer-T1uQHC-l.js → multi-peer-DuZtphz_.js} +13 -20
- package/dist/peers/default.d.ts +6 -6
- package/dist/peers/default.js +3 -3
- package/dist/peers/durable.d.ts +7 -7
- package/dist/peers/durable.js +4 -4
- package/dist/peers/index.d.ts +7 -7
- package/dist/peers/index.js +4 -4
- package/dist/{protocol-B6z2_jyb.d.ts → protocol-AvNp0_PF.d.ts} +3 -2
- package/dist/{protocol-C5QIKXey.js → protocol-BMv48vpU.js} +4 -1
- package/dist/protocol.d.ts +5 -5
- package/dist/protocol.js +2 -2
- package/dist/{schema-DVufxLYY.d.ts → schema-BPSDt2br.d.ts} +2 -2
- package/dist/schema.d.ts +1 -1
- package/dist/{server-Cp7xKF5w.d.ts → server-B2DZ33eC.d.ts} +5 -9
- package/dist/{sql-DYEHo09F.d.ts → sql-J3OVXInb.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-DTHyD7n1.d.ts → types-BO4jYJPi.d.ts} +14 -5
- package/dist/types.d.ts +6 -6
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -312,31 +312,6 @@ Real WebSocket RPC round-trip benchmarks (GitHub Actions runner, Node.js 22):
|
|
|
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.
|
|
314
314
|
|
|
315
|
-
## Multi-Peer Driver Results
|
|
316
|
-
|
|
317
|
-
When calling methods via `server.driver` or `this.driver` in a Durable Object, results are returned as an array:
|
|
318
|
-
|
|
319
|
-
```typescript
|
|
320
|
-
// Call all connected peers
|
|
321
|
-
const results = await server.driver.getData({});
|
|
322
|
-
|
|
323
|
-
// Each result contains the peer ID and success/error
|
|
324
|
-
for (const { id, result } of results) {
|
|
325
|
-
if (result.success) {
|
|
326
|
-
console.log(`Peer ${id} returned:`, result.value);
|
|
327
|
-
} else {
|
|
328
|
-
console.error(`Peer ${id} failed:`, result.error.message);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// Call specific peers
|
|
333
|
-
const singleResult = await server.driver.getData({}, { ids: "peer-123" });
|
|
334
|
-
const multiResult = await server.driver.getData({}, {
|
|
335
|
-
ids: ["peer-1", "peer-2"],
|
|
336
|
-
timeout: 5000,
|
|
337
|
-
});
|
|
338
|
-
```
|
|
339
|
-
|
|
340
315
|
## License
|
|
341
316
|
|
|
342
317
|
MIT
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as Provider, o as EventTuple, t as Driver, v as RpcSchema } from "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import { g as Provider, o as EventTuple, t as Driver, v as RpcSchema } from "../schema-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.js";
|
|
5
|
-
import { u as RpcProtocol } from "../protocol-
|
|
6
|
-
import { a as IRpcOptions,
|
|
7
|
-
import "../default-
|
|
5
|
+
import { u as RpcProtocol } from "../protocol-AvNp0_PF.js";
|
|
6
|
+
import { a as IRpcOptions, o as IWebSocket, u as WebSocketOptions } from "../types-BO4jYJPi.js";
|
|
7
|
+
import "../default-DYoo8pOJ.js";
|
|
8
8
|
import { t as ReconnectOptions } from "../reconnect-CYt5_8Xy.js";
|
|
9
9
|
import { IAdapterHooks, IConnectionAdapter } from "./types.js";
|
|
10
10
|
|
|
@@ -81,7 +81,7 @@ declare class RpcClient<TLocalSchema extends RpcSchema, TRemoteSchema extends Rp
|
|
|
81
81
|
* @returns Promise that resolves when connected
|
|
82
82
|
* @throws Error if connection fails
|
|
83
83
|
*/
|
|
84
|
-
connect(): Promise<void>;
|
|
84
|
+
connect(): void | Promise<void>;
|
|
85
85
|
/**
|
|
86
86
|
* Disconnect from the server
|
|
87
87
|
*
|
package/dist/adapters/client.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../factory-3ziwTuZe.js";
|
|
2
2
|
import "../json-Bshec-bZ.js";
|
|
3
3
|
import "../codecs-BmYG2d_U.js";
|
|
4
|
-
import "../protocol-
|
|
5
|
-
import "../errors-
|
|
4
|
+
import { u as isWireInput } from "../protocol-BMv48vpU.js";
|
|
5
|
+
import "../errors-UHUwf6sp.js";
|
|
6
6
|
import { t as WebSocketReadyState } from "../types-D_psiH09.js";
|
|
7
7
|
import { n as defaultReconnectOptions, t as calculateReconnectDelay } from "../reconnect-Cdr_3mjN.js";
|
|
8
|
-
import { t as RpcPeer } from "../default-
|
|
8
|
+
import { t as RpcPeer } from "../default-BXFwXL8g.js";
|
|
9
9
|
import "./types.js";
|
|
10
10
|
|
|
11
11
|
//#region src/adapters/client.ts
|
|
@@ -96,7 +96,7 @@ var RpcClient = class {
|
|
|
96
96
|
* @returns Promise that resolves when connected
|
|
97
97
|
* @throws Error if connection fails
|
|
98
98
|
*/
|
|
99
|
-
|
|
99
|
+
connect() {
|
|
100
100
|
if (this._state === "connected" || this._state === "connecting") return;
|
|
101
101
|
this.intentionalClose = false;
|
|
102
102
|
this._state = "connecting";
|
|
@@ -116,14 +116,13 @@ var RpcClient = class {
|
|
|
116
116
|
const onError = (event) => {
|
|
117
117
|
cleanup();
|
|
118
118
|
this._state = "disconnected";
|
|
119
|
-
reject(/* @__PURE__ */ new Error(`WebSocket connection failed: ${event}`));
|
|
119
|
+
reject(/* @__PURE__ */ new Error(`WebSocket connection failed: ${JSON.stringify(event)}`));
|
|
120
120
|
};
|
|
121
121
|
const onClose = (event) => {
|
|
122
122
|
cleanup();
|
|
123
|
+
const typed = event;
|
|
123
124
|
this._state = "disconnected";
|
|
124
|
-
|
|
125
|
-
const reason = typeof event === "object" && event != null && "reason" in event ? event.reason : "Unknown reason";
|
|
126
|
-
reject(/* @__PURE__ */ new Error(`WebSocket closed: ${code} ${reason}`));
|
|
125
|
+
reject(/* @__PURE__ */ new Error(`WebSocket closed: ${typed.code} ${typed.reason}`));
|
|
127
126
|
};
|
|
128
127
|
const cleanup = () => {
|
|
129
128
|
this.ws?.removeEventListener?.("open", onOpen);
|
|
@@ -169,12 +168,11 @@ var RpcClient = class {
|
|
|
169
168
|
timeout: this.timeout
|
|
170
169
|
});
|
|
171
170
|
this.ws.onmessage = (event) => {
|
|
172
|
-
if (
|
|
171
|
+
if (isWireInput(event.data)) this.peer?.handleMessage(event.data);
|
|
173
172
|
else throw new Error(`Received invalid event type in RpcClient.ws.onmessage ${JSON.stringify(event)}`);
|
|
174
173
|
};
|
|
175
174
|
this.ws.onclose = (event) => {
|
|
176
|
-
|
|
177
|
-
else throw new Error(`Received invalid event type in RpcClient.ws.onclose ${JSON.stringify(event)}`);
|
|
175
|
+
this.handleClose(event.code, event.reason);
|
|
178
176
|
};
|
|
179
177
|
this.ws.onerror = (event) => {
|
|
180
178
|
console.error("WebSocket error:", event);
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
import { g as Provider, o as EventTuple, v as RpcSchema } from "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import { g as Provider, o as EventTuple, v as RpcSchema } from "../schema-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import { a as IRpcOptions } from "../types-
|
|
7
|
-
import { t as RpcPeer } from "../default-
|
|
5
|
+
import "../protocol-AvNp0_PF.js";
|
|
6
|
+
import { a as IRpcOptions } from "../types-BO4jYJPi.js";
|
|
7
|
+
import { t as RpcPeer } from "../default-DYoo8pOJ.js";
|
|
8
8
|
import { IMultiAdapterHooks, IMultiConnectionAdapter } from "./types.js";
|
|
9
9
|
import { Constructor } from "type-fest";
|
|
10
|
-
import {
|
|
10
|
+
import { DurableObjectStorage } from "@cloudflare/workers-types";
|
|
11
11
|
|
|
12
12
|
//#region src/adapters/cloudflare-do.d.ts
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Minimal interface for Actor-like classes compatible with withRpc.
|
|
16
|
+
*
|
|
17
|
+
* This decouples ws-rpc from any specific Actor implementation (e.g. @cloudflare/actors,
|
|
18
|
+
* @polymarket/actors, or custom implementations). Any class that implements this interface
|
|
19
|
+
* can be used as a base for the withRpc mixin.
|
|
20
|
+
*
|
|
21
|
+
* Note: WebSocket lifecycle methods (onWebSocketConnect, etc.) are not included here
|
|
22
|
+
* because they are `protected` in Actor classes. The mixin can still override them
|
|
23
|
+
* from the base class without requiring them in this interface.
|
|
24
|
+
*/
|
|
25
|
+
interface ActorLike {
|
|
26
|
+
/** Storage with access to raw DurableObjectStorage for SQL-backed pending calls */
|
|
27
|
+
storage?: {
|
|
28
|
+
raw: DurableObjectStorage | undefined;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
14
31
|
/**
|
|
15
32
|
* Extended hooks for Durable Object adapter
|
|
16
33
|
*/
|
|
@@ -40,7 +57,7 @@ interface IRpcActorHooks<TLocalSchema extends RpcSchema, TRemoteSchema extends R
|
|
|
40
57
|
* Subclasses must implement methods from TLocalSchema on `this`.
|
|
41
58
|
* Runtime enforces this when methods are called via RPC.
|
|
42
59
|
*/
|
|
43
|
-
type RpcActorConstructor<TBase extends Constructor<
|
|
60
|
+
type RpcActorConstructor<TBase extends Constructor<ActorLike>, TLocalSchema extends RpcSchema, TRemoteSchema extends RpcSchema> = {
|
|
44
61
|
new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & IMultiConnectionAdapter<TLocalSchema, TRemoteSchema> & IRpcActorHooks<TLocalSchema, TRemoteSchema>;
|
|
45
62
|
} & Omit<TBase, "new">;
|
|
46
63
|
/**
|
|
@@ -86,8 +103,8 @@ type RpcActorConstructor<TBase extends Constructor<Actor<unknown>>, TLocalSchema
|
|
|
86
103
|
* }
|
|
87
104
|
* ```
|
|
88
105
|
*/
|
|
89
|
-
declare function withRpc<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcSchema,
|
|
106
|
+
declare function withRpc<TLocalSchema extends RpcSchema, TRemoteSchema extends RpcSchema, TBase extends Constructor<ActorLike> & {
|
|
90
107
|
prototype: Provider<TLocalSchema["methods"]>;
|
|
91
108
|
}>(Base: TBase, options: IRpcOptions<TLocalSchema, TRemoteSchema>): RpcActorConstructor<TBase, TLocalSchema, TRemoteSchema>;
|
|
92
109
|
//#endregion
|
|
93
|
-
export { IDOHooks, IRpcActorHooks, RpcActorConstructor, withRpc };
|
|
110
|
+
export { ActorLike, IDOHooks, IRpcActorHooks, RpcActorConstructor, withRpc };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import "../factory-3ziwTuZe.js";
|
|
2
2
|
import "../json-Bshec-bZ.js";
|
|
3
3
|
import "../codecs-BmYG2d_U.js";
|
|
4
|
-
import "../protocol-
|
|
5
|
-
import "../errors-
|
|
4
|
+
import "../protocol-BMv48vpU.js";
|
|
5
|
+
import "../errors-UHUwf6sp.js";
|
|
6
|
+
import { t as MemoryPendingCallStorage } from "../memory-Bqb3KEVr.js";
|
|
6
7
|
import { t as SqlPendingCallStorage } from "../sql-CCjc6Bid.js";
|
|
7
|
-
import "../default-
|
|
8
|
-
import { n as createDurableRpcPeerFactory } from "../durable-
|
|
9
|
-
import { t as MultiPeerBase } from "../multi-peer-
|
|
8
|
+
import "../default-BXFwXL8g.js";
|
|
9
|
+
import { n as createDurableRpcPeerFactory } from "../durable-DUd5YAN_.js";
|
|
10
|
+
import { t as MultiPeerBase } from "../multi-peer-DuZtphz_.js";
|
|
10
11
|
|
|
11
12
|
//#region src/adapters/cloudflare-do.ts
|
|
12
13
|
/**
|
|
@@ -132,14 +133,19 @@ function withRpc(Base, options) {
|
|
|
132
133
|
*
|
|
133
134
|
* Handles peer management, message routing, and durable storage.
|
|
134
135
|
* Uses SQL storage from the Durable Object for hibernation-safe calls.
|
|
135
|
-
*
|
|
136
|
-
* @throws Error if DurableObjectStorage is not available
|
|
136
|
+
* Falls back to in-memory storage if DurableObjectStorage is not available.
|
|
137
137
|
*/
|
|
138
138
|
get _rpc() {
|
|
139
|
-
if (
|
|
140
|
-
|
|
139
|
+
if (this.__rpc) return this.__rpc;
|
|
140
|
+
let storage;
|
|
141
|
+
if (this.storage?.raw) storage = new SqlPendingCallStorage(this.storage.raw.sql);
|
|
142
|
+
else {
|
|
143
|
+
console.warn(`[ws-rpc] DurableObjectStorage not available (storage=${typeof this.storage}, this=${this?.constructor?.name ?? typeof this}). Falling back to in-memory storage. Pending calls will not survive hibernation.`);
|
|
144
|
+
storage = new MemoryPendingCallStorage();
|
|
145
|
+
}
|
|
146
|
+
return this.__rpc = new DOMultiPeer({
|
|
141
147
|
actor: this,
|
|
142
|
-
storage
|
|
148
|
+
storage,
|
|
143
149
|
localSchema: options.localSchema,
|
|
144
150
|
remoteSchema: options.remoteSchema,
|
|
145
151
|
provider: this,
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import "../default-
|
|
5
|
+
import "../protocol-AvNp0_PF.js";
|
|
6
|
+
import "../types-BO4jYJPi.js";
|
|
7
|
+
import "../default-DYoo8pOJ.js";
|
|
8
8
|
import { n as calculateReconnectDelay, r as defaultReconnectOptions, t as ReconnectOptions } from "../reconnect-CYt5_8Xy.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-B2DZ33eC.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 };
|
package/dist/adapters/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import "../factory-3ziwTuZe.js";
|
|
2
2
|
import "../json-Bshec-bZ.js";
|
|
3
3
|
import "../codecs-BmYG2d_U.js";
|
|
4
|
-
import "../protocol-
|
|
5
|
-
import "../errors-
|
|
4
|
+
import "../protocol-BMv48vpU.js";
|
|
5
|
+
import "../errors-UHUwf6sp.js";
|
|
6
|
+
import "../memory-Bqb3KEVr.js";
|
|
6
7
|
import "../sql-CCjc6Bid.js";
|
|
7
8
|
import { n as defaultReconnectOptions, t as calculateReconnectDelay } from "../reconnect-Cdr_3mjN.js";
|
|
8
|
-
import "../default-
|
|
9
|
-
import "../durable-
|
|
9
|
+
import "../default-BXFwXL8g.js";
|
|
10
|
+
import "../durable-DUd5YAN_.js";
|
|
10
11
|
import "./types.js";
|
|
11
12
|
import { RpcClient } from "./client.js";
|
|
12
|
-
import { t as MultiPeerBase } from "../multi-peer-
|
|
13
|
+
import { t as MultiPeerBase } from "../multi-peer-DuZtphz_.js";
|
|
13
14
|
import { withRpc } from "./cloudflare-do.js";
|
|
14
15
|
import { RpcServer } from "./server.js";
|
|
15
16
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import "../default-
|
|
5
|
+
import "../protocol-AvNp0_PF.js";
|
|
6
|
+
import "../types-BO4jYJPi.js";
|
|
7
|
+
import "../default-DYoo8pOJ.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-B2DZ33eC.js";
|
|
10
10
|
export { RpcServer, RpcServerOptions };
|
package/dist/adapters/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../factory-3ziwTuZe.js";
|
|
2
2
|
import "../json-Bshec-bZ.js";
|
|
3
3
|
import "../codecs-BmYG2d_U.js";
|
|
4
|
-
import "../protocol-
|
|
5
|
-
import "../errors-
|
|
4
|
+
import { u as isWireInput } from "../protocol-BMv48vpU.js";
|
|
5
|
+
import "../errors-UHUwf6sp.js";
|
|
6
6
|
import { t as WebSocketReadyState } from "../types-D_psiH09.js";
|
|
7
|
-
import
|
|
8
|
-
import { t as MultiPeerBase } from "../multi-peer-
|
|
7
|
+
import "../default-BXFwXL8g.js";
|
|
8
|
+
import { t as MultiPeerBase } from "../multi-peer-DuZtphz_.js";
|
|
9
9
|
|
|
10
10
|
//#region src/adapters/server.ts
|
|
11
11
|
/**
|
|
@@ -73,20 +73,11 @@ var RpcServer = class extends MultiPeerBase {
|
|
|
73
73
|
this.wss.on("close", () => this.hooks.onClose?.());
|
|
74
74
|
}
|
|
75
75
|
handleConnection(ws) {
|
|
76
|
-
const peer =
|
|
77
|
-
ws,
|
|
78
|
-
localSchema: this.localSchema,
|
|
79
|
-
remoteSchema: this.remoteSchema,
|
|
80
|
-
provider: this.provider,
|
|
81
|
-
...this.protocol !== void 0 && { protocol: this.protocol },
|
|
82
|
-
timeout: this.timeout,
|
|
83
|
-
onEvent: (...args) => {
|
|
84
|
-
this.hooks.onEvent?.(peer, ...args);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
76
|
+
const peer = this.createPeer(ws);
|
|
87
77
|
this.addPeer(ws, peer);
|
|
88
78
|
ws.onmessage = (event) => {
|
|
89
|
-
if (
|
|
79
|
+
if (isWireInput(event.data)) peer.handleMessage(event.data);
|
|
80
|
+
else throw new Error(`Received invalid event type in RpcServer.ws.onmessage ${JSON.stringify(event)}`);
|
|
90
81
|
};
|
|
91
82
|
ws.onclose = () => {
|
|
92
83
|
this.removePeer(ws);
|
package/dist/adapters/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as EventHandler, d as InferOutput, h as MethodDef, l as InferInput, r as EventDef, t as Driver, v as RpcSchema, y as StringKeys } from "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import { a as EventHandler, d as InferOutput, h as MethodDef, l as InferInput, r as EventDef, t as Driver, v as RpcSchema, y as StringKeys } from "../schema-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.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-AvNp0_PF.js";
|
|
6
|
+
import { a as IRpcOptions, n as IMethodController, t as IEventController } from "../types-BO4jYJPi.js";
|
|
7
|
+
import { t as RpcPeer } from "../default-DYoo8pOJ.js";
|
|
8
8
|
import { n as calculateReconnectDelay, r as defaultReconnectOptions, t as ReconnectOptions } from "../reconnect-CYt5_8Xy.js";
|
|
9
9
|
|
|
10
10
|
//#region src/adapters/types.d.ts
|
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-BPSDt2br.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-BEd16-Ao.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-BPSDt2br.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-BEd16-Ao.js";
|
|
3
|
+
import { n as createJsonCodec, t as JsonCodec } from "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.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-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import { n as createJsonCodec, t as JsonCodec } from "../json-CDnAdySL.js";
|
|
4
4
|
export { JsonCodec, createJsonCodec };
|
package/dist/codecs/msgpack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as RpcErrorCodes, t as JsonProtocol } from "./protocol-
|
|
2
|
-
import { a as RpcTimeoutError, i as RpcRemoteError, o as RpcValidationError, r as RpcMethodNotFoundError, t as RpcConnectionClosed } from "./errors-
|
|
1
|
+
import { n as RpcErrorCodes, t as JsonProtocol } from "./protocol-BMv48vpU.js";
|
|
2
|
+
import { a as RpcTimeoutError, i as RpcRemoteError, o as RpcValidationError, r as RpcMethodNotFoundError, t as RpcConnectionClosed } from "./errors-UHUwf6sp.js";
|
|
3
3
|
import { v7 } from "uuid";
|
|
4
4
|
|
|
5
5
|
//#region src/peers/default.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as EventHandler, g as Provider, o as EventTuple, t as Driver, v as RpcSchema } 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 EventHandler, g as Provider, o as EventTuple, t as Driver, v as RpcSchema } from "./schema-BPSDt2br.js";
|
|
2
|
+
import { g as WireInput, u as RpcProtocol } from "./protocol-AvNp0_PF.js";
|
|
3
|
+
import { a as IRpcOptions, r as IMinWebSocket } from "./types-BO4jYJPi.js";
|
|
4
4
|
|
|
5
5
|
//#region src/peers/default.d.ts
|
|
6
6
|
|
package/dist/errors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./factory-3ziwTuZe.js";
|
|
2
2
|
import "./json-Bshec-bZ.js";
|
|
3
3
|
import "./codecs-BmYG2d_U.js";
|
|
4
|
-
import "./protocol-
|
|
5
|
-
import { a as RpcTimeoutError, i as RpcRemoteError, n as RpcError, o as RpcValidationError, r as RpcMethodNotFoundError, t as RpcConnectionClosed } from "./errors-
|
|
4
|
+
import "./protocol-BMv48vpU.js";
|
|
5
|
+
import { a as RpcTimeoutError, i as RpcRemoteError, n as RpcError, o as RpcValidationError, r as RpcMethodNotFoundError, t as RpcConnectionClosed } from "./errors-UHUwf6sp.js";
|
|
6
6
|
|
|
7
7
|
export { RpcConnectionClosed, RpcError, RpcMethodNotFoundError, RpcRemoteError, RpcTimeoutError, RpcValidationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as EventHandler, b as event, c as InferEvents, d as InferOutput, g as Provider, h as MethodDef, l as InferInput, o as EventTuple, r as EventDef, s as InferEventData, t as Driver, u as InferMethods, v as RpcSchema, x as method } from "./schema-
|
|
2
|
-
import "./factory-
|
|
3
|
-
import "./json-
|
|
1
|
+
import { a as EventHandler, b as event, c as InferEvents, d as InferOutput, g as Provider, h as MethodDef, l as InferInput, o as EventTuple, r as EventDef, s as InferEventData, t as Driver, u as InferMethods, v as RpcSchema, x as method } from "./schema-BPSDt2br.js";
|
|
2
|
+
import "./factory-BEd16-Ao.js";
|
|
3
|
+
import "./json-CDnAdySL.js";
|
|
4
4
|
import "./index-DAwMsCZ3.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,
|
|
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-AvNp0_PF.js";
|
|
6
|
+
import { a as IRpcOptions, d as WebSocketReadyState, f as WebSocketServerOptions, i as IRpcConnection, l as IWebSocketServer, n as IMethodController, o as IWebSocket, r as IMinWebSocket, t as IEventController, u as WebSocketOptions } from "./types-BO4jYJPi.js";
|
|
7
7
|
import { n as calculateReconnectDelay, r as defaultReconnectOptions, t as ReconnectOptions } from "./reconnect-CYt5_8Xy.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-DYLQZys5.js";
|
|
10
|
+
import { t as MemoryPendingCallStorage } from "./memory-DWpvxAue.js";
|
|
11
|
+
import { t as SqlPendingCallStorage } from "./sql-J3OVXInb.js";
|
|
12
12
|
import "./storage/index.js";
|
|
13
13
|
export { type AsyncPendingCallStorage, type Driver, type EventDef, type EventHandler, type EventTuple, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./factory-3ziwTuZe.js";
|
|
2
2
|
import "./json-Bshec-bZ.js";
|
|
3
3
|
import "./codecs-BmYG2d_U.js";
|
|
4
|
-
import { a as RpcMessageCodec, c as RpcResponseSchema, i as RpcEventSchema, l as createProtocol, n as RpcErrorCodes, o as RpcMessageSchema, r as RpcErrorSchema, s as RpcRequestSchema, t as JsonProtocol } from "./protocol-
|
|
5
|
-
import { a as RpcTimeoutError, i as RpcRemoteError, n as RpcError, o as RpcValidationError, r as RpcMethodNotFoundError, t as RpcConnectionClosed } from "./errors-
|
|
4
|
+
import { a as RpcMessageCodec, c as RpcResponseSchema, i as RpcEventSchema, l as createProtocol, n as RpcErrorCodes, o as RpcMessageSchema, r as RpcErrorSchema, s as RpcRequestSchema, t as JsonProtocol } from "./protocol-BMv48vpU.js";
|
|
5
|
+
import { a as RpcTimeoutError, i as RpcRemoteError, n as RpcError, o as RpcValidationError, r as RpcMethodNotFoundError, t as RpcConnectionClosed } from "./errors-UHUwf6sp.js";
|
|
6
6
|
import { event, method } from "./schema.js";
|
|
7
7
|
import { t as MemoryPendingCallStorage } from "./memory-Bqb3KEVr.js";
|
|
8
8
|
import { t as SqlPendingCallStorage } from "./sql-CCjc6Bid.js";
|
|
@@ -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-BEd16-Ao.js";
|
|
2
|
+
import { i as PendingCall, s as SyncPendingCallStorage } from "./interface-DYLQZys5.js";
|
|
3
3
|
|
|
4
4
|
//#region src/storage/memory.d.ts
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as isPromise } from "./promise-CjrOX-DI.js";
|
|
2
|
-
import { t as RpcPeer } from "./default-
|
|
2
|
+
import { t as RpcPeer } from "./default-BXFwXL8g.js";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/multi-peer.ts
|
|
5
5
|
/**
|
|
@@ -48,25 +48,18 @@ var MultiPeerBase = class {
|
|
|
48
48
|
* Subclasses can override to customize peer creation.
|
|
49
49
|
*/
|
|
50
50
|
createPeer(ws) {
|
|
51
|
-
|
|
51
|
+
const peer = new RpcPeer({
|
|
52
52
|
ws,
|
|
53
53
|
localSchema: this.localSchema,
|
|
54
54
|
remoteSchema: this.remoteSchema,
|
|
55
55
|
provider: this.provider,
|
|
56
|
+
timeout: this.timeout,
|
|
56
57
|
...this.protocol !== void 0 && { protocol: this.protocol },
|
|
57
|
-
onEvent:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} : void 0,
|
|
61
|
-
timeout: this.timeout
|
|
58
|
+
onEvent: (...args) => {
|
|
59
|
+
this.hooks.onEvent?.(peer, ...args);
|
|
60
|
+
}
|
|
62
61
|
});
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Find peer by WebSocket (internal helper for event routing)
|
|
66
|
-
*/
|
|
67
|
-
findPeerByWs(ws) {
|
|
68
|
-
for (const peer of this.peers.values()) if (peer.getWebSocket() === ws) return peer;
|
|
69
|
-
return null;
|
|
62
|
+
return peer;
|
|
70
63
|
}
|
|
71
64
|
/**
|
|
72
65
|
* Add a peer (called by subclass when connection established)
|
|
@@ -98,7 +91,7 @@ var MultiPeerBase = class {
|
|
|
98
91
|
* Get peer by ID
|
|
99
92
|
*/
|
|
100
93
|
getPeer(id) {
|
|
101
|
-
for (const peer of this.
|
|
94
|
+
for (const peer of this.getPeers()) if (peer.id === id) return peer;
|
|
102
95
|
return null;
|
|
103
96
|
}
|
|
104
97
|
/**
|
|
@@ -133,7 +126,7 @@ var MultiPeerBase = class {
|
|
|
133
126
|
*/
|
|
134
127
|
getConnectionCount() {
|
|
135
128
|
let count = 0;
|
|
136
|
-
for (const peer of this.
|
|
129
|
+
for (const peer of this.getPeers()) if (peer.isOpen) count++;
|
|
137
130
|
return count;
|
|
138
131
|
}
|
|
139
132
|
/**
|
|
@@ -141,7 +134,7 @@ var MultiPeerBase = class {
|
|
|
141
134
|
*/
|
|
142
135
|
getConnectionIds() {
|
|
143
136
|
const ids = [];
|
|
144
|
-
for (const peer of this.
|
|
137
|
+
for (const peer of this.getPeers()) if (peer.isOpen) ids.push(peer.id);
|
|
145
138
|
return ids;
|
|
146
139
|
}
|
|
147
140
|
/**
|
|
@@ -160,7 +153,7 @@ var MultiPeerBase = class {
|
|
|
160
153
|
emit(...args) {
|
|
161
154
|
const ids = args[2];
|
|
162
155
|
const eventArgs = args.slice(0, 2);
|
|
163
|
-
const validPeers = ids ? this.
|
|
156
|
+
const validPeers = ids ? Array.from(this.getPeers()).filter((p) => ids.includes(p.id) && p.isOpen) : Array.from(this.getPeers()).filter((p) => p.isOpen);
|
|
164
157
|
for (const peer of validPeers) peer.emit(...eventArgs);
|
|
165
158
|
}
|
|
166
159
|
/**
|
|
@@ -183,7 +176,7 @@ var MultiPeerBase = class {
|
|
|
183
176
|
* Close all peers
|
|
184
177
|
*/
|
|
185
178
|
closeAll() {
|
|
186
|
-
for (const peer of this.
|
|
179
|
+
for (const peer of this.getPeers()) {
|
|
187
180
|
peer.close();
|
|
188
181
|
this.hooks.onDisconnect?.(peer);
|
|
189
182
|
}
|
|
@@ -213,7 +206,7 @@ var MultiPeerBase = class {
|
|
|
213
206
|
const [input, options] = args.length === 2 ? args : [void 0, args[0]];
|
|
214
207
|
const { ids, timeout = this.timeout } = options ?? {};
|
|
215
208
|
let targetPeers;
|
|
216
|
-
if (ids === void 0) targetPeers = Array.from(this.
|
|
209
|
+
if (ids === void 0) targetPeers = Array.from(this.getPeers()).filter((p) => p.isOpen);
|
|
217
210
|
else if (typeof ids === "string") {
|
|
218
211
|
const peer = this.getPeer(ids);
|
|
219
212
|
targetPeers = peer?.isOpen ? [peer] : [];
|
package/dist/peers/default.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import { n as RpcPeerOptions, t as RpcPeer } from "../default-
|
|
5
|
+
import "../protocol-AvNp0_PF.js";
|
|
6
|
+
import "../types-BO4jYJPi.js";
|
|
7
|
+
import { n as RpcPeerOptions, t as RpcPeer } from "../default-DYoo8pOJ.js";
|
|
8
8
|
export { RpcPeer, RpcPeerOptions };
|
package/dist/peers/default.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../factory-3ziwTuZe.js";
|
|
2
2
|
import "../json-Bshec-bZ.js";
|
|
3
3
|
import "../codecs-BmYG2d_U.js";
|
|
4
|
-
import "../protocol-
|
|
5
|
-
import "../errors-
|
|
6
|
-
import { t as RpcPeer } from "../default-
|
|
4
|
+
import "../protocol-BMv48vpU.js";
|
|
5
|
+
import "../errors-UHUwf6sp.js";
|
|
6
|
+
import { t as RpcPeer } from "../default-BXFwXL8g.js";
|
|
7
7
|
|
|
8
8
|
export { RpcPeer };
|
package/dist/peers/durable.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { v as RpcSchema } from "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import { v as RpcSchema } from "../schema-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.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-AvNp0_PF.js";
|
|
6
|
+
import "../types-BO4jYJPi.js";
|
|
7
|
+
import { n as RpcPeerOptions, t as RpcPeer } from "../default-DYoo8pOJ.js";
|
|
8
|
+
import { i as PendingCall, s as SyncPendingCallStorage } from "../interface-DYLQZys5.js";
|
|
9
9
|
|
|
10
10
|
//#region src/peers/durable.d.ts
|
|
11
11
|
|
package/dist/peers/durable.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../factory-3ziwTuZe.js";
|
|
2
2
|
import "../json-Bshec-bZ.js";
|
|
3
3
|
import "../codecs-BmYG2d_U.js";
|
|
4
|
-
import "../protocol-
|
|
5
|
-
import "../errors-
|
|
6
|
-
import "../default-
|
|
7
|
-
import { n as createDurableRpcPeerFactory, t as DurableRpcPeer } from "../durable-
|
|
4
|
+
import "../protocol-BMv48vpU.js";
|
|
5
|
+
import "../errors-UHUwf6sp.js";
|
|
6
|
+
import "../default-BXFwXL8g.js";
|
|
7
|
+
import { n as createDurableRpcPeerFactory, t as DurableRpcPeer } from "../durable-DUd5YAN_.js";
|
|
8
8
|
|
|
9
9
|
export { DurableRpcPeer, createDurableRpcPeerFactory };
|
package/dist/peers/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../schema-
|
|
2
|
-
import "../factory-
|
|
3
|
-
import "../json-
|
|
1
|
+
import "../schema-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.js";
|
|
5
|
-
import "../protocol-
|
|
6
|
-
import "../types-
|
|
7
|
-
import { n as RpcPeerOptions, t as RpcPeer } from "../default-
|
|
8
|
-
import "../interface-
|
|
5
|
+
import "../protocol-AvNp0_PF.js";
|
|
6
|
+
import "../types-BO4jYJPi.js";
|
|
7
|
+
import { n as RpcPeerOptions, t as RpcPeer } from "../default-DYoo8pOJ.js";
|
|
8
|
+
import "../interface-DYLQZys5.js";
|
|
9
9
|
import { CallContext, DurableRpcPeer, DurableRpcPeerOptions } from "./durable.js";
|
|
10
10
|
export { type CallContext, DurableRpcPeer, type DurableRpcPeerOptions, RpcPeer, type RpcPeerOptions };
|
package/dist/peers/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../factory-3ziwTuZe.js";
|
|
2
2
|
import "../json-Bshec-bZ.js";
|
|
3
3
|
import "../codecs-BmYG2d_U.js";
|
|
4
|
-
import "../protocol-
|
|
5
|
-
import "../errors-
|
|
6
|
-
import { t as RpcPeer } from "../default-
|
|
7
|
-
import { t as DurableRpcPeer } from "../durable-
|
|
4
|
+
import "../protocol-BMv48vpU.js";
|
|
5
|
+
import "../errors-UHUwf6sp.js";
|
|
6
|
+
import { t as RpcPeer } from "../default-BXFwXL8g.js";
|
|
7
|
+
import { t as DurableRpcPeer } from "../durable-DUd5YAN_.js";
|
|
8
8
|
|
|
9
9
|
export { DurableRpcPeer, RpcPeer };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as WireCodec } from "./factory-
|
|
1
|
+
import { a as WireCodec } from "./factory-BEd16-Ao.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol.d.ts
|
|
@@ -130,6 +130,7 @@ type WireDataOf<T extends RpcWireCodec> = T extends z.ZodCodec<infer A> ? A exte
|
|
|
130
130
|
* for seamless integration with the ws package.
|
|
131
131
|
*/
|
|
132
132
|
type WireInput = string | ArrayBuffer | Uint8Array | Uint8Array[];
|
|
133
|
+
declare function isWireInput(value: unknown): value is WireInput;
|
|
133
134
|
/**
|
|
134
135
|
* Protocol interface returned by createProtocol
|
|
135
136
|
*/
|
|
@@ -208,4 +209,4 @@ declare const JsonProtocol: RpcProtocol<z.ZodCodec<z.ZodString, z.ZodUnion<reado
|
|
|
208
209
|
data: z.ZodUnknown;
|
|
209
210
|
}, z.core.$strip>]>>>;
|
|
210
211
|
//#endregion
|
|
211
|
-
export { createProtocol as _, RpcEvent as a, RpcMessageCodec as c, RpcRequest as d, RpcRequestSchema as f, WireInput as g, RpcWireCodec as h, RpcErrorSchema as i, RpcMessageSchema as l, RpcResponseSchema as m, RpcError as n, RpcEventSchema as o, RpcResponse as p, RpcErrorCodes as r, RpcMessage as s, JsonProtocol as t, RpcProtocol as u };
|
|
212
|
+
export { createProtocol as _, RpcEvent as a, RpcMessageCodec as c, RpcRequest as d, RpcRequestSchema as f, WireInput as g, RpcWireCodec as h, RpcErrorSchema as i, RpcMessageSchema as l, RpcResponseSchema as m, RpcError as n, RpcEventSchema as o, RpcResponse as p, RpcErrorCodes as r, RpcMessage as s, JsonProtocol as t, RpcProtocol as u, isWireInput as v };
|
|
@@ -81,6 +81,9 @@ const RpcErrorCodes = {
|
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
83
|
const RpcMessageCodec = createJsonCodec(RpcMessageSchema);
|
|
84
|
+
function isWireInput(value) {
|
|
85
|
+
return typeof value === "string" || value instanceof ArrayBuffer || value instanceof Uint8Array || Array.isArray(value) && value.every((v) => v instanceof Uint8Array);
|
|
86
|
+
}
|
|
84
87
|
/**
|
|
85
88
|
* Create a protocol instance with bound encode/decode functions
|
|
86
89
|
*
|
|
@@ -189,4 +192,4 @@ function createProtocol(codec = RpcMessageCodec) {
|
|
|
189
192
|
const JsonProtocol = createProtocol(RpcMessageCodec);
|
|
190
193
|
|
|
191
194
|
//#endregion
|
|
192
|
-
export { RpcMessageCodec as a, RpcResponseSchema as c, RpcEventSchema as i, createProtocol as l, RpcErrorCodes as n, RpcMessageSchema as o, RpcErrorSchema as r, RpcRequestSchema as s, JsonProtocol as t };
|
|
195
|
+
export { RpcMessageCodec as a, RpcResponseSchema as c, RpcEventSchema as i, createProtocol as l, RpcErrorCodes as n, RpcMessageSchema as o, RpcErrorSchema as r, RpcRequestSchema as s, JsonProtocol as t, isWireInput as u };
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./schema-
|
|
2
|
-
import "./factory-
|
|
3
|
-
import "./json-
|
|
1
|
+
import "./schema-BPSDt2br.js";
|
|
2
|
+
import "./factory-BEd16-Ao.js";
|
|
3
|
+
import "./json-CDnAdySL.js";
|
|
4
4
|
import "./index-DAwMsCZ3.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-
|
|
6
|
-
export { JsonProtocol, RpcError, RpcErrorCodes, RpcErrorSchema, RpcEvent, RpcEventSchema, RpcMessage, RpcMessageCodec, RpcMessageSchema, RpcProtocol, RpcRequest, RpcRequestSchema, RpcResponse, RpcResponseSchema, RpcWireCodec, WireInput, createProtocol };
|
|
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, v as isWireInput } from "./protocol-AvNp0_PF.js";
|
|
6
|
+
export { JsonProtocol, RpcError, RpcErrorCodes, RpcErrorSchema, RpcEvent, RpcEventSchema, RpcMessage, RpcMessageCodec, RpcMessageSchema, RpcProtocol, RpcRequest, RpcRequestSchema, RpcResponse, RpcResponseSchema, RpcWireCodec, WireInput, createProtocol, isWireInput };
|
package/dist/protocol.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./factory-3ziwTuZe.js";
|
|
2
2
|
import "./json-Bshec-bZ.js";
|
|
3
3
|
import "./codecs-BmYG2d_U.js";
|
|
4
|
-
import { a as RpcMessageCodec, c as RpcResponseSchema, i as RpcEventSchema, l as createProtocol, n as RpcErrorCodes, o as RpcMessageSchema, r as RpcErrorSchema, s as RpcRequestSchema, t as JsonProtocol } from "./protocol-
|
|
4
|
+
import { a as RpcMessageCodec, c as RpcResponseSchema, i as RpcEventSchema, l as createProtocol, n as RpcErrorCodes, o as RpcMessageSchema, r as RpcErrorSchema, s as RpcRequestSchema, t as JsonProtocol, u as isWireInput } from "./protocol-BMv48vpU.js";
|
|
5
5
|
|
|
6
|
-
export { JsonProtocol, RpcErrorCodes, RpcErrorSchema, RpcEventSchema, RpcMessageCodec, RpcMessageSchema, RpcRequestSchema, RpcResponseSchema, createProtocol };
|
|
6
|
+
export { JsonProtocol, RpcErrorCodes, RpcErrorSchema, RpcEventSchema, RpcMessageCodec, RpcMessageSchema, RpcRequestSchema, RpcResponseSchema, createProtocol, isWireInput };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import { LiteralUnion } from "type-fest";
|
|
2
|
+
import { LiteralUnion, NonEmptyObject } from "type-fest";
|
|
3
3
|
|
|
4
4
|
//#region src/schema.d.ts
|
|
5
5
|
|
|
@@ -123,7 +123,7 @@ type Driver<T extends RpcSchema["methods"]> = T extends Record<string, MethodDef
|
|
|
123
123
|
/**
|
|
124
124
|
* Discriminated event tuple union - enables proper narrowing in switch statements.
|
|
125
125
|
*/
|
|
126
|
-
type EventTuple<T extends RpcSchema["events"]> = T extends Record<string, EventDef
|
|
126
|
+
type EventTuple<T extends RpcSchema["events"]> = T extends NonEmptyObject<Record<string, EventDef>> ? { [K in keyof T]: [event: K, data: InferEventData<T[K]>] }[keyof T] : [event: string, data: unknown];
|
|
127
127
|
/**
|
|
128
128
|
* Event handler type - handles incoming events.
|
|
129
129
|
* Uses discriminated tuple union for proper type narrowing in switch statements.
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as RpcCollection, a as EventHandler, b as event, c as InferEvents, d as InferOutput, f as LiteralString, g as Provider, h as MethodDef, i as EventEmitter, l as InferInput, m as Method, n as Event, o as EventTuple, p as LiteralStringUnion, r as EventDef, s as InferEventData, t as Driver, u as InferMethods, v as RpcSchema, x as method, y as StringKeys } from "./schema-
|
|
1
|
+
import { _ as RpcCollection, a as EventHandler, b as event, c as InferEvents, d as InferOutput, f as LiteralString, g as Provider, h as MethodDef, i as EventEmitter, l as InferInput, m as Method, n as Event, o as EventTuple, p as LiteralStringUnion, r as EventDef, s as InferEventData, t as Driver, u as InferMethods, v as RpcSchema, x as method, y as StringKeys } from "./schema-BPSDt2br.js";
|
|
2
2
|
export { Driver, Event, EventDef, EventEmitter, EventHandler, EventTuple, InferEventData, InferEvents, InferInput, InferMethods, InferOutput, LiteralString, LiteralStringUnion, Method, MethodDef, Provider, RpcCollection, RpcSchema, StringKeys, event, method };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as Provider, o as EventTuple, v as RpcSchema } from "./schema-
|
|
2
|
-
import { u as RpcProtocol } from "./protocol-
|
|
3
|
-
import { a as IRpcOptions,
|
|
4
|
-
import { t as RpcPeer } from "./default-
|
|
1
|
+
import { g as Provider, o as EventTuple, v as RpcSchema } from "./schema-BPSDt2br.js";
|
|
2
|
+
import { u as RpcProtocol } from "./protocol-AvNp0_PF.js";
|
|
3
|
+
import { a as IRpcOptions, f as WebSocketServerOptions, l as IWebSocketServer, o as IWebSocket, r as IMinWebSocket } from "./types-BO4jYJPi.js";
|
|
4
|
+
import { t as RpcPeer } from "./default-DYoo8pOJ.js";
|
|
5
5
|
import { IMultiAdapterHooks, IMultiConnectionAdapter, MultiDriver } from "./adapters/types.js";
|
|
6
6
|
|
|
7
7
|
//#region src/adapters/multi-peer.d.ts
|
|
@@ -56,10 +56,6 @@ declare abstract class MultiPeerBase<TLocalSchema extends RpcSchema, TRemoteSche
|
|
|
56
56
|
* Subclasses can override to customize peer creation.
|
|
57
57
|
*/
|
|
58
58
|
protected createPeer(ws: IMinWebSocket): RpcPeer<TLocalSchema, TRemoteSchema>;
|
|
59
|
-
/**
|
|
60
|
-
* Find peer by WebSocket (internal helper for event routing)
|
|
61
|
-
*/
|
|
62
|
-
private findPeerByWs;
|
|
63
59
|
/**
|
|
64
60
|
* Add a peer (called by subclass when connection established)
|
|
65
61
|
*/
|
|
@@ -86,7 +82,7 @@ declare abstract class MultiPeerBase<TLocalSchema extends RpcSchema, TRemoteSche
|
|
|
86
82
|
/**
|
|
87
83
|
* Get all peers
|
|
88
84
|
*/
|
|
89
|
-
getPeers():
|
|
85
|
+
getPeers(): MapIterator<RpcPeer<TLocalSchema, TRemoteSchema>>;
|
|
90
86
|
/**
|
|
91
87
|
* Get all open peer entries (internal)
|
|
92
88
|
*/
|
|
@@ -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-BEd16-Ao.js";
|
|
2
|
+
import { i as PendingCall, s as SyncPendingCallStorage } from "./interface-DYLQZys5.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-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.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-DYLQZys5.js";
|
|
6
|
+
import { n as MemoryPendingCallStorageOptions, t as MemoryPendingCallStorage } from "../memory-DWpvxAue.js";
|
|
7
|
+
import { n as SqlPendingCallStorageOptions, t as SqlPendingCallStorage } from "../sql-J3OVXInb.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-BPSDt2br.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-DYLQZys5.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-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.js";
|
|
5
|
-
import "../interface-
|
|
6
|
-
import { n as MemoryPendingCallStorageOptions, t as MemoryPendingCallStorage } from "../memory-
|
|
5
|
+
import "../interface-DYLQZys5.js";
|
|
6
|
+
import { n as MemoryPendingCallStorageOptions, t as MemoryPendingCallStorage } from "../memory-DWpvxAue.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-BPSDt2br.js";
|
|
2
|
+
import "../factory-BEd16-Ao.js";
|
|
3
|
+
import "../json-CDnAdySL.js";
|
|
4
4
|
import "../index-DAwMsCZ3.js";
|
|
5
|
-
import "../interface-
|
|
6
|
-
import { i as SqlStorageCursor, n as SqlPendingCallStorageOptions, r as SqlStorage, t as SqlPendingCallStorage } from "../sql-
|
|
5
|
+
import "../interface-DYLQZys5.js";
|
|
6
|
+
import { i as SqlStorageCursor, n as SqlPendingCallStorageOptions, r as SqlStorage, t as SqlPendingCallStorage } from "../sql-J3OVXInb.js";
|
|
7
7
|
export { SqlPendingCallStorage, SqlPendingCallStorageOptions, SqlStorage, SqlStorageCursor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as EventHandler, g as Provider, h as MethodDef, i as EventEmitter, r as EventDef, v as RpcSchema } from "./schema-
|
|
2
|
-
import { g as WireInput, u as RpcProtocol } from "./protocol-
|
|
1
|
+
import { a as EventHandler, g as Provider, h as MethodDef, i as EventEmitter, r as EventDef, v as RpcSchema } from "./schema-BPSDt2br.js";
|
|
2
|
+
import { g as WireInput, u as RpcProtocol } from "./protocol-AvNp0_PF.js";
|
|
3
3
|
|
|
4
4
|
//#region src/types.d.ts
|
|
5
5
|
|
|
@@ -24,6 +24,15 @@ interface IMinWebSocket {
|
|
|
24
24
|
close(code?: number, reason?: string): void;
|
|
25
25
|
readonly readyState: number;
|
|
26
26
|
}
|
|
27
|
+
interface IWebSocketMessage {
|
|
28
|
+
[x: string]: unknown;
|
|
29
|
+
data: unknown;
|
|
30
|
+
}
|
|
31
|
+
interface IWebSocketClose {
|
|
32
|
+
code: number;
|
|
33
|
+
reason: string;
|
|
34
|
+
wasClean: boolean;
|
|
35
|
+
}
|
|
27
36
|
/**
|
|
28
37
|
* Extended WebSocket interface with events
|
|
29
38
|
*/
|
|
@@ -32,8 +41,8 @@ interface IWebSocket extends IMinWebSocket {
|
|
|
32
41
|
addEventListener?(type: "open" | "close" | "message" | "error", listener: (event: unknown) => void): void;
|
|
33
42
|
removeEventListener?(type: "open" | "close" | "message" | "error", listener: (event: unknown) => void): void;
|
|
34
43
|
onopen?: ((event: unknown) => void) | null;
|
|
35
|
-
onclose?: ((event:
|
|
36
|
-
onmessage?: ((event:
|
|
44
|
+
onclose?: ((event: IWebSocketClose) => void) | null;
|
|
45
|
+
onmessage?: ((event: IWebSocketMessage) => void) | null;
|
|
37
46
|
onerror?: ((event: unknown) => void) | null;
|
|
38
47
|
}
|
|
39
48
|
/**
|
|
@@ -113,4 +122,4 @@ interface IRpcConnection<TLocalSchema extends RpcSchema, TRemoteSchema extends R
|
|
|
113
122
|
handleMessage(data: WireInput): void;
|
|
114
123
|
}
|
|
115
124
|
//#endregion
|
|
116
|
-
export { IRpcOptions as a,
|
|
125
|
+
export { IRpcOptions as a, IWebSocketMessage as c, WebSocketReadyState as d, WebSocketServerOptions as f, IRpcConnection as i, IWebSocketServer as l, IMethodController as n, IWebSocket as o, IMinWebSocket as r, IWebSocketClose as s, IEventController as t, WebSocketOptions as u };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./schema-
|
|
2
|
-
import "./factory-
|
|
3
|
-
import "./json-
|
|
1
|
+
import "./schema-BPSDt2br.js";
|
|
2
|
+
import "./factory-BEd16-Ao.js";
|
|
3
|
+
import "./json-CDnAdySL.js";
|
|
4
4
|
import "./index-DAwMsCZ3.js";
|
|
5
|
-
import "./protocol-
|
|
6
|
-
import { a as IRpcOptions, c as
|
|
7
|
-
export { IEventController, IMethodController, IMinWebSocket, IRpcConnection, IRpcOptions, IWebSocket, IWebSocketServer, WebSocketOptions, WebSocketReadyState, WebSocketServerOptions };
|
|
5
|
+
import "./protocol-AvNp0_PF.js";
|
|
6
|
+
import { a as IRpcOptions, c as IWebSocketMessage, d as WebSocketReadyState, f as WebSocketServerOptions, i as IRpcConnection, l as IWebSocketServer, n as IMethodController, o as IWebSocket, r as IMinWebSocket, s as IWebSocketClose, t as IEventController, u as WebSocketOptions } from "./types-BO4jYJPi.js";
|
|
7
|
+
export { IEventController, IMethodController, IMinWebSocket, IRpcConnection, IRpcOptions, IWebSocket, IWebSocketClose, IWebSocketMessage, IWebSocketServer, WebSocketOptions, WebSocketReadyState, WebSocketServerOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igoforth/ws-rpc",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Bidirectional RPC over WebSocket with Zod schema validation, TypeScript inference, and Cloudflare Durable Object support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -132,10 +132,12 @@
|
|
|
132
132
|
"@biomejs/biome": "^2.3.10",
|
|
133
133
|
"@cloudflare/actors": "^0.0.1-beta.6",
|
|
134
134
|
"@cloudflare/vitest-pool-workers": "^0.11.1",
|
|
135
|
+
"@cloudflare/workers-types": "^4.20251223.0",
|
|
135
136
|
"@msgpack/msgpack": "^3.1.2",
|
|
136
137
|
"@types/node": "^22.10.2",
|
|
137
138
|
"@types/ws": "^8.18.1",
|
|
138
139
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
140
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
139
141
|
"cbor-x": "^1.6.0",
|
|
140
142
|
"tsdown": "^0.18.1",
|
|
141
143
|
"typescript": "^5.9.3",
|
|
@@ -145,9 +147,10 @@
|
|
|
145
147
|
},
|
|
146
148
|
"scripts": {
|
|
147
149
|
"build": "tsdown",
|
|
148
|
-
"test": "vitest run",
|
|
150
|
+
"test": "vitest run --silent && NODE_OPTIONS='--no-deprecation' vitest run --config vitest.config.workers.ts",
|
|
149
151
|
"test:watch": "vitest",
|
|
150
|
-
"
|
|
152
|
+
"test:workers": "NODE_OPTIONS='--no-deprecation' vitest run --config vitest.config.workers.ts",
|
|
153
|
+
"bench": "vitest bench",
|
|
151
154
|
"typecheck": "tsc --noEmit",
|
|
152
155
|
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",
|
|
153
156
|
"typegen": "wrangler types",
|