@powerlines/engine 0.46.6 → 0.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/api.cjs +18 -18
  2. package/dist/api.d.mts +1 -1
  3. package/dist/api.mjs +16 -16
  4. package/dist/{base-context-CbFlRUd-.cjs → base-context-DLemGRbd.cjs} +12 -12
  5. package/dist/{base-context-Ce9PuQ9z.mjs → base-context-DUha4Lz-.mjs} +17 -17
  6. package/dist/{base-context-Ce9PuQ9z.mjs.map → base-context-DUha4Lz-.mjs.map} +1 -1
  7. package/dist/context/index.cjs +3 -3
  8. package/dist/context/index.d.mts +1 -1
  9. package/dist/context/index.mjs +3 -3
  10. package/dist/{engine-context-CEbC9dHR.mjs → engine-context-BfFiKN53.mjs} +3 -3
  11. package/dist/{engine-context-CEbC9dHR.mjs.map → engine-context-BfFiKN53.mjs.map} +1 -1
  12. package/dist/{engine-context-D-rpz-J2.cjs → engine-context-D0y88i_J.cjs} +2 -2
  13. package/dist/{execution-context-DUtt6PWE.mjs → execution-context-CE5H90Um.mjs} +51 -50
  14. package/dist/execution-context-CE5H90Um.mjs.map +1 -0
  15. package/dist/{execution-context-9aXwcpL6.cjs → execution-context-CnyaM3Ul.cjs} +33 -32
  16. package/dist/{execution-context-Da_wozne.d.mts → execution-context-YrjFeD9k.d.mts} +1 -1
  17. package/dist/{execution-context-Da_wozne.d.mts.map → execution-context-YrjFeD9k.d.mts.map} +1 -1
  18. package/dist/{fs-D1nIP45P.mjs → fs-Dcle8lUp.mjs} +1 -1
  19. package/dist/{fs-D1nIP45P.mjs.map → fs-Dcle8lUp.mjs.map} +1 -1
  20. package/dist/index.cjs +5 -5
  21. package/dist/index.mjs +5 -5
  22. package/dist/rpc/client.cjs +74 -0
  23. package/dist/rpc/client.d.cts +31 -0
  24. package/dist/rpc/client.d.cts.map +1 -0
  25. package/dist/rpc/client.d.mts +31 -0
  26. package/dist/rpc/client.d.mts.map +1 -0
  27. package/dist/rpc/client.mjs +71 -0
  28. package/dist/rpc/client.mjs.map +1 -0
  29. package/dist/rpc/serialization.cjs +82 -0
  30. package/dist/rpc/serialization.d.cts +46 -0
  31. package/dist/rpc/serialization.d.cts.map +1 -0
  32. package/dist/rpc/serialization.d.mts +46 -0
  33. package/dist/rpc/serialization.d.mts.map +1 -0
  34. package/dist/rpc/serialization.mjs +76 -0
  35. package/dist/rpc/serialization.mjs.map +1 -0
  36. package/dist/rpc/server.cjs +69 -0
  37. package/dist/rpc/server.d.cts +29 -0
  38. package/dist/rpc/server.d.cts.map +1 -0
  39. package/dist/rpc/server.d.mts +29 -0
  40. package/dist/rpc/server.d.mts.map +1 -0
  41. package/dist/rpc/server.mjs +66 -0
  42. package/dist/rpc/server.mjs.map +1 -0
  43. package/dist/rpc/types.cjs +0 -0
  44. package/dist/rpc/types.d.cts +70 -0
  45. package/dist/rpc/types.d.cts.map +1 -0
  46. package/dist/rpc/types.d.mts +70 -0
  47. package/dist/rpc/types.d.mts.map +1 -0
  48. package/dist/rpc/types.mjs +1 -0
  49. package/dist/schemas.cjs +1 -1
  50. package/dist/schemas.mjs +1 -1
  51. package/dist/storage/base.cjs +216 -0
  52. package/dist/storage/base.d.cts +199 -0
  53. package/dist/storage/base.d.cts.map +1 -0
  54. package/dist/storage/base.d.mts +199 -0
  55. package/dist/storage/base.d.mts.map +1 -0
  56. package/dist/storage/base.mjs +215 -0
  57. package/dist/storage/base.mjs.map +1 -0
  58. package/dist/storage/file-system.cjs +180 -0
  59. package/dist/storage/file-system.d.cts +127 -0
  60. package/dist/storage/file-system.d.cts.map +1 -0
  61. package/dist/storage/file-system.d.mts +127 -0
  62. package/dist/storage/file-system.d.mts.map +1 -0
  63. package/dist/storage/file-system.mjs +179 -0
  64. package/dist/storage/file-system.mjs.map +1 -0
  65. package/dist/storage/helpers.cjs +37 -0
  66. package/dist/storage/helpers.d.cts +25 -0
  67. package/dist/storage/helpers.d.cts.map +1 -0
  68. package/dist/storage/helpers.d.mts +25 -0
  69. package/dist/storage/helpers.d.mts.map +1 -0
  70. package/dist/storage/helpers.mjs +34 -0
  71. package/dist/storage/helpers.mjs.map +1 -0
  72. package/dist/storage/index.cjs +10 -7
  73. package/dist/storage/index.d.cts +5 -419
  74. package/dist/storage/index.d.mts +5 -419
  75. package/dist/storage/index.mjs +4 -1
  76. package/dist/storage/virtual.cjs +98 -0
  77. package/dist/storage/virtual.d.cts +80 -0
  78. package/dist/storage/virtual.d.cts.map +1 -0
  79. package/dist/storage/virtual.d.mts +80 -0
  80. package/dist/storage/virtual.d.mts.map +1 -0
  81. package/dist/storage/virtual.mjs +97 -0
  82. package/dist/storage/virtual.mjs.map +1 -0
  83. package/dist/{ts-morph-D0CaA37w.mjs → ts-morph-C6YBNc46.mjs} +1 -1
  84. package/dist/{ts-morph-D0CaA37w.mjs.map → ts-morph-C6YBNc46.mjs.map} +1 -1
  85. package/dist/{tsconfig-BUDqmOaT.cjs → tsconfig-DeKMGasE.cjs} +2 -2
  86. package/dist/{tsconfig-MeFEs21S.mjs → tsconfig-HzJsMUrr.mjs} +3 -3
  87. package/dist/{tsconfig-MeFEs21S.mjs.map → tsconfig-HzJsMUrr.mjs.map} +1 -1
  88. package/dist/typescript/index.cjs +2 -2
  89. package/dist/typescript/index.mjs +2 -2
  90. package/package.json +5 -4
  91. package/dist/execution-context-DUtt6PWE.mjs.map +0 -1
  92. package/dist/storage/index.d.cts.map +0 -1
  93. package/dist/storage/index.d.mts.map +0 -1
  94. package/dist/virtual-CYGZHTDd.mjs +0 -513
  95. package/dist/virtual-CYGZHTDd.mjs.map +0 -1
  96. package/dist/virtual-Ct3ZqPeN.cjs +0 -548
  97. /package/dist/{fs-XogSgMqT.cjs → fs-CeEdzPKE.cjs} +0 -0
  98. /package/dist/{ts-morph-BaLPVAdB.cjs → ts-morph-BbM83PT9.cjs} +0 -0
