iframe-based deferred rendering with tokenized isolation layer

This commit is contained in:
laura 2025-11-08 18:34:17 -03:00
parent 1c361de610
commit 3ec65b9a0f
Signed by: w
GPG key ID: BCD2117C99E69817
8 changed files with 308 additions and 90 deletions

View file

@ -4,25 +4,32 @@
*/
import { DataStream } from "./http.ts";
import { Router } from "cobweb/routing";
export interface Context<Params = Record<string, string>> {
readonly request: Request;
readonly info: Deno.ServeHandlerInfo<Deno.NetAddr>;
readonly url: URL;
readonly method: string;
readonly params: Params;
readonly pattern: URLPatternResult;
readonly stream: DataStream;
readonly signal: AbortSignal;
readonly router: Router;
state: Map<string | symbol, unknown>;
}
export async function createContext<P = Record<string, string>>(
router: Router,
request: Request,
info: Deno.ServeHandlerInfo<Deno.NetAddr>,
pattern: URLPatternResult,
stream: DataStream,
): Promise<Context<P>> {
return {
router,
request,
info,
url: new URL(request.url),
method: request.method,
params: (pattern.pathname.groups || {}) as P,