devframe 0.8.2 → 0.9.0-beta.10
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-BPmX9fqK.d.mts +41 -0
- package/dist/_shared-CbZ_yhbz.mjs +68 -0
- package/dist/adapters/build.d.mts +10 -12
- package/dist/adapters/build.mjs +26 -29
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +156 -1
- package/dist/adapters/dev.d.mts +38 -46
- package/dist/adapters/dev.mjs +2 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/initiate.d.mts +224 -0
- package/dist/adapters/initiate.mjs +2 -0
- package/dist/adapters/mcp.d.mts +24 -7
- package/dist/adapters/mcp.mjs +2 -2
- package/dist/{agent-tool-name-C3b5vEwJ.mjs → agent-tool-name-EgfoFO8C.mjs} +0 -3
- package/dist/cli/main.d.mts +0 -2
- package/dist/cli/main.mjs +4 -8
- package/dist/client/index.d.mts +71 -7
- package/dist/client/index.mjs +720 -1540
- package/dist/constants.d.mts +28 -7
- package/dist/constants.mjs +28 -7
- package/dist/{context-DoSozfvx.d.mts → context-B3YUu_95.d.mts} +19 -1
- package/dist/{host-h3-D2hYZvDK.mjs → context-CEe4PBz1.mjs} +25 -557
- package/dist/{context-CBg8iRbQ.mjs → context-xdynGSLP.mjs} +10 -1
- package/dist/dev--rAPzbvO.mjs +239 -0
- package/dist/{devframe-mQ4qZAuo.d.mts → devframe-DJMg0WLe.d.mts} +181 -134
- package/dist/{diagnostics-hwjXp_UV.mjs → diagnostics-CD8nlgll.mjs} +1 -3
- package/dist/{diagnostics-D7wM2cwM.mjs → diagnostics-DOQPnQmX.mjs} +51 -5
- package/dist/dist-eNI9qM_I.mjs +228 -0
- package/dist/host-agent-xLCSe65D.mjs +264 -0
- package/dist/host-h3-Crkzm42q.mjs +26 -0
- package/dist/{fetch-BKaD0Vb3.mjs → http-DYpK0cUi.mjs} +42 -11
- package/dist/{index-b64Uuhy2.d.mts → index-CB-fSUyn.d.mts} +2 -2
- package/dist/{index-Dbw1p5ch.d.mts → index-tdrk1bzV.d.mts} +3 -32
- package/dist/index.d.mts +12 -5
- package/dist/index.mjs +8 -1
- package/dist/{instance-registry-BnnA2Eoh.mjs → instance-registry-WvQkt42E.mjs} +9 -8
- package/dist/instance-shell-CMFyszWJ.mjs +486 -0
- package/dist/instance-shell-CljiKq1c.d.mts +255 -0
- package/dist/internal/index.d.mts +397 -0
- package/dist/internal/index.mjs +9 -0
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +1 -1
- package/dist/node/hub-internals.d.mts +2 -14
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +4 -268
- package/dist/node/index.mjs +3 -5
- package/dist/nostics-CzECRXpE.mjs +59 -0
- package/dist/nostics-SPGDgHEP.d.mts +33 -0
- package/dist/recipes/common-rpc-functions.d.mts +4 -4
- package/dist/recipes/interactive-auth.d.mts +3 -3
- package/dist/recipes/interactive-auth.mjs +8 -8
- package/dist/remote-assets-Bg4gCUZ_.d.mts +123 -0
- package/dist/remote-assets-nTTxY2MU.mjs +636 -0
- package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
- package/dist/rpc/dump.d.mts +77 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +4 -18
- package/dist/rpc/transports/sse-client.d.mts +2 -0
- package/dist/rpc/transports/sse-client.mjs +142 -0
- package/dist/rpc/transports/sse-server.d.mts +61 -0
- package/dist/rpc/transports/sse-server.mjs +209 -0
- package/dist/rpc/transports/ws-bun.d.mts +35 -0
- package/dist/rpc/transports/ws-bun.mjs +31 -0
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +10 -18
- package/dist/rpc/transports/ws-server.d.mts +2 -2
- package/dist/rpc/transports/ws-server.mjs +2 -235
- package/dist/rpc-core-Cc4lucI0.d.mts +48 -0
- package/dist/rpc-core-DMTe-hLo.mjs +81 -0
- package/dist/{serialization-C8Mnw9hK.mjs → serialization-BGzEwAdr.mjs} +2 -2
- package/dist/{shared-state-6kHolYZy.mjs → shared-state-fRRbRUtD.mjs} +1 -1
- package/dist/sse-client-CFBOIaUi.d.mts +37 -0
- package/dist/state-Cc1IeSmQ.mjs +1291 -0
- package/dist/{dump-CgZShDRB.mjs → static-BPZ1_OPA.mjs} +3 -266
- package/dist/storage-CYye7P7L.mjs +137 -0
- package/dist/types/index.d.mts +6 -4
- package/dist/types/index.mjs +1 -6
- package/dist/{types-CnJSgRVa.d.mts → types-Djq7CBXh.d.mts} +0 -7
- package/dist/utils/agent-tool-name.d.mts +0 -3
- package/dist/utils/agent-tool-name.mjs +0 -3
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/get-port.d.mts +17 -0
- package/dist/utils/get-port.mjs +2 -0
- package/dist/utils/launch-editor.mjs +1 -25
- package/dist/utils/nostics.d.mts +2 -0
- package/dist/utils/nostics.mjs +2 -0
- package/dist/utils/open.d.mts +2 -10
- package/dist/utils/open.mjs +56 -1
- package/dist/utils/remote-assets.d.mts +15 -0
- package/dist/utils/remote-assets.mjs +2 -0
- package/dist/utils/serve-static.d.mts +13 -5
- package/dist/utils/serve-static.mjs +119 -9
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/simple-schema.d.mts +101 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/validation-CpXFB6Dz.mjs +266 -0
- package/dist/wire-codec-0K-o5MYW.mjs +56 -0
- package/dist/{ws-client-B6Tnr0ic.d.mts → ws-client-DhjNyQo3.d.mts} +7 -2
- package/dist/ws-server-BdSLrhxE.mjs +267 -0
- package/dist/{ws-server-uKQcClcJ.d.mts → ws-server-D1d3QM9f.d.mts} +90 -9
- package/package.json +13 -12
- package/skills/devframe/SKILL.md +91 -93
- package/dist/_shared-bWRzeSa0.mjs +0 -19
- package/dist/adapters/cli.d.mts +0 -11
- package/dist/adapters/cli.mjs +0 -6
- package/dist/cac-D4_9ok0z.mjs +0 -157
- package/dist/dev-Bc49u3qg.mjs +0 -439
- package/dist/diagnostics-reporter-CsIG85Q5.mjs +0 -38
- package/dist/helpers/vite.d.mts +0 -100
- package/dist/helpers/vite.mjs +0 -105
- package/dist/http-C4T68YV6.mjs +0 -38
- package/dist/index-vAX6bYuc.d.mts +0 -78
- package/dist/open-Deb5xmIT.mjs +0 -547
- package/dist/recipes/open-helpers.d.mts +0 -6
- package/dist/recipes/open-helpers.mjs +0 -6
- package/dist/server-CD8XmBXl.mjs +0 -167
- package/dist/server-UHWae43Q.d.mts +0 -149
- package/dist/simple-schema-BDzLeJDk.d.mts +0 -102
- package/dist/state-BeUHDDjk.mjs +0 -108
- package/dist/storage-CTNVbuFB.mjs +0 -1122
- package/dist/utils/promise.d.mts +0 -8
- package/dist/utils/promise.mjs +0 -15
- package/dist/utils/scope.d.mts +0 -11
- package/dist/utils/scope.mjs +0 -15
- package/skills/devframe/templates/spa-devframe.ts +0 -38
package/dist/helpers/vite.d.mts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { d as McpRouteOptions, p as DevframeAuthHandler, r as DevframeDefinition } from "../devframe-mQ4qZAuo.mjs";
|
|
2
|
-
//#region src/helpers/vite.d.ts
|
|
3
|
-
interface ViteDevBridgeOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Mount base. Defaults to `def.basePath ?? '/__<id>/'` for this hosted
|
|
6
|
-
* adapter — the devframe shares the origin with the host Vite app.
|
|
7
|
-
*
|
|
8
|
-
* Relative spellings like `'./'` (common for base-agnostic Nuxt builds)
|
|
9
|
-
* are normalized to absolute paths so they compose with Vite's connect
|
|
10
|
-
* router.
|
|
11
|
-
*/
|
|
12
|
-
base?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Dev-time middleware mode. When set, the host app owns the SPA and
|
|
15
|
-
* devframe spins up a separate RPC + WS server on a resolved port,
|
|
16
|
-
* registering Vite middleware at `<base>__connection.json` so the
|
|
17
|
-
* host-served SPA can discover the WS endpoint.
|
|
18
|
-
*
|
|
19
|
-
* - `false` (default) — static-mount the SPA at `base` with SPA
|
|
20
|
-
* fallback. No RPC server is started.
|
|
21
|
-
* - `true` — bridge mode with all defaults (port from
|
|
22
|
-
* {@link resolveDevServerPort}, host from `def.cli?.host`).
|
|
23
|
-
* - object — bridge mode with explicit overrides.
|
|
24
|
-
*/
|
|
25
|
-
devMiddleware?: boolean | {
|
|
26
|
-
/** Override the bridge port. Default: {@link resolveDevServerPort}. */
|
|
27
|
-
port?: number;
|
|
28
|
-
/** Override the bridge bind host. Default: `def.cli?.host ?? 'localhost'`. */
|
|
29
|
-
host?: string;
|
|
30
|
-
/** Flag bag forwarded to `def.setup(ctx, { flags })`. */
|
|
31
|
-
flags?: Record<string, unknown>;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Whether the bridged devframe runs its own auth gate. The side-car RPC
|
|
35
|
-
* server is reachable by anything that can open its socket, so it **gates by
|
|
36
|
-
* default**: when unset, authentication resolves through `createDevServer`
|
|
37
|
-
* (devframe's interactive OTP gate unless the definition's `cli.auth` opts
|
|
38
|
-
* out), and the side-car prints its code/link banner to stdout. Pass a
|
|
39
|
-
* {@link DevframeAuthHandler} to install a custom scheme, or `false` to opt
|
|
40
|
-
* out for a single-user localhost host that owns the trust boundary another
|
|
41
|
-
* way. Only applies in bridge mode (`devMiddleware`); the static-mount mode
|
|
42
|
-
* starts no RPC server.
|
|
43
|
-
*
|
|
44
|
-
* @default gated (devframe's interactive OTP, unless `cli.auth` opts out)
|
|
45
|
-
*/
|
|
46
|
-
auth?: boolean | DevframeAuthHandler;
|
|
47
|
-
/**
|
|
48
|
-
* Expose the side-car's route-based MCP server (Streamable-HTTP) and
|
|
49
|
-
* advertise it in the bridge's `__connection.json`. Forwarded to
|
|
50
|
-
* {@link createDevServer}: overrides `def.cli?.mcp`, `undefined` falls
|
|
51
|
-
* through to it, `false` disables the route regardless. Only applies in
|
|
52
|
-
* bridge mode (`devMiddleware`); the static-mount mode starts no server.
|
|
53
|
-
*
|
|
54
|
-
* The endpoint lives on the side-car's own port, so the advertised meta
|
|
55
|
-
* carries `{ port, path }` — see `ConnectionMeta['mcp']`.
|
|
56
|
-
*
|
|
57
|
-
* @experimental
|
|
58
|
-
*/
|
|
59
|
-
mcp?: boolean | McpRouteOptions;
|
|
60
|
-
}
|
|
61
|
-
interface DevframeVitePlugin {
|
|
62
|
-
name: string;
|
|
63
|
-
apply: 'serve';
|
|
64
|
-
configureServer: (server: {
|
|
65
|
-
middlewares: {
|
|
66
|
-
use: (path: string, handler: any) => void;
|
|
67
|
-
};
|
|
68
|
-
httpServer?: {
|
|
69
|
-
once: (event: 'close', cb: () => void) => void;
|
|
70
|
-
} | null;
|
|
71
|
-
}) => void | Promise<void>;
|
|
72
|
-
closeBundle?: () => void | Promise<void>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Bridge a devframe into an existing Vite dev server. Returns a Vite
|
|
76
|
-
* plugin with two modes, picked via `options.devMiddleware`:
|
|
77
|
-
*
|
|
78
|
-
* - **static-mount mode** (default) — mounts `def.cli.distDir` at
|
|
79
|
-
* `options.base` with SPA fallback enabled. No RPC server is started.
|
|
80
|
-
*
|
|
81
|
-
* - **bridge mode** (`devMiddleware: true | {…}`) — skips the static
|
|
82
|
-
* mount; the host app owns the SPA. Devframe starts a separate
|
|
83
|
-
* RPC + WS dev server (via {@link createDevServer} in bridge mode)
|
|
84
|
-
* and registers Vite middleware at `<base>__connection.json` so the
|
|
85
|
-
* host-served SPA can discover the WS endpoint via
|
|
86
|
-
* {@link connectDevframe}.
|
|
87
|
-
*
|
|
88
|
-
* The side-car RPC server **gates by default** (devframe's interactive OTP
|
|
89
|
-
* unless the definition's `cli.auth` opts out), printing its code/link banner
|
|
90
|
-
* to stdout, so a bridged devframe isn't silently reachable by anything that
|
|
91
|
-
* can open its socket. Pass `options.auth: false` to opt out for a single-user
|
|
92
|
-
* localhost host, or a {@link DevframeAuthHandler} for a custom scheme.
|
|
93
|
-
*
|
|
94
|
-
* Use bridge mode when integrating with frameworks that own the SPA
|
|
95
|
-
* (Nuxt, Astro, SolidStart, plain Vite apps). For the all-in-one
|
|
96
|
-
* `dev` / `build` / `mcp` shell, reach for {@link createCac} instead.
|
|
97
|
-
*/
|
|
98
|
-
declare function viteDevBridge(d: DevframeDefinition, options?: ViteDevBridgeOptions): DevframeVitePlugin;
|
|
99
|
-
//#endregion
|
|
100
|
-
export { DevframeVitePlugin, ViteDevBridgeOptions, viteDevBridge };
|
package/dist/helpers/vite.mjs
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_WS_ROUTE } from "../constants.mjs";
|
|
2
|
-
import { t as diagnostics } from "../diagnostics-D7wM2cwM.mjs";
|
|
3
|
-
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
4
|
-
import { serveStaticNodeMiddleware } from "../utils/serve-static.mjs";
|
|
5
|
-
import { n as resolveDevServerPort, r as resolveMcpConnectionMeta, t as createDevServer } from "../dev-Bc49u3qg.mjs";
|
|
6
|
-
import { resolve } from "pathe";
|
|
7
|
-
//#region src/helpers/vite.ts
|
|
8
|
-
/**
|
|
9
|
-
* Bridge a devframe into an existing Vite dev server. Returns a Vite
|
|
10
|
-
* plugin with two modes, picked via `options.devMiddleware`:
|
|
11
|
-
*
|
|
12
|
-
* - **static-mount mode** (default) — mounts `def.cli.distDir` at
|
|
13
|
-
* `options.base` with SPA fallback enabled. No RPC server is started.
|
|
14
|
-
*
|
|
15
|
-
* - **bridge mode** (`devMiddleware: true | {…}`) — skips the static
|
|
16
|
-
* mount; the host app owns the SPA. Devframe starts a separate
|
|
17
|
-
* RPC + WS dev server (via {@link createDevServer} in bridge mode)
|
|
18
|
-
* and registers Vite middleware at `<base>__connection.json` so the
|
|
19
|
-
* host-served SPA can discover the WS endpoint via
|
|
20
|
-
* {@link connectDevframe}.
|
|
21
|
-
*
|
|
22
|
-
* The side-car RPC server **gates by default** (devframe's interactive OTP
|
|
23
|
-
* unless the definition's `cli.auth` opts out), printing its code/link banner
|
|
24
|
-
* to stdout, so a bridged devframe isn't silently reachable by anything that
|
|
25
|
-
* can open its socket. Pass `options.auth: false` to opt out for a single-user
|
|
26
|
-
* localhost host, or a {@link DevframeAuthHandler} for a custom scheme.
|
|
27
|
-
*
|
|
28
|
-
* Use bridge mode when integrating with frameworks that own the SPA
|
|
29
|
-
* (Nuxt, Astro, SolidStart, plain Vite apps). For the all-in-one
|
|
30
|
-
* `dev` / `build` / `mcp` shell, reach for {@link createCac} instead.
|
|
31
|
-
*/
|
|
32
|
-
function viteDevBridge(d, options = {}) {
|
|
33
|
-
const base = normalizeMountBase(options.base ?? resolveBasePath(d, "hosted"));
|
|
34
|
-
if (!options.devMiddleware) {
|
|
35
|
-
const distDir = d.cli?.distDir;
|
|
36
|
-
return {
|
|
37
|
-
name: `devframe:${d.id}`,
|
|
38
|
-
apply: "serve",
|
|
39
|
-
configureServer(server) {
|
|
40
|
-
if (!distDir) return;
|
|
41
|
-
server.middlewares.use(base, serveStaticNodeMiddleware(resolve(distDir)));
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const mw = options.devMiddleware === true ? {} : options.devMiddleware;
|
|
46
|
-
let started;
|
|
47
|
-
return {
|
|
48
|
-
name: `devframe:${d.id}`,
|
|
49
|
-
apply: "serve",
|
|
50
|
-
async configureServer(server) {
|
|
51
|
-
await started?.close().catch(() => {});
|
|
52
|
-
started = void 0;
|
|
53
|
-
let port;
|
|
54
|
-
try {
|
|
55
|
-
port = mw.port ?? await resolveDevServerPort(d, { host: mw.host });
|
|
56
|
-
started = await createDevServer(d, {
|
|
57
|
-
host: mw.host,
|
|
58
|
-
port,
|
|
59
|
-
flags: mw.flags,
|
|
60
|
-
openBrowser: false,
|
|
61
|
-
auth: options.auth,
|
|
62
|
-
mcp: options.mcp
|
|
63
|
-
});
|
|
64
|
-
} catch (e) {
|
|
65
|
-
diagnostics.DF0033({
|
|
66
|
-
id: d.id,
|
|
67
|
-
reason: String(e),
|
|
68
|
-
cause: e
|
|
69
|
-
}, { method: "warn" });
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const mcpMeta = resolveMcpConnectionMeta(d, options.mcp, port);
|
|
73
|
-
const metaPath = `${base}${DEVFRAME_CONNECTION_META_FILENAME}`;
|
|
74
|
-
server.middlewares.use(metaPath, (_req, res) => {
|
|
75
|
-
res.setHeader("Content-Type", "application/json");
|
|
76
|
-
res.end(JSON.stringify({
|
|
77
|
-
backend: "websocket",
|
|
78
|
-
websocket: {
|
|
79
|
-
port,
|
|
80
|
-
path: `/${DEVFRAME_WS_ROUTE}`
|
|
81
|
-
},
|
|
82
|
-
...mcpMeta ? { mcp: mcpMeta } : {}
|
|
83
|
-
}));
|
|
84
|
-
});
|
|
85
|
-
server.httpServer?.once("close", () => {
|
|
86
|
-
started?.close().catch(() => {});
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
async closeBundle() {
|
|
90
|
-
await started?.close().catch(() => {});
|
|
91
|
-
started = void 0;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Make `base` safe for `server.middlewares.use(path, …)`. Vite's connect
|
|
97
|
-
* router matches by absolute URL prefix, so relative spellings like
|
|
98
|
-
* `'./'` (commonly used for base-agnostic Nuxt builds) collapse to the
|
|
99
|
-
* origin root before the shared leading/trailing-slash normalization.
|
|
100
|
-
*/
|
|
101
|
-
function normalizeMountBase(base) {
|
|
102
|
-
return normalizeBasePath(base.replace(/^\.\/?/, "/"));
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
export { viteDevBridge };
|
package/dist/http-C4T68YV6.mjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { t as createMcpFetchHandler } from "./fetch-BKaD0Vb3.mjs";
|
|
2
|
-
import { defineHandler } from "h3";
|
|
3
|
-
//#region src/adapters/mcp/http.ts
|
|
4
|
-
/**
|
|
5
|
-
* Mount an MCP Streamable-HTTP endpoint on an h3 app at `path` — the h3
|
|
6
|
-
* binding over {@link createMcpFetchHandler}, which owns the sessions, the
|
|
7
|
-
* origin gate, and the transport plumbing.
|
|
8
|
-
*
|
|
9
|
-
* The handler is web-standard — it takes the h3 event's web `Request` and
|
|
10
|
-
* returns a web `Response` (an SSE `ReadableStream` body for the
|
|
11
|
-
* server→client stream). We copy that response onto `event.res` and return
|
|
12
|
-
* its body rather than returning the `Response` object directly, so a
|
|
13
|
-
* legitimate MCP 404 (unknown session) isn't swallowed by h3's
|
|
14
|
-
* "Response-with-404 falls through to the next handler" rule (which would
|
|
15
|
-
* otherwise hand the request to the SPA static catch-all).
|
|
16
|
-
*
|
|
17
|
-
* @experimental
|
|
18
|
-
*/
|
|
19
|
-
function mountMcpHttp(app, ctx, path, options) {
|
|
20
|
-
const handler = createMcpFetchHandler(ctx, options);
|
|
21
|
-
app.use(path, defineHandler(async (event) => respond(event, await handler.fetch(event.req))));
|
|
22
|
-
return { dispose: handler.dispose };
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Copy a web `Response` from the MCP transport onto the h3 event's response
|
|
26
|
-
* and return its body. Returning the body (a `ReadableStream` or `null`)
|
|
27
|
-
* rather than the `Response` object avoids h3's 404-fall-through behavior.
|
|
28
|
-
*/
|
|
29
|
-
function respond(event, response) {
|
|
30
|
-
event.res.status = response.status;
|
|
31
|
-
event.res.statusText = response.statusText;
|
|
32
|
-
response.headers.forEach((value, key) => {
|
|
33
|
-
event.res.headers.set(key, value);
|
|
34
|
-
});
|
|
35
|
-
return response.body ?? "";
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
export { mountMcpHttp };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { h as RpcDumpStore, l as RpcDumpClientOptions, m as RpcDumpRecordError, n as BirpcReturn, o as RpcDefinitionsToFunctions, u as RpcDumpCollectionOptions, v as RpcFunctionDefinitionAny } from "./types-CnJSgRVa.mjs";
|
|
2
|
-
//#region src/rpc/dump/static.d.ts
|
|
3
|
-
type StaticRpcDumpSerialization = 'json' | 'structured-clone';
|
|
4
|
-
interface StaticRpcDumpManifestStaticEntry {
|
|
5
|
-
type: 'static';
|
|
6
|
-
path: string;
|
|
7
|
-
/** Encoder used when this entry's file was written. Default: `'json'`. */
|
|
8
|
-
serialization?: StaticRpcDumpSerialization;
|
|
9
|
-
}
|
|
10
|
-
interface StaticRpcDumpManifestQueryEntry {
|
|
11
|
-
type: 'query';
|
|
12
|
-
records: Record<string, string>;
|
|
13
|
-
fallback?: string;
|
|
14
|
-
/** Encoder used when each record/fallback file was written. Default: `'json'`. */
|
|
15
|
-
serialization?: StaticRpcDumpSerialization;
|
|
16
|
-
}
|
|
17
|
-
type StaticRpcDumpManifestValue = StaticRpcDumpManifestStaticEntry | StaticRpcDumpManifestQueryEntry | any;
|
|
18
|
-
type StaticRpcDumpManifest = Record<string, StaticRpcDumpManifestValue>;
|
|
19
|
-
interface StaticRpcDumpFile {
|
|
20
|
-
/** Whether this file was written via `JSON.stringify` or `structured-clone-es.stringify`. */
|
|
21
|
-
serialization: StaticRpcDumpSerialization;
|
|
22
|
-
/** Function name the file belongs to — used to scope `DF0019` errors during write. */
|
|
23
|
-
fnName: string;
|
|
24
|
-
/** Payload to encode. */
|
|
25
|
-
data: unknown;
|
|
26
|
-
}
|
|
27
|
-
interface StaticRpcDumpCollection {
|
|
28
|
-
manifest: StaticRpcDumpManifest;
|
|
29
|
-
files: Record<string, StaticRpcDumpFile>;
|
|
30
|
-
}
|
|
31
|
-
declare function collectStaticRpcDump(definitions: Iterable<RpcFunctionDefinitionAny>, context: any): Promise<StaticRpcDumpCollection>;
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/rpc/dump/collect.d.ts
|
|
34
|
-
/**
|
|
35
|
-
* Collects pre-computed dumps by executing functions with their defined input combinations.
|
|
36
|
-
* Static functions without dump config automatically get `{ inputs: [[]] }`.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* const store = await dumpFunctions([greet], context, { concurrency: 10 })
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
declare function dumpFunctions<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T, context?: any, options?: RpcDumpCollectionOptions): Promise<RpcDumpStore<RpcDefinitionsToFunctions<T>>>;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a client that serves pre-computed results from a dump store.
|
|
46
|
-
* Uses argument hashing to match calls to stored records.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* const client = createClientFromDump(store)
|
|
51
|
-
* await client.greet('Alice')
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function createClientFromDump<T extends Record<string, any>>(store: RpcDumpStore<T>, options?: RpcDumpClientOptions): BirpcReturn<T>;
|
|
55
|
-
/**
|
|
56
|
-
* Filters function definitions to only those with dump definitions.
|
|
57
|
-
* Note: Only checks the definition itself, not setup results.
|
|
58
|
-
*/
|
|
59
|
-
declare function getDefinitionsWithDumps<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T): RpcFunctionDefinitionAny[];
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/rpc/dump/error.d.ts
|
|
62
|
-
/**
|
|
63
|
-
* Normalize a thrown value into a plain object suitable for storage in
|
|
64
|
-
* a dump record. Preserves `message`, `name`, `cause`, and any own
|
|
65
|
-
* enumerable properties of an `Error` so consumers reading the dump can
|
|
66
|
-
* reconstruct a richer Error than just `{ message, name }`.
|
|
67
|
-
*
|
|
68
|
-
* Non-`Error` throws are wrapped as `{ name: 'Error', message: String(thrown) }`.
|
|
69
|
-
*/
|
|
70
|
-
declare function serializeDumpError(error: unknown): RpcDumpRecordError;
|
|
71
|
-
/**
|
|
72
|
-
* Inverse of {@link serializeDumpError}: rebuild a thrown `Error` from
|
|
73
|
-
* the plain object stored in a dump record. Preserves `cause`, restores
|
|
74
|
-
* the original `name`, and re-attaches any custom own properties.
|
|
75
|
-
*/
|
|
76
|
-
declare function reviveDumpError(stored: RpcDumpRecordError): Error;
|
|
77
|
-
//#endregion
|
|
78
|
-
export { getDefinitionsWithDumps as a, StaticRpcDumpManifest as c, StaticRpcDumpManifestValue as d, StaticRpcDumpSerialization as f, dumpFunctions as i, StaticRpcDumpManifestQueryEntry as l, serializeDumpError as n, StaticRpcDumpCollection as o, collectStaticRpcDump as p, createClientFromDump as r, StaticRpcDumpFile as s, reviveDumpError as t, StaticRpcDumpManifestStaticEntry as u };
|