-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure + nodenext compatibility (#197)
* restructure * nodenext compatibility * disable package-lock generation * fix
- Loading branch information
Showing
9 changed files
with
79 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
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,2 @@ | ||
files: | ||
- 'test/**/*.test.js' |
This file was deleted.
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import type { FastifyPluginAsync } from 'fastify'; | ||
import type { Db, MongoClient, MongoClientOptions } from 'mongodb'; | ||
import { ObjectId } from 'mongodb'; | ||
|
||
declare module 'fastify' { | ||
interface FastifyInstance { | ||
mongo: fastifyMongodb.FastifyMongoObject & fastifyMongodb.FastifyMongoNestedObject; | ||
} | ||
} | ||
|
||
type FastifyMongodb = FastifyPluginAsync<fastifyMongodb.FastifyMongodbOptions>; | ||
|
||
declare namespace fastifyMongodb { | ||
|
||
export interface FastifyMongoObject { | ||
/** | ||
* Mongo client instance | ||
*/ | ||
client: MongoClient; | ||
/** | ||
* DB instance | ||
*/ | ||
db?: Db; | ||
/** | ||
* Mongo ObjectId class | ||
*/ | ||
ObjectId: typeof ObjectId; | ||
} | ||
|
||
export interface FastifyMongoNestedObject { | ||
[name: string]: FastifyMongoObject; | ||
} | ||
|
||
export interface FastifyMongodbOptions extends MongoClientOptions { | ||
/** | ||
* Force to close the mongodb connection when app stopped | ||
* @default false | ||
*/ | ||
forceClose?: boolean; | ||
/** | ||
* Database name to connect | ||
*/ | ||
database?: string; | ||
name?: string; | ||
/** | ||
* Pre-configured instance of MongoClient | ||
*/ | ||
client?: MongoClient; | ||
/** | ||
* Connection url | ||
*/ | ||
url?: string; | ||
} | ||
|
||
export { ObjectId } | ||
|
||
export const fastifyMongodb: FastifyMongodb | ||
export { fastifyMongodb as default } | ||
} | ||
|
||
declare function fastifyMongodb(...params: Parameters<FastifyMongodb>): ReturnType<FastifyMongodb> | ||
export = fastifyMongodb |
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