-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove fastify with type implementation (#932)
* Add init changes for fastify dep removal * Add types for fastify to use as replacements * Update package-lock with tldts dependency * Add build files for fastify types * Update some types to resolve conflicts with fastify types * Bump version with some fixes * Add fixes for fastify types and fix example * Keep fastify as a dev dependency for fastify related test * Update lib/ts/framework/fastify/framework.ts Co-authored-by: Mihály Lengyel <mihaly@lengyel.tech> * Update types of fastify instance and plugin * Fix a typo about the Fastify framework name * Update package lock with deps --------- Co-authored-by: Mihály Lengyel <mihaly@lengyel.tech>
- Loading branch information
1 parent
24bbae8
commit 3a9d396
Showing
16 changed files
with
6,943 additions
and
33,871 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
652 changes: 6 additions & 646 deletions
652
examples/fastify/with-emailpassword/frontend/package-lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39,993 changes: 6,816 additions & 33,177 deletions
39,993
examples/fastify/with-emailpassword/package-lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,14 @@ | ||
// @ts-nocheck | ||
/// <reference types="node" /> | ||
export type { SessionRequest } from "./framework"; | ||
export declare const plugin: import("fastify").FastifyPluginCallback< | ||
Record<never, never>, | ||
import("fastify").RawServerDefault | ||
>; | ||
export declare const plugin: import("./types").FastifyPluginCallback<import("./types").FastifyInstance< | ||
unknown, | ||
import("./types").FastifyRequest, | ||
import("./types").FastifyReply | ||
>>; | ||
export declare const errorHandler: () => ( | ||
err: any, | ||
req: import("fastify").FastifyRequest< | ||
import("fastify/types/route").RouteGenericInterface, | ||
import("fastify").RawServerDefault, | ||
import("http").IncomingMessage | ||
>, | ||
res: import("fastify").FastifyReply< | ||
import("fastify").RawServerDefault, | ||
import("http").IncomingMessage, | ||
import("http").ServerResponse<import("http").IncomingMessage>, | ||
import("fastify/types/route").RouteGenericInterface, | ||
unknown | ||
> | ||
req: import("./types").FastifyRequest, | ||
res: import("./types").FastifyReply | ||
) => Promise<void>; | ||
export declare const wrapRequest: (unwrapped: any) => import("..").BaseRequest; | ||
export declare const wrapResponse: (unwrapped: any) => import("..").BaseResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// @ts-nocheck | ||
/** | ||
* Define fastify types based on the parts that are used in the codebase. | ||
*/ | ||
export interface FastifyRequest { | ||
body: any; | ||
query: unknown; | ||
headers: Record<string, string | string[] | undefined>; | ||
method: string; | ||
url: string; | ||
} | ||
export interface FastifyReply { | ||
sent: boolean; | ||
statusCode: number; | ||
getHeaders(): Record<string, number | string | string[] | undefined>; | ||
send(payload?: any): FastifyReply; | ||
header(key: any, value: any): FastifyReply; | ||
removeHeader(key: string): void; | ||
getHeader(key: any): number | string | string[] | undefined; | ||
type(contentType: string): FastifyReply; | ||
} | ||
export interface FastifyInstance< | ||
Instance = unknown, | ||
Request extends FastifyRequest = FastifyRequest, | ||
Reply extends FastifyReply = FastifyReply | ||
> { | ||
addHook(this: Instance, name: string, hook: (req: Request, reply: Reply) => void): Instance; | ||
} | ||
export declare type FastifyPluginCallback<Instance = FastifyInstance> = ( | ||
instance: Instance, | ||
opts: unknown, | ||
done: (err?: Error) => void | ||
) => void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"use strict"; | ||
/** | ||
* Define fastify types based on the parts that are used in the codebase. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// @ts-nocheck | ||
import { VerifySessionOptions } from ".."; | ||
import { SessionRequest } from "../../../framework/fastify/framework"; | ||
import { FastifyReply, FastifyRequest as OriginalFastifyRequest } from "fastify"; | ||
import { FastifyReply, FastifyRequest as OriginalFastifyRequest } from "../../../framework/fastify/types"; | ||
export declare function verifySession<TRequest extends OriginalFastifyRequest = OriginalFastifyRequest>( | ||
options?: VerifySessionOptions | ||
): (req: SessionRequest<TRequest>, res: FastifyReply) => Promise<void>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Define fastify types based on the parts that are used in the codebase. | ||
*/ | ||
|
||
export interface FastifyRequest { | ||
body: any; | ||
query: unknown; | ||
headers: Record<string, string | string[] | undefined>; | ||
method: string; | ||
url: string; | ||
} | ||
|
||
export interface FastifyReply { | ||
sent: boolean; | ||
statusCode: number; | ||
getHeaders(): Record<string, number | string | string[] | undefined>; | ||
send(payload?: any): FastifyReply; | ||
header(key: any, value: any): FastifyReply; | ||
removeHeader(key: string): void; | ||
getHeader(key: any): number | string | string[] | undefined; | ||
type(contentType: string): FastifyReply; | ||
} | ||
|
||
export interface FastifyInstance< | ||
Instance = unknown, | ||
Request extends FastifyRequest = FastifyRequest, | ||
Reply extends FastifyReply = FastifyReply | ||
> { | ||
addHook(this: Instance, name: string, hook: (req: Request, reply: Reply) => void): Instance; | ||
} | ||
|
||
export type FastifyPluginCallback<Instance = FastifyInstance> = ( | ||
instance: Instance, | ||
opts: unknown, | ||
done: (err?: Error) => void | ||
) => void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.