@junejs/server 0.1.2-dev.9 → 1.0.0-dev.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/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AdapterCapabilities, AdapterEmitContext, AdapterEntry, JuneAdapter, ResourcePlan, deno, staticSite, vercel, workers } from "./adapter.js";
|
|
2
2
|
import { CreateAppOptions, JuneApp, createApp } from "./app.js";
|
|
3
3
|
import { R2Bucket, localBlob, r2 } from "./blob.js";
|
|
4
|
-
import { a as Pipeline, d as createPipeline, n as LayoutComponent, o as PipelineConfig, s as Resolved, u as RouteResolver } from "./pipeline-
|
|
4
|
+
import { a as Pipeline, d as createPipeline, n as LayoutComponent, o as PipelineConfig, s as Resolved, u as RouteResolver } from "./pipeline-cCR6MGNK.js";
|
|
5
5
|
import { WorkerManifest, createWorker } from "./worker.js";
|
|
6
6
|
import { BuildResult, buildManifest, freezeConfig, generateContent, juneBuild, scanRoutes } from "./build.js";
|
|
7
7
|
import { loadJuneConfig } from "./config-loader.js";
|
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { DocumentConfig } from "@junejs/core/document";
|
|
5
5
|
import { I18nConfig } from "@junejs/core/i18n";
|
|
6
6
|
import { Resources } from "@junejs/core/resources";
|
|
7
|
+
import { Principal, Session } from "@junejs/core/context";
|
|
7
8
|
//#region src/pipeline.d.ts
|
|
8
9
|
type LayoutComponent = React.ComponentType<{
|
|
9
10
|
children: React.ReactNode;
|
|
@@ -32,6 +33,13 @@ type PipelineConfig = {
|
|
|
32
33
|
resolve: RouteResolver;
|
|
33
34
|
resources?: () => Promise<Resources> | Resources;
|
|
34
35
|
services?: () => Promise<unknown> | unknown;
|
|
36
|
+
identity?: (request: Request) => Promise<{
|
|
37
|
+
user?: Principal;
|
|
38
|
+
session?: Session;
|
|
39
|
+
}> | {
|
|
40
|
+
user?: Principal;
|
|
41
|
+
session?: Session;
|
|
42
|
+
};
|
|
35
43
|
earlyHints?: string[];
|
|
36
44
|
htmlCacheControl?: string;
|
|
37
45
|
notFoundComponent?: React.ComponentType<{
|
package/dist/pipeline.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Pipeline, c as ResolvedResource, d as createPipeline, i as MiddlewareHandler, l as ResourceHandler, n as LayoutComponent, o as PipelineConfig, r as LoadingComponent, s as Resolved, t as ExtraHandler, u as RouteResolver } from "./pipeline-
|
|
1
|
+
import { a as Pipeline, c as ResolvedResource, d as createPipeline, i as MiddlewareHandler, l as ResourceHandler, n as LayoutComponent, o as PipelineConfig, r as LoadingComponent, s as Resolved, t as ExtraHandler, u as RouteResolver } from "./pipeline-cCR6MGNK.js";
|
|
2
2
|
export { ExtraHandler, LayoutComponent, LoadingComponent, MiddlewareHandler, Pipeline, PipelineConfig, Resolved, ResolvedResource, ResourceHandler, RouteResolver, createPipeline };
|
package/dist/pipeline.js
CHANGED
|
@@ -171,7 +171,10 @@ function createPipeline(cfg) {
|
|
|
171
171
|
const url = new URL(request.url);
|
|
172
172
|
if (url.pathname === "/mcp") {
|
|
173
173
|
if (!agent.mcp) return notFoundResponse("view", url.pathname);
|
|
174
|
-
return mcpHandler(request, {
|
|
174
|
+
return mcpHandler(request, {
|
|
175
|
+
request,
|
|
176
|
+
...cfg.identity ? await cfg.identity(request) : void 0
|
|
177
|
+
});
|
|
175
178
|
}
|
|
176
179
|
if (request.method === "GET" && agent.discovery) {
|
|
177
180
|
const d = await discovery(url);
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as ResourceHandler, n as LayoutComponent, r as LoadingComponent, t as ExtraHandler } from "./pipeline-
|
|
1
|
+
import { l as ResourceHandler, n as LayoutComponent, r as LoadingComponent, t as ExtraHandler } from "./pipeline-cCR6MGNK.js";
|
|
2
2
|
import { BrandedRoute } from "@junejs/core/route";
|
|
3
3
|
import { AgentConfig } from "@junejs/core/config";
|
|
4
4
|
import React from "react";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junejs/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-dev.10",
|
|
4
4
|
"description": "June host adapters + dev server. Host-coupled; depends on the pure @junejs/core contract layer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -125,14 +125,14 @@
|
|
|
125
125
|
"build": "tsdown"
|
|
126
126
|
},
|
|
127
127
|
"dependencies": {
|
|
128
|
-
"@junejs/db": ">=0.0.34-dev.
|
|
128
|
+
"@junejs/db": ">=0.0.34-dev.1",
|
|
129
129
|
"@momiji-rs/sparkdown": "^0.0.4",
|
|
130
130
|
"lightningcss": "^1.27.0",
|
|
131
131
|
"oxc-parser": "^0.137.0",
|
|
132
132
|
"rolldown": "^1.1.0"
|
|
133
133
|
},
|
|
134
134
|
"peerDependencies": {
|
|
135
|
-
"@junejs/core": ">=0.
|
|
135
|
+
"@junejs/core": ">=0.2.0-dev.26",
|
|
136
136
|
"react": "^19.2.0",
|
|
137
137
|
"react-dom": "^19.2.0",
|
|
138
138
|
"react-server-dom-webpack": "19.2.7",
|
|
@@ -156,7 +156,8 @@
|
|
|
156
156
|
},
|
|
157
157
|
"repository": {
|
|
158
158
|
"type": "git",
|
|
159
|
-
"url": "https://github.com/junebuild/june"
|
|
159
|
+
"url": "git+https://github.com/junebuild/june.git",
|
|
160
|
+
"directory": "packages/june"
|
|
160
161
|
},
|
|
161
162
|
"devDependencies": {
|
|
162
163
|
"@libsql/client": "^0.17.3",
|
package/src/pipeline.ts
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
sitemapXml,
|
|
35
35
|
} from "@junejs/core/discovery";
|
|
36
36
|
import { mcpHandler, mcpTools } from "@junejs/core/mcp";
|
|
37
|
+
import type { Principal, Session } from "@junejs/core/context";
|
|
37
38
|
|
|
38
39
|
import { ensureScope, runInScope, setRequestLocale } from "@junejs/db";
|
|
39
40
|
import type { AgentConfig } from "@junejs/core/config";
|
|
@@ -126,6 +127,14 @@ export type PipelineConfig = {
|
|
|
126
127
|
// `currentServices()` resolves in loaders/views/actions. Absent → currentServices()
|
|
127
128
|
// is undefined. This is the Worker-side twin of a Durable Object seeding services.
|
|
128
129
|
services?: () => Promise<unknown> | unknown;
|
|
130
|
+
// Resolve the request's authenticated identity (the auth integration's job —
|
|
131
|
+
// e.g. Better Auth reading the session cookie). The result rides every
|
|
132
|
+
// ActionContext the pipeline builds, starting with the /mcp mount, so
|
|
133
|
+
// requiresPrincipal actions and per-call connection auth see the SAME
|
|
134
|
+
// principal a UI dispatch would. Absent → anonymous (identity-gated actions
|
|
135
|
+
// reject); a THROWING resolver propagates as a server error — it must never
|
|
136
|
+
// silently degrade to anonymous.
|
|
137
|
+
identity?: (request: Request) => Promise<{ user?: Principal; session?: Session }> | { user?: Principal; session?: Session };
|
|
129
138
|
earlyHints?: string[];
|
|
130
139
|
htmlCacheControl?: string;
|
|
131
140
|
notFoundComponent?: React.ComponentType<{ pathname: string }>;
|
|
@@ -473,9 +482,11 @@ export function createPipeline(cfg: PipelineConfig): Pipeline {
|
|
|
473
482
|
if (url.pathname === "/mcp") {
|
|
474
483
|
if (!agent.mcp) return notFoundResponse("view", url.pathname);
|
|
475
484
|
// The agent's tool calls run inside the same request scope, so an action's
|
|
476
|
-
// ambient `db` is the SAME resource the UI uses
|
|
477
|
-
// the same principal
|
|
478
|
-
|
|
485
|
+
// ambient `db` is the SAME resource the UI uses, and — via cfg.identity —
|
|
486
|
+
// the same principal: requiresPrincipal actions and per-call connection
|
|
487
|
+
// auth are live on this surface. ctx carries identity only — not resources.
|
|
488
|
+
const identity = cfg.identity ? await cfg.identity(request) : undefined;
|
|
489
|
+
return mcpHandler(request, { request, ...identity });
|
|
479
490
|
}
|
|
480
491
|
if (request.method === "GET" && agent.discovery) {
|
|
481
492
|
const d = await discovery(url);
|