@mikro-orm/core
Advanced tools
Comparing version 6.3.14-dev.56 to 6.3.14-dev.57
@@ -29,4 +29,6 @@ import { type Configuration, type ConnectionOptions, type DynamicPassword } from '../utils'; | ||
abstract checkConnection(): Promise<{ | ||
ok: boolean; | ||
reason?: string; | ||
ok: true; | ||
} | { | ||
ok: false; | ||
reason: string; | ||
error?: Error; | ||
@@ -33,0 +35,0 @@ }>; |
@@ -63,2 +63,8 @@ "use strict"; | ||
const debugMode = context?.debugMode ?? this.debugMode; | ||
if (namespace === 'deprecated') { | ||
const { ignoreDeprecations = false } = this.options; | ||
return Array.isArray(ignoreDeprecations) | ||
? !ignoreDeprecations.includes(context?.label ?? '') | ||
: !ignoreDeprecations; | ||
} | ||
return !!debugMode && (!Array.isArray(debugMode) || debugMode.includes(namespace)); | ||
@@ -65,0 +71,0 @@ } |
@@ -25,3 +25,3 @@ import type { AnyString, Dictionary, Highlighter } from '../typings'; | ||
} | ||
export type LoggerNamespace = 'query' | 'query-params' | 'schema' | 'discovery' | 'info'; | ||
export type LoggerNamespace = 'query' | 'query-params' | 'schema' | 'discovery' | 'info' | 'deprecated'; | ||
export interface LogContext extends Dictionary { | ||
@@ -45,2 +45,3 @@ query?: string; | ||
debugMode?: boolean | LoggerNamespace[]; | ||
ignoreDeprecations?: boolean | string[]; | ||
highlighter?: Highlighter; | ||
@@ -47,0 +48,0 @@ usesReplicas?: boolean; |
@@ -47,4 +47,6 @@ import type { EntityManagerType, IDatabaseDriver } from './drivers'; | ||
checkConnection(): Promise<{ | ||
ok: boolean; | ||
reason?: string; | ||
ok: true; | ||
} | { | ||
ok: false; | ||
reason: string; | ||
error?: Error; | ||
@@ -51,0 +53,0 @@ }>; |
@@ -32,3 +32,8 @@ "use strict"; | ||
if (!options) { | ||
options = (await utils_1.ConfigurationLoader.getConfiguration()).getAll(); | ||
const configPathFromArg = utils_1.ConfigurationLoader.configPathsFromArg(); | ||
const config = (await utils_1.ConfigurationLoader.getConfiguration(configPathFromArg ?? utils_1.ConfigurationLoader.getConfigPaths())); | ||
options = config.getAll(); | ||
if (configPathFromArg) { | ||
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' }); | ||
} | ||
} | ||
@@ -35,0 +40,0 @@ options = utils_1.Utils.mergeConfig(options, env); |
{ | ||
"name": "@mikro-orm/core", | ||
"version": "6.3.14-dev.56", | ||
"version": "6.3.14-dev.57", | ||
"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.", | ||
@@ -67,5 +67,5 @@ "main": "index.js", | ||
"globby": "11.1.0", | ||
"mikro-orm": "6.3.14-dev.56", | ||
"mikro-orm": "6.3.14-dev.57", | ||
"reflect-metadata": "0.2.2" | ||
} | ||
} |
@@ -82,2 +82,3 @@ import type { NamingStrategy } from '../naming-strategy'; | ||
debug: false; | ||
ignoreDeprecations: false; | ||
verbose: false; | ||
@@ -371,2 +372,3 @@ driverOptions: {}; | ||
debug: boolean | LoggerNamespace[]; | ||
ignoreDeprecations: boolean | string[]; | ||
highlighter: Highlighter; | ||
@@ -373,0 +375,0 @@ tsNode?: boolean; |
@@ -76,2 +76,3 @@ "use strict"; | ||
debug: false, | ||
ignoreDeprecations: false, | ||
verbose: false, | ||
@@ -154,2 +155,3 @@ driverOptions: {}, | ||
debugMode: this.options.debug, | ||
ignoreDeprecations: this.options.ignoreDeprecations, | ||
usesReplicas: (this.options.replicas?.length ?? 0) > 0, | ||
@@ -156,0 +158,0 @@ highlighter: this.options.highlighter, |
@@ -9,5 +9,6 @@ import type { EntityManager } from '../EntityManager'; | ||
export declare class ConfigurationLoader { | ||
static getConfiguration<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = EntityManager>(validate?: boolean, options?: Partial<Options>): Promise<Configuration<D, EM>>; | ||
static getConfiguration<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = EntityManager>(paths: string[], options?: Partial<Options>, validate?: boolean): Promise<Configuration<D, EM>>; | ||
static getPackageConfig(basePath?: string): Dictionary; | ||
static getSettings(): Settings; | ||
static configPathsFromArg(): string[] | undefined; | ||
static getConfigPaths(): string[]; | ||
@@ -14,0 +15,0 @@ static isESM(): boolean; |
@@ -19,6 +19,3 @@ "use strict"; | ||
class ConfigurationLoader { | ||
static async getConfiguration(validate = true, options = {}) { | ||
this.commonJSCompat(options); | ||
this.registerDotenv(options); | ||
const paths = this.getConfigPaths(); | ||
static async getConfiguration(paths, options = {}, validate = true) { | ||
const env = this.loadEnvironmentVars(); | ||
@@ -77,3 +74,3 @@ for (let path of paths) { | ||
} | ||
static getConfigPaths() { | ||
static configPathsFromArg() { | ||
const options = Utils_1.Utils.parseArgs(); | ||
@@ -84,2 +81,5 @@ const configArgName = process.env.MIKRO_ORM_CONFIG_ARG_NAME ?? 'config'; | ||
} | ||
return undefined; | ||
} | ||
static getConfigPaths() { | ||
const paths = []; | ||
@@ -86,0 +86,0 @@ const settings = ConfigurationLoader.getSettings(); |
1080571
24028
+ Addedmikro-orm@6.3.14-dev.57(transitive)
- Removedmikro-orm@6.3.14-dev.56(transitive)
Updatedmikro-orm@6.3.14-dev.57