better-sqlite3-multiple-ciphers 11.7.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.
@@ -20,7 +20,7 @@
20
20
  ** Purpose: SQLite3 Multiple Ciphers version numbers
21
21
  ** Author: Ulrich Telle
22
22
  ** Created: 2020-08-05
23
- ** Copyright: (c) 2020-2024 Ulrich Telle
23
+ ** Copyright: (c) 2020-2025 Ulrich Telle
24
24
  ** License: MIT
25
25
  */
26
26
 
@@ -29,11 +29,11 @@
29
29
  #ifndef SQLITE3MC_VERSION_H_
30
30
  #define SQLITE3MC_VERSION_H_
31
31
 
32
- #define SQLITE3MC_VERSION_MAJOR 1
33
- #define SQLITE3MC_VERSION_MINOR 9
32
+ #define SQLITE3MC_VERSION_MAJOR 2
33
+ #define SQLITE3MC_VERSION_MINOR 0
34
34
  #define SQLITE3MC_VERSION_RELEASE 2
35
35
  #define SQLITE3MC_VERSION_SUBRELEASE 0
36
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.9.2"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.0.2"
37
37
 
38
38
  #endif /* SQLITE3MC_VERSION_H_ */
39
39
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -192,9 +192,9 @@ extern "C" {
192
192
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
193
193
  ** [sqlite_version()] and [sqlite_source_id()].
194
194
  */
195
- #define SQLITE_VERSION "3.47.2"
196
- #define SQLITE_VERSION_NUMBER 3047002
197
- #define SQLITE_SOURCE_ID "2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c"
195
+ #define SQLITE_VERSION "3.48.0"
196
+ #define SQLITE_VERSION_NUMBER 3048000
197
+ #define SQLITE_SOURCE_ID "2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010"
198
198
 
199
199
  /*
200
200
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -1146,6 +1146,11 @@ struct sqlite3_io_methods {
1146
1146
  ** pointed to by the pArg argument. This capability is used during testing
1147
1147
  ** and only needs to be supported when SQLITE_TEST is defined.
1148
1148
  **
1149
+ ** <li>[[SQLITE_FCNTL_NULL_IO]]
1150
+ ** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
1151
+ ** or file handle for the [sqlite3_file] object such that it will no longer
1152
+ ** read or write to the database file.
1153
+ **
1149
1154
  ** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
1150
1155
  ** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
1151
1156
  ** be advantageous to block on the next WAL lock if the lock is not immediately
@@ -1299,6 +1304,7 @@ struct sqlite3_io_methods {
1299
1304
  #define SQLITE_FCNTL_EXTERNAL_READER 40
1300
1305
  #define SQLITE_FCNTL_CKSM_FILE 41
1301
1306
  #define SQLITE_FCNTL_RESET_CACHE 42
1307
+ #define SQLITE_FCNTL_NULL_IO 43
1302
1308
 
1303
1309
  /* deprecated names */
1304
1310
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -2677,10 +2683,14 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
2677
2683
  ** deleted by the most recently completed INSERT, UPDATE or DELETE
2678
2684
  ** statement on the database connection specified by the only parameter.
2679
2685
  ** The two functions are identical except for the type of the return value
2680
- ** and that if the number of rows modified by the most recent INSERT, UPDATE
2686
+ ** and that if the number of rows modified by the most recent INSERT, UPDATE,
2681
2687
  ** or DELETE is greater than the maximum value supported by type "int", then
2682
2688
  ** the return value of sqlite3_changes() is undefined. ^Executing any other
2683
2689
  ** type of SQL statement does not modify the value returned by these functions.
2690
+ ** For the purposes of this interface, a CREATE TABLE AS SELECT statement
2691
+ ** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
2692
+ ** added to the new table by the CREATE TABLE AS SELECT statement are not
2693
+ ** counted.
2684
2694
  **
2685
2695
  ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2686
2696
  ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
@@ -4240,11 +4250,22 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4240
4250
  ** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
4241
4251
  ** to return an error (error code SQLITE_ERROR) if the statement uses
4242
4252
  ** any virtual tables.
4253
+ **
4254
+ ** [[SQLITE_PREPARE_DONT_LOG]] <dt>SQLITE_PREPARE_DONT_LOG</dt>
4255
+ ** <dd>The SQLITE_PREPARE_DONT_LOG flag prevents SQL compiler
4256
+ ** errors from being sent to the error log defined by
4257
+ ** [SQLITE_CONFIG_LOG]. This can be used, for example, to do test
4258
+ ** compiles to see if some SQL syntax is well-formed, without generating
4259
+ ** messages on the global error log when it is not. If the test compile
4260
+ ** fails, the sqlite3_prepare_v3() call returns the same error indications
4261
+ ** with or without this flag; it just omits the call to [sqlite3_log()] that
4262
+ ** logs the error.
4243
4263
  ** </dl>
4244
4264
  */
4245
4265
  #define SQLITE_PREPARE_PERSISTENT 0x01
4246
4266
  #define SQLITE_PREPARE_NORMALIZE 0x02
4247
4267
  #define SQLITE_PREPARE_NO_VTAB 0x04
4268
+ #define SQLITE_PREPARE_DONT_LOG 0x10
4248
4269
 
4249
4270
  /*
4250
4271
  ** CAPI3REF: Compiling An SQL Statement
@@ -10935,7 +10956,7 @@ SQLITE_API int sqlite3_deserialize(
10935
10956
  #ifdef __cplusplus
10936
10957
  } /* End of the 'extern "C"' block */
10937
10958
  #endif
10938
- #endif /* SQLITE3_H */
10959
+ /* #endif for SQLITE3_H will be added by mksqlite3.tcl */
10939
10960
 
10940
10961
  /******** Begin file sqlite3rtree.h *********/
10941
10962
  /*
@@ -13186,14 +13207,29 @@ struct Fts5PhraseIter {
13186
13207
  ** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
13187
13208
  ** output variable (*ppToken) is set to point to a buffer containing the
13188
13209
  ** matching document token, and (*pnToken) to the size of that buffer in
13189
- ** bytes. This API is not available if the specified token matches a
13190
- ** prefix query term. In that case both output variables are always set
13191
- ** to 0.
13210
+ ** bytes.
13192
13211
  **
13193
13212
  ** The output text is not a copy of the document text that was tokenized.
13194
13213
  ** It is the output of the tokenizer module. For tokendata=1 tables, this
13195
13214
  ** includes any embedded 0x00 and trailing data.
13196
13215
  **
13216
+ ** This API may be slow in some cases if the token identified by parameters
13217
+ ** iIdx and iToken matched a prefix token in the query. In most cases, the
13218
+ ** first call to this API for each prefix token in the query is forced
13219
+ ** to scan the portion of the full-text index that matches the prefix
13220
+ ** token to collect the extra data required by this API. If the prefix
13221
+ ** token matches a large number of token instances in the document set,
13222
+ ** this may be a performance problem.
13223
+ **
13224
+ ** If the user knows in advance that a query may use this API for a
13225
+ ** prefix token, FTS5 may be configured to collect all required data as part
13226
+ ** of the initial querying of the full-text index, avoiding the second scan
13227
+ ** entirely. This also causes prefix queries that do not use this API to
13228
+ ** run more slowly and use more memory. FTS5 may be configured in this way
13229
+ ** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
13230
+ ** option, or on a per-query basis using the
13231
+ ** [fts5_insttoken | fts5_insttoken()] user function.
13232
+ **
13197
13233
  ** This API can be quite slow if used with an FTS5 table created with the
13198
13234
  ** "detail=none" or "detail=column" option.
13199
13235
  **
@@ -13627,110 +13663,12 @@ struct fts5_api {
13627
13663
  #endif /* _FTS5_H */
13628
13664
 
13629
13665
  /******** End of fts5.h *********/
13666
+ #endif /* SQLITE3_H */
13630
13667
  /*** End of #include "sqlite3.h" ***/
13631
13668
 
13632
13669
 
13633
13670
  #ifdef SQLITE_USER_AUTHENTICATION
13634
- /* #include "sqlite3userauth.h" */
13635
- /*** Begin of #include "sqlite3userauth.h" ***/
13636
- /*
13637
- ** 2014-09-08
13638
- **
13639
- ** The author disclaims copyright to this source code. In place of
13640
- ** a legal notice, here is a blessing:
13641
- **
13642
- ** May you do good and not evil.
13643
- ** May you find forgiveness for yourself and forgive others.
13644
- ** May you share freely, never taking more than you give.
13645
- **
13646
- *************************************************************************
13647
- **
13648
- ** This file contains the application interface definitions for the
13649
- ** user-authentication extension feature.
13650
- **
13651
- ** To compile with the user-authentication feature, append this file to
13652
- ** end of an SQLite amalgamation header file ("sqlite3.h"), then add
13653
- ** the SQLITE_USER_AUTHENTICATION compile-time option. See the
13654
- ** user-auth.txt file in the same source directory as this file for
13655
- ** additional information.
13656
- */
13657
- #ifdef SQLITE_USER_AUTHENTICATION
13658
-
13659
- #ifdef __cplusplus
13660
- extern "C" {
13661
- #endif
13662
-
13663
- /*
13664
- ** If a database contains the SQLITE_USER table, then the
13665
- ** sqlite3_user_authenticate() interface must be invoked with an
13666
- ** appropriate username and password prior to enable read and write
13667
- ** access to the database.
13668
- **
13669
- ** Return SQLITE_OK on success or SQLITE_ERROR if the username/password
13670
- ** combination is incorrect or unknown.
13671
- **
13672
- ** If the SQLITE_USER table is not present in the database file, then
13673
- ** this interface is a harmless no-op returnning SQLITE_OK.
13674
- */
13675
- SQLITE_API int sqlite3_user_authenticate(
13676
- sqlite3 *db, /* The database connection */
13677
- const char *zUsername, /* Username */
13678
- const char *aPW, /* Password or credentials */
13679
- int nPW /* Number of bytes in aPW[] */
13680
- );
13681
-
13682
- /*
13683
- ** The sqlite3_user_add() interface can be used (by an admin user only)
13684
- ** to create a new user. When called on a no-authentication-required
13685
- ** database, this routine converts the database into an authentication-
13686
- ** required database, automatically makes the added user an
13687
- ** administrator, and logs in the current connection as that user.
13688
- ** The sqlite3_user_add() interface only works for the "main" database, not
13689
- ** for any ATTACH-ed databases. Any call to sqlite3_user_add() by a
13690
- ** non-admin user results in an error.
13691
- */
13692
- SQLITE_API int sqlite3_user_add(
13693
- sqlite3 *db, /* Database connection */
13694
- const char *zUsername, /* Username to be added */
13695
- const char *aPW, /* Password or credentials */
13696
- int nPW, /* Number of bytes in aPW[] */
13697
- int isAdmin /* True to give new user admin privilege */
13698
- );
13699
-
13700
- /*
13701
- ** The sqlite3_user_change() interface can be used to change a users
13702
- ** login credentials or admin privilege. Any user can change their own
13703
- ** login credentials. Only an admin user can change another users login
13704
- ** credentials or admin privilege setting. No user may change their own
13705
- ** admin privilege setting.
13706
- */
13707
- SQLITE_API int sqlite3_user_change(
13708
- sqlite3 *db, /* Database connection */
13709
- const char *zUsername, /* Username to change */
13710
- const char *aPW, /* New password or credentials */
13711
- int nPW, /* Number of bytes in aPW[] */
13712
- int isAdmin /* Modified admin privilege for the user */
13713
- );
13714
-
13715
- /*
13716
- ** The sqlite3_user_delete() interface can be used (by an admin user only)
13717
- ** to delete a user. The currently logged-in user cannot be deleted,
13718
- ** which guarantees that there is always an admin user and hence that
13719
- ** the database cannot be converted into a no-authentication-required
13720
- ** database.
13721
- */
13722
- SQLITE_API int sqlite3_user_delete(
13723
- sqlite3 *db, /* Database connection */
13724
- const char *zUsername /* Username to remove */
13725
- );
13726
-
13727
- #ifdef __cplusplus
13728
- } /* end of the 'extern "C"' block */
13729
- #endif
13730
-
13731
- #endif /* SQLITE_USER_AUTHENTICATION */
13732
- /*** End of #include "sqlite3userauth.h" ***/
13733
-
13671
+ #undef SQLITE_USER_AUTHENTICATION
13734
13672
  #endif
13735
13673
 
13736
13674
  /*
@@ -13743,7 +13681,8 @@ SQLITE_API int sqlite3_user_delete(
13743
13681
  #define CODEC_TYPE_SQLCIPHER 4
13744
13682
  #define CODEC_TYPE_RC4 5
13745
13683
  #define CODEC_TYPE_ASCON128 6
13746
- #define CODEC_TYPE_MAX_BUILTIN 6
13684
+ #define CODEC_TYPE_AEGIS 7
13685
+ #define CODEC_TYPE_MAX_BUILTIN 7
13747
13686
 
13748
13687
  /*
13749
13688
  ** Definition of API functions
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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for better-sqlite3-multiple-ciphers 11.2.1
1
+ // Type definitions for better-sqlite3-multiple-ciphers 11.8.0
2
2
  // Project: https://github.com/m4heshd/better-sqlite3-multiple-ciphers
3
3
  // Definitions by: Ben Davies <https://github.com/Morfent>
4
4
  // Mathew Rumsey <https://github.com/matrumz>
@@ -102,18 +102,19 @@ declare namespace BetterSqlite3MultipleCiphers {
102
102
  new(filename?: string | Buffer, options?: Database.Options): Database;
103
103
  (filename?: string, options?: Database.Options): Database;
104
104
  prototype: Database;
105
-
106
- SqliteError: typeof SqliteError;
105
+ SqliteError: SqliteErrorType;
107
106
  }
108
107
  }
109
108
 
110
- declare class SqliteError extends Error {
109
+ declare class SqliteErrorClass extends Error {
111
110
  name: string;
112
111
  message: string;
113
112
  code: string;
114
113
  constructor(message: string, code: string);
115
114
  }
116
115
 
116
+ type SqliteErrorType = typeof SqliteErrorClass;
117
+
117
118
  declare namespace Database {
118
119
  interface RunResult {
119
120
  changes: number;
@@ -153,7 +154,7 @@ declare namespace Database {
153
154
  progress: (info: BackupMetadata) => number;
154
155
  }
155
156
 
156
- type SqliteError = typeof SqliteError;
157
+ type SqliteError = SqliteErrorType;
157
158
  type Statement<BindParameters extends unknown[] | {} = unknown[], Result = unknown> = BindParameters extends unknown[] ?
158
159
  BetterSqlite3MultipleCiphers.Statement<BindParameters, Result> :
159
160
  BetterSqlite3MultipleCiphers.Statement<[BindParameters], Result>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "11.7.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>",
@@ -28,7 +28,7 @@
28
28
  "fs-extra": "^11.1.1",
29
29
  "mocha": "^10.2.0",
30
30
  "nodemark": "^0.3.0",
31
- "prebuild": "^13.0.0",
31
+ "prebuild": "^13.0.1",
32
32
  "sqlite": "^5.0.1",
33
33
  "sqlite3": "^5.1.6"
34
34
  },
@@ -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 = "v1.9.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