import type { WriteInvalidation } from "@concavejs/core"; export type { WriteInvalidation } from "@concavejs/core"; import type { UdfResult } from "@concavejs/core/udf"; import type { WireAuthContext } from "@concavejs/core/auth"; import type { SyncWebSocket } from "@concavejs/core/sync"; import type { ClientMessage, ServerMessage } from "@concavejs/core/types"; import type { JSONValue } from "convex/values"; import type { UserIdentityAttributes } from "convex/server"; export interface ClientTransport { clientUrl: string; webSocketConstructor: typeof WebSocket; fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise; } export interface RuntimeUdfRequest { path: string; args: Record; type: "query" | "mutation" | "action"; auth?: WireAuthContext | UserIdentityAttributes; componentPath?: string; requestId?: string; snapshotTimestamp?: bigint; /** * Execute with the internal-capable server call context. This is for trusted * in-process callers such as the test harness, not public client traffic. */ trusted?: boolean; } export interface RuntimeHost { readonly clientUrl: string; start(): Promise; executeUdf(request: RuntimeUdfRequest): Promise; executeHttp(request: Request, auth?: WireAuthContext | UserIdentityAttributes, requestId?: string): Promise; createSyncSession(sessionId: string, websocket: SyncWebSocket): Promise; updateSyncSessionId(oldSessionId: string, newSessionId: string): void; handleSyncMessage(sessionId: string, message: ClientMessage): Promise; destroySyncSession(sessionId: string): void; handleRequest(request: Request): Promise; notifyWrites(invalidation: WriteInvalidation): Promise; createWebSocketConstructor(): typeof WebSocket; createFetch(clientUrl?: string): (input: RequestInfo | URL, init?: RequestInit) => Promise; createTransport(clientUrl?: string): ClientTransport; close(): Promise; }