@nest-boot/mikro-orm 7.3.2 → 7.5.0

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@mikro-orm/core");
4
+ const mysql_1 = require("@mikro-orm/mysql");
5
+ const postgresql_1 = require("@mikro-orm/postgresql");
6
+ const reflection_1 = require("@mikro-orm/reflection");
7
+ const load_config_from_env_util_1 = require("./load-config-from-env.util");
8
+ const ORIGINAL_ENV = process.env;
9
+ describe("loadConfigFromEnv", () => {
10
+ beforeEach(() => {
11
+ process.env = Object.fromEntries(Object.entries(ORIGINAL_ENV).filter(([key]) => !key.startsWith("DB_") && !key.startsWith("DATABASE_")));
12
+ });
13
+ afterAll(() => {
14
+ process.env = ORIGINAL_ENV;
15
+ });
16
+ it("should load URL-based MySQL config", async () => {
17
+ process.env.DB_URL = "mysql://user:pass@localhost:3306/app";
18
+ process.env.DB_DEBUG = "true";
19
+ await expect((0, load_config_from_env_util_1.loadConfigFromEnv)()).resolves.toMatchObject({
20
+ clientUrl: "mysql://user:pass@localhost:3306/app",
21
+ colors: false,
22
+ dataloader: core_1.DataloaderType.ALL,
23
+ debug: true,
24
+ driver: mysql_1.MySqlDriver,
25
+ entities: ["dist/**/*.entity.js"],
26
+ entitiesTs: ["src/**/*.entity.ts"],
27
+ metadataProvider: reflection_1.TsMorphMetadataProvider,
28
+ migrations: {
29
+ path: "dist/database/migrations",
30
+ pathTs: "src/database/migrations",
31
+ snapshot: false,
32
+ },
33
+ seeder: {
34
+ defaultSeeder: "DatabaseSeeder",
35
+ path: "dist/database/seeders",
36
+ pathTs: "src/database/seeders",
37
+ },
38
+ timezone: "UTC",
39
+ });
40
+ });
41
+ it("should load URL-based PostgreSQL config", async () => {
42
+ process.env.DATABASE_URL = "postgresql://user:pass@localhost:5432/app";
43
+ await expect((0, load_config_from_env_util_1.loadConfigFromEnv)()).resolves.toMatchObject({
44
+ clientUrl: "postgresql://user:pass@localhost:5432/app",
45
+ driver: postgresql_1.PostgreSqlDriver,
46
+ });
47
+ });
48
+ it("should load host-based config from aliases", async () => {
49
+ process.env.DATABASE_TYPE = "postgres";
50
+ process.env.DATABASE_HOST = "localhost";
51
+ process.env.DATABASE_PORT = "5432";
52
+ process.env.DATABASE_NAME = "app";
53
+ process.env.DATABASE_USERNAME = "user";
54
+ process.env.DATABASE_PASSWORD = "pass";
55
+ await expect((0, load_config_from_env_util_1.loadConfigFromEnv)()).resolves.toMatchObject({
56
+ dbName: "app",
57
+ driver: postgresql_1.PostgreSqlDriver,
58
+ host: "localhost",
59
+ password: "pass",
60
+ port: 5432,
61
+ user: "user",
62
+ });
63
+ });
64
+ it("should return undefined driver and port when env vars are absent", async () => {
65
+ await expect((0, load_config_from_env_util_1.loadConfigFromEnv)()).resolves.toMatchObject({
66
+ dbName: undefined,
67
+ driver: undefined,
68
+ host: undefined,
69
+ password: undefined,
70
+ port: undefined,
71
+ user: undefined,
72
+ });
73
+ });
74
+ });
75
+ //# sourceMappingURL=load-config-from-env.util.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-config-from-env.util.spec.js","sourceRoot":"","sources":["../../src/utils/load-config-from-env.util.spec.ts"],"names":[],"mappings":";;AAAA,0CAAiD;AACjD,4CAA+C;AAC/C,sDAAyD;AACzD,sDAAgE;AAEhE,2EAAgE;AAEhE,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;AAEjC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,WAAW,CAC9B,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CACjC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,K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CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QAC1D,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,UAAU,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,WAAW,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,MAAM,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,KAAK,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC;QAEvC,MAAM,MAAM,CAAC,IAAA,6CAAiB,GAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;YACvD,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,6BAAgB;YACxB,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,KAAK,IAAI,EAAE;QAChF,MAAM,MAAM,CAAC,IAAA,6CAAiB,GAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;YACvD,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nest-boot/mikro-orm",
3
- "version": "7.3.2",
3
+ "version": "7.5.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/nest-boot/nest-boot.git",
@@ -39,19 +39,19 @@
39
39
  "@nestjs/testing": "^11.1.11",
40
40
  "@types/jest": "^29.5.14",
41
41
  "@types/lodash": "^4.17.20",
42
- "@types/node": "^22.18.6",
42
+ "@types/node": "^24.12.4",
43
43
  "dataloader": "^2.2.3",
44
44
  "dotenv": "^17.2.3",
45
- "eslint": "^9.39.2",
45
+ "eslint": "^9.39.3",
46
46
  "jest": "^29.7.0",
47
47
  "reflect-metadata": "^0.2.2",
48
48
  "rxjs": "^7.8.2",
49
49
  "ts-jest": "^29.4.4",
50
50
  "typescript": "^5.9.3",
51
- "@nest-boot/eslint-config": "^7.0.3",
52
- "@nest-boot/tsconfig": "^7.0.1",
53
- "@nest-boot/eslint-plugin": "^7.0.5",
54
- "@nest-boot/request-context": "^7.4.3"
51
+ "@nest-boot/request-context": "^7.5.0",
52
+ "@nest-boot/tsconfig": "^7.1.0",
53
+ "@nest-boot/eslint-plugin": "^7.0.8",
54
+ "@nest-boot/eslint-config": "^7.1.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@mikro-orm/core": "^6.0.0",
@@ -77,9 +77,10 @@
77
77
  },
78
78
  "scripts": {
79
79
  "build": "tsc -p tsconfig.build.json",
80
- "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
80
+ "clean": "rm -rf .nx && rm -rf node_modules && rm -rf dist",
81
81
  "dev": "tsc -w -p tsconfig.build.json",
82
- "lint": "eslint \"{src,test}/**/*.ts\" --fix",
82
+ "lint": "eslint \"{src,test}/**/*.ts\"",
83
+ "lint:fix": "eslint \"{src,test}/**/*.ts\" --fix",
83
84
  "test": "jest",
84
85
  "test:cov": "jest --coverage",
85
86
  "test:watch": "jest --watch",