-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
66 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
fcabbd1ee53b1c97b89337e657be1e62011eb716 | ||
739aa6efb9c96e31554306b4761349550825fb2e |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import fp from 'fastify-plugin' | ||
import { fastifyPaprPlugin } from './fastify-papr-plugin.js' | ||
export { asCollection, fastifyPaprPlugin } from './fastify-papr-plugin.js' | ||
export * from './simple-doc-failed-validation.js' | ||
export * from './types.js' | ||
|
||
export default fp(fastifyPaprPlugin, { | ||
name: 'fastify-papr-plugin', | ||
fastify: '4.x', | ||
}) | ||
export { fastifyPaprPlugin as default } from './fastify-papr-plugin.js' |
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,41 +1,25 @@ | ||
import type { Db, IndexDescription } from 'mongodb' | ||
import type { BaseSchema, Model, SchemaOptions } from 'papr' | ||
|
||
export type PaprModelItem = { | ||
collectionName: string | ||
collectionSchema: [BaseSchema, SchemaOptions<Partial<BaseSchema>>] | ||
collectionIndexes?: IndexDescription[] | ||
} | ||
|
||
export type ModelRegistrationPair<T> = { | ||
[U in keyof T]: PaprModelItem | ||
} | ||
|
||
export type IndexesRegistrationPair = { | ||
collectionName: string | ||
collectionIndexes: readonly IndexDescription[] | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export type ColModel<T extends BaseSchema = any, U extends SchemaOptions<Partial<T>> = any> = Model<T, U> | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export type FastifyPapr<T extends BaseSchema = any, U extends SchemaOptions<Partial<T>> = any> = Record< | ||
string, | ||
ColModel<T, U> | Record<string, ColModel<T, U>> | ||
Model<T, U> | Record<string, Model<T, U>> | ||
> | ||
|
||
export type PaprDb = Record<string, FastifyPapr> | ||
export type ModelRegistration = { | ||
name: string | ||
schema: [BaseSchema, SchemaOptions<Partial<BaseSchema>>] | ||
indexes?: IndexDescription[] | ||
} | ||
|
||
export type ModelRegistrationPair<T> = { | ||
[U in keyof T]: ModelRegistration | ||
} | ||
|
||
export type FastifyPaprOptions = { | ||
name?: string | ||
db: Db | ||
models: ModelRegistrationPair<FastifyPapr> | ||
disableSchemaReconciliation?: boolean | ||
} | ||
|
||
declare module 'fastify' { | ||
interface FastifyInstance { | ||
papr: FastifyPapr | ||
} | ||
} |
File renamed without changes.
File renamed without changes.