better-sqlite3-multiple-ciphers 8.5.3-beta.0 → 8.6.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.
package/README.md CHANGED
@@ -17,10 +17,10 @@ The fastest and simplest library for SQLite3 in Node.js. This particular fork su
17
17
  ## Current versions
18
18
 
19
19
  - ### Stable
20
- - **better-sqlite3-multiple-ciphers** - [`8.5.2`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.5.2)
21
- - **better-sqlite3** - [`8.5.2`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.5.2)
22
- - **SQLite** - [`3.42.0`](https://www.sqlite.org/releaselog/3_42_0.html)
23
- - **SQLite3 Multiple Ciphers** - [`1.6.3`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.6.3)
20
+ - **better-sqlite3-multiple-ciphers** - [`8.6.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.6.0)
21
+ - **better-sqlite3** - [`8.6.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.6.0)
22
+ - **SQLite** - [`3.43.0`](https://www.sqlite.org/releaselog/3_43_0.html)
23
+ - **SQLite3 Multiple Ciphers** - [`1.6.4`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.6.4)
24
24
 
25
25
  - ### Beta
26
26
  - **better-sqlite3-multiple-ciphers** - [`8.5.3-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.5.3-beta.0)
package/deps/copy.js CHANGED
@@ -18,9 +18,14 @@ if (process.argv[3]) {
18
18
  }
19
19
 
20
20
  for (const { filename, optional } of files) {
21
- if (optional && !fs.existsSync(path.join(source, filename))) {
21
+ const sourceFilepath = path.join(source, filename);
22
+ const destFilepath = path.join(dest, filename);
23
+
24
+ if (optional && !fs.existsSync(sourceFilepath)) {
22
25
  continue;
23
26
  }
24
- fs.accessSync(path.join(source, filename));
25
- fs.copyFileSync(path.join(source, filename), path.join(dest, filename));
27
+
28
+ fs.accessSync(sourceFilepath);
29
+ fs.mkdirSync(path.dirname(destFilepath), { recursive: true });
30
+ fs.copyFileSync(sourceFilepath, destFilepath);
26
31
  }
package/deps/defines.gypi CHANGED
@@ -9,6 +9,7 @@
9
9
  'HAVE_UINT16_T=1',
10
10
  'HAVE_UINT32_T=1',
11
11
  'HAVE_UINT8_T=1',
12
+ 'HAVE_USLEEP=1',
12
13
  'SQLITE_DEFAULT_CACHE_SIZE=-16000',
13
14
  'SQLITE_DEFAULT_FOREIGN_KEYS=1',
14
15
  'SQLITE_DEFAULT_MEMSTATUS=0',
@@ -26,7 +27,6 @@
26
27
  'SQLITE_ENABLE_RTREE',
27
28
  'SQLITE_ENABLE_STAT4',
28
29
  'SQLITE_ENABLE_UPDATE_DELETE_LIMIT',
29
- 'SQLITE_INTROSPECTION_PRAGMAS',
30
30
  'SQLITE_LIKE_DOESNT_MATCH_BLOBS',
31
31
  'SQLITE_OMIT_DEPRECATED',
32
32
  'SQLITE_OMIT_GET_TABLE',
package/deps/download.sh CHANGED
@@ -47,7 +47,6 @@ SQLITE_ENABLE_MATH_FUNCTIONS
47
47
  SQLITE_ENABLE_RTREE
48
48
  SQLITE_ENABLE_STAT4
49
49
  SQLITE_ENABLE_UPDATE_DELETE_LIMIT
50
- SQLITE_INTROSPECTION_PRAGMAS
51
50
  SQLITE_LIKE_DOESNT_MATCH_BLOBS
52
51
  SQLITE_OMIT_DEPRECATED
53
52
  SQLITE_OMIT_GET_TABLE
package/lib/database.js CHANGED
@@ -33,22 +33,28 @@ function Database(filenameGiven, options) {
33
33
  const fileMustExist = util.getBooleanOption(options, 'fileMustExist');
34
34
  const timeout = 'timeout' in options ? options.timeout : 5000;
35
35
  const verbose = 'verbose' in options ? options.verbose : null;
36
- const nativeBindingPath = 'nativeBinding' in options ? options.nativeBinding : null;
36
+ const nativeBinding = 'nativeBinding' in options ? options.nativeBinding : null;
37
37
 
38
38
  // Validate interpreted options
39
39
  if (readonly && anonymous && !buffer) throw new TypeError('In-memory/temporary databases cannot be readonly');
40
40
  if (!Number.isInteger(timeout) || timeout < 0) throw new TypeError('Expected the "timeout" option to be a positive integer');
41
41
  if (timeout > 0x7fffffff) throw new RangeError('Option "timeout" cannot be greater than 2147483647');
42
42
  if (verbose != null && typeof verbose !== 'function') throw new TypeError('Expected the "verbose" option to be a function');
43
- if (nativeBindingPath != null && typeof nativeBindingPath !== 'string') throw new TypeError('Expected the "nativeBinding" option to be a string');
43
+ if (nativeBinding != null && typeof nativeBinding !== 'string' && typeof nativeBinding !== 'object') throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
44
44
 
45
45
  // Load the native addon
46
46
  let addon;
47
- if (nativeBindingPath == null) {
47
+ if (nativeBinding == null) {
48
48
  addon = DEFAULT_ADDON || (DEFAULT_ADDON = require('bindings')('better_sqlite3.node'));
49
+ } else if (typeof nativeBinding === 'string') {
50
+ // See <https://webpack.js.org/api/module-variables/#__non_webpack_require__-webpack-specific>
51
+ const requireFunc = typeof __non_webpack_require__ === 'function' ? __non_webpack_require__ : require;
52
+ addon = requireFunc(path.resolve(nativeBinding).replace(/(\.node)?$/, '.node'));
49
53
  } else {
50
- addon = require(path.resolve(nativeBindingPath).replace(/(\.node)?$/, '.node'));
54
+ // See <https://github.com/WiseLibs/better-sqlite3/issues/972>
55
+ addon = nativeBinding;
51
56
  }
57
+
52
58
  if (!addon.isInitialized) {
53
59
  addon.setErrorConstructor(SqliteError);
54
60
  addon.isInitialized = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "8.5.3-beta.0",
3
+ "version": "8.6.0",
4
4
  "description": "better-sqlite3 with multiple-cipher encryption support",
5
5
  "homepage": "https://github.com/m4heshd/better-sqlite3-multiple-ciphers",
6
6
  "author": "Mahesh Bandara Wijerathna (m4heshd) <m4heshd@gmail.com>",
@@ -19,19 +19,19 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "bindings": "^1.5.0",
22
- "prebuild-install": "^7.1.0"
22
+ "prebuild-install": "^7.1.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "20.4.9",
26
- "chai": "^4.3.6",
27
- "cli-color": "^2.0.2",
28
- "fs-extra": "^10.1.0",
26
+ "chai": "^4.3.8",
27
+ "cli-color": "^2.0.3",
28
+ "fs-extra": "^11.1.1",
29
29
  "mocha": "^10.2.0",
30
- "node-gyp": "8.4.1",
30
+ "node-gyp": "9.4.0",
31
31
  "nodemark": "^0.3.0",
32
32
  "prebuild": "^11.0.4",
33
- "sqlite": "^4.1.1",
34
- "sqlite3": "^5.0.8"
33
+ "sqlite": "^5.0.1",
34
+ "sqlite3": "^5.1.6"
35
35
  },
36
36
  "overrides": {
37
37
  "prebuild": {
@@ -2,6 +2,17 @@
2
2
  //
3
3
 
4
4
  #include "better_sqlite3.hpp"
5
+ #line 161 "./src/util/macros.lzz"
6
+ #ifndef V8_COMPRESS_POINTERS_IN_SHARED_CAGE
7
+ #define SAFE_NEW_BUFFER(env, data, length, finalizeCallback, finalizeHint) node::Buffer::New(env, data, length, finalizeCallback, finalizeHint)
8
+ #else
9
+ static inline v8::MaybeLocal<v8::Object> BufferSandboxNew(v8::Isolate* isolate, char* data, size_t length, void (*finalizeCallback)(char*, void*), void* finalizeHint) {
10
+ v8::MaybeLocal<v8::Object> buffer = node::Buffer::Copy(isolate, data, length);
11
+ finalizeCallback(data, finalizeHint);
12
+ return buffer;
13
+ }
14
+ #define SAFE_NEW_BUFFER(env, data, length, finalizeCallback, finalizeHint) BufferSandboxNew(env, data, length, finalizeCallback, finalizeHint)
15
+ #endif
5
16
  #line 39 "./src/util/binder.lzz"
6
17
  static bool IsPlainObject(v8::Isolate* isolate, v8::Local<v8::Object> obj) {
7
18
  v8::Local<v8::Value> proto = obj->GetPrototype();
@@ -617,7 +628,7 @@ void Database::JS_serialize (v8::FunctionCallbackInfo <v8 :: Value> const & info
617
628
  }
618
629
 
619
630
  info.GetReturnValue().Set(
620
- node::Buffer::New(isolate, reinterpret_cast<char*>(data), length, FreeSerialization, NULL).ToLocalChecked()
631
+ SAFE_NEW_BUFFER(isolate, reinterpret_cast<char*>(data), length, FreeSerialization, NULL).ToLocalChecked()
621
632
  );
622
633
  }
623
634
  #line 337 "./src/objects/database.lzz"