@rocketmakers/orbit-capsule-utils 2.0.5 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bootstrap/boot.d.ts +1 -2
- package/lib/bootstrap/boot.d.ts.map +1 -1
- package/lib/bootstrap/boot.js +9 -13
- package/lib/bootstrap/boot.js.map +1 -1
- package/lib/bootstrap/common.d.ts +1 -1
- package/lib/bootstrap/common.d.ts.map +1 -1
- package/lib/bootstrap/common.js +1 -2
- package/lib/bootstrap/common.js.map +1 -1
- package/lib/bootstrap/createExpressApp.d.ts +2 -3
- package/lib/bootstrap/createExpressApp.d.ts.map +1 -1
- package/lib/bootstrap/createExpressApp.js +10 -13
- package/lib/bootstrap/createExpressApp.js.map +1 -1
- package/lib/bootstrap/ioc/register.d.ts +1 -1
- package/lib/bootstrap/ioc/register.d.ts.map +1 -1
- package/lib/bootstrap/ioc/register.js +1 -5
- package/lib/bootstrap/ioc/register.js.map +1 -1
- package/lib/bootstrap/ioc/tsoaIoc.d.ts +2 -4
- package/lib/bootstrap/ioc/tsoaIoc.d.ts.map +1 -1
- package/lib/bootstrap/ioc/tsoaIoc.helper.d.ts +2 -2
- package/lib/bootstrap/ioc/tsoaIoc.helper.d.ts.map +1 -1
- package/lib/bootstrap/ioc/tsoaIoc.helper.js +6 -5
- package/lib/bootstrap/ioc/tsoaIoc.helper.js.map +1 -1
- package/lib/bootstrap/ioc/tsoaIoc.js.map +1 -1
- package/lib/bootstrap/ioc/types.d.ts +0 -3
- package/lib/bootstrap/ioc/types.d.ts.map +1 -1
- package/lib/config/app.js +9 -13
- package/lib/config/app.js.map +1 -1
- package/lib/config/environment.generated.js +5 -1
- package/lib/config/environment.generated.js.map +1 -1
- package/lib/database/connectionFactory.d.ts +4 -5
- package/lib/database/connectionFactory.d.ts.map +1 -1
- package/lib/database/connectionFactory.js +43 -47
- package/lib/database/connectionFactory.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/middleware/errors.d.ts +1 -2
- package/lib/middleware/errors.d.ts.map +1 -1
- package/lib/middleware/errors.js +8 -5
- package/lib/middleware/errors.js.map +1 -1
- package/lib/utils/capsules.js +9 -13
- package/lib/utils/capsules.js.map +1 -1
- package/lib/utils/resolveLibDirFilePaths.js +4 -4
- package/lib/utils/resolveLibDirFilePaths.js.map +1 -1
- package/package.json +45 -47
- package/lib/environment.json +0 -27
- package/lib/rest/health.d.ts +0 -7
- package/lib/rest/health.d.ts.map +0 -1
- package/lib/rest/health.js +0 -43
- package/lib/rest/health.js.map +0 -1
- package/lib/rest/index.d.ts +0 -2
- package/lib/rest/index.d.ts.map +0 -1
- package/lib/rest/index.js +0 -5
- package/lib/rest/index.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
package/lib/bootstrap/boot.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="bunyan" />
|
|
2
1
|
import { Logger } from '@rocketmakers/log';
|
|
3
2
|
import { AppConfig } from '../config';
|
|
4
3
|
import { IExpressSetup } from './createExpressApp';
|
|
5
4
|
export declare function protectedBoot(func: () => Promise<void>): void;
|
|
6
|
-
export declare function boot(name: string, bootstrap: (logger: Logger, config: AppConfig) => Promise<void>, setup: IExpressSetup): Promise<import("express
|
|
5
|
+
export declare function boot(name: string, bootstrap: (logger: Logger, config: AppConfig) => Promise<void>, setup: IExpressSetup): Promise<import("express").Express>;
|
|
7
6
|
//# sourceMappingURL=boot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/bootstrap/boot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/bootstrap/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAClD,OAAO,EAAoB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAErE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAM7D;AAED,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/D,KAAK,EAAE,aAAa,sCAUrB"}
|
package/lib/bootstrap/boot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.protectedBoot = protectedBoot;
|
|
4
|
+
exports.boot = boot;
|
|
5
5
|
const log_1 = require("@rocketmakers/log");
|
|
6
6
|
const config_1 = require("../config");
|
|
7
7
|
const createExpressApp_1 = require("./createExpressApp");
|
|
@@ -11,16 +11,12 @@ function protectedBoot(func) {
|
|
|
11
11
|
process.exit(1);
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
app.listen(config.port, () => logger.info(`Listening on port ${config.port}`));
|
|
22
|
-
return app;
|
|
23
|
-
});
|
|
14
|
+
async function boot(name, bootstrap, setup) {
|
|
15
|
+
const config = await (0, config_1.initConfig)();
|
|
16
|
+
const logger = log_1.ConsoleLogger.create(name);
|
|
17
|
+
await bootstrap(logger, config);
|
|
18
|
+
const app = (0, createExpressApp_1.createExpressApp)(logger, config, setup);
|
|
19
|
+
app.listen(config.port, () => logger.info(`Listening on port ${config.port}`));
|
|
20
|
+
return app;
|
|
24
21
|
}
|
|
25
|
-
exports.boot = boot;
|
|
26
22
|
//# sourceMappingURL=boot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../../src/bootstrap/boot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../../src/bootstrap/boot.ts"],"names":[],"mappings":";;AAKA,sCAMC;AAED,oBAaC;AA1BD,2CAA0D;AAE1D,sCAAkD;AAClD,yDAAqE;AAErE,SAAgB,aAAa,CAAC,IAAyB;IACrD,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,6BAA6B,EAAE,iBAAiB,CAAC,CAAC;QAEnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,IAAI,CACxB,IAAY,EACZ,SAA+D,EAC/D,KAAoB;IAEpB,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAU,GAAE,CAAC;IAClC,MAAM,MAAM,GAAG,mBAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE1C,MAAM,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC,MAAM,GAAG,GAAG,IAAA,mCAAgB,EAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACpD,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/E,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LoggerLevel } from '@rocketmakers/log';
|
|
2
|
-
export
|
|
2
|
+
export type TValidLogLevels = LoggerLevel;
|
|
3
3
|
export declare function getMultipleLogLevels<T extends string[]>(supportedLogLevels: T, loggerLevels?: string): T;
|
|
4
4
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/bootstrap/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/bootstrap/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,kBAAkB,EAAE,CAAC,EAAE,YAAY,SAAU,GAAG,CAAC,CAOzG"}
|
package/lib/bootstrap/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMultipleLogLevels =
|
|
3
|
+
exports.getMultipleLogLevels = getMultipleLogLevels;
|
|
4
4
|
function getMultipleLogLevels(supportedLogLevels, loggerLevels = 'error') {
|
|
5
5
|
const selectedLogLevels = loggerLevels.split(',');
|
|
6
6
|
const validSelectedLogLevels = selectedLogLevels.filter(sll => supportedLogLevels.includes(sll));
|
|
@@ -9,5 +9,4 @@ function getMultipleLogLevels(supportedLogLevels, loggerLevels = 'error') {
|
|
|
9
9
|
}
|
|
10
10
|
return validSelectedLogLevels;
|
|
11
11
|
}
|
|
12
|
-
exports.getMultipleLogLevels = getMultipleLogLevels;
|
|
13
12
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/bootstrap/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/bootstrap/common.ts"],"names":[],"mappings":";;AAIA,oDAOC;AAPD,SAAgB,oBAAoB,CAAqB,kBAAqB,EAAE,YAAY,GAAG,OAAO;IACpG,MAAM,iBAAiB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAM,CAAC;IACvD,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAsB,CAAC,CAAC,CAAC;IACpH,IAAI,sBAAsB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,OAAO,CAAM,CAAC;IACxB,CAAC;IACD,OAAO,sBAA2B,CAAC;AACrC,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="bunyan" />
|
|
2
1
|
import { Logger } from '@rocketmakers/log';
|
|
3
|
-
import
|
|
2
|
+
import express from 'express';
|
|
4
3
|
import { AppConfig } from '../config';
|
|
5
4
|
export interface IExpressSetup {
|
|
6
5
|
pre?: (app: express.Express) => void;
|
|
7
6
|
post: (app: express.Express) => void;
|
|
8
7
|
}
|
|
9
|
-
export declare function createExpressApp(logger: Logger, config: AppConfig, setup: IExpressSetup):
|
|
8
|
+
export declare function createExpressApp(logger: Logger, config: AppConfig, setup: IExpressSetup): express.Express;
|
|
10
9
|
//# sourceMappingURL=createExpressApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExpressApp.d.ts","sourceRoot":"","sources":["../../src/bootstrap/createExpressApp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createExpressApp.d.ts","sourceRoot":"","sources":["../../src/bootstrap/createExpressApp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AActC,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC;IACrC,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CA4BzG"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createExpressApp =
|
|
3
|
+
exports.createExpressApp = createExpressApp;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const terminus_1 = require("@godaddy/terminus");
|
|
6
|
-
const bodyParser = require("body-parser");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const bodyParser = tslib_1.__importStar(require("body-parser"));
|
|
7
|
+
const cors_1 = tslib_1.__importDefault(require("cors"));
|
|
8
|
+
const express_1 = tslib_1.__importDefault(require("express"));
|
|
9
9
|
const middleware_1 = require("../middleware");
|
|
10
10
|
function healthCheck(logger, path) {
|
|
11
11
|
logger.trace(`Adding health check at ${path}`);
|
|
@@ -18,12 +18,12 @@ function healthCheck(logger, path) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function createExpressApp(logger, config, setup) {
|
|
21
|
-
const app =
|
|
21
|
+
const app = (0, express_1.default)();
|
|
22
22
|
if (setup.pre) {
|
|
23
23
|
setup.pre(app);
|
|
24
24
|
}
|
|
25
25
|
app.set('etag', false);
|
|
26
|
-
app.use(
|
|
26
|
+
app.use((0, cors_1.default)({ origin: true, credentials: true }));
|
|
27
27
|
app.disable('x-powered-by');
|
|
28
28
|
app.use(healthCheck(logger, '/health'));
|
|
29
29
|
app.use(bodyParser.json());
|
|
@@ -31,16 +31,13 @@ function createExpressApp(logger, config, setup) {
|
|
|
31
31
|
setup.post(app);
|
|
32
32
|
app.use((0, middleware_1.errorRequestHandler)(logger));
|
|
33
33
|
(0, terminus_1.createTerminus)(app, {
|
|
34
|
-
beforeShutdown() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
setTimeout(resolve, 5000);
|
|
39
|
-
});
|
|
34
|
+
async beforeShutdown() {
|
|
35
|
+
logger.warn(`Server about to shutdown`);
|
|
36
|
+
return new Promise(resolve => {
|
|
37
|
+
setTimeout(resolve, 5000);
|
|
40
38
|
});
|
|
41
39
|
},
|
|
42
40
|
});
|
|
43
41
|
return app;
|
|
44
42
|
}
|
|
45
|
-
exports.createExpressApp = createExpressApp;
|
|
46
43
|
//# sourceMappingURL=createExpressApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExpressApp.js","sourceRoot":"","sources":["../../src/bootstrap/createExpressApp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createExpressApp.js","sourceRoot":"","sources":["../../src/bootstrap/createExpressApp.ts"],"names":[],"mappings":";;AAyBA,4CA4BC;;AArDD,gDAAmD;AAEnD,gEAA0C;AAC1C,wDAAwB;AACxB,8DAA8B;AAG9B,8CAAoD;AAEpD,SAAS,WAAW,CAAC,MAAc,EAAE,IAAY;IAC/C,MAAM,CAAC,KAAK,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAoB,EAAE,GAAqB,EAAE,IAA0B,EAAE,EAAE;QACjF,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;AACJ,CAAC;AAOD,SAAgB,gBAAgB,CAAC,MAAc,EAAE,MAAiB,EAAE,KAAoB;IACtF,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IAEtB,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;QACd,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvB,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnD,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5B,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACxC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3B,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;IAEnE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEhB,GAAG,CAAC,GAAG,CAAC,IAAA,gCAAmB,EAAC,MAAM,CAAC,CAAC,CAAC;IAErC,IAAA,yBAAc,EAAC,GAAG,EAAE;QAClB,KAAK,CAAC,cAAc;YAClB,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACxC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC3B,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IContainer } from '@rocketmakers/ioc';
|
|
2
|
-
import { AppConfig } from '
|
|
2
|
+
import { AppConfig } from '../../config';
|
|
3
3
|
import { ICommonContainerTypes } from './types';
|
|
4
4
|
export declare function registerCommonIoC(config: AppConfig): IContainer<ICommonContainerTypes>;
|
|
5
5
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ioc/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ioc/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAItF"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerCommonIoC =
|
|
3
|
+
exports.registerCommonIoC = registerCommonIoC;
|
|
4
4
|
const ioc_1 = require("@rocketmakers/ioc");
|
|
5
|
-
const __1 = require("../..");
|
|
6
5
|
function registerCommonIoC(config) {
|
|
7
6
|
return (0, ioc_1.register)({
|
|
8
7
|
config: builder => builder.constant(config),
|
|
9
|
-
healthController: builder => builder.class(__1.HealthController, []).inTransientScope(),
|
|
10
|
-
transactionalHealthController: builder => builder.class(__1.TransactionalHealthController, []).inTransientScope(),
|
|
11
8
|
});
|
|
12
9
|
}
|
|
13
|
-
exports.registerCommonIoC = registerCommonIoC;
|
|
14
10
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/bootstrap/ioc/register.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/bootstrap/ioc/register.ts"],"names":[],"mappings":";;AAKA,8CAIC;AATD,2CAAyD;AAKzD,SAAgB,iBAAiB,CAAC,MAAiB;IACjD,OAAO,IAAA,cAAQ,EAAwB;QACrC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;KAC5C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { IocContainer } from '@tsoa/runtime';
|
|
1
|
+
import { IocContainer, ServiceIdentifier } from '@tsoa/runtime';
|
|
2
2
|
declare class Ioc implements IocContainer {
|
|
3
|
-
get<T>(controller:
|
|
4
|
-
prototype: T;
|
|
5
|
-
}): T;
|
|
3
|
+
get<T>(controller: ServiceIdentifier<T>): T;
|
|
6
4
|
}
|
|
7
5
|
export declare const iocContainer: Ioc;
|
|
8
6
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsoaIoc.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ioc/tsoaIoc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tsoaIoc.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ioc/tsoaIoc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIhE,cAAM,GAAI,YAAW,YAAY;IAC/B,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC;CAG5C;AAGD,eAAO,MAAM,YAAY,KAAY,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICommonContainerTypes } from './types';
|
|
1
|
+
import type { ICommonContainerTypes } from './types';
|
|
2
2
|
export declare function ContainerKey(name: keyof ICommonContainerTypes): ClassDecorator;
|
|
3
|
-
export declare function getContainerKey(item:
|
|
3
|
+
export declare function getContainerKey<T>(item: T): keyof ICommonContainerTypes;
|
|
4
4
|
//# sourceMappingURL=tsoaIoc.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsoaIoc.helper.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ioc/tsoaIoc.helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsoaIoc.helper.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ioc/tsoaIoc.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIrD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,qBAAqB,GAAG,cAAc,CAM9E;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,qBAAqB,CAEvE"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ContainerKey = ContainerKey;
|
|
4
|
+
exports.getContainerKey = getContainerKey;
|
|
5
|
+
const key = Symbol('___ioc');
|
|
4
6
|
function ContainerKey(name) {
|
|
5
7
|
return t => {
|
|
6
|
-
|
|
8
|
+
const func = t;
|
|
9
|
+
func[key] = name;
|
|
7
10
|
};
|
|
8
11
|
}
|
|
9
|
-
exports.ContainerKey = ContainerKey;
|
|
10
12
|
function getContainerKey(item) {
|
|
11
|
-
return item
|
|
13
|
+
return item[key];
|
|
12
14
|
}
|
|
13
|
-
exports.getContainerKey = getContainerKey;
|
|
14
15
|
//# sourceMappingURL=tsoaIoc.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsoaIoc.helper.js","sourceRoot":"","sources":["../../../src/bootstrap/ioc/tsoaIoc.helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsoaIoc.helper.js","sourceRoot":"","sources":["../../../src/bootstrap/ioc/tsoaIoc.helper.ts"],"names":[],"mappings":";;AAIA,oCAMC;AAED,0CAEC;AAZD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAE7B,SAAgB,YAAY,CAAC,IAAiC;IAC5D,OAAO,CAAC,CAAC,EAAE;QACT,MAAM,IAAI,GAAG,CAAC,CAAC;QAEf,IAAI,CAAC,GAAc,CAAC,GAAG,IAAsB,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAAI,IAAO;IACxC,OAAO,IAAI,CAAC,GAAc,CAAgC,CAAC;AAC7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsoaIoc.js","sourceRoot":"","sources":["../../../src/bootstrap/ioc/tsoaIoc.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AAGtD,qDAAmD;AAEnD,MAAM,GAAG;IACP,GAAG,CAAI,
|
|
1
|
+
{"version":3,"file":"tsoaIoc.js","sourceRoot":"","sources":["../../../src/bootstrap/ioc/tsoaIoc.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AAGtD,qDAAmD;AAEnD,MAAM,GAAG;IACP,GAAG,CAAI,UAAgC;QACrC,OAAO,uBAAiB,CAAC,GAAG,CAAC,IAAA,gCAAe,EAAC,UAAU,CAAC,CAAiB,CAAC;IAC5E,CAAC;CACF;AAGY,QAAA,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { AppConfig } from '../../config/app';
|
|
2
|
-
import { HealthController, TransactionalHealthController } from '../../rest';
|
|
3
2
|
export interface ICommonContainerTypes {
|
|
4
3
|
config: AppConfig;
|
|
5
|
-
healthController: HealthController;
|
|
6
|
-
transactionalHealthController: TransactionalHealthController;
|
|
7
4
|
}
|
|
8
5
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ioc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ioc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,WAAW,qBAAqB;IAEpC,MAAM,EAAE,SAAS,CAAC;CACnB"}
|
package/lib/config/app.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initConfig =
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
3
|
+
exports.initConfig = initConfig;
|
|
5
4
|
const environment_1 = require("@rocketmakers/environment");
|
|
6
5
|
const environment_generated_1 = require("./environment.generated");
|
|
7
|
-
function initConfig() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
});
|
|
6
|
+
async function initConfig() {
|
|
7
|
+
const defaultEnv = await (0, environment_1.readFromEnvironment)(environment_generated_1.CoreEnvironment);
|
|
8
|
+
return {
|
|
9
|
+
environment: defaultEnv.env || 'dev',
|
|
10
|
+
port: defaultEnv.port || 3000,
|
|
11
|
+
logLevels: defaultEnv.logLevel,
|
|
12
|
+
requestRawBodySizeLimit: defaultEnv.requestRawBodySizeLimitBytes || 100000000,
|
|
13
|
+
};
|
|
17
14
|
}
|
|
18
|
-
exports.initConfig = initConfig;
|
|
19
15
|
//# sourceMappingURL=app.js.map
|
package/lib/config/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/config/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/config/app.ts"],"names":[],"mappings":";;AAqBA,gCASC;AA9BD,2DAAgE;AAGhE,mEAA0D;AAkBnD,KAAK,UAAU,UAAU;IAC9B,MAAM,UAAU,GAAG,MAAM,IAAA,iCAAmB,EAAC,uCAAe,CAAC,CAAC;IAE9D,OAAO;QACL,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,KAAK;QACpC,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI;QAC7B,SAAS,EAAE,UAAU,CAAC,QAAQ;QAC9B,uBAAuB,EAAE,UAAU,CAAC,4BAA4B,IAAI,SAAS;KAC9E,CAAC;AACJ,CAAC"}
|
|
@@ -4,7 +4,12 @@ exports.CoreEnvironment = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const environment_1 = require("@rocketmakers/environment");
|
|
6
6
|
class CoreEnvironment {
|
|
7
|
+
env;
|
|
8
|
+
logLevel;
|
|
9
|
+
port;
|
|
10
|
+
requestRawBodySizeLimitBytes;
|
|
7
11
|
}
|
|
12
|
+
exports.CoreEnvironment = CoreEnvironment;
|
|
8
13
|
tslib_1.__decorate([
|
|
9
14
|
environment_1.environmentVariable.string('ENV', { optional: true }),
|
|
10
15
|
tslib_1.__metadata("design:type", String)
|
|
@@ -21,5 +26,4 @@ tslib_1.__decorate([
|
|
|
21
26
|
environment_1.environmentVariable.integer('REQUEST_RAW_BODY_SIZE_LIMIT_BYTES', { optional: true }),
|
|
22
27
|
tslib_1.__metadata("design:type", Number)
|
|
23
28
|
], CoreEnvironment.prototype, "requestRawBodySizeLimitBytes", void 0);
|
|
24
|
-
exports.CoreEnvironment = CoreEnvironment;
|
|
25
29
|
//# sourceMappingURL=environment.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.generated.js","sourceRoot":"","sources":["../../src/config/environment.generated.ts"],"names":[],"mappings":";;;;AAKA,2DAAgE;AAEhE,MAAa,eAAe;
|
|
1
|
+
{"version":3,"file":"environment.generated.js","sourceRoot":"","sources":["../../src/config/environment.generated.ts"],"names":[],"mappings":";;;;AAKA,2DAAgE;AAEhE,MAAa,eAAe;IAGxB,GAAG,CAAU;IAGb,QAAQ,CAAU;IAGlB,IAAI,CAAU;IAGd,4BAA4B,CAAU;CACzC;AAbD,0CAaC;AAVG;IADC,iCAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACzC;AAGb;IADC,iCAAmB,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDAC1C;AAGlB;IADC,iCAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC1C;AAGd;IADC,iCAAmB,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qEAC/C"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/// <reference types="bunyan" />
|
|
2
1
|
import { Logger } from '@rocketmakers/log';
|
|
3
2
|
import { IDatabaseConfig } from '@rocketmakers/orbit-core';
|
|
4
3
|
import { DataSource, DataSourceOptions } from 'typeorm';
|
|
5
4
|
import { BaseDataSourceOptions } from 'typeorm/data-source/BaseDataSourceOptions';
|
|
6
5
|
import { AppConfig } from '../config/app';
|
|
7
6
|
declare const supportedDatabases: readonly ["postgres", "mssql"];
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
7
|
+
export type TSupportedDatabases = (typeof supportedDatabases)[number];
|
|
8
|
+
type TSupportedDatabaseLogLevels<T> = T extends string[] ? T : never;
|
|
9
|
+
export type SupportedDatabaseLogLevels = TSupportedDatabaseLogLevels<DataSourceOptions['logging']>;
|
|
10
|
+
type TypeormEntities = BaseDataSourceOptions['entities'];
|
|
12
11
|
export declare function dataSourceFactory(entities: TypeormEntities, schema: string, { database, logLevels }: {
|
|
13
12
|
database: IDatabaseConfig;
|
|
14
13
|
} & Pick<AppConfig, 'logLevels'>, logger: Logger): Promise<DataSource>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionFactory.d.ts","sourceRoot":"","sources":["../../src/database/connectionFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connectionFactory.d.ts","sourceRoot":"","sources":["../../src/database/connectionFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAe,eAAe,EAAsB,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAA,MAAM,kBAAkB,gCAAiC,CAAC;AAE1D,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,KAAK,2BAA2B,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAErE,MAAM,MAAM,0BAA0B,GAAG,2BAA2B,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;AAInG,KAAK,eAAe,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;AAEzD,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,MAAM,EACd,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,EACrF,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CA4CrB"}
|
|
@@ -1,57 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataSourceFactory =
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
3
|
+
exports.dataSourceFactory = dataSourceFactory;
|
|
5
4
|
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
6
5
|
const typeorm_1 = require("typeorm");
|
|
7
6
|
const common_1 = require("../bootstrap/common");
|
|
8
7
|
const supportedDatabases = ['postgres', 'mssql'];
|
|
9
8
|
const supportedLogLevels = ['info', 'error', 'log', 'migration', 'query', 'schema', 'warn'];
|
|
10
|
-
function dataSourceFactory(entities, schema, { database, logLevels }, logger) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}).initialize();
|
|
48
|
-
}
|
|
49
|
-
default: {
|
|
50
|
-
(0, orbit_core_1.assertNever)(databaseType, 'Unsupported database type');
|
|
51
|
-
throw new orbit_core_1.UnknownServerError('Unsupported database type');
|
|
52
|
-
}
|
|
9
|
+
async function dataSourceFactory(entities, schema, { database, logLevels }, logger) {
|
|
10
|
+
const { databaseType } = database;
|
|
11
|
+
const databaseLogLevel = (0, common_1.getMultipleLogLevels)(supportedLogLevels, logLevels);
|
|
12
|
+
logger.info(`Database log levels: ${databaseLogLevel.join('|')}`);
|
|
13
|
+
switch (databaseType) {
|
|
14
|
+
case 'postgres': {
|
|
15
|
+
return new typeorm_1.DataSource({
|
|
16
|
+
extra: { application_name: schema },
|
|
17
|
+
type: databaseType,
|
|
18
|
+
entities,
|
|
19
|
+
schema,
|
|
20
|
+
logging: databaseLogLevel,
|
|
21
|
+
database: database.name,
|
|
22
|
+
host: database.hostname,
|
|
23
|
+
username: database.username,
|
|
24
|
+
password: database.password,
|
|
25
|
+
port: database.port,
|
|
26
|
+
}).initialize();
|
|
27
|
+
}
|
|
28
|
+
case 'mssql': {
|
|
29
|
+
return new typeorm_1.DataSource({
|
|
30
|
+
extra: { application_name: schema },
|
|
31
|
+
type: databaseType,
|
|
32
|
+
entities,
|
|
33
|
+
schema,
|
|
34
|
+
logging: databaseLogLevel,
|
|
35
|
+
database: database.name,
|
|
36
|
+
host: database.hostname,
|
|
37
|
+
username: database.username,
|
|
38
|
+
password: database.password,
|
|
39
|
+
port: database.port,
|
|
40
|
+
synchronize: false,
|
|
41
|
+
options: {
|
|
42
|
+
enableArithAbort: true,
|
|
43
|
+
encrypt: true,
|
|
44
|
+
},
|
|
45
|
+
}).initialize();
|
|
53
46
|
}
|
|
54
|
-
|
|
47
|
+
default: {
|
|
48
|
+
(0, orbit_core_1.assertNever)(databaseType, 'Unsupported database type');
|
|
49
|
+
throw new orbit_core_1.UnknownServerError('Unsupported database type');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
55
52
|
}
|
|
56
|
-
exports.dataSourceFactory = dataSourceFactory;
|
|
57
53
|
//# sourceMappingURL=connectionFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionFactory.js","sourceRoot":"","sources":["../../src/database/connectionFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connectionFactory.js","sourceRoot":"","sources":["../../src/database/connectionFactory.ts"],"names":[],"mappings":";;AAoBA,8CAiDC;AApED,yDAA4F;AAC5F,qCAAwD;AAGxD,gDAA2D;AAG3D,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,OAAO,CAAU,CAAC;AAQ1D,MAAM,kBAAkB,GAA+B,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ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nB,WAAW,EAAE,KAAK;gBAClB,OAAO,EAAE;oBACP,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,IAAI;iBACd;aACF,CAAC,CAAC,UAAU,EAAE,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,IAAA,wBAAW,EAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;YACvD,MAAM,IAAI,+BAAkB,CAAC,2BAA2B,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./bootstrap"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./config"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./rest"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./database"), exports);
|
|
8
7
|
tslib_1.__exportStar(require("./middleware"), exports);
|
|
9
8
|
tslib_1.__exportStar(require("./utils"), exports);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAIA,sDAA4B;AAC5B,mDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAIA,sDAA4B;AAC5B,mDAAyB;AACzB,qDAA2B;AAC3B,uDAA6B;AAC7B,kDAAwB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="bunyan" />
|
|
2
1
|
import { Logger } from '@rocketmakers/log';
|
|
3
|
-
import
|
|
2
|
+
import express from 'express';
|
|
4
3
|
export declare function errorRequestHandler(logger: Logger): express.ErrorRequestHandler;
|
|
5
4
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/middleware/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/middleware/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,OAAO,MAAM,SAAS,CAAC;AA4C9B,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAmB/E"}
|
package/lib/middleware/errors.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errorRequestHandler =
|
|
3
|
+
exports.errorRequestHandler = errorRequestHandler;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
5
6
|
const runtime_1 = require("@tsoa/runtime");
|
|
6
|
-
const HttpStatus = require("http-status-codes");
|
|
7
|
+
const HttpStatus = tslib_1.__importStar(require("http-status-codes"));
|
|
7
8
|
function isRequestTooLargeError(err) {
|
|
8
|
-
return err.status === HttpStatus.REQUEST_TOO_LONG;
|
|
9
|
+
return !!err && err.status === HttpStatus.REQUEST_TOO_LONG;
|
|
9
10
|
}
|
|
10
11
|
function wrap(message) {
|
|
11
12
|
if (message) {
|
|
@@ -16,7 +17,7 @@ function wrap(message) {
|
|
|
16
17
|
function logError(statusCode, statusMessage, logger, err, developerMessage) {
|
|
17
18
|
try {
|
|
18
19
|
const logMethod = statusCode >= 400 && statusCode < 500 ? logger.warn : logger.error;
|
|
19
|
-
logMethod.call(logger,
|
|
20
|
+
logMethod.call(logger, { stack: err.stack, ...err }, `${statusCode} ${statusMessage}${wrap(developerMessage)}`);
|
|
20
21
|
}
|
|
21
22
|
catch (error) {
|
|
22
23
|
console.error('Unable to log error in errorRequestHandler:', err);
|
|
@@ -34,6 +35,9 @@ function errorResponse(err) {
|
|
|
34
35
|
}
|
|
35
36
|
function errorRequestHandler(logger) {
|
|
36
37
|
return (err, _req, res, _next) => {
|
|
38
|
+
if (!_next) {
|
|
39
|
+
logger.info('Unexpected next function missing');
|
|
40
|
+
}
|
|
37
41
|
let devMessage;
|
|
38
42
|
try {
|
|
39
43
|
if (err instanceof runtime_1.ValidateError) {
|
|
@@ -49,5 +53,4 @@ function errorRequestHandler(logger) {
|
|
|
49
53
|
}
|
|
50
54
|
};
|
|
51
55
|
}
|
|
52
|
-
exports.errorRequestHandler = errorRequestHandler;
|
|
53
56
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/middleware/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/middleware/errors.ts"],"names":[],"mappings":";;AA+CA,kDAmBC;;AAjED,yDAA0F;AAC1F,2CAA8C;AAE9C,sEAAgD;AAShD,SAAS,sBAAsB,CAAC,GAAmC;IACjE,OAAO,CAAC,CAAC,GAAG,IAAK,GAA0B,CAAC,MAAM,KAAK,UAAU,CAAC,gBAAgB,CAAC;AACrF,CAAC;AAED,SAAS,IAAI,CAAC,OAA2B;IACvC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,KAAK,O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