@estgbue/mezgeb 0.0.18 → 0.0.20
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.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
2
3
|
export declare class AuditClientModule {
|
|
3
|
-
static forRoot(
|
|
4
|
+
static forRoot(options?: {
|
|
5
|
+
dataSource?: DataSource;
|
|
6
|
+
connectionName?: string;
|
|
7
|
+
}): DynamicModule;
|
|
4
8
|
}
|
|
5
9
|
//# sourceMappingURL=client.module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.module.d.ts","sourceRoot":"","sources":["../../../libs/mezgeb/src/mezgeb/client/client.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"client.module.d.ts","sourceRoot":"","sources":["../../../libs/mezgeb/src/mezgeb/client/client.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoB,MAAM,gBAAgB,CAAC;AAMjE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,qBAaa,iBAAiB;IAC5B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,UAAU,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,aAAa;CA4B9F"}
|
|
@@ -17,19 +17,31 @@ const client_subscriber_1 = require("./client.subscriber");
|
|
|
17
17
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
18
|
const mezgeb_enum_1 = require("../mezgeb.enum");
|
|
19
19
|
let AuditClientModule = AuditClientModule_1 = class AuditClientModule {
|
|
20
|
-
static forRoot() {
|
|
20
|
+
static forRoot(options) {
|
|
21
|
+
const providers = [
|
|
22
|
+
client_subscriber_1.ClientSubscriber,
|
|
23
|
+
];
|
|
24
|
+
if (options === null || options === void 0 ? void 0 : options.dataSource) {
|
|
25
|
+
// Caller supplied a DataSource instance directly
|
|
26
|
+
providers.push({
|
|
27
|
+
provide: mezgeb_enum_1.AuditDatasource,
|
|
28
|
+
useValue: options.dataSource,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// Resolve DataSource from the host application's TypeOrmModule using the token
|
|
33
|
+
const token = (0, typeorm_1.getDataSourceToken)(options === null || options === void 0 ? void 0 : options.connectionName);
|
|
34
|
+
providers.push({
|
|
35
|
+
provide: mezgeb_enum_1.AuditDatasource,
|
|
36
|
+
useFactory: (dataSource) => dataSource,
|
|
37
|
+
inject: [token],
|
|
38
|
+
});
|
|
39
|
+
}
|
|
21
40
|
return {
|
|
22
41
|
module: AuditClientModule_1,
|
|
23
|
-
imports: [
|
|
24
|
-
providers
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
provide: mezgeb_enum_1.AuditDatasource,
|
|
28
|
-
useFactory: (dataSource) => dataSource,
|
|
29
|
-
inject: [(0, typeorm_1.getDataSourceToken)()], // 🔑 correct token
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
exports: [client_subscriber_1.ClientSubscriber],
|
|
42
|
+
imports: [],
|
|
43
|
+
providers,
|
|
44
|
+
exports: [client_subscriber_1.ClientSubscriber, mezgeb_enum_1.AuditDatasource],
|
|
33
45
|
};
|
|
34
46
|
}
|
|
35
47
|
};
|