@rhythmjs/router 0.0.10 → 0.0.12

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.
@@ -1,14 +0,0 @@
1
- import { t as RhythmHttpContext } from "./context-ChHlG-q0.js";
2
- import { ErrorHandler, ServerRuntimeContext } from "srvx";
3
- import { Rhythm } from "@rhythmjs/rhythm";
4
- //#region src/adapters/base.d.ts
5
- interface WebSocketUpgrader {
6
- handleUpgrade(request: Request, ...extra: unknown[]): Response | undefined | Promise<Response | undefined>;
7
- }
8
- interface AdapterOptions {
9
- onError?: ErrorHandler;
10
- websocket?: WebSocketUpgrader;
11
- }
12
- type FetchAdapter<TExtra extends unknown[] = []> = <TContext extends RhythmHttpContext, TProviders extends object = {}>(app: Rhythm<RhythmHttpContext, TContext, TProviders>, options?: AdapterOptions) => (request: Request, ...extra: TExtra) => Promise<Response>;
13
- //#endregion
14
- export { FetchAdapter as n, AdapterOptions as t };
@@ -1,24 +0,0 @@
1
- import { ServerRuntimeContext } from "srvx";
2
- //#region src/context.d.ts
3
- type RhythmRuntime = ServerRuntimeContext;
4
- declare function getRuntime(request: Request): RhythmRuntime | undefined;
5
- type RhythmResponseBody = string | ArrayBuffer | Uint8Array | Blob | FormData | URLSearchParams | ReadableStream<Uint8Array> | null;
6
- declare class RhythmResponse {
7
- status: number;
8
- statusText: string | undefined;
9
- headers: Headers;
10
- body: RhythmResponseBody;
11
- }
12
- interface RhythmHttpContext {
13
- readonly request: Request;
14
- readonly response: RhythmResponse;
15
- json(data: unknown, status?: number): void;
16
- text(body: string, status?: number): void;
17
- html(body: string, status?: number): void;
18
- error(status: number, message?: string): void;
19
- redirect(url: string, status?: number): void;
20
- }
21
- declare function createHttpContext(request: Request): RhythmHttpContext;
22
- declare function toResponse(response: RhythmResponse): Response;
23
- //#endregion
24
- export { createHttpContext as a, RhythmRuntime as i, RhythmResponse as n, getRuntime as o, RhythmResponseBody as r, toResponse as s, RhythmHttpContext as t };