mythix 2.7.3 → 2.8.0
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/package.json +1 -1
- package/src/application.d.ts +3 -2
- package/src/application.js +3 -2
- package/src/cli/cli-utils.js +2 -2
- package/src/controllers/controller-module.js +1 -1
- package/src/http-server/http-server-module.js +1 -1
- package/src/models/model-module.js +1 -1
- package/src/modules/base-module.d.ts +1 -1
- package/src/modules/database-module.js +1 -1
- package/src/modules/file-watcher-module.js +1 -1
- package/src/tasks/task-module.js +1 -1
package/package.json
CHANGED
package/src/application.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Modules, ModuleClasses, BaseModuleClass } from './modules/base-module';
|
|
|
8
8
|
export declare type ApplicationClass = typeof Application;
|
|
9
9
|
|
|
10
10
|
export declare interface ApplicationOptions {
|
|
11
|
+
cli: boolean;
|
|
11
12
|
environment: string;
|
|
12
13
|
appName: string;
|
|
13
14
|
rootPath: string;
|
|
@@ -29,7 +30,7 @@ export declare interface ApplicationOptions {
|
|
|
29
30
|
database: boolean | GenericObject;
|
|
30
31
|
httpServer: boolean | GenericObject;
|
|
31
32
|
tempPath: string;
|
|
32
|
-
routeParserTypes: { [
|
|
33
|
+
routeParserTypes: { [key: string]: (value: string, param: GenericObject, index?: number) => any };
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export declare class Application {
|
|
@@ -54,7 +55,7 @@ export declare class Application {
|
|
|
54
55
|
public setConfig(options: GenericObject): Application;
|
|
55
56
|
public getApplicationName(): string;
|
|
56
57
|
public getRoutes(): GenericObject;
|
|
57
|
-
public getCustomRouteParserTypes(): { [
|
|
58
|
+
public getCustomRouteParserTypes(): { [key: string]: (value: string, param: GenericObject, index?: number) => any };
|
|
58
59
|
public createLogger(loggerOptions: LoggerOptions, LoggerClass: LoggerClass): Logger;
|
|
59
60
|
public getLogger(): Logger;
|
|
60
61
|
public start(): Promise<void>;
|
package/src/application.js
CHANGED
|
@@ -81,7 +81,6 @@ class Application extends EventEmitter {
|
|
|
81
81
|
templatesPath: Path.resolve(ROOT_PATH, 'templates'),
|
|
82
82
|
commandsPath: Path.resolve(ROOT_PATH, 'commands'),
|
|
83
83
|
tasksPath: Path.resolve(ROOT_PATH, 'tasks'),
|
|
84
|
-
modules: this.constructor.getDefaultModules(),
|
|
85
84
|
autoReload: ((_opts && _opts.environment) || process.env.NODE_ENV || 'development') === 'development',
|
|
86
85
|
exitOnShutdown: null,
|
|
87
86
|
runTasks: true,
|
|
@@ -149,6 +148,8 @@ class Application extends EventEmitter {
|
|
|
149
148
|
|
|
150
149
|
if (Nife.isEmpty(opts.tempPath))
|
|
151
150
|
opts.tempPath = Path.resolve(OS.tmpdir(), this.getApplicationName().replace(/[^\w-]/g, ''), ('' + process.pid));
|
|
151
|
+
|
|
152
|
+
opts.modules = this.constructor.getDefaultModules(this, opts);
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
getApplicationName() {
|
|
@@ -176,7 +177,7 @@ class Application extends EventEmitter {
|
|
|
176
177
|
|
|
177
178
|
for (let i = 0, il = modules.length; i < il; i++) {
|
|
178
179
|
let ModuleClass = modules[i];
|
|
179
|
-
if (typeof ModuleClass.shouldUse === 'function' && ModuleClass.shouldUse.call(this, options) === false)
|
|
180
|
+
if (typeof ModuleClass.shouldUse === 'function' && ModuleClass.shouldUse.call(ModuleClass, this, options) === false)
|
|
180
181
|
continue;
|
|
181
182
|
|
|
182
183
|
let moduleInstance = new ModuleClass(this);
|
package/src/cli/cli-utils.js
CHANGED
|
@@ -250,10 +250,10 @@ function defineCommand(_commandName, definer, _parent) {
|
|
|
250
250
|
if (typeof applicationConfig === 'function')
|
|
251
251
|
applicationConfig = applicationConfig(config, Application);
|
|
252
252
|
else if (applicationConfig)
|
|
253
|
-
applicationConfig = Nife.extend(true, { httpServer: false, autoReload: false, logger: { level: Logger.LEVEL_WARN }, runTasks: false }, applicationConfig);
|
|
253
|
+
applicationConfig = Nife.extend(true, { cli: true, httpServer: false, autoReload: false, logger: { level: Logger.LEVEL_WARN }, runTasks: false }, applicationConfig);
|
|
254
254
|
|
|
255
255
|
if (!applicationConfig)
|
|
256
|
-
applicationConfig = {
|
|
256
|
+
applicationConfig = { cli: true, ttpServer: false, autoReload: false, logger: { level: Logger.LEVEL_WARN }, runTasks: false };
|
|
257
257
|
|
|
258
258
|
let doStartApplication = (applicationConfig.autoStart !== false);
|
|
259
259
|
|
|
@@ -5,7 +5,7 @@ const { BaseModule } = require('../modules/base-module');
|
|
|
5
5
|
const { HTTPServer } = require('./http-server');
|
|
6
6
|
|
|
7
7
|
class HTTPServerModule extends BaseModule {
|
|
8
|
-
static shouldUse(options) {
|
|
8
|
+
static shouldUse(application, options) {
|
|
9
9
|
if (options.httpServer === false)
|
|
10
10
|
return false;
|
|
11
11
|
|
|
@@ -11,7 +11,7 @@ export declare class BaseModule {
|
|
|
11
11
|
public declare static fileWatcherQueueName: string;
|
|
12
12
|
|
|
13
13
|
public static getModuleName(): string;
|
|
14
|
-
public static shouldUse(options
|
|
14
|
+
public static shouldUse(application: Application, options: GenericObject): boolean;
|
|
15
15
|
|
|
16
16
|
public fileWatcherGetMonitorPaths(options?: GenericObject): Array<string>;
|
|
17
17
|
public fileWatcherHandler(options?: GenericObject): Promise<void>;
|