@zukhruf/rpc 0.8.213 → 0.8.214

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.
Files changed (54) hide show
  1. package/README.md +7 -3
  2. package/dist/call/client.d.ts +8 -3
  3. package/dist/call/client.d.ts.map +1 -1
  4. package/dist/call/client.js +21 -6
  5. package/dist/call/client.js.map +1 -1
  6. package/dist/call/pending-calls.d.ts +5 -4
  7. package/dist/call/pending-calls.d.ts.map +1 -1
  8. package/dist/call/pending-calls.js +16 -9
  9. package/dist/call/pending-calls.js.map +1 -1
  10. package/dist/call/server.d.ts.map +1 -1
  11. package/dist/call/server.js +16 -2
  12. package/dist/call/server.js.map +1 -1
  13. package/dist/channel/child-process-connection.d.ts +6 -0
  14. package/dist/channel/child-process-connection.d.ts.map +1 -1
  15. package/dist/channel/child-process-connection.js +17 -19
  16. package/dist/channel/child-process-connection.js.map +1 -1
  17. package/dist/channel/parent-port-connection.d.ts +1 -0
  18. package/dist/channel/parent-port-connection.d.ts.map +1 -1
  19. package/dist/channel/parent-port-connection.js +3 -1
  20. package/dist/channel/parent-port-connection.js.map +1 -1
  21. package/dist/channel/process-channel-connection.d.ts +9 -1
  22. package/dist/channel/process-channel-connection.d.ts.map +1 -1
  23. package/dist/channel/process-channel-connection.js +14 -2
  24. package/dist/channel/process-channel-connection.js.map +1 -1
  25. package/dist/channel/shared-channel-connection.d.ts +1 -0
  26. package/dist/channel/shared-channel-connection.d.ts.map +1 -1
  27. package/dist/channel/shared-channel-connection.js.map +1 -1
  28. package/dist/channel/worker-connection.d.ts +1 -0
  29. package/dist/channel/worker-connection.d.ts.map +1 -1
  30. package/dist/channel/worker-connection.js +5 -3
  31. package/dist/channel/worker-connection.js.map +1 -1
  32. package/dist/connection/connection-supervisor.d.ts +6 -1
  33. package/dist/connection/connection-supervisor.d.ts.map +1 -1
  34. package/dist/connection/connection-supervisor.js +13 -3
  35. package/dist/connection/connection-supervisor.js.map +1 -1
  36. package/dist/connection/connection.d.ts +6 -3
  37. package/dist/connection/connection.d.ts.map +1 -1
  38. package/dist/error/client-warning.d.ts +13 -0
  39. package/dist/error/client-warning.d.ts.map +1 -0
  40. package/dist/error/client-warning.js +15 -0
  41. package/dist/error/client-warning.js.map +1 -0
  42. package/dist/error/error-codec.d.ts +2 -1
  43. package/dist/error/error-codec.d.ts.map +1 -1
  44. package/dist/error/error-codec.js +6 -2
  45. package/dist/error/error-codec.js.map +1 -1
  46. package/dist/error/remote-serialization-error.d.ts +10 -0
  47. package/dist/error/remote-serialization-error.d.ts.map +1 -0
  48. package/dist/error/remote-serialization-error.js +13 -0
  49. package/dist/error/remote-serialization-error.js.map +1 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +2 -0
  53. package/dist/index.js.map +1 -1
  54. package/package.json +5 -5
package/README.md CHANGED
@@ -92,13 +92,13 @@ The thread stays alive after its call to `log`: the server holds the link while
92
92
 
93
93
  ## Call a method of the other end
94
94
 
95
- `client.call(method, params, { signal })` sends a request and waits for its answer. The answer is checked by the client's `answers` check of that method before the call gives it its type: it comes from another thread or process (mutex ADR 0017). A call made while no connection is open goes on the next one. A call that went out on a connection that is lost rejects at once with `ConnectionLostError`, and it is not sent again: the peer may have run it, as a lost Postgres commit may have committed. A call whose `signal` aborts rejects with the signal's reason, and a later answer settles nothing.
95
+ `client.call(method, params, { signal })` sends a request and waits for its answer. The answer is checked by the client's `answers` check of that method before the call gives it its type: it comes from another thread or process (mutex ADR 0017). A call made while no connection is open goes on the next one. A call that went out on a connection that is lost rejects at once with `ConnectionLostError`, and it is not sent again: the peer may have run it, as a lost Postgres commit may have committed. A call whose `signal` aborts rejects with the signal's reason, and a later answer settles nothing. A call with a value that the channel cannot carry, such as a `WeakMap`, rejects with the channel's own error (a worker's `DataCloneError`, the `Error` or `TypeError` of an IPC channel), and the link and every other call go on (ADR 0005).
96
96
 
97
- `client.notify(method, params)` runs the method on the other end and waits for no answer. A notification made before the connection opens goes once it opens.
97
+ `client.notify(method, params)` runs the method on the other end and waits for no answer. A notification made before the connection opens goes once it opens. On an open connection, a value that the channel cannot carry throws its error at `notify`. A notification that waited and is refused when it goes out has no caller left: it is dropped with a `ClientWarning` (`ZUKHRUF_RPC_NOTIFICATION_REFUSED`).
98
98
 
99
99
  ## Serve the methods of an object
100
100
 
101
- `server.serve(link)` opens the supervisor `link` and answers each request on it with the value of the method, or with the error that it threw. It serves only the methods that `methods` names, each with the check of its parameters: a method of the target with no check is refused, as is a request whose parameters fail the check. The server holds the link while it serves, as a listening `net.Server` keeps the process alive: until the link is closed or unavailable. An answer that does not reach the link is dropped, because its caller is gone. A notification's method that throws emits a `ServerWarning` (`ZUKHRUF_RPC_NOTIFICATION_FAILED`), because nothing answers a notification.
101
+ `server.serve(link)` opens the supervisor `link` and answers each request on it with the value of the method, or with the error that it threw. It serves only the methods that `methods` names, each with the check of its parameters: a method of the target with no check is refused, as is a request whose parameters fail the check. The server holds the link while it serves, as a listening `net.Server` keeps the process alive: until the link is closed or unavailable. An answer that does not reach the link is dropped, because its caller is gone. An answer that the channel cannot carry goes as a `RemoteSerializationError` in its place, with the channel's error as its `cause`: the method ran, and the caller decides whether to call again. A notification's method that throws emits a `ServerWarning` (`ZUKHRUF_RPC_NOTIFICATION_FAILED`), because nothing answers a notification.
102
102
 
103
103
  Each end can run a `Client` and a `Server` on one link, as StreamJsonRpc's `JsonRpc` does: the client reads the responses and the server reads the requests.
104
104
 
@@ -142,6 +142,8 @@ A call holds the link from its add until it is taken, so the process exits only
142
142
  | `ConnectionLostError` | A call was in flight on a connection that was lost, the client was disposed, or no peer can come again. |
143
143
  | `ServerError` | The peer threw an error of a class that this end's codec does not list. |
144
144
  | `ConnectionClosedError` | A send of an adapter cannot reach the peer, because the connection is closed. |
145
+ | `RemoteSerializationError` | The peer ran the method, and its channel could not carry the answer. The `cause` is the channel's error. |
146
+ | The channel's own error | A call or a notification has a value that the channel cannot carry. Nothing is sent, and the link goes on. |
145
147
  | `TypeError` | The server has no such method, the parameters fail its check, or the answer fails the client's check. |
146
148
  | `RangeError` | Two classes of an `ErrorCodec` have one name, or `PendingCalls.add` gets an id that waits already. |
