CARD-22 / D20. api-extractor 7.59.4 is now a dev dependency.
scripts/api-report.mjs reads the declarations that tsup emits for each
export-map entry (".", "./deno", "./bun", "./edge") and writes
api/<entry>.api.md.
`npm run api` regenerates the reports. `npm run api:check` runs in the
CI build job and fails when a report differs from the build, so a
public type change has to arrive with its regenerated report in the
same PR.
The check also fails on ae-forgotten-export: a public signature that
names a type its entry does not export. In the adapter entries, a root
type such as App or Logger is accepted, because it is importable from
@green-tea/core; any other unexported type still fails. Both failure
paths were verified locally, by adding a field to TlsOptions and by
un-exporting DenoServeOptions.
The reports are not published: npm ships dist/ and JSR ships src/.
CONTRIBUTING documents the check and the additions-only rule.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
1082 lines
25 KiB
Markdown
1082 lines
25 KiB
Markdown
## API Report File for "@green-tea/core"
|
|
|
|
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
|
|
```ts
|
|
|
|
import http from 'http';
|
|
|
|
// @public
|
|
export function abort(): ParameterDecorator;
|
|
|
|
// @public
|
|
export interface App {
|
|
boot(): Promise<void>;
|
|
// (undocumented)
|
|
bus: Bus;
|
|
close(options?: {
|
|
timeoutMs?: number;
|
|
}): Promise<void>;
|
|
degraded(): string[];
|
|
// (undocumented)
|
|
explain(routePath: string): Explain;
|
|
fetch(request: Request): Promise<Response>;
|
|
// (undocumented)
|
|
graph(): GraphView;
|
|
handleSignals<T extends (options?: {
|
|
timeoutMs?: number;
|
|
}) => Promise<void>>(closer: T): T;
|
|
// (undocumented)
|
|
inspect(routePath: string): InspectLine[];
|
|
// (undocumented)
|
|
listen(port: number): Promise<http.Server>;
|
|
logger: Logger;
|
|
openapi(info?: OpenApiInfo): OpenApiDoc;
|
|
ready(): Promise<void>;
|
|
// (undocumented)
|
|
toDOT(): string;
|
|
// (undocumented)
|
|
toMermaid(): string;
|
|
upgrade(request: WsRequest, socket: WsSocket): Promise<void>;
|
|
}
|
|
|
|
// @public
|
|
export interface AppOptions {
|
|
// (undocumented)
|
|
bodyDuplicates?: 'array' | 'last';
|
|
compression?: boolean | CompressionOptions;
|
|
// (undocumented)
|
|
cors?: CorsOptions;
|
|
// (undocumented)
|
|
devGraph?: boolean;
|
|
// (undocumented)
|
|
devOpenapi?: boolean;
|
|
etag?: boolean;
|
|
experimental?: boolean;
|
|
handleSignals?: boolean;
|
|
health?: boolean | {
|
|
drainDelayMs?: number;
|
|
};
|
|
hooks?: Hooks[];
|
|
// (undocumented)
|
|
limits?: RequestLimits;
|
|
logger?: Logger;
|
|
logRequests?: boolean;
|
|
// (undocumented)
|
|
mesh?: MeshConfig;
|
|
// (undocumented)
|
|
modules: Ctor[];
|
|
onError?: ErrorRenderer;
|
|
// (undocumented)
|
|
overrides?: Record<string, unknown>;
|
|
// (undocumented)
|
|
plugins?: Plugin[];
|
|
// (undocumented)
|
|
security?: boolean | SecurityOptions;
|
|
shutdownTimeoutMs?: number;
|
|
static?: boolean | string | {
|
|
dir?: string;
|
|
cacheControl?: string;
|
|
};
|
|
teardownTimeoutMs?: number;
|
|
// (undocumented)
|
|
tls?: TlsOptions;
|
|
// (undocumented)
|
|
trustProxy?: boolean;
|
|
viewEngine?: (source: string, data: unknown) => string;
|
|
views?: string;
|
|
warnGraphDepth?: number | false;
|
|
}
|
|
|
|
// @public
|
|
export type ArgDecorator = (arg?: string | string[] | StandardSchemaV1, schema?: StandardSchemaV1) => ParameterDecorator;
|
|
|
|
// @public (undocumented)
|
|
export type ArgSource = 'ctx' | 'needs' | 'params' | 'query' | 'body' | 'headers' | 'cookies' | 'inbound' | 'abort';
|
|
|
|
// @public
|
|
export interface ArgSpec {
|
|
// (undocumented)
|
|
index: number;
|
|
// (undocumented)
|
|
key?: string;
|
|
// (undocumented)
|
|
keys?: string[];
|
|
// (undocumented)
|
|
schema?: StandardSchemaV1;
|
|
// (undocumented)
|
|
source: ArgSource;
|
|
}
|
|
|
|
// @public
|
|
export const body: ArgDecorator;
|
|
|
|
// @public
|
|
export function buildManifest(args: {
|
|
steps: string[];
|
|
routes: RouteEntry[];
|
|
}): Manifest;
|
|
|
|
// @public
|
|
export function buildOpenApi(routes: OpenApiRoute[], info?: OpenApiInfo): OpenApiDoc;
|
|
|
|
// @public
|
|
export function buildRemote(link: Link): {
|
|
steps: RemoteScopeNode[];
|
|
routes: RemoteRoute[];
|
|
};
|
|
|
|
// @public
|
|
export class Bus {
|
|
emit(event: LifecycleEvent, payload: EventPayload): void;
|
|
hasListeners(event: LifecycleEvent): boolean;
|
|
on(event: LifecycleEvent, listener: (p: EventPayload) => void): () => void;
|
|
}
|
|
|
|
// @public
|
|
export interface BusLike {
|
|
// (undocumented)
|
|
on(event: 'request:end' | 'request:failed', listener: (payload: EventPayload) => void): () => void;
|
|
}
|
|
|
|
// @public
|
|
export interface Channel<T> extends AsyncIterable<T> {
|
|
// (undocumented)
|
|
close(): void;
|
|
// (undocumented)
|
|
readonly closed: boolean;
|
|
// (undocumented)
|
|
fail(err: unknown): void;
|
|
// (undocumented)
|
|
push(value: T): void;
|
|
}
|
|
|
|
// @public
|
|
export function channel<T>(opts?: {
|
|
buffer?: number;
|
|
}): Channel<T>;
|
|
|
|
// @public
|
|
export interface CompiledFlow<Seed, Acc> {
|
|
// (undocumented)
|
|
handler: (ctx: Acc) => unknown;
|
|
// (undocumented)
|
|
run(seed: Seed): Promise<unknown>;
|
|
// (undocumented)
|
|
steps: {
|
|
name: string;
|
|
fn: StepFn<any, any>;
|
|
}[];
|
|
}
|
|
|
|
// @public
|
|
export interface CompressionOptions {
|
|
encodings?: Array<'br' | 'gzip'>;
|
|
threshold?: number;
|
|
}
|
|
|
|
// @public
|
|
export function connectLink(args: {
|
|
url: string;
|
|
secret: string;
|
|
timeoutMs?: number;
|
|
heartbeatMs?: number;
|
|
bus?: Bus;
|
|
Ctor?: SocketCtor;
|
|
reconnect?: boolean | ReconnectOptions;
|
|
onManifestChange?: ManifestPolicy;
|
|
logger?: Logger;
|
|
onReconnect?: (manifest: Manifest) => void;
|
|
onGone?: () => void;
|
|
}): Promise<Link>;
|
|
|
|
// @public
|
|
export type Context = Record<string, unknown>;
|
|
|
|
// @public
|
|
export const cookie: ArgDecorator;
|
|
|
|
// @public
|
|
export interface CookieOptions {
|
|
domain?: string;
|
|
expires?: Date;
|
|
httpOnly?: boolean;
|
|
maxAge?: number;
|
|
partitioned?: boolean;
|
|
path?: string;
|
|
sameSite?: 'strict' | 'lax' | 'none';
|
|
secure?: boolean;
|
|
}
|
|
|
|
// @public
|
|
export const cookies: ArgDecorator;
|
|
|
|
// @public
|
|
export type Correlation = Pick<EventPayload, 'requestId' | 'traceId' | 'route' | 'method' | 'transport'>;
|
|
|
|
// @public
|
|
export interface CorsOptions {
|
|
// (undocumented)
|
|
allowedHeaders?: string[];
|
|
// (undocumented)
|
|
credentials?: boolean;
|
|
// (undocumented)
|
|
exposedHeaders?: string[];
|
|
// (undocumented)
|
|
maxAge?: number;
|
|
// (undocumented)
|
|
methods?: string[];
|
|
// (undocumented)
|
|
origins: string | string[] | '*' | ((origin: string) => boolean);
|
|
}
|
|
|
|
// @public
|
|
export function createApp(opts: AppOptions): App;
|
|
|
|
// @public
|
|
export function createDefaultLogger(pretty?: boolean): Logger;
|
|
|
|
// @public
|
|
export function createMeshControl(deps: MeshControlDeps): {
|
|
path: string;
|
|
maxFrameBytes: number;
|
|
handle: (socket: WsSocket) => Promise<void>;
|
|
};
|
|
|
|
// @public
|
|
export type Ctor = new (...args: any[]) => any;
|
|
|
|
// @public
|
|
export function ctx(): ParameterDecorator;
|
|
|
|
// @public
|
|
export const Delete: RouteDecorator;
|
|
|
|
// @public
|
|
export function envelopeFrom(ctx: any): RequestEnvelope;
|
|
|
|
// @public
|
|
export type ErrorRenderer = (error: unknown, req: ErrorRequest) => ErrorResponse | undefined | void;
|
|
|
|
// @public
|
|
export interface ErrorRequest {
|
|
// (undocumented)
|
|
headers: Record<string, string | string[] | undefined>;
|
|
// (undocumented)
|
|
method: string;
|
|
// (undocumented)
|
|
url: string;
|
|
}
|
|
|
|
// @public
|
|
export interface ErrorResponse {
|
|
// (undocumented)
|
|
body: string;
|
|
headers: Record<string, string | string[]>;
|
|
// (undocumented)
|
|
status: number;
|
|
}
|
|
|
|
// @public
|
|
export interface EventfulSocket {
|
|
// (undocumented)
|
|
addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (event: {
|
|
data?: string | ArrayBuffer;
|
|
error?: unknown;
|
|
}) => void): void;
|
|
readonly bufferedAmount?: number;
|
|
// (undocumented)
|
|
close(code?: number, reason?: string): void;
|
|
// (undocumented)
|
|
readonly readyState: number;
|
|
// (undocumented)
|
|
send(data: string): void;
|
|
}
|
|
|
|
// @public
|
|
export interface EventPayload {
|
|
added?: string[];
|
|
// (undocumented)
|
|
durationMs?: number;
|
|
// (undocumented)
|
|
error?: unknown;
|
|
// (undocumented)
|
|
method?: string;
|
|
name: string;
|
|
removed?: string[];
|
|
requestId?: string;
|
|
route?: string;
|
|
// (undocumented)
|
|
scope?: string;
|
|
status?: number;
|
|
traceId?: string;
|
|
// (undocumented)
|
|
transport?: string;
|
|
url?: string;
|
|
}
|
|
|
|
// @public
|
|
export interface Events {
|
|
// (undocumented)
|
|
on: Bus['on'];
|
|
}
|
|
|
|
// @public
|
|
export interface Explain {
|
|
// (undocumented)
|
|
chain: ExplainNode[];
|
|
// (undocumented)
|
|
method: HttpMethod;
|
|
// (undocumented)
|
|
pattern: string;
|
|
// (undocumented)
|
|
transport: Transport;
|
|
}
|
|
|
|
// @public
|
|
export interface ExplainNode {
|
|
// (undocumented)
|
|
kind: 'provider' | 'step' | 'handler';
|
|
// (undocumented)
|
|
name: string;
|
|
// (undocumented)
|
|
needs: string[];
|
|
// (undocumented)
|
|
origin: string;
|
|
// (undocumented)
|
|
provides: string[];
|
|
}
|
|
|
|
// @public
|
|
export class Flow<Seed, Acc> {
|
|
constructor(steps?: {
|
|
name: string;
|
|
fn: StepFn<any, any>;
|
|
}[]);
|
|
handle(handler: (ctx: Acc) => unknown): CompiledFlow<Seed, Acc>;
|
|
step<Out>(name: string, fn: StepFn<Acc, Out>): Flow<Seed, Acc & Out>;
|
|
}
|
|
|
|
// @public
|
|
export function flow<Seed extends object>(): Flow<Seed, Seed>;
|
|
|
|
// @public
|
|
export type Frame = {
|
|
type: 'hello';
|
|
v: number;
|
|
secret: string;
|
|
} | {
|
|
type: 'manifest';
|
|
v: number;
|
|
steps: string[];
|
|
routes: RouteEntry[];
|
|
} | {
|
|
type: 'rpc-req';
|
|
id: string;
|
|
kind: 'scope' | 'route';
|
|
name: string;
|
|
ctx: RequestEnvelope;
|
|
} | {
|
|
type: 'rpc-res';
|
|
id: string;
|
|
ok: true;
|
|
result: unknown;
|
|
} | {
|
|
type: 'rpc-res';
|
|
id: string;
|
|
ok: false;
|
|
error: {
|
|
message: string;
|
|
status?: number;
|
|
};
|
|
} | {
|
|
type: 'ping';
|
|
} | {
|
|
type: 'pong';
|
|
};
|
|
|
|
// @public
|
|
export const Get: RouteDecorator;
|
|
|
|
// @public
|
|
export interface GraphNodeView {
|
|
// (undocumented)
|
|
kind: 'provider' | 'step';
|
|
// (undocumented)
|
|
name: string;
|
|
// (undocumented)
|
|
needs: string[];
|
|
// (undocumented)
|
|
origin: string;
|
|
// (undocumented)
|
|
provides: string[];
|
|
}
|
|
|
|
// @public
|
|
export interface GraphRouteView {
|
|
// (undocumented)
|
|
chain: string[];
|
|
// (undocumented)
|
|
method: string;
|
|
// (undocumented)
|
|
pattern: string;
|
|
// (undocumented)
|
|
transport: string;
|
|
}
|
|
|
|
// @public
|
|
export interface GraphView {
|
|
// (undocumented)
|
|
nodes: GraphNodeView[];
|
|
// (undocumented)
|
|
routes: GraphRouteView[];
|
|
}
|
|
|
|
// @public
|
|
export const Head: RouteDecorator;
|
|
|
|
// @public
|
|
export const header: ArgDecorator;
|
|
|
|
// @public
|
|
export const headers: ArgDecorator;
|
|
|
|
// @public @deprecated (undocumented)
|
|
type Headers_2 = RequestHeaders;
|
|
export { Headers_2 as Headers }
|
|
|
|
// @public
|
|
export interface Hooks {
|
|
onShutdown?: TeardownFn;
|
|
}
|
|
|
|
// @public
|
|
export function Html(path: string, opts?: {
|
|
template?: boolean;
|
|
}): MethodDecorator;
|
|
|
|
// @public (undocumented)
|
|
export function Html(target: object, propertyKey: string | symbol): void;
|
|
|
|
// @public
|
|
export const HTTP_ERROR: unique symbol;
|
|
|
|
// @public
|
|
export class HttpError extends Error {
|
|
// (undocumented)
|
|
readonly [HTTP_ERROR] = true;
|
|
constructor(status: number, message?: string, body?: unknown | undefined, headers?: Record<string, string | string[]> | undefined);
|
|
// (undocumented)
|
|
readonly body?: unknown | undefined;
|
|
// (undocumented)
|
|
readonly headers?: Record<string, string | string[]> | undefined;
|
|
// (undocumented)
|
|
readonly status: number;
|
|
}
|
|
|
|
// @public
|
|
export interface HttpErrorLike {
|
|
// (undocumented)
|
|
body?: unknown;
|
|
// (undocumented)
|
|
headers?: Record<string, string | string[]>;
|
|
// (undocumented)
|
|
message: string;
|
|
// (undocumented)
|
|
status: number;
|
|
}
|
|
|
|
// @public
|
|
export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
|
|
// @public
|
|
export function inbound(): ParameterDecorator;
|
|
|
|
// @public
|
|
export interface InspectLine {
|
|
// (undocumented)
|
|
kind: 'provider' | 'step' | 'handler';
|
|
// (undocumented)
|
|
name: string;
|
|
// (undocumented)
|
|
origin: string;
|
|
}
|
|
|
|
// @public
|
|
export function isAsyncIterable(x: unknown): x is AsyncIterable<unknown>;
|
|
|
|
// @public
|
|
export function isHttpError(error: unknown): error is HttpErrorLike;
|
|
|
|
// @public
|
|
export function isSseEvent(item: unknown): item is SseEvent;
|
|
|
|
// @public
|
|
export function isValidationError(error: unknown): error is ValidationError;
|
|
|
|
// @public
|
|
export const JsonTransformer: TransformerFn;
|
|
|
|
// @public
|
|
export type LifecycleEvent = 'boot:provider:start' | 'boot:provider:ok' | 'boot:provider:fail' | 'request:step:enter' | 'request:step:leave' | 'request:step:error' | 'stream:open' | 'stream:close' | 'stream:error' | 'mesh:connect' | 'mesh:disconnect' | 'mesh:rpc:error' | 'mesh:boot:retry' | 'mesh:routes' | 'plugin:mounted' | 'request:start' | 'request:end' | 'request:failed' | 'route:matched' | 'route:unmatched';
|
|
|
|
// @public
|
|
export interface Link {
|
|
// (undocumented)
|
|
close(): void;
|
|
// (undocumented)
|
|
manifest: Manifest;
|
|
// (undocumented)
|
|
rpc(kind: 'scope' | 'route', name: string, ctx: RequestEnvelope): Promise<unknown>;
|
|
}
|
|
|
|
// @public
|
|
export type LogFields = Record<string, unknown>;
|
|
|
|
// @public
|
|
export interface Logger {
|
|
// (undocumented)
|
|
debug(message: string, fields?: LogFields): void;
|
|
// (undocumented)
|
|
error(message: string, fields?: LogFields): void;
|
|
// (undocumented)
|
|
info(message: string, fields?: LogFields): void;
|
|
// (undocumented)
|
|
warn(message: string, fields?: LogFields): void;
|
|
}
|
|
|
|
// @public
|
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
|
|
// @public
|
|
export function logRequests(bus: BusLike, logger: Logger): () => void;
|
|
|
|
// @public
|
|
export interface Manifest {
|
|
// (undocumented)
|
|
routes: RouteEntry[];
|
|
// (undocumented)
|
|
steps: string[];
|
|
}
|
|
|
|
// @public
|
|
export type ManifestPolicy = 'refuse';
|
|
|
|
// @public
|
|
export const MESH_CONTROL_PATH = "/__mesh__/control";
|
|
|
|
// @public
|
|
export interface MeshConfig {
|
|
bootTimeoutMs?: number;
|
|
heartbeatMs?: number;
|
|
onManifestChange?: 'refuse';
|
|
reconnect?: boolean | {
|
|
initialDelayMs?: number;
|
|
maxDelayMs?: number;
|
|
};
|
|
// (undocumented)
|
|
secret?: string;
|
|
// (undocumented)
|
|
teapots?: Array<{
|
|
url: string;
|
|
secret: string;
|
|
}>;
|
|
timeoutMs?: number;
|
|
}
|
|
|
|
// @public
|
|
export interface MeshControlDeps {
|
|
// (undocumented)
|
|
bus?: Bus;
|
|
// (undocumented)
|
|
manifest: Manifest;
|
|
maxBodyBytes?: number;
|
|
// (undocumented)
|
|
resolveRoute: (name: string, env: RequestEnvelope) => Promise<ResponseShape>;
|
|
// (undocumented)
|
|
resolveScope: (name: string, env: RequestEnvelope) => Promise<unknown>;
|
|
// (undocumented)
|
|
secret: string;
|
|
}
|
|
|
|
// @public
|
|
export function Module(opts: ModuleOptions): ClassDecorator;
|
|
|
|
// @public
|
|
export interface ModuleOptions {
|
|
// (undocumented)
|
|
controllers?: Ctor[];
|
|
// (undocumented)
|
|
mountpoint: string;
|
|
// (undocumented)
|
|
providers?: Ctor[];
|
|
// (undocumented)
|
|
steps?: Ctor[];
|
|
}
|
|
|
|
// @public
|
|
export interface MultipartBody {
|
|
// (undocumented)
|
|
fields: Record<string, string | string[]>;
|
|
// (undocumented)
|
|
files: Record<string, UploadedFile | UploadedFile[]>;
|
|
}
|
|
|
|
// @public
|
|
export const ndjsonEncoder: StreamEncoder;
|
|
|
|
// @public
|
|
export function needs(key: string): ParameterDecorator;
|
|
|
|
// @public
|
|
export class NotFound extends HttpError {
|
|
constructor(message?: string);
|
|
}
|
|
|
|
// @public
|
|
export class NotModified extends HttpError {
|
|
constructor();
|
|
}
|
|
|
|
// @public
|
|
export interface OpenApiDoc {
|
|
// (undocumented)
|
|
info: {
|
|
title: string;
|
|
version: string;
|
|
description?: string;
|
|
};
|
|
// (undocumented)
|
|
openapi: string;
|
|
// (undocumented)
|
|
paths: Record<string, Record<string, unknown>>;
|
|
}
|
|
|
|
// @public
|
|
export interface OpenApiInfo {
|
|
// (undocumented)
|
|
description?: string;
|
|
// (undocumented)
|
|
title?: string;
|
|
// (undocumented)
|
|
version?: string;
|
|
}
|
|
|
|
// @public
|
|
export interface OpenApiRoute {
|
|
// (undocumented)
|
|
args: ArgSpec[];
|
|
// (undocumented)
|
|
method: string;
|
|
// (undocumented)
|
|
pattern: string;
|
|
// (undocumented)
|
|
transport: Transport;
|
|
}
|
|
|
|
// @public
|
|
export const Options: RouteDecorator;
|
|
|
|
// @public
|
|
export const param: ArgDecorator;
|
|
|
|
// @public
|
|
export function parseCookies(header: string | string[] | undefined): Record<string, string>;
|
|
|
|
// @public
|
|
export const Patch: RouteDecorator;
|
|
|
|
// @public
|
|
export interface Plugin {
|
|
// (undocumented)
|
|
mount(api: PluginApi): void;
|
|
// (undocumented)
|
|
readonly name: string;
|
|
}
|
|
|
|
// @public
|
|
export interface PluginApi {
|
|
// (undocumented)
|
|
bus: {
|
|
on: Bus['on'];
|
|
};
|
|
onShutdown(fn: TeardownFn): void;
|
|
// (undocumented)
|
|
scope: ScopeApi;
|
|
}
|
|
|
|
// @public
|
|
export const Post: RouteDecorator;
|
|
|
|
// @public
|
|
export function Provider(opts: {
|
|
provides: string;
|
|
needs?: string[];
|
|
optional?: boolean;
|
|
}): ClassDecorator;
|
|
|
|
// @public
|
|
export const Put: RouteDecorator;
|
|
|
|
// @public
|
|
export type Query = Record<string, string>;
|
|
|
|
// @public
|
|
export const query: ArgDecorator;
|
|
|
|
// @public
|
|
export interface ReconnectOptions {
|
|
initialDelayMs?: number;
|
|
maxDelayMs?: number;
|
|
}
|
|
|
|
// @public
|
|
export class Redirect extends HttpError {
|
|
constructor(location: string);
|
|
// (undocumented)
|
|
readonly location: string;
|
|
}
|
|
|
|
// @public
|
|
export interface RemoteRoute {
|
|
// (undocumented)
|
|
handler: (req: RequestEnvelope) => Promise<ResponseShape>;
|
|
// (undocumented)
|
|
method: string;
|
|
// (undocumented)
|
|
pattern: string;
|
|
}
|
|
|
|
// @public
|
|
export interface RemoteScopeNode {
|
|
// (undocumented)
|
|
name: string;
|
|
// (undocumented)
|
|
run: (ctx: any) => Promise<Record<string, unknown>>;
|
|
}
|
|
|
|
// @public
|
|
export function render(source: string, data: unknown): string;
|
|
|
|
// @public
|
|
export interface RequestEnvelope {
|
|
// (undocumented)
|
|
body: unknown;
|
|
correlation?: {
|
|
requestId?: string;
|
|
traceId?: string;
|
|
};
|
|
// (undocumented)
|
|
headers: Record<string, string | string[] | undefined>;
|
|
// (undocumented)
|
|
method: string;
|
|
// (undocumented)
|
|
params: Record<string, string>;
|
|
// (undocumented)
|
|
query: Record<string, string>;
|
|
url?: string;
|
|
}
|
|
|
|
// @public
|
|
export type RequestHeaders = Record<string, string | string[] | undefined>;
|
|
|
|
// @public
|
|
export interface RequestLimits {
|
|
// (undocumented)
|
|
headersTimeoutMs?: number;
|
|
// (undocumented)
|
|
keepAliveTimeoutMs?: number;
|
|
// (undocumented)
|
|
maxBodyBytes?: number;
|
|
// (undocumented)
|
|
maxConcurrentRequests?: number;
|
|
// (undocumented)
|
|
maxConnections?: number;
|
|
// (undocumented)
|
|
maxParts?: number;
|
|
maxWsMessageBytes?: number;
|
|
maxWsQueue?: number;
|
|
// (undocumented)
|
|
requestTimeoutMs?: number;
|
|
}
|
|
|
|
// @public
|
|
export interface ResponseShape {
|
|
// (undocumented)
|
|
body: string;
|
|
headers: Record<string, string | string[]>;
|
|
// (undocumented)
|
|
status: number;
|
|
}
|
|
|
|
// @public
|
|
export class Rooms {
|
|
names(): string[];
|
|
room<T = unknown>(name: string): Channel<T>;
|
|
}
|
|
|
|
// @public
|
|
export function Route(prefix: string): ClassDecorator;
|
|
|
|
// @public
|
|
export type RouteDecorator = (path: string, opts?: {
|
|
export?: boolean;
|
|
duplicates?: 'array' | 'last';
|
|
maxBodyBytes?: number;
|
|
maxParts?: number;
|
|
}) => MethodDecorator;
|
|
|
|
// @public
|
|
export interface RouteEntry {
|
|
// (undocumented)
|
|
method: string;
|
|
// (undocumented)
|
|
pattern: string;
|
|
}
|
|
|
|
// @public
|
|
export interface ScopeApi {
|
|
// (undocumented)
|
|
add(node: ScopeNode): void;
|
|
}
|
|
|
|
// @public
|
|
export interface ScopeNode {
|
|
// (undocumented)
|
|
kind: 'step' | 'provider';
|
|
// (undocumented)
|
|
name: string;
|
|
// (undocumented)
|
|
needs: string[];
|
|
// (undocumented)
|
|
provides: string[];
|
|
// (undocumented)
|
|
run: (ctx: any) => any;
|
|
}
|
|
|
|
// @public
|
|
export interface SecurityOptions {
|
|
// (undocumented)
|
|
csp?: string;
|
|
// (undocumented)
|
|
dnsPrefetchControl?: boolean;
|
|
// (undocumented)
|
|
frameOptions?: 'SAMEORIGIN' | 'DENY' | false;
|
|
// (undocumented)
|
|
hsts?: boolean | {
|
|
maxAge?: number;
|
|
includeSubDomains?: boolean;
|
|
preload?: boolean;
|
|
};
|
|
// (undocumented)
|
|
noSniff?: boolean;
|
|
// (undocumented)
|
|
referrerPolicy?: string | false;
|
|
}
|
|
|
|
// @public
|
|
export function setCookie(name: string, value: string, options?: CookieOptions): string;
|
|
|
|
// @public
|
|
export type SocketCtor = new (url: string) => EventfulSocket;
|
|
|
|
// @public
|
|
export const Sse: RouteDecorator;
|
|
|
|
// @public
|
|
export function sse<T>(data: T, fields?: SseFields): SseEvent<T>;
|
|
|
|
// @public
|
|
export const sseEncoder: StreamEncoder;
|
|
|
|
// @public
|
|
export interface SseEvent<T = unknown> extends SseFields {
|
|
// (undocumented)
|
|
readonly [SSE_EVENT]: true;
|
|
// (undocumented)
|
|
data: T;
|
|
}
|
|
|
|
// @public
|
|
export interface SseFields {
|
|
event?: string;
|
|
id?: string;
|
|
retry?: number;
|
|
}
|
|
|
|
// @public
|
|
export interface StandardIssue {
|
|
// (undocumented)
|
|
readonly message: string;
|
|
// (undocumented)
|
|
readonly path?: ReadonlyArray<PropertyKey | {
|
|
readonly key: PropertyKey;
|
|
}>;
|
|
}
|
|
|
|
// @public
|
|
export type StandardResult<T> = {
|
|
readonly value: T;
|
|
readonly issues?: undefined;
|
|
} | {
|
|
readonly issues: ReadonlyArray<StandardIssue>;
|
|
};
|
|
|
|
// @public
|
|
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
// (undocumented)
|
|
readonly '~standard': {
|
|
readonly version: 1;
|
|
readonly vendor: string;
|
|
validate(value: unknown): StandardResult<Output> | Promise<StandardResult<Output>>;
|
|
readonly types?: {
|
|
readonly input: Input;
|
|
readonly output: Output;
|
|
};
|
|
};
|
|
}
|
|
|
|
// @public
|
|
export function Step(opts: {
|
|
provides: string;
|
|
needs?: string[];
|
|
optional?: boolean;
|
|
export?: boolean;
|
|
}): ClassDecorator;
|
|
|
|
// @public
|
|
export type StepFn<In, Out> = (ctx: In) => Out | Promise<Out>;
|
|
|
|
// @public
|
|
export const Stream: RouteDecorator;
|
|
|
|
// @public
|
|
export interface StreamEncoder {
|
|
// (undocumented)
|
|
encode(item: unknown): string | Buffer;
|
|
// (undocumented)
|
|
encodeError(err: unknown): string | Buffer | null;
|
|
// (undocumented)
|
|
headers: Record<string, string>;
|
|
// (undocumented)
|
|
ping?(): string;
|
|
}
|
|
|
|
// @public
|
|
export type TeardownFn = () => void | Promise<void>;
|
|
|
|
// @public
|
|
export interface TlsOptions {
|
|
// (undocumented)
|
|
ca?: Buffer | string;
|
|
// (undocumented)
|
|
cert: Buffer | string;
|
|
// (undocumented)
|
|
key: Buffer | string;
|
|
// (undocumented)
|
|
passphrase?: string;
|
|
}
|
|
|
|
// @public
|
|
export function toDOT(view: GraphView): string;
|
|
|
|
// @public
|
|
export function toMermaid(view: GraphView): string;
|
|
|
|
// @public
|
|
export function Transformer(fn: TransformerFn): MethodDecorator;
|
|
|
|
// @public
|
|
export type TransformerFn = (value: unknown) => {
|
|
status?: number;
|
|
headers?: Record<string, string | string[]>;
|
|
body: string;
|
|
};
|
|
|
|
// @public
|
|
export type Transport = 'buffer' | 'sse' | 'ndjson' | 'negotiate' | 'ws';
|
|
|
|
// @public
|
|
export class TransportMismatchError extends HttpError {
|
|
constructor(transport: string, got: 'stream' | 'value', req?: {
|
|
method?: string;
|
|
url?: string;
|
|
});
|
|
}
|
|
|
|
// @public
|
|
export class Unauthorized extends HttpError {
|
|
constructor(message?: string);
|
|
}
|
|
|
|
// @public
|
|
export const UNMATCHED_ROUTE = "<unmatched>";
|
|
|
|
// @public
|
|
export interface UploadedFile {
|
|
// (undocumented)
|
|
contentType: string;
|
|
// (undocumented)
|
|
data: Buffer;
|
|
// (undocumented)
|
|
filename: string;
|
|
// (undocumented)
|
|
size: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const VALIDATION_ERROR: unique symbol;
|
|
|
|
// @public
|
|
export class ValidationError extends HttpError {
|
|
// (undocumented)
|
|
readonly [VALIDATION_ERROR] = true;
|
|
constructor(issues: StandardIssue[], source: string);
|
|
// (undocumented)
|
|
issues: StandardIssue[];
|
|
// (undocumented)
|
|
source: string;
|
|
}
|
|
|
|
// @public
|
|
export const VERSION = "26.9.0-beta.2";
|
|
|
|
// @public
|
|
export function withConsoleFallback(logger: Logger): Logger;
|
|
|
|
// @public
|
|
export const Ws: RouteDecorator;
|
|
|
|
// @public
|
|
export interface WsRequest {
|
|
// (undocumented)
|
|
headers: Record<string, string | string[] | undefined>;
|
|
// (undocumented)
|
|
ip: string;
|
|
// (undocumented)
|
|
protocol: 'http' | 'https';
|
|
// (undocumented)
|
|
url: string;
|
|
}
|
|
|
|
// @public
|
|
export interface WsSocket {
|
|
// (undocumented)
|
|
readonly abort: AbortSignal;
|
|
// (undocumented)
|
|
close(code?: number, reason?: string): void;
|
|
drained?(): Promise<void>;
|
|
// (undocumented)
|
|
readonly inbound: AsyncIterable<unknown>;
|
|
// (undocumented)
|
|
readonly isOpen: boolean;
|
|
// (undocumented)
|
|
send(data: string): void;
|
|
// (undocumented)
|
|
terminate(): void;
|
|
}
|
|
|
|
// (No @packageDocumentation comment for this package)
|
|
|
|
```
|