devframe 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{_shared-Cm4iD0L3.d.mts → _shared-BxeuukaL.d.mts} +2 -4
- package/dist/{_shared-C61zPwIz.mjs → _shared-CtXCQFTV.mjs} +6 -9
- package/dist/adapters/build.d.mts +3 -5
- package/dist/adapters/build.mjs +7 -8
- package/dist/adapters/cac.d.mts +1 -3
- package/dist/adapters/cac.mjs +5 -7
- package/dist/adapters/dev.d.mts +6 -8
- package/dist/adapters/dev.mjs +2 -2
- package/dist/adapters/embedded.d.mts +2 -4
- package/dist/adapters/embedded.mjs +1 -2
- package/dist/adapters/initiate.d.mts +10 -10
- package/dist/adapters/initiate.mjs +1 -2
- package/dist/adapters/mcp.d.mts +2 -2
- package/dist/adapters/mcp.mjs +1 -2
- package/dist/{agentic-C6SCkdtj.d.mts → agentic-DVgUzwhV.d.mts} +1 -3
- package/dist/{browser-agent-Pu-FLk6I.mjs → browser-agent-DmAotroz.mjs} +1 -2
- package/dist/{browser-agent-rpc-KH4HHvHf.mjs → browser-agent-rpc-CS80Sphv.mjs} +3 -5
- package/dist/cli/main.d.mts +1 -3
- package/dist/cli/main.mjs +3 -4
- package/dist/client/index.d.mts +6 -30
- package/dist/client/index.mjs +47 -72
- package/dist/{client-agent-iBkMYxqn.mjs → client-agent-qNMgDUev.mjs} +7 -12
- package/dist/constants.d.mts +1 -5
- package/dist/constants.mjs +2 -3
- package/dist/{context-BGJi0ITA.d.mts → context-B-AARy_U.d.mts} +1 -3
- package/dist/{context-D_jSSdME.mjs → context-BTxC4QrJ.mjs} +4 -5
- package/dist/{context-CAJ5V017.mjs → context-C5FcbWQi.mjs} +25 -41
- package/dist/{crypto-token-TVbGGFuj.mjs → crypto-token-CUhPE_ei.mjs} +1 -2
- package/dist/{define-BLWPsH6y.mjs → define-C8h-fyD3.mjs} +1 -2
- package/dist/{dev-BKBjIpX3.mjs → dev-Cu_iwSCy.mjs} +9 -11
- package/dist/{diagnostics-E_PvUPsA.mjs → diagnostics-DC1-WcvN.mjs} +2 -3
- package/dist/{dist-CO98PBnQ.mjs → dist-BWGpvt-z.mjs} +1 -2
- package/dist/{dist-CZXfGEkd.mjs → dist-CZ-TySHD.mjs} +3 -11
- package/dist/{events-0wDwalmL.mjs → events-qWCKwD8-.mjs} +1 -2
- package/dist/{handler-DmaAfpGq.mjs → handler-DkLlj3-B.mjs} +3 -5
- package/dist/{hash-DdPnc4k3.mjs → hash-DHqpWeMO.mjs} +4 -8
- package/dist/{host-h3-BROI6SQ4.mjs → host-h3-D1uj5EM8.mjs} +1 -2
- package/dist/{import-runtime-module-BzlEQ9PI.mjs → import-runtime-module-DsdqJ1gK.mjs} +2 -3
- package/dist/in-page-channel/index.d.mts +3 -12
- package/dist/in-page-channel/index.mjs +10 -16
- package/dist/{index-CeEtxDmK.d.mts → index-BIRF0E5l.d.mts} +0 -2
- package/dist/{index-Bia1vKjL.d.mts → index-BKu9BxcT.d.mts} +0 -2
- package/dist/{context-BNxFOPbX.d.mts → index-BhUqJUHG.d.mts} +1408 -1442
- package/dist/index.d.mts +7 -8
- package/dist/index.mjs +3 -4
- package/dist/{instance-registry-C_4PpB6N.mjs → instance-registry-DwmnWyCK.mjs} +4 -10
- package/dist/{instance-shell-m4sY2oTG.mjs → instance-shell-Coid7CP6.mjs} +38 -17
- package/dist/{instance-shell-GihbmXoF.d.mts → instance-shell-DTk514M9.d.mts} +6 -10
- package/dist/{interactive-auth-DdDxs3WF.mjs → interactive-auth-BURwIAvE.mjs} +6 -8
- package/dist/internal/index.d.mts +9 -29
- package/dist/internal/index.mjs +13 -15
- package/dist/{mcp-content-QImBQO8e.d.mts → mcp-content-0a0mpCL5.d.mts} +1 -3
- package/dist/{mcp-content-DN3O212x.mjs → mcp-content-CqU8yaF7.mjs} +1 -2
- package/dist/{mrmime-40h5OOIp.mjs → mrmime-y_XyiVcd.mjs} +1 -2
- package/dist/node/auth.d.mts +84 -3
- package/dist/node/auth.mjs +2 -2
- package/dist/node/hub-internals.d.mts +11 -2
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +4 -6
- package/dist/node/index.mjs +2 -2
- package/dist/{nostics-D0PvLZsn.mjs → nostics-InlX4tmd.mjs} +2 -4
- package/dist/{origin-DZit9g29.mjs → origin-Ck7mLbKU.mjs} +1 -2
- package/dist/recipes/interactive-auth.d.mts +3 -5
- package/dist/recipes/interactive-auth.mjs +1 -2
- package/dist/{remote-assets-eBvSKZMS.d.mts → remote-assets-5AQMHZnV.d.mts} +0 -2
- package/dist/{remote-assets-B-n83kUY.mjs → remote-assets-DhonNeo_.mjs} +5 -8
- package/dist/{revoke-CeQUo6KI.mjs → revoke-D6KA3vwr.mjs} +2 -3
- package/dist/{rolldown-runtime-B4iAMlE-.mjs → rolldown-runtime-BVN1G_yT.mjs} +6 -7
- package/dist/rpc/client.d.mts +2 -4
- package/dist/rpc/client.mjs +2 -3
- package/dist/rpc/dump.d.mts +3 -11
- package/dist/rpc/dump.mjs +1 -2
- package/dist/rpc/index.d.mts +122 -4
- package/dist/rpc/index.mjs +6 -8
- package/dist/rpc/server.d.mts +2 -4
- package/dist/rpc/server.mjs +2 -3
- package/dist/rpc/transports/sse-client.d.mts +34 -2
- package/dist/rpc/transports/sse-client.mjs +2 -3
- package/dist/rpc/transports/sse-server.d.mts +5 -7
- package/dist/rpc/transports/sse-server.mjs +4 -5
- package/dist/rpc/transports/ws-bun.d.mts +3 -5
- package/dist/rpc/transports/ws-bun.mjs +2 -3
- package/dist/rpc/transports/ws-client.d.mts +27 -2
- package/dist/rpc/transports/ws-client.mjs +2 -3
- package/dist/rpc/transports/ws-deno.d.mts +3 -5
- package/dist/rpc/transports/ws-deno.mjs +2 -3
- package/dist/rpc/transports/ws-server.d.mts +151 -4
- package/dist/rpc/transports/ws-server.mjs +5 -6
- package/dist/{rpc-core-BLc5hm9X.mjs → rpc-core-BmDHiDR6.mjs} +4 -5
- package/dist/{rpc-core-CGTCla-R.d.mts → rpc-core-CblgPYJ_.d.mts} +5 -7
- package/dist/{serialization-BhuOoL80.mjs → serialization-iiTQ7n21.mjs} +3 -5
- package/dist/{services-install-D5YUwFXW.mjs → services-install-DCuDzMJ-.mjs} +1 -2
- package/dist/{session-DPfj6zQG.mjs → session-BjvoLH3r.mjs} +1 -2
- package/dist/{session-r6PDixP6.d.mts → session-Y9R6tqg4.d.mts} +0 -2
- package/dist/{shared-state-Cc-Jrhma.mjs → shared-state-COV7NCbd.mjs} +4 -6
- package/dist/{state-W4wI6X5X.mjs → state-B_yjfeqo.mjs} +3 -5
- package/dist/{storage-CWI9PZ-5.mjs → storage-DpJ52UB_.mjs} +3 -5
- package/dist/{structured-clone-CbAV5rFI.mjs → structured-clone-B1N_XQvA.mjs} +2 -4
- package/dist/{structured-clone-CgtQ61SA.mjs → structured-clone-D1dOCZvc.mjs} +2 -4
- package/dist/{tool-input-CES3Pc4y.mjs → tool-input-CcCgJ8jq.mjs} +6 -12
- package/dist/types/index.d.mts +5 -5
- package/dist/{types-BmDbfHCx.d.mts → types-KZOyhez5.d.mts} +2 -5
- package/dist/utils/agent-tool-name.d.mts +1 -3
- package/dist/utils/agent-tool-name.mjs +1 -2
- package/dist/utils/colors.d.mts +1 -3
- package/dist/utils/colors.mjs +1 -2
- package/dist/utils/crypto-token.d.mts +1 -3
- package/dist/utils/crypto-token.mjs +1 -2
- package/dist/utils/debounce.d.mts +6 -2
- package/dist/utils/debounce.mjs +1 -2
- package/dist/utils/events.d.mts +2 -4
- package/dist/utils/events.mjs +1 -2
- package/dist/utils/get-port.d.mts +0 -2
- package/dist/utils/get-port.mjs +1 -2
- package/dist/utils/hash.d.mts +1 -3
- package/dist/utils/hash.mjs +1 -2
- package/dist/utils/launch-editor.d.mts +1 -3
- package/dist/utils/launch-editor.mjs +25 -37
- package/dist/utils/nanoid.d.mts +1 -3
- package/dist/utils/nanoid.mjs +1 -2
- package/dist/utils/nostics.d.mts +40 -2
- package/dist/utils/nostics.mjs +1 -2
- package/dist/utils/open.d.mts +1 -3
- package/dist/utils/open.mjs +1 -2
- package/dist/utils/origin.d.mts +55 -2
- package/dist/utils/origin.mjs +1 -2
- package/dist/utils/remote-assets.d.mts +2 -4
- package/dist/utils/remote-assets.mjs +1 -2
- package/dist/utils/serve-static.d.mts +3 -5
- package/dist/utils/serve-static.mjs +3 -4
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -2
- package/dist/utils/simple-schema.d.mts +1 -3
- package/dist/utils/simple-schema.mjs +1 -2
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/streaming-channel.mjs +1 -2
- package/dist/utils/structured-clone.d.mts +1 -3
- package/dist/utils/structured-clone.mjs +1 -2
- package/dist/utils/url.d.mts +1 -3
- package/dist/utils/url.mjs +1 -2
- package/dist/utils/when.d.mts +1 -3
- package/dist/utils/when.mjs +2 -4
- package/dist/{validation-CMfDAti3.mjs → validation-Cjy1P58H.mjs} +7 -13
- package/dist/{wire-codec-B1W3zH3L.mjs → wire-codec-BdngvzfH.mjs} +3 -4
- package/dist/{write-DK7rBUN3.mjs → write-3miSvPaD.mjs} +10 -16
- package/package.json +8 -8
- package/dist/index-CxJatyA1.d.mts +0 -88
- package/dist/index-DuEm0sDH.d.mts +0 -135
- package/dist/nostics-DWvukRwa.d.mts +0 -42
- package/dist/origin-CY6BBHOy.d.mts +0 -58
- package/dist/sse-client-DNdscfu_.d.mts +0 -37
- package/dist/ws-client-6Mrz6eC4.d.mts +0 -30
- package/dist/ws-server-y2R76aSW.d.mts +0 -152
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Diagnostic, createConsoleReporter, defineDiagnostics, defineProdDiagnostics, formatDiagnostic } from "nostics";
|
|
2
2
|
import { ansiFormatter, ansiFormatter as ansiFormatter$1 } from "nostics/formatters/ansi";
|
|
3
|
-
|
|
3
|
+
// src/utils/colors.ts
|
|
4
4
|
function makeColor(open, close) {
|
|
5
5
|
const o = `\x1B[${open}m`;
|
|
6
6
|
const c = `\x1B[${close}m`;
|
|
@@ -29,8 +29,7 @@ const colors = {
|
|
|
29
29
|
reset: makeColor(0, 0),
|
|
30
30
|
underline: makeColor(4, 24)
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
//#region src/utils/nostics.ts
|
|
32
|
+
// src/utils/nostics.ts
|
|
34
33
|
const formatAnsi = ansiFormatter(colors);
|
|
35
34
|
/**
|
|
36
35
|
* The reporter every {@link defineDiagnostics} call below wires in ahead of
|
|
@@ -55,5 +54,4 @@ function defineDiagnostics$1(options) {
|
|
|
55
54
|
reporters: [devframeReporter, ...options.reporters ?? []]
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
|
-
//#endregion
|
|
59
57
|
export { defineProdDiagnostics as a, defineDiagnostics$1 as i, ansiFormatter$1 as n, formatDiagnostic as o, createConsoleReporter as r, colors as s, Diagnostic as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/origin.ts
|
|
2
2
|
/**
|
|
3
3
|
* Origin and hostname predicates shared by the RPC transports (the WS upgrade,
|
|
4
4
|
* SSE, and MCP origin gates) and the instance shell's authentication-link
|
|
@@ -76,5 +76,4 @@ function validateOriginCandidate(candidate, allowedOrigins) {
|
|
|
76
76
|
if (canonical === "null") return void 0;
|
|
77
77
|
if (isLoopbackHostname(url.hostname) || allowedOrigins?.includes(canonical)) return canonical;
|
|
78
78
|
}
|
|
79
|
-
//#endregion
|
|
80
79
|
export { isLoopbackHostname as n, validateOriginCandidate as r, isAllowedOrigin as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-CxJatyA1.mjs";
|
|
1
|
+
import { B as DevframeNodeRpcSession, k as DevframeAuthHandler, z as DevframeNodeContext } from "../index-BhUqJUHG.mjs";
|
|
3
2
|
import { ColorFn } from "../utils/colors.mjs";
|
|
4
|
-
|
|
3
|
+
import "../node/auth.mjs";
|
|
5
4
|
export interface CreateInteractiveAuthOptions {
|
|
6
5
|
/**
|
|
7
6
|
* Static, pre-shared bearer tokens that are always trusted, for CI runs
|
|
@@ -95,5 +94,4 @@ export declare function createAuthBanner(options?: CreateAuthBannerOptions): Aut
|
|
|
95
94
|
* // the whole handler to `initDevframe` / `initHub` via their `auth` option.
|
|
96
95
|
* ```
|
|
97
96
|
*/
|
|
98
|
-
export declare function createInteractiveAuth(context: DevframeNodeContext, options?: CreateInteractiveAuthOptions): DevframeAuthHandler;
|
|
99
|
-
//#endregion
|
|
97
|
+
export declare function createInteractiveAuth(context: DevframeNodeContext, options?: CreateInteractiveAuthOptions): DevframeAuthHandler;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createAuthBanner, createInteractiveAuth };
|
|
1
|
+
export { t as createAuthBanner, n as createInteractiveAuth } from "../interactive-auth-BURwIAvE.mjs";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types/remote-assets.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* A version-locked pointer at browser assets published as their own npm
|
|
4
3
|
* package (e.g. `@devframes/plugin-git-client`), served through devframe's
|
|
@@ -119,5 +118,4 @@ interface RemoteAssetsStore {
|
|
|
119
118
|
*/
|
|
120
119
|
materialize: (targetDir: string) => Promise<void>;
|
|
121
120
|
}
|
|
122
|
-
//#endregion
|
|
123
121
|
export { RemoteAssetsStore as a, RemoteAssetsProviderCustom as i, RemoteAssetsErrorMessage as n, StaticAssetsSource as o, RemoteAssetsProvider as r, RemoteAssets as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
1
|
+
import { t as lookup } from "./mrmime-y_XyiVcd.mjs";
|
|
2
|
+
import { t as diagnostics } from "./diagnostics-DC1-WcvN.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { dirname, extname, isAbsolute, join, normalize, resolve, sep } from "pathe";
|
|
@@ -8,7 +8,7 @@ import { formatWithOptions, inspect } from "node:util";
|
|
|
8
8
|
import { createReadStream, existsSync } from "node:fs";
|
|
9
9
|
import { Buffer } from "node:buffer";
|
|
10
10
|
import { Readable } from "node:stream";
|
|
11
|
-
|
|
11
|
+
// ../../node_modules/.pnpm/obug@3.0.0/node_modules/obug/dist/core.js
|
|
12
12
|
/**
|
|
13
13
|
* Coerce `value`.
|
|
14
14
|
*/
|
|
@@ -135,8 +135,7 @@ function enabled(name) {
|
|
|
135
135
|
for (const ns of names) if (matchesTemplate(name, ns)) return true;
|
|
136
136
|
return false;
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
//#region ../../node_modules/.pnpm/obug@3.0.0/node_modules/obug/dist/ansi.js
|
|
138
|
+
// ../../node_modules/.pnpm/obug@3.0.0/node_modules/obug/dist/ansi.js
|
|
140
139
|
let env = {};
|
|
141
140
|
try {
|
|
142
141
|
process.env.DEBUG;
|
|
@@ -293,8 +292,7 @@ function createDebug(namespace, options) {
|
|
|
293
292
|
return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options));
|
|
294
293
|
}
|
|
295
294
|
enable(env.DEBUG || "");
|
|
296
|
-
|
|
297
|
-
//#region src/utils/remote-assets.ts
|
|
295
|
+
// src/utils/remote-assets.ts
|
|
298
296
|
const debugFetch = createDebug("devframe:remote-assets:fetch");
|
|
299
297
|
const debugCache = createDebug("devframe:remote-assets:cache");
|
|
300
298
|
const MANIFEST_FILENAME = ".manifest.json";
|
|
@@ -664,5 +662,4 @@ function resolveStaticAssetsSource(source, projectStorageDir, defaultResolveFrom
|
|
|
664
662
|
} : source;
|
|
665
663
|
return resolveInstalled(resolved) ?? createStore(resolved, join(projectStorageDir, ".remote-assets", `${resolved.package.replace(/\//g, "+")}@${resolved.version}`));
|
|
666
664
|
}
|
|
667
|
-
//#endregion
|
|
668
665
|
export { createDebug as n, resolveStaticAssetsSource as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as DEVFRAME_EVENTS } from "./events-
|
|
2
|
-
|
|
1
|
+
import { t as DEVFRAME_EVENTS } from "./events-qWCKwD8-.mjs";
|
|
2
|
+
// src/node/auth/revoke.ts
|
|
3
3
|
/**
|
|
4
4
|
* Flip `isTrusted` to false on any live WS clients connected with `token`
|
|
5
5
|
* and broadcast the `auth:revoked` event so they can react.
|
|
@@ -32,5 +32,4 @@ async function revokeAuthToken(context, storage, token) {
|
|
|
32
32
|
});
|
|
33
33
|
await revokeActiveConnectionsForToken(context, token);
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { revokeAuthToken as n, revokeActiveConnectionsForToken as t };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
-
var __exportAll = (all,
|
|
11
|
-
let target = {};
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
10
|
+
var __exportAll = (all, flags) => {
|
|
11
|
+
let target = Object.setPrototypeOf({}, null);
|
|
12
12
|
for (var name in all) __defProp(target, name, {
|
|
13
13
|
get: all[name],
|
|
14
14
|
enumerable: true
|
|
15
15
|
});
|
|
16
|
-
if (!
|
|
17
|
-
return target;
|
|
16
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
18
18
|
};
|
|
19
19
|
var __copyProps = (to, from, except, desc) => {
|
|
20
20
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
@@ -31,5 +31,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
enumerable: true
|
|
32
32
|
}) : target, mod));
|
|
33
33
|
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
34
|
-
//#endregion
|
|
35
34
|
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|
package/dist/rpc/client.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { a as ChannelOptions, i as BirpcReturn, r as BirpcOptions } from "../index-
|
|
2
|
-
//#region src/rpc/client.d.ts
|
|
1
|
+
import { a as ChannelOptions, i as BirpcReturn, r as BirpcOptions } from "../index-BKu9BxcT.mjs";
|
|
3
2
|
export declare function createRpcClient<ServerFunctions extends object = Record<string, never>, ClientFunctions extends object = Record<string, never>>(functions: ClientFunctions, options: {
|
|
4
3
|
channel: ChannelOptions;
|
|
5
4
|
rpcOptions?: Partial<BirpcOptions<ServerFunctions, ClientFunctions, boolean>>;
|
|
6
|
-
}): BirpcReturn<ServerFunctions, ClientFunctions, false>;
|
|
7
|
-
//#endregion
|
|
5
|
+
}): BirpcReturn<ServerFunctions, ClientFunctions, false>;
|
package/dist/rpc/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createBirpc } from "../dist-
|
|
2
|
-
|
|
1
|
+
import { t as createBirpc } from "../dist-BWGpvt-z.mjs";
|
|
2
|
+
// src/rpc/client.ts
|
|
3
3
|
function createRpcClient(functions, options) {
|
|
4
4
|
const { channel, rpcOptions = {} } = options;
|
|
5
5
|
return createBirpc(functions, {
|
|
@@ -9,5 +9,4 @@ function createRpcClient(functions, options) {
|
|
|
9
9
|
proxify: false
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { createRpcClient };
|
package/dist/rpc/dump.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { i as BirpcReturn } from "../index-
|
|
2
|
-
import { c as RpcDumpCollectionOptions, f as RpcDumpRecordError, g as RpcFunctionDefinitionAny, i as RpcDefinitionsToFunctions, p as RpcDumpStore, s as RpcDumpClientOptions } from "../types-
|
|
3
|
-
//#region src/rpc/dump/collect.d.ts
|
|
1
|
+
import { i as BirpcReturn } from "../index-BKu9BxcT.mjs";
|
|
2
|
+
import { c as RpcDumpCollectionOptions, f as RpcDumpRecordError, g as RpcFunctionDefinitionAny, i as RpcDefinitionsToFunctions, p as RpcDumpStore, s as RpcDumpClientOptions } from "../types-KZOyhez5.mjs";
|
|
4
3
|
export declare function dumpFunctions<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T, context?: any, options?: RpcDumpCollectionOptions): Promise<RpcDumpStore<RpcDefinitionsToFunctions<T>>>;
|
|
5
4
|
/**
|
|
6
5
|
* Creates a client that serves pre-computed results from a dump store.
|
|
@@ -18,8 +17,6 @@ export declare function createClientFromDump<T extends Record<string, any>>(stor
|
|
|
18
17
|
* Note: Only checks the definition itself, not setup results.
|
|
19
18
|
*/
|
|
20
19
|
export declare function getDefinitionsWithDumps<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T): RpcFunctionDefinitionAny[];
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/rpc/dump/error.d.ts
|
|
23
20
|
/**
|
|
24
21
|
* Normalize a thrown value into a plain object suitable for storage in
|
|
25
22
|
* a dump record. Preserves `message`, `name`, `cause`, and any own
|
|
@@ -35,8 +32,6 @@ export declare function serializeDumpError(error: unknown): RpcDumpRecordError;
|
|
|
35
32
|
* the original `name`, and re-attaches any custom own properties.
|
|
36
33
|
*/
|
|
37
34
|
export declare function reviveDumpError(stored: RpcDumpRecordError): Error;
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/rpc/dump/static.d.ts
|
|
40
35
|
export type StaticRpcDumpSerialization = 'json' | 'structured-clone';
|
|
41
36
|
export interface StaticRpcDumpManifestStaticEntry {
|
|
42
37
|
type: 'static';
|
|
@@ -66,8 +61,6 @@ export interface StaticRpcDumpCollection {
|
|
|
66
61
|
files: Record<string, StaticRpcDumpFile>;
|
|
67
62
|
}
|
|
68
63
|
export declare function collectStaticRpcDump(definitions: Iterable<RpcFunctionDefinitionAny>, context: any): Promise<StaticRpcDumpCollection>;
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/rpc/dump/write.d.ts
|
|
71
64
|
export interface WriteStaticRpcDumpOptions {
|
|
72
65
|
/**
|
|
73
66
|
* Pretty-print RPC dump JSON files. Defaults to `false` so payload
|
|
@@ -81,5 +74,4 @@ export interface WriteStaticRpcDumpOptions {
|
|
|
81
74
|
* the `__rpc-dump/index.json` manifest, under `outDir`. Shared by the build
|
|
82
75
|
* adapter (`createBuild`) and `@devframes/hub`'s `buildHub`.
|
|
83
76
|
*/
|
|
84
|
-
export declare function writeStaticRpcDump(dump: StaticRpcDumpCollection, outDir: string, options?: WriteStaticRpcDumpOptions): Promise<void>;
|
|
85
|
-
//#endregion
|
|
77
|
+
export declare function writeStaticRpcDump(dump: StaticRpcDumpCollection, outDir: string, options?: WriteStaticRpcDumpOptions): Promise<void>;
|
package/dist/rpc/dump.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError, writeStaticRpcDump };
|
|
1
|
+
export { n as collectStaticRpcDump, r as createClientFromDump, i as dumpFunctions, a as getDefinitionsWithDumps, o as reviveDumpError, s as serializeDumpError, t as writeStaticRpcDump } from "../write-3miSvPaD.mjs";
|
package/dist/rpc/index.d.mts
CHANGED
|
@@ -1,4 +1,122 @@
|
|
|
1
|
-
import { i as BirpcReturn, t as BirpcFn } from "../index-
|
|
2
|
-
import { a as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { i as BirpcReturn, t as BirpcFn } from "../index-BKu9BxcT.mjs";
|
|
2
|
+
import { C as RpcFunctionType, E as Thenable, S as RpcFunctionSetupResult, T as RpcReturnSchema, _ as RpcFunctionDefinitionAnyWithContext, a as RpcDefinitionsToFunctionsWithNamespace, b as RpcFunctionDefinitionWithSchemas, c as RpcDumpCollectionOptions, d as RpcDumpRecord, f as RpcDumpRecordError, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcDefinitionsToFunctions, l as RpcDumpDefinition, m as RpcFunctionAgentOptions, n as RpcArgsSchema, o as RpcDump, p as RpcDumpStore, r as RpcDefinitionsFilter, s as RpcDumpClientOptions, t as EntriesToObject, u as RpcDumpGetter, v as RpcFunctionDefinitionBase, w as RpcFunctionsCollector, x as RpcFunctionDefinitionWithoutSchemas, y as RpcFunctionDefinitionToFunction } from "../types-KZOyhez5.mjs";
|
|
3
|
+
export interface RpcCacheOptions {
|
|
4
|
+
functions: string[];
|
|
5
|
+
keySerializer?: (args: unknown[]) => string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @experimental API is expected to change.
|
|
9
|
+
*/
|
|
10
|
+
export declare class RpcCacheManager {
|
|
11
|
+
private cacheMap;
|
|
12
|
+
private options;
|
|
13
|
+
private keySerializer;
|
|
14
|
+
constructor(options: RpcCacheOptions);
|
|
15
|
+
updateOptions(options: Partial<RpcCacheOptions>): void;
|
|
16
|
+
cached<T>(m: string, a: unknown[]): T | undefined;
|
|
17
|
+
has(m: string, a: unknown[]): boolean;
|
|
18
|
+
apply(req: {
|
|
19
|
+
m: string;
|
|
20
|
+
a: unknown[];
|
|
21
|
+
}, res: unknown): void;
|
|
22
|
+
validate(m: string): boolean;
|
|
23
|
+
clear(fn?: string): void;
|
|
24
|
+
}
|
|
25
|
+
export declare class RpcFunctionsCollectorBase<LocalFunctions extends Record<string, any>, SetupContext> implements RpcFunctionsCollector<LocalFunctions, SetupContext> {
|
|
26
|
+
readonly context: SetupContext;
|
|
27
|
+
readonly definitions: Map<string, RpcFunctionDefinition<string, any, any, any, any, any, SetupContext>>;
|
|
28
|
+
readonly functions: LocalFunctions;
|
|
29
|
+
private readonly _onChanged;
|
|
30
|
+
constructor(context: SetupContext);
|
|
31
|
+
register(fnDef: RpcFunctionDefinition<string, any, any, any, any, any, SetupContext>, force?: boolean): void;
|
|
32
|
+
update(fn: RpcFunctionDefinition<string, any, any, any, any, any, SetupContext>, force?: boolean): void;
|
|
33
|
+
onChanged(fn: (id?: string) => void): () => void;
|
|
34
|
+
getHandler<T extends keyof LocalFunctions>(name: T): Promise<LocalFunctions[T]>;
|
|
35
|
+
getSchema<T extends keyof LocalFunctions>(name: T): {
|
|
36
|
+
args: RpcArgsSchema | undefined;
|
|
37
|
+
returns: RpcReturnSchema | undefined;
|
|
38
|
+
};
|
|
39
|
+
has(name: string): boolean;
|
|
40
|
+
get(name: string): RpcFunctionDefinition<string, any, any, any, any, any, SetupContext> | undefined;
|
|
41
|
+
list(): string[];
|
|
42
|
+
}
|
|
43
|
+
export declare function defineRpcFunction<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS>): RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS>;
|
|
44
|
+
export declare function createDefineWrapperWithContext<CONTEXT>(): <NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, CONTEXT>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, CONTEXT>;
|
|
45
|
+
export declare function getRpcResolvedSetupResult<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, CONTEXT = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, any, any, CONTEXT>, context: CONTEXT): Promise<RpcFunctionSetupResult<ARGS, RETURN>>;
|
|
46
|
+
export declare function getRpcHandler<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, CONTEXT = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, any, any, CONTEXT>, context: CONTEXT): Promise<(...args: ARGS) => RETURN>;
|
|
47
|
+
/**
|
|
48
|
+
* Wire format used by the live RPC transports (WebSocket and SSE).
|
|
49
|
+
*
|
|
50
|
+
* - **JSON (default, unprefixed):** payload is plain JSON text. Used when
|
|
51
|
+
* the dispatched method is declared `jsonSerializable: true`. Encoded
|
|
52
|
+
* via {@link strictJsonStringify} (rejects non-JSON values), decoded
|
|
53
|
+
* via `JSON.parse`.
|
|
54
|
+
* - **Structured-clone (`s:` prefix):** payload is `s:` followed by
|
|
55
|
+
* `structured-clone-es` text. Used when the method is declared
|
|
56
|
+
* `jsonSerializable: false` (or omitted, the default). Round-trips
|
|
57
|
+
* `Map`, `Set`, `Date`, `BigInt`, cycles, and class instances.
|
|
58
|
+
*
|
|
59
|
+
* birpc envelopes always start with `{`, so a leading byte that is not
|
|
60
|
+
* `s` is unambiguously JSON. Each direction independently chooses its
|
|
61
|
+
* encoding from local definitions; request and response are not
|
|
62
|
+
* coupled by a mirror rule.
|
|
63
|
+
*/
|
|
64
|
+
export declare const STRUCTURED_CLONE_PREFIX = "s:";
|
|
65
|
+
/**
|
|
66
|
+
* `JSON.stringify` with a single-pass strict replacer.
|
|
67
|
+
*
|
|
68
|
+
* Throws `DF0020` synchronously when the value contains a type JSON
|
|
69
|
+
* cannot round-trip losslessly: `Map`, `Set`, `Date`, `BigInt`, class
|
|
70
|
+
* instances, or `undefined` inside an array (silently becomes `null`).
|
|
71
|
+
*
|
|
72
|
+
* Native pass-throughs (no extra work needed):
|
|
73
|
+
* - circular references: `JSON.stringify` raises `TypeError`.
|
|
74
|
+
* - `BigInt` at top level: caught here for a friendlier error path.
|
|
75
|
+
*
|
|
76
|
+
* Lenient cases (allowed without throwing):
|
|
77
|
+
* - `undefined` as an object property: legitimate optional field;
|
|
78
|
+
* JSON.stringify just omits it.
|
|
79
|
+
* - `undefined` at the root: legitimate "action returned nothing".
|
|
80
|
+
* - `Symbol` / `Function` values: semantically "drop me" in JSON.
|
|
81
|
+
*
|
|
82
|
+
* `fnName` is used only for the diagnostic message; pass the RPC
|
|
83
|
+
* function name when calling from a wire serializer / dump writer so
|
|
84
|
+
* the error points at the offending function.
|
|
85
|
+
*/
|
|
86
|
+
export declare function strictJsonStringify(value: unknown, fnName?: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* Validate positional arguments against their declared schemas. Only
|
|
89
|
+
* indices with a schema are checked; extra arguments pass through
|
|
90
|
+
* untouched. Throws `DF0038` on the first failing argument.
|
|
91
|
+
*
|
|
92
|
+
* Validation guards the payload without rewriting it: the original values
|
|
93
|
+
* are handed to the handler unchanged, so a schema that describes a subset
|
|
94
|
+
* of an object never silently strips the sender's extra fields (and any
|
|
95
|
+
* declared transforms stay a purely type-level concern).
|
|
96
|
+
*
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
export declare function validateRpcArgs(name: string, argsSchema: RpcArgsSchema | undefined, args: readonly unknown[]): Promise<unknown[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Validate a handler's resolved return value against its declared schema.
|
|
102
|
+
* Throws `DF0039` when the value fails the schema, otherwise returns the
|
|
103
|
+
* original value unchanged (guard-only, never rewriting the payload; see
|
|
104
|
+
* {@link validateRpcArgs}). Passes through when no return schema is set.
|
|
105
|
+
*
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
export declare function validateRpcReturn(name: string, returnSchema: RpcReturnSchema | undefined, value: unknown): Promise<unknown>;
|
|
109
|
+
/**
|
|
110
|
+
* Validates RPC function definitions.
|
|
111
|
+
* Action and event functions cannot have dumps (side effects should not be cached).
|
|
112
|
+
*
|
|
113
|
+
* @throws {Error} If an action or event function has a dump configuration
|
|
114
|
+
*/
|
|
115
|
+
export declare function validateDefinitions(definitions: readonly RpcFunctionDefinitionAny[]): void;
|
|
116
|
+
/**
|
|
117
|
+
* Validates a single RPC function definition.
|
|
118
|
+
*
|
|
119
|
+
* @throws {Error} If an action or event function has a dump configuration
|
|
120
|
+
*/
|
|
121
|
+
export declare function validateDefinition(definition: RpcFunctionDefinitionAny): void;
|
|
122
|
+
export { type BirpcFn, type BirpcReturn, EntriesToObject, RpcArgsSchema, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDefinitionsToFunctionsWithNamespace, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpRecordError, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionDefinitionWithSchemas, RpcFunctionDefinitionWithoutSchemas, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcReturnSchema, Thenable };
|
package/dist/rpc/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as hash, n as validateDefinitions, r as ensureAgentJsonSerializable, t as validateDefinition } from "../validation-
|
|
2
|
-
import { n as strictJsonStringify, r as diagnostics, t as STRUCTURED_CLONE_PREFIX } from "../serialization-
|
|
3
|
-
import { i as validateRpcReturn, n as getRpcResolvedSetupResult, r as validateRpcArgs, t as getRpcHandler } from "../handler-
|
|
4
|
-
import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-
|
|
5
|
-
|
|
1
|
+
import { i as hash, n as validateDefinitions, r as ensureAgentJsonSerializable, t as validateDefinition } from "../validation-Cjy1P58H.mjs";
|
|
2
|
+
import { n as strictJsonStringify, r as diagnostics, t as STRUCTURED_CLONE_PREFIX } from "../serialization-iiTQ7n21.mjs";
|
|
3
|
+
import { i as validateRpcReturn, n as getRpcResolvedSetupResult, r as validateRpcArgs, t as getRpcHandler } from "../handler-DkLlj3-B.mjs";
|
|
4
|
+
import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-C8h-fyD3.mjs";
|
|
5
|
+
// src/rpc/cache.ts
|
|
6
6
|
/**
|
|
7
7
|
* @experimental API is expected to change.
|
|
8
8
|
*/
|
|
@@ -40,8 +40,7 @@ var RpcCacheManager = class {
|
|
|
40
40
|
else this.cacheMap.clear();
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
//#region src/rpc/collector.ts
|
|
43
|
+
// src/rpc/collector.ts
|
|
45
44
|
var RpcFunctionsCollectorBase = class {
|
|
46
45
|
context;
|
|
47
46
|
definitions = /* @__PURE__ */ new Map();
|
|
@@ -112,5 +111,4 @@ var RpcFunctionsCollectorBase = class {
|
|
|
112
111
|
return Array.from(this.definitions.keys());
|
|
113
112
|
}
|
|
114
113
|
};
|
|
115
|
-
//#endregion
|
|
116
114
|
export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, createDefineWrapperWithContext, defineRpcFunction, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions, validateRpcArgs, validateRpcReturn };
|
package/dist/rpc/server.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { n as BirpcGroup, o as EventOptions } from "../index-
|
|
2
|
-
//#region src/rpc/server.d.ts
|
|
1
|
+
import { n as BirpcGroup, o as EventOptions } from "../index-BKu9BxcT.mjs";
|
|
3
2
|
export declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options?: {
|
|
4
3
|
rpcOptions?: EventOptions<ClientFunctions, ServerFunctions, false>;
|
|
5
|
-
}): BirpcGroup<ClientFunctions, ServerFunctions, false>;
|
|
6
|
-
//#endregion
|
|
4
|
+
}): BirpcGroup<ClientFunctions, ServerFunctions, false>;
|
package/dist/rpc/server.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { n as createBirpcGroup } from "../dist-
|
|
2
|
-
|
|
1
|
+
import { n as createBirpcGroup } from "../dist-BWGpvt-z.mjs";
|
|
2
|
+
// src/rpc/server.ts
|
|
3
3
|
function createRpcServer(functions, options = {}) {
|
|
4
4
|
return createBirpcGroup(functions, [], {
|
|
5
5
|
...options.rpcOptions,
|
|
6
6
|
proxify: false
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { createRpcServer };
|
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { a as ChannelOptions } from "../../index-BKu9BxcT.mjs";
|
|
2
|
+
import { g as RpcFunctionDefinitionAny } from "../../types-KZOyhez5.mjs";
|
|
3
|
+
export interface SseRpcChannelOptions {
|
|
4
|
+
/** Resolved `http(s)://` URL of the SSE endpoint. */
|
|
5
|
+
url: string;
|
|
6
|
+
onConnected?: () => void;
|
|
7
|
+
onError?: (e: Error) => void;
|
|
8
|
+
onDisconnected?: () => void;
|
|
9
|
+
authToken?: string;
|
|
10
|
+
/**
|
|
11
|
+
* RPC function definitions (or just the `jsonSerializable` flag per
|
|
12
|
+
* method) used to dispatch the per-call wire serializer, the same contract
|
|
13
|
+
* as the WS channel.
|
|
14
|
+
*/
|
|
15
|
+
definitions?: ReadonlyMap<string, Pick<RpcFunctionDefinitionAny, 'jsonSerializable'>>;
|
|
16
|
+
/** Fetch implementation. Default: `globalThis.fetch`. */
|
|
17
|
+
fetch?: typeof globalThis.fetch;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Build a birpc `ChannelOptions` object backed by an SSE stream (server →
|
|
21
|
+
* client) and HTTP `POST` (client → server): the WebSocket-free counterpart
|
|
22
|
+
* to `createWsRpcChannel`, wire-compatible with `attachSseRpcTransport`.
|
|
23
|
+
*
|
|
24
|
+
* The stream is consumed via `fetch` streaming (not `EventSource`), so it
|
|
25
|
+
* works in browsers and server runtimes alike. The server's first frame
|
|
26
|
+
* (`event: session`) carries the session id; every `POST` echoes it in the
|
|
27
|
+
* `x-birpc-session` header. A response to a client-initiated request comes
|
|
28
|
+
* back in the `POST`'s own body and is re-injected into the channel; a
|
|
29
|
+
* dropped stream terminates the channel; there is no reconnect, matching
|
|
30
|
+
* the WS channel's closed-is-done semantics.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createSseRpcChannel(options: SseRpcChannelOptions): ChannelOptions & {
|
|
33
|
+
close: () => void;
|
|
34
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_SSE_SESSION_HEADER } from "../../constants.mjs";
|
|
2
|
-
import { t as createRpcWireCodec } from "../../wire-codec-
|
|
3
|
-
|
|
2
|
+
import { t as createRpcWireCodec } from "../../wire-codec-BdngvzfH.mjs";
|
|
3
|
+
// src/rpc/transports/sse-client.ts
|
|
4
4
|
function NOOP() {}
|
|
5
5
|
/** Split the next complete SSE frame (up to a blank line) off the buffer. */
|
|
6
6
|
function takeFrame(buffer) {
|
|
@@ -154,5 +154,4 @@ function createSseRpcChannel(options) {
|
|
|
154
154
|
deserialize: codec.deserialize
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
//#endregion
|
|
158
157
|
export { createSseRpcChannel };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { n as BirpcGroup } from "../../index-
|
|
2
|
-
import { g as RpcFunctionDefinitionAny } from "../../types-
|
|
3
|
-
import { n as DevframeRpcConnection, t as DevframeNodeRpcSessionMeta } from "../../session-
|
|
4
|
-
import {
|
|
5
|
-
//#region src/rpc/transports/sse-server.d.ts
|
|
1
|
+
import { n as BirpcGroup } from "../../index-BKu9BxcT.mjs";
|
|
2
|
+
import { g as RpcFunctionDefinitionAny } from "../../types-KZOyhez5.mjs";
|
|
3
|
+
import { n as DevframeRpcConnection, t as DevframeNodeRpcSessionMeta } from "../../session-Y9R6tqg4.mjs";
|
|
4
|
+
import { WsOriginRegistry } from "./ws-server.mjs";
|
|
6
5
|
export interface SseRpcTransportOptions {
|
|
7
6
|
/**
|
|
8
7
|
* Same contract as `WsRpcTransportOptions.allowedOrigins`: extra origins
|
|
@@ -57,5 +56,4 @@ export interface SseRpcTransport {
|
|
|
57
56
|
* - server-initiated calls/events stream down as `event: message`
|
|
58
57
|
* frames, and the client's replies up via `POST` get a bare `202`.
|
|
59
58
|
*/
|
|
60
|
-
export declare function attachSseRpcTransport<ClientFunctions extends object, ServerFunctions extends object>(rpcGroup: BirpcGroup<ClientFunctions, ServerFunctions, false>, options?: SseRpcTransportOptions): SseRpcTransport;
|
|
61
|
-
//#endregion
|
|
59
|
+
export declare function attachSseRpcTransport<ClientFunctions extends object, ServerFunctions extends object>(rpcGroup: BirpcGroup<ClientFunctions, ServerFunctions, false>, options?: SseRpcTransportOptions): SseRpcTransport;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DEVFRAME_SSE_SESSION_HEADER } from "../../constants.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as createRpcSessionMeta } from "../../session-
|
|
5
|
-
|
|
2
|
+
import { t as isAllowedOrigin } from "../../origin-Ck7mLbKU.mjs";
|
|
3
|
+
import { n as peekRpcWireFrame, t as createRpcWireCodec } from "../../wire-codec-BdngvzfH.mjs";
|
|
4
|
+
import { t as createRpcSessionMeta } from "../../session-BjvoLH3r.mjs";
|
|
5
|
+
// src/rpc/transports/sse-server.ts
|
|
6
6
|
const SSE_STREAM_HEADERS = {
|
|
7
7
|
"content-type": "text/event-stream",
|
|
8
8
|
"cache-control": "no-cache, no-transform",
|
|
@@ -205,5 +205,4 @@ function attachSseRpcTransport(rpcGroup, options = {}) {
|
|
|
205
205
|
}
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
//#endregion
|
|
209
208
|
export { attachSseRpcTransport };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/rpc/transports/ws-bun.d.ts
|
|
1
|
+
import { t as ContextRpcServer } from "../../rpc-core-CblgPYJ_.mjs";
|
|
2
|
+
import { WsOriginRegistry } from "./ws-server.mjs";
|
|
4
3
|
export interface AttachBunWsTransportOptions {
|
|
5
4
|
/** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
|
|
6
5
|
allowedOrigins?: readonly string[] | WsOriginRegistry | false;
|
|
@@ -30,5 +29,4 @@ export interface BunWsTier {
|
|
|
30
29
|
* app's own origin, with no side-car server. Load it dynamically so the Bun
|
|
31
30
|
* adapter never enters a Node-only bundle path.
|
|
32
31
|
*/
|
|
33
|
-
export declare function attachBunWsTransport(core: ContextRpcServer, options?: AttachBunWsTransportOptions): Promise<BunWsTier>;
|
|
34
|
-
//#endregion
|
|
32
|
+
export declare function attachBunWsTransport(core: ContextRpcServer, options?: AttachBunWsTransportOptions): Promise<BunWsTier>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as isAllowedOrigin } from "../../origin-
|
|
1
|
+
import { t as isAllowedOrigin } from "../../origin-Ck7mLbKU.mjs";
|
|
2
2
|
import { createWsRpcPeerHooks } from "./ws-server.mjs";
|
|
3
|
-
|
|
3
|
+
// src/rpc/transports/ws-bun.ts
|
|
4
4
|
/**
|
|
5
5
|
* The Bun fetch-upgrade WebSocket tier for `initDevframe` / `initHub`: the
|
|
6
6
|
* same RPC peer wiring as `attachWsRpcTransport`, driven by crossws's Bun
|
|
@@ -33,5 +33,4 @@ async function attachBunWsTransport(core, options = {}) {
|
|
|
33
33
|
close: () => ws.close()
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
//#endregion
|
|
37
36
|
export { attachBunWsTransport };
|
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { a as ChannelOptions } from "../../index-BKu9BxcT.mjs";
|
|
2
|
+
import { g as RpcFunctionDefinitionAny } from "../../types-KZOyhez5.mjs";
|
|
3
|
+
export interface WsRpcChannelOptions {
|
|
4
|
+
url: string;
|
|
5
|
+
onConnected?: (e: Event) => void;
|
|
6
|
+
onError?: (e: Error) => void;
|
|
7
|
+
onDisconnected?: (e: CloseEvent) => void;
|
|
8
|
+
authToken?: string;
|
|
9
|
+
/**
|
|
10
|
+
* RPC function definitions (or just the `jsonSerializable` flag per
|
|
11
|
+
* method) used to dispatch the per-call wire serializer. Pass an
|
|
12
|
+
* empty / partial map on clients that don't have the full registry;
|
|
13
|
+
* encoding falls back to structured-clone (the safer superset) and
|
|
14
|
+
* decoding still routes correctly via the wire prefix.
|
|
15
|
+
*/
|
|
16
|
+
definitions?: ReadonlyMap<string, Pick<RpcFunctionDefinitionAny, 'jsonSerializable'>>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build a birpc `ChannelOptions` object backed by a browser `WebSocket`.
|
|
20
|
+
* Pass the result straight to `createRpcClient`'s `channel` option.
|
|
21
|
+
*
|
|
22
|
+
* Also returns `close()`, closing the underlying socket, mirroring the server transport's
|
|
23
|
+
* existing `WsRpcTransport.close()`. `birpc`'s own `ChannelOptions` has no teardown of its own.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createWsRpcChannel(options: WsRpcChannelOptions): ChannelOptions & {
|
|
26
|
+
close: () => void;
|
|
27
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEVFRAME_AUTH_TOKEN_QUERY_PARAM } from "../../constants.mjs";
|
|
2
|
-
import { t as createRpcWireCodec } from "../../wire-codec-
|
|
3
|
-
|
|
2
|
+
import { t as createRpcWireCodec } from "../../wire-codec-BdngvzfH.mjs";
|
|
3
|
+
// src/rpc/transports/ws-client.ts
|
|
4
4
|
function NOOP() {}
|
|
5
5
|
const EMPTY_DEFS = /* @__PURE__ */ new Map();
|
|
6
6
|
/**
|
|
@@ -60,5 +60,4 @@ function createWsRpcChannel(options) {
|
|
|
60
60
|
deserialize: codec.deserialize
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { createWsRpcChannel };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/rpc/transports/ws-deno.d.ts
|
|
1
|
+
import { t as ContextRpcServer } from "../../rpc-core-CblgPYJ_.mjs";
|
|
2
|
+
import { WsOriginRegistry } from "./ws-server.mjs";
|
|
4
3
|
export interface AttachDenoWsTransportOptions {
|
|
5
4
|
/** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
|
|
6
5
|
allowedOrigins?: readonly string[] | WsOriginRegistry | false;
|
|
@@ -21,5 +20,4 @@ export interface DenoWsTier {
|
|
|
21
20
|
* app's own origin, with no side-car server. Load it dynamically so the Deno
|
|
22
21
|
* adapter never enters a Node-only bundle path.
|
|
23
22
|
*/
|
|
24
|
-
export declare function attachDenoWsTransport(core: ContextRpcServer, options?: AttachDenoWsTransportOptions): Promise<DenoWsTier>;
|
|
25
|
-
//#endregion
|
|
23
|
+
export declare function attachDenoWsTransport(core: ContextRpcServer, options?: AttachDenoWsTransportOptions): Promise<DenoWsTier>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as isAllowedOrigin } from "../../origin-
|
|
1
|
+
import { t as isAllowedOrigin } from "../../origin-Ck7mLbKU.mjs";
|
|
2
2
|
import { createWsRpcPeerHooks } from "./ws-server.mjs";
|
|
3
|
-
|
|
3
|
+
// src/rpc/transports/ws-deno.ts
|
|
4
4
|
/**
|
|
5
5
|
* The Deno fetch-upgrade WebSocket tier for `initDevframe` / `initHub`: the
|
|
6
6
|
* same RPC peer wiring as `attachWsRpcTransport`, driven by crossws's Deno
|
|
@@ -32,5 +32,4 @@ async function attachDenoWsTransport(core, options = {}) {
|
|
|
32
32
|
close: () => ws.close()
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { attachDenoWsTransport };
|