(options: Partial<Options<any, any, any>>, validate = true)
| 187 | #routinesNormalised = false; |
| 188 | |
| 189 | constructor(options: Partial<Options<any, any, any>>, validate = true) { |
| 190 | if (options.dynamicImportProvider) { |
| 191 | (globalThis as any).dynamicImportProvider = options.dynamicImportProvider; |
| 192 | } |
| 193 | |
| 194 | this.#options = Utils.mergeConfig({} as Options<D, EM>, DEFAULTS, options); |
| 195 | |
| 196 | if (validate) { |
| 197 | this.validateOptions(); |
| 198 | } |
| 199 | |
| 200 | this.#options.loggerFactory ??= DefaultLogger.create; |
| 201 | this.#logger = this.#options.loggerFactory({ |
| 202 | debugMode: this.#options.debug, |
| 203 | ignoreDeprecations: this.#options.ignoreDeprecations, |
| 204 | usesReplicas: (this.#options.replicas?.length ?? 0) > 0, |
| 205 | highlighter: this.#options.highlighter, |
| 206 | writer: this.#options.logger, |
| 207 | }); |
| 208 | |
| 209 | const cf = this.#options.compiledFunctions as Record<string, unknown> | undefined; |
| 210 | |
| 211 | if (cf && cf.__version !== Utils.getORMVersion()) { |
| 212 | this.#logger.warn( |
| 213 | 'discovery', |
| 214 | `Compiled functions were generated with MikroORM v${cf.__version ?? 'unknown'}, but the current version is v${Utils.getORMVersion()}. Please regenerate with \`npx mikro-orm compile\`.`, |
| 215 | ); |
| 216 | } |
| 217 | |
| 218 | if (this.#options.driver) { |
| 219 | this.#driver = new this.#options.driver(this); |
| 220 | this.#platform = this.#driver.getPlatform() as ReturnType<D['getPlatform']>; |
| 221 | this.#platform.setConfig(this); |
| 222 | this.init(validate); |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | /** Returns the database platform instance. */ |
| 227 | getPlatform(): ReturnType<D['getPlatform']> { |
nothing calls this directly
no test coverage detected