qhttpx 1.8.11 → 1.9.0
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.
- package/package.json +12 -3
- package/prebuilds/darwin-arm64/qhttpx.node +0 -0
- package/prebuilds/linux-x64/qhttpx.node +0 -0
- package/prebuilds/win32-x64/qhttpx.node +0 -0
- package/src/native/index.ts +104 -24
- package/src/native/picohttpparser.h +5 -0
- package/src/native/server.cc +2 -0
- package/dist/examples/api-server.d.ts +0 -1
- package/dist/examples/api-server.js +0 -77
- package/dist/examples/basic.d.ts +0 -1
- package/dist/examples/basic.js +0 -10
- package/dist/examples/compression.d.ts +0 -1
- package/dist/examples/compression.js +0 -17
- package/dist/examples/cors.d.ts +0 -1
- package/dist/examples/cors.js +0 -19
- package/dist/examples/errors.d.ts +0 -1
- package/dist/examples/errors.js +0 -25
- package/dist/examples/file-upload.d.ts +0 -1
- package/dist/examples/file-upload.js +0 -24
- package/dist/examples/fusion.d.ts +0 -1
- package/dist/examples/fusion.js +0 -21
- package/dist/examples/rate-limiting.d.ts +0 -1
- package/dist/examples/rate-limiting.js +0 -17
- package/dist/examples/validation.d.ts +0 -1
- package/dist/examples/validation.js +0 -23
- package/dist/examples/websockets.d.ts +0 -1
- package/dist/examples/websockets.js +0 -20
- package/dist/package.json +0 -101
- package/dist/src/benchmarks/quantam-users.d.ts +0 -1
- package/dist/src/benchmarks/quantam-users.js +0 -56
- package/dist/src/benchmarks/simple-json.d.ts +0 -1
- package/dist/src/benchmarks/simple-json.js +0 -60
- package/dist/src/benchmarks/ultra-mode.d.ts +0 -1
- package/dist/src/benchmarks/ultra-mode.js +0 -94
- package/dist/src/cli/index.d.ts +0 -2
- package/dist/src/cli/index.js +0 -222
- package/dist/src/client/index.d.ts +0 -17
- package/dist/src/client/index.js +0 -72
- package/dist/src/core/batch.d.ts +0 -24
- package/dist/src/core/batch.js +0 -97
- package/dist/src/core/body-parser.d.ts +0 -15
- package/dist/src/core/body-parser.js +0 -121
- package/dist/src/core/buffer-pool.d.ts +0 -41
- package/dist/src/core/buffer-pool.js +0 -70
- package/dist/src/core/config.d.ts +0 -7
- package/dist/src/core/config.js +0 -50
- package/dist/src/core/errors.d.ts +0 -34
- package/dist/src/core/errors.js +0 -70
- package/dist/src/core/fusion.d.ts +0 -14
- package/dist/src/core/fusion.js +0 -183
- package/dist/src/core/logger.d.ts +0 -22
- package/dist/src/core/logger.js +0 -49
- package/dist/src/core/metrics.d.ts +0 -45
- package/dist/src/core/metrics.js +0 -111
- package/dist/src/core/native-adapter.d.ts +0 -11
- package/dist/src/core/native-adapter.js +0 -211
- package/dist/src/core/resources.d.ts +0 -9
- package/dist/src/core/resources.js +0 -25
- package/dist/src/core/scheduler.d.ts +0 -34
- package/dist/src/core/scheduler.js +0 -85
- package/dist/src/core/scope.d.ts +0 -26
- package/dist/src/core/scope.js +0 -68
- package/dist/src/core/serializer.d.ts +0 -10
- package/dist/src/core/serializer.js +0 -44
- package/dist/src/core/server.d.ts +0 -138
- package/dist/src/core/server.js +0 -1082
- package/dist/src/core/stream.d.ts +0 -15
- package/dist/src/core/stream.js +0 -71
- package/dist/src/core/tasks.d.ts +0 -29
- package/dist/src/core/tasks.js +0 -87
- package/dist/src/core/types.d.ts +0 -173
- package/dist/src/core/types.js +0 -19
- package/dist/src/core/websocket.d.ts +0 -25
- package/dist/src/core/websocket.js +0 -86
- package/dist/src/core/worker-queue.d.ts +0 -41
- package/dist/src/core/worker-queue.js +0 -73
- package/dist/src/database/adapters/memory.d.ts +0 -21
- package/dist/src/database/adapters/memory.js +0 -90
- package/dist/src/database/adapters/mongo.d.ts +0 -11
- package/dist/src/database/adapters/mongo.js +0 -141
- package/dist/src/database/adapters/postgres.d.ts +0 -10
- package/dist/src/database/adapters/postgres.js +0 -111
- package/dist/src/database/adapters/sqlite.d.ts +0 -10
- package/dist/src/database/adapters/sqlite.js +0 -42
- package/dist/src/database/coalescer.d.ts +0 -14
- package/dist/src/database/coalescer.js +0 -134
- package/dist/src/database/manager.d.ts +0 -35
- package/dist/src/database/manager.js +0 -87
- package/dist/src/database/types.d.ts +0 -20
- package/dist/src/database/types.js +0 -2
- package/dist/src/index.d.ts +0 -50
- package/dist/src/index.js +0 -91
- package/dist/src/middleware/compression.d.ts +0 -2
- package/dist/src/middleware/compression.js +0 -133
- package/dist/src/middleware/cors.d.ts +0 -2
- package/dist/src/middleware/cors.js +0 -66
- package/dist/src/middleware/presets.d.ts +0 -16
- package/dist/src/middleware/presets.js +0 -52
- package/dist/src/middleware/rate-limit.d.ts +0 -14
- package/dist/src/middleware/rate-limit.js +0 -83
- package/dist/src/middleware/security.d.ts +0 -21
- package/dist/src/middleware/security.js +0 -69
- package/dist/src/middleware/static.d.ts +0 -11
- package/dist/src/middleware/static.js +0 -191
- package/dist/src/native/index.d.ts +0 -29
- package/dist/src/native/index.js +0 -64
- package/dist/src/openapi/generator.d.ts +0 -19
- package/dist/src/openapi/generator.js +0 -149
- package/dist/src/router/radix-router.d.ts +0 -18
- package/dist/src/router/radix-router.js +0 -89
- package/dist/src/router/radix-tree.d.ts +0 -18
- package/dist/src/router/radix-tree.js +0 -131
- package/dist/src/router/router.d.ts +0 -34
- package/dist/src/router/router.js +0 -186
- package/dist/src/testing/index.d.ts +0 -25
- package/dist/src/testing/index.js +0 -84
- package/dist/src/utils/cookies.d.ts +0 -3
- package/dist/src/utils/cookies.js +0 -59
- package/dist/src/utils/logger.d.ts +0 -12
- package/dist/src/utils/logger.js +0 -45
- package/dist/src/utils/signals.d.ts +0 -6
- package/dist/src/utils/signals.js +0 -31
- package/dist/src/utils/sse.d.ts +0 -6
- package/dist/src/utils/sse.js +0 -32
- package/dist/src/validation/index.d.ts +0 -3
- package/dist/src/validation/index.js +0 -19
- package/dist/src/validation/simple.d.ts +0 -5
- package/dist/src/validation/simple.js +0 -102
- package/dist/src/validation/types.d.ts +0 -32
- package/dist/src/validation/types.js +0 -12
- package/dist/src/validation/zod.d.ts +0 -4
- package/dist/src/validation/zod.js +0 -18
- package/dist/src/views/index.d.ts +0 -1
- package/dist/src/views/index.js +0 -17
- package/dist/src/views/types.d.ts +0 -3
- package/dist/src/views/types.js +0 -2
- package/dist/tests/adapters.test.d.ts +0 -1
- package/dist/tests/adapters.test.js +0 -106
- package/dist/tests/batch.test.d.ts +0 -1
- package/dist/tests/batch.test.js +0 -117
- package/dist/tests/body-parser.test.d.ts +0 -1
- package/dist/tests/body-parser.test.js +0 -52
- package/dist/tests/compression-sse.test.d.ts +0 -1
- package/dist/tests/compression-sse.test.js +0 -87
- package/dist/tests/cookies.test.d.ts +0 -1
- package/dist/tests/cookies.test.js +0 -63
- package/dist/tests/cors.test.d.ts +0 -1
- package/dist/tests/cors.test.js +0 -55
- package/dist/tests/database.test.d.ts +0 -1
- package/dist/tests/database.test.js +0 -80
- package/dist/tests/dx.test.d.ts +0 -1
- package/dist/tests/dx.test.js +0 -114
- package/dist/tests/ecosystem.test.d.ts +0 -1
- package/dist/tests/ecosystem.test.js +0 -133
- package/dist/tests/features.test.d.ts +0 -1
- package/dist/tests/features.test.js +0 -47
- package/dist/tests/fusion.test.d.ts +0 -1
- package/dist/tests/fusion.test.js +0 -92
- package/dist/tests/http-basic.test.d.ts +0 -1
- package/dist/tests/http-basic.test.js +0 -124
- package/dist/tests/logger.test.d.ts +0 -1
- package/dist/tests/logger.test.js +0 -33
- package/dist/tests/middleware.test.d.ts +0 -1
- package/dist/tests/middleware.test.js +0 -109
- package/dist/tests/native-adapter.test.d.ts +0 -1
- package/dist/tests/native-adapter.test.js +0 -71
- package/dist/tests/observability.test.d.ts +0 -1
- package/dist/tests/observability.test.js +0 -59
- package/dist/tests/openapi.test.d.ts +0 -1
- package/dist/tests/openapi.test.js +0 -64
- package/dist/tests/plugin.test.d.ts +0 -1
- package/dist/tests/plugin.test.js +0 -65
- package/dist/tests/plugins.test.d.ts +0 -1
- package/dist/tests/plugins.test.js +0 -71
- package/dist/tests/rate-limit.test.d.ts +0 -1
- package/dist/tests/rate-limit.test.js +0 -77
- package/dist/tests/resources.test.d.ts +0 -1
- package/dist/tests/resources.test.js +0 -47
- package/dist/tests/scheduler.test.d.ts +0 -1
- package/dist/tests/scheduler.test.js +0 -46
- package/dist/tests/schema-routes.test.d.ts +0 -1
- package/dist/tests/schema-routes.test.js +0 -77
- package/dist/tests/security.test.d.ts +0 -1
- package/dist/tests/security.test.js +0 -83
- package/dist/tests/server-db.test.d.ts +0 -1
- package/dist/tests/server-db.test.js +0 -72
- package/dist/tests/smoke.test.d.ts +0 -1
- package/dist/tests/smoke.test.js +0 -10
- package/dist/tests/sqlite-fusion.test.d.ts +0 -1
- package/dist/tests/sqlite-fusion.test.js +0 -92
- package/dist/tests/static.test.d.ts +0 -1
- package/dist/tests/static.test.js +0 -102
- package/dist/tests/stream.test.d.ts +0 -1
- package/dist/tests/stream.test.js +0 -44
- package/dist/tests/task-metrics.test.d.ts +0 -1
- package/dist/tests/task-metrics.test.js +0 -53
- package/dist/tests/tasks.test.d.ts +0 -1
- package/dist/tests/tasks.test.js +0 -62
- package/dist/tests/testing.test.d.ts +0 -1
- package/dist/tests/testing.test.js +0 -47
- package/dist/tests/validation.test.d.ts +0 -1
- package/dist/tests/validation.test.js +0 -107
- package/dist/tests/websocket.test.d.ts +0 -1
- package/dist/tests/websocket.test.js +0 -146
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -9
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import http, { IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';
|
|
2
|
-
import { URL } from 'url';
|
|
3
|
-
import { WebSocketManager } from './websocket';
|
|
4
|
-
import { Validator } from '../validation/types';
|
|
5
|
-
import { OpenAPIOptions } from '../openapi/generator';
|
|
6
|
-
import { HTTPMethod, QHTTPXContext, QHTTPXErrorHandler, QHTTPXHandler, QHTTPXMethodNotAllowedHandler, QHTTPXMiddleware, QHTTPXNotFoundHandler, QHTTPXOptions, QHTTPXRouteOptions, QHTTPXPlugin, QHTTPXPluginOptions, CookieOptions, QHTTPXFile } from './types';
|
|
7
|
-
import { Logger } from './logger';
|
|
8
|
-
export declare class QHTTPXContextImpl implements QHTTPXContext {
|
|
9
|
-
req: IncomingMessage;
|
|
10
|
-
res: ServerResponse;
|
|
11
|
-
headers: IncomingHttpHeaders;
|
|
12
|
-
method: HTTPMethod;
|
|
13
|
-
params: Record<string, string>;
|
|
14
|
-
query: Record<string, string | string[]>;
|
|
15
|
-
body: unknown;
|
|
16
|
-
files?: Record<string, QHTTPXFile | QHTTPXFile[]>;
|
|
17
|
-
cookies: Record<string, string>;
|
|
18
|
-
private _state;
|
|
19
|
-
requestId: string | undefined;
|
|
20
|
-
requestStart: number | undefined;
|
|
21
|
-
serializer?: (value: unknown) => string;
|
|
22
|
-
disableAutoEnd?: boolean;
|
|
23
|
-
path: string;
|
|
24
|
-
error?: Error;
|
|
25
|
-
next?: () => Promise<void>;
|
|
26
|
-
private _url;
|
|
27
|
-
private _ip;
|
|
28
|
-
private _app;
|
|
29
|
-
private _appJsonSerializer;
|
|
30
|
-
constructor(app: QHTTPX);
|
|
31
|
-
get bufferPool(): any;
|
|
32
|
-
get db(): any;
|
|
33
|
-
get state(): Record<string, unknown>;
|
|
34
|
-
set state(v: Record<string, unknown>);
|
|
35
|
-
get ip(): string;
|
|
36
|
-
set ip(v: string);
|
|
37
|
-
get url(): URL;
|
|
38
|
-
set url(v: URL);
|
|
39
|
-
json(payload: unknown, status?: number): void;
|
|
40
|
-
send(payload: string | Buffer, status?: number): void;
|
|
41
|
-
html(payload: string, status?: number): void;
|
|
42
|
-
redirect(url: string, status?: number): void;
|
|
43
|
-
setCookie(name: string, value: string, options: CookieOptions | undefined): void;
|
|
44
|
-
render(view: string, locals?: Record<string, unknown>): Promise<void>;
|
|
45
|
-
validate<T>(schema: unknown, data?: unknown): Promise<T>;
|
|
46
|
-
reset(): void;
|
|
47
|
-
}
|
|
48
|
-
export declare class QHTTPX {
|
|
49
|
-
private static readonly EMPTY_PARAMS;
|
|
50
|
-
private static readonly EMPTY_MATCH;
|
|
51
|
-
private readonly options;
|
|
52
|
-
private readonly server;
|
|
53
|
-
readonly logger: Logger;
|
|
54
|
-
private readonly router;
|
|
55
|
-
private readonly scheduler;
|
|
56
|
-
private readonly middlewares;
|
|
57
|
-
private readonly workerCount;
|
|
58
|
-
private readonly tasks;
|
|
59
|
-
private readonly metrics;
|
|
60
|
-
private readonly contextPool;
|
|
61
|
-
private readonly bufferPool;
|
|
62
|
-
private pipelineRunner;
|
|
63
|
-
private errorHandler?;
|
|
64
|
-
private notFoundHandler?;
|
|
65
|
-
private methodNotAllowedHandler?;
|
|
66
|
-
private readonly tracer?;
|
|
67
|
-
private readonly onStartHooks;
|
|
68
|
-
private readonly onBeforeShutdownHooks;
|
|
69
|
-
private readonly onShutdownHooks;
|
|
70
|
-
private nextRequestId;
|
|
71
|
-
private requestCounter;
|
|
72
|
-
private readonly wsManager;
|
|
73
|
-
private readonly ultraMode;
|
|
74
|
-
private readonly batchExecutor?;
|
|
75
|
-
private readonly fusion?;
|
|
76
|
-
readonly validator: Validator;
|
|
77
|
-
private readonly poolLimit;
|
|
78
|
-
constructor(options?: QHTTPXOptions);
|
|
79
|
-
get serverInstance(): http.Server;
|
|
80
|
-
get websocket(): WebSocketManager;
|
|
81
|
-
setErrorHandler(handler: QHTTPXErrorHandler): void;
|
|
82
|
-
setNotFoundHandler(handler: QHTTPXNotFoundHandler): void;
|
|
83
|
-
setMethodNotAllowedHandler(handler: QHTTPXMethodNotAllowedHandler): void;
|
|
84
|
-
set404Handler(handler: QHTTPXNotFoundHandler): void;
|
|
85
|
-
set405Handler(handler: QHTTPXMethodNotAllowedHandler): void;
|
|
86
|
-
/**
|
|
87
|
-
* Alias for setErrorHandler
|
|
88
|
-
*/
|
|
89
|
-
onError(handler: QHTTPXErrorHandler): void;
|
|
90
|
-
/**
|
|
91
|
-
* Alias for setNotFoundHandler
|
|
92
|
-
*/
|
|
93
|
-
notFound(handler: QHTTPXNotFoundHandler): void;
|
|
94
|
-
onStart(hook: () => void | Promise<void>): void;
|
|
95
|
-
onBeforeShutdown(hook: () => void | Promise<void>): void;
|
|
96
|
-
onShutdown(hook: () => void | Promise<void>): void;
|
|
97
|
-
upgrade(path: string, handler: import('./websocket').WSHandler): void;
|
|
98
|
-
use(middleware: QHTTPXMiddleware): void;
|
|
99
|
-
private compileMiddlewarePipeline;
|
|
100
|
-
private compileRoutePipeline;
|
|
101
|
-
_registerRoute(method: HTTPMethod, path: string, handlerOrOptions: QHTTPXHandler | QHTTPXRouteOptions): void;
|
|
102
|
-
register<Options extends QHTTPXPluginOptions>(plugin: QHTTPXPlugin<Options>, options?: Options): Promise<void>;
|
|
103
|
-
private registerRoute;
|
|
104
|
-
get(path: string, handler: QHTTPXHandler | QHTTPXRouteOptions): void;
|
|
105
|
-
get(path: string, config: import('./types').QHTTPXRouteConfig, handler: QHTTPXHandler): void;
|
|
106
|
-
post(path: string, handler: QHTTPXHandler | QHTTPXRouteOptions): void;
|
|
107
|
-
post(path: string, config: import('./types').QHTTPXRouteConfig, handler: QHTTPXHandler): void;
|
|
108
|
-
put(path: string, handler: QHTTPXHandler | QHTTPXRouteOptions): void;
|
|
109
|
-
put(path: string, config: import('./types').QHTTPXRouteConfig, handler: QHTTPXHandler): void;
|
|
110
|
-
delete(path: string, handler: QHTTPXHandler | QHTTPXRouteOptions): void;
|
|
111
|
-
delete(path: string, config: import('./types').QHTTPXRouteConfig, handler: QHTTPXHandler): void;
|
|
112
|
-
route(path: string): {
|
|
113
|
-
get(handler: QHTTPXHandler | QHTTPXRouteOptions): /*elided*/ any;
|
|
114
|
-
post(handler: QHTTPXHandler | QHTTPXRouteOptions): /*elided*/ any;
|
|
115
|
-
put(handler: QHTTPXHandler | QHTTPXRouteOptions): /*elided*/ any;
|
|
116
|
-
delete(handler: QHTTPXHandler | QHTTPXRouteOptions): /*elided*/ any;
|
|
117
|
-
};
|
|
118
|
-
task(name: string, handler: import('./types').QHTTPXTaskHandler, options?: import('./types').QHTTPXTaskOptions): void;
|
|
119
|
-
enqueue(name: string, payload: unknown): Promise<void>;
|
|
120
|
-
op(name: string, handler: import('./types').QHTTPXOpHandler): void;
|
|
121
|
-
private registerInternalRoutes;
|
|
122
|
-
getOpenAPI(options: OpenAPIOptions): object;
|
|
123
|
-
listen(port: number, hostnameOrCallback?: string | (() => void), callback?: () => void): Promise<{
|
|
124
|
-
port: number;
|
|
125
|
-
}>;
|
|
126
|
-
close(): Promise<void>;
|
|
127
|
-
shutdown(): Promise<void>;
|
|
128
|
-
private createContext;
|
|
129
|
-
private acquireContext;
|
|
130
|
-
private releaseContext;
|
|
131
|
-
private handleNoMatch;
|
|
132
|
-
handleRequest(req: IncomingMessage, res: ServerResponse): void;
|
|
133
|
-
private dispatch;
|
|
134
|
-
private handleUpgrade;
|
|
135
|
-
private runLifecycleHooks;
|
|
136
|
-
private handleError;
|
|
137
|
-
private generateRequestId;
|
|
138
|
-
}
|