@nattyjs/common 0.0.1-beta.14 → 0.0.1-beta.16

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 CHANGED
@@ -618,7 +618,7 @@ class AbstractRunner {
618
618
  "data",
619
619
  (data) => {
620
620
  const writeData = data.toString().replace(/\r\n|\n/, "");
621
- if (writeData.indexOf("[NATTYJS]") > -1) {
621
+ if (writeData.indexOf("[NATTYJS]") > -1 || writeData.indexOf("[NATTYJS:LOGGER]") > -1) {
622
622
  console.log(writeData);
623
623
  }
624
624
  }
@@ -646,6 +646,32 @@ async function getPort() {
646
646
  return port;
647
647
  }
648
648
 
649
+ const reset = "\x1B[0m";
650
+ const NATTY_LOGGER = `[NATTYJS:LOGGER] `;
651
+ const log = {
652
+ green: (text) => console.log("\x1B[32m" + NATTY_LOGGER + text + reset),
653
+ red: (text) => console.log("\x1B[31m" + NATTY_LOGGER + text + reset),
654
+ blue: (text) => console.log("\x1B[34m" + NATTY_LOGGER + text + reset),
655
+ yellow: (text) => console.log("\x1B[33m" + NATTY_LOGGER + text + reset)
656
+ };
657
+ class AbstractConsoleLogger {
658
+ log(message) {
659
+ log.yellow(message);
660
+ }
661
+ info(message) {
662
+ log.blue(message);
663
+ }
664
+ warn(message) {
665
+ log.yellow(message);
666
+ }
667
+ error(message) {
668
+ log.red(message);
669
+ }
670
+ }
671
+
672
+ class ConsoleLogger extends AbstractConsoleLogger {
673
+ }
674
+
649
675
  exports.ALLOW_METHODS = ALLOW_METHODS;
650
676
  exports.AbstractRunner = AbstractRunner;
651
677
  exports.ActionFilter = ActionFilter;
@@ -654,6 +680,7 @@ exports.AuthorizationFilter = AuthorizationFilter;
654
680
  exports.BACK_SLASH_REGEX = BACK_SLASH_REGEX;
655
681
  exports.BLANK = BLANK;
656
682
  exports.CONTROLLER = CONTROLLER;
683
+ exports.ConsoleLogger = ConsoleLogger;
657
684
  exports.DEFAULT_ACTIONS = DEFAULT_ACTIONS;
658
685
  exports.DEFAULT_CHILD_PATH = DEFAULT_CHILD_PATH;
659
686
  exports.DELETE = DELETE;
package/dist/index.d.ts CHANGED
@@ -264,4 +264,14 @@ declare function registerType(type: TypesInfo): void;
264
264
 
265
265
  declare function getPort(): Promise<number>;
266
266
 
267
- export { ALLOW_METHODS, AbstractRunner, ActionFilter, AuthenticationFilter, AuthorizationFilter, BACK_SLASH_REGEX, BLANK, CONTROLLER, Claim, ClassType, DEFAULT_ACTIONS, DEFAULT_CHILD_PATH, DELETE, ENVIRONMENTS, ExceptionFilter, FrameworkType, GET, GlobalConfig, HTTP_METHOD_ROUTES, IActionExecutedContext, IActionExecutingContext, IExecutionContext, IGNORE_METHODS, List, MetaConfigProps, Middleware, NattyAppConfig, NattyCliConfig, NattyConfig, POST, PUT, RIGHT_SLASH, ROUTE_INSTANCES, ROUTE_METHODS, ROUTE_PATHS, TS_EXTENSION, UserIdentity, commonContainer, createPath, createTestServer, getPath, getPort, isConstructor, isEqual, isFunction, isObject, readEnv, readEnvKey, registerType, typeContainer };
267
+ declare abstract class AbstractConsoleLogger {
268
+ log(message: any): void;
269
+ info(message: any): void;
270
+ warn(message: any): void;
271
+ error(message: any): void;
272
+ }
273
+
274
+ declare class ConsoleLogger extends AbstractConsoleLogger {
275
+ }
276
+
277
+ export { ALLOW_METHODS, AbstractRunner, ActionFilter, AuthenticationFilter, AuthorizationFilter, BACK_SLASH_REGEX, BLANK, CONTROLLER, Claim, ClassType, ConsoleLogger, DEFAULT_ACTIONS, DEFAULT_CHILD_PATH, DELETE, ENVIRONMENTS, ExceptionFilter, FrameworkType, GET, GlobalConfig, HTTP_METHOD_ROUTES, IActionExecutedContext, IActionExecutingContext, IExecutionContext, IGNORE_METHODS, List, MetaConfigProps, Middleware, NattyAppConfig, NattyCliConfig, NattyConfig, POST, PUT, RIGHT_SLASH, ROUTE_INSTANCES, ROUTE_METHODS, ROUTE_PATHS, TS_EXTENSION, UserIdentity, commonContainer, createPath, createTestServer, getPath, getPort, isConstructor, isEqual, isFunction, isObject, readEnv, readEnvKey, registerType, typeContainer };
package/dist/index.mjs CHANGED
@@ -601,7 +601,7 @@ class AbstractRunner {
601
601
  "data",
602
602
  (data) => {
603
603
  const writeData = data.toString().replace(/\r\n|\n/, "");
604
- if (writeData.indexOf("[NATTYJS]") > -1) {
604
+ if (writeData.indexOf("[NATTYJS]") > -1 || writeData.indexOf("[NATTYJS:LOGGER]") > -1) {
605
605
  console.log(writeData);
606
606
  }
607
607
  }
@@ -629,4 +629,30 @@ async function getPort() {
629
629
  return port;
630
630
  }
631
631
 
632
- export { ALLOW_METHODS, AbstractRunner, ActionFilter, AuthenticationFilter, AuthorizationFilter, BACK_SLASH_REGEX, BLANK, CONTROLLER, DEFAULT_ACTIONS, DEFAULT_CHILD_PATH, DELETE, ENVIRONMENTS, ExceptionFilter, FrameworkType, GET, HTTP_METHOD_ROUTES, IGNORE_METHODS, List, MetaConfigProps, Middleware, POST, PUT, RIGHT_SLASH, ROUTE_INSTANCES, ROUTE_METHODS, ROUTE_PATHS, TS_EXTENSION, UserIdentity, commonContainer, createPath, createTestServer, getPath, getPort, isConstructor, isEqual, isFunction, isObject, readEnv, readEnvKey, registerType, typeContainer };
632
+ const reset = "\x1B[0m";
633
+ const NATTY_LOGGER = `[NATTYJS:LOGGER] `;
634
+ const log = {
635
+ green: (text) => console.log("\x1B[32m" + NATTY_LOGGER + text + reset),
636
+ red: (text) => console.log("\x1B[31m" + NATTY_LOGGER + text + reset),
637
+ blue: (text) => console.log("\x1B[34m" + NATTY_LOGGER + text + reset),
638
+ yellow: (text) => console.log("\x1B[33m" + NATTY_LOGGER + text + reset)
639
+ };
640
+ class AbstractConsoleLogger {
641
+ log(message) {
642
+ log.yellow(message);
643
+ }
644
+ info(message) {
645
+ log.blue(message);
646
+ }
647
+ warn(message) {
648
+ log.yellow(message);
649
+ }
650
+ error(message) {
651
+ log.red(message);
652
+ }
653
+ }
654
+
655
+ class ConsoleLogger extends AbstractConsoleLogger {
656
+ }
657
+
658
+ export { ALLOW_METHODS, AbstractRunner, ActionFilter, AuthenticationFilter, AuthorizationFilter, BACK_SLASH_REGEX, BLANK, CONTROLLER, ConsoleLogger, DEFAULT_ACTIONS, DEFAULT_CHILD_PATH, DELETE, ENVIRONMENTS, ExceptionFilter, FrameworkType, GET, HTTP_METHOD_ROUTES, IGNORE_METHODS, List, MetaConfigProps, Middleware, POST, PUT, RIGHT_SLASH, ROUTE_INSTANCES, ROUTE_METHODS, ROUTE_PATHS, TS_EXTENSION, UserIdentity, commonContainer, createPath, createTestServer, getPath, getPort, isConstructor, isEqual, isFunction, isObject, readEnv, readEnvKey, registerType, typeContainer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nattyjs/common",
3
- "version": "0.0.1-beta.14",
3
+ "version": "0.0.1-beta.16",
4
4
  "description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM",
5
5
  "keywords": [],
6
6
  "author": "ajayojha <ojhaajay@outlook.com>",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "20.3.1",
24
- "@nattyjs/types": "0.0.1-beta.14",
24
+ "@nattyjs/types": "0.0.1-beta.16",
25
25
  "unbuild": "1.2.1"
26
26
  }
27
27
  }