@photostructure/sqlite 0.3.0 → 0.5.0

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +65 -16
  2. package/README.md +5 -10
  3. package/binding.gyp +2 -2
  4. package/dist/index.cjs +314 -11
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +346 -89
  7. package/dist/index.d.mts +346 -89
  8. package/dist/index.d.ts +346 -89
  9. package/dist/index.mjs +311 -10
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +72 -63
  12. package/prebuilds/darwin-arm64/@photostructure+sqlite.glibc.node +0 -0
  13. package/prebuilds/darwin-x64/@photostructure+sqlite.glibc.node +0 -0
  14. package/prebuilds/linux-arm64/@photostructure+sqlite.glibc.node +0 -0
  15. package/prebuilds/linux-arm64/@photostructure+sqlite.musl.node +0 -0
  16. package/prebuilds/linux-x64/@photostructure+sqlite.glibc.node +0 -0
  17. package/prebuilds/linux-x64/@photostructure+sqlite.musl.node +0 -0
  18. package/prebuilds/test_extension.so +0 -0
  19. package/prebuilds/win32-arm64/@photostructure+sqlite.glibc.node +0 -0
  20. package/prebuilds/win32-x64/@photostructure+sqlite.glibc.node +0 -0
  21. package/src/aggregate_function.cpp +222 -114
  22. package/src/aggregate_function.h +5 -6
  23. package/src/binding.cpp +30 -21
  24. package/src/enhance.ts +552 -0
  25. package/src/index.ts +84 -9
  26. package/src/shims/node_errors.h +34 -15
  27. package/src/shims/sqlite_errors.h +34 -8
  28. package/src/sql-tag-store.ts +6 -9
  29. package/src/sqlite_impl.cpp +1044 -394
  30. package/src/sqlite_impl.h +46 -7
  31. package/src/transaction.ts +178 -0
  32. package/src/types/database-sync-instance.ts +6 -40
  33. package/src/types/pragma-options.ts +23 -0
  34. package/src/types/statement-sync-instance.ts +38 -12
  35. package/src/types/transaction.ts +72 -0
  36. package/src/upstream/node_sqlite.cc +143 -43
  37. package/src/upstream/node_sqlite.h +15 -11
  38. package/src/upstream/sqlite3.c +102 -58
  39. package/src/upstream/sqlite3.h +5 -5
  40. package/src/user_function.cpp +138 -141
  41. package/src/user_function.h +3 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photostructure/sqlite",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Drop-in replacement for node:sqlite",
5
5
  "homepage": "https://photostructure.github.io/node-sqlite/",
6
6
  "types": "./dist/index.d.ts",
@@ -27,68 +27,76 @@
27
27
  "private": false,
