@nathapp/nestjs-data 1.0.0-rc.2 → 1.0.0-rc.3
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.
|
@@ -3,11 +3,12 @@ export interface TypeOrmConnectionFactory {
|
|
|
3
3
|
createModuleOptions(): Promise<TypeOrmModuleOptions> | TypeOrmModuleOptions;
|
|
4
4
|
}
|
|
5
5
|
export declare class DefaultTypeOrmConnectionFactory implements TypeOrmConnectionFactory {
|
|
6
|
-
connectionString
|
|
7
|
-
connectionName
|
|
8
|
-
connectionType
|
|
9
|
-
extraOptions
|
|
6
|
+
private connectionString;
|
|
7
|
+
private connectionName;
|
|
8
|
+
private connectionType;
|
|
9
|
+
private extraOptions;
|
|
10
10
|
constructor(connectionString: String, connectionName?: String, extraOptions?: any);
|
|
11
|
-
createExtraOptions
|
|
11
|
+
private createExtraOptions;
|
|
12
12
|
createModuleOptions(): TypeOrmModuleOptions | Promise<TypeOrmModuleOptions>;
|
|
13
|
+
static createModuleOptions(connectionString: String, connectionName?: String, extraOptions?: any): TypeOrmModuleOptions | Promise<TypeOrmModuleOptions>;
|
|
13
14
|
}
|
|
@@ -20,6 +20,9 @@ const defaultMongoExtraOptions = {
|
|
|
20
20
|
class DefaultTypeOrmConnectionFactory {
|
|
21
21
|
constructor(connectionString, connectionName, extraOptions) {
|
|
22
22
|
this.connectionString = connectionString;
|
|
23
|
+
if (!connectionString || connectionString == "") {
|
|
24
|
+
throw new Error("connectionString is missing");
|
|
25
|
+
}
|
|
23
26
|
this.connectionName = connectionName || "default";
|
|
24
27
|
const isPresent = connectionString && connectionString != "";
|
|
25
28
|
this.connectionType = (isPresent ? this.connectionString.split(":").shift() : null);
|
|
@@ -50,5 +53,9 @@ class DefaultTypeOrmConnectionFactory {
|
|
|
50
53
|
throw new Error("Connection Not Supported");
|
|
51
54
|
}
|
|
52
55
|
}
|
|
56
|
+
static createModuleOptions(connectionString, connectionName, extraOptions) {
|
|
57
|
+
const factory = new DefaultTypeOrmConnectionFactory(connectionString, connectionName, extraOptions);
|
|
58
|
+
return factory.createModuleOptions();
|
|
59
|
+
}
|
|
53
60
|
}
|
|
54
61
|
exports.DefaultTypeOrmConnectionFactory = DefaultTypeOrmConnectionFactory;
|