@@ -0,0 +1,46 @@
1
+ import { deserialize as structuredCloneDeserialize, parse as structuredCloneParse, serialize as structuredCloneSerialize, stringify as structuredCloneStringify } from "structured-clone-es";
2
+
3
+ //#region src/rpc/serialization.d.ts
4
+ /**
5
+ * Wire format used by the WS RPC transport.
6
+ *
7
+ * - **JSON (default, unprefixed):** payload is plain JSON text. Used when
8
+ * the dispatched method is declared `jsonSerializable: true`. Encoded
9
+ * via {@link strictJsonStringify} (rejects non-JSON values), decoded
10
+ * via `JSON.parse`.
11
+ * - **Structured-clone (`s:` prefix):** payload is `s:` followed by
12
+ * `structured-clone-es` text. Used when the method is declared
13
+ * `jsonSerializable: false` (or omitted, the default). Round-trips
14
+ * `Map`, `Set`, `Date`, `BigInt`, cycles, and class instances.
15
+ *
16
+ * birpc envelopes always start with `{`, so a leading byte that is not
17
+ * `s` is unambiguously JSON. Each direction independently chooses its
18
+ * encoding from local definitions — request and response are not
19
+ * coupled by a mirror rule.
20
+ */
21
+ declare const STRUCTURED_CLONE_PREFIX = "s:";
22
+ /**
23
+ * `JSON.stringify` with a single-pass strict replacer.
24
+ *
25
+ * Throws `DF0020` synchronously when the value contains a type JSON
26
+ * cannot round-trip losslessly: `Map`, `Set`, `Date`, `BigInt`, class
27
+ * instances, or `undefined` inside an array (silently becomes `null`).
28
+ *
29
+ * Native pass-throughs (no extra work needed):
30
+ * - circular references — `JSON.stringify` raises `TypeError`.
31
+ * - `BigInt` at top level — caught here for a friendlier error path.
32
+ *
33
+ * Lenient cases (allowed without throwing):
34
+ * - `undefined` as an object property — legitimate optional field;
35
+ * JSON.stringify just omits it.
36
+ * - `undefined` at the root — legitimate "action returned nothing".
37
+ * - `Symbol` / `Function` values — semantically "drop me" in JSON.
38
+ *
39
+ * `fnName` is used only for the diagnostic message — pass the RPC
40
+ * function name when calling from a wire serializer / dump writer so
41
+ * the error points at the offending function.
42
+ */
43
+ declare function strictJsonStringify(value: unknown, fnName?: string): string;
44
+ //#endregion
45
+ export { STRUCTURED_CLONE_PREFIX, strictJsonStringify, structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify };
46
+ //# sourceMappingURL=serialization.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialization.d.mts","names":[],"sources":["../../src/rpc/serialization.ts"],"mappings":";;;;AAiDA;;;;;AAuBA;;;;;;;;;;;cAvBa,uBAAA;;;;;;;;;;;;;;;;;;;;;;iBAuBG,mBAAA,CACd,KAAA,WACA,MAAA"}
@@ -0,0 +1,76 @@
1
+ import { deserialize as structuredCloneDeserialize, parse as structuredCloneParse, serialize as structuredCloneSerialize, stringify as structuredCloneStringify } from "structured-clone-es";
2
+
3
+ //#region src/rpc/serialization.ts
4
+ /**
5
+ * Wire format used by the WS RPC transport.
6
+ *
7
+ * - **JSON (default, unprefixed):** payload is plain JSON text. Used when
8
+ * the dispatched method is declared `jsonSerializable: true`. Encoded
9
+ * via {@link strictJsonStringify} (rejects non-JSON values), decoded
10
+ * via `JSON.parse`.
11
+ * - **Structured-clone (`s:` prefix):** payload is `s:` followed by
12
+ * `structured-clone-es` text. Used when the method is declared
13
+ * `jsonSerializable: false` (or omitted, the default). Round-trips
14
+ * `Map`, `Set`, `Date`, `BigInt`, cycles, and class instances.
15
+ *
16
+ * birpc envelopes always start with `{`, so a leading byte that is not
17
+ * `s` is unambiguously JSON. Each direction independently chooses its
18
+ * encoding from local definitions — request and response are not
19
+ * coupled by a mirror rule.
20
+ */
21
+ const STRUCTURED_CLONE_PREFIX = "s:";
22
+ /**
23
+ * `JSON.stringify` with a single-pass strict replacer.
24
+ *
25
+ * Throws `DF0020` synchronously when the value contains a type JSON
26
+ * cannot round-trip losslessly: `Map`, `Set`, `Date`, `BigInt`, class
27
+ * instances, or `undefined` inside an array (silently becomes `null`).
28
+ *
29
+ * Native pass-throughs (no extra work needed):
30
+ * - circular references — `JSON.stringify` raises `TypeError`.
31
+ * - `BigInt` at top level — caught here for a friendlier error path.
32
+ *
33
+ * Lenient cases (allowed without throwing):
34
+ * - `undefined` as an object property — legitimate optional field;
35
+ * JSON.stringify just omits it.
36
+ * - `undefined` at the root — legitimate "action returned nothing".
37
+ * - `Symbol` / `Function` values — semantically "drop me" in JSON.
38
+ *
39
+ * `fnName` is used only for the diagnostic message — pass the RPC
40
+ * function name when calling from a wire serializer / dump writer so
41
+ * the error points at the offending function.
42
+ */
43
+ function strictJsonStringify(value, fnName = "") {
44
+ return JSON.stringify(value, function strictReplacer(key, val) {
45
+ const holder = this;
46
+ const original = holder != null ? holder[key] : val;
47
+ if (original === void 0) {
48
+ if (Array.isArray(holder)) throw nonJsonAt(fnName, "undefined", holder, key);
49
+ return val;
50
+ }
51
+ if (original === null) return val;
52
+ if (typeof original === "bigint") throw nonJsonAt(fnName, "BigInt", holder, key);
53
+ if (typeof original === "object") {
54
+ if (original instanceof Map) throw nonJsonAt(fnName, "Map", holder, key);
55
+ if (original instanceof Set) throw nonJsonAt(fnName, "Set", holder, key);
56
+ if (original instanceof Date) throw nonJsonAt(fnName, "Date", holder, key);
57
+ if (Array.isArray(original)) return val;
58
+ const proto = Object.getPrototypeOf(original);
59
+ if (proto !== null && proto !== Object.prototype) throw nonJsonAt(fnName, original.constructor?.name ?? "class instance", holder, key);
60
+ }
61
+ return val;
62
+ });
63
+ }
64
+ function nonJsonAt(fnName, type, parent, key) {
65
+ const path = formatPath(parent, key);
66
+ return /* @__PURE__ */ new Error(`Serialization error: ${fnName || "<anonymous>"} - ${type} at ${path}`);
67
+ }
68
+ function formatPath(parent, key) {
69
+ if (Array.isArray(parent)) return `[${key}]`;
70
+ if (key === "") return "<root>";
71
+ return key;
72
+ }
73
+
74
+ //#endregion
75
+ export { STRUCTURED_CLONE_PREFIX, strictJsonStringify, structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify };
76
+ //# sourceMappingURL=serialization.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialization.mjs","names":[],"sources":["../../src/rpc/serialization.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n deserialize as structuredCloneDeserialize,\n parse as structuredCloneParse,\n serialize as structuredCloneSerialize,\n stringify as structuredCloneStringify\n} from \"structured-clone-es\";\n\nexport {\n structuredCloneDeserialize,\n structuredCloneParse,\n structuredCloneSerialize,\n structuredCloneStringify\n};\n\n/**\n * Wire format used by the WS RPC transport.\n *\n * - **JSON (default, unprefixed):** payload is plain JSON text. Used when\n * the dispatched method is declared `jsonSerializable: true`. Encoded\n * via {@link strictJsonStringify} (rejects non-JSON values), decoded\n * via `JSON.parse`.\n * - **Structured-clone (`s:` prefix):** payload is `s:` followed by\n * `structured-clone-es` text. Used when the method is declared\n * `jsonSerializable: false` (or omitted, the default). Round-trips\n * `Map`, `Set`, `Date`, `BigInt`, cycles, and class instances.\n *\n * birpc envelopes always start with `{`, so a leading byte that is not\n * `s` is unambiguously JSON. Each direction independently chooses its\n * encoding from local definitions — request and response are not\n * coupled by a mirror rule.\n */\nexport const STRUCTURED_CLONE_PREFIX = \"s:\";\n\n/**\n * `JSON.stringify` with a single-pass strict replacer.\n *\n * Throws `DF0020` synchronously when the value contains a type JSON\n * cannot round-trip losslessly: `Map`, `Set`, `Date`, `BigInt`, class\n * instances, or `undefined` inside an array (silently becomes `null`).\n *\n * Native pass-throughs (no extra work needed):\n * - circular references — `JSON.stringify` raises `TypeError`.\n * - `BigInt` at top level — caught here for a friendlier error path.\n *\n * Lenient cases (allowed without throwing):\n * - `undefined` as an object property — legitimate optional field;\n * JSON.stringify just omits it.\n * - `undefined` at the root — legitimate \"action returned nothing\".\n * - `Symbol` / `Function` values — semantically \"drop me\" in JSON.\n *\n * `fnName` is used only for the diagnostic message — pass the RPC\n * function name when calling from a wire serializer / dump writer so\n * the error points at the offending function.\n */\nexport function strictJsonStringify(\n value: unknown,\n fnName: string = \"\"\n): string {\n return JSON.stringify(\n value,\n function strictReplacer(this: unknown, key: string, val: unknown): unknown {\n // The replacer receives the value AFTER any `toJSON()` coercion\n // (e.g. `Date` already became an ISO string). To detect raw types,\n // peek at the holder's original property via `this[key]`. At the\n // root, `this` is the wrapper `{ '': value }` so `this['']` is the\n // raw root value.\n const holder = this as Record<string, unknown> | unknown[] | undefined;\n const original = holder != null ? (holder as any)[key] : val;\n\n if (original === undefined) {\n if (Array.isArray(holder))\n throw nonJsonAt(fnName, \"undefined\", holder, key);\n return val;\n }\n if (original === null) return val;\n\n if (typeof original === \"bigint\")\n throw nonJsonAt(fnName, \"BigInt\", holder, key);\n\n if (typeof original === \"object\") {\n if (original instanceof Map)\n throw nonJsonAt(fnName, \"Map\", holder, key);\n if (original instanceof Set)\n throw nonJsonAt(fnName, \"Set\", holder, key);\n if (original instanceof Date)\n throw nonJsonAt(fnName, \"Date\", holder, key);\n if (Array.isArray(original)) return val;\n const proto = Object.getPrototypeOf(original);\n if (proto !== null && proto !== Object.prototype) {\n const ctorName =\n (original as { constructor?: { name?: string } }).constructor\n ?.name ?? \"class instance\";\n throw nonJsonAt(fnName, ctorName, holder, key);\n }\n }\n\n return val;\n }\n );\n}\n\nfunction nonJsonAt(\n fnName: string,\n type: string,\n parent: unknown,\n key: string\n): Error {\n const path = formatPath(parent, key);\n\n return new Error(\n `Serialization error: ${fnName || \"<anonymous>\"} - ${type} at ${path}`\n );\n}\n\nfunction formatPath(parent: unknown, key: string): string {\n if (Array.isArray(parent)) return `[${key}]`;\n if (key === \"\") return \"<root>\";\n return key;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;;AAuBvC,SAAgB,oBACd,OACA,SAAiB,IACT;AACR,QAAO,KAAK,UACV,OACA,SAAS,eAA8B,KAAa,KAAuB;EAMzE,MAAM,SAAS;EACf,MAAM,WAAW,UAAU,OAAQ,OAAe,OAAO;AAEzD,MAAI,aAAa,QAAW;AAC1B,OAAI,MAAM,QAAQ,OAAO,CACvB,OAAM,UAAU,QAAQ,aAAa,QAAQ,IAAI;AACnD,UAAO;;AAET,MAAI,aAAa,KAAM,QAAO;AAE9B,MAAI,OAAO,aAAa,SACtB,OAAM,UAAU,QAAQ,UAAU,QAAQ,IAAI;AAEhD,MAAI,OAAO,aAAa,UAAU;AAChC,OAAI,oBAAoB,IACtB,OAAM,UAAU,QAAQ,OAAO,QAAQ,IAAI;AAC7C,OAAI,oBAAoB,IACtB,OAAM,UAAU,QAAQ,OAAO,QAAQ,IAAI;AAC7C,OAAI,oBAAoB,KACtB,OAAM,UAAU,QAAQ,QAAQ,QAAQ,IAAI;AAC9C,OAAI,MAAM,QAAQ,SAAS,CAAE,QAAO;GACpC,MAAM,QAAQ,OAAO,eAAe,SAAS;AAC7C,OAAI,UAAU,QAAQ,UAAU,OAAO,UAIrC,OAAM,UAAU,QAFb,SAAiD,aAC9C,QAAQ,kBACoB,QAAQ,IAAI;;AAIlD,SAAO;GAEV;;AAGH,SAAS,UACP,QACA,MACA,QACA,KACO;CACP,MAAM,OAAO,WAAW,QAAQ,IAAI;AAEpC,wBAAO,IAAI,MACT,wBAAwB,UAAU,cAAc,KAAK,KAAK,MAAM,OACjE;;AAGH,SAAS,WAAW,QAAiB,KAAqB;AACxD,KAAI,MAAM,QAAQ,OAAO,CAAE,QAAO,IAAI,IAAI;AAC1C,KAAI,QAAQ,GAAI,QAAO;AACvB,QAAO"}
@@ -0,0 +1,69 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('../chunk-C0xms8kb.cjs');
3
+ const require_rpc_serialization = require('./serialization.cjs');
4
+ let birpc = require("birpc");
5
+ let structured_clone_es = require("structured-clone-es");
6
+
7
+ //#region src/rpc/server.ts
8
+ function createRpcServer(functions, options = {}) {
9
+ return (0, birpc.createBirpcGroup)(functions, [], {
10
+ ...options.rpcOptions,
11
+ proxify: false
12
+ });
13
+ }
14
+ function NOOP() {}
15
+ const EMPTY_DEFS = /* @__PURE__ */ new Map();
16
+ /**
17
+ * Build a birpc `ChannelOptions` object backed by a browser `WebSocket`.
18
+ * Pass the result straight to `createRpcClient`'s `channel` option.
19
+ */
20
+ function createWsRpcChannel(options) {
21
+ const { onConnected = NOOP, onError = NOOP, onDisconnected = NOOP, definitions = EMPTY_DEFS } = options;
22
+ const ws = new WebSocket(options.url);
23
+ ws.addEventListener("open", (e) => {
24
+ onConnected(e);
25
+ });
26
+ ws.addEventListener("error", (e) => {
27
+ onError(e instanceof Error ? e : new Error(e.type));
28
+ });
29
+ ws.addEventListener("close", (e) => {
30
+ onDisconnected(e);
31
+ });
32
+ const pendingRequestMethods = /* @__PURE__ */ new Map();
33
+ return {
34
+ on: (handler) => {
35
+ ws.addEventListener("message", (e) => {
36
+ handler(e.data);
37
+ });
38
+ },
39
+ post: (data) => {
40
+ if (ws.readyState === WebSocket.OPEN) ws.send(data);
41
+ else {
42
+ function handler() {
43
+ ws.send(data);
44
+ ws.removeEventListener("open", handler);
45
+ }
46
+ ws.addEventListener("open", handler);
47
+ }
48
+ },
49
+ serialize: (msg) => {
50
+ let method;
51
+ if (msg.t === "q") method = msg.m;
52
+ else {
53
+ method = pendingRequestMethods.get(msg.i);
54
+ pendingRequestMethods.delete(msg.i);
55
+ }
56
+ if (!!method && definitions.get(method)?.jsonSerializable === true) return require_rpc_serialization.strictJsonStringify(msg, method ?? "");
57
+ return `${"s:"}${(0, structured_clone_es.stringify)(msg)}`;
58
+ },
59
+ deserialize: (raw) => {
60
+ const msg = raw.startsWith("s:") ? (0, structured_clone_es.parse)(raw.slice("s:".length)) : JSON.parse(raw);
61
+ if (msg.t === "q" && msg.i && msg.m) pendingRequestMethods.set(msg.i, msg.m);
62
+ return msg;
63
+ }
64
+ };
65
+ }
66
+
67
+ //#endregion
68
+ exports.createRpcServer = createRpcServer;
69
+ exports.createWsRpcChannel = createWsRpcChannel;
@@ -0,0 +1,29 @@
1
+ import { RpcFunctionDefinitionAny } from "./types.cjs";
2
+ import { BirpcGroup, ChannelOptions, EventOptions } from "birpc";
3
+
4
+ //#region src/rpc/server.d.ts
5
+ declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options?: {
6
+ rpcOptions?: EventOptions<ClientFunctions, ServerFunctions, false>;
7
+ }): BirpcGroup<ClientFunctions, ServerFunctions, false>;
8
+ interface WsRpcChannelOptions {
9
+ url: string;
10
+ onConnected?: (e: Event) => void;
11
+ onError?: (e: Error) => void;
12
+ onDisconnected?: (e: CloseEvent) => void;
13
+ /**
14
+ * RPC function definitions (or just the `jsonSerializable` flag per
15
+ * method) used to dispatch the per-call wire serializer. Pass an
16
+ * empty / partial map on clients that don't have the full registry —
17
+ * encoding falls back to structured-clone (the safer superset) and
18
+ * decoding still routes correctly via the wire prefix.
19
+ */
20
+ definitions?: ReadonlyMap<string, Pick<RpcFunctionDefinitionAny, "jsonSerializable">>;
21
+ }
22
+ /**
23
+ * Build a birpc `ChannelOptions` object backed by a browser `WebSocket`.
24
+ * Pass the result straight to `createRpcClient`'s `channel` option.
25
+ */
26
+ declare function createWsRpcChannel(options: WsRpcChannelOptions): ChannelOptions;
27
+ //#endregion
28
+ export { WsRpcChannelOptions, createRpcServer, createWsRpcChannel };
29
+ //# sourceMappingURL=server.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.cts","names":[],"sources":["../../src/rpc/server.ts"],"mappings":";;;;iBA4BgB,eAAA,kCACmB,MAAA,kDACA,MAAA,gBAAA,CAEjC,SAAA,EAAW,eAAA,EACX,OAAA;EACE,UAAA,GAAa,YAAA,CAAa,eAAA,EAAiB,eAAA;AAAA,IAE5C,UAAA,CAAW,eAAA,EAAiB,eAAA;AAAA,UAWd,mBAAA;EACf,GAAA;EACA,WAAA,IAAe,CAAA,EAAG,KAAA;EAClB,OAAA,IAAW,CAAA,EAAG,KAAA;EACd,cAAA,IAAkB,CAAA,EAAG,UAAA;EAjBO;;;;;;;EAyB5B,WAAA,GAAc,WAAA,SAEZ,IAAA,CAAK,wBAAA;AAAA;;;;;iBAeO,kBAAA,CACd,OAAA,EAAS,mBAAA,GACR,cAAA"}
@@ -0,0 +1,29 @@
1
+ import { RpcFunctionDefinitionAny } from "./types.mjs";
2
+ import { BirpcGroup, ChannelOptions, EventOptions } from "birpc";
3
+
4
+ //#region src/rpc/server.d.ts
5
+ declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options?: {
6
+ rpcOptions?: EventOptions<ClientFunctions, ServerFunctions, false>;
7
+ }): BirpcGroup<ClientFunctions, ServerFunctions, false>;
8
+ interface WsRpcChannelOptions {
9
+ url: string;
10
+ onConnected?: (e: Event) => void;
11
+ onError?: (e: Error) => void;
12
+ onDisconnected?: (e: CloseEvent) => void;
13
+ /**
14
+ * RPC function definitions (or just the `jsonSerializable` flag per
15
+ * method) used to dispatch the per-call wire serializer. Pass an
16
+ * empty / partial map on clients that don't have the full registry —
17
+ * encoding falls back to structured-clone (the safer superset) and
18
+ * decoding still routes correctly via the wire prefix.
19
+ */
20
+ definitions?: ReadonlyMap<string, Pick<RpcFunctionDefinitionAny, "jsonSerializable">>;
21
+ }
22
+ /**
23
+ * Build a birpc `ChannelOptions` object backed by a browser `WebSocket`.
24
+ * Pass the result straight to `createRpcClient`'s `channel` option.
25
+ */
26
+ declare function createWsRpcChannel(options: WsRpcChannelOptions): ChannelOptions;
27
+ //#endregion
28
+ export { WsRpcChannelOptions, createRpcServer, createWsRpcChannel };
29
+ //# sourceMappingURL=server.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.mts","names":[],"sources":["../../src/rpc/server.ts"],"mappings":";;;;iBA4BgB,eAAA,kCACmB,MAAA,kDACA,MAAA,gBAAA,CAEjC,SAAA,EAAW,eAAA,EACX,OAAA;EACE,UAAA,GAAa,YAAA,CAAa,eAAA,EAAiB,eAAA;AAAA,IAE5C,UAAA,CAAW,eAAA,EAAiB,eAAA;AAAA,UAWd,mBAAA;EACf,GAAA;EACA,WAAA,IAAe,CAAA,EAAG,KAAA;EAClB,OAAA,IAAW,CAAA,EAAG,KAAA;EACd,cAAA,IAAkB,CAAA,EAAG,UAAA;EAjBO;;;;;;;EAyB5B,WAAA,GAAc,WAAA,SAEZ,IAAA,CAAK,wBAAA;AAAA;;;;;iBAeO,kBAAA,CACd,OAAA,EAAS,mBAAA,GACR,cAAA"}
@@ -0,0 +1,66 @@
1
+ import { STRUCTURED_CLONE_PREFIX, strictJsonStringify, structuredCloneParse, structuredCloneStringify } from "./serialization.mjs";
2
+ import { createBirpcGroup } from "birpc";
3
+
4
+ //#region src/rpc/server.ts
5
+ function createRpcServer(functions, options = {}) {
6
+ return createBirpcGroup(functions, [], {
7
+ ...options.rpcOptions,
8
+ proxify: false
9
+ });
10
+ }
11
+ function NOOP() {}
12
+ const EMPTY_DEFS = /* @__PURE__ */ new Map();
13
+ /**
14
+ * Build a birpc `ChannelOptions` object backed by a browser `WebSocket`.
15
+ * Pass the result straight to `createRpcClient`'s `channel` option.
16
+ */
17
+ function createWsRpcChannel(options) {
18
+ const { onConnected = NOOP, onError = NOOP, onDisconnected = NOOP, definitions = EMPTY_DEFS } = options;
19
+ const ws = new WebSocket(options.url);
20
+ ws.addEventListener("open", (e) => {
21
+ onConnected(e);
22
+ });
23
+ ws.addEventListener("error", (e) => {
24
+ onError(e instanceof Error ? e : new Error(e.type));
25
+ });
26
+ ws.addEventListener("close", (e) => {
27
+ onDisconnected(e);
28
+ });
29
+ const pendingRequestMethods = /* @__PURE__ */ new Map();
30
+ return {
31
+ on: (handler) => {
32
+ ws.addEventListener("message", (e) => {
33
+ handler(e.data);
34
+ });
35
+ },
36
+ post: (data) => {
37
+ if (ws.readyState === WebSocket.OPEN) ws.send(data);
38
+ else {
39
+ function handler() {
40
+ ws.send(data);
41
+ ws.removeEventListener("open", handler);
42
+ }
43
+ ws.addEventListener("open", handler);
44
+ }
45
+ },
46
+ serialize: (msg) => {
47
+ let method;
48
+ if (msg.t === "q") method = msg.m;
49
+ else {
50
+ method = pendingRequestMethods.get(msg.i);
51
+ pendingRequestMethods.delete(msg.i);
52
+ }
53
+ if (!!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
54
+ return `${"s:"}${structuredCloneStringify(msg)}`;
55
+ },
56
+ deserialize: (raw) => {
57
+ const msg = raw.startsWith("s:") ? structuredCloneParse(raw.slice("s:".length)) : JSON.parse(raw);
58
+ if (msg.t === "q" && msg.i && msg.m) pendingRequestMethods.set(msg.i, msg.m);
59
+ return msg;
60
+ }
61
+ };
62
+ }
63
+
64
+ //#endregion
65
+ export { createRpcServer, createWsRpcChannel };
66
+ //# sourceMappingURL=server.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.mjs","names":[],"sources":["../../src/rpc/server.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { BirpcGroup, ChannelOptions, EventOptions } from \"birpc\";\nimport { createBirpcGroup } from \"birpc\";\nimport {\n strictJsonStringify,\n STRUCTURED_CLONE_PREFIX,\n structuredCloneParse,\n structuredCloneStringify\n} from \"./serialization\";\nimport { RpcFunctionDefinitionAny } from \"./types\";\n\nexport function createRpcServer<\n ClientFunctions extends object = Record<string, never>,\n ServerFunctions extends object = Record<string, never>\n>(\n functions: ServerFunctions,\n options: {\n rpcOptions?: EventOptions<ClientFunctions, ServerFunctions, false>;\n } = {}\n): BirpcGroup<ClientFunctions, ServerFunctions, false> {\n return createBirpcGroup<ClientFunctions, ServerFunctions, false>(\n functions,\n [],\n {\n ...options.rpcOptions,\n proxify: false\n }\n );\n}\n\nexport interface WsRpcChannelOptions {\n url: string;\n onConnected?: (e: Event) => void;\n onError?: (e: Error) => void;\n onDisconnected?: (e: CloseEvent) => void;\n /**\n * RPC function definitions (or just the `jsonSerializable` flag per\n * method) used to dispatch the per-call wire serializer. Pass an\n * empty / partial map on clients that don't have the full registry —\n * encoding falls back to structured-clone (the safer superset) and\n * decoding still routes correctly via the wire prefix.\n */\n definitions?: ReadonlyMap<\n string,\n Pick<RpcFunctionDefinitionAny, \"jsonSerializable\">\n >;\n}\n\nfunction NOOP() {}\n\nconst EMPTY_DEFS: ReadonlyMap<\n string,\n Pick<RpcFunctionDefinitionAny, \"jsonSerializable\">\n> = new Map();\n\n/**\n * Build a birpc `ChannelOptions` object backed by a browser `WebSocket`.\n * Pass the result straight to `createRpcClient`'s `channel` option.\n */\nexport function createWsRpcChannel(\n options: WsRpcChannelOptions\n): ChannelOptions {\n const {\n onConnected = NOOP,\n onError = NOOP,\n onDisconnected = NOOP,\n definitions = EMPTY_DEFS\n } = options;\n\n const ws = new WebSocket(options.url);\n\n ws.addEventListener(\"open\", e => {\n onConnected(e);\n });\n\n ws.addEventListener(\"error\", e => {\n const _e = e instanceof Error ? e : new Error(e.type);\n onError(_e);\n });\n\n ws.addEventListener(\"close\", e => {\n onDisconnected(e);\n });\n\n // Per-channel state: maps an incoming request id to its method name\n // so the matching outgoing response can independently look the\n // method up in `definitions` and pick the right encoder.\n const pendingRequestMethods = new Map<string, string>();\n\n return {\n on: (handler: (data: string) => void) => {\n ws.addEventListener(\"message\", e => {\n handler(e.data);\n });\n },\n post: (data: string) => {\n if (ws.readyState === WebSocket.OPEN) {\n ws.send(data);\n } else {\n function handler() {\n ws.send(data);\n ws.removeEventListener(\"open\", handler);\n }\n ws.addEventListener(\"open\", handler);\n }\n },\n serialize: (msg: any): string => {\n let method: string | undefined;\n if (msg.t === \"q\") {\n method = msg.m;\n } else {\n method = pendingRequestMethods.get(msg.i);\n pendingRequestMethods.delete(msg.i);\n }\n const useJson =\n !!method && definitions.get(method)?.jsonSerializable === true;\n if (useJson) return strictJsonStringify(msg, method ?? \"\");\n return `${STRUCTURED_CLONE_PREFIX}${structuredCloneStringify(msg)}`;\n },\n deserialize: (raw: string): any => {\n const msg: any = raw.startsWith(STRUCTURED_CLONE_PREFIX)\n ? structuredCloneParse(raw.slice(STRUCTURED_CLONE_PREFIX.length))\n : JSON.parse(raw);\n if (msg.t === \"q\" && msg.i && msg.m)\n pendingRequestMethods.set(msg.i, msg.m);\n return msg;\n }\n };\n}\n"],"mappings":";;;;AA4BA,SAAgB,gBAId,WACA,UAEI,EAAE,EAC+C;AACrD,QAAO,iBACL,WACA,EAAE,EACF;EACE,GAAG,QAAQ;EACX,SAAS;EACV,CACF;;AAqBH,SAAS,OAAO;AAEhB,MAAM,6BAGF,IAAI,KAAK;;;;;AAMb,SAAgB,mBACd,SACgB;CAChB,MAAM,EACJ,cAAc,MACd,UAAU,MACV,iBAAiB,MACjB,cAAc,eACZ;CAEJ,MAAM,KAAK,IAAI,UAAU,QAAQ,IAAI;AAErC,IAAG,iBAAiB,SAAQ,MAAK;AAC/B,cAAY,EAAE;GACd;AAEF,IAAG,iBAAiB,UAAS,MAAK;AAEhC,UADW,aAAa,QAAQ,IAAI,IAAI,MAAM,EAAE,KAAK,CAC1C;GACX;AAEF,IAAG,iBAAiB,UAAS,MAAK;AAChC,iBAAe,EAAE;GACjB;CAKF,MAAM,wCAAwB,IAAI,KAAqB;AAEvD,QAAO;EACL,KAAK,YAAoC;AACvC,MAAG,iBAAiB,YAAW,MAAK;AAClC,YAAQ,EAAE,KAAK;KACf;;EAEJ,OAAO,SAAiB;AACtB,OAAI,GAAG,eAAe,UAAU,KAC9B,IAAG,KAAK,KAAK;QACR;IACL,SAAS,UAAU;AACjB,QAAG,KAAK,KAAK;AACb,QAAG,oBAAoB,QAAQ,QAAQ;;AAEzC,OAAG,iBAAiB,QAAQ,QAAQ;;;EAGxC,YAAY,QAAqB;GAC/B,IAAI;AACJ,OAAI,IAAI,MAAM,IACZ,UAAS,IAAI;QACR;AACL,aAAS,sBAAsB,IAAI,IAAI,EAAE;AACzC,0BAAsB,OAAO,IAAI,EAAE;;AAIrC,OADE,CAAC,CAAC,UAAU,YAAY,IAAI,OAAO,EAAE,qBAAqB,KAC/C,QAAO,oBAAoB,KAAK,UAAU,GAAG;AAC1D,UAAO,UAA6B,yBAAyB,IAAI;;EAEnE,cAAc,QAAqB;GACjC,MAAM,MAAW,IAAI,gBAAmC,GACpD,qBAAqB,IAAI,WAA8B,OAAO,CAAC,GAC/D,KAAK,MAAM,IAAI;AACnB,OAAI,IAAI,MAAM,OAAO,IAAI,KAAK,IAAI,EAChC,uBAAsB,IAAI,IAAI,GAAG,IAAI,EAAE;AACzC,UAAO;;EAEV"}
File without changes
@@ -0,0 +1,70 @@
1
+ import { GenericSchema, InferInput } from "valibot";
2
+
3
+ //#region src/rpc/types.d.ts
4
+ /** Valibot schema array for validating function arguments */
5
+ type RpcArgsSchema = readonly GenericSchema[];
6
+ /** Valibot schema for validating function return value */
7
+ type RpcReturnSchema = GenericSchema;
8
+ /** Infers TypeScript tuple type from Valibot schema array */
9
+ type InferArgsType<S extends RpcArgsSchema | undefined> = S extends readonly [] ? [] : S extends readonly [infer H, ...infer T] ? H extends GenericSchema ? T extends readonly GenericSchema[] ? [InferInput<H>, ...InferArgsType<T>] : never : never : never;
10
+ /** Infers TypeScript return type from Valibot return schema */
11
+ type InferReturnType<S extends RpcReturnSchema | undefined> = S extends RpcReturnSchema ? InferInput<S> : void;
12
+ /**
13
+ * RPC function definition with optional dump support.
14
+ */
15
+ type RpcFunctionDefinition<TName extends string, TArgs extends any[] = [], TReturns = void, TArgsSchema extends RpcArgsSchema | undefined = undefined, TReturnSchema extends RpcReturnSchema | undefined = undefined> = [TArgsSchema, TReturnSchema] extends [undefined, undefined] ? {
16
+ /**
17
+ * Function name (unique identifier)
18
+ */
19
+ name: TName;
20
+ /**
21
+ * Valibot schema array for validating function arguments
22
+ */
23
+ args?: TArgsSchema;
24
+ /**
25
+ * Valibot schema for validating function return value
26
+ */
27
+ returns?: TReturnSchema;
28
+ /**
29
+ * Declares whether this function's args/return are JSON-serializable
30
+ * (no Map/Set/Date/BigInt/cycles/class instances/undefined/Symbol/Function).
31
+ *
32
+ * - `true` — wire and dump use strict `JSON.stringify`; misshapen
33
+ * values throw `DF0019` at the call site. Required for `agent`.
34
+ * - `false` (default) — `structured-clone-es` round-trips fancy
35
+ * types. Cannot be `agent`-exposed (registration throws `DF0018`).
36
+ */
37
+ jsonSerializable?: boolean;
38
+ /**
39
+ * Function implementation (required if setup doesn't provide one)
40
+ */
41
+ handler: (...args: TArgs) => TReturns;
42
+ } : {
43
+ /**
44
+ * Function name (unique identifier)
45
+ */
46
+ name: TName;
47
+ /**
48
+ * Valibot schema array for validating function arguments
49
+ */
50
+ args?: TArgsSchema;
51
+ /**
52
+ * Valibot schema for validating function return value
53
+ */
54
+ returns?: TReturnSchema;
55
+ /**
56
+ * Declares whether this function's args/return are JSON-serializable
57
+ * (no Map/Set/Date/BigInt/cycles/class instances/undefined/Symbol/Function).
58
+ *
59
+ * - `true` — wire and dump use strict `JSON.stringify`; misshapen
60
+ * values throw `DF0019` at the call site. Required for `agent`.
61
+ * - `false` (default) — `structured-clone-es` round-trips fancy
62
+ * types. Cannot be `agent`-exposed (registration throws `DF0018`).
63
+ */
64
+ jsonSerializable?: boolean; /** Function implementation (required if setup doesn't provide one) */
65
+ handler?: (...args: InferArgsType<TArgsSchema>) => InferReturnType<TReturnSchema>;
66
+ };
67
+ type RpcFunctionDefinitionAny = RpcFunctionDefinition<string, any, any, any, any>;
68
+ //#endregion
69
+ export { InferArgsType, InferReturnType, RpcArgsSchema, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcReturnSchema };
70
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/rpc/types.ts"],"mappings":";;;;KAqBY,aAAA,YAAyB,aAAA;AAArC;AAAA,KAEY,eAAA,GAAkB,aAAA;;KAGlB,aAAA,WAAwB,aAAA,gBAClC,CAAA,4BAEI,CAAA,0CACE,CAAA,SAAU,aAAA,GACR,CAAA,kBAAmB,aAAA,MAChB,UAAA,CAAW,CAAA,MAAO,aAAA,CAAc,CAAA;;KAMjC,eAAA,WAA0B,eAAA,gBACpC,CAAA,SAAU,eAAA,GAAkB,UAAA,CAAW,CAAA;;;;KAK7B,qBAAA,sFAIU,aAAA,gDACE,eAAA,6BACnB,WAAA,EAAa,aAAA;EAxBN;;;EA6BN,IAAA,EAAM,KAAA;EA5BV;;;EAiCI,IAAA,GAAO,WAAA;EA5BW;;;EAiClB,OAAA,GAAU,aAAA;EAjC4B;;;;;;;;;EA4CtC,gBAAA;EA7CI;;;EAkDJ,OAAA,MAAa,IAAA,EAAM,KAAA,KAAU,QAAA;AAAA;EAjDU;;;EAuDvC,IAAA,EAAM,KAAA;EAjDe;;;EAsDrB,IAAA,GAAO,WAAA;EArDD;;;EA0DN,OAAA,GAAU,aAAA;EA1DwB;;;;;;;;;EAqElC,gBAAA,YAhE2B;EAmE3B,OAAA,OACK,IAAA,EAAM,aAAA,CAAc,WAAA,MACpB,eAAA,CAAgB,aAAA;AAAA;AAAA,KAGf,wBAAA,GAA2B,qBAAA"}
@@ -0,0 +1,70 @@
1
+ import { GenericSchema, InferInput } from "valibot";
2
+
3
+ //#region src/rpc/types.d.ts
4
+ /** Valibot schema array for validating function arguments */
5
+ type RpcArgsSchema = readonly GenericSchema[];
6
+ /** Valibot schema for validating function return value */
7
+ type RpcReturnSchema = GenericSchema;
8
+ /** Infers TypeScript tuple type from Valibot schema array */
9
+ type InferArgsType<S extends RpcArgsSchema | undefined> = S extends readonly [] ? [] : S extends readonly [infer H, ...infer T] ? H extends GenericSchema ? T extends readonly GenericSchema[] ? [InferInput<H>, ...InferArgsType<T>] : never : never : never;
10
+ /** Infers TypeScript return type from Valibot return schema */
11
+ type InferReturnType<S extends RpcReturnSchema | undefined> = S extends RpcReturnSchema ? InferInput<S> : void;
12
+ /**
13
+ * RPC function definition with optional dump support.
14
+ */
15
+ type RpcFunctionDefinition<TName extends string, TArgs extends any[] = [], TReturns = void, TArgsSchema extends RpcArgsSchema | undefined = undefined, TReturnSchema extends RpcReturnSchema | undefined = undefined> = [TArgsSchema, TReturnSchema] extends [undefined, undefined] ? {
16
+ /**
17
+ * Function name (unique identifier)
18
+ */
19
+ name: TName;
20
+ /**
21
+ * Valibot schema array for validating function arguments
22
+ */
23
+ args?: TArgsSchema;
24
+ /**
25
+ * Valibot schema for validating function return value
26
+ */
27
+ returns?: TReturnSchema;
28
+ /**
29
+ * Declares whether this function's args/return are JSON-serializable
30
+ * (no Map/Set/Date/BigInt/cycles/class instances/undefined/Symbol/Function).
31
+ *
32
+ * - `true` — wire and dump use strict `JSON.stringify`; misshapen
33
+ * values throw `DF0019` at the call site. Required for `agent`.
34
+ * - `false` (default) — `structured-clone-es` round-trips fancy
35
+ * types. Cannot be `agent`-exposed (registration throws `DF0018`).
36
+ */
37
+ jsonSerializable?: boolean;
38
+ /**
39
+ * Function implementation (required if setup doesn't provide one)
40
+ */
41
+ handler: (...args: TArgs) => TReturns;
42
+ } : {
43
+ /**
44
+ * Function name (unique identifier)
45
+ */
46
+ name: TName;
47
+ /**
48
+ * Valibot schema array for validating function arguments
49
+ */
50
+ args?: TArgsSchema;
51
+ /**
52
+ * Valibot schema for validating function return value
53
+ */
54
+ returns?: TReturnSchema;
55
+ /**
56
+ * Declares whether this function's args/return are JSON-serializable
57
+ * (no Map/Set/Date/BigInt/cycles/class instances/undefined/Symbol/Function).
58
+ *
59
+ * - `true` — wire and dump use strict `JSON.stringify`; misshapen
60
+ * values throw `DF0019` at the call site. Required for `agent`.
61
+ * - `false` (default) — `structured-clone-es` round-trips fancy
62
+ * types. Cannot be `agent`-exposed (registration throws `DF0018`).
63
+ */
64
+ jsonSerializable?: boolean; /** Function implementation (required if setup doesn't provide one) */
65
+ handler?: (...args: InferArgsType<TArgsSchema>) => InferReturnType<TReturnSchema>;
66
+ };
67
+ type RpcFunctionDefinitionAny = RpcFunctionDefinition<string, any, any, any, any>;
68
+ //#endregion
69
+ export { InferArgsType, InferReturnType, RpcArgsSchema, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcReturnSchema };
70
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/rpc/types.ts"],"mappings":";;;;KAqBY,aAAA,YAAyB,aAAA;AAArC;AAAA,KAEY,eAAA,GAAkB,aAAA;;KAGlB,aAAA,WAAwB,aAAA,gBAClC,CAAA,4BAEI,CAAA,0CACE,CAAA,SAAU,aAAA,GACR,CAAA,kBAAmB,aAAA,MAChB,UAAA,CAAW,CAAA,MAAO,aAAA,CAAc,CAAA;;KAMjC,eAAA,WAA0B,eAAA,gBACpC,CAAA,SAAU,eAAA,GAAkB,UAAA,CAAW,CAAA;;;;KAK7B,qBAAA,sFAIU,aAAA,gDACE,eAAA,6BACnB,WAAA,EAAa,aAAA;EAxBN;;;EA6BN,IAAA,EAAM,KAAA;EA5BV;;;EAiCI,IAAA,GAAO,WAAA;EA5BW;;;EAiClB,OAAA,GAAU,aAAA;EAjC4B;;;;;;;;;EA4CtC,gBAAA;EA7CI;;;EAkDJ,OAAA,MAAa,IAAA,EAAM,KAAA,KAAU,QAAA;AAAA;EAjDU;;;EAuDvC,IAAA,EAAM,KAAA;EAjDe;;;EAsDrB,IAAA,GAAO,WAAA;EArDD;;;EA0DN,OAAA,GAAU,aAAA;EA1DwB;;;;;;;;;EAqElC,gBAAA,YAhE2B;EAmE3B,OAAA,OACK,IAAA,EAAM,aAAA,CAAc,WAAA,MACpB,eAAA,CAAgB,aAAA;AAAA;AAAA,KAGf,wBAAA,GAA2B,qBAAA"}
@@ -0,0 +1 @@
1
+ export { };
package/dist/schemas.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_fs = require('./fs-XogSgMqT.cjs');
2
+ const require_fs = require('./fs-CeEdzPKE.cjs');
3
3
 
4
4
  exports.FileId = require_fs.FileId;
5
5
  exports.FileMetadata = require_fs.FileMetadata;
package/dist/schemas.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as FileSystem, i as FileStorage, n as FileMetadata, o as _capnpFileId, r as FileMetadata_KeyValuePair, t as FileId } from "./fs-D1nIP45P.mjs";
1
+ import { a as FileSystem, i as FileStorage, n as FileMetadata, o as _capnpFileId, r as FileMetadata_KeyValuePair, t as FileId } from "./fs-Dcle8lUp.mjs";
2
2
 
3
3
  export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, _capnpFileId };