@xentobias/worker-rpc 1.0.1 → 1.0.2
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/dist/endpoint.d.ts +23 -6
- package/dist/endpoint.d.ts.map +1 -1
- package/dist/id.d.ts +9 -0
- package/dist/id.d.ts.map +1 -0
- package/dist/index.d.ts +5 -94
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -224
- package/dist/proxy.d.ts +10 -4
- package/dist/proxy.d.ts.map +1 -1
- package/dist/types.d.ts +3 -54
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/endpoint.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type MethodPath, type MessageTarget } from './types';
|
|
2
|
+
/** Configuration options for the RPC endpoint */
|
|
3
|
+
export interface EndpointOptions {
|
|
4
|
+
/** Timeout for RPC calls in milliseconds (default: 30000) */
|
|
5
|
+
timeout?: number;
|
|
6
|
+
/** Custom error handler */
|
|
7
|
+
onError?: (error: Error) => void;
|
|
8
|
+
/** Enable debug logging */
|
|
9
|
+
debug?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Configuration for exposing an API */
|
|
12
|
+
export interface ExposeOptions {
|
|
13
|
+
/** Maximum depth for nested objects (default: 10) */
|
|
14
|
+
maxDepth?: number;
|
|
15
|
+
}
|
|
7
16
|
/**
|
|
8
17
|
* RPC Endpoint - handles bidirectional communication with a worker
|
|
9
18
|
*/
|
|
@@ -96,6 +105,14 @@ export declare class Endpoint {
|
|
|
96
105
|
*/
|
|
97
106
|
getTarget(): MessageTarget;
|
|
98
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Check if a value is a function
|
|
110
|
+
*/
|
|
111
|
+
export declare function isFunction(value: unknown): value is Function;
|
|
112
|
+
/**
|
|
113
|
+
* Check if a value is a MessagePort
|
|
114
|
+
*/
|
|
115
|
+
export declare function isMessagePort(value: unknown): value is MessagePort;
|
|
99
116
|
/**
|
|
100
117
|
* Create an endpoint for a worker or message port
|
|
101
118
|
*/
|
package/dist/endpoint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,UAAU,EAGf,KAAK,aAAa,EAEnB,MAAM,SAAS,CAAC;AAYjB,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,aAAa,CAAqB;IAE1C,sCAAsC;IACtC,OAAO,CAAC,YAAY,CAAkC;IAEtD,2DAA2D;IAC3D,OAAO,CAAC,SAAS,CAA+C;IAEhE,iEAAiE;IACjE,OAAO,CAAC,eAAe,CAAmC;IAE1D,6CAA6C;IAC7C,OAAO,CAAC,mBAAmB,CAA4C;IAEvE,8CAA8C;IAC9C,OAAO,CAAC,QAAQ,CAAS;gBAEb,MAAM,EAAE,aAAa,EAAE,OAAO,GAAE,eAAoB;IAYhE;;OAEG;IACH,OAAO,CAAC,cAAc;IAQtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAQtB;;OAEG;IACH,OAAO,CAAC,KAAK;IAMb;;OAEG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI;IAO7D;;OAEG;IACH,OAAO,CAAC,aAAa;IA6BrB;;OAEG;YACW,UAAU;IAsDxB;;OAEG;IACH,OAAO,CAAC,aAAa;IAmCrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAoBpB;;OAEG;IACH,OAAO,CAAC,WAAW;IAwBnB;;OAEG;YACW,cAAc;IA8D5B;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAkB5B;;OAEG;YACW,cAAc;IAgD5B;;OAEG;IACU,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IA2DtE;;OAEG;IACH,OAAO,CAAC,IAAI;IAQZ;;OAEG;IACI,OAAO,IAAI,IAAI;IAkCtB;;OAEG;IACI,SAAS,IAAI,aAAa;CAGlC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,eAAe,GACxB,QAAQ,CAEV"}
|
package/dist/id.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Generate a unique call ID */
|
|
2
|
+
export declare function generateId(): string;
|
|
3
|
+
/** Unique identifier for tracking RPC calls */
|
|
4
|
+
export type CallId = `c:${string}`;
|
|
5
|
+
export declare function generateCallId(): CallId;
|
|
6
|
+
/** Unique identifier for callback functions */
|
|
7
|
+
export type CallbackId = `cb:${string}`;
|
|
8
|
+
export declare function generateCallbackId(): CallbackId;
|
|
9
|
+
//# sourceMappingURL=id.d.ts.map
|
package/dist/id.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAMA,gCAAgC;AAChC,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAGD,+CAA+C;AAC/C,MAAM,MAAM,MAAM,GAAG,KAAK,MAAM,EAAE,CAAC;AAEnC,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG,MAAM,MAAM,EAAE,CAAC;AAExC,wBAAgB,kBAAkB,IAAI,UAAU,CAE/C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,58 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* // worker.ts
|
|
10
|
-
* import { expose } from "worker-rpc";
|
|
11
|
-
*
|
|
12
|
-
* const api = {
|
|
13
|
-
* add: (a: number, b: number) => a + b,
|
|
14
|
-
* db: {
|
|
15
|
-
* users: {
|
|
16
|
-
* find: async (id: string) => ({ id, name: "John" }),
|
|
17
|
-
* },
|
|
18
|
-
* },
|
|
19
|
-
* processWithCallback: async (data: number[], cb: (progress: number) => void) => {
|
|
20
|
-
* for (let i = 0; i < data.length; i++) {
|
|
21
|
-
* await someWork(data[i]);
|
|
22
|
-
* cb((i + 1) / data.length);
|
|
23
|
-
* }
|
|
24
|
-
* return "done";
|
|
25
|
-
* },
|
|
26
|
-
* };
|
|
27
|
-
*
|
|
28
|
-
* expose(api);
|
|
29
|
-
*
|
|
30
|
-
* export type WorkerApi = typeof api;
|
|
31
|
-
*
|
|
32
|
-
* // main.ts
|
|
33
|
-
* import { wrap, createEndpoint } from "worker-rpc";
|
|
34
|
-
* import type { WorkerApi } from "./worker";
|
|
35
|
-
*
|
|
36
|
-
* const worker = new Worker("./worker.ts");
|
|
37
|
-
* const api = wrap<WorkerApi>(createEndpoint(worker));
|
|
38
|
-
*
|
|
39
|
-
* // Type-safe, async calls
|
|
40
|
-
* const sum = await api.add(1, 2);
|
|
41
|
-
* const user = await api.db.users.find("123");
|
|
42
|
-
*
|
|
43
|
-
* // Callbacks work seamlessly
|
|
44
|
-
* await api.processWithCallback([1, 2, 3], (progress) => {
|
|
45
|
-
* console.log(`Progress: ${progress * 100}%`);
|
|
46
|
-
* });
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export { type CallId, type CallbackId, type MethodPath, MessageType, type RpcMessage, type EndpointOptions, type ExposeOptions, type RemoteObject, type RemoteFunction, type MessageTarget, type BunWorker, REMOTE_PROXY, ENDPOINT, RELEASE, CREATE_CHANNEL, } from "./types";
|
|
50
|
-
export { Endpoint, createEndpoint } from "./endpoint";
|
|
51
|
-
export { wrap, isProxy, getEndpoint, releaseProxy } from "./proxy";
|
|
52
|
-
export { type WorkerId, type WorkerRegistry, createRegistry, createWorkerChannel, acceptChannel, setupChannelHandler, PeerChannel, createPeerPair, } from "./channel";
|
|
53
|
-
export { serializeError, deserializeError, isFunction, isMessagePort, isTransferable, type SerializedError, } from "./serialize";
|
|
54
|
-
import { Endpoint } from "./endpoint";
|
|
55
|
-
import type { MessageTarget, EndpointOptions, RemoteObject } from "./types";
|
|
1
|
+
import { Endpoint, type EndpointOptions } from "./endpoint";
|
|
2
|
+
import { type MessageTarget, type RemoteObject } from "./types";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export * from "./endpoint";
|
|
5
|
+
export * from "./proxy";
|
|
56
6
|
/**
|
|
57
7
|
* Expose an API object for remote invocation
|
|
58
8
|
* Call this in the worker to expose methods to the parent
|
|
@@ -90,43 +40,4 @@ export declare function expose(api: object, options?: EndpointOptions): Endpoint
|
|
|
90
40
|
* ```
|
|
91
41
|
*/
|
|
92
42
|
export declare function remote<T extends object>(worker: MessageTarget, options?: EndpointOptions): RemoteObject<T>;
|
|
93
|
-
/**
|
|
94
|
-
* Transfer a value by reference (marks it for zero-copy transfer)
|
|
95
|
-
* Currently supports ArrayBuffer and MessagePort
|
|
96
|
-
*
|
|
97
|
-
* Note: With the optimized serialization, ArrayBuffers are passed through
|
|
98
|
-
* structured clone which handles transfer automatically.
|
|
99
|
-
*
|
|
100
|
-
* @param value - The value to transfer
|
|
101
|
-
* @returns The same value
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* const buffer = new ArrayBuffer(1024);
|
|
106
|
-
* await api.processBuffer(transfer(buffer));
|
|
107
|
-
* // buffer is now unusable in this context (transferred)
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
export declare function transfer<T extends ArrayBuffer | MessagePort>(value: T): T;
|
|
111
|
-
/**
|
|
112
|
-
* Create a proxy function that can be passed to workers
|
|
113
|
-
* Useful for creating callbacks with specific invocation limits
|
|
114
|
-
*
|
|
115
|
-
* @param fn - The function to wrap
|
|
116
|
-
* @param options - Options for the callback
|
|
117
|
-
* @returns The wrapped function
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```typescript
|
|
121
|
-
* // Single-use callback
|
|
122
|
-
* await api.onComplete(callback(() => console.log("done"), { once: true }));
|
|
123
|
-
*
|
|
124
|
-
* // Limited invocations
|
|
125
|
-
* await api.onProgress(callback((p) => console.log(p), { times: 10 }));
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
export declare function callback<T extends (...args: any[]) => any>(fn: T, _options?: {
|
|
129
|
-
once?: boolean;
|
|
130
|
-
times?: number;
|
|
131
|
-
}): T;
|
|
132
43
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEhE,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CAKvE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EACrC,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,eAAe,GACxB,YAAY,CAAC,CAAC,CAAC,CAGjB"}
|
package/dist/index.js
CHANGED
|
@@ -7,45 +7,23 @@ var MessageType;
|
|
|
7
7
|
MessageType2[MessageType2["Error"] = 2] = "Error";
|
|
8
8
|
MessageType2[MessageType2["Callback"] = 3] = "Callback";
|
|
9
9
|
MessageType2[MessageType2["Release"] = 4] = "Release";
|
|
10
|
-
MessageType2[MessageType2["Channel"] = 5] = "Channel";
|
|
11
|
-
MessageType2[MessageType2["ChannelAck"] = 6] = "ChannelAck";
|
|
12
10
|
})(MessageType ||= {});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
e: error.message,
|
|
21
|
-
n: error.name,
|
|
22
|
-
s: error.stack
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function deserializeError(data) {
|
|
26
|
-
const error = new Error(data.e);
|
|
27
|
-
error.name = data.n;
|
|
28
|
-
if (data.s) {
|
|
29
|
-
error.stack = data.s;
|
|
30
|
-
}
|
|
31
|
-
return error;
|
|
32
|
-
}
|
|
33
|
-
function isFunction(value) {
|
|
34
|
-
return typeof value === "function";
|
|
11
|
+
|
|
12
|
+
// src/id.ts
|
|
13
|
+
var instanceId = Math.random().toString(36).slice(2, 8);
|
|
14
|
+
var counter = 0;
|
|
15
|
+
function generateId() {
|
|
16
|
+
return `${instanceId}:${++counter}`;
|
|
35
17
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
18
|
+
function generateCallId() {
|
|
19
|
+
return `c:${generateId()}`;
|
|
38
20
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
21
|
+
function generateCallbackId() {
|
|
22
|
+
return `cb:${generateId()}`;
|
|
41
23
|
}
|
|
42
24
|
|
|
43
25
|
// src/endpoint.ts
|
|
44
26
|
var DEFAULT_TIMEOUT = 30000;
|
|
45
|
-
var idCounter = 0;
|
|
46
|
-
function generateId() {
|
|
47
|
-
return `${++idCounter}:${Date.now().toString(36)}`;
|
|
48
|
-
}
|
|
49
27
|
|
|
50
28
|
class Endpoint {
|
|
51
29
|
target;
|
|
@@ -272,7 +250,7 @@ class Endpoint {
|
|
|
272
250
|
}
|
|
273
251
|
}
|
|
274
252
|
registerCallback(fn, remaining = -1) {
|
|
275
|
-
const id =
|
|
253
|
+
const id = generateCallbackId();
|
|
276
254
|
this.callbacks.set(id, { fn, remaining });
|
|
277
255
|
return id;
|
|
278
256
|
}
|
|
@@ -288,7 +266,7 @@ class Endpoint {
|
|
|
288
266
|
return proxy;
|
|
289
267
|
}
|
|
290
268
|
async invokeCallback(callbackId, args) {
|
|
291
|
-
const id =
|
|
269
|
+
const id = generateCallId();
|
|
292
270
|
const rawArgs = [];
|
|
293
271
|
const callbackMap = {};
|
|
294
272
|
const transferables = [];
|
|
@@ -324,22 +302,29 @@ class Endpoint {
|
|
|
324
302
|
if (this.released) {
|
|
325
303
|
throw new Error("Endpoint has been released");
|
|
326
304
|
}
|
|
327
|
-
const id = generateId();
|
|
328
305
|
const rawArgs = [];
|
|
329
306
|
const callbackMap = {};
|
|
330
307
|
const transferables = [];
|
|
331
308
|
for (let i = 0;i < args.length; i++) {
|
|
332
309
|
const arg = args[i];
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
310
|
+
switch (true) {
|
|
311
|
+
case isFunction(arg): {
|
|
312
|
+
callbackMap[i] = this.registerCallback(arg);
|
|
313
|
+
rawArgs.push(null);
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
case isMessagePort(arg): {
|
|
317
|
+
transferables.push(arg);
|
|
318
|
+
rawArgs.push(arg);
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
default: {
|
|
322
|
+
rawArgs.push(arg);
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
341
325
|
}
|
|
342
326
|
}
|
|
327
|
+
const id = generateCallId();
|
|
343
328
|
return new Promise((resolve, reject) => {
|
|
344
329
|
const timer = setTimeout(() => {
|
|
345
330
|
this.pendingCalls.delete(id);
|
|
@@ -376,7 +361,7 @@ class Endpoint {
|
|
|
376
361
|
const callbackIds = Array.from(this.remoteCallbacks.keys());
|
|
377
362
|
this.send({
|
|
378
363
|
t: 4 /* Release */,
|
|
379
|
-
id:
|
|
364
|
+
id: generateCallId(),
|
|
380
365
|
c: callbackIds
|
|
381
366
|
});
|
|
382
367
|
this.remoteCallbacks.clear();
|
|
@@ -388,14 +373,24 @@ class Endpoint {
|
|
|
388
373
|
return this.target;
|
|
389
374
|
}
|
|
390
375
|
}
|
|
376
|
+
function isFunction(value) {
|
|
377
|
+
return typeof value === "function";
|
|
378
|
+
}
|
|
379
|
+
function isMessagePort(value) {
|
|
380
|
+
return typeof MessagePort !== "undefined" && value instanceof MessagePort;
|
|
381
|
+
}
|
|
391
382
|
function createEndpoint(target, options) {
|
|
392
383
|
return new Endpoint(target, options);
|
|
393
384
|
}
|
|
385
|
+
|
|
394
386
|
// src/proxy.ts
|
|
395
|
-
var PATH = Symbol("
|
|
396
|
-
var PROXY_ENDPOINT = Symbol("
|
|
387
|
+
var PATH = Symbol("rpc:path");
|
|
388
|
+
var PROXY_ENDPOINT = Symbol("rpc:proxy-endpoint");
|
|
389
|
+
var REMOTE_PROXY = Symbol.for("rpc:remote-proxy");
|
|
390
|
+
var ENDPOINT = Symbol.for("rpc:endpoint");
|
|
391
|
+
var RELEASE = Symbol.for("rpc:release");
|
|
397
392
|
var proxyHandler = {
|
|
398
|
-
get(target, prop
|
|
393
|
+
get(target, prop) {
|
|
399
394
|
if (prop === REMOTE_PROXY) {
|
|
400
395
|
return true;
|
|
401
396
|
}
|
|
@@ -429,7 +424,6 @@ var proxyHandler = {
|
|
|
429
424
|
const newPath = [...currentPath, prop];
|
|
430
425
|
return createProxyInternal(endpoint, newPath);
|
|
431
426
|
}
|
|
432
|
-
return;
|
|
433
427
|
},
|
|
434
428
|
apply(target, _thisArg, args) {
|
|
435
429
|
const endpoint = target[PROXY_ENDPOINT];
|
|
@@ -472,207 +466,39 @@ function getEndpoint(proxy) {
|
|
|
472
466
|
if (isProxy(proxy)) {
|
|
473
467
|
return proxy[ENDPOINT];
|
|
474
468
|
}
|
|
475
|
-
return;
|
|
476
469
|
}
|
|
477
470
|
function releaseProxy(proxy) {
|
|
478
471
|
if (isProxy(proxy)) {
|
|
479
472
|
proxy[RELEASE]();
|
|
480
473
|
}
|
|
481
474
|
}
|
|
482
|
-
// src/channel.ts
|
|
483
|
-
function createRegistry() {
|
|
484
|
-
const workers = new Map;
|
|
485
|
-
const channels = new Map;
|
|
486
|
-
const pendingChannels = new Map;
|
|
487
|
-
function handleWorkerMessage(workerId, event) {
|
|
488
|
-
const message = event.data;
|
|
489
|
-
if (typeof message !== "object" || message === null || message.t !== 5 /* Channel */) {
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
const { target: targetId, port, id } = message;
|
|
493
|
-
const targetWorker = workers.get(targetId);
|
|
494
|
-
if (!targetWorker) {
|
|
495
|
-
const worker = workers.get(workerId);
|
|
496
|
-
if (worker) {
|
|
497
|
-
worker.postMessage({
|
|
498
|
-
t: 2 /* Error */,
|
|
499
|
-
id,
|
|
500
|
-
e: `Worker not found: ${targetId}`
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
targetWorker.postMessage({
|
|
506
|
-
t: 5 /* Channel */,
|
|
507
|
-
id,
|
|
508
|
-
source: workerId,
|
|
509
|
-
port
|
|
510
|
-
}, [port]);
|
|
511
|
-
}
|
|
512
|
-
return {
|
|
513
|
-
register(id, worker) {
|
|
514
|
-
workers.set(id, worker);
|
|
515
|
-
const handler = (event) => handleWorkerMessage(id, event);
|
|
516
|
-
if (worker.addEventListener) {
|
|
517
|
-
worker.addEventListener("message", handler);
|
|
518
|
-
}
|
|
519
|
-
},
|
|
520
|
-
unregister(id) {
|
|
521
|
-
workers.delete(id);
|
|
522
|
-
for (const [key, state] of channels) {
|
|
523
|
-
if (key.includes(id)) {
|
|
524
|
-
state.endpoint.release();
|
|
525
|
-
state.port.close();
|
|
526
|
-
channels.delete(key);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
async getChannel(targetId) {
|
|
531
|
-
throw new Error("getChannel should be called from within a worker using createWorkerChannel");
|
|
532
|
-
},
|
|
533
|
-
releaseAll() {
|
|
534
|
-
for (const [, state] of channels) {
|
|
535
|
-
state.endpoint.release();
|
|
536
|
-
state.port.close();
|
|
537
|
-
}
|
|
538
|
-
channels.clear();
|
|
539
|
-
workers.clear();
|
|
540
|
-
}
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
async function createWorkerChannel(mainThreadEndpoint, targetWorkerId, options) {
|
|
544
|
-
const channel = new MessageChannel;
|
|
545
|
-
return new Promise((resolve, reject) => {
|
|
546
|
-
const id = `channel:${Date.now()}:${Math.random().toString(36).slice(2)}`;
|
|
547
|
-
const originalHandler = mainThreadEndpoint.getTarget().onmessage;
|
|
548
|
-
const responseHandler = (event) => {
|
|
549
|
-
const message = event.data;
|
|
550
|
-
if (message?.id === id) {
|
|
551
|
-
if (mainThreadEndpoint.getTarget().onmessage === responseHandler) {
|
|
552
|
-
mainThreadEndpoint.getTarget().onmessage = originalHandler;
|
|
553
|
-
}
|
|
554
|
-
if (message.t === 2 /* Error */) {
|
|
555
|
-
reject(new Error(message.e));
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
const endpoint = createEndpoint(channel.port1, options);
|
|
559
|
-
resolve(wrap(endpoint));
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
const target = mainThreadEndpoint.getTarget();
|
|
563
|
-
if (target.addEventListener) {
|
|
564
|
-
target.addEventListener("message", responseHandler);
|
|
565
|
-
} else {
|
|
566
|
-
target.onmessage = responseHandler;
|
|
567
|
-
}
|
|
568
|
-
target.postMessage({
|
|
569
|
-
t: 5 /* Channel */,
|
|
570
|
-
id,
|
|
571
|
-
target: targetWorkerId,
|
|
572
|
-
port: channel.port2
|
|
573
|
-
}, [channel.port2]);
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
function acceptChannel(port, api, options) {
|
|
577
|
-
const endpoint = createEndpoint(port, options);
|
|
578
|
-
endpoint.expose(api);
|
|
579
|
-
port.start();
|
|
580
|
-
return wrap(endpoint);
|
|
581
|
-
}
|
|
582
|
-
function setupChannelHandler(mainThread, getApi, options) {
|
|
583
|
-
const handler = (event) => {
|
|
584
|
-
const message = event.data;
|
|
585
|
-
if (typeof message !== "object" || message === null || message.t !== 5 /* Channel */) {
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
const { port, source, id } = message;
|
|
589
|
-
if (!port) {
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
const endpoint = createEndpoint(port, options);
|
|
593
|
-
endpoint.expose(getApi());
|
|
594
|
-
port.start();
|
|
595
|
-
mainThread.postMessage({
|
|
596
|
-
t: 6 /* ChannelAck */,
|
|
597
|
-
id,
|
|
598
|
-
source
|
|
599
|
-
});
|
|
600
|
-
};
|
|
601
|
-
if (mainThread.addEventListener) {
|
|
602
|
-
mainThread.addEventListener("message", handler);
|
|
603
|
-
} else {
|
|
604
|
-
mainThread.onmessage = handler;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
475
|
|
|
608
|
-
class PeerChannel {
|
|
609
|
-
endpoint;
|
|
610
|
-
remote;
|
|
611
|
-
constructor(port, localApi, options) {
|
|
612
|
-
this.endpoint = createEndpoint(port, options);
|
|
613
|
-
this.endpoint.expose(localApi);
|
|
614
|
-
this.remote = wrap(this.endpoint);
|
|
615
|
-
port.start();
|
|
616
|
-
}
|
|
617
|
-
getRemote() {
|
|
618
|
-
return this.remote;
|
|
619
|
-
}
|
|
620
|
-
release() {
|
|
621
|
-
this.endpoint.release();
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
function createPeerPair(apiA, apiB, options) {
|
|
625
|
-
const channel = new MessageChannel;
|
|
626
|
-
const endpointA = createEndpoint(channel.port1, options);
|
|
627
|
-
endpointA.expose(apiA);
|
|
628
|
-
const endpointB = createEndpoint(channel.port2, options);
|
|
629
|
-
endpointB.expose(apiB);
|
|
630
|
-
channel.port1.start();
|
|
631
|
-
channel.port2.start();
|
|
632
|
-
return [wrap(endpointA), wrap(endpointB)];
|
|
633
|
-
}
|
|
634
476
|
// src/index.ts
|
|
635
477
|
function expose(api, options) {
|
|
636
478
|
const self = globalThis;
|
|
637
|
-
const
|
|
638
|
-
|
|
639
|
-
return
|
|
479
|
+
const endpoint2 = createEndpoint(self, options);
|
|
480
|
+
endpoint2.expose(api);
|
|
481
|
+
return endpoint2;
|
|
640
482
|
}
|
|
641
483
|
function remote(worker, options) {
|
|
642
|
-
const
|
|
643
|
-
return wrap(
|
|
644
|
-
}
|
|
645
|
-
function transfer(value) {
|
|
646
|
-
return value;
|
|
647
|
-
}
|
|
648
|
-
function callback(fn, _options) {
|
|
649
|
-
return fn;
|
|
484
|
+
const endpoint2 = createEndpoint(worker, options);
|
|
485
|
+
return wrap(endpoint2);
|
|
650
486
|
}
|
|
651
487
|
export {
|
|
652
488
|
wrap,
|
|
653
|
-
transfer,
|
|
654
|
-
setupChannelHandler,
|
|
655
|
-
serializeError,
|
|
656
489
|
remote,
|
|
657
490
|
releaseProxy,
|
|
658
|
-
isTransferable,
|
|
659
491
|
isProxy,
|
|
660
492
|
isMessagePort,
|
|
661
493
|
isFunction,
|
|
662
494
|
getEndpoint,
|
|
663
495
|
expose,
|
|
664
|
-
deserializeError,
|
|
665
|
-
createWorkerChannel,
|
|
666
|
-
createRegistry,
|
|
667
|
-
createPeerPair,
|
|
668
496
|
createEndpoint,
|
|
669
|
-
callback,
|
|
670
|
-
acceptChannel,
|
|
671
497
|
REMOTE_PROXY,
|
|
672
498
|
RELEASE,
|
|
673
|
-
|
|
499
|
+
PROXY_ENDPOINT,
|
|
500
|
+
PATH,
|
|
674
501
|
MessageType,
|
|
675
502
|
Endpoint,
|
|
676
|
-
ENDPOINT
|
|
677
|
-
CREATE_CHANNEL
|
|
503
|
+
ENDPOINT
|
|
678
504
|
};
|
package/dist/proxy.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Worker RPC - Proxy Module
|
|
3
|
-
* Creates type-safe proxies for remote API access
|
|
4
|
-
*/
|
|
5
1
|
import { Endpoint } from "./endpoint";
|
|
6
2
|
import { type RemoteObject } from "./types";
|
|
3
|
+
/** Symbol to store the method path on a proxy */
|
|
4
|
+
export declare const PATH: unique symbol;
|
|
5
|
+
/** Symbol to store the endpoint on a proxy */
|
|
6
|
+
export declare const PROXY_ENDPOINT: unique symbol;
|
|
7
|
+
/** Symbol to mark a proxy as a remote reference */
|
|
8
|
+
export declare const REMOTE_PROXY: unique symbol;
|
|
9
|
+
/** Symbol for accessing the underlying endpoint */
|
|
10
|
+
export declare const ENDPOINT: unique symbol;
|
|
11
|
+
/** Symbol for releasing a proxy */
|
|
12
|
+
export declare const RELEASE: unique symbol;
|
|
7
13
|
/**
|
|
8
14
|
* Wrap a worker/endpoint to create a type-safe remote API proxy
|
|
9
15
|
*
|
package/dist/proxy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAEjB,iDAAiD;AACjD,eAAO,MAAM,IAAI,eAAqB,CAAC;AAEvC,8CAA8C;AAC9C,eAAO,MAAM,cAAc,eAA+B,CAAC;AAE3D,mDAAmD;AACnD,eAAO,MAAM,YAAY,eAAiC,CAAC;AAE3D,mDAAmD;AACnD,eAAO,MAAM,QAAQ,eAA6B,CAAC;AAEnD,mCAAmC;AACnC,eAAO,MAAM,OAAO,eAA4B,CAAC;AAsGjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAC5E,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EACnC,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7B,YAAY,CAAC,CAAC,CAAC,CAAC;AAKnB;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAU/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAIhE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAIjD"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Worker RPC - Type Definitions
|
|
3
|
-
* High-performance, type-safe worker communication for Bun.js
|
|
4
|
-
*/
|
|
5
|
-
/** Unique identifier for tracking RPC calls */
|
|
6
|
-
export type CallId = string;
|
|
7
|
-
/** Unique identifier for callback functions */
|
|
8
|
-
export type CallbackId = string;
|
|
1
|
+
import type { CallbackId, CallId } from './id';
|
|
9
2
|
/** Path to a nested method (e.g., ['db', 'users', 'find']) */
|
|
10
3
|
export type MethodPath = string[];
|
|
11
4
|
/** Message types for the RPC protocol */
|
|
@@ -19,11 +12,7 @@ export declare enum MessageType {
|
|
|
19
12
|
/** Callback invocation */
|
|
20
13
|
Callback = 3,
|
|
21
14
|
/** Release a callback reference */
|
|
22
|
-
Release = 4
|
|
23
|
-
/** Establish a direct channel between workers */
|
|
24
|
-
Channel = 5,
|
|
25
|
-
/** Acknowledgment for channel establishment */
|
|
26
|
-
ChannelAck = 6
|
|
15
|
+
Release = 4
|
|
27
16
|
}
|
|
28
17
|
/** Base message structure */
|
|
29
18
|
export interface BaseMessage {
|
|
@@ -76,22 +65,8 @@ export interface ReleaseMessage extends BaseMessage {
|
|
|
76
65
|
/** Callback IDs to release */
|
|
77
66
|
c: CallbackId[];
|
|
78
67
|
}
|
|
79
|
-
/** Channel establishment message */
|
|
80
|
-
export interface ChannelMessage extends BaseMessage {
|
|
81
|
-
t: MessageType.Channel;
|
|
82
|
-
/** Target worker identifier */
|
|
83
|
-
target: string;
|
|
84
|
-
/** MessagePort for direct communication */
|
|
85
|
-
port: MessagePort;
|
|
86
|
-
}
|
|
87
|
-
/** Channel acknowledgment */
|
|
88
|
-
export interface ChannelAckMessage extends BaseMessage {
|
|
89
|
-
t: MessageType.ChannelAck;
|
|
90
|
-
/** Source worker identifier */
|
|
91
|
-
source: string;
|
|
92
|
-
}
|
|
93
68
|
/** Union of all message types */
|
|
94
|
-
export type RpcMessage = CallMessage | ResultMessage | ErrorMessage | CallbackMessage | ReleaseMessage
|
|
69
|
+
export type RpcMessage = CallMessage | ResultMessage | ErrorMessage | CallbackMessage | ReleaseMessage;
|
|
95
70
|
/** Unwrap a Promise type */
|
|
96
71
|
export type Unpromise<T> = T extends Promise<infer U> ? U : T;
|
|
97
72
|
/** Make a function async if it isn't already */
|
|
@@ -102,28 +77,6 @@ export type RemoteFunction<T> = T extends (...args: infer A) => infer R ? (...ar
|
|
|
102
77
|
export type RemoteObject<T> = {
|
|
103
78
|
[K in keyof T]: T[K] extends (...args: any[]) => any ? RemoteFunction<T[K]> : T[K] extends object ? RemoteObject<T[K]> : T[K];
|
|
104
79
|
};
|
|
105
|
-
/** Symbol to mark a proxy as a remote reference */
|
|
106
|
-
export declare const REMOTE_PROXY: unique symbol;
|
|
107
|
-
/** Symbol for accessing the underlying endpoint */
|
|
108
|
-
export declare const ENDPOINT: unique symbol;
|
|
109
|
-
/** Symbol for releasing a proxy */
|
|
110
|
-
export declare const RELEASE: unique symbol;
|
|
111
|
-
/** Symbol for creating a direct channel */
|
|
112
|
-
export declare const CREATE_CHANNEL: unique symbol;
|
|
113
|
-
/** Configuration options for the RPC endpoint */
|
|
114
|
-
export interface EndpointOptions {
|
|
115
|
-
/** Timeout for RPC calls in milliseconds (default: 30000) */
|
|
116
|
-
timeout?: number;
|
|
117
|
-
/** Custom error handler */
|
|
118
|
-
onError?: (error: Error) => void;
|
|
119
|
-
/** Enable debug logging */
|
|
120
|
-
debug?: boolean;
|
|
121
|
-
}
|
|
122
|
-
/** Configuration for exposing an API */
|
|
123
|
-
export interface ExposeOptions {
|
|
124
|
-
/** Maximum depth for nested objects (default: 10) */
|
|
125
|
-
maxDepth?: number;
|
|
126
|
-
}
|
|
127
80
|
/** Pending call information */
|
|
128
81
|
export interface PendingCall {
|
|
129
82
|
resolve: (value: any) => void;
|
|
@@ -147,8 +100,4 @@ export interface MessageTarget {
|
|
|
147
100
|
start?(): void;
|
|
148
101
|
close?(): void;
|
|
149
102
|
}
|
|
150
|
-
/** Extended Worker type with Bun-specific features */
|
|
151
|
-
export interface BunWorker extends MessageTarget {
|
|
152
|
-
terminate?(): void;
|
|
153
|
-
}
|
|
154
103
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xentobias/worker-rpc",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "High-performance, type-safe RPC for
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "High-performance, type-safe RPC for Workers",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|