@zukhruf/rpc 0.8.208 → 0.8.210

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -122,7 +122,7 @@ A call holds the link from its add until it is taken, so the process exits only
122
122
 
123
123
  ## Carry errors across
124
124
 
125
- `new ErrorCodec(classes)` encodes a thrown value as `{ name, message, stack, fields, cause }`, and rebuilds it on the other end. `structuredClone` and `v8.serialize` rebuild every error as its native base class and drop own fields such as `code`. The codec rebuilds an error of a listed class, or of a native class (`Error`, `TypeError`, `RangeError` and the others that HTML's structured clone keeps), as an instance of that class with the peer's message, stack, cause and own fields. It does not run the class's constructor. An error of a class that the codec does not list arrives as a `ServerError` with the peer's name, message and fields. A thrown value that is not an error arrives as it is.
125
+ `new ErrorCodec(classes)` encodes a thrown value as `{ name, message, stack, fields, cause }`, a `DOMException` as `{ domException: { name, message, stack, cause } }`, and rebuilds it on the other end. `structuredClone` and `v8.serialize` rebuild every error as its native base class and drop own fields such as `code`. The codec rebuilds an error of a listed class, or of a native class (`Error`, `TypeError`, `RangeError` and the others that HTML's structured clone keeps), as an instance of that class with the peer's message, stack, cause and own fields. It does not run the class's constructor. A `DOMException`, such as the `AbortError` of an aborted signal, arrives as a `DOMException` with its name, so with its `code`, and with its message, stack and cause, as the structured clone gives it; a subclass arrives as a plain `DOMException`, without its own fields. An error of a class that the codec does not list arrives as a `ServerError` with the peer's name, message and fields. A thrown value that is not an error arrives as it is.
126
126
 
127
127
  ## Share a channel with the application
128
128
 
@@ -167,6 +167,7 @@ A call holds the link from its add until it is taken, so the process exits only
167
167
  | A remote error | Go `rpc.ServerError`; StreamJsonRpc `RemoteInvocationException` |
168
168
  | The message shape | [JSON-RPC 2.0](https://www.jsonrpc.org/specification), sections 4 and 5 |
169
169
  | The errors that survive a clone | HTML [structured clone](https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal) of `[[ErrorData]]` |
170
+ | A `DOMException` that crosses | WebIDL [DOMException serialization steps](https://webidl.spec.whatwg.org/#idl-DOMException) |
170
171
 
171
172
  comlink 4.4.2, birpc 4.2.0 and vscode-jsonrpc 10.0.2 were probed on Node 26.13.1 (#4984, paper v2): each leaves a call pending after its thread exits, and each loses the `code` of a thrown error.
172
173
 
@@ -225,6 +226,11 @@ export class ErrorCodec {
225
226
  encode(reason: unknown): EncodedReason;
226
227
  decode(encoded: EncodedReason): unknown;
227
228
  }
229
+ export type EncodedReason = EncodedError | EncodedDOMException | EncodedValue;
230
+ export interface EncodedDOMException {
231
+ domException: { name: string; message: string; stack: string | undefined; cause?: EncodedReason };
232
+ }
233
+ export function isEncodedReason(value: unknown): value is EncodedReason;
228
234
  ````
229
235
 
230
236
  ## Documentation
@@ -14,7 +14,23 @@ export interface EncodedError {
14
14
  export interface EncodedValue {
15
15
  value: unknown;
16
16
  }
17
- export type EncodedReason = EncodedError | EncodedValue;
17
+ /**
18
+ * A `DOMException` as it crosses: its name, which sets its `code`, its text
19
+ * and its cause. WebIDL serializes a DOMException by its name, message and
20
+ * stack, and so does the codec, with the cause, which the codec keeps for
21
+ * every error. A subclass crosses as a plain DOMException, as WebIDL's steps
22
+ * give it, and the own fields of a subclass, such as those of
23
+ * `QuotaExceededError`, stay behind.
24
+ */
25
+ export interface EncodedDOMException {
26
+ domException: {
27
+ name: string;
28
+ message: string;
29
+ stack: string | undefined;
30
+ cause?: EncodedReason;
31
+ };
32
+ }
33
+ export type EncodedReason = EncodedError | EncodedDOMException | EncodedValue;
18
34
  /**
19
35
  * Turns a thrown value into data that a message channel or a JSON line can
20
36
  * carry, and back. `structuredClone` and `v8.serialize` rebuild every error as
@@ -22,8 +38,9 @@ export type EncodedReason = EncodedError | EncodedValue;
22
38
  * them. It rebuilds an error of a listed class, or of a native class, as an
23
39
  * instance of that class, with the peer's message, stack, cause and own
24
40
  * fields. It never runs the class's constructor, so a constructor's arguments
25
- * and side effects do not matter. An error of any other class arrives as a
26
- * `ServerError` that keeps the peer's name and fields.
41
+ * and side effects do not matter. A `DOMException` arrives as a
42
+ * `DOMException` with its name, so its `code` too. An error of any other class
43
+ * arrives as a `ServerError` that keeps the peer's name and fields.
27
44
  */
28
45
  export declare class ErrorCodec {
29
46
  #private;
@@ -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,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,YAAY,CAAC;AAoBxD;;;;;;;;;GASG;AACH,qBAAa,UAAU;;IAGrB,8FAA8F;IAC9F,YAAY,OAAO,EAAE,SAAS,UAAU,EAAE,EAWzC;IAED,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,CAgBrC;IAED,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CActC;CACF;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAUtE"}
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,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,mBAAmB,GAAG,YAAY,CAAC;AAoB9E;;;;;;;;;;GAUG;AACH,qBAAa,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"}
@@ -23,8 +23,9 @@ const carried = new Set(['message', 'stack', 'cause']);
23
23
  * them. It rebuilds an error of a listed class, or of a native class, as an
24
24
  * instance of that class, with the peer's message, stack, cause and own
25
25
  * fields. It never runs the class's constructor, so a constructor's arguments
26
- * and side effects do not matter. An error of any other class arrives as a
27
- * `ServerError` that keeps the peer's name and fields.
26
+ * and side effects do not matter. A `DOMException` arrives as a
27
+ * `DOMException` with its name, so its `code` too. An error of any other class
28
+ * arrives as a `ServerError` that keeps the peer's name and fields.
28
29
  */
29
30
  export class ErrorCodec {
30
31
  #classes = new Map();
@@ -41,6 +42,19 @@ export class ErrorCodec {
41
42
  }
42
43
  }
43
44
  encode(reason) {
45
+ if (isDOMException(reason)) {
46
+ const encoded = {
47
+ domException: {
48
+ name: reason.name,
49
+ message: reason.message,
50
+ stack: reason.stack,
51
+ },
52
+ };
53
+ if (Object.hasOwn(reason, 'cause')) {
54
+ encoded.domException.cause = this.encode(reason.cause);
55
+ }
56
+ return encoded;
57
+ }
44
58
  if (!Error.isError(reason))
45
59
  return { value: reason };
46
60
  const fields = {};
@@ -62,6 +76,12 @@ export class ErrorCodec {
62
76
  decode(encoded) {
63
77
  if ('value' in encoded)
64
78
  return encoded.value;
79
+ if ('domException' in encoded) {
80
+ const { name, message, stack, cause } = encoded.domException;
81
+ const error = new DOMException(message, cause ? { name, cause: this.decode(cause) } : { name });
82
+ define(error, 'stack', stack, false);
83
+ return error;
84
+ }
65
85
  const known = this.#classes.get(encoded.name);
66
86
  const error = known
67
87
  ? Reflect.construct(nativeBaseOf(known), [encoded.message], known)
@@ -83,12 +103,38 @@ export function isEncodedReason(value) {
83
103
  return false;
84
104
  if (Object.hasOwn(value, 'value'))
85
105
  return true;
106
+ if (Object.hasOwn(value, 'domException')) {
107
+ const { domException } = value;
108
+ return (isRecord(domException) &&
109
+ typeof domException.name === 'string' &&
110
+ typeof domException.message === 'string' &&
111
+ (domException.stack === undefined ||
112
+ typeof domException.stack === 'string') &&
113
+ (domException.cause === undefined || isEncodedReason(domException.cause)));
114
+ }
86
115
  return (typeof value.name === 'string' &&
87
116
  typeof value.message === 'string' &&
88
117
  (value.stack === undefined || typeof value.stack === 'string') &&
89
118
  isRecord(value.fields) &&
90
119
  (value.cause === undefined || isEncodedReason(value.cause)));
91
120
  }
121
+ /**
122
+ * Whether `value` is a `DOMException`, by its brand: the getter of `name`
123
+ * refuses a receiver that is no DOMException (WebIDL, "attribute getter"),
124
+ * also an object made from its prototype, which `instanceof` takes. A
125
+ * DOMException is a native error too, so this is checked before the error.
126
+ */
127
+ function isDOMException(value) {
128
+ try {
129
+ Reflect.get(DOMException.prototype, 'name', value);
130
+ return true;
131
+ }
132
+ catch (refusal) {
133
+ if (refusal instanceof TypeError)
134
+ return false;
135
+ throw refusal;
136
+ }
137
+ }
92
138
  /** The name of the error's own class, or its `name` when its class has none. */
93
139
  function classNameOf(error) {
94
140
  const prototype = Object.getPrototypeOf(error);
@@ -1 +1 @@
1
- {"version":3,"file":"error-codec.js","sourceRoot":"","sources":["../../src/error/error-codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAuBhD;;;;GAIG;AACH,MAAM,OAAO,GAA0B;IACrC,KAAK;IACL,SAAS;IACT,UAAU;IACV,cAAc;IACd,WAAW;IACX,SAAS;IACT,QAAQ;CACT,CAAC;AAEF,qEAAqE;AACrE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,OAAO,UAAU;IACZ,QAAQ,GAAG,IAAI,GAAG,EAAsB,CAAC;IAElD,8FAA8F;IAC9F,YAAY,OAA8B;QACxC,KAAK,MAAM,UAAU,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;YAClD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACjD,IAAI,KAAK,KAAK,UAAU;gBAAE,SAAS;YACnC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,IAAI,UAAU,CAClB,gCAAgC,UAAU,CAAC,IAAI,6CAA6C,CAC7F,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,GAAG,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,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"}
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ 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
15
  export { ConnectionLostError } from './error/connection-lost-error.ts';
16
- export { type EncodedError, type EncodedReason, type EncodedValue, type ErrorClass, ErrorCodec, } from './error/error-codec.ts';
16
+ export { type EncodedDOMException, type EncodedError, type EncodedReason, type EncodedValue, type ErrorClass, ErrorCodec, isEncodedReason, } from './error/error-codec.ts';
17
17
  export { ServerError } from './error/server-error.ts';
18
18
  export { ServerWarning } from './error/server-warning.ts';
19
19
  //# sourceMappingURL=index.d.ts.map
@@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AAE,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,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ 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
15
  export { ConnectionLostError } from './error/connection-lost-error.js';
16
- export { ErrorCodec, } from './error/error-codec.js';
16
+ export { ErrorCodec, isEncodedReason, } from './error/error-codec.js';
17
17
  export { ServerError } from './error/server-error.js';
18
18
  export { ServerWarning } from './error/server-warning.js';
19
19
  //# 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,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAoB,MAAM,EAAsB,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAIN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,YAAY,GAGb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAKN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAsB,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAGN,MAAM,4BAA4B,CAA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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.208",
3
+ "version": "0.8.210",
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,10 +42,11 @@
42
42
  "access": "public"
43
43
  },
44
44
  "dependencies": {
45
- "@zukhruf/async": "^0.8.208"
45
+ "@zukhruf/async": "^0.8.210"
46
46
  },
47
47
  "devDependencies": {
48
- "@zukhruf/process": "^0.8.208",
49
- "@zukhruf/testing": "^0.8.208"
48
+ "@zukhruf/parameterized-test": "^0.8.210",
49
+ "@zukhruf/process": "^0.8.210",
50
+ "@zukhruf/testing": "^0.8.210"
50
51
  }
51
52
  }