@nymphjs/driver-sqlite3 1.0.0-beta.11 → 1.0.0-beta.110

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.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nymphjs/driver-sqlite3",
3
- "version": "1.0.0-beta.11",
4
- "description": "NymphJS - SQLite3 DB Driver",
5
- "type": "commonjs",
3
+ "version": "1.0.0-beta.110",
4
+ "description": "Nymph.js - SQLite3 DB Driver",
5
+ "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "keywords": [
@@ -14,9 +14,9 @@
14
14
  "clean": "test -d dist && rm -r dist || true",
15
15
  "build": "tsc",
16
16
  "watch": "tsc --watch",
17
- "prepare": "npm run clean && npm run build",
18
- "test": "jest",
19
- "test:watch": "jest --watch"
17
+ "prepublish": "npm run clean && npm run build",
18
+ "test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest",
19
+ "test:watch": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest --watch"
20
20
  },
21
21
  "publishConfig": {
22
22
  "access": "public"
@@ -31,17 +31,20 @@
31
31
  },
32
32
  "license": "Apache-2.0",
33
33
  "dependencies": {
34
- "@nymphjs/guid": "^1.0.0-beta.11",
35
- "@nymphjs/nymph": "^1.0.0-beta.11",
36
- "better-sqlite3": "^8.1.0"
34
+ "@nymphjs/guid": "^1.0.0-beta.110",
35
+ "@nymphjs/nymph": "^1.0.0-beta.110",
36
+ "@sciactive/tokenizer": "^3.0.2",
37
+ "better-sqlite3": "^12.6.2"
37
38
  },
38
39
  "devDependencies": {
39
- "@tsconfig/recommended": "^1.0.2",
40
- "@types/better-sqlite3": "^7.6.3",
41
- "@types/jest": "^29.4.0",
42
- "jest": "^29.4.3",
43
- "ts-jest": "^29.0.5",
44
- "typescript": "^4.9.5"
40
+ "@nymphjs/tilmeld": "^1.0.0-beta.110",
41
+ "@tsconfig/recommended": "^1.0.13",
42
+ "@types/better-sqlite3": "^7.6.13",
43
+ "@types/jest": "^30.0.0",
44
+ "jest": "^30.2.0",
45
+ "ts-jest": "^29.4.6",
46
+ "ts-node": "^10.9.2",
47
+ "typescript": "^5.9.3"
45
48
  },
46
- "gitHead": "812eeec8e5b100c6f82abbae1722cfc64a167046"
49
+ "gitHead": "7bfef29456edf4959f36ee2781c81913293849ea"
47
50
  }
@@ -1,20 +1,64 @@
1
- import { Nymph, QueriesTest, UIDTest, ExportImportTest } from '@nymphjs/nymph';
1
+ import { tmpdir } from 'node:os';
2
+ import { resolve } from 'node:path';
3
+ import fs from 'node:fs';
4
+ import { Nymph, EntitiesTest, UIDTest, ExportImportTest } from '@nymphjs/nymph';
5
+ import { TilmeldTest } from '@nymphjs/tilmeld/dist/testArtifacts.js';
2
6
 
3
- import SQLite3Driver from './SQLite3Driver';
7
+ import SQLite3Driver from './SQLite3Driver.js';
4
8
 
5
- const sqliteConfig = {
6
- // filename: __dirname + '/test.db',
7
- filename: ':memory:',
8
- };
9
+ describe('SQLite3Driver In-Memory', () => {
10
+ const sqliteConfig = {
11
+ filename: ':memory:',
12
+ explicitWrite: true,
13
+ };
14
+ const nymph = new Nymph({}, new SQLite3Driver(sqliteConfig));
9
15
 
10
- const nymph = new Nymph({}, new SQLite3Driver(sqliteConfig));
16
+ if (nymph.driver.isConnected()) {
17
+ nymph.driver.disconnect();
18
+ nymph.driver.connect();
19
+ }
20
+ EntitiesTest(nymph, it);
21
+ UIDTest(nymph, it);
22
+ ExportImportTest(nymph, it);
23
+
24
+ const tilmeldNymph = nymph.clone();
25
+ TilmeldTest(tilmeldNymph, it);
26
+ });
27
+
28
+ describe('SQLite3Driver DB File', () => {
29
+ const filename = resolve(tmpdir(), `nymph-test-${Date.now()}.db`);
30
+ const sqliteConfig = {
31
+ filename,
32
+ explicitWrite: true,
33
+ };
34
+ const nymph = new Nymph({}, new SQLite3Driver(sqliteConfig));
11
35
 
12
- describe('SQLite3Driver', () => {
13
36
  if (nymph.driver.isConnected()) {
14
37
  nymph.driver.disconnect();
15
38
  nymph.driver.connect();
16
39
  }
17
- QueriesTest(nymph, it);
40
+ EntitiesTest(nymph, it);
18
41
  UIDTest(nymph, it);
19
42
  ExportImportTest(nymph, it);
43
+
44
+ const tilmeldNymph = nymph.clone();
45
+ TilmeldTest(tilmeldNymph, it);
46
+
47
+ it('cleans up the db', () => {
48
+ try {
49
+ fs.unlinkSync(filename);
50
+ } catch (e: any) {
51
+ // ignore errors
52
+ }
53
+ try {
54
+ fs.unlinkSync(filename + '-shm');
55
+ } catch (e: any) {
56
+ // ignore errors
57
+ }
58
+ try {
59
+ fs.unlinkSync(filename + '-wal');
60
+ } catch (e: any) {
61
+ // ignore errors
62
+ }
63
+ });
20
64
  });