28
28
  "scripts": {
29
29
  "install": "node-gyp-build",
30
- "clean": "run-p clean:*",
30
+ "//build": "build commands",
31
+ "build": "run-p build:dist build:native",
32
+ "build:dist": "tsup && node scripts/post-build.mjs",
33
+ "build:native": "tsx scripts/build-native.ts",
34
+ "build:native:linux": "bash scripts/prebuild-linux-glibc.sh",
35
+ "build:native:rebuild": "node-gyp rebuild",
36
+ "rebuild": "run-s clean build",
37
+ "//clean": "cleanup commands",
38
+ "clean": "run-p clean:dist clean:native",
31
39
  "clean:dist": "del-cli dist \"*.tsbuildinfo\"",
32
40
  "clean:native": "node-gyp clean && del-cli prebuilds",
41
+ "clean:docker": "docker rm -f $(docker ps -aq --filter name=node-sqlite-test 2>/dev/null) 2>/dev/null || true",
42
+ "clean:docker:cache": "del-cli .cache",
43
+ "clean:all": "run-p clean:dist clean:native clean:docker clean:docker:cache",
44
+ "//sync": "sync upstream sources",
45
+ "sync": "run-s sync:node sync:sqlite sync:tests",
33
46
  "sync:node": "tsx scripts/sync-from-node.ts",
34
47
  "sync:sqlite": "tsx scripts/sync-from-sqlite.ts",
35
- "node-gyp-rebuild": "node-gyp rebuild",
36
- "// rebuild": "`npm run rebuild` does what you'd expect. `npm rebuild` only rebuilds already-installed packages.",
37
- "rebuild": "run-s clean build",
38
- "build": "run-p build:native build:dist",
39
- "build:native": "tsx scripts/build-native.ts",
40
- "// build:linux-glibc": "called by GHA build.yml",
41
- "build:linux-glibc": "bash scripts/prebuild-linux-glibc.sh",
42
- "build:dist": "tsup && node scripts/post-build.mjs",
43
- "// pretests": "builds everything before running full test suite",
44
- "pretests": "npm run build",
45
- "tests": "run-s tests:*",
46
- "tests:cjs": "node --expose-gc node_modules/jest/bin/jest.js",
47
- "tests:esm": "cross-env TEST_ESM=1 node --expose-gc --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js",
48
- "// pretest": "only builds TypeScript since native build should already exist",
49
- "pretest": "npm run build:dist",
50
- "// test": "support `npm t name_of_file` (and don't fail due to missing coverage)",
51
- "test": "npm run tests:cjs -- --no-coverage",
52
- "test:serial": "npm run tests:cjs -- --runInBand --no-coverage",
53
- "test:all": "run-s \"tests:cjs -- {@}\" \"tests:esm -- {@}\" --",
54
- "// test:api-compat": "run by the api compatibility CI workflow",
55
- "test:api-compat": "jest --config jest.config.api-compat.cjs",
56
- "test:node-compat": "cross-env NODE_OPTIONS=\"--experimental-sqlite --no-warnings --expose-gc\" npm run tests:cjs -- --no-coverage test/node-compatibility.test.ts",
57
- "test:build-extension": "cd test/fixtures/test-extension && node build.js",
58
- "memory:test": "cross-env TEST_MEMORY=1 node --expose-gc node_modules/jest/bin/jest.js --no-coverage test/memory.test.ts",
59
- "memory:valgrind": "bash scripts/valgrind-test.sh",
60
- "memory:asan": "bash scripts/sanitizers-test.sh",
61
- "check:memory": "npx --yes tsx scripts/check-memory.ts",
62
- "benchmark": "cd benchmark && npm install && npm run bench",
63
- "benchmark:memory": "cd benchmark && npm install && npm run bench:memory",
64
- "benchmark:full": "cd benchmark && npm install && npm run bench && npm run bench:memory",
65
- "stress-test": "cd benchmark && npm install && cd .. && tsx scripts/stress-test.ts",
66
- "stress-test:validate": "npm run tests:cjs -- --no-coverage benchmark/stress-test.test.ts",
67
- "stress-test:ci": "cd benchmark && npm install && cd .. && tsx scripts/stress-test.ts --ci --output-file stress-test-results.json",
68
- "lint": "run-p lint:*",
48
+ "sync:tests": "tsx scripts/sync-node-tests.ts",
49
+ "//test": "'test' is quick dev feedback, 'test:all' is comprehensive",
50
+ "test": "npm run build:dist && node --expose-gc node_modules/jest/bin/jest.js --no-coverage",
51
+ "test:cjs": "node --expose-gc node_modules/jest/bin/jest.js",
52
+ "test:esm": "cross-env TEST_ESM=1 node --expose-gc --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js",
53
+ "test:all": "npm run build && run-s test:cjs test:esm",
54
+ "test:serial": "node --expose-gc node_modules/jest/bin/jest.js --runInBand --no-coverage",
55
+ "test:api": "jest --config jest.config.api-compat.cjs",
56
+ "test:node": "node --test test/node-compat/*.js test/node-compat/*.mjs",
57
+ "test:memory": "cross-env TEST_MEMORY=1 node --expose-gc node_modules/jest/bin/jest.js --no-coverage test/memory.test.ts",
58
+ "test:extension": "cd test/fixtures/test-extension && node build.js",
59
+ "test:docker:debian": "REUSE_BUILD=1 REUSE_CONTAINER=1 bash scripts/test-docker-debian.sh",
60
+ "test:docker:alpine": "REUSE_BUILD=1 REUSE_CONTAINER=1 bash scripts/test-docker-alpine.sh",
61
+ "//lint": "'lint' runs everywhere, 'lint:full' adds optional tools",
62
+ "lint": "run-p lint:ts lint:eslint",
69
63
  "lint:ts": "tsc --noEmit",
70
- "lint:ts-build": "tsc -p tsconfig.build.json --noEmit",
71
- "lint:ts-scripts": "tsc --noEmit --module esnext --target es2022 --moduleResolution node --project scripts/tsconfig.json",
72
- "lint:ts-benchmark": "cd benchmark && npm install && tsc --noEmit",
64
+ "lint:ts:build": "tsc -p tsconfig.build.json --noEmit",
65
+ "lint:ts:scripts": "tsc --noEmit --module esnext --target es2022 --moduleResolution node --project scripts/tsconfig.json",
66
+ "lint:ts:bench": "cd benchmark && npm install && tsc --noEmit",
73
67
  "lint:eslint": "eslint src/ test/ scripts/",
74
- "// lint:api-compat": "run by the api compatibility CI workflow",
75
- "lint:api-compat": "tsx scripts/check-api-compat.ts",
76
68
  "lint:native": "tsx scripts/clang-tidy.ts",
77
- "fmt": "run-p fmt:*",
78
- "fmt:prettier": "prettier --write .",
79
- "// fmt:native": "on ubuntu: `sudo apt install clang-format`. NOTE: we don't reformat src/upstream!",
69
+ "lint:api": "tsx scripts/check-api-compat.ts",
70
+ "lint:full": "run-s lint lint:native lint:api",
71
+ "//fmt": "code formatting",
72
+ "fmt": "run-p fmt:prettier fmt:native",
73
+ "fmt:prettier": "prettier --cache --write .",
80
74
  "fmt:native": "clang-format --style=LLVM -i src/shims/*.h src/*.cpp src/*.h test/fixtures/test-extension/*.c || true",
75
+ "//memory": "memory analysis tools",
76
+ "memory:check": "npx --yes tsx scripts/check-memory.ts",
77
+ "memory:valgrind": "bash scripts/valgrind-test.sh",
78
+ "memory:asan": "bash scripts/sanitizers-test.sh",
79
+ "//bench": "benchmarks",
80
+ "bench": "cd benchmark && npm install && npm run bench",
81
+ "bench:memory": "cd benchmark && npm install && npm run bench:memory",
82
+ "bench:full": "cd benchmark && npm install && npm run bench && npm run bench:memory",
83
+ "//stress": "stress tests",
84
+ "stress": "cd benchmark && npm install && cd .. && tsx scripts/stress-test.ts",
85
+ "stress:validate": "node --expose-gc node_modules/jest/bin/jest.js --no-coverage benchmark/stress-test.test.ts",
86
+ "stress:ci": "cd benchmark && npm install && cd .. && tsx scripts/stress-test.ts --ci --output-file stress-test-results.json",
87
+ "//security": "security scanning",
88
+ "security": "run-s security:audit security:osv",
89
+ "security:audit": "npm audit --production",
90
+ "security:audit:fix": "npm audit fix --force",
91
+ "security:osv": "osv-scanner scan --recursive . || true",
92
+ "//docs": "documentation",
81
93
  "docs": "typedoc",
82
- "// precommit": "should be manually run by developers before they run `git commit`",
94
+ "//ci": "CI and release commands",
83
95
  "precommit": "npx --yes tsx scripts/precommit.ts",
84
- "prepare-release": "npm run build:dist",
85
- "security": "run-s security:*",
86
- "security:audit-fix": "npm audit fix --force",
87
- "security:audit": "npm audit --production",
96
+ "release:prepare": "npm run build:dist",
97
+ "update:actions": "pinact run -u",
88
98
  "install:osv-scanner": "go install github.com/google/osv-scanner/cmd/osv-scanner@latest",
89
- "security:osv": "osv-scanner scan --recursive . || true",
90
- "install:actions": "go install github.com/suzuki-shunsuke/pinact/cmd/pinact@latest",
91
- "update:actions": "pinact run -u"
99
+ "install:actions": "go install github.com/suzuki-shunsuke/pinact/cmd/pinact@latest"
92
100
  },
