@sprucelabs/data-stores 28.4.0 → 28.5.1
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.
@@ -8,7 +8,11 @@ export default class DatabaseFactory {
|
|
8
8
|
private static generateCacheKey;
|
9
9
|
static reset(): void;
|
10
10
|
}
|
11
|
-
export type
|
11
|
+
export type DatabaseAdapterClass = new (connectionString: string, options: DatabaseOptions) => Database;
|
12
|
+
export interface DatabaseAdapterBuilder {
|
13
|
+
Database(connectionString: string, options: DatabaseOptions): Database;
|
14
|
+
}
|
15
|
+
export type DatabaseConstructor = DatabaseAdapterClass | DatabaseAdapterBuilder;
|
12
16
|
interface DatabaseFactoryOptions {
|
13
17
|
dbName?: string;
|
14
18
|
dbConnectionString: string;
|
@@ -21,8 +21,14 @@ class DatabaseFactory {
|
|
21
21
|
if (!this.cache[cacheKey]) {
|
22
22
|
for (const [key, Adapter] of Object.entries(this.Adapters)) {
|
23
23
|
if (dbConnectionString.startsWith(key)) {
|
24
|
-
|
25
|
-
|
24
|
+
const args = [
|
25
|
+
dbConnectionString,
|
26
|
+
{ dbName },
|
27
|
+
];
|
28
|
+
database =
|
29
|
+
'Database' in Adapter
|
30
|
+
? Adapter.Database(...args)
|
31
|
+
: new Adapter(...args);
|
26
32
|
}
|
27
33
|
}
|
28
34
|
if (!database) {
|
@@ -8,7 +8,11 @@ export default class DatabaseFactory {
|
|
8
8
|
private static generateCacheKey;
|
9
9
|
static reset(): void;
|
10
10
|
}
|
11
|
-
export type
|
11
|
+
export type DatabaseAdapterClass = new (connectionString: string, options: DatabaseOptions) => Database;
|
12
|
+
export interface DatabaseAdapterBuilder {
|
13
|
+
Database(connectionString: string, options: DatabaseOptions): Database;
|
14
|
+
}
|
15
|
+
export type DatabaseConstructor = DatabaseAdapterClass | DatabaseAdapterBuilder;
|
12
16
|
interface DatabaseFactoryOptions {
|
13
17
|
dbName?: string;
|
14
18
|
dbConnectionString: string;
|
@@ -26,8 +26,14 @@ class DatabaseFactory {
|
|
26
26
|
if (!this.cache[cacheKey]) {
|
27
27
|
for (const [key, Adapter] of Object.entries(this.Adapters)) {
|
28
28
|
if (dbConnectionString.startsWith(key)) {
|
29
|
-
|
30
|
-
|
29
|
+
const args = [
|
30
|
+
dbConnectionString,
|
31
|
+
{ dbName },
|
32
|
+
];
|
33
|
+
database =
|
34
|
+
'Database' in Adapter
|
35
|
+
? Adapter.Database(...args)
|
36
|
+
: new Adapter(...args);
|
31
37
|
}
|
32
38
|
}
|
33
39
|
if (!database) {
|
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"publishConfig": {
|
4
4
|
"access": "public"
|
5
5
|
},
|
6
|
-
"version": "28.
|
6
|
+
"version": "28.5.1",
|
7
7
|
"files": [
|
8
8
|
"build/**/*",
|
9
9
|
"!build/__tests__",
|
@@ -83,7 +83,7 @@
|
|
83
83
|
"@types/lodash": "^4.17.13",
|
84
84
|
"@types/node": "^22.10.2",
|
85
85
|
"chokidar-cli": "^3.0.0",
|
86
|
-
"concurrently": "^9.1.
|
86
|
+
"concurrently": "^9.1.1",
|
87
87
|
"dotenv": "^16.4.7",
|
88
88
|
"eslint": "^9.17.0",
|
89
89
|
"eslint-config-spruce": "^11.2.26",
|