@vmm/service
Advanced tools
Comparing version 1.0.49 to 1.0.50
{ | ||
"name": "@vmm/service", | ||
"version": "1.0.49", | ||
"version": "1.0.50", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "description": "VMM Service library", |
@@ -55,3 +55,3 @@ /// <reference types="node" /> | ||
} | ||
interface IServiceOptions<T_API extends IApiDefines, T_RESTDB, T_SESSION> { | ||
interface IServiceOptions<T_API extends IApiDefines> { | ||
host?: string; | ||
@@ -64,10 +64,6 @@ port: number; | ||
}; | ||
sessionExpire: number; | ||
sessionExpire?: number; | ||
apiMiddleWares?: RequestHandler[]; | ||
} | ||
export declare class Service<T_API extends IApiDefines, T_RESTDB extends { | ||
[k: string]: { | ||
[k: string]: ApiFunction_T; | ||
}; | ||
}, T_SESSIONS extends ISeviceSession> { | ||
export declare class Service<T_API extends IApiDefines> { | ||
expressApp: import("express-serve-static-core").Express; | ||
@@ -80,5 +76,5 @@ router: import("express-serve-static-core").Router; | ||
private _servicePath; | ||
api: REMAP_API_FUNCS<T_API, T_SESSIONS>; | ||
api: REMAP_API_FUNCS<T_API['api'], T_API['session']>; | ||
readonly httpServer: Server; | ||
constructor(options: IServiceOptions<T_API, T_RESTDB, T_SESSIONS>); | ||
constructor(options: IServiceOptions<T_API>); | ||
private _responseHeaderOriginHandle; | ||
@@ -85,0 +81,0 @@ private _logHandle; |
@@ -69,4 +69,4 @@ "use strict"; | ||
this._servicePath = `/api/${lodash_1.default.kebabCase(this._name).replace(/-api$/, '')}`; | ||
this.api = lodash_1.default.clone(options.api); | ||
log.debug('api using service path:', this._servicePath); | ||
this.api = lodash_1.default.clone(options.api.api); | ||
log.debug('api using service path :', this._servicePath); | ||
this.router.use(this._responseHeaderOriginHandle.bind(this)); | ||
@@ -85,7 +85,6 @@ this.router.use(body_parser_1.default.json({ | ||
log.debug('using api:', apiName, this._servicePath + '/' + lodash_1.default.kebabCase(apiName)); | ||
this.router.use(`/${lodash_1.default.kebabCase(apiName)}`, this._createApiHandle(this._options.api[apiName], () => this.api[apiName])); | ||
this.router.use(`/${lodash_1.default.kebabCase(apiName)}`, this._createApiHandle(this._options.api.api[apiName], () => this.api[apiName])); | ||
}); | ||
if (this._options.api.db) { | ||
lodash_1.default.forEach(this._options.api.db, (restDb, apiName) => { | ||
log.debug('using rest db api:', apiName, Object.keys(restDb).join()); | ||
const dbApis = restDbApi_1.createDbApi(this._options.mongo, restDb); | ||
@@ -96,2 +95,3 @@ lodash_1.default.forEach(restDb, (dbMethod, methodName) => { | ||
}); | ||
log.debug('using rest db api:', apiName, Object.keys(restDb).join()); | ||
}); | ||
@@ -98,0 +98,0 @@ } |
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
44426
1115