devframe 0.9.20 → 0.10.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.
- package/dist/_shared-B2PZsp-J.mjs +191 -0
- package/dist/{_shared-BIUet_Jh.d.mts → _shared-D1ebaX_J.d.mts} +13 -14
- package/dist/adapters/build.d.mts +3 -4
- package/dist/adapters/build.mjs +4 -5
- package/dist/adapters/cac.d.mts +3 -4
- package/dist/adapters/cac.mjs +3 -3
- package/dist/adapters/dev.d.mts +8 -8
- package/dist/adapters/dev.mjs +2 -2
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/initiate.d.mts +8 -8
- package/dist/adapters/initiate.mjs +1 -1
- package/dist/adapters/mcp.d.mts +4 -142
- package/dist/adapters/mcp.mjs +1 -597
- package/dist/agentic-DLqHMOyN.d.mts +30 -0
- package/dist/browser-agent-Pu-FLk6I.mjs +26 -0
- package/dist/browser-agent-rpc-BXhoSh1z.mjs +70 -0
- package/dist/cli/main.mjs +12 -260
- package/dist/client/index.d.mts +6 -6
- package/dist/client/index.mjs +12 -87
- package/dist/constants.d.mts +2 -1
- package/dist/constants.mjs +2 -1
- package/dist/{context-BLHBDQcZ.d.mts → context--tVkJw3W.d.mts} +127 -47
- package/dist/{context-BLXXjoBW.mjs → context-BqpgC5tq.mjs} +55 -5
- package/dist/{context-jXO5vzjH.mjs → context-CHpyLX8W.mjs} +1 -1
- package/dist/{context-BA5FPz7K.d.mts → context-D3qBv0IX.d.mts} +1 -1
- package/dist/{dev-BdKKOH8S.mjs → dev-BTbLJekh.mjs} +16 -24
- package/dist/{diagnostics-DZA6KQ_Z.mjs → diagnostics-Cx4_VjlG.mjs} +11 -3
- package/dist/dist-CO98PBnQ.mjs +265 -0
- package/dist/{host-agent-C3MBpNCd.mjs → host-agent-mIbQ6Qi5.mjs} +14 -13
- package/dist/import-runtime-module-BzlEQ9PI.mjs +24 -0
- package/dist/in-page-channel/index.d.mts +16 -12
- package/dist/in-page-channel/index.mjs +42 -14
- package/dist/index-Bia1vKjL.d.mts +218 -0
- package/dist/index-CeEtxDmK.d.mts +78 -0
- package/dist/{index-r6NstVmM.d.mts → index-D-2IdY1I.d.mts} +2 -2
- package/dist/{index-CiA6C705.d.mts → index-DuEm0sDH.d.mts} +1 -1
- package/dist/index.d.mts +4 -11
- package/dist/index.mjs +1 -10
- package/dist/{instance-registry-DCq762YJ.mjs → instance-registry-DtvYxc0Y.mjs} +1 -1
- package/dist/{instance-shell-C6Vg97lg.d.mts → instance-shell-CXnpSuK7.d.mts} +31 -5
- package/dist/{instance-shell-yfrM3_vK.mjs → instance-shell-wC2sfEU_.mjs} +7 -7
- package/dist/interactive-auth-BCa_iamv.mjs +384 -0
- package/dist/internal/index.d.mts +66 -22
- package/dist/internal/index.mjs +143 -8
- package/dist/mrmime-40h5OOIp.mjs +448 -0
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +2 -4
- package/dist/node/index.mjs +2 -2
- package/dist/{nostics-0sKe5HIj.d.mts → nostics-DWvukRwa.d.mts} +11 -2
- package/dist/{origin-D_eBKEzr.mjs → origin-DZit9g29.mjs} +1 -21
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +1 -231
- package/dist/{remote-assets-D0StJVLp.mjs → remote-assets-B9MeWmW6.mjs} +2 -2
- package/dist/rpc/client.d.mts +1 -1
- package/dist/rpc/client.mjs +1 -1
- package/dist/rpc/dump.d.mts +2 -1
- package/dist/rpc/index.d.mts +3 -2
- package/dist/rpc/server.d.mts +1 -1
- package/dist/rpc/server.mjs +1 -1
- package/dist/rpc/transports/sse-client.d.mts +1 -1
- package/dist/rpc/transports/sse-server.d.mts +3 -3
- package/dist/rpc/transports/sse-server.mjs +1 -1
- package/dist/rpc/transports/ws-bun.d.mts +2 -2
- package/dist/rpc/transports/ws-bun.mjs +1 -1
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-deno.d.mts +2 -2
- package/dist/rpc/transports/ws-deno.mjs +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +1 -1
- package/dist/{rpc-core-BlL-Ip8n.d.mts → rpc-core-B6n9MQsc.d.mts} +4 -4
- package/dist/{rpc-core-CvkU23bQ.mjs → rpc-core-BXyMjbKG.mjs} +1 -1
- package/dist/{services-install-Ben4yh52.mjs → services-install-D5YUwFXW.mjs} +17 -1
- package/dist/{sse-client-BcbYwXdD.d.mts → sse-client-DNdscfu_.d.mts} +2 -2
- package/dist/{storage-B70AXK64.mjs → storage-CHD1IkqU.mjs} +1 -1
- package/dist/tool-input-BAQXvvqL.mjs +393 -0
- package/dist/types/index.d.mts +4 -4
- package/dist/{types-D2vGd7-2.d.mts → types-BmDbfHCx.d.mts} +2 -3
- package/dist/utils/debounce.d.mts +50 -0
- package/dist/utils/debounce.mjs +88 -0
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/launch-editor.d.mts +8 -0
- package/dist/utils/launch-editor.mjs +36 -1
- package/dist/utils/nostics.d.mts +2 -2
- package/dist/utils/remote-assets.mjs +1 -1
- package/dist/utils/serve-static.mjs +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/simple-schema.d.mts +3 -2
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/url.d.mts +31 -0
- package/dist/utils/url.mjs +58 -0
- package/dist/{ws-client-CNpP6Ium.d.mts → ws-client-6Mrz6eC4.d.mts} +2 -2
- package/dist/{ws-server-BB8jhxeT.d.mts → ws-server-y2R76aSW.d.mts} +2 -2
- package/package.json +10 -11
- package/dist/_shared-U8D-xzrp.mjs +0 -115
- package/dist/agent-tool-name-DGzeuWcO.mjs +0 -31
- package/dist/client-assets-DNdhagGm.mjs +0 -16
- package/dist/nostics-DD6gsDZA.mjs +0 -108
- package/dist/recipes/common-rpc-functions.d.mts +0 -70
- package/dist/recipes/common-rpc-functions.mjs +0 -115
- package/dist/simple-schema-Bi40l-P6.mjs +0 -154
|
@@ -1,232 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
|
|
3
|
-
import { isAnonymousRpcMethod } from "../constants.mjs";
|
|
4
|
-
import { a as getTempAuthCodeInfo, n as describeUA, o as refreshTempAuthCode, r as exchangeTempAuthCode, s as verifyAuthToken, t as buildOtpAuthUrl } from "../state-W4wI6X5X.mjs";
|
|
5
|
-
import { t as getInternalContext } from "../context-jXO5vzjH.mjs";
|
|
6
|
-
import { t as s } from "../simple-schema-Bi40l-P6.mjs";
|
|
7
|
-
//#region src/recipes/interactive-auth.ts
|
|
8
|
-
/**
|
|
9
|
-
* Build a {@link AuthBannerFunction} that renders the auth code + magic-link
|
|
10
|
-
* URL as a small bordered box, its two rows label-aligned. `createInteractiveAuth`
|
|
11
|
-
* falls back to `createAuthBanner()` when no `banner` is given; call this
|
|
12
|
-
* yourself to rebrand the box (`title` / `colors`) and pass the result as
|
|
13
|
-
* `options.banner`.
|
|
14
|
-
*/
|
|
15
|
-
function createAuthBanner(options = {}) {
|
|
16
|
-
const title = options.title ?? "Devframe";
|
|
17
|
-
const palette = {
|
|
18
|
-
border: colors.dim,
|
|
19
|
-
title: (x) => colors.gray(colors.bold(x)),
|
|
20
|
-
label: colors.dim,
|
|
21
|
-
code: (f) => colors.green(colors.bold(f)),
|
|
22
|
-
url: colors.cyan,
|
|
23
|
-
...options.colors
|
|
24
|
-
};
|
|
25
|
-
return (info) => {
|
|
26
|
-
const rows = [
|
|
27
|
-
[
|
|
28
|
-
"auth code",
|
|
29
|
-
info.code,
|
|
30
|
-
palette.code
|
|
31
|
-
],
|
|
32
|
-
[
|
|
33
|
-
"or open",
|
|
34
|
-
info.url,
|
|
35
|
-
palette.url
|
|
36
|
-
],
|
|
37
|
-
[
|
|
38
|
-
"expires at",
|
|
39
|
-
new Date(info.expireAt).toLocaleTimeString(),
|
|
40
|
-
palette.label
|
|
41
|
-
]
|
|
42
|
-
];
|
|
43
|
-
if (info.requester) {
|
|
44
|
-
rows.push([
|
|
45
|
-
"ua",
|
|
46
|
-
info.requester.ua,
|
|
47
|
-
palette.label
|
|
48
|
-
]);
|
|
49
|
-
rows.push([
|
|
50
|
-
"origin",
|
|
51
|
-
info.requester.origin,
|
|
52
|
-
palette.label
|
|
53
|
-
]);
|
|
54
|
-
}
|
|
55
|
-
const labelWidth = Math.max(...rows.map(([label]) => label.length));
|
|
56
|
-
const contentWidth = Math.max(...rows.map(([, value]) => labelWidth + 2 + value.length));
|
|
57
|
-
const titleBarLength = title.length + 2;
|
|
58
|
-
const lineWidth = Math.max(contentWidth, titleBarLength - 2);
|
|
59
|
-
const top = [
|
|
60
|
-
palette.border(`╭`),
|
|
61
|
-
palette.title(title),
|
|
62
|
-
palette.border(`${"─".repeat(Math.max(lineWidth + 2 - titleBarLength, 0))}╮`)
|
|
63
|
-
].join(" ");
|
|
64
|
-
const bottom = `╰${"─".repeat(lineWidth + 2)}╯`;
|
|
65
|
-
const body = rows.map(([label, value, color]) => {
|
|
66
|
-
const plain = `${label.padEnd(labelWidth)} ${value}`;
|
|
67
|
-
const pad = " ".repeat(lineWidth - plain.length);
|
|
68
|
-
return `${palette.border("│")} ${palette.label(label.padEnd(labelWidth))} ${color(value)}${pad} ${palette.border("│")}`;
|
|
69
|
-
});
|
|
70
|
-
console.log(`\n${palette.border(top)}\n${body.join("\n")}\n${palette.border(bottom)}\n`);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Package the interactive OTP auth protocol devframe's primitives
|
|
75
|
-
* (`exchangeTempAuthCode`, `verifyAuthToken`, `revokeAuthToken`,
|
|
76
|
-
* `getTempAuthCode`, `buildOtpAuthUrl`) implement into a ready-made
|
|
77
|
-
* {@link DevframeAuthHandler}: the handshake RPC functions, the resolver
|
|
78
|
-
* gate, the connect-time trust hook, and the startup banner.
|
|
79
|
-
*
|
|
80
|
-
* The auth storage stays internal to this handler; callers never reach into
|
|
81
|
-
* `devframe/node/hub-internals` themselves.
|
|
82
|
-
*
|
|
83
|
-
* ```ts
|
|
84
|
-
* import { createInteractiveAuth } from 'devframe/recipes/interactive-auth'
|
|
85
|
-
*
|
|
86
|
-
* const auth = createInteractiveAuth(ctx)
|
|
87
|
-
* auth.rpcFunctions.forEach(fn => ctx.rpc.register(fn))
|
|
88
|
-
* auth.printBanner()
|
|
89
|
-
*
|
|
90
|
-
* // wire `auth.authorize` / `auth.onConnect` into your transport, or pass
|
|
91
|
-
* // the whole handler to `initDevframe` / `initHub` via their `auth` option.
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
function createInteractiveAuth(context, options = {}) {
|
|
95
|
-
const internal = getInternalContext(context);
|
|
96
|
-
const storage = internal.storage.auth;
|
|
97
|
-
const staticTokens = new Set(options.clientAuthTokens ?? []);
|
|
98
|
-
function isStaticToken(token) {
|
|
99
|
-
return !!token && staticTokens.has(token);
|
|
100
|
-
}
|
|
101
|
-
function resolveServerUrl() {
|
|
102
|
-
return options.serverUrl?.() ?? context.host.resolveOrigin();
|
|
103
|
-
}
|
|
104
|
-
const banner = options.banner ?? createAuthBanner();
|
|
105
|
-
let bannerPrintedForCode;
|
|
106
|
-
function printBanner(info) {
|
|
107
|
-
const { code, expireAt } = getTempAuthCodeInfo();
|
|
108
|
-
if (code === bannerPrintedForCode) return;
|
|
109
|
-
bannerPrintedForCode = code;
|
|
110
|
-
const url = buildOtpAuthUrl(resolveServerUrl(), code);
|
|
111
|
-
banner({
|
|
112
|
-
code,
|
|
113
|
-
url,
|
|
114
|
-
expireAt,
|
|
115
|
-
...info?.requester ? { requester: info.requester } : {}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
const anonymousAuth = defineRpcFunction({
|
|
119
|
-
name: "anonymous:devframe:auth",
|
|
120
|
-
type: "action",
|
|
121
|
-
jsonSerializable: true,
|
|
122
|
-
args: [s.object({
|
|
123
|
-
authToken: s.string(),
|
|
124
|
-
ua: s.string(),
|
|
125
|
-
origin: s.string()
|
|
126
|
-
})],
|
|
127
|
-
returns: s.object({ isTrusted: s.boolean() }),
|
|
128
|
-
handler(params) {
|
|
129
|
-
const session = context.rpc.getCurrentRpcSession();
|
|
130
|
-
if (!session) return { isTrusted: false };
|
|
131
|
-
if (session.meta.isTrusted) return { isTrusted: true };
|
|
132
|
-
if (isStaticToken(params.authToken)) {
|
|
133
|
-
session.meta.clientAuthToken = params.authToken;
|
|
134
|
-
session.meta.isTrusted = true;
|
|
135
|
-
return { isTrusted: true };
|
|
136
|
-
}
|
|
137
|
-
return { isTrusted: verifyAuthToken(params.authToken, session, storage) };
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
const anonymousAuthExchange = defineRpcFunction({
|
|
141
|
-
name: "anonymous:devframe:auth:exchange",
|
|
142
|
-
type: "action",
|
|
143
|
-
jsonSerializable: true,
|
|
144
|
-
args: [s.object({
|
|
145
|
-
code: s.string(),
|
|
146
|
-
ua: s.string(),
|
|
147
|
-
origin: s.string()
|
|
148
|
-
})],
|
|
149
|
-
returns: s.object({ authToken: s.nullable(s.string()) }),
|
|
150
|
-
handler(params) {
|
|
151
|
-
const session = context.rpc.getCurrentRpcSession();
|
|
152
|
-
if (!session) return { authToken: null };
|
|
153
|
-
const authToken = exchangeTempAuthCode(params.code, session, params, storage);
|
|
154
|
-
if (authToken) options.onTrusted?.({
|
|
155
|
-
session,
|
|
156
|
-
authToken
|
|
157
|
-
});
|
|
158
|
-
return { authToken };
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
const anonymousAuthRequestCode = defineRpcFunction({
|
|
162
|
-
name: "anonymous:devframe:auth:request-code",
|
|
163
|
-
type: "action",
|
|
164
|
-
jsonSerializable: true,
|
|
165
|
-
args: [s.object({
|
|
166
|
-
ua: s.string(),
|
|
167
|
-
origin: s.string(),
|
|
168
|
-
reissue: s.optional(s.boolean())
|
|
169
|
-
})],
|
|
170
|
-
returns: s.void(),
|
|
171
|
-
handler(params) {
|
|
172
|
-
if (params.reissue) refreshTempAuthCode();
|
|
173
|
-
printBanner({ requester: {
|
|
174
|
-
ua: describeUA(params.ua),
|
|
175
|
-
origin: params.origin
|
|
176
|
-
} });
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
const revoke = defineRpcFunction({
|
|
180
|
-
name: "devframe:auth:revoke",
|
|
181
|
-
type: "action",
|
|
182
|
-
jsonSerializable: true,
|
|
183
|
-
args: [],
|
|
184
|
-
returns: s.void(),
|
|
185
|
-
async handler() {
|
|
186
|
-
const token = context.rpc.getCurrentRpcSession()?.meta.clientAuthToken;
|
|
187
|
-
if (token) await internal.revokeAuthToken(token);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
function authorize(methodName, session) {
|
|
191
|
-
if (isAnonymousRpcMethod(methodName)) return true;
|
|
192
|
-
return !!session.meta.isTrusted;
|
|
193
|
-
}
|
|
194
|
-
function onConnect(connection, session) {
|
|
195
|
-
let token;
|
|
196
|
-
let requestOrigin;
|
|
197
|
-
try {
|
|
198
|
-
token = new URL(connection.request?.url ?? "", "http://localhost").searchParams.get("devframe_auth_token") ?? void 0;
|
|
199
|
-
} catch {}
|
|
200
|
-
try {
|
|
201
|
-
requestOrigin = connection.request?.headers?.get?.("origin") ?? void 0;
|
|
202
|
-
} catch {}
|
|
203
|
-
if (!token) return;
|
|
204
|
-
if (isStaticToken(token)) {
|
|
205
|
-
session.meta.clientAuthToken = token;
|
|
206
|
-
session.meta.isTrusted = true;
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (verifyAuthToken(token, session, storage)) return;
|
|
210
|
-
if (internal.isRemoteTokenTrusted(token, requestOrigin)) {
|
|
211
|
-
session.meta.clientAuthToken = token;
|
|
212
|
-
session.meta.isTrusted = true;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
function buildOpenUrl(url) {
|
|
216
|
-
return buildOtpAuthUrl(url);
|
|
217
|
-
}
|
|
218
|
-
return {
|
|
219
|
-
rpcFunctions: [
|
|
220
|
-
anonymousAuth,
|
|
221
|
-
anonymousAuthExchange,
|
|
222
|
-
anonymousAuthRequestCode,
|
|
223
|
-
revoke
|
|
224
|
-
],
|
|
225
|
-
authorize,
|
|
226
|
-
onConnect,
|
|
227
|
-
printBanner,
|
|
228
|
-
buildOpenUrl
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
//#endregion
|
|
1
|
+
import { n as createInteractiveAuth, t as createAuthBanner } from "../interactive-auth-BCa_iamv.mjs";
|
|
232
2
|
export { createAuthBanner, createInteractiveAuth };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as diagnostics } from "./diagnostics-
|
|
1
|
+
import { t as diagnostics } from "./diagnostics-Cx4_VjlG.mjs";
|
|
2
|
+
import { t as lookup } from "./mrmime-40h5OOIp.mjs";
|
|
2
3
|
import { createRequire } from "node:module";
|
|
3
4
|
import { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
4
5
|
import { dirname, extname, isAbsolute, join, normalize, resolve, sep } from "pathe";
|
|
@@ -7,7 +8,6 @@ import { formatWithOptions, inspect } from "node:util";
|
|
|
7
8
|
import { createReadStream, existsSync } from "node:fs";
|
|
8
9
|
import { Buffer } from "node:buffer";
|
|
9
10
|
import { Readable } from "node:stream";
|
|
10
|
-
import { lookup } from "mrmime";
|
|
11
11
|
//#region ../../node_modules/.pnpm/obug@3.0.0/node_modules/obug/dist/core.js
|
|
12
12
|
/**
|
|
13
13
|
* Coerce `value`.
|
package/dist/rpc/client.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as ChannelOptions, i as BirpcReturn, r as BirpcOptions } from "../index-Bia1vKjL.mjs";
|
|
2
2
|
//#region src/rpc/client.d.ts
|
|
3
3
|
export declare function createRpcClient<ServerFunctions extends object = Record<string, never>, ClientFunctions extends object = Record<string, never>>(functions: ClientFunctions, options: {
|
|
4
4
|
channel: ChannelOptions;
|
package/dist/rpc/client.mjs
CHANGED
package/dist/rpc/dump.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as BirpcReturn } from "../index-Bia1vKjL.mjs";
|
|
2
|
+
import { c as RpcDumpCollectionOptions, f as RpcDumpRecordError, g as RpcFunctionDefinitionAny, i as RpcDefinitionsToFunctions, p as RpcDumpStore, s as RpcDumpClientOptions } from "../types-BmDbfHCx.mjs";
|
|
2
3
|
//#region src/rpc/dump/collect.d.ts
|
|
3
4
|
export declare function dumpFunctions<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T, context?: any, options?: RpcDumpCollectionOptions): Promise<RpcDumpStore<RpcDefinitionsToFunctions<T>>>;
|
|
4
5
|
/**
|
package/dist/rpc/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as BirpcReturn, t as BirpcFn } from "../index-Bia1vKjL.mjs";
|
|
2
|
+
import { a as STRUCTURED_CLONE_PREFIX, c as getRpcResolvedSetupResult, d as RpcFunctionsCollectorBase, f as RpcCacheManager, i as validateRpcReturn, l as createDefineWrapperWithContext, n as validateDefinitions, o as strictJsonStringify, p as RpcCacheOptions, r as validateRpcArgs, s as getRpcHandler, t as validateDefinition, u as defineRpcFunction } from "../index-DuEm0sDH.mjs";
|
|
3
|
+
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-BmDbfHCx.mjs";
|
|
3
4
|
export { type BirpcFn, type BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDefinitionsToFunctionsWithNamespace, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpRecordError, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionDefinitionWithSchemas, RpcFunctionDefinitionWithoutSchemas, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcFunctionsCollectorBase, RpcReturnSchema, STRUCTURED_CLONE_PREFIX, Thenable, createDefineWrapperWithContext, defineRpcFunction, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions, validateRpcArgs, validateRpcReturn };
|
package/dist/rpc/server.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BirpcGroup, EventOptions } from "
|
|
1
|
+
import { n as BirpcGroup, o as EventOptions } from "../index-Bia1vKjL.mjs";
|
|
2
2
|
//#region src/rpc/server.d.ts
|
|
3
3
|
export declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options?: {
|
|
4
4
|
rpcOptions?: EventOptions<ClientFunctions, ServerFunctions, false>;
|
package/dist/rpc/server.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createSseRpcChannel, t as SseRpcChannelOptions } from "../../sse-client-
|
|
1
|
+
import { n as createSseRpcChannel, t as SseRpcChannelOptions } from "../../sse-client-DNdscfu_.mjs";
|
|
2
2
|
export { SseRpcChannelOptions, createSseRpcChannel };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as BirpcGroup } from "../../index-Bia1vKjL.mjs";
|
|
2
|
+
import { g as RpcFunctionDefinitionAny } from "../../types-BmDbfHCx.mjs";
|
|
2
3
|
import { n as DevframeRpcConnection, t as DevframeNodeRpcSessionMeta } from "../../session-r6PDixP6.mjs";
|
|
3
|
-
import { n as WsOriginRegistry } from "../../ws-server-
|
|
4
|
-
import { BirpcGroup } from "birpc";
|
|
4
|
+
import { n as WsOriginRegistry } from "../../ws-server-y2R76aSW.mjs";
|
|
5
5
|
//#region src/rpc/transports/sse-server.d.ts
|
|
6
6
|
export interface SseRpcTransportOptions {
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEVFRAME_SSE_SESSION_HEADER } from "../../constants.mjs";
|
|
2
2
|
import { n as peekRpcWireFrame, t as createRpcWireCodec } from "../../wire-codec-B1W3zH3L.mjs";
|
|
3
|
-
import { t as isAllowedOrigin } from "../../origin-
|
|
3
|
+
import { t as isAllowedOrigin } from "../../origin-DZit9g29.mjs";
|
|
4
4
|
import { t as createRpcSessionMeta } from "../../session-DPfj6zQG.mjs";
|
|
5
5
|
//#region src/rpc/transports/sse-server.ts
|
|
6
6
|
const SSE_STREAM_HEADERS = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as WsOriginRegistry } from "../../ws-server-
|
|
2
|
-
import { t as ContextRpcServer } from "../../rpc-core-
|
|
1
|
+
import { n as WsOriginRegistry } from "../../ws-server-y2R76aSW.mjs";
|
|
2
|
+
import { t as ContextRpcServer } from "../../rpc-core-B6n9MQsc.mjs";
|
|
3
3
|
//#region src/rpc/transports/ws-bun.d.ts
|
|
4
4
|
export interface AttachBunWsTransportOptions {
|
|
5
5
|
/** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-
|
|
1
|
+
import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-6Mrz6eC4.mjs";
|
|
2
2
|
export { WsRpcChannelOptions, createWsRpcChannel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as WsOriginRegistry } from "../../ws-server-
|
|
2
|
-
import { t as ContextRpcServer } from "../../rpc-core-
|
|
1
|
+
import { n as WsOriginRegistry } from "../../ws-server-y2R76aSW.mjs";
|
|
2
|
+
import { t as ContextRpcServer } from "../../rpc-core-B6n9MQsc.mjs";
|
|
3
3
|
//#region src/rpc/transports/ws-deno.d.ts
|
|
4
4
|
export interface AttachDenoWsTransportOptions {
|
|
5
5
|
/** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as DevframeWsPeer, i as DevframeRpcTransportKind, n as DevframeRpcConnection, r as DevframeRpcConnectionRequest, t as DevframeNodeRpcSessionMeta } from "../../session-r6PDixP6.mjs";
|
|
2
2
|
import { r as isLoopbackHostname, t as isAllowedOrigin } from "../../origin-CY6BBHOy.mjs";
|
|
3
|
-
import { a as attachWsRpcTransport, i as WsRpcTransportOptions, n as WsOriginRegistry, o as createWsOriginRegistry, r as WsRpcTransport, s as createWsRpcPeerHooks, t as CreateWsOriginRegistryOptions } from "../../ws-server-
|
|
3
|
+
import { a as attachWsRpcTransport, i as WsRpcTransportOptions, n as WsOriginRegistry, o as createWsOriginRegistry, r as WsRpcTransport, s as createWsRpcPeerHooks, t as CreateWsOriginRegistryOptions } from "../../ws-server-y2R76aSW.mjs";
|
|
4
4
|
export { CreateWsOriginRegistryOptions, type DevframeNodeRpcSessionMeta, type DevframeRpcConnection, type DevframeRpcConnectionRequest, type DevframeRpcTransportKind, type DevframeWsPeer, WsOriginRegistry, WsRpcTransport, WsRpcTransportOptions, attachWsRpcTransport, createWsOriginRegistry, createWsRpcPeerHooks, isAllowedOrigin, isLoopbackHostname };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../constants.mjs";
|
|
2
2
|
import { t as createRpcWireCodec } from "../../wire-codec-B1W3zH3L.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { n as isLoopbackHostname, t as isAllowedOrigin } from "../../origin-DZit9g29.mjs";
|
|
4
4
|
import { t as createRpcSessionMeta } from "../../session-DPfj6zQG.mjs";
|
|
5
5
|
import { n as randomToken, r as timingSafeEqual } from "../../crypto-token-TVbGGFuj.mjs";
|
|
6
6
|
import { createServer } from "node:http";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as BirpcGroup, o as EventOptions } from "./index-Bia1vKjL.mjs";
|
|
2
|
+
import { At as DevframeAuthHandler, Ct as DevframeRpcClientFunctions, o as DevframeNodeContext, s as DevframeNodeRpcSession, wt as DevframeRpcServerFunctions } from "./context--tVkJw3W.mjs";
|
|
2
3
|
import { n as DevframeRpcConnection, t as DevframeNodeRpcSessionMeta } from "./session-r6PDixP6.mjs";
|
|
3
|
-
import "./ws-server-
|
|
4
|
-
import "./index-
|
|
5
|
-
import { BirpcGroup, EventOptions } from "birpc";
|
|
4
|
+
import "./ws-server-y2R76aSW.mjs";
|
|
5
|
+
import "./index-D-2IdY1I.mjs";
|
|
6
6
|
//#region src/node/rpc-core.d.ts
|
|
7
7
|
interface CreateContextRpcServerOptions {
|
|
8
8
|
context: DevframeNodeContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.mjs";
|
|
2
2
|
import { createRpcServer } from "./rpc/server.mjs";
|
|
3
|
-
import { t as diagnostics } from "./diagnostics-
|
|
3
|
+
import { t as diagnostics } from "./diagnostics-Cx4_VjlG.mjs";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
//#region src/node/rpc-core.ts
|
|
6
6
|
var rpc_core_exports = /* @__PURE__ */ __exportAll({ createContextRpcServer: () => createContextRpcServer });
|
|
@@ -31,6 +31,22 @@ function expandResolveFrom(resolveFrom, cwd) {
|
|
|
31
31
|
} catch {}
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
+
* Resolve a package specifier against each `resolveFrom` candidate in order,
|
|
35
|
+
* returning the resolved absolute path or `undefined`. A pure probe: nothing
|
|
36
|
+
* is imported. The resolution base arrives as a parameter (not a literal
|
|
37
|
+
* `createRequire(import.meta.url)`), which keeps bundlers that special-case
|
|
38
|
+
* that pattern (turbopack rewrites its `.resolve()` of a dynamic specifier
|
|
39
|
+
* into a throwing stub) from touching the runtime resolution.
|
|
40
|
+
*/
|
|
41
|
+
function resolveServicePackage(pkg, resolveFrom) {
|
|
42
|
+
for (const from of resolveFrom) {
|
|
43
|
+
if (typeof from !== "string" || from.length === 0) continue;
|
|
44
|
+
try {
|
|
45
|
+
return createRequire(toRequireBase(from)).resolve(pkg);
|
|
46
|
+
} catch {}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
34
50
|
* Import a service package's module, trying each `resolveFrom` candidate in
|
|
35
51
|
* order (so a plugin-declared service resolves against the plugin's own
|
|
36
52
|
* dependency tree first, then the workspace fallback). Throws the last
|
|
@@ -151,4 +167,4 @@ function deepMergeOptionSets(sets) {
|
|
|
151
167
|
return sets.reduce((merged, set) => deepMergeTwo(merged, set));
|
|
152
168
|
}
|
|
153
169
|
//#endregion
|
|
154
|
-
export { satisfiesVersionRange as i, expandResolveFrom as n, importServicePackage as r, deepMergeOptionSets as t };
|
|
170
|
+
export { satisfiesVersionRange as a, resolveServicePackage as i, expandResolveFrom as n, importServicePackage as r, deepMergeOptionSets as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as ChannelOptions } from "./index-Bia1vKjL.mjs";
|
|
2
|
+
import { g as RpcFunctionDefinitionAny } from "./types-BmDbfHCx.mjs";
|
|
3
3
|
//#region src/rpc/transports/sse-client.d.ts
|
|
4
4
|
interface SseRpcChannelOptions {
|
|
5
5
|
/** Resolved `http(s)://` URL of the SSE endpoint. */
|