@davinci/http-server-fastify
Advanced tools
Comparing version 2.0.0-next.17 to 2.0.0-next.18
@@ -1,1 +0,1 @@ | ||
{"processes":{"52211c08-6794-4c25-b440-32db084f5e86":{"parent":null,"children":[]},"791f6cba-4809-43dd-bbd5-25d877526065":{"parent":"8e604461-9ef1-41ae-b58d-fe51c9f59b30","children":["ad5a2f35-67cb-4105-8022-d544b25d9ae4"]},"8e604461-9ef1-41ae-b58d-fe51c9f59b30":{"parent":null,"children":["791f6cba-4809-43dd-bbd5-25d877526065"]},"ad5a2f35-67cb-4105-8022-d544b25d9ae4":{"parent":"791f6cba-4809-43dd-bbd5-25d877526065","children":[]}},"files":{"/home/circleci/project/packages/http-server-fastify/src/FastifyHttpServer.ts":["52211c08-6794-4c25-b440-32db084f5e86","ad5a2f35-67cb-4105-8022-d544b25d9ae4"],"/home/circleci/project/packages/http-server-fastify/src/index.ts":["52211c08-6794-4c25-b440-32db084f5e86","ad5a2f35-67cb-4105-8022-d544b25d9ae4"]},"externalIds":{}} | ||
{"processes":{"5fae59f3-297a-41f8-8a26-910206e8df50":{"parent":"f6d101bb-b3e3-4f4e-a571-d6113504684e","children":[]},"7e72c9be-c177-4c69-9206-c1a027cb1ed0":{"parent":null,"children":[]},"9a2fb03e-c5cc-41d7-80ee-6c5ba6e33543":{"parent":null,"children":["f6d101bb-b3e3-4f4e-a571-d6113504684e"]},"f6d101bb-b3e3-4f4e-a571-d6113504684e":{"parent":"9a2fb03e-c5cc-41d7-80ee-6c5ba6e33543","children":["5fae59f3-297a-41f8-8a26-910206e8df50"]}},"files":{"/home/circleci/project/packages/http-server-fastify/src/index.ts":["5fae59f3-297a-41f8-8a26-910206e8df50","7e72c9be-c177-4c69-9206-c1a027cb1ed0"],"/home/circleci/project/packages/http-server-fastify/src/FastifyHttpServer.ts":["5fae59f3-297a-41f8-8a26-910206e8df50","7e72c9be-c177-4c69-9206-c1a027cb1ed0"]},"externalIds":{}} |
@@ -10,3 +10,3 @@ /// <reference types="node" /> | ||
declare type Server = HttpServer | HttpsServer; | ||
export declare type FastifyHttpServerModuleOptions = { | ||
export interface FastifyHttpServerModuleOptions extends HttpServerModuleOptions { | ||
app?: FastifyInstance; | ||
@@ -17,4 +17,9 @@ middlewares?: { | ||
plugins?: [FastifyPluginCallback, FastifyPluginOptions?][]; | ||
} & HttpServerModuleOptions; | ||
export declare class FastifyHttpServer extends HttpServerModule<FastifyRequest, FastifyReply, Server, FastifyHttpServerModuleOptions> { | ||
} | ||
export declare class FastifyHttpServer extends HttpServerModule<{ | ||
Request: FastifyRequest; | ||
Response: FastifyReply; | ||
Server: Server; | ||
ModuleOptions: FastifyHttpServerModuleOptions; | ||
}> { | ||
instance: FastifyInstance; | ||
@@ -21,0 +26,0 @@ app: App; |
@@ -16,10 +16,17 @@ "use strict"; | ||
constructor(options) { | ||
var _a, _b; | ||
const { app, ...moduleOptions } = options !== null && options !== void 0 ? options : {}; | ||
super(moduleOptions); | ||
this.instance = app; | ||
if ((_a = this.moduleOptions.logger) === null || _a === void 0 ? void 0 : _a.level) { | ||
this.logger.level = (_b = this.moduleOptions.logger) === null || _b === void 0 ? void 0 : _b.level; | ||
} | ||
} | ||
async onRegister(app) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
this.app = app; | ||
this.logger.level = (_b = (_a = this.app.getOptions()) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.level; | ||
const level = (_b = (_a = this.moduleOptions.logger) === null || _a === void 0 ? void 0 : _a.level) !== null && _b !== void 0 ? _b : (_c = app.getOptions().logger) === null || _c === void 0 ? void 0 : _c.level; | ||
if (level) { | ||
this.logger.level = level; | ||
} | ||
this.initHttpServer(); | ||
@@ -26,0 +33,0 @@ await this.registerMiddlewares(); |
@@ -10,3 +10,3 @@ /// <reference types="node" /> | ||
declare type Server = HttpServer | HttpsServer; | ||
export declare type FastifyHttpServerModuleOptions = { | ||
export interface FastifyHttpServerModuleOptions extends HttpServerModuleOptions { | ||
app?: FastifyInstance; | ||
@@ -17,4 +17,9 @@ middlewares?: { | ||
plugins?: [FastifyPluginCallback, FastifyPluginOptions?][]; | ||
} & HttpServerModuleOptions; | ||
export declare class FastifyHttpServer extends HttpServerModule<FastifyRequest, FastifyReply, Server, FastifyHttpServerModuleOptions> { | ||
} | ||
export declare class FastifyHttpServer extends HttpServerModule<{ | ||
Request: FastifyRequest; | ||
Response: FastifyReply; | ||
Server: Server; | ||
ModuleOptions: FastifyHttpServerModuleOptions; | ||
}> { | ||
instance: FastifyInstance; | ||
@@ -21,0 +26,0 @@ app: App; |
@@ -12,10 +12,17 @@ /* | ||
constructor(options) { | ||
var _a, _b; | ||
const { app, ...moduleOptions } = options !== null && options !== void 0 ? options : {}; | ||
super(moduleOptions); | ||
this.instance = app; | ||
if ((_a = this.moduleOptions.logger) === null || _a === void 0 ? void 0 : _a.level) { | ||
this.logger.level = (_b = this.moduleOptions.logger) === null || _b === void 0 ? void 0 : _b.level; | ||
} | ||
} | ||
async onRegister(app) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
this.app = app; | ||
this.logger.level = (_b = (_a = this.app.getOptions()) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.level; | ||
const level = (_b = (_a = this.moduleOptions.logger) === null || _a === void 0 ? void 0 : _a.level) !== null && _b !== void 0 ? _b : (_c = app.getOptions().logger) === null || _c === void 0 ? void 0 : _c.level; | ||
if (level) { | ||
this.logger.level = level; | ||
} | ||
this.initHttpServer(); | ||
@@ -22,0 +29,0 @@ await this.registerMiddlewares(); |
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-next.18](https://github.com/HPInc/davinci/compare/@davinci/http-server-fastify@2.0.0-next.17...@davinci/http-server-fastify@2.0.0-next.18) (2022-11-18) | ||
**Note:** Version bump only for package @davinci/http-server-fastify | ||
# [2.0.0-next.17](https://github.com/HPInc/davinci/compare/@davinci/http-server-fastify@2.0.0-next.16...@davinci/http-server-fastify@2.0.0-next.17) (2022-11-17) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@davinci/http-server-fastify", | ||
"version": "2.0.0-next.17", | ||
"version": "2.0.0-next.18", | ||
"description": "Framework for rapid and consistent API development", | ||
@@ -23,3 +23,3 @@ "main": "build-cjs/index.js", | ||
"dependencies": { | ||
"@davinci/http-server": "^2.0.0-next.15", | ||
"@davinci/http-server": "^2.0.0-next.16", | ||
"@davinci/reflector": "^2.0.0-next.13" | ||
@@ -43,3 +43,3 @@ }, | ||
}, | ||
"gitHead": "7ec642982bd2a951806b09656416d010adacaca4" | ||
"gitHead": "b58c92ee275c82ac4462271fdd89212bfdfadb08" | ||
} |
@@ -29,3 +29,3 @@ /* | ||
export type FastifyHttpServerModuleOptions = { | ||
export interface FastifyHttpServerModuleOptions extends HttpServerModuleOptions { | ||
app?: FastifyInstance; | ||
@@ -36,10 +36,10 @@ middlewares?: { | ||
plugins?: [FastifyPluginCallback, FastifyPluginOptions?][]; | ||
} & HttpServerModuleOptions; | ||
} | ||
export class FastifyHttpServer extends HttpServerModule< | ||
FastifyRequest, | ||
FastifyReply, | ||
Server, | ||
FastifyHttpServerModuleOptions | ||
> { | ||
export class FastifyHttpServer extends HttpServerModule<{ | ||
Request: FastifyRequest; | ||
Response: FastifyReply; | ||
Server: Server; | ||
ModuleOptions: FastifyHttpServerModuleOptions; | ||
}> { | ||
instance: FastifyInstance; | ||
@@ -52,2 +52,5 @@ app: App; | ||
this.instance = app; | ||
if (this.moduleOptions.logger?.level) { | ||
this.logger.level = this.moduleOptions.logger?.level; | ||
} | ||
} | ||
@@ -57,3 +60,6 @@ | ||
this.app = app; | ||
this.logger.level = this.app.getOptions()?.logger?.level; | ||
const level = this.moduleOptions.logger?.level ?? app.getOptions().logger?.level; | ||
if (level) { | ||
this.logger.level = level; | ||
} | ||
this.initHttpServer(); | ||
@@ -60,0 +66,0 @@ await this.registerMiddlewares(); |
@@ -214,3 +214,3 @@ /* | ||
it('should propagate the calls to the underlying fastify instance', async () => { | ||
const fastifyHttpServer = new FastifyHttpServer(); | ||
const fastifyHttpServer = new FastifyHttpServer({ logger: { level: 'silent' } }); | ||
await fastifyHttpServer.initHttpServer(); | ||
@@ -217,0 +217,0 @@ const fastify = fastifyHttpServer.getInstance(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
204414
1467