oc-fastify-server-adapter 0.1.2 → 0.1.3
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/dist/index.d.ts +7 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type http from 'node:http';
|
|
2
|
+
import { type FastifyInstance } from 'fastify';
|
|
2
3
|
type CookieOptions = {
|
|
3
4
|
domain?: string;
|
|
4
5
|
encode?: (value: string) => string;
|
|
@@ -66,7 +67,7 @@ type OcResponse = {
|
|
|
66
67
|
};
|
|
67
68
|
type OcHandler = (req: OcRequest, res: OcResponse) => void | Promise<void>;
|
|
68
69
|
type ExpressMiddleware = (req: any, res: any, next: (err?: unknown) => void) => void;
|
|
69
|
-
export type HttpServerAdapter = {
|
|
70
|
+
export type HttpServerAdapter<TNative = unknown> = {
|
|
70
71
|
name: string;
|
|
71
72
|
enableBodyParser(opts: {
|
|
72
73
|
limit?: number | string;
|
|
@@ -92,7 +93,7 @@ export type HttpServerAdapter = {
|
|
|
92
93
|
onServerError(cb: (err: Error) => void): void;
|
|
93
94
|
close(cb: (err?: Error) => void): void;
|
|
94
95
|
isListening(): boolean;
|
|
95
|
-
native():
|
|
96
|
+
native(): TNative;
|
|
96
97
|
httpServer(): http.Server;
|
|
97
98
|
};
|
|
98
99
|
export interface FastifyServerAdapterOptions {
|
|
@@ -100,9 +101,10 @@ export interface FastifyServerAdapterOptions {
|
|
|
100
101
|
port?: number | string;
|
|
101
102
|
trustProxy?: boolean | string | string[] | number;
|
|
102
103
|
}
|
|
103
|
-
type
|
|
104
|
-
(options?: unknown): HttpServerAdapter
|
|
105
|
-
readonly __serverAdapterOptions?:
|
|
104
|
+
export type HttpServerAdapterFactory<TOptions = unknown, TNative = unknown> = {
|
|
105
|
+
(options?: unknown): HttpServerAdapter<TNative>;
|
|
106
|
+
readonly __serverAdapterOptions?: TOptions;
|
|
106
107
|
};
|
|
108
|
+
type FastifyServerAdapterFactory = HttpServerAdapterFactory<FastifyServerAdapterOptions | number | string, FastifyInstance>;
|
|
107
109
|
declare const createFastifyAdapter: FastifyServerAdapterFactory;
|
|
108
110
|
export default createFastifyAdapter;
|