typespeed 2.1.3 → 2.3.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/app/nodemon.json +5 -0
- package/{test → app}/package.json +1 -2
- package/{test → app}/src/config-development.json +1 -1
- package/{test → app}/src/config.json +3 -4
- package/{test → app}/src/custom-log.class.ts +1 -1
- package/{test → app}/src/main.ts +10 -3
- package/dist/core.decorator.js +1 -67
- package/dist/default/express-server.class.js +9 -8
- package/dist/default/node-cache.class.js +2 -1
- package/dist/default/rabbitmq.class.js +3 -2
- package/dist/default/read-write-db.class.js +8 -7
- package/dist/default/redis.class.js +3 -2
- package/dist/typespeed.js +85 -1
- package/package.json +16 -5
- package/src/core.decorator.ts +1 -68
- package/src/default/express-server.class.ts +4 -3
- package/src/default/node-cache.class.ts +2 -1
- package/src/default/rabbitmq.class.ts +2 -1
- package/src/default/read-write-db.class.ts +2 -2
- package/src/default/redis.class.ts +2 -2
- package/src/typespeed.ts +86 -1
- package/test/first-page.test.ts +45 -0
- package/tsconfig.json +2 -3
- package/test/nodemon.json +0 -6
- /package/{test → app}/node_modules/.package-lock.json +0 -0
- /package/{test → app}/node_modules/@types/body-parser/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/body-parser/README.md +0 -0
- /package/{test → app}/node_modules/@types/body-parser/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/body-parser/package.json +0 -0
- /package/{test → app}/node_modules/@types/connect/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/connect/README.md +0 -0
- /package/{test → app}/node_modules/@types/connect/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/connect/package.json +0 -0
- /package/{test → app}/node_modules/@types/express/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/express/README.md +0 -0
- /package/{test → app}/node_modules/@types/express/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/express/package.json +0 -0
- /package/{test → app}/node_modules/@types/express-serve-static-core/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/express-serve-static-core/README.md +0 -0
- /package/{test → app}/node_modules/@types/express-serve-static-core/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/express-serve-static-core/package.json +0 -0
- /package/{test → app}/node_modules/@types/mime/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/mime/Mime.d.ts +0 -0
- /package/{test → app}/node_modules/@types/mime/README.md +0 -0
- /package/{test → app}/node_modules/@types/mime/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/mime/lite.d.ts +0 -0
- /package/{test → app}/node_modules/@types/mime/package.json +0 -0
- /package/{test → app}/node_modules/@types/node/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/node/README.md +0 -0
- /package/{test → app}/node_modules/@types/node/assert/strict.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/assert.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/async_hooks.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/buffer.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/child_process.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/cluster.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/console.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/constants.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/crypto.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/dgram.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/diagnostics_channel.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/dns/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/dns.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/dom-events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/domain.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/fs/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/fs.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/globals.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/globals.global.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/http.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/http2.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/https.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/inspector.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/module.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/net.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/os.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/package.json +0 -0
- /package/{test → app}/node_modules/@types/node/path.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/perf_hooks.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/process.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/punycode.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/querystring.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/readline/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/readline.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/repl.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/stream/consumers.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/stream/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/stream/web.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/stream.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/string_decoder.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/test.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/timers/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/timers.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/tls.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/trace_events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/assert.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/buffer.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/child_process.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/cluster.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/console.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/constants.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/crypto.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/dgram.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/dns.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/domain.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/fs.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/globals.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/http.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/http2.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/https.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/inspector.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/module.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/net.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/os.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/path.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/process.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/punycode.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/querystring.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/readline.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/repl.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/stream.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/test.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/timers.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/tls.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/tty.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/url.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/util.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/v8.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/vm.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/wasi.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/zlib.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/tty.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/url.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/util.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/v8.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/vm.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/wasi.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/worker_threads.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/zlib.d.ts +0 -0
- /package/{test → app}/node_modules/@types/qs/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/qs/README.md +0 -0
- /package/{test → app}/node_modules/@types/qs/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/qs/package.json +0 -0
- /package/{test → app}/node_modules/@types/range-parser/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/range-parser/README.md +0 -0
- /package/{test → app}/node_modules/@types/range-parser/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/range-parser/package.json +0 -0
- /package/{test → app}/node_modules/@types/send/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/send/README.md +0 -0
- /package/{test → app}/node_modules/@types/send/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/send/package.json +0 -0
- /package/{test → app}/node_modules/@types/serve-static/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/serve-static/README.md +0 -0
- /package/{test → app}/node_modules/@types/serve-static/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/serve-static/package.json +0 -0
- /package/{test → app}/node_modules/colors/LICENSE +0 -0
- /package/{test → app}/node_modules/colors/README.md +0 -0
- /package/{test → app}/node_modules/colors/examples/normal-usage.js +0 -0
- /package/{test → app}/node_modules/colors/examples/safe-string.js +0 -0
- /package/{test → app}/node_modules/colors/index.d.ts +0 -0
- /package/{test → app}/node_modules/colors/lib/colors.js +0 -0
- /package/{test → app}/node_modules/colors/lib/custom/trap.js +0 -0
- /package/{test → app}/node_modules/colors/lib/custom/zalgo.js +0 -0
- /package/{test → app}/node_modules/colors/lib/extendStringPrototype.js +0 -0
- /package/{test → app}/node_modules/colors/lib/index.js +0 -0
- /package/{test → app}/node_modules/colors/lib/maps/america.js +0 -0
- /package/{test → app}/node_modules/colors/lib/maps/rainbow.js +0 -0
- /package/{test → app}/node_modules/colors/lib/maps/random.js +0 -0
- /package/{test → app}/node_modules/colors/lib/maps/zebra.js +0 -0
- /package/{test → app}/node_modules/colors/lib/styles.js +0 -0
- /package/{test → app}/node_modules/colors/lib/system/has-flag.js +0 -0
- /package/{test → app}/node_modules/colors/lib/system/supports-colors.js +0 -0
- /package/{test → app}/node_modules/colors/package.json +0 -0
- /package/{test → app}/node_modules/colors/safe.d.ts +0 -0
- /package/{test → app}/node_modules/colors/safe.js +0 -0
- /package/{test → app}/node_modules/colors/themes/generic-logging.js +0 -0
- /package/{test → app}/node_modules/dateformat/LICENSE +0 -0
- /package/{test → app}/node_modules/dateformat/Readme.md +0 -0
- /package/{test → app}/node_modules/dateformat/lib/dateformat.js +0 -0
- /package/{test → app}/node_modules/dateformat/package.json +0 -0
- /package/{test → app}/node_modules/mkdirp/CHANGELOG.md +0 -0
- /package/{test → app}/node_modules/mkdirp/LICENSE +0 -0
- /package/{test → app}/node_modules/mkdirp/bin/cmd.js +0 -0
- /package/{test → app}/node_modules/mkdirp/index.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/find-made.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/mkdirp-manual.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/mkdirp-native.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/opts-arg.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/path-arg.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/use-native.js +0 -0
- /package/{test → app}/node_modules/mkdirp/package.json +0 -0
- /package/{test → app}/node_modules/mkdirp/readme.markdown +0 -0
- /package/{test → app}/node_modules/tinytim/.travis.yml +0 -0
- /package/{test → app}/node_modules/tinytim/README.md +0 -0
- /package/{test → app}/node_modules/tinytim/index.js +0 -0
- /package/{test → app}/node_modules/tinytim/lib/index.js +0 -0
- /package/{test → app}/node_modules/tinytim/lib/tinytim.js +0 -0
- /package/{test → app}/node_modules/tinytim/package.json +0 -0
- /package/{test → app}/node_modules/tinytim/test/files/html.tim +0 -0
- /package/{test → app}/node_modules/tinytim/test/files/string.tim +0 -0
- /package/{test → app}/node_modules/tinytim/test/files/string2.tim +0 -0
- /package/{test → app}/node_modules/tinytim/test/render-file-replace.js +0 -0
- /package/{test → app}/node_modules/tinytim/test/render-replace.js +0 -0
- /package/{test → app}/node_modules/tinytim/test/tim-replace.js +0 -0
- /package/{test → app}/node_modules/tracer/README.md +0 -0
- /package/{test → app}/node_modules/tracer/lib/color_console.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/console.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/dailyfile.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/index.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/settings.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/utils.js +0 -0
- /package/{test → app}/node_modules/tracer/package.json +0 -0
- /package/{test → app}/node_modules/tracer/types/index.d.ts +0 -0
- /package/{test → app}/src/aop-test.class.ts +0 -0
- /package/{test → app}/src/config-production.json +0 -0
- /package/{test → app}/src/entities/mutil-users.class.ts +0 -0
- /package/{test → app}/src/entities/user-dto.class.ts +0 -0
- /package/{test → app}/src/first-page.class.ts +0 -0
- /package/{test → app}/src/jwt-authentication.class.ts +0 -0
- /package/{test → app}/src/second-page.class.ts +0 -0
- /package/{test → app}/src/test-database.class.ts +0 -0
- /package/{test → app}/src/test-log.class.ts +0 -0
- /package/{test → app}/src/test-mq.class.ts +0 -0
- /package/{test → app}/src/test-orm.class.ts +0 -0
- /package/{test → app}/src/test-request.class.ts +0 -0
- /package/{test → app}/src/user-model.class.ts +0 -0
- /package/{test → app}/src/views/index.html +0 -0
- /package/{test → app}/src/views/upload.html +0 -0
- /package/{test → app}/static/favicon.ico +0 -0
- /package/{test → app}/static/k.jpg +0 -0
- /package/{test → app}/tsconfig.json +0 -0
package/app/nodemon.json
ADDED
|
@@ -17,7 +17,7 @@ export default class CustomLog extends LogFactory {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
public log(message?: any, ...optionalParams: any[]) : void{
|
|
20
|
-
this.logger.log(message, ...optionalParams);
|
|
20
|
+
//this.logger.log(message, ...optionalParams);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
public error(message?: any, ...optionalParams: any[]) : void {
|
package/{test → app}/src/main.ts
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { app, log, autoware, ServerFactory } from "../../";
|
|
1
|
+
import { app, log, autoware, ServerFactory } from "../../src/typespeed";
|
|
2
2
|
//import * as basicAuth from "express-basic-auth"
|
|
3
|
+
let appServer = null;
|
|
3
4
|
|
|
4
5
|
@app
|
|
5
6
|
class Main {
|
|
@@ -11,7 +12,13 @@ class Main {
|
|
|
11
12
|
// this.server.setMiddleware(basicAuth({
|
|
12
13
|
// users: { 'admin': 'supersecret' }
|
|
13
14
|
// }));
|
|
14
|
-
this.server.start(8081);
|
|
15
|
+
appServer = this.server.start(8081);
|
|
15
16
|
log('start application');
|
|
16
17
|
}
|
|
17
|
-
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
if (appServer != null) {
|
|
22
|
+
appServer.close();
|
|
23
|
+
}
|
|
24
|
+
};
|
package/dist/core.decorator.js
CHANGED
|
@@ -1,54 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.schedule = exports.getComponent = exports.getBean = exports.autoware = exports.
|
|
3
|
+
exports.schedule = exports.getComponent = exports.getBean = exports.autoware = exports.error = exports.log = exports.resource = exports.bean = exports.component = void 0;
|
|
4
4
|
require("reflect-metadata");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const walkSync = require("walk-sync");
|
|
8
5
|
const cron = require("cron");
|
|
9
6
|
const log_factory_class_1 = require("./factory/log-factory.class");
|
|
10
|
-
let globalConfig = {};
|
|
11
7
|
const resourceObjects = new Map();
|
|
12
8
|
const beanMapper = new Map();
|
|
13
9
|
const objectMapper = new Map();
|
|
14
|
-
const coreDir = __dirname;
|
|
15
|
-
const mainPath = path.dirname(process.argv[1]);
|
|
16
|
-
const configFile = mainPath + "/config.json";
|
|
17
|
-
if (fs.existsSync(configFile)) {
|
|
18
|
-
globalConfig = JSON.parse(fs.readFileSync(configFile, "utf-8"));
|
|
19
|
-
const nodeEnv = process.env.NODE_ENV || "development";
|
|
20
|
-
const envConfigFile = mainPath + "/config-" + nodeEnv + ".json";
|
|
21
|
-
if (fs.existsSync(envConfigFile)) {
|
|
22
|
-
globalConfig = Object.assign(globalConfig, JSON.parse(fs.readFileSync(envConfigFile, "utf-8")));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function app(constructor) {
|
|
26
|
-
const coreFiles = walkSync(coreDir, { globs: ['**/*.ts'], ignore: ['**/*.d.ts', 'scaffold/**'] });
|
|
27
|
-
const mainFiles = walkSync(mainPath, { globs: ['**/*.ts'] });
|
|
28
|
-
(async function () {
|
|
29
|
-
try {
|
|
30
|
-
for (let p of coreFiles) {
|
|
31
|
-
let moduleName = p.replace(".d.ts", "").replace(".ts", "");
|
|
32
|
-
await Promise.resolve().then(() => require(coreDir + "/" + moduleName));
|
|
33
|
-
}
|
|
34
|
-
for (let p of mainFiles) {
|
|
35
|
-
let moduleName = p.replace(".d.ts", "").replace(".ts", "");
|
|
36
|
-
await Promise.resolve().then(() => require(mainPath + "/" + moduleName));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
console.error(err);
|
|
41
|
-
}
|
|
42
|
-
//log("main start")
|
|
43
|
-
const main = new constructor();
|
|
44
|
-
main["main"]();
|
|
45
|
-
}());
|
|
46
|
-
}
|
|
47
|
-
exports.app = app;
|
|
48
|
-
function config(node) {
|
|
49
|
-
return globalConfig[node] || null;
|
|
50
|
-
}
|
|
51
|
-
exports.config = config;
|
|
52
10
|
function component(constructorFunction) {
|
|
53
11
|
objectMapper.set(constructorFunction.name, new constructorFunction());
|
|
54
12
|
}
|
|
@@ -71,30 +29,6 @@ function getBean(mappingClass) {
|
|
|
71
29
|
return bean["factory"];
|
|
72
30
|
}
|
|
73
31
|
exports.getBean = getBean;
|
|
74
|
-
function value(configPath) {
|
|
75
|
-
return function (target, propertyKey) {
|
|
76
|
-
if (globalConfig === undefined) {
|
|
77
|
-
Object.defineProperty(target, propertyKey, {
|
|
78
|
-
get: () => {
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
let pathNodes = configPath.split(".");
|
|
85
|
-
let nodeValue = globalConfig;
|
|
86
|
-
for (let i = 0; i < pathNodes.length; i++) {
|
|
87
|
-
nodeValue = nodeValue[pathNodes[i]];
|
|
88
|
-
}
|
|
89
|
-
Object.defineProperty(target, propertyKey, {
|
|
90
|
-
get: () => {
|
|
91
|
-
return nodeValue;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
exports.value = value;
|
|
98
32
|
function autoware(target, propertyKey) {
|
|
99
33
|
const type = Reflect.getMetadata("design:type", target, propertyKey);
|
|
100
34
|
Object.defineProperty(target, propertyKey, {
|
|
@@ -19,6 +19,7 @@ const expressSession = require("express-session");
|
|
|
19
19
|
const connectRedis = require("connect-redis");
|
|
20
20
|
const server_factory_class_1 = require("../factory/server-factory.class");
|
|
21
21
|
const route_decorator_1 = require("../route.decorator");
|
|
22
|
+
const typespeed_1 = require("../typespeed");
|
|
22
23
|
const core_decorator_1 = require("../core.decorator");
|
|
23
24
|
const redis_class_1 = require("./redis.class");
|
|
24
25
|
const authentication_factory_class_1 = require("../factory/authentication-factory.class");
|
|
@@ -37,7 +38,7 @@ class ExpressServer extends server_factory_class_1.default {
|
|
|
37
38
|
this.app.use(middleware);
|
|
38
39
|
});
|
|
39
40
|
this.setDefaultMiddleware();
|
|
40
|
-
this.app.listen(port, () => {
|
|
41
|
+
return this.app.listen(port, () => {
|
|
41
42
|
(0, core_decorator_1.log)("server start at port: " + port);
|
|
42
43
|
});
|
|
43
44
|
}
|
|
@@ -110,31 +111,31 @@ class ExpressServer extends server_factory_class_1.default {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
__decorate([
|
|
113
|
-
(0,
|
|
114
|
+
(0, typespeed_1.value)("view"),
|
|
114
115
|
__metadata("design:type", String)
|
|
115
116
|
], ExpressServer.prototype, "view", void 0);
|
|
116
117
|
__decorate([
|
|
117
|
-
(0,
|
|
118
|
+
(0, typespeed_1.value)("static"),
|
|
118
119
|
__metadata("design:type", String)
|
|
119
120
|
], ExpressServer.prototype, "static", void 0);
|
|
120
121
|
__decorate([
|
|
121
|
-
(0,
|
|
122
|
+
(0, typespeed_1.value)("favicon"),
|
|
122
123
|
__metadata("design:type", String)
|
|
123
124
|
], ExpressServer.prototype, "favicon", void 0);
|
|
124
125
|
__decorate([
|
|
125
|
-
(0,
|
|
126
|
+
(0, typespeed_1.value)("compression"),
|
|
126
127
|
__metadata("design:type", Object)
|
|
127
128
|
], ExpressServer.prototype, "compression", void 0);
|
|
128
129
|
__decorate([
|
|
129
|
-
(0,
|
|
130
|
+
(0, typespeed_1.value)("cookie"),
|
|
130
131
|
__metadata("design:type", Object)
|
|
131
132
|
], ExpressServer.prototype, "cookieConfig", void 0);
|
|
132
133
|
__decorate([
|
|
133
|
-
(0,
|
|
134
|
+
(0, typespeed_1.value)("session"),
|
|
134
135
|
__metadata("design:type", Object)
|
|
135
136
|
], ExpressServer.prototype, "session", void 0);
|
|
136
137
|
__decorate([
|
|
137
|
-
(0,
|
|
138
|
+
(0, typespeed_1.value)("redis"),
|
|
138
139
|
__metadata("design:type", Object)
|
|
139
140
|
], ExpressServer.prototype, "redisConfig", void 0);
|
|
140
141
|
__decorate([
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const cache_factory_class_1 = require("../factory/cache-factory.class");
|
|
13
13
|
const cache = require("node-cache");
|
|
14
|
+
const typespeed_1 = require("../typespeed");
|
|
14
15
|
const core_decorator_1 = require("../core.decorator");
|
|
15
16
|
class NodeCache extends cache_factory_class_1.default {
|
|
16
17
|
constructor() {
|
|
@@ -38,7 +39,7 @@ class NodeCache extends cache_factory_class_1.default {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
__decorate([
|
|
41
|
-
(0,
|
|
42
|
+
(0, typespeed_1.value)("cache"),
|
|
42
43
|
__metadata("design:type", Object)
|
|
43
44
|
], NodeCache.prototype, "config", void 0);
|
|
44
45
|
__decorate([
|
|
@@ -11,11 +11,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.rabbitListener = exports.RabbitMQ = void 0;
|
|
13
13
|
const core_decorator_1 = require("../core.decorator");
|
|
14
|
+
const typespeed_1 = require("../typespeed");
|
|
14
15
|
const amqplib_1 = require("amqplib");
|
|
15
16
|
let rabbitConnection = null;
|
|
16
17
|
class RabbitMQ {
|
|
17
18
|
getRabbitMQ() {
|
|
18
|
-
if (!(0,
|
|
19
|
+
if (!(0, typespeed_1.config)("rabbitmq")) {
|
|
19
20
|
return null;
|
|
20
21
|
}
|
|
21
22
|
return new RabbitMQ();
|
|
@@ -48,7 +49,7 @@ __decorate([
|
|
|
48
49
|
exports.RabbitMQ = RabbitMQ;
|
|
49
50
|
async function getChannel() {
|
|
50
51
|
if (rabbitConnection === null) {
|
|
51
|
-
rabbitConnection = await (0, amqplib_1.connect)((0,
|
|
52
|
+
rabbitConnection = await (0, amqplib_1.connect)((0, typespeed_1.config)("rabbitmq"));
|
|
52
53
|
process.once('SIGINT', async () => {
|
|
53
54
|
await rabbitConnection.close();
|
|
54
55
|
});
|
|
@@ -12,10 +12,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const mysql2_1 = require("mysql2");
|
|
13
13
|
const data_source_factory_class_1 = require("../factory/data-source-factory.class");
|
|
14
14
|
const core_decorator_1 = require("../core.decorator");
|
|
15
|
+
const typespeed_1 = require("../typespeed");
|
|
15
16
|
class ReadWriteDb extends data_source_factory_class_1.default {
|
|
17
|
+
getDataSource() {
|
|
18
|
+
if (!(0, typespeed_1.config)("mysql")) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return new ReadWriteDb();
|
|
22
|
+
}
|
|
16
23
|
constructor() {
|
|
17
24
|
super();
|
|
18
|
-
const dbConfig = (0,
|
|
25
|
+
const dbConfig = (0, typespeed_1.config)("mysql");
|
|
19
26
|
if (dbConfig["master"] && dbConfig["slave"]) {
|
|
20
27
|
this.writeSession = this.getConnectionByConfig(dbConfig["master"]);
|
|
21
28
|
if (Array.isArray(dbConfig["slave"])) {
|
|
@@ -30,12 +37,6 @@ class ReadWriteDb extends data_source_factory_class_1.default {
|
|
|
30
37
|
this.readSession = [this.writeSession];
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
|
-
getDataSource() {
|
|
34
|
-
if (!(0, core_decorator_1.config)("mysql")) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
return new ReadWriteDb();
|
|
38
|
-
}
|
|
39
40
|
getConnectionByConfig(config) {
|
|
40
41
|
if (config["PoolOptions"] !== undefined) {
|
|
41
42
|
// we need pool
|
|
@@ -11,12 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const core_decorator_1 = require("../core.decorator");
|
|
13
13
|
const ioredis_1 = require("ioredis");
|
|
14
|
+
const typespeed_1 = require("../typespeed");
|
|
14
15
|
class Redis extends ioredis_1.default {
|
|
15
16
|
getRedis() {
|
|
16
|
-
if (!(0,
|
|
17
|
+
if (!(0, typespeed_1.config)("redis")) {
|
|
17
18
|
return null;
|
|
18
19
|
}
|
|
19
|
-
return new Redis((0,
|
|
20
|
+
return new Redis((0, typespeed_1.config)("redis"));
|
|
20
21
|
}
|
|
21
22
|
constructor(config) {
|
|
22
23
|
super(config);
|
package/dist/typespeed.js
CHANGED
|
@@ -14,7 +14,91 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ReadWriteDb = exports.Redis = exports.NodeCache = exports.LogDefault = exports.ExpressServer = exports.AuthenticationFactory = exports.ServerFactory = exports.DataSourceFactory = exports.CacheFactory = exports.LogFactory = void 0;
|
|
17
|
+
exports.ReadWriteDb = exports.Redis = exports.NodeCache = exports.LogDefault = exports.ExpressServer = exports.AuthenticationFactory = exports.ServerFactory = exports.DataSourceFactory = exports.CacheFactory = exports.LogFactory = exports.config = exports.value = exports.app = void 0;
|
|
18
|
+
require("reflect-metadata");
|
|
19
|
+
const fs = require("fs");
|
|
20
|
+
const path = require("path");
|
|
21
|
+
const walkSync = require("walk-sync");
|
|
22
|
+
let globalConfig = {};
|
|
23
|
+
const coreDir = __dirname;
|
|
24
|
+
const mainPath = path.dirname(getRootPath(new Error().stack.split("\n")) || process.argv[1]);
|
|
25
|
+
const configFile = mainPath + "/config.json";
|
|
26
|
+
if (fs.existsSync(configFile)) {
|
|
27
|
+
globalConfig = JSON.parse(fs.readFileSync(configFile, "utf-8"));
|
|
28
|
+
const nodeEnv = process.env.NODE_ENV || "development";
|
|
29
|
+
const envConfigFile = mainPath + "/config-" + nodeEnv + ".json";
|
|
30
|
+
if (fs.existsSync(envConfigFile)) {
|
|
31
|
+
globalConfig = Object.assign(globalConfig, JSON.parse(fs.readFileSync(envConfigFile, "utf-8")));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function app(constructor) {
|
|
35
|
+
const coreFiles = walkSync(coreDir, { globs: ['**/*.ts'], ignore: ['**/*.d.ts', 'scaffold/**'] });
|
|
36
|
+
const mainFiles = walkSync(mainPath, { globs: ['**/*.ts'] });
|
|
37
|
+
(async function () {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
try {
|
|
40
|
+
for (let p of coreFiles) {
|
|
41
|
+
let moduleName = p.replace(".d.ts", "").replace(".ts", "");
|
|
42
|
+
await (_a = coreDir + "/" + moduleName, Promise.resolve().then(() => require(_a)));
|
|
43
|
+
}
|
|
44
|
+
for (let p of mainFiles) {
|
|
45
|
+
let moduleName = p.replace(".d.ts", "").replace(".ts", "");
|
|
46
|
+
await (_b = mainPath + "/" + moduleName, Promise.resolve().then(() => require(_b)));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
console.error(err);
|
|
51
|
+
}
|
|
52
|
+
//log("main start")
|
|
53
|
+
const main = new constructor();
|
|
54
|
+
main["main"]();
|
|
55
|
+
}());
|
|
56
|
+
}
|
|
57
|
+
exports.app = app;
|
|
58
|
+
function config(node) {
|
|
59
|
+
return globalConfig[node] || null;
|
|
60
|
+
}
|
|
61
|
+
exports.config = config;
|
|
62
|
+
function value(configPath) {
|
|
63
|
+
return function (target, propertyKey) {
|
|
64
|
+
if (globalConfig === undefined) {
|
|
65
|
+
Object.defineProperty(target, propertyKey, {
|
|
66
|
+
get: () => {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
let pathNodes = configPath.split(".");
|
|
73
|
+
let nodeValue = globalConfig;
|
|
74
|
+
for (let i = 0; i < pathNodes.length; i++) {
|
|
75
|
+
nodeValue = nodeValue[pathNodes[i]];
|
|
76
|
+
}
|
|
77
|
+
Object.defineProperty(target, propertyKey, {
|
|
78
|
+
get: () => {
|
|
79
|
+
return nodeValue;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
exports.value = value;
|
|
86
|
+
function getRootPath(lines) {
|
|
87
|
+
const macths = ["at Function.Module._load", "at Module.require", "at require", "at Object.<anonymous>"];
|
|
88
|
+
let matchIndex = 0;
|
|
89
|
+
for (let line of lines) {
|
|
90
|
+
if (line.includes(macths[matchIndex])) {
|
|
91
|
+
if (matchIndex === macths.length - 1) {
|
|
92
|
+
return line.split("(")[1].split(":")[0];
|
|
93
|
+
}
|
|
94
|
+
matchIndex++;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
matchIndex = 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
18
102
|
__exportStar(require("./core.decorator"), exports);
|
|
19
103
|
__exportStar(require("./route.decorator"), exports);
|
|
20
104
|
__exportStar(require("./database.decorator"), exports);
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typespeed",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A new Framework for TypeScript.",
|
|
5
5
|
"author": "speedphp",
|
|
6
6
|
"license": "MIT License",
|
|
7
7
|
"scripts": {
|
|
8
|
+
"test": "mocha --require ts-node/register test/**/*.ts --exit",
|
|
9
|
+
"test-with-coverage": "nyc --reporter=text npm test",
|
|
10
|
+
"start": "ts-node --transpile-only app/src/main.ts",
|
|
8
11
|
"build": "tsc -p .",
|
|
9
12
|
"postbuild": "cp src/typespeed.d.ts dist/typespeed.d.ts && cp -r src/default/pages dist/default/pages && cp -r src/scaffold/templates dist/scaffold/templates",
|
|
10
13
|
"prebuild": "rm -rf dist",
|
|
@@ -30,7 +33,6 @@
|
|
|
30
33
|
"middleware"
|
|
31
34
|
],
|
|
32
35
|
"dependencies": {
|
|
33
|
-
"@types/node": "^18.0.6",
|
|
34
36
|
"commander": "^9.4.0",
|
|
35
37
|
"compression": "^1.7.4",
|
|
36
38
|
"connect-redis": "^6.1.3",
|
|
@@ -50,9 +52,18 @@
|
|
|
50
52
|
"reflect-metadata": "^0.1.13",
|
|
51
53
|
"serve-favicon": "^2.5.0",
|
|
52
54
|
"tracer": "^1.1.6",
|
|
53
|
-
"typescript": "^4.7.4",
|
|
54
55
|
"walk-sync": "^3.0.0",
|
|
55
|
-
"amqplib": "0.10.3"
|
|
56
|
-
|
|
56
|
+
"amqplib": "0.10.3"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^18.0.6",
|
|
60
|
+
"@types/express": "^4.17.13",
|
|
61
|
+
"@types/mocha": "^10.0.1",
|
|
62
|
+
"chai": "4.3.7",
|
|
63
|
+
"chai-http": "^4.4.0",
|
|
64
|
+
"mocha": "10.2.0",
|
|
65
|
+
"nyc": "^15.1.0",
|
|
66
|
+
"ts-node": "^10.9.1",
|
|
67
|
+
"typescript": "^4.9.5"
|
|
57
68
|
}
|
|
58
69
|
}
|
package/src/core.decorator.ts
CHANGED
|
@@ -1,54 +1,10 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import * as path from "path";
|
|
4
|
-
import * as walkSync from "walk-sync";
|
|
5
2
|
import * as cron from "cron";
|
|
6
3
|
import LogFactory from "./factory/log-factory.class";
|
|
7
4
|
|
|
8
|
-
let globalConfig = {};
|
|
9
5
|
const resourceObjects = new Map<string, object>();
|
|
10
6
|
const beanMapper: Map<string, any> = new Map<string, any>();
|
|
11
7
|
const objectMapper: Map<string, any> = new Map<string, any>();
|
|
12
|
-
const coreDir = __dirname;
|
|
13
|
-
const mainPath = path.dirname(process.argv[1]);
|
|
14
|
-
|
|
15
|
-
const configFile = mainPath + "/config.json";
|
|
16
|
-
if (fs.existsSync(configFile)) {
|
|
17
|
-
globalConfig = JSON.parse(fs.readFileSync(configFile, "utf-8"));
|
|
18
|
-
const nodeEnv = process.env.NODE_ENV || "development";
|
|
19
|
-
const envConfigFile = mainPath + "/config-" + nodeEnv + ".json";
|
|
20
|
-
if (fs.existsSync(envConfigFile)) {
|
|
21
|
-
globalConfig = Object.assign(globalConfig, JSON.parse(fs.readFileSync(envConfigFile, "utf-8")));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function app<T extends { new(...args: any[]): {} }>(constructor: T) {
|
|
26
|
-
const coreFiles = walkSync(coreDir, { globs: ['**/*.ts'], ignore: ['**/*.d.ts', 'scaffold/**'] });
|
|
27
|
-
const mainFiles = walkSync(mainPath, { globs: ['**/*.ts'] });
|
|
28
|
-
|
|
29
|
-
(async function () {
|
|
30
|
-
try {
|
|
31
|
-
for (let p of coreFiles) {
|
|
32
|
-
let moduleName = p.replace(".d.ts", "").replace(".ts", "");
|
|
33
|
-
await import(coreDir + "/" + moduleName);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
for (let p of mainFiles) {
|
|
37
|
-
let moduleName = p.replace(".d.ts", "").replace(".ts", "");
|
|
38
|
-
await import(mainPath + "/" + moduleName);
|
|
39
|
-
}
|
|
40
|
-
} catch (err) {
|
|
41
|
-
console.error(err);
|
|
42
|
-
}
|
|
43
|
-
//log("main start")
|
|
44
|
-
const main = new constructor();
|
|
45
|
-
main["main"]();
|
|
46
|
-
}());
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function config(node: string) {
|
|
50
|
-
return globalConfig[node] || null;
|
|
51
|
-
}
|
|
52
8
|
|
|
53
9
|
function component(constructorFunction) {
|
|
54
10
|
objectMapper.set(constructorFunction.name, new constructorFunction());
|
|
@@ -72,28 +28,6 @@ function getBean(mappingClass: Function): any {
|
|
|
72
28
|
return bean["factory"];
|
|
73
29
|
}
|
|
74
30
|
|
|
75
|
-
function value(configPath: string): any {
|
|
76
|
-
return function (target: any, propertyKey: string) {
|
|
77
|
-
if (globalConfig === undefined) {
|
|
78
|
-
Object.defineProperty(target, propertyKey, {
|
|
79
|
-
get: () => {
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
} else {
|
|
84
|
-
let pathNodes = configPath.split(".");
|
|
85
|
-
let nodeValue = globalConfig;
|
|
86
|
-
for (let i = 0; i < pathNodes.length; i++) {
|
|
87
|
-
nodeValue = nodeValue[pathNodes[i]];
|
|
88
|
-
}
|
|
89
|
-
Object.defineProperty(target, propertyKey, {
|
|
90
|
-
get: () => {
|
|
91
|
-
return nodeValue;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
31
|
|
|
98
32
|
function autoware(target: any, propertyKey: string): void {
|
|
99
33
|
const type = Reflect.getMetadata("design:type", target, propertyKey);
|
|
@@ -145,11 +79,10 @@ function error(message?: any, ...optionalParams: any[]) {
|
|
|
145
79
|
}
|
|
146
80
|
}
|
|
147
81
|
|
|
148
|
-
|
|
149
82
|
function schedule(cronTime: string | Date) {
|
|
150
83
|
return (target: any, propertyKey: string) => {
|
|
151
84
|
new cron.CronJob(cronTime, target[propertyKey]).start();
|
|
152
85
|
}
|
|
153
86
|
}
|
|
154
87
|
|
|
155
|
-
export { component, bean, resource, log,
|
|
88
|
+
export { component, bean, resource, log, error, autoware, getBean, getComponent, schedule };
|
|
@@ -8,7 +8,8 @@ import * as expressSession from "express-session";
|
|
|
8
8
|
import * as connectRedis from "connect-redis";
|
|
9
9
|
import ServerFactory from "../factory/server-factory.class";
|
|
10
10
|
import { setRouter } from "../route.decorator";
|
|
11
|
-
import {
|
|
11
|
+
import { value } from "../typespeed";
|
|
12
|
+
import { bean, log, error, autoware } from "../core.decorator";
|
|
12
13
|
import Redis from "./redis.class";
|
|
13
14
|
import AuthenticationFactory from "../factory/authentication-factory.class";
|
|
14
15
|
|
|
@@ -52,7 +53,7 @@ export default class ExpressServer extends ServerFactory {
|
|
|
52
53
|
this.middlewareList.push(middleware);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
public start(port: number) {
|
|
56
|
+
public start(port: number): any {
|
|
56
57
|
this.app.use(this.authentication.afterCompletion);
|
|
57
58
|
this.middlewareList.forEach(middleware => {
|
|
58
59
|
this.app.use(middleware);
|
|
@@ -60,7 +61,7 @@ export default class ExpressServer extends ServerFactory {
|
|
|
60
61
|
|
|
61
62
|
this.setDefaultMiddleware();
|
|
62
63
|
|
|
63
|
-
this.app.listen(port, () => {
|
|
64
|
+
return this.app.listen(port, () => {
|
|
64
65
|
log("server start at port: " + port);
|
|
65
66
|
});
|
|
66
67
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import CacheFactory from "../factory/cache-factory.class";
|
|
2
2
|
import * as cache from "node-cache";
|
|
3
|
-
import { value
|
|
3
|
+
import { value } from "../typespeed";
|
|
4
|
+
import { bean } from "../core.decorator";
|
|
4
5
|
|
|
5
6
|
export default class NodeCache extends CacheFactory {
|
|
6
7
|
private NodeCache: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createConnection, createPool } from "mysql2";
|
|
2
2
|
import DataSourceFactory from "../factory/data-source-factory.class";
|
|
3
|
-
import { bean
|
|
4
|
-
|
|
3
|
+
import { bean } from "../core.decorator";
|
|
4
|
+
import { config } from "../typespeed";
|
|
5
5
|
export default class ReadWriteDb extends DataSourceFactory {
|
|
6
6
|
private readonly readSession;
|
|
7
7
|
private readonly writeSession;
|