147
149
 
@@ -165,6 +167,7 @@ A call holds the link from its add until it is taken, so the process exits only
165
167
  | Client and server | Go [`net/rpc`](https://pkg.go.dev/net/rpc) `Client`, `Server`; StreamJsonRpc [`JsonRpc`](https://github.com/microsoft/vs-streamjsonrpc) |
166
168
  | A lost call | StreamJsonRpc `ConnectionLostException`; Go `rpc.ErrShutdown` |
167
169
  | A remote error | Go `rpc.ServerError`; StreamJsonRpc `RemoteInvocationException` |
170
+ | An answer that cannot cross | StreamJsonRpc `RemoteSerializationException` (`ResponseSerializationFailure`, -32003) |
168
171
  | The message shape | [JSON-RPC 2.0](https://www.jsonrpc.org/specification), sections 4 and 5 |
169
172
  | The errors that survive a clone | HTML [structured clone](https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal) of `[[ErrorData]]` |
170
173
  | A `DOMException` that crosses | WebIDL [DOMException serialization steps](https://webidl.spec.whatwg.org/#idl-DOMException) |
@@ -239,4 +242,5 @@ export function isEncodedReason(value: unknown): value is EncodedReason;
239
242
  - [ADR 0002](./docs/adr/0002-an-error-crosses-as-data-and-is-rebuilt-from-a-list-of-classes-without-its-constructor.md): an error crosses as data and is rebuilt from a list of classes, without its constructor.
240
243
  - [ADR 0003](./docs/adr/0003-each-end-checks-what-it-receives.md): each end checks what it receives.
241
244
  - [ADR 0004](./docs/adr/0004-a-link-has-one-count-of-holds.md): a link has one count of holds.
245
+ - [ADR 0005](./docs/adr/0005-a-refused-message-rejects-only-its-own-send-and-only-a-lost-peer-is-a-loss.md): a refused message rejects only its own send, and only a lost peer is a loss.
242
246
  - [Copied code](./docs/copied-code.md)
@@ -15,8 +15,10 @@ export interface CallOptions {
15
15
  * Calls the methods of a peer's `Server` over a supervised connection. A
16
16
  * call waits for its answer, or rejects with `ConnectionLostError` as soon as
17
17
  * the connection it went out on is lost. A call made while no connection is
18
- * open goes on the next one. The client holds the connection only while a
19
- * call or a notification waits, so it keeps the process alive no longer.
18
+ * open goes on the next one. A call whose value the channel refuses rejects
19
+ * with the channel's error, and the link goes on. The client holds the
20
+ * connection only while a call or a notification waits, so it keeps the
21
+ * process alive no longer.
20
22
  */
21
23
  export declare class Client<Remote extends Methods<Remote>> implements AsyncDisposable {
22
24
  #private;
@@ -25,7 +27,10 @@ export declare class Client<Remote extends Methods<Remote>> implements AsyncDisp
25
27
  /**
26
28
  * Runs `method` on the peer and waits for no answer. It goes on the open
27
29
  * connection, or on the next one. A notification that went out is never
28
- * sent again, and what its method throws stays with the peer.
30
+ * sent again, and what its method throws stays with the peer. On the open
31
+ * connection, a value that the channel refuses throws its error here. A
32
+ * notification that waited for the connection and is refused then is
33
+ * dropped with a `ClientWarning`.
29
34
  */
30
35
  notify<M extends keyof Remote & string>(method: M, params: Parameters<Remote[M]>): void;
31
36
  /** Closes the connection. Each call that waits rejects with `ConnectionLostError`. */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/call/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EACL,KAAK,UAAU,EAKhB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,OAAO,CAAC,MAAM,CAAC;IAC3D,yDAAyD;IACzD,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,qGAAqG;IACrG,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAClC;AAOD;;;;;;GAMG;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C,EAAE,WAAW,GAAG,SAAS,CAAC;CAClC;AAOD;;;;;;;;GAQG;AACH,qBAAa,MAAM,CAAC,MAAM,SAAS,OAAO,CAAC,MAAM,CAAC,CAAE,YAAW,eAAe;;IAS5E,YACE,IAAI,EAAE,oBAAoB,CAAC,UAAU,CAAC,EACtC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,EAgB3C;IAEK,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM,GAAG,MAAM,EACxC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAC7B,EAAE,MAAM,EAAE,GAAE,WAAgB,GAC3B,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAmBzC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,SAAS,MAAM,MAAM,GAAG,MAAM,EACpC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAO9B;IAED,sFAAsF;IAChF,CAAC,MAAM,CAAC,YAAY,CAAC,kBAI1B;CAyCF"}
@@ -1,4 +1,5 @@
1
1
  import { untilAborted } from '@zukhruf/async';
2
+ import { ClientWarning } from '../error/client-warning.js';
2
3
  import { ConnectionLostError } from '../error/connection-lost-error.js';
3
4
  import { PendingCalls } from './pending-calls.js';
4
5
  import { isRpcResponse, } from './rpc-message.js';
@@ -10,8 +11,10 @@ const rejectLost = {
10
11
  * Calls the methods of a peer's `Server` over a supervised connection. A
11
12
  * call waits for its answer, or rejects with `ConnectionLostError` as soon as
12
13
  * the connection it went out on is lost. A call made while no connection is
13
- * open goes on the next one. The client holds the connection only while a
14
- * call or a notification waits, so it keeps the process alive no longer.
14
+ * open goes on the next one. A call whose value the channel refuses rejects
15
+ * with the channel's error, and the link goes on. The client holds the
16
+ * connection only while a call or a notification waits, so it keeps the
17
+ * process alive no longer.
15
18
  */
16
19
  export class Client {
17
20
  #link;
@@ -61,7 +64,10 @@ export class Client {
61
64
  /**
62
65
  * Runs `method` on the peer and waits for no answer. It goes on the open
63
66
  * connection, or on the next one. A notification that went out is never
64
- * sent again, and what its method throws stays with the peer.
67
+ * sent again, and what its method throws stays with the peer. On the open
68
+ * connection, a value that the channel refuses throws its error here. A
69
+ * notification that waited for the connection and is refused then is
70
+ * dropped with a `ClientWarning`.
65
71
  */
66
72
  notify(method, params) {
67
73
  this.#assertOpen();
@@ -92,12 +98,21 @@ export class Client {
92
98
  else
93
99
  call.resolve(response.result);
94
100
  }
95
- /** Sends what waited for this connection, in order, until a send does not reach it. */
101
+ /**
102
+ * Sends what waited for this connection, in order, until a send does not
103
+ * reach it. A notification that the channel refuses has no caller left to
104
+ * hear it, so its refusal goes to the process.
105
+ */
96
106
  #flush() {
97
107
  while (this.#outbox.length > 0) {
98
108
  const next = this.#outbox[0];
99
- if (!this.#link.send(next.notification))
100
- return;
109
+ try {
110
+ if (!this.#link.send(next.notification))
111
+ return;
112
+ }
113
+ catch (refusal) {
114
+ process.emitWarning(new ClientWarning(refusal, { method: next.notification.method }));
115
+ }
101
116
  this.#outbox.shift();
102
117
  next.held[Symbol.dispose]();
103
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/call/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EAAuB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAKL,aAAa,GACd,MAAM,kBAAkB,CAAC;AAa1B,sFAAsF;AACtF,MAAM,UAAU,GAA4B;IAC1C,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,mBAAmB,EAAE,CAAC;CACzD,CAAC;AA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
35
  * The calls that wait for an answer over a supervised connection, by id. A
36
36
  * call goes out when it is added, or on the next connection when none is
37
- * open. The owner reports each loss and each new connection, so it can send
38
- * its own messages first (a reassertion, a marker). A call holds the
39
- * connection from its add until it is taken, so the process exits only when
40
- * no call, and no other holder of the connection, waits.
37
+ * open. A call whose request the channel refuses rejects with the refusal.
38
+ * The owner reports each loss and each new connection, so it can send its own
39
+ * messages first (a reassertion, a marker). A call holds the connection from
40
+ * its add until it is taken, so the process exits only when no call, and no
41
+ * other holder of the connection, waits.
41
42
  */
42
43
  export declare class PendingCalls<Request, Answer> {
43
44
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"pending-calls.d.ts","sourceRoot":"","sources":["../../src/call/pending-calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,0EAA0E;AAC1E,MAAM,WAAW,OAAO,CAAC,MAAM;IAC7B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED,iGAAiG;AACjG,MAAM,MAAM,cAAc,CAAC,MAAM;AAC/B,iGAAiG;AAC/F,QAAQ;AACV;;;;GAIG;GACD;IAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CAAE;AACzC;;;;;GAKG;GACD;IAAE,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC;AAEjD,uEAAuE;AACvE,MAAM,WAAW,SAAS,CAAC,OAAO,EAAE,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;IACjE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gGAAgG;IAChG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAuBD;;;;;;;GAOG;AACH,qBAAa,YAAY,CA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,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC;AAEjD,uEAAuE;AACvE,MAAM,WAAW,SAAS,CAAC,OAAO,EAAE,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;IACjE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gGAAgG;IAChG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAuBD;;;;;;;;GAQG;AACH,qBAAa,YAAY,CAAC,OAAO,EAAE,MAAM;;IAIvC,6GAA6G;IAC7G,YAAY,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,EAE9C;IAED,yGAAyG;IACzG,GAAG,CACD,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,GAC7B,OAAO,CAAC,MAAM,CAAC,CAgBjB;IAED,qDAAqD;IACrD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAEnC;IAED,+EAA+E;IAC/E,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,QAGlC;IAED,uHAAuH;IACvH,IAAI,CAAC,EAAE,EAAE,MAAM,QAGd;IAED,wEAAwE;IACxE,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,SAAS,CAUvD;IAED;;;OAGG;IACH,MAAM,SAQL;IAED,qFAAqF;IACrF,SAAS,SAQR;IAED,SAAS,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,QAK9C;CAUF"}
@@ -3,10 +3,11 @@ const sent = { kind: 'sent' };
3
3
  /**
4
4
  * The calls that wait for an answer over a supervised connection, by id. A
5
5
  * call goes out when it is added, or on the next connection when none is
6
- * open. The owner reports each loss and each new connection, so it can send
7
- * its own messages first (a reassertion, a marker). A call holds the
8
- * connection from its add until it is taken, so the process exits only when
9
- * no call, and no other holder of the connection, waits.
6
+ * open. A call whose request the channel refuses rejects with the refusal.
7
+ * The owner reports each loss and each new connection, so it can send its own
8
+ * messages first (a reassertion, a marker). A call holds the connection from
9
+ * its add until it is taken, so the process exits only when no call, and no
10
+ * other holder of the connection, waits.
10
11
  */
11
12
  export class PendingCalls {
12
13
  #link;
@@ -30,7 +31,7 @@ export class PendingCalls {
30
31
  };
31
32
  this.#calls.set(id, call);
32
33
  this.#link.open();
33
- this.#dispatch(call);
34
+ this.#dispatch(id, call);
34
35
  return promise;
35
36
  }
36
37
  /** The request of the call that waits under `id`. */
@@ -47,7 +48,7 @@ export class PendingCalls {
47
48
  send(id) {
48
49
  const call = this.#calls.get(id);
49
50
  if (call)
50
- this.#dispatch(call);
51
+ this.#dispatch(id, call);
51
52
  }
52
53
  /** Removes the call of `id`, so a late answer to it settles nothing. */
53
54
  take(id) {
@@ -72,7 +73,7 @@ export class PendingCalls {
72
73
  call.delivery.atReconnect(this.take(id));
73
74
  }
74
75
  else if (call.delivery.kind === 'queued') {
75
- this.#dispatch(call);
76
+ this.#dispatch(id, call);
76
77
  }
77
78
  }
78
79
  }
@@ -96,8 +97,14 @@ export class PendingCalls {
96
97
  call.reject(reason(call.request));
97
98
  }
98
99
  }
99
- #dispatch(call) {
100
- call.delivery = this.#link.send(call.request) ? sent : queued;
100
+ /** A request that the channel refuses was not sent, and it never can be: the call leaves the table and rejects with the refusal (rpc ADR 0005). */
101
+ #dispatch(id, call) {
102
+ try {
103
+ call.delivery = this.#link.send(call.request) ? sent : queued;
104
+ }
105
+ catch (refusal) {
106
+ this.take(id)?.reject(refusal);
107
+ }
101
108
  }
102
109
  }
103
110
  //# sourceMappingURL=pending-calls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pending-calls.js","sourceRoot":"","sources":["../../src/call/pending-calls.ts"],"names":[],"mappings":"AA0CA,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAW,CAA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oB,CAAC,UAAU,CAAC,QAS3C;CAqDF"}
@@ -1,3 +1,4 @@
1
+ import { RemoteSerializationError } from '../error/remote-serialization-error.js';
1
2
  import { ServerWarning } from '../error/server-warning.js';
2
3
  import { isRpcCall, } from './rpc-message.js';
3
4
  /**
@@ -35,7 +36,12 @@ export class Server {
35
36
  });
36
37
  link.open();
37
38
  }
38
- /** A send that does not reach the link drops the answer: the caller is gone, and nobody waits for it. */
39
+ /**
40
+ * A send that does not reach the link drops the answer: the caller is
41
+ * gone, and nobody waits for it. An answer that the channel refuses goes
42
+ * as a `RemoteSerializationError` in its place, with the refusal as its
43
+ * cause, so the caller does not wait for ever (rpc ADR 0005).
44
+ */
39
45
  async #answer(link, request) {
40
46
  let response;
41
47
  try {
@@ -44,7 +50,15 @@ export class Server {
44
50
  catch (error) {
45
51
  response = { id: request.id, error: this.#errors.encode(error) };
46
52
  }
47
- link.send(response);
53
+ try {
54
+ link.send(response);
55
+ }
56
+ catch (refusal) {
57
+ link.send({
58
+ id: request.id,
59
+ error: this.#errors.encode(new RemoteSerializationError({ cause: refusal })),
60
+ });
61
+ }
48
62
  }
49
63
  async #run(notification) {
50
64
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/call/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAIL,SAAS,GACV,MAAM,kBAAkB,CAAC;AAS1B;;;;;;GAMG;AACH,MAAM,OAAO,MAAM;IACR,OAAO,CAAQ;IACf,QAAQ,CAGf;IACO,OAAO,CAAa;IAE7B,YAAY,MAAa,EAAE,EAAE,OAAO,EAAE,MAAM,EAAwB;QAClE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,MAAM,C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CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,WAAW,CACjB,IAAI,aAAa,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EACZ,MAAM,EACN,MAAM,GACgC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,GAAG,GAAY,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAChE,IAAI,CAAC,KAAK,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;YACxC,MAAM,IAAI,SAAS,CAAC,6BAA6B,MAAM,IAAI,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACnB,MAAM,IAAI,SAAS,CACjB,sBAAsB,MAAM,mCAAmC,CAChE,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;CACF"}
@@ -8,6 +8,12 @@ import { SharedChannelConnection } from './shared-channel-connection.ts';
8
8
  export declare class ChildProcessConnection<Outgoing> extends SharedChannelConnection<Outgoing> {
9
9
  #private;
10
10
  constructor(child: ChildProcess, options: ChannelOptions);
11
+ /**
12
+ * `child.send` serializes at once: a value that the channel cannot carry
13
+ * throws here, and nothing is sent. A write that fails, to a child that
14
+ * died (EPIPE) or after the channel closed (ERR_IPC_CHANNEL_CLOSED),
15
+ * reports its error through the callback.
16
+ */
11
17
  send(message: Outgoing): Promise<void>;
12
18
  /** The running child already keeps the parent alive. */
13
19
  ref(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"child-process-connection.d.ts","sourceRoot":"","sources":["../../src/channel/child-process-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,oBAAoB,CAAC;AAIrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;;GAGG;AACH,qBAAa,sBAAsB,CACjC,QAAQ,CACR,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;;IAIzC,YAAY,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAIvD;IAEK,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAc3C;IAED,wDAAwD;IACxD,GAAG,SAAK;IAER,KAAK,SAAK;IAEJ,KAAK,kBAEV;CACF"}
1
+ {"version":3,"file":"child-process-connection.d.ts","sourceRoot":"","sources":["../../src/channel/child-process-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;GAGG;AACH,qBAAa,sBAAsB,CACjC,QAAQ,CACR,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;;IAGzC,YAAY,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAIvD;IAED;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrC;IAED,wDAAwD;IACxD,GAAG,SAAK;IAER,KAAK,SAAK;IAEJ,KAAK,kBAEV;CACF"}
@@ -1,33 +1,31 @@
1
- import { promisify } from 'node:util';
2
1
  import { ConnectionClosedError } from '../connection/connection-closed-error.js';
3
2
  import { SharedChannelConnection } from './shared-channel-connection.js';
4
- /** A send to a child that died fails with EPIPE, and one after the channel closed with ERR_IPC_CHANNEL_CLOSED. */
5
- const closedCodes = new Set(['EPIPE', 'ERR_IPC_CHANNEL_CLOSED']);
6
3
  /**
7
4
  * The parent's end of the IPC channel to one child. The kernel closes the
8
5
  * channel when the child dies, so `disconnect` reports even a SIGKILL.
9
6
  */
10
7
  export class ChildProcessConnection extends SharedChannelConnection {
11
- /** A send after the channel closed reports the error through its callback. */
12
- #send;
8
+ #child;
13
9
  constructor(child, options) {
14
10
  super(child, ['disconnect'], options);
15
- this.#send = promisify(child.send).bind(child);
11
+ this.#child = child;
16
12
  this.listen();
17
13
  }
18
- async send(message) {
19
- try {
20
- await this.#send(this.envelope.wrap(message));
21
- }
22
- catch (error) {
23
- if (Error.isError(error) &&
24
- 'code' in error &&
25
- typeof error.code === 'string' &&
26
- closedCodes.has(error.code)) {
27
- throw new ConnectionClosedError({ cause: error });
28
- }
29
- throw error;
30
- }
14
+ /**
15
+ * `child.send` serializes at once: a value that the channel cannot carry
16
+ * throws here, and nothing is sent. A write that fails, to a child that
17
+ * died (EPIPE) or after the channel closed (ERR_IPC_CHANNEL_CLOSED),
18
+ * reports its error through the callback.
19
+ */
20
+ send(message) {
21
+ const { promise, resolve, reject } = Promise.withResolvers();
22
+ this.#child.send(this.envelope.wrap(message), (error) => {
23
+ if (error)
24
+ reject(new ConnectionClosedError({ cause: error }));
25
+ else
26
+ resolve();
27
+ });
28
+ return promise;
31
29
  }
32
30
  /** The running child already keeps the parent alive. */
33
31
  ref() { }
@@ -1 +1 @@
1
- {"version":3,"file":"child-process-connection.js","sourceRoot":"","sources":["../../src/channel/child-process-connection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,kHAAkH;AAClH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,OAAO,sBAEX,SAAQ,uBAAiC;IACzC,8EAA8E;IACrE,KAAK,CAA4C;IAE1D,YAAY,KAAmB,EAAE,OAAuB;QACtD,KAAK,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAqB,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnE,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAiB;QAC1B,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBACpB,MAAM,IAAI,KAAK;gBACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAC9B,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAC3B,CAAC;gBACD,MAAM,IAAI,qBAAqB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACpD,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,wDAAwD;IACxD,GAAG,KAAI,CAAC;IAER,KAAK,KAAI,CAAC;IAEV,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;CACF"}
1
+ {"version":3,"file":"child-process-connection.js","sourceRoot":"","sources":["../../src/channel/child-process-connection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;GAGG;AACH,MAAM,OAAO,sBAEX,SAAQ,uBAAiC;IAChC,MAAM,CAAe;IAE9B,YAAY,KAAmB,EAAE,OAAuB;QACtD,KAAK,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,OAAiB;QACpB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,EAAQ,CAAC;QACnE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;YACtD,IAAI,KAAK;gBAAE,MAAM,CAAC,IAAI,qBAAqB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;;gBAC1D,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,wDAAwD;IACxD,GAAG,KAAI,CAAC;IAER,KAAK,KAAI,CAAC;IAEV,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -11,6 +11,7 @@ import { SharedChannelConnection } from './shared-channel-connection.ts';
11
11
  export declare class ParentPortConnection<Outgoing> extends SharedChannelConnection<Outgoing> {
12
12
  #private;
13
13
  constructor(port: MessagePort, options: ChannelOptions);
14
+ /** `postMessage` throws a `DataCloneError` for a value that it cannot clone, and sends nothing. */
14
15
  send(message: Outgoing): Promise<void>;
15
16
  /** Removes the listener before it adds it, so a second `ref` does not listen twice. */
16
17
  ref(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"parent-port-connection.d.ts","sourceRoot":"","sources":["../../src/channel/parent-port-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,qBAAa,oBAAoB,CAC/B,QAAQ,CACR,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;;IAGzC,YAAY,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAGrD;IAEK,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3C;IAED,uFAAuF;IACvF,GAAG,SAGF;IAED,KAAK,SAEJ;IAEK,KAAK,kBAEV;CACF"}
1
+ {"version":3,"file":"parent-port-connection.d.ts","sourceRoot":"","sources":["../../src/channel/parent-port-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,qBAAa,oBAAoB,CAC/B,QAAQ,CACR,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;;IAGzC,YAAY,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAGrD;IAED,mGAAmG;IACnG,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAGrC;IAED,uFAAuF;IACvF,GAAG,SAGF;IAED,KAAK,SAEJ;IAEK,KAAK,kBAEV;CACF"}
@@ -12,8 +12,10 @@ export class ParentPortConnection extends SharedChannelConnection {
12
12
  super(port, [], options);
13
13
  this.#port = port;
14
14
  }
15
- async send(message) {
15
+ /** `postMessage` throws a `DataCloneError` for a value that it cannot clone, and sends nothing. */
16
+ send(message) {
16
17
  this.#port.postMessage(this.envelope.wrap(message));
18
+ return Promise.resolve();
17
19
  }
18
20
  /** Removes the listener before it adds it, so a second `ref` does not listen twice. */
19
21
  ref() {
@@ -1 +1 @@
1
- {"version":3,"file":"parent-port-connection.js","sourceRoot":"","sources":["../../src/channel/parent-port-connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,OAAO,oBAEX,SAAQ,uBAAiC;IAChC,KAAK,CAAc;IAE5B,YAAY,IAAiB,EAAE,OAAuB;QACpD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAiB;QAC1B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,uFAAuF;IACvF,GAAG;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF"}
1
+ {"version":3,"file":"parent-port-connection.js","sourceRoot":"","sources":["../../src/channel/parent-port-connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,OAAO,oBAEX,SAAQ,uBAAiC;IAChC,KAAK,CAAc;IAE5B,YAAY,IAAiB,EAAE,OAAuB;QACpD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,mGAAmG;IACnG,IAAI,CAAC,OAAiB;QACpB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,uFAAuF;IACvF,GAAG;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF"}
@@ -1,5 +1,7 @@
1
1
  import type { ChannelOptions } from './envelope.ts';
2
2
  import { SharedChannelConnection } from './shared-channel-connection.ts';
3
+ /** `process.send`, bound to `process`: a process that was started with an IPC channel has it. */
4
+ type ProcessSend = NonNullable<NodeJS.Process['send']>;
3
5
  /**
4
6
  * The child's end of the IPC channel to its parent. Node counts `message` and
5
7
  * `disconnect` listeners to decide whether the channel keeps the process alive,
@@ -9,11 +11,17 @@ import { SharedChannelConnection } from './shared-channel-connection.ts';
9
11
  */
10
12
  export declare class ProcessChannelConnection<Outgoing> extends SharedChannelConnection<Outgoing> {
11
13
  #private;
12
- constructor(send: (envelope: unknown) => Promise<void>, options: ChannelOptions);
14
+ constructor(send: ProcessSend, options: ChannelOptions);
15
+ /**
16
+ * `process.send` serializes at once: a value that the channel cannot carry
17
+ * throws here, and nothing is sent. A write after the channel closed
18
+ * reports its error through the callback.
19
+ */
13
20
  send(message: Outgoing): Promise<void>;
14
21
  /** Removes the listeners before it adds them, so a second `ref` does not listen twice. */
15
22
  ref(): void;
16
23
  unref(): void;
17
24
  close(): Promise<void>;
18
25
  }
26
+ export {};
19
27
  //# sourceMappingURL=process-channel-connection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-channel-connection.d.ts","sourceRoot":"","sources":["../../src/channel/process-channel-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,qBAAa,wBAAwB,CACnC,QAAQ,CACR,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;;IAIzC,YACE,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,EAC1C,OAAO,EAAE,cAAc,EAIxB;IAED,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAErC;IAED,0FAA0F;IAC1F,GAAG,SAGF;IAED,KAAK,SAEJ;IAEK,KAAK,kBAEV;CACF"}
1
+ {"version":3,"file":"process-channel-connection.d.ts","sourceRoot":"","sources":["../../src/channel/process-channel-connection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,iGAAiG;AACjG,KAAK,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAEvD;;;;;;GAMG;AACH,qBAAa,wBAAwB,CACnC,QAAQ,CACR,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;;IAGzC,YAAY,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAGrD;IAED;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrC;IAED,0FAA0F;IAC1F,GAAG,SAGF;IAED,KAAK,SAEJ;IAEK,KAAK,kBAEV;CACF"}
@@ -1,3 +1,4 @@
1
+ import { ConnectionClosedError } from '../connection/connection-closed-error.js';
1
2
  import { SharedChannelConnection } from './shared-channel-connection.js';
2
3
  /**
3
4
  * The child's end of the IPC channel to its parent. Node counts `message` and
@@ -7,14 +8,25 @@ import { SharedChannelConnection } from './shared-channel-connection.js';
7
8
  * not listening are buffered by Node and delivered on the next `ref`.
8
9
  */
9
10
  export class ProcessChannelConnection extends SharedChannelConnection {
10
- /** `process.send`, which reports a send after the channel closed through its callback. */
11
11
  #send;
12
12
  constructor(send, options) {
13
13
  super(process, ['disconnect'], options);
14
14
  this.#send = send;
15
15
  }
16
+ /**
17
+ * `process.send` serializes at once: a value that the channel cannot carry
18
+ * throws here, and nothing is sent. A write after the channel closed
19
+ * reports its error through the callback.
20
+ */
16
21
  send(message) {
17
- return this.#send(this.envelope.wrap(message));
22
+ const { promise, resolve, reject } = Promise.withResolvers();
23
+ this.#send(this.envelope.wrap(message), undefined, undefined, (error) => {
24
+ if (error)
25
+ reject(new ConnectionClosedError({ cause: error }));
26
+ else
27
+ resolve();
28
+ });
29
+ return promise;
18
30
  }
19
31
  /** Removes the listeners before it adds them, so a second `ref` does not listen twice. */
20
32
  ref() {
@@ -1 +1 @@
1
- {"version":3,"file":"process-channel-connection.js","sourceRoot":"","sources":["../../src/channel/process-channel-connection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,OAAO,wBAEX,SAAQ,uBAAiC;IACzC,0FAA0F;IACjF,KAAK,CAAuC;IAErD,YACE,IAA0C,EAC1C,OAAuB;QAEvB,KAAK,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAI,CAAC,OAAiB;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,0FAA0F;IAC1F,GAAG;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF"}
1
+ {"version":3,"file":"process-channel-connection.js","sourceRoot":"","sources":["../../src/channel/process-channel-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;;;;;GAMG;AACH,MAAM,OAAO,wBAEX,SAAQ,uBAAiC;IAChC,KAAK,CAAc;IAE5B,YAAY,IAAiB,EAAE,OAAuB;QACpD,KAAK,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,OAAiB;QACpB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,EAAQ,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACtE,IAAI,KAAK;gBAAE,MAAM,CAAC,IAAI,qBAAqB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;;gBAC1D,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,0FAA0F;IAC1F,GAAG;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF"}
@@ -18,6 +18,7 @@ export declare abstract class SharedChannelConnection<Outgoing> extends EventEmi
18
18
  #private;
19
19
  protected readonly envelope: Envelope;
20
20
  protected constructor(channel: ChannelEnd, goneEvents: readonly string[], { tag }: ChannelOptions);
21
+ /** Throws the channel's refusal before anything is sent; rejects only with `ConnectionClosedError`. */
21
22
  abstract send(message: Outgoing): Promise<void>;
22
23
  abstract ref(): void;
23
24
  abstract unref(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"shared-channel-connection.d.ts","sourceRoot":"","sources":["../../src/channel/shared-channel-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,KAAK,cAAc,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9D,6GAA6G;AAC7G,UAAU,UAAU;IAClB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC;IAClE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;IACnD,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC;CACpE;AAED;;;;;;GAMG;AACH,8BAAsB,uBAAuB,CAAC,QAAQ,CACpD,SAAQ,YAAY,CAAC,gBAAgB,CACrC,YAAW,UAAU,CAAC,QAAQ,CAAC;;IAE/B,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAetC,SAAS,aACP,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,GAAG,EAAE,EA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AAC,OAAO,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,YACE,OAAmB,EACnB,UAA6B,EAC7B,EAAE,GAAG,EAAkB;QAEvB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAWS,MAAM;QACd,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAES,aAAa;QACrB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;CACF"}
@@ -9,6 +9,7 @@ import { SharedChannelConnection } from './shared-channel-connection.ts';
9
9
  export declare class WorkerConnection<Outgoing> extends SharedChannelConnection<Outgoing> {
10
10
  #private;
11
11
  constructor(worker: Worker, options: ChannelOptions);
12
+ /** `postMessage` throws a `DataCloneError` for a value that it cannot clone, and sends nothing. */
12
13
  send(message: Outgoing): Promise<void>;
13
14
  /** The running worker already keeps its starting thread alive. */
14
15
  ref(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"worker-connection.d.ts","sourceRoot":"","sources":["../../src/channel/worker-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;GAIG;AACH,qBAAa,gBAAgB,CAC3B,QAAQ,CACR,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;;IAGzC,YAAY,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAIlD;IAEK,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ3C;IAED,kEAAkE;IAClE,GAAG,SAAK;IAER,KAAK,SAAK;IAEJ,KAAK,kBAEV;CACF"}
1
+ {"version":3,"file":"worker-connection.d.ts","sourceRoot":"","sources":["../../src/channel/worker-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;GAIG;AACH,qBAAa,gBAAgB,CAC3B,QAAQ,CACR,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;;IAGzC,YAAY,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAIlD;IAED,mGAAmG;IACnG,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrC;IAED,kEAAkE;IAClE,GAAG,SAAK;IAER,KAAK,SAAK;IAEJ,KAAK,kBAEV;CACF"}
@@ -12,14 +12,16 @@ export class WorkerConnection extends SharedChannelConnection {
12
12
  this.#worker = worker;
13
13
  this.listen();
14
14
  }
15
- async send(message) {
15
+ /** `postMessage` throws a `DataCloneError` for a value that it cannot clone, and sends nothing. */
16
+ send(message) {
16
17
  // A stopped worker drops messages without an error; its thread id is -1 from then on.
17
18
  if (this.#worker.threadId === -1) {
18
- throw new ConnectionClosedError({
19
+ return Promise.reject(new ConnectionClosedError({
19
20
  cause: new Error('The worker thread has exited.'),
20
- });
21
+ }));
21
22
  }
22
23
  this.#worker.postMessage(this.envelope.wrap(message));
24
+ return Promise.resolve();
23
25
  }
24
26
  /** The running worker already keeps its starting thread alive. */
25
27
  ref() { }
@@ -1 +1 @@
1
- {"version":3,"file":"worker-connection.js","sourceRoot":"","sources":["../../src/channel/worker-connection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,OAAO,gBAEX,SAAQ,uBAAiC;IAChC,OAAO,CAAS;IAEzB,YAAY,MAAc,EAAE,OAAuB;QACjD,KAAK,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAiB;QAC1B,sFAAsF;QACtF,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,qBAAqB,CAAC;gBAC9B,KAAK,EAAE,IAAI,KAAK,CAAC,+BAA+B,CAAC;aAClD,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,kEAAkE;IAClE,GAAG,KAAI,CAAC;IAER,KAAK,KAAI,CAAC;IAEV,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;CACF"}
1
+ {"version":3,"file":"worker-connection.js","sourceRoot":"","sources":["../../src/channel/worker-connection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,OAAO,gBAEX,SAAQ,uBAAiC;IAChC,OAAO,CAAS;IAEzB,YAAY,MAAc,EAAE,OAAuB;QACjD,KAAK,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,mGAAmG;IACnG,IAAI,CAAC,OAAiB;QACpB,sFAAsF;QACtF,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,qBAAqB,CAAC;gBACxB,KAAK,EAAE,IAAI,KAAK,CAAC,+BAA+B,CAAC;aAClD,CAAC,CACH,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,kEAAkE;IAClE,GAAG,KAAI,CAAC;IAER,KAAK,KAAI,CAAC;IAEV,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -24,7 +24,12 @@ export declare class ConnectionSupervisor<Outgoing> extends EventEmitter<Supervi
24
24
  get status(): SupervisorStatus;
25
25
  /** Starts connecting, unless a connection is open, on its way, or never coming. */
26
26
  open(): void;
27
- /** Whether `message` was handed to an open connection. A failed delivery is reported as a loss. */
27
+ /**
28
+ * Whether `message` was handed to an open connection. A message that the
29
+ * channel refuses throws the channel's error, and the connection stays; a
30
+ * delivery that fails because the connection closed is reported as a loss
31
+ * (rpc ADR 0005).
32
+ */
28
33
  send(message: Outgoing): boolean;
29
34
  /**
30
35
  * Keeps the process alive through the open connection, and each one that
@@ -1 +1 @@
1
- {"version":3,"file":"connection-supervisor.d.ts","sourceRoot":"","sources":["../../src/connection/connection-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAC1B,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,SAAS,EAAE,EAAE,CAAC;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5B,wGAAwG;IACxG,YAAY,EAAE,EAAE,CAAC;IACjB,6CAA6C;IAC7C,WAAW,EAAE,EAAE,CAAC;IAChB,kEAAkE;IAClE,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CAC1B;AAED;;;;;GAKG;AACH,qBAAa,oBAAoB,CAC/B,QAAQ,CACR,SAAQ,YAAY,CAAC,gBAAgB,CAAC;;IAGtC,YAAY,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,EAGzC;IAED,IAAI,MAAM,IAAI,gBAAgB,CAE7B;IAED,mFAAmF;IACnF,IAAI,SAEH;IAED,mGAAmG;IACnG,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAE/B;IAED;;;;;;OAMG;IACH,IAAI,IAAI,UAAU,CAEjB;IAED,uEAAuE;IACvE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErB;CACF"}
1
+ {"version":3,"file":"connection-supervisor.d.ts","sourceRoot":"","sources":["../../src/connection/connection-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAC1B,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,SAAS,EAAE,EAAE,CAAC;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5B,wGAAwG;IACxG,YAAY,EAAE,EAAE,CAAC;IACjB,6CAA6C;IAC7C,WAAW,EAAE,EAAE,CAAC;IAChB,kEAAkE;IAClE,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CAC1B;AAED;;;;;GAKG;AACH,qBAAa,oBAAoB,CAC/B,QAAQ,CACR,SAAQ,YAAY,CAAC,gBAAgB,CAAC;;IAGtC,YAAY,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,EAGzC;IAED,IAAI,MAAM,IAAI,gBAAgB,CAE7B;IAED,mFAAmF;IACnF,IAAI,SAEH;IAED;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAE/B;IAED;;;;;;OAMG;IACH,IAAI,IAAI,UAAU,CAEjB;IAED,uEAAuE;IACvE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErB;CACF"}
@@ -19,7 +19,12 @@ export class ConnectionSupervisor extends EventEmitter {
19
19
  open() {
20
20
  this.#supervision.state.open();
21
21
  }
22
- /** Whether `message` was handed to an open connection. A failed delivery is reported as a loss. */
22
+ /**
23
+ * Whether `message` was handed to an open connection. A message that the
24
+ * channel refuses throws the channel's error, and the connection stays; a
25
+ * delivery that fails because the connection closed is reported as a loss
26
+ * (rpc ADR 0005).
27
+ */
23
28
  send(message) {
24
29
  return this.#supervision.state.send(message);
25
30
  }
@@ -151,7 +156,12 @@ class Connected {
151
156
  supervision.events.emit('connected');
152
157
  }
153
158
  open() { }
154
- /** The connection may report its loss while it sends, so the state is checked after the call. */
159
+ /**
160
+ * A refusal throws out of the connection's `send` before anything is sent,
161
+ * and goes to the caller. The promise rejects only when the connection is
162
+ * closed. The connection may report its loss while it sends, so the state
163
+ * is checked after the call.
164
+ */
155
165
  send(message) {
156
166
  this.#connection.send(message).catch(() => this.#lose());
157
167
  return this.#supervision.isCurrent(this);
@@ -163,7 +173,7 @@ class Connected {
163
173
  this.#supervision.become(new Closed());
164
174
  await this.#connection.close();
165
175
  }
166
- /** A close event and a failed send can both report one loss; only the first counts. */
176
+ /** A close event and a send to the closed connection can both report one loss; only the first counts. */
167
177
  #lose() {
168
178
  const supervision = this.#supervision;
169
179
  if (!supervision.isCurrent(this))
@@ -1 +1 @@
1
- {"version":3,"file":"connection-supervisor.js","sourceRoot":"","sources":["../../src/connection/connection-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAkB,MAAM,gBAAgB,CAAC;AAoBjE;;;;;GAKG;AACH,MAAM,OAAO,oBAEX,SAAQ,YAA8B;IAC7B,YAAY,CAAwB;IAE7C,YAAY,SAA8B;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;IACxC,CAAC;IAED,mFAAmF;IACnF,IAAI;QACF,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,mGAAmG;IACnG,IAAI,CAAC,OAAiB;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,E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AED,KAAK;QACH,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAI,CAAC;IAET,IAAI;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS,KAAI,CAAC;IAEd,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;CACF;AAED,MAAM,MAAM;IACD,MAAM,GAAG,QAAQ,CAAC;IAE3B,KAAK,KAAI,CAAC;IAEV,IAAI,KAAI,CAAC;IAET,IAAI;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS,KAAI,CAAC;IAEd,KAAK,CAAC,KAAK,KAAI,CAAC;CACjB"}
1
+ {"version":3,"file":"connection-supervisor.js","sourceRoot":"","sources":["../../src/connection/connection-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAkB,MAAM,gBAAgB,CAAC;AAoBjE;;;;;GAKG;AACH,MAAM,OAAO,oBAEX,SAAQ,YAA8B;IAC7B,YAAY,CAAwB;IAE7C,YAAY,SAA8B;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;IACxC,CAAC;IAED,mFAAmF;IACnF,IAAI;QACF,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,OAAiB;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;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IAE7C,YAAY,WAAkC;QAC5C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAI,CAAC;IAET,IAAI;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS,KAAI,CAAC;IAEd,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;CACF;AAED,MAAM,MAAM;IACD,MAAM,GAAG,QAAQ,CAAC;IAE3B,KAAK,KAAI,CAAC;IAEV,IAAI,KAAI,CAAC;IAET,IAAI;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS,KAAI,CAAC;IAEd,KAAK,CAAC,KAAK,KAAI,CAAC;CACjB"}
@@ -12,9 +12,12 @@ export interface ConnectionEvents {
12
12
  */
13
13
  export interface Connection<Outgoing> extends EventEmitter<ConnectionEvents> {
14
14
  /**
15
- * Rejects when the message cannot be delivered because the peer is gone.
16
- * The adapters that a coordinator answers through reject with
17
- * `ConnectionClosedError` then.
15
+ * Serializes `message` at once. A message that the channel cannot carry,
16
+ * such as a value that the structured clone refuses, throws the channel's
17
+ * own error here: nothing is sent, and the connection stays open, as
18
+ * `postMessage` does. The promise rejects only when the message cannot
19
+ * reach the peer because the connection is closed, with
20
+ * `ConnectionClosedError` (rpc ADR 0005).
18
21
  */
19
22
  send(message: Outgoing): Promise<void>;
20
23
  /** Keeps the process alive while its owner waits for a message. */
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/connection/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,yFAAyF;IACzF,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5B,2CAA2C;IAC3C,KAAK,EAAE,EAAE,CAAC;CACX;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,QAAQ,CAAE,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IAC1E;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,mEAAmE;IACnE,GAAG,IAAI,IAAI,CAAC;IACZ,oFAAoF;IACpF,KAAK,IAAI,IAAI,CAAC;IACd,oDAAoD;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/connection/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,yFAAyF;IACzF,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5B,2CAA2C;IAC3C,KAAK,EAAE,EAAE,CAAC;CACX;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,QAAQ,CAAE,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IAC1E;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,mEAAmE;IACnE,GAAG,IAAI,IAAI,CAAC;IACZ,oFAAoF;IACpF,KAAK,IAAI,IAAI,CAAC;IACd,oDAAoD;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A notification waited for the connection, and the channel refused it when
3
+ * it went out. Nothing waits for a notification, so the refusal goes to the
4
+ * process.
5
+ */
6
+ export declare class ClientWarning extends Error {
7
+ readonly code = "ZUKHRUF_RPC_NOTIFICATION_REFUSED";
8
+ readonly detail: string;
9
+ constructor(refusal: unknown, { method }: {
10
+ method: string;
11
+ });
12
+ }
13
+ //# sourceMappingURL=client-warning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-warning.d.ts","sourceRoot":"","sources":["../../src/error/client-warning.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,sCAAsC;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAO3D;CACF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A notification waited for the connection, and the channel refused it when
3
+ * it went out. Nothing waits for a notification, so the refusal goes to the
4
+ * process.
5
+ */
6
+ export class ClientWarning extends Error {
7
+ code = 'ZUKHRUF_RPC_NOTIFICATION_REFUSED';
8
+ detail;
9
+ constructor(refusal, { method }) {
10
+ super(`The channel refused a notification that waited for the connection, and the client drops it: ${Error.isError(refusal) ? refusal.message : String(refusal)}`, { cause: refusal });
11
+ this.name = 'ClientWarning';
12
+ this.detail = `method: ${method}`;
13
+ }
14
+ }
15
+ //# sourceMappingURL=client-warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-warning.js","sourceRoot":"","sources":["../../src/error/client-warning.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,IAAI,GAAG,kCAAkC,CAAC;IAC1C,MAAM,CAAS;IAExB,YAAY,OAAgB,EAAE,EAAE,MAAM,EAAsB;QAC1D,KAAK,CACH,+FAA+F,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAC3J,EAAE,KAAK,EAAE,OAAO,EAAE,CACnB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,WAAW,MAAM,EAAE,CAAC;IACpC,CAAC;CACF"}
@@ -37,7 +37,8 @@ export type EncodedReason = EncodedError | EncodedDOMException | EncodedValue;
37
37
  * its native base class and drop own fields such as `code`; this codec keeps
38
38
  * them. It rebuilds an error of a listed class, or of a native class, as an
39
39
  * instance of that class, with the peer's message, stack, cause and own
40
- * fields. It never runs the class's constructor, so a constructor's arguments
40
+ * fields, and so `RemoteSerializationError` of this package without a list.
41
+ * It never runs the class's constructor, so a constructor's arguments
41
42
  * and side effects do not matter. A `DOMException` arrives as a
42
43
  * `DOMException` with its name, so its `code` too. An error of any other class
43
44
  * arrives as a `ServerError` that keeps the peer's name and fields.
@@ -1 +1 @@
1
- {"version":3,"file":"error-codec.d.ts","sourceRoot":"","sources":["../../src/error/error-codec.ts"],"names":[],"mappings":"AAGA,kGAAkG;AAClG,MAAM,MAAM,UAAU,GAAG,QAAQ,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC;AAElE,oGAAoG;AACpG,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,4FAA4F;IAC5F,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;QAC1B,KAAK,CAAC,EAAE,aAAa,CAAC;KACvB,CAAC;CACH;AAED,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Aa,UAAU;;IAGrB,8FAA8F;IAC9F,YAAY,OAAO,EAAE,SAAS,UAAU,EAAE,EAWzC;IAED,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,CA6BrC;IAED,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAuBtC;CACF;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAqBtE"}
@@ -1,4 +1,5 @@
1
1
  import { isRecord } from '../shared/is-record.js';
2
+ import { RemoteSerializationError } from './remote-serialization-error.js';
2
3
  import { ServerError } from './server-error.js';
3
4
  /**
4
5
  * The native error classes, which the structured clone of HTML keeps by name
@@ -14,6 +15,8 @@ const natives = [
14
15
  TypeError,
15
16
  URIError,
16
17
  ];
18
+ /** The package's own errors that cross: every codec knows them, so a `Server` can answer with one. */
19
+ const own = [RemoteSerializationError];
17
20
  /** The own properties that the codec carries apart from `fields`. */
18
21
  const carried = new Set(['message', 'stack', 'cause']);
19
22
  /**
@@ -22,7 +25,8 @@ const carried = new Set(['message', 'stack', 'cause']);
22
25
  * its native base class and drop own fields such as `code`; this codec keeps
23
26
  * them. It rebuilds an error of a listed class, or of a native class, as an
24
27
  * instance of that class, with the peer's message, stack, cause and own
25
- * fields. It never runs the class's constructor, so a constructor's arguments
28
+ * fields, and so `RemoteSerializationError` of this package without a list.
29
+ * It never runs the class's constructor, so a constructor's arguments
26
30
  * and side effects do not matter. A `DOMException` arrives as a
27
31
  * `DOMException` with its name, so its `code` too. An error of any other class
28
32
  * arrives as a `ServerError` that keeps the peer's name and fields.
@@ -31,7 +35,7 @@ export class ErrorCodec {
31
35
  #classes = new Map();
32
36
  /** Throws a `RangeError` when two classes have one name, because the name is what crosses. */
33
37
  constructor(classes) {
34
- for (const errorClass of [...natives, ...classes]) {
38
+ for (const errorClass of [...natives, ...own, ...classes]) {
35
39
  const known = this.#classes.get(errorClass.name);
36
40
  if (known === errorClass)
37
41
  continue;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O,CAAC;IAChB,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,SAAS,GAAY,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,WAAW,GAAY,QAAQ,CAAC,SAAS,CAAC;QAC9C,CAAC,CAAC,SAAS,CAAC,WAAW;QACvB,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,OAAO,WAAW,KAAK,UAAU,IAAI,WAAW,CAAC,IAAI,KAAK,EAAE;QACjE,CAAC,CAAC,WAAW,CAAC,IAAI;QAClB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;AACjB,CAAC;AAED,qHAAqH;AACrH,SAAS,YAAY,CAAC,UAAsB;IAC1C,KACE,IAAI,OAAO,GAAY,UAAU,EACjC,OAAO,OAAO,KAAK,UAAU,EAC7B,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,EACxC,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC;QAClE,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oGAAoG;AACpG,SAAS,MAAM,CACb,KAAY,EACZ,GAAW,EACX,KAAc,EACd,UAAmB;IAEnB,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE;QAChC,KAAK;QACL,UAAU;QACV,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The answer to a call that the peer's channel refused to carry, such as a
3
+ * value that the structured clone cannot clone. The method ran on the peer,
4
+ * so the caller decides whether to make the call again. The `cause` is the
5
+ * channel's refusal (StreamJsonRpc's `RemoteSerializationException`).
6
+ */
7
+ export declare class RemoteSerializationError extends Error {
8
+ constructor(options?: ErrorOptions);
9
+ }
10
+ //# sourceMappingURL=remote-serialization-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-serialization-error.d.ts","sourceRoot":"","sources":["../../src/error/remote-serialization-error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAO,CAAC,EAAE,YAAY,EAMjC;CACF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The answer to a call that the peer's channel refused to carry, such as a
3
+ * value that the structured clone cannot clone. The method ran on the peer,
4
+ * so the caller decides whether to make the call again. The `cause` is the
5
+ * channel's refusal (StreamJsonRpc's `RemoteSerializationException`).
6
+ */
7
+ export class RemoteSerializationError extends Error {
8
+ constructor(options) {
9
+ super('The peer ran the method, but its channel refused to carry the answer.', options);
10
+ this.name = 'RemoteSerializationError';
11
+ }
12
+ }
13
+ //# sourceMappingURL=remote-serialization-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-serialization-error.js","sourceRoot":"","sources":["../../src/error/remote-serialization-error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAsB;QAChC,KAAK,CACH,uEAAuE,EACvE,OAAO,CACR,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -12,8 +12,10 @@ export { type Connection, type ConnectionEvents, } from './connection/connection
12
12
  export { ConnectionClosedError } from './connection/connection-closed-error.ts';
13
13
  export { ConnectionSupervisor, type SupervisorEvents, type SupervisorStatus, } from './connection/connection-supervisor.ts';
14
14
  export { type Connector } from './connection/connector.ts';
15
+ export { ClientWarning } from './error/client-warning.ts';
15
16
  export { ConnectionLostError } from './error/connection-lost-error.ts';
16
17
  export { type EncodedDOMException, type EncodedError, type EncodedReason, type EncodedValue, type ErrorClass, ErrorCodec, isEncodedReason, } from './error/error-codec.ts';
18
+ export { RemoteSerializationError } from './error/remote-serialization-error.ts';
17
19
  export { ServerError } from './error/server-error.ts';
18
20
  export { ServerWarning } from './error/server-warning.ts';
19
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,KAAK,OAAO,EACZ,KAAK,SAAS,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACL,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA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AyC,CAAC;AAChF,OAAO,EACL,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,UAAU,EACV,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -12,8 +12,10 @@ export {} from './connection/connection.js';
12
12
  export { ConnectionClosedError } from './connection/connection-closed-error.js';
13
13
  export { ConnectionSupervisor, } from './connection/connection-supervisor.js';
14
14
  export {} from './connection/connector.js';
15
+ export { ClientWarning } from './error/client-warning.js';
15
16
  export { ConnectionLostError } from './error/connection-lost-error.js';
16
17
  export { ErrorCodec, isEncodedReason, } from './error/error-codec.js';
18
+ export { RemoteSerializationError } from './error/remote-serialization-error.js';
17
19
  export { ServerError } from './error/server-error.js';
18
20
  export { ServerWarning } from './error/server-warning.js';
19
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAuB,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,wBA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O,EAAE,MAAM,EAAsB,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAGN,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACL,oBAAoB,GAGrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAML,UAAU,EACV,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/rpc",
3
- "version": "0.8.213",
3
+ "version": "0.8.214",
4
4
  "description": "Calls between threads and processes over a worker, a port or an IPC channel: a supervised connection, calls that reject at once when the peer goes or go again, and errors that keep their class and fields. After Go's net/rpc and .NET's StreamJsonRpc.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,11 +42,11 @@
42
42
  "access": "public"
43
43
  },
44
44
  "dependencies": {
45
- "@zukhruf/async": "^0.8.213"
45
+ "@zukhruf/async": "^0.8.214"
46
46
  },
47
47
  "devDependencies": {
48
- "@zukhruf/parameterized-test": "^0.8.213",
49
- "@zukhruf/process": "^0.8.213",
50
- "@zukhruf/testing": "^0.8.213"
48
+ "@zukhruf/parameterized-test": "^0.8.214",
49
+ "@zukhruf/process": "^0.8.214",
50
+ "@zukhruf/testing": "^0.8.214"
51
51
  }
52
52
  }