@bearei/server-common 1.0.6 → 1.0.8
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.
|
@@ -5,48 +5,53 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
-
var
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
8
|
+
var DatabaseModule_1;
|
|
11
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
10
|
exports.DatabaseModule = void 0;
|
|
13
11
|
const common_1 = require("@nestjs/common");
|
|
14
12
|
const config_1 = require("@nestjs/config");
|
|
15
13
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
let DatabaseModule = DatabaseModule_1 = class DatabaseModule {
|
|
15
|
+
static forRoot(options = {}) {
|
|
16
|
+
return {
|
|
17
|
+
module: DatabaseModule_1,
|
|
18
|
+
imports: [
|
|
19
|
+
config_1.ConfigModule,
|
|
20
|
+
typeorm_1.TypeOrmModule.forRootAsync({
|
|
21
|
+
imports: [config_1.ConfigModule],
|
|
22
|
+
inject: [config_1.ConfigService],
|
|
23
|
+
useFactory: async (configService) => {
|
|
24
|
+
const baseConfig = {
|
|
25
|
+
database: configService.get('database.database'),
|
|
26
|
+
entities: configService.get('database.entities'),
|
|
27
|
+
host: configService.get('database.host'),
|
|
28
|
+
logging: false,
|
|
29
|
+
password: configService.get('database.password'),
|
|
30
|
+
port: configService.get('database.port'),
|
|
31
|
+
synchronize: false,
|
|
32
|
+
type: configService.get('database.type'),
|
|
33
|
+
username: configService.get('database.username'),
|
|
34
|
+
extra: {
|
|
35
|
+
connectionTimeoutMillis: 2000,
|
|
36
|
+
idleTimeoutMillis: 30000,
|
|
37
|
+
max: 10
|
|
38
|
+
},
|
|
39
|
+
...(process.env.NODE_ENV !== 'production' && {
|
|
40
|
+
logger: 'advanced-console',
|
|
41
|
+
logging: true,
|
|
42
|
+
synchronize: true
|
|
43
|
+
}),
|
|
44
|
+
...options
|
|
45
|
+
};
|
|
46
|
+
return baseConfig;
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
18
52
|
};
|
|
19
53
|
exports.DatabaseModule = DatabaseModule;
|
|
20
|
-
exports.DatabaseModule = DatabaseModule = __decorate([
|
|
21
|
-
(0, common_1.Module)({
|
|
22
|
-
imports: [
|
|
23
|
-
typeorm_1.TypeOrmModule.forRootAsync({
|
|
24
|
-
imports: [config_1.ConfigModule],
|
|
25
|
-
useFactory: configService => ({
|
|
26
|
-
database: configService.get('database.database'),
|
|
27
|
-
entities: configService.get('database.entities'),
|
|
28
|
-
host: configService.get('database.host'),
|
|
29
|
-
migrations: [
|
|
30
|
-
node_path_1.default.join(__dirname, 'database/migrations', `*.${process.env.NODE_ENV === 'production' ? 'js' : 'ts'}`)
|
|
31
|
-
],
|
|
32
|
-
password: configService.get('database.password'),
|
|
33
|
-
port: configService.get('database.port'),
|
|
34
|
-
type: configService.get('database.type'),
|
|
35
|
-
username: configService.get('database.username'),
|
|
36
|
-
extra: {
|
|
37
|
-
connectionTimeoutMillis: 2000,
|
|
38
|
-
idleTimeoutMillis: 30000,
|
|
39
|
-
max: 10
|
|
40
|
-
},
|
|
41
|
-
...(process.env.NODE_ENV !== 'production' && {
|
|
42
|
-
logger: 'advanced-console',
|
|
43
|
-
logging: true,
|
|
44
|
-
synchronize: true
|
|
45
|
-
})
|
|
46
|
-
}),
|
|
47
|
-
inject: [config_1.ConfigService]
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
})
|
|
54
|
+
exports.DatabaseModule = DatabaseModule = DatabaseModule_1 = __decorate([
|
|
55
|
+
(0, common_1.Module)({})
|
|
51
56
|
], DatabaseModule);
|
|
52
57
|
//# sourceMappingURL=database.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.module.js","sourceRoot":"","sources":["../../src/database/database.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"database.module.js","sourceRoot":"","sources":["../../src/database/database.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,2CAA0D;AAC1D,6CAAmE;AAG5D,IAAM,cAAc,sBAApB,MAAM,cAAc;IAC1B,MAAM,CAAC,OAAO,CAAC,UAAyC,EAAE;QACzD,OAAO;YACN,MAAM,EAAE,gBAAc;YACtB,OAAO,EAAE;gBACR,qBAAY;gBACZ,uBAAa,CAAC,YAAY,CAAC;oBAC1B,OAAO,EAAE,CAAC,qBAAY,CAAC;oBACvB,MAAM,EAAE,CAAC,sBAAa,CAAC;oBACvB,UAAU,EAAE,KAAK,EAAE,aAA4B,EAAE,EAAE;wBAClD,MAAM,UAAU,GAAG;4BAClB,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC;4BAChD,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC;4BAChD,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,eAAe,CAAC;4BACxC,OAAO,EAAE,KAAK;4BACd,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC;4BAChD,IAAI,EAAE,aAAa,CAAC,GAAG,CAAS,eAAe,CAAC;4BAChD,WAAW,EAAE,KAAK;4BAClB,IAAI,EAAE,aAAa,CAAC,GAAG,CAAa,eAAe,CAAC;4BACpD,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC;4BAChD,KAAK,EAAE;gCACN,uBAAuB,EAAE,IAAI;gCAC7B,iBAAiB,EAAE,KAAK;gCACxB,GAAG,EAAE,EAAE;6BACP;4BACD,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI;gCAC5C,MAAM,EAAE,kBAAkB;gCAC1B,OAAO,EAAE,IAAI;gCACb,WAAW,EAAE,IAAI;6BACjB,CAAC;4BACF,GAAG,OAAO;yBACc,CAAA;wBAEzB,OAAO,UAAU,CAAA;oBAClB,CAAC;iBACD,CAAC;aACF;SACD,CAAA;IACF,CAAC;CACD,CAAA;AAvCY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAuC1B"}
|