fastify-decorators
Advanced tools
Comparing version 2.0.0 to 3.0.0-0
@@ -13,2 +13,2 @@ /** | ||
*/ | ||
export declare function bootstrap(fastify: FastifyInstance, config: BootstrapConfig): Promise<void>; | ||
export declare function bootstrap(fastify: FastifyInstance<any, any, any, any>, config: BootstrapConfig): Promise<void>; |
@@ -66,2 +66,2 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vdHN0cmFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL2Jvb3RzdHJhcC9ib290c3RyYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7O0FBR0gseUJBQXlCO0FBQ3pCLCtCQUE0QjtBQUM1QiwrQkFBaUM7QUFHakMseURBQXNEO0FBQ3RELHdDQUEyRDtBQUMzRCw4REFBMEQ7QUFFMUQsTUFBTSxPQUFPLEdBQUcsZ0JBQVMsQ0FBQyxFQUFFLENBQUMsT0FBTyxDQUFDLENBQUM7QUFFdEMsTUFBTSxXQUFXLEdBQUcsMEJBQTBCLENBQUM7QUFFL0M7O0dBRUc7QUFDSSxLQUFLLFVBQVUsU0FBUyxDQUFDLE9BQXdCLEVBQUUsTUFBdUI7SUFDN0UseUJBQVcsQ0FBQyxHQUFHLENBQUMsOEJBQW9CLEVBQUUsZ0NBQWMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO0lBRS9ELElBQUksV0FBVyxJQUFJLE1BQU07UUFBRSxNQUFNLGVBQWUsQ0FBQyxNQUF3QixFQUFFLE9BQU8sQ0FBQyxDQUFDO0lBQ3BGLElBQUksYUFBYSxJQUFJLE1BQU07UUFBRSxlQUFlLENBQUMsTUFBK0IsRUFBRSxPQUFPLENBQUMsQ0FBQztBQUMzRixDQUFDO0FBTEQsOEJBS0M7QUFFRCxTQUFTLGVBQWUsQ0FBQyxNQUE2QixFQ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2R1bGU6IHN0cmluZyk6IEluamVjdGFibGVDbGFzcyB7XG4gICAgcmV0dXJuIHJlcXVpcmUobW9kdWxlKS5fX2VzTW9kdWxlXG4gICAgICAgID8gcmVxdWlyZShtb2R1bGUpLmRlZmF1bHRcbiAgICAgICAgOiByZXF1aXJlKG1vZHVsZSk7XG59XG4iXX0= |
@@ -8,3 +8,9 @@ # Changelog | ||
## [Unreleased] | ||
## [3.0.0-0] | ||
## Added | ||
- `@ErrorHandler` decorator for error handling within controllers | ||
## Changed | ||
- *BREAKING*: move to Fastify 3 | ||
## [2.0.0] | ||
@@ -65,3 +71,4 @@ ### Added | ||
[Unreleased]: https://github.com/L2jLiga/fastify-decorators/compare/v2.0.0...HEAD | ||
[Unreleased]: https://github.com/L2jLiga/fastify-decorators/compare/v3.0.0-0...HEAD | ||
[3.0.0-0]: https://github.com/L2jLiga/fastify-decorators/compare/v2.0.0...v3.0.0-0 | ||
[2.0.0]: https://github.com/L2jLiga/fastify-decorators/compare/v1.3.0...v2.0.0 | ||
@@ -68,0 +75,0 @@ [1.3.0]: https://github.com/L2jLiga/fastify-decorators/compare/v1.2.0...v1.3.0 |
@@ -33,2 +33,2 @@ "use strict"; | ||
exports.Controller = Controller; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJvbGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9kZWNvcmF0b3JzL2NvbnRyb2xsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7O0FBR0gsMENBQTZDO0FBQzdDLHlEQUFzRDtBQUN0RCx3Q0FBa0Q7QUFDbEQsbUZBQXFGO0FBQ3JGLGtFQUF3RTtBQUV4RSxTQUFTLFVBQVUsQ0FBQyxNQUFrQztJQUNsRCxJQUFJLE9BQU8sTUFBTSxLQUFLLFFBQVE7UUFBRSxNQUFNLEdBQ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ltcG9ydCB7IENSRUFUT1IgfSBmcm9tICcuLi8uLi9zeW1ib2xzJztcblxuZXhwb3J0IGZ1bmN0aW9uIGluamVjdERlZmF1bHRDb250cm9sbGVyT3B0aW9ucyhjb250cm9sbGVyOiBhbnkpOiB2b2lkIHtcbiAgICBpZiAoISg8Q29udHJvbGxlckNvbnN0cnVjdG9yPmNvbnRyb2xsZXIpW0NSRUFUT1JdKSB7XG4gICAgICAgICg8Q29udHJvbGxlckNvbnN0cnVjdG9yPmNvbnRyb2xsZXIpW0NSRUFUT1JdID0gZ2V0RGVmYXVsdENvbnRyb2xsZXJPcHRpb25zKCk7XG4gICAgfVxufVxuXG5mdW5jdGlvbiBnZXREZWZhdWx0Q29udHJvbGxlck9wdGlvbnMoKTogQ29udHJvbGxlckhhbmRsZXJzQW5kSG9va3M8U2VydmVyLCBJbmNvbWluZ01lc3NhZ2UsIFNlcnZlclJlc3BvbnNlPiB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgaGFuZGxlcnM6IFtdLFxuICAgICAgICBlcnJvckhhbmRsZXJzOiBbXSxcbiAgICAgICAgaG9va3M6IFtdLFxuICAgIH07XG59XG4iXX0= |
@@ -12,3 +12,3 @@ /** | ||
import { HttpMethods } from './http-methods'; | ||
export declare function requestDecoratorsFactory(method: HttpMethods): (routeOrConfig?: string | RouteConfig | undefined, options?: RouteShorthandOptions<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify").DefaultQuery, import("fastify").DefaultParams, import("fastify").DefaultHeaders, any> | undefined) => (target: any, propKey?: string | symbol | undefined) => void; | ||
export declare function requestDecoratorsFactory(method: HttpMethods): (routeOrConfig?: string | RouteConfig | undefined, options?: RouteShorthandOptions<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify").RequestGenericInterface, unknown> | undefined) => (target: any, propKey?: string | symbol | undefined) => void; | ||
export declare function controllerMethodDecoratorsFactory(method: HttpMethods, config: RouteConfig, target: any, propKey: string | symbol): void; |
@@ -11,3 +11,4 @@ /** | ||
export { Hook } from './hook'; | ||
export { ErrorHandler } from './error-handler'; | ||
export { Controller } from './controller'; | ||
export { ALL, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT } from './request-handlers'; |
@@ -16,2 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "Hook", { enumerable: true, get: function () { return hook_1.Hook; } }); | ||
var error_handler_1 = require("./error-handler"); | ||
Object.defineProperty(exports, "ErrorHandler", { enumerable: true, get: function () { return error_handler_1.ErrorHandler; } }); | ||
var controller_1 = require("./controller"); | ||
@@ -28,2 +30,2 @@ Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return controller_1.Controller; } }); | ||
Object.defineProperty(exports, "PUT", { enumerable: true, get: function () { return request_handlers_1.PUT; } }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWIvZGVjb3JhdG9ycy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOztBQUVILHFDQUFvQztBQUEzQixrR0FBQSxPQUFPLE9BQUE7QUFDaEIsbUNBQWtDO0FBQXpCLGdHQUFBLE1BQU0sT0FBQTtBQUNmLCtCQUE4QjtBQUFyQiw0RkFBQSxJQUFJLE9BQUE7QUFFYiwyQ0FBMEM7QUFBakMsd0dBQUEsVUFBVSxPQUFBO0FBRW5CLHVEQUF1RjtBQUE5RSx1R0FBQSxHQUFHLE9BQUE7QUFBRSwwR0FBQSxNQUFNLE9BQUE7QUFBRSx1R0FBQSxHQUFHLE9BQUE7QUFBRSx3R0FBQSxJQUFJLE9BQUE7QUFBRSwyR0FBQSxPQUFPLE9BQUE7QUFBRSx5R0FBQSxLQUFLLE9BQUE7QUFBRSx3R0FBQSxJQUFJLE9BQUE7QUFBRSx1R0FBQSxHQUFHLE9BQUEiLCJzb3VyY2VzQ29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REVMRVRFLCBHRVQsIEhFQUQsIE9QVElPTlMsIFBBVENILCBQT1NULCBQVVQgfSBmcm9tICcuL3JlcXVlc3QtaGFuZGxlcnMnO1xuIl19 |
@@ -23,4 +23,4 @@ /** | ||
export declare const ControllerTypeStrategies: { | ||
readonly 0: (instance: FastifyInstance, constructor: ControllerConstructor, injectablesMap: Map<any, any>, cacheResult: boolean) => void; | ||
readonly 1: (instance: FastifyInstance, constructor: ControllerConstructor, injectablesMap: Map<any, any>, cacheResult: boolean) => void; | ||
readonly 0: (instance: FastifyInstance<any, any, any, any>, constructor: ControllerConstructor, injectablesMap: Map<any, any>, cacheResult: boolean) => void; | ||
readonly 1: (instance: FastifyInstance<any, any, any, any>, constructor: ControllerConstructor, injectablesMap: Map<any, any>, cacheResult: boolean) => void; | ||
}; |
@@ -29,10 +29,5 @@ "use strict"; | ||
const configuration = constructor[symbols_1.CREATOR]; | ||
configuration.handlers.forEach(handler => { | ||
instance[handler.method](handler.url, handler.options, function (...args) { | ||
return controllerInstance[handler.handlerMethod](...args); | ||
}); | ||
}); | ||
configuration.hooks.forEach(hook => { | ||
instance.addHook(hook.name, controllerInstance[hook.handlerName].bind(controllerInstance)); | ||
}); | ||
registerHandlers(configuration.handlers, instance, controllerInstance); | ||
registerErrorHandlers(configuration.errorHandlers, instance, controllerInstance); | ||
registerHooks(configuration.hooks, instance, controllerInstance); | ||
}, | ||
@@ -47,4 +42,34 @@ [registry_1.ControllerType.REQUEST](instance, constructor, injectablesMap, cacheResult) { | ||
}); | ||
} | ||
}, | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJvbGxlci10eXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGliL2RlY29yYXRvcnMvc3RyYXRlZ2llcy9jb250cm9sbGVyLXR5cGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs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RsZXIgPT4ge1xuICAgICAgICAgICAgY29uc3QgeyB1cmwsIG1ldGhvZCwgaGFuZGxlck1ldGhvZCwgb3B0aW9ucyB9ID0gaGFuZGxlcjtcblxuICAgICAgICAgICAgaW5zdGFuY2VbbWV0aG9kXSh1cmwsIG9wdGlvbnMsIGZ1bmN0aW9uICguLi5hcmdzKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGNyZWF0ZVdpdGhJbmplY3RlZERlcGVuZGVuY2llcyhjb25zdHJ1Y3RvciwgaW5qZWN0YWJsZXNNYXAsIGNhY2hlUmVzdWx0KVtoYW5kbGVyTWV0aG9kXSguLi5hcmdzKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG59IGFzIGNvbnN0O1xuIl19 | ||
function registerHandlers(handlers, instance, controllerInstance) { | ||
handlers.forEach(handler => { | ||
instance[handler.method](handler.url, handler.options, function (...args) { | ||
return controllerInstance[handler.handlerMethod](...args); | ||
}); | ||
}); | ||
} | ||
function registerHooks(hooks, instance, controllerInstance) { | ||
hooks.forEach(hook => { | ||
instance.addHook(hook.name, controllerInstance[hook.handlerName].bind(controllerInstance)); | ||
}); | ||
} | ||
function registerErrorHandlers(errorHandlers, instance, controllerInstance) { | ||
instance.setErrorHandler(async (error, request, reply) => { | ||
let err = error; | ||
for (const handler of errorHandlers) { | ||
if (handler.accepts(error)) { | ||
try { | ||
await controllerInstance[handler.handlerName](err, request, reply); | ||
err = null; | ||
return; | ||
} | ||
catch (e) { | ||
err = e; | ||
} | ||
} | ||
} | ||
throw err; | ||
}); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJvbGxlci10eXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGliL2RlY29yYXRvcnMvc3RyYXRlZ2llcy9jb250cm9sbGVyLXR5cGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5nc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RsZXJOYW1lXS5iaW5kKGNvbnRyb2xsZXJJbnN0YW5jZSkpO1xuICAgIH0pO1xufVxuXG5mdW5jdGlvbiByZWdpc3RlckVycm9ySGFuZGxlcnMoZXJyb3JIYW5kbGVyczogRXJyb3JIYW5kbGVyW10sIGluc3RhbmNlOiBGYXN0aWZ5SW5zdGFuY2UsIGNvbnRyb2xsZXJJbnN0YW5jZTogYW55KSB7XG4gICAgaW5zdGFuY2Uuc2V0RXJyb3JIYW5kbGVyKGFzeW5jIChlcnJvciwgcmVxdWVzdCwgcmVwbHkpID0+IHtcbiAgICAgICAgbGV0IGVycjogRXJyb3IgfCBudWxsID0gZXJyb3I7XG4gICAgICAgIGZvciAoY29uc3QgaGFuZGxlciBvZiBlcnJvckhhbmRsZXJzKSB7XG4gICAgICAgICAgICBpZiAoaGFuZGxlci5hY2NlcHRzKGVycm9yKSkge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IGNvbnRyb2xsZXJJbnN0YW5jZVtoYW5kbGVyLmhhbmRsZXJOYW1lXShlcnIsIHJlcXVlc3QsIHJlcGx5KTtcbiAgICAgICAgICAgICAgICAgICAgZXJyID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgZXJyID0gZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB0aHJvdyBlcnI7XG4gICAgfSk7XG59XG4iXX0= |
@@ -243,4 +243,39 @@ <h1 style="text-align: center">Fastify decorators</h1> | ||
### Error handling | ||
`fastify-decorators` also provides abilities to handle error with `@ErrorHandler` decorator. | ||
`@ErrorHandler` may accept error code or type to handle or be empty which means will handle all errors. Let's take a look on example: | ||
```typescript | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { Controller, GET, ErrorHandler } from 'fastify-decorators'; | ||
class TokenNotFoundError extends Error { | ||
} | ||
@Controller('/') | ||
export default class SimpleController { | ||
@GET('/') | ||
async get(request, reply) { | ||
// may throw FS_READ_ERROR | ||
const content = fs.readFileSync(path.join(__dirname, request.query.fileName)); | ||
if (!content.includes('token')) { | ||
throw new TokenNotFoundError('Token not found in file requested') | ||
} | ||
return { message: 'ok' } | ||
} | ||
@ErrorHandler(TokenNotFoundError) | ||
handleTokenNotFound(error: TokenNotFoundError, request, reply) { | ||
reply.status(403).send({ message: 'You have no access' }); | ||
} | ||
} | ||
``` | ||
[Fastify Hooks]: https://github.com/fastify/fastify/blob/master/docs/Hooks.md | ||
[`RouteConfig`]: https://github.com/fastify/fastify/blob/master/docs/Routes.md | ||
[Dependency Injection]: ./Dependency-Injection.md |
@@ -17,2 +17,3 @@ /** | ||
export { Hook } from './decorators'; | ||
export { ErrorHandler } from './decorators'; | ||
export { getInstanceByToken } from './utils'; | ||
@@ -19,0 +20,0 @@ export { FastifyInstanceToken } from './symbols'; |
22
index.js
@@ -24,2 +24,4 @@ "use strict"; | ||
Object.defineProperty(exports, "Hook", { enumerable: true, get: function () { return decorators_4.Hook; } }); | ||
var decorators_5 = require("./decorators"); | ||
Object.defineProperty(exports, "ErrorHandler", { enumerable: true, get: function () { return decorators_5.ErrorHandler; } }); | ||
var utils_1 = require("./utils"); | ||
@@ -29,18 +31,18 @@ Object.defineProperty(exports, "getInstanceByToken", { enumerable: true, get: function () { return utils_1.getInstanceByToken; } }); | ||
Object.defineProperty(exports, "FastifyInstanceToken", { enumerable: true, get: function () { return symbols_1.FastifyInstanceToken; } }); | ||
var decorators_5 = require("./decorators"); | ||
Object.defineProperty(exports, "ALL", { enumerable: true, get: function () { return decorators_5.ALL; } }); | ||
var decorators_6 = require("./decorators"); | ||
Object.defineProperty(exports, "DELETE", { enumerable: true, get: function () { return decorators_6.DELETE; } }); | ||
Object.defineProperty(exports, "ALL", { enumerable: true, get: function () { return decorators_6.ALL; } }); | ||
var decorators_7 = require("./decorators"); | ||
Object.defineProperty(exports, "GET", { enumerable: true, get: function () { return decorators_7.GET; } }); | ||
Object.defineProperty(exports, "DELETE", { enumerable: true, get: function () { return decorators_7.DELETE; } }); | ||
var decorators_8 = require("./decorators"); | ||
Object.defineProperty(exports, "HEAD", { enumerable: true, get: function () { return decorators_8.HEAD; } }); | ||
Object.defineProperty(exports, "GET", { enumerable: true, get: function () { return decorators_8.GET; } }); | ||
var decorators_9 = require("./decorators"); | ||
Object.defineProperty(exports, "OPTIONS", { enumerable: true, get: function () { return decorators_9.OPTIONS; } }); | ||
Object.defineProperty(exports, "HEAD", { enumerable: true, get: function () { return decorators_9.HEAD; } }); | ||
var decorators_10 = require("./decorators"); | ||
Object.defineProperty(exports, "PATCH", { enumerable: true, get: function () { return decorators_10.PATCH; } }); | ||
Object.defineProperty(exports, "OPTIONS", { enumerable: true, get: function () { return decorators_10.OPTIONS; } }); | ||
var decorators_11 = require("./decorators"); | ||
Object.defineProperty(exports, "POST", { enumerable: true, get: function () { return decorators_11.POST; } }); | ||
Object.defineProperty(exports, "PATCH", { enumerable: true, get: function () { return decorators_11.PATCH; } }); | ||
var decorators_12 = require("./decorators"); | ||
Object.defineProperty(exports, "PUT", { enumerable: true, get: function () { return decorators_12.PUT; } }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9saWIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7QUFFSCxtREFBa0Q7QUFBekMsc0dBQUEsU0FBUyxPQUFBO0FBRWxCLDJDQUE4QztBQUFyQyw0R0FBQSxjQUFjLE9BQUE7QUFFdkIsMkNBQTBDO0FBQWpDLHdHQUFBLFVBQVUsT0FBQTtBQUNuQix1Q0FBNEM7QUFBbkMsMEdBQUEsY0FBYyxPQUFBO0FBR3ZCLDJDQUF1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G9ydCB7IFJvdXRlQ29uZmlnIH0gZnJvbSAnLi9pbnRlcmZhY2VzJztcbiJdfQ== | ||
Object.defineProperty(exports, "POST", { enumerable: true, get: function () { return decorators_12.POST; } }); | ||
var decorators_13 = require("./decorators"); | ||
Object.defineProperty(exports, "PUT", { enumerable: true, get: function () { return decorators_13.PUT; } }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9saWIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7QUFFSCxtREFBa0Q7QUFBekMsc0dBQUEsU0FBUyxPQUFBO0FBRWxCLDJDQUE4QztBQUFyQyw0R0FBQSxjQUFjLE9BQUE7QUFFdkIsMkNBQTBDO0FBQWpDLHdHQUFBLFVBQVUsT0FBQTtBQUNuQix1Q0FBNEM7QUFBbkMsMEdBQUEsY0FBYyxPQUFBO0FBR3ZCLDJDQUF1QztBQUE5QixxR0FBQSxPQUFPLE9BQUE7QUFDaEIsMkNBQXNDO0FBQTdCLG9HQUFBLE1BQU0sT0FBQTtBQUNmLDJDQUFvQztBQUEzQixrR0FBQSxJQUFJLE9BQUE7QUFDYiwyQ0FBNEM7QUFBbkMsMEdBQUEsWUFBWSxPQUFBO0FBRXJCLGlDQUE2QztBQUFwQywyR0FBQSxrQkFBa0IsT0FBQTtBQUMzQixxQ0FBaUQ7QUFBeEMsK0dBQUEsb0JBQW9CLE9BQUE7QUFFN0IsMkNBQW1DO0FBQTFCLGlHQUFBLEdBQUcsT0FBQTtBQUNaLDJDQUFzQztBQUE3QixvR0FBQSxNQUFNLE9BQUE7QUFDZiwyQ0FBbUM7QUFBMUIsaUdBQUEsR0FBRyxPQUFBO0FBQ1osMkNBQW9DO0FBQTNCLGtHQUFBLElBQUksT0FBQTtBQUNiLDRDQUF1QztBQUE5QixzR0FBQSx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YXRvcnMnO1xuZXhwb3J0IHsgSG9vayB9IGZyb20gJy4vZGVjb3JhdG9ycyc7XG5leHBvcnQgeyBFcnJvckhhbmRsZXIgfSBmcm9tICcuL2RlY29yYXRvcnMnO1xuXG5leHBvcnQgeyBnZXRJbnN0YW5jZUJ5VG9rZW4gfSBmcm9tICcuL3V0aWxzJztcbmV4cG9ydCB7IEZhc3RpZnlJbnN0YW5jZVRva2VuIH0gZnJvbSAnLi9zeW1ib2xzJztcblxuZXhwb3J0IHsgQUxMIH0gZnJvbSAnLi9kZWNvcmF0b3JzJztcbmV4cG9ydCB7IERFTEVURSB9IGZyb20gJy4vZGVjb3JhdG9ycyc7XG5leHBvcnQgeyBHRVQgfSBmcm9tICcuL2RlY29yYXRvcnMnO1xuZXhwb3J0IHsgSEVBRCB9IGZyb20gJy4vZGVjb3JhdG9ycyc7XG5leHBvcnQgeyBPUFRJT05TIH0gZnJvbSAnLi9kZWNvcmF0b3JzJztcbmV4cG9ydCB7IFBBVENIIH0gZnJvbSAnLi9kZWNvcmF0b3JzJztcbmV4cG9ydCB7IFBPU1QgfSBmcm9tICcuL2RlY29yYXRvcnMnO1xuZXhwb3J0IHsgUFVUIH0gZnJvbSAnLi9kZWNvcmF0b3JzJztcbmV4cG9ydCB7IFJvdXRlQ29uZmlnIH0gZnJvbSAnLi9pbnRlcmZhY2VzJztcbiJdfQ== |
@@ -8,9 +8,7 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import { RegisterOptions } from 'fastify'; | ||
import { IncomingMessage, Server, ServerResponse } from 'http'; | ||
import { FastifyPluginOptions } from 'fastify'; | ||
/** | ||
* Config for application bootstrap | ||
*/ | ||
export interface AutoLoadConfig<HttpServer = Server, HttpRequest = IncomingMessage, HttpResponse = ServerResponse> extends RegisterOptions<HttpServer, HttpRequest, HttpResponse> { | ||
export interface AutoLoadConfig extends FastifyPluginOptions { | ||
/** | ||
@@ -32,3 +30,3 @@ * Path to directory which contains files to load | ||
} | ||
export interface ControllersListConfig<HttpServer = Server, HttpRequest = IncomingMessage, HttpResponse = ServerResponse> extends RegisterOptions<HttpServer, HttpRequest, HttpResponse> { | ||
export interface ControllersListConfig extends FastifyPluginOptions { | ||
/** | ||
@@ -38,3 +36,9 @@ * List of Controller classes to bootstrap | ||
controllers: any[]; | ||
/** | ||
* By default application will fails to bootstrap if one or more of loaded files does not contain valid controller or handler | ||
* This option allows to change this behavior | ||
* @default false | ||
*/ | ||
skipBroken?: boolean; | ||
} | ||
export declare type BootstrapConfig = AutoLoadConfig | ControllersListConfig; |
@@ -10,2 +10,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vdHN0cmFwLWNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9pbnRlcmZhY2VzL2Jvb3RzdHJhcC1jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBBbmRyZXkgQ2hhbGtpbiA8TDJqTGlnYUBnbWFpbC5jb20+IChodHRwczovL2dpdGh1Yi5jb20vTDJqTGlnYSkuIEFsbCBSaWdodHMgUmVzZXJ2ZWQuXG4gKlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgYW4gTUlULXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmVcbiAqIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUgYXQgaHR0cHM6Ly9naXRodWIuY29tL0wyakxpZ2EvZmFzdGlmeS1kZWNvcmF0b3JzL2Jsb2IvbWFzdGVyL0xJQ0VOU0VcbiAqL1xuXG5pbXBvcnQgeyBSZWdpc3Rlck9wdGlvbnMgfSBmcm9tICdm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Fzc2VzIHRvIGJvb3RzdHJhcFxuICAgICAqL1xuICAgIGNvbnRyb2xsZXJzOiBhbnlbXTtcblxuICAgIC8qKlxuICAgICAqIEJ5IGRlZmF1bHQgYXBwbGljYXRpb24gd2lsbCBmYWlscyB0byBib290c3RyYXAgaWYgb25lIG9yIG1vcmUgb2YgbG9hZGVkIGZpbGVzIGRvZXMgbm90IGNvbnRhaW4gdmFsaWQgY29udHJvbGxlciBvciBoYW5kbGVyXG4gICAgICogVGhpcyBvcHRpb24gYWxsb3dzIHRvIGNoYW5nZSB0aGlzIGJlaGF2aW9yXG4gICAgICogQGRlZmF1bHQgZmFsc2VcbiAgICAgKi9cbiAgICBza2lwQnJva2VuPzogYm9vbGVhbjtcbn1cblxuZXhwb3J0IHR5cGUgQm9vdHN0cmFwQ29uZmlnID0gQXV0b0xvYWRDb25maWcgfCBDb250cm9sbGVyc0xpc3RDb25maWc7XG4iXX0= |
@@ -8,18 +8,19 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import { FastifyInstance, RouteShorthandOptions } from 'fastify'; | ||
import { IncomingMessage, Server, ServerResponse } from 'http'; | ||
import { FastifyLoggerInstance } from 'fastify/types/logger'; | ||
import { RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase, RawServerDefault } from 'fastify/types/utils'; | ||
import { HttpMethods } from '../decorators/helpers/http-methods'; | ||
import { CREATOR } from '../symbols'; | ||
export interface ControllerConstructor<HttpServer = Server, Request = IncomingMessage, Response = ServerResponse> { | ||
export interface ControllerConstructor<RawServer extends RawServerBase = RawServerDefault, RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>, RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>, Logger = FastifyLoggerInstance> { | ||
new (): any; | ||
new (...args: any[]): any; | ||
[CREATOR]: ControllerHandlersAndHooks<HttpServer, Request, Response>; | ||
[CREATOR]: ControllerHandlersAndHooks<RawServer, RawRequest, RawReply>; | ||
} | ||
export interface ControllerHandlersAndHooks<HttpServer, Request, Response> { | ||
handlers: Handler<Request, Response>[]; | ||
export interface ControllerHandlersAndHooks<RawServer extends RawServerBase, RawRequest extends RawRequestDefaultExpression<RawServer>, RawReply extends RawReplyDefaultExpression<RawServer>> { | ||
handlers: Handler<RawServer, RawRequest, RawReply>[]; | ||
hooks: Hook[]; | ||
register?: (instance: FastifyInstance<HttpServer, Request, Response>) => void; | ||
errorHandlers: ErrorHandler[]; | ||
register?: (instance: FastifyInstance<RawServer, RawRequest, RawReply>) => void; | ||
} | ||
export interface Handler<Request, Response> { | ||
export interface Handler<RawServer extends RawServerBase = RawServerDefault, RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>, RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>> { | ||
url: string; | ||
@@ -30,2 +31,6 @@ method: HttpMethods; | ||
} | ||
export interface ErrorHandler { | ||
accepts<T extends Error>(error?: T): boolean; | ||
handlerName: string | symbol; | ||
} | ||
export interface Hook { | ||
@@ -32,0 +37,0 @@ name: any; |
@@ -11,2 +11,2 @@ "use strict"; | ||
const symbols_1 = require("../symbols"); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJvbGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9pbnRlcmZhY2VzL2NvbnRyb2xsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7QUFLSCx3Q0FBcUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgQW5kcmV5IENoYWxraW4gPEwyakxpZ2FAZ21haWwuY29tPiAoaHR0cHM6Ly9naXRodWIuY29tL0wyakxpZ2EpLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB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0aG9kOiBIdHRwTWV0aG9kcztcbiAgICBvcHRpb25zOiBSb3V0ZVNob3J0aGFuZE9wdGlvbnM7XG4gICAgaGFuZGxlck1ldGhvZDogc3RyaW5nIHwgc3ltYm9sO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIEVycm9ySGFuZGxlciB7XG4gICAgYWNjZXB0czxUIGV4dGVuZHMgRXJyb3I+KGVycm9yPzogVCk6IGJvb2xlYW47XG5cbiAgICBoYW5kbGVyTmFtZTogc3RyaW5nIHwgc3ltYm9sO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIEhvb2sge1xuICAgIG5hbWU6IGFueTtcbiAgICBoYW5kbGVyTmFtZTogc3RyaW5nIHwgc3ltYm9sO1xufVxuIl19 |
@@ -10,6 +10,5 @@ /** | ||
export { ControllerConfig } from './controller-config'; | ||
export { ControllerConstructor } from './controller'; | ||
export { ControllerHandlersAndHooks } from './controller'; | ||
export { ControllerConstructor, ControllerHandlersAndHooks, ErrorHandler, Handler, Hook } from './controller'; | ||
export { RequestHandler } from './request-handler'; | ||
export { RouteConfig } from './route-config'; | ||
export { InjectableClass } from './injectable-class'; |
@@ -12,2 +12,2 @@ "use strict"; | ||
Object.defineProperty(exports, "RequestHandler", { enumerable: true, get: function () { return request_handler_1.RequestHandler; } }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWIvaW50ZXJmYWNlcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOztBQU1ILHFEQUFtRDtBQUExQyxpSEFBQSxjQUFjLE9BQUEiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgQW5kcmV5IENoYWxraW4gPEwyakxpZ2FAZ21haWwuY29tPiAoaHR0cHM6Ly9na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Y2VzQ29udGVudCI6WyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgQW5kcmV5IENoYWxraW4gPEwyakxpZ2FAZ21haWwuY29tPiAoaHR0cHM6Ly9naXRodWIuY29tL0wyakxpZ2EpLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vZ2l0aHViLmNvbS9MMmpMaWdhL2Zhc3RpZnktZGVjb3JhdG9ycy9ibG9iL21hc3Rlci9MSUNFTlNFXG4gKi9cblxuZXhwb3J0IHsgQm9vdHN0cmFwQ29uZmlnIH0gZnJvbSAnLi9ib290c3RyYXAtY29uZmlnJztcbmV4cG9ydCB7IENvbnRyb2xsZXJDb25maWcgfSBmcm9tICcuL2NvbnRyb2xsZXItY29uZmlnJztcbmV4cG9ydCB7IENvbnRyb2xsZXJDb25zdHJ1Y3RvciwgQ29udHJvbGxlckhhbmRsZXJzQW5kSG9va3MsIEVycm9ySGFuZGxlciwgSGFuZGxlciwgSG9vayB9IGZyb20gJy4vY29udHJvbGxlcic7XG5leHBvcnQgeyBSZXF1ZXN0SGFuZGxlciB9IGZyb20gJy4vcmVxdWVzdC1oYW5kbGVyJztcbmV4cG9ydCB7IFJvdXRlQ29uZmlnIH0gZnJvbSAnLi9yb3V0ZS1jb25maWcnO1xuZXhwb3J0IHsgSW5qZWN0YWJsZUNsYXNzIH0gZnJvbSAnLi9pbmplY3RhYmxlLWNsYXNzJztcbiJdfQ== |
@@ -8,5 +8,5 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'; | ||
import { IncomingMessage, ServerResponse } from 'http'; | ||
import { RequestGenericInterface } from 'fastify/types/request'; | ||
import { ContextConfigDefault, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase, RawServerDefault } from 'fastify/types/utils'; | ||
import { CREATOR } from '../symbols'; | ||
@@ -16,6 +16,6 @@ /** | ||
*/ | ||
export declare abstract class RequestHandler<Request = IncomingMessage, Response = ServerResponse> { | ||
protected request: FastifyRequest<Request>; | ||
protected reply: FastifyReply<Response>; | ||
protected constructor(request: FastifyRequest<Request>, reply: FastifyReply<Response>); | ||
export declare abstract class RequestHandler<RawServer extends RawServerBase = RawServerDefault, RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>, RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>, RequestGeneric extends RequestGenericInterface = RequestGenericInterface, ContextConfig = ContextConfigDefault> { | ||
protected request: FastifyRequest<RawServer, RawRequest, RequestGeneric>; | ||
protected reply: FastifyReply<RawServer, RawRequest, RawReply, RequestGeneric, ContextConfig>; | ||
protected constructor(request: FastifyRequest<RawServer, RawRequest, RequestGeneric>, reply: FastifyReply<RawServer, RawRequest, RawReply, RequestGeneric, ContextConfig>); | ||
/** | ||
@@ -22,0 +22,0 @@ * Main method for request handling |
@@ -22,2 +22,2 @@ "use strict"; | ||
exports.RequestHandler = RequestHandler; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdC1oYW5kbGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL2ludGVyZmFjZXMvcmVxdWVzdC1oYW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7O0dBTUc7OztBQUlILHdDQUFxQztBQUVyQzs7R0FFRztBQUNILE1BQXNCLGNBQWM7SUFDaEMsWUFBZ0MsT0FBZ0MsRUFDaEMsS0FBNkI7UUFEN0IsWUFBTyxHQUFQLE9BQU8sQ0FBeUI7UUFDaEMsVUFB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eHByZXNzaW9uPFJhd1NlcnZlcj4sXG4gICAgUmF3UmVwbHkgZXh0ZW5kcyBSYXdSZXBseURlZmF1bHRFeHByZXNzaW9uPFJhd1NlcnZlcj4gPSBSYXdSZXBseURlZmF1bHRFeHByZXNzaW9uPFJhd1NlcnZlcj4sXG4gICAgUmVxdWVzdEdlbmVyaWMgZXh0ZW5kcyBSZXF1ZXN0R2VuZXJpY0ludGVyZmFjZSA9IFJlcXVlc3RHZW5lcmljSW50ZXJmYWNlLFxuICAgIENvbnRleHRDb25maWcgPSBDb250ZXh0Q29uZmlnRGVmYXVsdCxcbiAgICA+IHtcblxuICAgIHByb3RlY3RlZCBjb25zdHJ1Y3Rvcihwcm90ZWN0ZWQgcmVxdWVzdDogRmFzdGlmeVJlcXVlc3Q8UmF3U2VydmVyLCBSYXdSZXF1ZXN0LCBSZXF1ZXN0R2VuZXJpYz4sXG4gICAgICAgICAgICAgICAgICAgICAgICAgIHByb3RlY3RlZCByZXBseTogRmFzdGlmeVJlcGx5PFJhd1NlcnZlciwgUmF3UmVxdWVzdCwgUmF3UmVwbHksIFJlcXVlc3RHZW5lcmljLCBDb250ZXh0Q29uZmlnPikge1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIE1haW4gbWV0aG9kIGZvciByZXF1ZXN0IGhhbmRsaW5nXG4gICAgICovXG4gICAgYWJzdHJhY3QgaGFuZGxlKCk6IHZvaWQgfCBQcm9taXNlPGFueT47XG5cbiAgICAvKipcbiAgICAgKiBTdGF0aWMgbWV0aG9kIHRvIHJlZ2lzdGVyIGhhbmRsZXIgYnkgYXV0b2xvYWRlciAoYm9vdHN0cmFwKVxuICAgICAqL1xuICAgIHN0YXRpYyByZWFkb25seSBbQ1JFQVRPUl06IHsgcmVnaXN0ZXI6IChpbnN0YW5jZTogRmFzdGlmeUluc3RhbmNlKSA9PiB2b2lkIH07XG59XG4iXX0= |
{ | ||
"name": "fastify-decorators", | ||
"version": "2.0.0", | ||
"version": "3.0.0-0", | ||
"description": "Build your Fastify server with controllers, services and hooks", | ||
@@ -31,3 +31,3 @@ "main": "index.js", | ||
"engines": { | ||
"node": ">= 10.0.0" | ||
"node": ">= 10.16.0" | ||
}, | ||
@@ -37,4 +37,4 @@ "type": "commonjs", | ||
"@types/node": "*", | ||
"fastify": "^2.0.0" | ||
"fastify": "^3.0.0-rc.1 || ^3.0.0" | ||
} | ||
} |
@@ -30,3 +30,3 @@ # Fastify decorators | ||
- [Testing] | ||
- [Migration to V2] | ||
- [Migration guide (V3)] | ||
@@ -171,7 +171,7 @@ ## Basic usage | ||
[Getting Started]: https://github.com/L2jLiga/fastify-decorators/blob/v2.0.0/lib/docs/Getting-Started.md | ||
[Request Handler]: https://github.com/L2jLiga/fastify-decorators/blob/v2.0.0/lib/docs/Request-Handlers.md | ||
[Controllers]: https://github.com/L2jLiga/fastify-decorators/blob/v2.0.0/lib/docs/Controllers.md | ||
[Dependency Injection]: https://github.com/L2jLiga/fastify-decorators/blob/v2.0.0/lib/docs/Dependency-Injection.md | ||
[Testing]: https://github.com/L2jLiga/fastify-decorators/blob/v2.0.0/lib/docs/Testing.md | ||
[Migration to V2]: https://github.com/L2jLiga/fastify-decorators/blob/v2.0.0/lib/docs/Migration-to-v2.md | ||
[Getting Started]: https://github.com/L2jLiga/fastify-decorators/blob/v3.0.0-0/lib/docs/Getting-Started.md | ||
[Request Handler]: https://github.com/L2jLiga/fastify-decorators/blob/v3.0.0-0/lib/docs/Request-Handlers.md | ||
[Controllers]: https://github.com/L2jLiga/fastify-decorators/blob/v3.0.0-0/lib/docs/Controllers.md | ||
[Dependency Injection]: https://github.com/L2jLiga/fastify-decorators/blob/v3.0.0-0/lib/docs/Dependency-Injection.md | ||
[Testing]: https://github.com/L2jLiga/fastify-decorators/blob/v3.0.0-0/lib/docs/Testing.md | ||
[Migration guide (V3)]: https://github.com/L2jLiga/fastify-decorators/blob/v3.0.0-0/lib/lib/docs/Migration-to-v3.md |
@@ -8,4 +8,3 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import fastify = require('fastify'); | ||
import { FastifyInstance } from 'fastify'; | ||
import { ServiceMock } from './service-mock'; | ||
@@ -16,2 +15,2 @@ export interface ControllerTestConfig { | ||
} | ||
export declare function configureControllerTest(config: ControllerTestConfig): Promise<fastify.FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse>>; | ||
export declare function configureControllerTest(config: ControllerTestConfig): Promise<FastifyInstance<any, any, any, any>>; |
@@ -11,3 +11,3 @@ "use strict"; | ||
exports.configureControllerTest = void 0; | ||
const fastify = require("fastify"); | ||
const fastify_1 = require("fastify"); | ||
const injectables_1 = require("../registry/injectables"); | ||
@@ -17,8 +17,9 @@ const symbols_1 = require("../symbols"); | ||
async function configureControllerTest(config) { | ||
const instance = fastify(); | ||
const instance = fastify_1.fastify(); | ||
const injectablesWithMocks = mocks_manager_1.MocksManager.create(injectables_1.injectables, config.mocks); | ||
config.controller[symbols_1.CREATOR].register(instance, injectablesWithMocks, false); | ||
await config.controller[symbols_1.CREATOR].register(instance, injectablesWithMocks, false); | ||
await instance.ready(); | ||
return instance; | ||
} | ||
exports.configureControllerTest = configureControllerTest; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJlLWNvbnRyb2xsZXItdGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi90ZXN0aW5nL2NvbmZpZ3VyZS1jb250cm9sbGVyLXRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7O0FBRUgsbUNBQW9DO0FBQ3BDLHlEQUFzRDtBQUN0RCx3Q0FBcUM7QUFDckMsbURBQStDO0FBUXhDLEtBQUssVUFBVSx1QkFBdUIsQ0FBQyxNQUE0QjtJQUN0RSxNQUFNLFFBQVEsR0FBRyxPQUFPLEVBQUUsQ0FBQztJQUMzQixNQUFNLG9CQUFvQixHQ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3luYyBmdW5jdGlvbiBjb25maWd1cmVDb250cm9sbGVyVGVzdChjb25maWc6IENvbnRyb2xsZXJUZXN0Q29uZmlnKTogUHJvbWlzZTxGYXN0aWZ5SW5zdGFuY2U8YW55LCBhbnksIGFueSwgYW55Pj4ge1xuICAgIGNvbnN0IGluc3RhbmNlID0gZmFzdGlmeSgpO1xuICAgIGNvbnN0IGluamVjdGFibGVzV2l0aE1vY2tzID0gTW9ja3NNYW5hZ2VyLmNyZWF0ZShpbmplY3RhYmxlcywgY29uZmlnLm1vY2tzKTtcblxuICAgIGF3YWl0IGNvbmZpZy5jb250cm9sbGVyW0NSRUFUT1JdLnJlZ2lzdGVyKGluc3RhbmNlLCBpbmplY3RhYmxlc1dpdGhNb2NrcywgZmFsc2UpO1xuICAgIGF3YWl0IGluc3RhbmNlLnJlYWR5KCk7XG5cbiAgICByZXR1cm4gaW5zdGFuY2U7XG59XG4iXX0= |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
169793
76
1271
2