better-sqlite3-multiple-ciphers 11.8.0 → 11.8.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.
package/deps/sqlite3.gyp CHANGED
@@ -1,5 +1,5 @@
1
1
  # ===
2
- # This configuration defines options specific to compiling SQLite3 itself.
2
+ # This configuration defines options specific to compiling SQLite itself.
3
3
  # Compile-time options are loaded by the auto-generated file "defines.gypi".
4
4
  # The --sqlite3 option can be provided to use a custom amalgamation instead.
5
5
  # ===
@@ -2,7 +2,7 @@
2
2
  SQLITE_EXTENSION_INIT1
3
3
 
4
4
  /*
5
- This SQLite3 extension is used only for testing purposes (npm test).
5
+ This SQLite extension is used only for testing purposes (npm test).
6
6
  */
7
7
 
8
8
  static void TestExtensionFunction(sqlite3_context* pCtx, int nVal, sqlite3_value** _) {
@@ -1,113 +1,140 @@
1
- #!/usr/bin/env bash
2
-
3
- # ===
4
- # This script defines and generates the bundled SQLite3 unit (sqlite3.c).
5
- #
6
- # The following steps are taken:
7
- # 1. populate the shell environment with the defined compile-time options.
8
- # 2. download and extract the SQLite3 source code into a temporary directory.
9
- # 3. run "sh configure" and "make sqlite3.c" within the source directory.
10
- # 4. copy the generated amalgamation into the output directory (./sqlite3).
11
- # 5. export the defined compile-time options to a gyp file (./defines.gypi).
12
- # 6. update the docs (../docs/compilation.md) with details of this distribution.
13
- #
14
- # When a user builds better-sqlite3, the following steps are taken:
15
- # 1. node-gyp loads the previously exported compile-time options (defines.gypi).
16
- # 2. the copy.js script copies the bundled amalgamation into the build folder.
17
- # 3. node-gyp compiles the copied sqlite3.c along with better_sqlite3.cpp.
18
- # 4. node-gyp links the two resulting binaries to generate better_sqlite3.node.
19
- # ===
20
-
21
- YEAR="2022"
22
- VERSION="3380200"
23
-
24
- # Defines below are sorted alphabetically
25
- DEFINES="
26
- HAVE_INT16_T=1
27
- HAVE_INT32_T=1
28
- HAVE_INT8_T=1
29
- HAVE_STDINT_H=1
30
- HAVE_UINT16_T=1
31
- HAVE_UINT32_T=1
32
- HAVE_UINT8_T=1
33
- SQLITE_DEFAULT_CACHE_SIZE=-16000
34
- SQLITE_DEFAULT_FOREIGN_KEYS=1
35
- SQLITE_DEFAULT_MEMSTATUS=0
36
- SQLITE_DEFAULT_WAL_SYNCHRONOUS=1
37
- SQLITE_DQS=0
38
- SQLITE_ENABLE_COLUMN_METADATA
39
- SQLITE_ENABLE_DBSTAT_VTAB
40
- SQLITE_ENABLE_DESERIALIZE
41
- SQLITE_ENABLE_FTS3
42
- SQLITE_ENABLE_FTS3_PARENTHESIS
43
- SQLITE_ENABLE_FTS4
44
- SQLITE_ENABLE_FTS5
45
- SQLITE_ENABLE_GEOPOLY
46
- SQLITE_ENABLE_JSON1
47
- SQLITE_ENABLE_MATH_FUNCTIONS
48
- SQLITE_ENABLE_RTREE
49
- SQLITE_ENABLE_STAT4
50
- SQLITE_ENABLE_UPDATE_DELETE_LIMIT
51
- SQLITE_LIKE_DOESNT_MATCH_BLOBS
52
- SQLITE_OMIT_DEPRECATED
53
- SQLITE_OMIT_PROGRESS_CALLBACK
54
- SQLITE_OMIT_SHARED_CACHE
55
- SQLITE_OMIT_TCL_VARIABLE
56
- SQLITE_SOUNDEX
57
- SQLITE_THREADSAFE=2
58
- SQLITE_TRACE_SIZE_LIMIT=32
59
- SQLITE_USER_AUTHENTICATION=0
60
- SQLITE_USE_URI=0
61
- "
62
-
63
- # ========== START SCRIPT ========== #
64
-
65
- echo "setting up environment..."
66
- DEPS="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
67
- TEMP="$DEPS/temp"
68
- OUTPUT="$DEPS/sqlite3"
69
- rm -rf "$TEMP"
70
- rm -rf "$OUTPUT"
71
- mkdir -p "$TEMP"
72
- mkdir -p "$OUTPUT"
73
- export CFLAGS=`echo $(echo "$DEFINES" | sed -e "/^\s*$/d" -e "s/^/-D/")`
74
-
75
- echo "downloading source..."
76
- curl -#f "https://www.sqlite.org/$YEAR/sqlite-src-$VERSION.zip" > "$TEMP/source.zip" || exit 1
77
-
78
- echo "extracting source..."
79
- unzip "$TEMP/source.zip" -d "$TEMP" > /dev/null || exit 1
80
- cd "$TEMP/sqlite-src-$VERSION" || exit 1
81
-
82
- echo "configuring amalgamation..."
83
- sh configure > /dev/null || exit 1
84
-
85
- echo "building amalgamation..."
86
- make sqlite3.c > /dev/null || exit 1
87
-
88
- echo "copying amalgamation..."
89
- cp sqlite3.c sqlite3.h sqlite3ext.h "$OUTPUT/" || exit 1
90
-
91
- echo "updating gyp configs..."
92
- GYP="$DEPS/defines.gypi"
93
- printf "# THIS FILE IS AUTOMATICALLY GENERATED BY deps/download.sh (DO NOT EDIT)\n\n{\n 'defines': [\n" > "$GYP"
94
- printf "$DEFINES" | sed -e "/^\s*$/d" -e "s/\(.*\)/ '\1',/" >> "$GYP"
95
- printf " ],\n}\n" >> "$GYP"
96
-
97
- echo "updating docs..."
98
- DOCS="$DEPS/../docs/compilation.md"
99
- MAJOR=`expr "${VERSION:0:1}" + 0`
100
- MINOR=`expr "${VERSION:1:2}" + 0`
101
- PATCH=`expr "${VERSION:3:2}" + 0`
102
- sed -Ei.bak -e "s/version [0-9]+\.[0-9]+\.[0-9]+/version $MAJOR.$MINOR.$PATCH/g" "$DOCS"
103
- sed -i.bak -e "/^SQLITE_/,\$d" "$DOCS"
104
- sed -i.bak -e "/^HAVE_/,\$d" "$DOCS"
105
- rm "$DOCS".bak
106
- printf "$DEFINES" | sed -e "/^\s*$/d" >> "$DOCS"
107
- printf "\`\`\`\n" >> "$DOCS"
108
-
109
- echo "cleaning up..."
110
- cd - > /dev/null || exit 1
111
- rm -rf "$TEMP"
112
-
113
- echo "done!"
1
+ #!/usr/bin/env bash
2
+
3
+ # ===
4
+ # This script defines and generates the bundled SQLite unit (sqlite3.c).
5
+ #
6
+ # The following steps are taken:
7
+ # 1. populate the shell environment with the defined compile-time options.
8
+ # 2. download and extract the SQLite source code into a temporary directory.
9
+ # 3. run "sh configure" and "make sqlite3.c" within the source directory.
10
+ # 4. clone the SQLite3MultipleCiphers repo, replace SQLite amalgamation and patch it.
11
+ # 5. build the SQLite3MultipleCiphers amalgamation
12
+ # 6. copy the generated amalgamation into the output directory (./sqlite3).
13
+ # 7. export the defined compile-time options to a gyp file (./defines.gypi).
14
+ # 8. update the docs (../docs/compilation.md) with details of this distribution.
15
+ #
16
+ # When a user builds better-sqlite3-multiple-ciphers, the following steps are taken:
17
+ # 1. node-gyp loads the previously exported compile-time options (defines.gypi).
18
+ # 2. the copy.js script copies the bundled amalgamation into the build folder.
19
+ # 3. node-gyp compiles the copied sqlite3.c along with better_sqlite3.cpp.
20
+ # 4. node-gyp links the two resulting binaries to generate better_sqlite3.node.
21
+ # ===
22
+
23
+ YEAR="2025"
24
+ VERSION="3480000"
25
+ SQLITE3MC_VERSION="v2.0.2"
26
+
27
+ # Defines below are sorted alphabetically
28
+ DEFINES="
29
+ HAVE_INT16_T=1
30
+ HAVE_INT32_T=1
31
+ HAVE_INT8_T=1
32
+ HAVE_STDINT_H=1
33
+ HAVE_UINT16_T=1
34
+ HAVE_UINT32_T=1
35
+ HAVE_UINT8_T=1
36
+ HAVE_USLEEP=1
37
+ SQLITE_DEFAULT_CACHE_SIZE=-16000
38
+ SQLITE_DEFAULT_FOREIGN_KEYS=1
39
+ SQLITE_DEFAULT_MEMSTATUS=0
40
+ SQLITE_DEFAULT_WAL_SYNCHRONOUS=1
41
+ SQLITE_DQS=0
42
+ SQLITE_ENABLE_COLUMN_METADATA
43
+ SQLITE_ENABLE_DBSTAT_VTAB
44
+ SQLITE_ENABLE_DESERIALIZE
45
+ SQLITE_ENABLE_FTS3
46
+ SQLITE_ENABLE_FTS3_PARENTHESIS
47
+ SQLITE_ENABLE_FTS4
48
+ SQLITE_ENABLE_FTS5
49
+ SQLITE_ENABLE_GEOPOLY
50
+ SQLITE_ENABLE_JSON1
51
+ SQLITE_ENABLE_MATH_FUNCTIONS
52
+ SQLITE_ENABLE_RTREE
53
+ SQLITE_ENABLE_STAT4
54
+ SQLITE_ENABLE_UPDATE_DELETE_LIMIT
55
+ SQLITE_LIKE_DOESNT_MATCH_BLOBS
56
+ SQLITE_OMIT_DEPRECATED
57
+ SQLITE_OMIT_PROGRESS_CALLBACK
58
+ SQLITE_OMIT_SHARED_CACHE
59
+ SQLITE_OMIT_TCL_VARIABLE
60
+ SQLITE_SOUNDEX
61
+ SQLITE_THREADSAFE=2
62
+ SQLITE_TRACE_SIZE_LIMIT=32
63
+ SQLITE_USER_AUTHENTICATION=0
64
+ SQLITE_USE_URI=0
65
+ "
66
+
67
+ # ========== START SCRIPT ========== #
68
+
69
+ echo -e "Setting up environment..."
70
+ DEPS="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
71
+ TEMP="$DEPS/temp"
72
+ OUTPUT="$DEPS/sqlite3"
73
+ rm -rf "$TEMP"
74
+ rm -rf "$OUTPUT"
75
+ mkdir -p "$TEMP"
76
+ mkdir -p "$OUTPUT"
77
+ export CFLAGS=`echo $(echo "$DEFINES" | sed -e "/^\s*$/d" -e "s/^/-D/")`
78
+
79
+ echo -e "\nDownloading SQLite source..."
80
+ curl -#f "https://www.sqlite.org/$YEAR/sqlite-src-$VERSION.zip" > "$TEMP/source.zip" || exit 1
81
+
82
+ echo -e "\nExtracting SQLite source..."
83
+ unzip "$TEMP/source.zip" -d "$TEMP" > /dev/null || exit 1
84
+ cd "$TEMP/sqlite-src-$VERSION" || exit 1
85
+
86
+ echo -e "\nConfiguring SQLite amalgamation..."
87
+ sh configure > /dev/null || exit 1
88
+
89
+ echo -e "\nBuilding SQLite amalgamation..."
90
+ make OPTIONS="$CFLAGS" sqlite3.c > /dev/null || exit 1
91
+
92
+ echo -e "\nCloning SQLite3MultipleCiphers repo..."
93
+ cd "$TEMP" || exit 1
94
+ git clone --quiet https://github.com/utelle/SQLite3MultipleCiphers.git > /dev/null || exit 1
95
+ cd "$TEMP/SQLite3MultipleCiphers" || exit 1
96
+ git checkout --quiet "tags/$SQLITE3MC_VERSION" > /dev/null || exit 1
97
+
98
+ echo -e "\nReplacing SQLite amalgamation in SQLite3MultipleCiphers..."
99
+ cd "$TEMP/sqlite-src-$VERSION" || exit 1
100
+ (yes | cp -rf sqlite3.c sqlite3.h sqlite3ext.h "$TEMP/SQLite3MultipleCiphers/src") || exit 1
101
+
102
+ echo -e "\nPatching SQLite amalgamation in SQLite3MultipleCiphers..."
103
+ cd "$TEMP/SQLite3MultipleCiphers" || exit 1
104
+ chmod +x ./scripts/patchsqlite3.sh || exit 1
105
+ chmod +x ./scripts/rekeyvacuum.sh || exit 1
106
+ ./scripts/patchsqlite3.sh ./src/sqlite3.c >./src/sqlite3patched.c || exit 1
107
+ ./scripts/rekeyvacuum.sh ./src/sqlite3.c >./src/rekeyvacuum.c || exit 1
108
+
109
+ echo -e "\nBuilding SQLite3MultipleCiphers amalgamation..."
110
+ python3 ./scripts/amalgamate.py --config ./scripts/sqlite3mc.c.json --source ./src/ || exit 1
111
+ mv sqlite3mc_amalgamation.c sqlite3.c || exit 1
112
+ python3 ./scripts/amalgamate.py --config ./scripts/sqlite3mc.h.json --source ./src/ || exit 1
113
+ mv sqlite3mc_amalgamation.h sqlite3.h || exit 1
114
+
115
+ echo -e "\nCopying SQLite3MultipleCiphers amalgamation..."
116
+ cp sqlite3.c sqlite3.h ./src/sqlite3ext.h "$OUTPUT/" || exit 1
117
+
118
+ echo -e "\nUpdating gyp configs..."
119
+ GYP="$DEPS/defines.gypi"
120
+ printf "# THIS FILE IS AUTOMATICALLY GENERATED BY deps/download.sh (DO NOT EDIT)\n\n{\n 'defines': [\n" > "$GYP"
121
+ printf "$DEFINES" | sed -e "/^\s*$/d" -e "s/\(.*\)/ '\1',/" >> "$GYP"
122
+ printf " ],\n}\n" >> "$GYP"
123
+
124
+ echo -e "\nUpdating docs..."
125
+ DOCS="$DEPS/../docs/compilation.md"
126
+ MAJOR=`expr "${VERSION:0:1}" + 0`
127
+ MINOR=`expr "${VERSION:1:2}" + 0`
128
+ PATCH=`expr "${VERSION:3:2}" + 0`
129
+ sed -Ei.bak -e "s/version [0-9]+\.[0-9]+\.[0-9]+/version $MAJOR.$MINOR.$PATCH/g" "$DOCS"
130
+ sed -i.bak -e "/^SQLITE_/,\$d" "$DOCS"
131
+ sed -i.bak -e "/^HAVE_/,\$d" "$DOCS"
132
+ rm "$DOCS".bak
133
+ printf "$DEFINES" | sed -e "/^\s*$/d" >> "$DOCS"
134
+ printf "\`\`\`\n" >> "$DOCS"
135
+
136
+ echo -e "\nCleaning up..."
137
+ cd - > /dev/null || exit 1
138
+ rm -rf "$TEMP"
139
+
140
+ echo -e "\nSQLite3MultipleCiphers update process completed!"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "11.8.0",
3
+ "version": "11.8.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>",
@@ -41,8 +41,7 @@
41
41
  "test": "mocha --exit --slow=75 --timeout=30000",
42
42
  "test:container": "docker-compose up --detach --build",
43
43
  "benchmark": "node benchmark",
44
- "download": "bash ./deps/download.sh",
45
- "setup": "powershell ./deps/setup.ps1",
44
+ "update-sqlite3mc": "bash ./deps/update-sqlite3mc.sh",
46
45
  "lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz",
47
46
  "bump:patch": "npm --no-git-tag-version version patch",
48
47
  "bump:minor": "npm --no-git-tag-version version minor",
package/deps/setup.ps1 DELETED
@@ -1,38 +0,0 @@
1
- # ENV
2
- $ErrorActionPreference = "Stop"
3
-
4
- # SQLite Info
5
- $SQLITEMC_VER = "v2.0.2"
6
- $API_URL = "https://api.github.com/repos/utelle/SQLite3MultipleCiphers/releases/tags/" + $SQLITEMC_VER
7
-
8
- # Paths
9
- $TEMP_PATH = Join-Path $PSScriptRoot "temp"
10
- $SOURCE_PATH = Join-Path $TEMP_PATH "source.zip"
11
- $EXTRACT_PATH = Join-Path $TEMP_PATH "extracted"
12
- $DEST_PATH = Join-Path $PSScriptRoot "sqlite3"
13
-
14
- Write-Host "Preparing.."
15
- Remove-Item -Path $TEMP_PATH -Recurse -Force -ErrorAction Ignore
16
-
17
- Write-Host "`r`nDiscovering the asset.."
18
- $RESULT = Invoke-WebRequest $API_URL -Method Get | ConvertFrom-Json
19
- $FILE = @($RESULT.assets.name) -match '-amalgamation.zip' | Select-Object -First 1
20
- $DL_URL = @($RESULT.assets.browser_download_url) -match '-amalgamation.zip' | Select-Object -First 1
21
-
22
- Write-Host "`r`nDownloading.. ($( $FILE ))"
23
- Invoke-WebRequest -Uri $DL_URL -OutFile (New-Item -Path $SOURCE_PATH -Force)
24
-
25
- Write-Host "`r`nExtracting archive.."
26
- Expand-Archive -Path $SOURCE_PATH -DestinationPath $EXTRACT_PATH
27
-
28
- Write-Host "`r`nCopying SQLite3MC source files.."
29
- Remove-Item -Path $DEST_PATH -Recurse -Force -ErrorAction Ignore
30
- New-Item $DEST_PATH -Type Directory
31
- Copy-Item -Path (Join-Path $EXTRACT_PATH "sqlite3mc_amalgamation.h") -Destination (Join-Path $DEST_PATH "sqlite3.h")
32
- Copy-Item -Path (Join-Path $EXTRACT_PATH "sqlite3mc_amalgamation.c") -Destination (Join-Path $DEST_PATH "sqlite3.c")
33
- Copy-Item -Path (Join-Path $EXTRACT_PATH "sqlite3ext.h") -Destination (Join-Path $DEST_PATH "sqlite3ext.h")
34
-
35
- Write-Host "`r`nCleaning up.."
36
- Remove-Item -Path $TEMP_PATH -Recurse -Force
37
-
38
- Write-Host "`r`nProcess completed" -ForegroundColor green