@fastify/auth
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -1,2 +0,3 @@ | ||
import { FastifyPluginCallback, FastifyRequest, FastifyReply, preHandlerHookHandler, FastifyInstance } from 'fastify'; | ||
import { ContextConfigDefault, FastifyInstance, FastifyPluginCallback, FastifyReply, FastifyRequest, FastifySchema, preHandlerHookHandler } from 'fastify'; | ||
import { RouteGenericInterface } from 'fastify/types/route'; | ||
@@ -11,3 +12,3 @@ export type FastifyAuthFunction = ( | ||
declare module 'fastify' { | ||
interface FastifyInstance { | ||
interface FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> { | ||
auth( | ||
@@ -19,3 +20,3 @@ functions: FastifyAuthFunction[], | ||
} | ||
): preHandlerHookHandler; | ||
): preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGenericInterface, ContextConfigDefault, FastifySchema, TypeProvider>; | ||
} | ||
@@ -22,0 +23,0 @@ } |
{ | ||
"name": "@fastify/auth", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Run multiple auth functions in Fastify", | ||
@@ -13,3 +13,3 @@ "repository": { | ||
"clean": "rimraf authdb", | ||
"standard": "standard", | ||
"lint": "standard", | ||
"test": "npm run test:unit && npm run test:typescript", | ||
@@ -36,3 +36,5 @@ "test:ci": "standard && tap -J ./test/*.test.js --coverage-report=lcovonly && npm run test:typescript", | ||
"@fastify/leveldb": "^5.0.1", | ||
"@types/node": "^17.0.32", | ||
"@fastify/type-provider-json-schema-to-ts": "^1.0.0", | ||
"@fastify/type-provider-typebox": "^1.0.0", | ||
"@types/node": "^18.0.0", | ||
"fastify": "^4.0.0-rc.3", | ||
@@ -43,3 +45,3 @@ "pre-commit": "^1.2.2", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.20.0", | ||
"tsd": "^0.21.0", | ||
"typescript": "^4.0.2" | ||
@@ -46,0 +48,0 @@ }, |
import fastify, { FastifyRequest, FastifyReply, preHandlerHookHandler, FastifyInstance } from 'fastify'; | ||
import fastifyAuth from '../auth' | ||
import { expectType } from 'tsd'; | ||
import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox' | ||
import { JsonSchemaToTsProvider } from '@fastify/type-provider-json-schema-to-ts' | ||
@@ -41,1 +43,19 @@ const app = fastify(); | ||
}); | ||
const typebox = fastify().withTypeProvider<TypeBoxTypeProvider>() | ||
typebox.register(fastifyAuth) | ||
typebox.route({ | ||
method: 'GET', | ||
url: '/', | ||
preHandler: typebox.auth([]), | ||
handler: () => {} | ||
}) | ||
const jsonSchemaToTS = fastify().withTypeProvider<JsonSchemaToTsProvider>() | ||
jsonSchemaToTS.register(fastifyAuth) | ||
jsonSchemaToTS.route({ | ||
method: 'GET', | ||
url: '/', | ||
preHandler: jsonSchemaToTS.auth([]), | ||
handler: () => {} | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47742
1458
12