93
101
  "gypfile": true,
94
102
  "publishConfig": {
@@ -124,31 +132,32 @@
124
132
  "node-gyp-build": "^4.8.4"
125
133
  },
126
134
  "devDependencies": {
135
+ "@mceachen/sqlite-vec": "^0.3.2",
127
136
  "@types/jest": "^30.0.0",
128
- "@types/node": "^24.10.1",
129
- "better-sqlite3": "^12.5.0",
137
+ "@types/node": "^25.0.3",
138
+ "better-sqlite3": "^12.6.2",
130
139
  "cross-env": "^10.1.0",
131
140
  "del-cli": "^7.0.0",
132
- "eslint": "^9.39.1",
133
- "eslint-plugin-regexp": "^2.10.0",
141
+ "eslint": "^9.39.2",
142
+ "eslint-plugin-regexp": "^3.0.0",
134
143
  "eslint-plugin-security": "^3.0.1",
135
- "globals": "^16.5.0",
144
+ "globals": "^17.0.0",
136
145
  "jest": "^30.2.0",
137
- "node-gyp": "^12.1.0",
146
+ "node-gyp": "^12.2.0",
138
147
  "npm-check-updates": "^19",
139
148
  "npm-run-all2": "8.0.4",
140
149
  "prebuildify": "^6.0.1",
141
- "prettier": "^3.7.4",
150
+ "prettier": "^3.8.1",
142
151
  "prettier-plugin-organize-imports": "^4.3.0",
143
152
  "ts-jest": "^29.4.6",
144
153
  "tsup": "^8.5.1",
145
154
  "tsx": "^4.21.0",
146
- "typedoc": "^0.28.15",
155
+ "typedoc": "^0.28.16",
147
156
  "typescript": "^5.9.3",
148
- "typescript-eslint": "^8.49.0"
157
+ "typescript-eslint": "^8.54.0"
149
158
  },
150
159
  "versions": {
151
- "nodejs": "v25.2.2@c57a40c",
152
- "sqlite": "3.51.1"
160
+ "nodejs": "v25.6.1@dffcdb3",
161
+ "sqlite": "3.51.2"
153
162
  }
154
163
  }
Binary file