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.
Files changed (2) hide show
  1. package/dist/index.d.ts +7 -5
  2. 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(): unknown;
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 FastifyServerAdapterFactory = {
104
- (options?: unknown): HttpServerAdapter;
105
- readonly __serverAdapterOptions?: FastifyServerAdapterOptions | number | string;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-fastify-server-adapter",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Fastify HTTP server adapter for OC",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",