better-sqlite3-multiple-ciphers 12.1.1 → 12.4.1

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.
@@ -366,6 +366,8 @@ struct sqlite3_api_routines {
366
366
  /* Version 3.44.0 and later */
367
367
  void *(*get_clientdata)(sqlite3*,const char*);
368
368
  int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
369
+ /* Version 3.50.0 and later */
370
+ int (*setlk_timeout)(sqlite3*,int,int);
369
371
  };
370
372
 
371
373
  /*
@@ -699,6 +701,8 @@ typedef int (*sqlite3_loadext_entry)(
699
701
  /* Version 3.44.0 and later */
700
702
  #define sqlite3_get_clientdata sqlite3_api->get_clientdata
701
703
  #define sqlite3_set_clientdata sqlite3_api->set_clientdata
704
+ /* Version 3.50.0 and later */
705
+ #define sqlite3_setlk_timeout sqlite3_api->setlk_timeout
702
706
  #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
703
707
 
704
708
  #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
@@ -21,8 +21,8 @@
21
21
  # ===
22
22
 
23
23
  YEAR="2025"
24
- VERSION="3490200"
25
- SQLITE3MC_VERSION="v2.1.1"
24
+ VERSION="3500400"
25
+ SQLITE3MC_VERSION="v2.2.4"
26
26
 
27
27
  # Defines below are sorted alphabetically
28
28
  DEFINES="
package/lib/database.js CHANGED
@@ -61,7 +61,7 @@ function Database(filenameGiven, options) {
61
61
  }
62
62
 
63
63
  // Make sure the specified directory exists
64
- if (!anonymous && !fs.existsSync(path.dirname(filename))) {
64
+ if (!anonymous && !filename.startsWith('file:') && !fs.existsSync(path.dirname(filename))) {
65
65
  throw new TypeError('Cannot open database because the directory does not exist');
66
66
  }
67
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "12.1.1",
3
+ "version": "12.4.1",
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>",
@@ -13,7 +13,7 @@
13
13
  "files": [
14
14
  "index.d.ts",
15
15
  "binding.gyp",
16
- "src/*.[ch]pp",
16
+ "src/**/*.[ch]pp",
17
17
  "lib/**",
18
18
  "deps/**"
19
19
  ],
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "overrides": {
28
28
  "prebuild": {
29
- "node-abi": "4.9.0"
29
+ "node-abi": "4.13.1"
30
30
  }
31
31
  },
32
32
  "devDependencies": {
@@ -44,13 +44,10 @@
44
44
  "install": "prebuild-install || node-gyp rebuild --release",
45
45
  "build-release": "node-gyp rebuild --release",
46
46
  "build-debug": "node-gyp rebuild --debug",
47
- "rebuild-release": "npm run lzz && npm run build-release",
48
- "rebuild-debug": "npm run lzz && npm run build-debug",
49
47
  "test": "mocha --exit --slow=75 --timeout=30000",
50
48
  "test:container": "docker-compose up --detach --build",
51
49
  "benchmark": "node benchmark",
52
50
  "update-sqlite3mc": "bash ./deps/update-sqlite3mc.sh",
53
- "lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz",
54
51
  "bump:patch": "npm --no-git-tag-version version patch",
55
52
  "bump:minor": "npm --no-git-tag-version version minor",
56
53
  "bump:major": "npm --no-git-tag-version version major",
package/src/addon.cpp ADDED
@@ -0,0 +1,47 @@
1
+ struct Addon {
2
+ explicit Addon(v8::Isolate* isolate) :
3
+ privileged_info(NULL),
4
+ next_id(0),
5
+ cs(isolate) {}
6
+
7
+ static void Cleanup(void* ptr) {
8
+ Addon* addon = static_cast<Addon*>(ptr);
9
+ for (Database* db : addon->dbs) db->CloseHandles();
10
+ addon->dbs.clear();
11
+ delete addon;
12
+ }
13
+
14
+ inline sqlite3_uint64 NextId() {
15
+ return next_id++;
16
+ }
17
+
18
+ static void ConfigureURI() {
19
+ static std::once_flag init_flag;
20
+ std::call_once(init_flag, [](){
21
+ const char* env = getenv("SQLITE_USE_URI");
22
+ if (env != NULL) {
23
+ if (strcmp(env, "1") == 0) {
24
+ int status = sqlite3_config(SQLITE_CONFIG_URI, 1);
25
+ assert(status == SQLITE_OK); ((void)status);
26
+ } else if (strcmp(env, "0") == 0) {
27
+ int status = sqlite3_config(SQLITE_CONFIG_URI, 0);
28
+ assert(status == SQLITE_OK); ((void)status);
29
+ }
30
+ }
31
+ });
32
+ }
33
+
34
+ static NODE_METHOD(JS_setErrorConstructor) {
35
+ REQUIRE_ARGUMENT_FUNCTION(first, v8::Local<v8::Function> SqliteError);
36
+ OnlyAddon->SqliteError.Reset(OnlyIsolate, SqliteError);
37
+ }
38
+
39
+ v8::Global<v8::Function> Statement;
40
+ v8::Global<v8::Function> StatementIterator;
41
+ v8::Global<v8::Function> Backup;
42
+ v8::Global<v8::Function> SqliteError;
43
+ NODE_ARGUMENTS_POINTER privileged_info;
44
+ sqlite3_uint64 next_id;
45
+ CS cs;
46
+ std::set<Database*, Database::CompareDatabase> dbs;
47
+ };