@sprucelabs/data-stores 18.0.8 → 18.0.9

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,7 +3,7 @@ export default class DatabaseFactory {
3
3
  private static cache;
4
4
  private constructor();
5
5
  static Database(options: {
6
- dbName: string;
6
+ dbName?: string;
7
7
  dbConnectionString: string;
8
8
  }): Database;
9
9
  private static generateCacheKey;
@@ -27,7 +27,10 @@ export default class DatabaseFactory {
27
27
  }
28
28
  static generateCacheKey(options) {
29
29
  if (!options.dbName && options.dbConnectionString.includes('memory')) {
30
- options.dbName = 'memory';
30
+ const key = Object.keys(this.cache).find((k) => k.startsWith('memory'));
31
+ if (key) {
32
+ return key;
33
+ }
31
34
  }
32
35
  return options.dbName + options.dbConnectionString;
33
36
  }
@@ -3,7 +3,7 @@ export default class DatabaseFactory {
3
3
  private static cache;
4
4
  private constructor();
5
5
  static Database(options: {
6
- dbName: string;
6
+ dbName?: string;
7
7
  dbConnectionString: string;
8
8
  }): Database;
9
9
  private static generateCacheKey;
@@ -32,7 +32,10 @@ class DatabaseFactory {
32
32
  }
33
33
  static generateCacheKey(options) {
34
34
  if (!options.dbName && options.dbConnectionString.includes('memory')) {
35
- options.dbName = 'memory';
35
+ const key = Object.keys(this.cache).find((k) => k.startsWith('memory'));
36
+ if (key) {
37
+ return key;
38
+ }
36
39
  }
37
40
  return options.dbName + options.dbConnectionString;
38
41
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "18.0.8",
6
+ "version": "18.0.9",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "!build/__tests__",