@stonyx/orm 0.3.2-beta.51 → 0.3.2-beta.53

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/main.js CHANGED
@@ -54,6 +54,10 @@ export default class Orm {
54
54
  Orm.instance = this;
55
55
  }
56
56
  async init() {
57
+ // Self-register so log.db works even when @stonyx/orm is in the
58
+ // consumer's `dependencies` (stonyx loader only merges devDependencies).
59
+ const { logColor = 'white', logMethod = 'db' } = config.orm;
60
+ log.defineType(logMethod, logColor);
57
61
  const { paths, restServer } = config.orm;
58
62
  const promises = ['Model', 'Serializer', 'Transform'].map(type => {
59
63
  const lowerCaseType = type.toLowerCase();
@@ -49,6 +49,8 @@ export interface OrmSection {
49
49
  mysql?: OrmMysqlConfig;
50
50
  postgres?: OrmPostgresConfig;
51
51
  timescale?: OrmPostgresConfig;
52
+ logColor?: string;
53
+ logMethod?: string;
52
54
  [key: string]: unknown;
53
55
  }
54
56
  export interface OrmConfig {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "stonyx-async",
5
5
  "stonyx-module"
6
6
  ],
7
- "version": "0.3.2-beta.51",
7
+ "version": "0.3.2-beta.53",
8
8
  "description": "",
9
9
  "main": "dist/index.js",
10
10
  "type": "module",
package/src/main.ts CHANGED
@@ -90,6 +90,11 @@ export default class Orm {
90
90
  }
91
91
 
92
92
  async init(): Promise<void> {
93
+ // Self-register so log.db works even when @stonyx/orm is in the
94
+ // consumer's `dependencies` (stonyx loader only merges devDependencies).
95
+ const { logColor = 'white', logMethod = 'db' } = config.orm;
96
+ log.defineType(logMethod, logColor);
97
+
93
98
  const { paths, restServer } = config.orm;
94
99
 
95
100
  const promises: Promise<unknown>[] = ['Model', 'Serializer', 'Transform'].map(type => {
@@ -55,6 +55,8 @@ export interface OrmSection {
55
55
  mysql?: OrmMysqlConfig;
56
56
  postgres?: OrmPostgresConfig;
57
57
  timescale?: OrmPostgresConfig;
58
+ logColor?: string;
59
+ logMethod?: string;
58
60
  [key: string]: unknown;
59
61
  }
60
62
 
@@ -5,7 +5,13 @@ declare module 'stonyx/config' {
5
5
  }
6
6
 
7
7
  declare module 'stonyx/log' {
8
- const log: Record<string, ((...args: unknown[]) => void) | undefined>;
8
+ interface Log {
9
+ db(message: string): void;
10
+ error(message: string, ...args: unknown[]): void;
11
+ defineType(type: string, setting: string, options?: Record<string, unknown> | null): void;
12
+ [key: string]: ((...args: unknown[]) => void) | undefined;
13
+ }
14
+ const log: Log;
9
15
  export default log;
10
16
  }
11
17