moost 0.4.22 → 0.5.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/dist/index.cjs +10 -5
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +6 -5
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ var eventCore = require('@wooksjs/event-core');
|
|
|
5
5
|
var infact$1 = require('@prostojs/infact');
|
|
6
6
|
var logger = require('@prostojs/logger');
|
|
7
7
|
var hookable = require('hookable');
|
|
8
|
+
var wooks = require('wooks');
|
|
8
9
|
|
|
9
10
|
async function runPipes(pipes, initialValue, metas, level) {
|
|
10
11
|
let v = initialValue;
|
|
@@ -384,7 +385,7 @@ function getIterceptorHandlerFactory(interceptors, getTargetInstance, pipes, log
|
|
|
384
385
|
}
|
|
385
386
|
|
|
386
387
|
async function bindControllerMethods(options) {
|
|
387
|
-
const opts = options
|
|
388
|
+
const opts = options;
|
|
388
389
|
const { getInstance } = opts;
|
|
389
390
|
const { classConstructor } = opts;
|
|
390
391
|
const { adapters } = opts;
|
|
@@ -461,7 +462,7 @@ async function bindControllerMethods(options) {
|
|
|
461
462
|
getIterceptorHandler,
|
|
462
463
|
resolveArgs,
|
|
463
464
|
logHandler: (eventName) => {
|
|
464
|
-
options.logger.info(
|
|
465
|
+
options.logger.info(`${eventName} ${'[0m' + '[2m' + '[32m'}→ ${classConstructor.name}.${'[36m'}${method}${'[32m'}()`);
|
|
465
466
|
},
|
|
466
467
|
register(h, path, args) {
|
|
467
468
|
const data = wm.get(h);
|
|
@@ -669,10 +670,10 @@ class Moost extends hookable.Hookable {
|
|
|
669
670
|
this.provide = infact$1.createProvideRegistry([infact$1.Infact, getMoostInfact], [mate$1.Mate, getMoostMate]);
|
|
670
671
|
this.replace = {};
|
|
671
672
|
this.unregisteredControllers = [];
|
|
672
|
-
this.logger = options?.logger || getDefaultLogger('moost
|
|
673
|
-
getMoostInfact().setLogger(this.getLogger('infact'));
|
|
673
|
+
this.logger = options?.logger || getDefaultLogger(`${'[2m' + '[35m'}[moost]`);
|
|
674
|
+
getMoostInfact().setLogger(this.getLogger('[infact]'));
|
|
674
675
|
const mate = getMoostMate();
|
|
675
|
-
Object.assign(mate, { logger: this.getLogger('mate') });
|
|
676
|
+
Object.assign(mate, { logger: this.getLogger('[mate]') });
|
|
676
677
|
}
|
|
677
678
|
_fireEventStart(source) {
|
|
678
679
|
this.callHook('event-start', source);
|
|
@@ -899,6 +900,10 @@ Object.defineProperty(exports, "createReplaceRegistry", {
|
|
|
899
900
|
enumerable: true,
|
|
900
901
|
get: function () { return infact$1.createReplaceRegistry; }
|
|
901
902
|
});
|
|
903
|
+
Object.defineProperty(exports, "getGlobalWooks", {
|
|
904
|
+
enumerable: true,
|
|
905
|
+
get: function () { return wooks.getGlobalWooks; }
|
|
906
|
+
});
|
|
902
907
|
exports.Circular = Circular;
|
|
903
908
|
exports.Const = Const;
|
|
904
909
|
exports.ConstFactory = ConstFactory;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Hookable } from 'hookable';
|
|
|
7
7
|
import * as _prostojs_mate from '@prostojs/mate';
|
|
8
8
|
import { TMateParamMeta, Mate } from '@prostojs/mate';
|
|
9
9
|
export { getConstructor, isConstructor } from '@prostojs/mate';
|
|
10
|
+
export { getGlobalWooks } from 'wooks';
|
|
10
11
|
|
|
11
12
|
type TAny = any;
|
|
12
13
|
type TAnyFn = (...a: TAny[]) => unknown;
|
|
@@ -431,7 +432,7 @@ interface TMoostOptions {
|
|
|
431
432
|
* │ const app = new MyServer()
|
|
432
433
|
* │ const http = new MoostHttp()
|
|
433
434
|
* │ app.adapter(http).listen(3000, () => {
|
|
434
|
-
* │ app.getLogger('MyApp').log('Up on port 3000')
|
|
435
|
+
* │ app.getLogger('[MyApp]').log('Up on port 3000')
|
|
435
436
|
* │ })
|
|
436
437
|
* │ app.init()
|
|
437
438
|
* ```
|
|
@@ -479,7 +480,7 @@ declare class Moost extends Hookable {
|
|
|
479
480
|
* Provides application logger
|
|
480
481
|
* ```js
|
|
481
482
|
* // get logger with topic = "App"
|
|
482
|
-
* const logger = app.getLogger('App')
|
|
483
|
+
* const logger = app.getLogger('[App]')
|
|
483
484
|
* logger.log('...')
|
|
484
485
|
* ```
|
|
485
486
|
* @param topic
|
package/dist/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { Infact, createProvideRegistry, createReplaceRegistry } from '@prostojs/
|
|
|
6
6
|
export { createProvideRegistry, createReplaceRegistry } from '@prostojs/infact';
|
|
7
7
|
import { ProstoLogger, createConsoleTransort, coloredConsole } from '@prostojs/logger';
|
|
8
8
|
import { Hookable } from 'hookable';
|
|
9
|
+
export { getGlobalWooks } from 'wooks';
|
|
9
10
|
|
|
10
11
|
async function runPipes(pipes, initialValue, metas, level) {
|
|
11
12
|
let v = initialValue;
|
|
@@ -385,7 +386,7 @@ function getIterceptorHandlerFactory(interceptors, getTargetInstance, pipes, log
|
|
|
385
386
|
}
|
|
386
387
|
|
|
387
388
|
async function bindControllerMethods(options) {
|
|
388
|
-
const opts = options
|
|
389
|
+
const opts = options;
|
|
389
390
|
const { getInstance } = opts;
|
|
390
391
|
const { classConstructor } = opts;
|
|
391
392
|
const { adapters } = opts;
|
|
@@ -462,7 +463,7 @@ async function bindControllerMethods(options) {
|
|
|
462
463
|
getIterceptorHandler,
|
|
463
464
|
resolveArgs,
|
|
464
465
|
logHandler: (eventName) => {
|
|
465
|
-
options.logger.info(
|
|
466
|
+
options.logger.info(`${eventName} ${'[0m' + '[2m' + '[32m'}→ ${classConstructor.name}.${'[36m'}${method}${'[32m'}()`);
|
|
466
467
|
},
|
|
467
468
|
register(h, path, args) {
|
|
468
469
|
const data = wm.get(h);
|
|
@@ -670,10 +671,10 @@ class Moost extends Hookable {
|
|
|
670
671
|
this.provide = createProvideRegistry([Infact, getMoostInfact], [Mate, getMoostMate]);
|
|
671
672
|
this.replace = {};
|
|
672
673
|
this.unregisteredControllers = [];
|
|
673
|
-
this.logger = options?.logger || getDefaultLogger('moost
|
|
674
|
-
getMoostInfact().setLogger(this.getLogger('infact'));
|
|
674
|
+
this.logger = options?.logger || getDefaultLogger(`${'[2m' + '[35m'}[moost]`);
|
|
675
|
+
getMoostInfact().setLogger(this.getLogger('[infact]'));
|
|
675
676
|
const mate = getMoostMate();
|
|
676
|
-
Object.assign(mate, { logger: this.getLogger('mate') });
|
|
677
|
+
Object.assign(mate, { logger: this.getLogger('[mate]') });
|
|
677
678
|
}
|
|
678
679
|
_fireEventStart(source) {
|
|
679
680
|
this.callHook('event-start', source);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moost",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "moost",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"prostojs"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@prostojs/infact": "^0.2.
|
|
35
|
-
"@prostojs/mate": "^0.3.
|
|
36
|
-
"@prostojs/logger": "^0.4.
|
|
37
|
-
"@wooksjs/event-core": "^0.5.
|
|
34
|
+
"@prostojs/infact": "^0.2.4",
|
|
35
|
+
"@prostojs/mate": "^0.3.3",
|
|
36
|
+
"@prostojs/logger": "^0.4.3",
|
|
37
|
+
"@wooksjs/event-core": "^0.5.18",
|
|
38
38
|
"hookable": "^5.5.3",
|
|
39
|
-
"wooks": "^0.5.
|
|
39
|
+
"wooks": "^0.5.18"
|
|
40
40
|
},
|
|
41
41
|
"author": "Artem Maltsev",
|
|
42
42
|
"license": "MIT",
|