@mikro-orm/core 6.3.14-dev.56 → 6.3.14-dev.57
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/MikroORM.d.ts +4 -2
- package/MikroORM.js +6 -1
- package/connections/Connection.d.ts +4 -2
- package/logging/DefaultLogger.js +6 -0
- package/logging/Logger.d.ts +2 -1
- package/package.json +2 -2
- package/utils/Configuration.d.ts +2 -0
- package/utils/Configuration.js +2 -0
- package/utils/ConfigurationLoader.d.ts +2 -1
- package/utils/ConfigurationLoader.js +5 -5
package/MikroORM.d.ts
CHANGED
|
@@ -44,8 +44,10 @@ export declare class MikroORM<D extends IDatabaseDriver = IDatabaseDriver, EM ex
|
|
|
44
44
|
* Checks whether the database connection is active, returns .
|
|
45
45
|
*/
|
|
46
46
|
checkConnection(): Promise<{
|
|
47
|
-
ok:
|
|
48
|
-
|
|
47
|
+
ok: true;
|
|
48
|
+
} | {
|
|
49
|
+
ok: false;
|
|
50
|
+
reason: string;
|
|
49
51
|
error?: Error;
|
|
50
52
|
}>;
|
|
51
53
|
/**
|
package/MikroORM.js
CHANGED
|
@@ -29,7 +29,12 @@ class MikroORM {
|
|
|
29
29
|
const coreVersion = await utils_1.ConfigurationLoader.checkPackageVersion();
|
|
30
30
|
const env = utils_1.ConfigurationLoader.loadEnvironmentVars();
|
|
31
31
|
if (!options) {
|
|
32
|
-
|
|
32
|
+
const configPathFromArg = utils_1.ConfigurationLoader.configPathsFromArg();
|
|
33
|
+
const config = (await utils_1.ConfigurationLoader.getConfiguration(configPathFromArg ?? utils_1.ConfigurationLoader.getConfigPaths()));
|
|
34
|
+
options = config.getAll();
|
|
35
|
+
if (configPathFromArg) {
|
|
36
|
+
config.getLogger().warn('deprecated', 'Path for config file was inferred from the command line arguments. Instead, you should set the MIKRO_ORM_CLI_CONFIG environment variable to specify the path, or if you really must use the command line arguments, import the config manually based on them, and pass it to init.', { label: 'D0001' });
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
39
|
options = utils_1.Utils.mergeConfig(options, env);
|
|
35
40
|
await utils_1.ConfigurationLoader.commonJSCompat(options);
|
package/logging/DefaultLogger.js
CHANGED
|
@@ -60,6 +60,12 @@ class DefaultLogger {
|
|
|
60
60
|
return context.enabled;
|
|
61
61
|
}
|
|
62
62
|
const debugMode = context?.debugMode ?? this.debugMode;
|
|
63
|
+
if (namespace === 'deprecated') {
|
|
64
|
+
const { ignoreDeprecations = false } = this.options;
|
|
65
|
+
return Array.isArray(ignoreDeprecations)
|
|
66
|
+
? !ignoreDeprecations.includes(context?.label ?? '')
|
|
67
|
+
: !ignoreDeprecations;
|
|
68
|
+
}
|
|
63
69
|
return !!debugMode && (!Array.isArray(debugMode) || debugMode.includes(namespace));
|
|
64
70
|
}
|
|
65
71
|
/**
|
package/logging/Logger.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface Logger {
|
|
|
22
22
|
setDebugMode(debugMode: boolean | LoggerNamespace[]): void;
|
|
23
23
|
isEnabled(namespace: LoggerNamespace, context?: LogContext): boolean;
|
|
24
24
|
}
|
|
25
|
-
export type LoggerNamespace = 'query' | 'query-params' | 'schema' | 'discovery' | 'info';
|
|
25
|
+
export type LoggerNamespace = 'query' | 'query-params' | 'schema' | 'discovery' | 'info' | 'deprecated';
|
|
26
26
|
export interface LogContext extends Dictionary {
|
|
27
27
|
query?: string;
|
|
28
28
|
label?: string;
|
|
@@ -41,6 +41,7 @@ export interface LogContext extends Dictionary {
|
|
|
41
41
|
export interface LoggerOptions {
|
|
42
42
|
writer: (message: string) => void;
|
|
43
43
|
debugMode?: boolean | LoggerNamespace[];
|
|
44
|
+
ignoreDeprecations?: boolean | string[];
|
|
44
45
|
highlighter?: Highlighter;
|
|
45
46
|
usesReplicas?: boolean;
|
|
46
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.3.14-dev.
|
|
3
|
+
"version": "6.3.14-dev.57",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"esprima": "4.0.1",
|
|
65
65
|
"fs-extra": "11.2.0",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.3.14-dev.
|
|
67
|
+
"mikro-orm": "6.3.14-dev.57",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/utils/Configuration.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
|
|
|
79
79
|
ensureIndexes: false;
|
|
80
80
|
batchSize: number;
|
|
81
81
|
debug: false;
|
|
82
|
+
ignoreDeprecations: false;
|
|
82
83
|
verbose: false;
|
|
83
84
|
driverOptions: {};
|
|
84
85
|
migrations: {
|
|
@@ -367,6 +368,7 @@ export interface MikroORMOptions<D extends IDatabaseDriver = IDatabaseDriver, EM
|
|
|
367
368
|
findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
|
|
368
369
|
findExactlyOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
|
|
369
370
|
debug: boolean | LoggerNamespace[];
|
|
371
|
+
ignoreDeprecations: boolean | string[];
|
|
370
372
|
highlighter: Highlighter;
|
|
371
373
|
tsNode?: boolean;
|
|
372
374
|
baseDir: string;
|
package/utils/Configuration.js
CHANGED
|
@@ -73,6 +73,7 @@ class Configuration {
|
|
|
73
73
|
ensureIndexes: false,
|
|
74
74
|
batchSize: 300,
|
|
75
75
|
debug: false,
|
|
76
|
+
ignoreDeprecations: false,
|
|
76
77
|
verbose: false,
|
|
77
78
|
driverOptions: {},
|
|
78
79
|
migrations: {
|
|
@@ -150,6 +151,7 @@ class Configuration {
|
|
|
150
151
|
this.options.loggerFactory ??= logging_1.DefaultLogger.create;
|
|
151
152
|
this.logger = this.options.loggerFactory({
|
|
152
153
|
debugMode: this.options.debug,
|
|
154
|
+
ignoreDeprecations: this.options.ignoreDeprecations,
|
|
153
155
|
usesReplicas: (this.options.replicas?.length ?? 0) > 0,
|
|
154
156
|
highlighter: this.options.highlighter,
|
|
155
157
|
writer: this.options.logger,
|
|
@@ -6,9 +6,10 @@ import { Configuration, type Options } from './Configuration';
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export declare class ConfigurationLoader {
|
|
9
|
-
static getConfiguration<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = EntityManager>(
|
|
9
|
+
static getConfiguration<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = EntityManager>(paths: string[], options?: Partial<Options>, validate?: boolean): Promise<Configuration<D, EM>>;
|
|
10
10
|
static getPackageConfig(basePath?: string): Dictionary;
|
|
11
11
|
static getSettings(): Settings;
|
|
12
|
+
static configPathsFromArg(): string[] | undefined;
|
|
12
13
|
static getConfigPaths(): string[];
|
|
13
14
|
static isESM(): boolean;
|
|
14
15
|
static registerTsNode(configPath?: string): boolean;
|
|
@@ -16,10 +16,7 @@ const Utils_1 = require("./Utils");
|
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
class ConfigurationLoader {
|
|
19
|
-
static async getConfiguration(
|
|
20
|
-
this.commonJSCompat(options);
|
|
21
|
-
this.registerDotenv(options);
|
|
22
|
-
const paths = this.getConfigPaths();
|
|
19
|
+
static async getConfiguration(paths, options = {}, validate = true) {
|
|
23
20
|
const env = this.loadEnvironmentVars();
|
|
24
21
|
for (let path of paths) {
|
|
25
22
|
path = Utils_1.Utils.absolutePath(path);
|
|
@@ -73,12 +70,15 @@ class ConfigurationLoader {
|
|
|
73
70
|
}
|
|
74
71
|
return settings;
|
|
75
72
|
}
|
|
76
|
-
static
|
|
73
|
+
static configPathsFromArg() {
|
|
77
74
|
const options = Utils_1.Utils.parseArgs();
|
|
78
75
|
const configArgName = process.env.MIKRO_ORM_CONFIG_ARG_NAME ?? 'config';
|
|
79
76
|
if (options[configArgName]) {
|
|
80
77
|
return [options[configArgName]];
|
|
81
78
|
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
static getConfigPaths() {
|
|
82
82
|
const paths = [];
|
|
83
83
|
const settings = ConfigurationLoader.getSettings();
|
|
84
84
|
if (process.env.MIKRO_ORM_CLI_CONFIG) {
|