iopa
Version:
API-first, Internet of Things (IoT) stack for Typescript, official implementation of the Internet Open Protocols Alliance (IOPA) reference pattern
81 lines • 3.14 kB
TypeScript
import type { IReplyIopaLegacy, IContextIopa, IReplyIopa, ICookieOptions, HandlerResult } from '@iopa/types';
import { ContextCore } from './context-core';
import IopaMap from './map';
declare const kRequest: unique symbol;
declare const kHeaders: unique symbol;
declare const kIsFinalized: unique symbol;
declare const kResponse: unique symbol;
declare const kStatusCode: unique symbol;
export declare class ContextEdge extends ContextCore<any> implements IContextIopa<any> {
protected [kRequest]: Request;
protected [kHeaders]: Headers;
notFound?: () => Response;
response: IReplyIopa;
cookies?: Record<string, any>;
signedCookies?: Record<string, any>;
secret?: string;
init(): this;
get body(): ReadableStream<Uint8Array> | null;
get headers(): Headers;
get url(): string;
get signal(): AbortSignal;
get bodyUsed(): boolean;
get method(): string;
get 'iopa.Method'(): string;
set 'iopa.Method'(value: string);
get 'iopa.Headers'(): Headers;
set 'iopa.Headers'(headers: Headers);
get 'iopa.RawRequest'(): Request;
set 'iopa.RawRequest'(request: Request);
get 'iopa.RawRequestClone'(): Request;
set 'iopa.RawRequestClone'(request: Request);
param(): Record<string, string>;
param(key: string): string | undefined;
query(): Record<string, string>;
query(key: string): string | undefined;
blob(): Promise<Blob>;
arrayBuffer(): Promise<ArrayBuffer>;
text(): Promise<string>;
json(): Promise<any>;
formData(): Promise<FormData>;
redirect(location: any, code?: number): this;
respondWith(res: HandlerResult, options?: number | {
status?: number;
headers?: Record<string, string>;
}): this;
}
export declare class ContextReply extends IopaMap<IReplyIopaLegacy> implements IReplyIopa {
protected [kHeaders]: Headers;
protected [kStatusCode]: number;
'iopa.Version': string;
protected [kResponse]: Response | PromiseLike<Response>;
protected [kIsFinalized]: boolean;
get 'iopa.StatusCode'(): number;
set 'iopa.StatusCode'(value: number);
get headers(): Headers;
get redirected(): boolean;
get ok(): boolean;
get statusText(): string;
get 'iopa.Headers'(): Headers;
set 'iopa.Headers'(headers: Headers);
get 'iopa.IsFinalized'(): boolean;
get 'iopa.RawResponse'(): Response | PromiseLike<Response>;
get 'iopa.RawResponseClone'(): Response | PromiseLike<Response>;
init(): this;
status(code: number): this;
header(field: string, value: string): this;
cookie(name: string, value: any, options?: ICookieOptions): this;
clearCookie(name: string, options?: ICookieOptions): this;
arrayBuffer(data: BufferSource): this;
formData(data: FormData | URLSearchParams): this;
blob(data: Blob): this;
json(data: any): this;
text(data: string): this;
html(data: string): this;
respondWith(res: Omit<HandlerResult, 'null' | 'undefined'>, options?: number | {
status?: number;
headers?: Record<string, string>;
}): this;
}
export {};
//# sourceMappingURL=context-edge.d.ts.map