@mikro-orm/core 6.3.14-dev.69 → 6.3.14-dev.70
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/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.70",
|
|
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.70",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -6,7 +6,33 @@ import { Configuration, type Options } from './Configuration';
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export declare class ConfigurationLoader {
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Gets a named configuration from a set of paths
|
|
11
|
+
*
|
|
12
|
+
* @param contextName Name of context to load from the config. Used when config file exports array or factory function.
|
|
13
|
+
* @param paths Array of possible paths for a configuration file. Files will be checked in order, and the first existing one will be used.
|
|
14
|
+
* @param options Additional options to augment the final configuration with.
|
|
15
|
+
*/
|
|
16
|
+
static getConfiguration<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = EntityManager>(contextName: string, paths: string[], options?: Partial<Options>): Promise<Configuration<D, EM>>;
|
|
17
|
+
/**
|
|
18
|
+
* Gets a named configuration from a set of paths
|
|
19
|
+
*
|
|
20
|
+
* @param contextName Name of context to load from the config. Used when config file exports array or factory function. Defaults to "default".
|
|
21
|
+
* @param paths Array of possible paths for a configuration file. Files will be checked in order, and the first existing one will be used. Defaults to the output of {@link ConfigurationLoader.getConfigPaths}
|
|
22
|
+
* @param options Additional options to augment the final configuration with.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Prefer to explicitly set the parameter values. The defaults are available for backwards compatibility.
|
|
25
|
+
*/
|
|
26
|
+
static getConfiguration<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = EntityManager>(contextName?: string, paths?: string[], options?: Partial<Options>): Promise<Configuration<D, EM>>;
|
|
27
|
+
/**
|
|
28
|
+
* Gets default configuration
|
|
29
|
+
*
|
|
30
|
+
* @param validate It was used to control Configuration constructor's validate parameter. Currently is no-op. Set to `true` to enable cross-version calls that also check for --config in process.argv.
|
|
31
|
+
* @param options Additional options to augment the final configuration with.
|
|
32
|
+
*
|
|
33
|
+
* @deprecated Use the other overload of this method. This signature will be removed in v7.
|
|
34
|
+
*/
|
|
35
|
+
static getConfiguration<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = EntityManager>(validate: true, options?: Partial<Options>): Promise<Configuration<D, EM>>;
|
|
10
36
|
static getPackageConfig(basePath?: string): Dictionary;
|
|
11
37
|
static getSettings(): Settings;
|
|
12
38
|
static configPathsFromArg(): string[] | undefined;
|
|
@@ -16,7 +16,15 @@ const Utils_1 = require("./Utils");
|
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
class ConfigurationLoader {
|
|
19
|
-
static async getConfiguration(contextName = 'default', paths, options = {}) {
|
|
19
|
+
static async getConfiguration(contextName = 'default', paths = ConfigurationLoader.getConfigPaths(), options = {}) {
|
|
20
|
+
if (contextName === true || !Array.isArray(paths)) {
|
|
21
|
+
const configPathFromArg = ConfigurationLoader.configPathsFromArg();
|
|
22
|
+
const config = (await ConfigurationLoader.getConfiguration(process.env.MIKRO_ORM_CONTEXT_NAME ?? 'default', configPathFromArg ?? ConfigurationLoader.getConfigPaths(), Array.isArray(paths) ? undefined : paths));
|
|
23
|
+
if (configPathFromArg) {
|
|
24
|
+
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' });
|
|
25
|
+
}
|
|
26
|
+
return config;
|
|
27
|
+
}
|
|
20
28
|
const env = this.loadEnvironmentVars();
|
|
21
29
|
const configFinder = (cfg) => {
|
|
22
30
|
return typeof cfg === 'object' && cfg !== null && ('contextName' in cfg ? cfg.contextName === contextName : (contextName === 'default'));
|