@sprucelabs/data-stores 26.3.5 → 26.3.7

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.
@@ -14,7 +14,7 @@ import DatabaseFactory from '../factories/DatabaseFactory.js';
14
14
  const MEMORY = 'memory://';
15
15
  class DatabaseFixture {
16
16
  constructor(options) {
17
- const { dbConnectionString = MEMORY, dbName } = Object.assign(Object.assign({}, DatabaseFixture.defaultOptions), options);
17
+ const { dbConnectionString = MEMORY, dbName = 'memory' } = Object.assign(Object.assign({}, DatabaseFixture.defaultOptions), options);
18
18
  const missing = [];
19
19
  if (!dbConnectionString) {
20
20
  missing.push('dbConnectionString');
@@ -9,4 +9,8 @@ export default class AbstractDatabaseTest extends AbstractSpruceTest {
9
9
  protected static afterEach(): Promise<void>;
10
10
  protected static DatabaseFixture(options?: DatabaseFixtureOptions): Promise<DatabaseFixture>;
11
11
  protected static connectToDatabase(): Promise<Database>;
12
+ protected static DatabaseConnection(): Promise<{
13
+ dbFixture: DatabaseFixture;
14
+ db: Database;
15
+ }>;
12
16
  }
@@ -42,14 +42,20 @@ class AbstractDatabaseTest extends AbstractSpruceTest {
42
42
  static connectToDatabase() {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
44
  if (!this.db) {
45
- const dbFixture = yield this.DatabaseFixture();
46
- const db = yield dbFixture.connectToDatabase();
45
+ const { dbFixture, db } = yield this.DatabaseConnection();
47
46
  this.DB_NAME = this.shouldUseInMemoryDatabase ? '' : dbFixture.getDbName();
48
47
  this.db = db;
49
48
  }
50
49
  return this.db;
51
50
  });
52
51
  }
52
+ static DatabaseConnection() {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const dbFixture = yield this.DatabaseFixture();
55
+ const db = yield dbFixture.connectToDatabase();
56
+ return { dbFixture, db };
57
+ });
58
+ }
53
59
  }
54
60
  AbstractDatabaseTest.shouldUseInMemoryDatabase = true;
55
61
  export default AbstractDatabaseTest;
@@ -10,7 +10,7 @@ const DatabaseFactory_1 = __importDefault(require("../factories/DatabaseFactory"
10
10
  const MEMORY = 'memory://';
11
11
  class DatabaseFixture {
12
12
  constructor(options) {
13
- const { dbConnectionString = MEMORY, dbName } = Object.assign(Object.assign({}, DatabaseFixture.defaultOptions), options);
13
+ const { dbConnectionString = MEMORY, dbName = 'memory' } = Object.assign(Object.assign({}, DatabaseFixture.defaultOptions), options);
14
14
  const missing = [];
15
15
  if (!dbConnectionString) {
16
16
  missing.push('dbConnectionString');
@@ -9,4 +9,8 @@ export default class AbstractDatabaseTest extends AbstractSpruceTest {
9
9
  protected static afterEach(): Promise<void>;
10
10
  protected static DatabaseFixture(options?: DatabaseFixtureOptions): Promise<DatabaseFixture>;
11
11
  protected static connectToDatabase(): Promise<Database>;
12
+ protected static DatabaseConnection(): Promise<{
13
+ dbFixture: DatabaseFixture;
14
+ db: Database;
15
+ }>;
12
16
  }
@@ -25,13 +25,17 @@ class AbstractDatabaseTest extends test_utils_1.default {
25
25
  }
26
26
  static async connectToDatabase() {
27
27
  if (!this.db) {
28
- const dbFixture = await this.DatabaseFixture();
29
- const db = await dbFixture.connectToDatabase();
28
+ const { dbFixture, db } = await this.DatabaseConnection();
30
29
  this.DB_NAME = this.shouldUseInMemoryDatabase ? '' : dbFixture.getDbName();
31
30
  this.db = db;
32
31
  }
33
32
  return this.db;
34
33
  }
34
+ static async DatabaseConnection() {
35
+ const dbFixture = await this.DatabaseFixture();
36
+ const db = await dbFixture.connectToDatabase();
37
+ return { dbFixture, db };
38
+ }
35
39
  }
36
40
  AbstractDatabaseTest.shouldUseInMemoryDatabase = true;
37
41
  exports.default = AbstractDatabaseTest;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "26.3.5",
6
+ "version": "26.3.7",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "!build/__tests__",
@@ -68,23 +68,23 @@
68
68
  "upgrade.packages.test": "yarn upgrade.packages.all && yarn lint && yarn build.dev && yarn test"
69
69
  },
70
70
  "dependencies": {
71
- "@sprucelabs/error": "^5.1.55",
71
+ "@sprucelabs/error": "^5.1.56",
72
72
  "@sprucelabs/globby": "^1.0.3",
73
- "@sprucelabs/schema": "^29.3.3",
74
- "@sprucelabs/spruce-skill-utils": "^30.1.48",
73
+ "@sprucelabs/schema": "^29.3.4",
74
+ "@sprucelabs/spruce-skill-utils": "^30.1.49",
75
75
  "just-clone": "^6.2.0",
76
76
  "lodash": "^4.17.21",
77
77
  "mongodb": "^6.3.0",
78
78
  "nedb": "^1.8.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@sprucelabs/esm-postbuild": "^5.0.112",
82
- "@sprucelabs/jest-json-reporter": "^7.0.136",
81
+ "@sprucelabs/esm-postbuild": "^5.0.113",
82
+ "@sprucelabs/jest-json-reporter": "^7.0.137",
83
83
  "@sprucelabs/jest-sheets-reporter": "^3.0.26",
84
- "@sprucelabs/resolve-path-aliases": "^1.1.273",
84
+ "@sprucelabs/resolve-path-aliases": "^1.1.274",
85
85
  "@sprucelabs/semantic-release": "^4.0.8",
86
- "@sprucelabs/test": "^8.0.37",
87
- "@sprucelabs/test-utils": "^4.0.89",
86
+ "@sprucelabs/test": "^8.0.38",
87
+ "@sprucelabs/test-utils": "^4.0.90",
88
88
  "@types/lodash": "^4.14.202",
89
89
  "@types/nedb": "^1.8.16",
90
90
  "@types/node": "^20.10.4",
@@ -98,7 +98,7 @@
98
98
  "prettier": "^3.1.1",
99
99
  "ts-node": "^10.9.2",
100
100
  "tsc-watch": "^6.0.4",
101
- "tsconfig-paths": "^3.15.0",
101
+ "tsconfig-paths": "^4.2.0",
102
102
  "typescript": "^5.3.3"
103
103
  },
104
104
  "engines": {