@op-engineering/op-sqlite 14.1.3 → 15.0.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/android/CMakeLists.txt +23 -62
- package/android/build.gradle +104 -164
- package/android/gradle.properties +5 -1
- package/android/jniLibs/arm64-v8a/libsql_experimental.a +0 -0
- package/android/jniLibs/armeabi-v7a/libsql_experimental.a +0 -0
- package/android/jniLibs/x86/libsql_experimental.a +0 -0
- package/android/jniLibs/x86_64/libsql_experimental.a +0 -0
- package/android/src/main/AndroidManifest.xml +2 -1
- package/cpp/DBHostObject.cpp +21 -2
- package/cpp/DBHostObject.h +2 -1
- package/cpp/bindings.cpp +7 -1
- package/cpp/libsql/bridge.cpp +3 -1
- package/cpp/libsql/bridge.h +2 -1
- package/cpp/libsql/libsql.h +1 -0
- package/cpp/sqlcipher/sqlite3.c +3091 -1643
- package/cpp/sqlcipher/sqlite3.h +188 -128
- package/cpp/sqlite3.c +304 -176
- package/cpp/sqlite3.h +89 -87
- package/ios/libsql.xcframework/Info.plist +5 -5
- package/ios/libsql.xcframework/ios-arm64/Headers/libsql.h +1 -0
- package/ios/libsql.xcframework/ios-arm64/libsql_experimental.a +0 -0
- package/ios/libsql.xcframework/ios-arm64_x86_64-simulator/Headers/libsql.h +1 -0
- package/ios/libsql.xcframework/ios-arm64_x86_64-simulator/libsql_experimental.a +0 -0
- package/lib/module/Storage.js +9 -2
- package/lib/module/Storage.js.map +1 -1
- package/lib/module/index.js +8 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Storage.d.ts +4 -0
- package/lib/typescript/src/Storage.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +10 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/op-sqlite.podspec +2 -11
- package/package.json +48 -19
- package/src/Storage.ts +8 -1
- package/src/index.ts +14 -2
- package/android/.project +0 -17
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/src/paper/java/com/op/sqlite/NativeOPSQLiteSpec.java +0 -77
- package/lib/commonjs/NativeOPSQLite.js +0 -9
- package/lib/commonjs/NativeOPSQLite.js.map +0 -1
- package/lib/commonjs/Storage.js +0 -60
- package/lib/commonjs/Storage.js.map +0 -1
- package/lib/commonjs/index.js +0 -387
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
package/android/CMakeLists.txt
CHANGED
|
@@ -72,72 +72,33 @@ if (USER_DEFINED_SOURCE_FILES)
|
|
|
72
72
|
endif()
|
|
73
73
|
|
|
74
74
|
if (USE_SQLCIPHER)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)
|
|
84
|
-
else()
|
|
85
|
-
target_link_libraries(
|
|
86
|
-
${PACKAGE_NAME}
|
|
87
|
-
${LOG_LIB}
|
|
88
|
-
fbjni::fbjni
|
|
89
|
-
ReactAndroid::jsi
|
|
90
|
-
ReactAndroid::turbomodulejsijni
|
|
91
|
-
ReactAndroid::react_nativemodule_core
|
|
92
|
-
android
|
|
93
|
-
openssl::crypto
|
|
94
|
-
)
|
|
95
|
-
endif()
|
|
75
|
+
target_link_libraries(
|
|
76
|
+
${PACKAGE_NAME}
|
|
77
|
+
${LOG_LIB}
|
|
78
|
+
ReactAndroid::reactnative
|
|
79
|
+
ReactAndroid::jsi
|
|
80
|
+
fbjni::fbjni
|
|
81
|
+
openssl::crypto
|
|
82
|
+
)
|
|
96
83
|
elseif (USE_LIBSQL)
|
|
97
84
|
cmake_path(SET LIBSQL ${CMAKE_CURRENT_SOURCE_DIR}/jniLibs/${ANDROID_ABI}/libsql_experimental.a NORMALIZE)
|
|
98
85
|
add_library(libsql STATIC IMPORTED)
|
|
99
86
|
set_target_properties(libsql PROPERTIES IMPORTED_LOCATION ${LIBSQL})
|
|
100
87
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
)
|
|
110
|
-
else()
|
|
111
|
-
target_link_libraries(
|
|
112
|
-
${PACKAGE_NAME}
|
|
113
|
-
${LOG_LIB}
|
|
114
|
-
fbjni::fbjni
|
|
115
|
-
ReactAndroid::jsi
|
|
116
|
-
ReactAndroid::turbomodulejsijni
|
|
117
|
-
ReactAndroid::react_nativemodule_core
|
|
118
|
-
android
|
|
119
|
-
libsql
|
|
120
|
-
)
|
|
121
|
-
endif()
|
|
88
|
+
target_link_libraries(
|
|
89
|
+
${PACKAGE_NAME}
|
|
90
|
+
${LOG_LIB}
|
|
91
|
+
ReactAndroid::reactnative
|
|
92
|
+
ReactAndroid::jsi
|
|
93
|
+
fbjni::fbjni
|
|
94
|
+
libsql
|
|
95
|
+
)
|
|
122
96
|
else ()
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
fbjni::fbjni
|
|
131
|
-
)
|
|
132
|
-
else()
|
|
133
|
-
target_link_libraries(
|
|
134
|
-
${PACKAGE_NAME}
|
|
135
|
-
${LOG_LIB}
|
|
136
|
-
fbjni::fbjni
|
|
137
|
-
ReactAndroid::jsi
|
|
138
|
-
ReactAndroid::turbomodulejsijni
|
|
139
|
-
ReactAndroid::react_nativemodule_core
|
|
140
|
-
android
|
|
141
|
-
)
|
|
142
|
-
endif()
|
|
97
|
+
target_link_libraries(
|
|
98
|
+
${PACKAGE_NAME}
|
|
99
|
+
${LOG_LIB}
|
|
100
|
+
ReactAndroid::reactnative
|
|
101
|
+
ReactAndroid::jsi
|
|
102
|
+
fbjni::fbjni
|
|
103
|
+
)
|
|
143
104
|
endif()
|
package/android/build.gradle
CHANGED
|
@@ -2,29 +2,29 @@ import java.nio.file.Paths
|
|
|
2
2
|
import groovy.json.JsonSlurper
|
|
3
3
|
|
|
4
4
|
buildscript {
|
|
5
|
+
ext.getExtOrDefault = {name ->
|
|
6
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['OPSQLite_' + name]
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
repositories {
|
|
6
10
|
google()
|
|
7
|
-
|
|
11
|
+
mavenCentral()
|
|
8
12
|
}
|
|
9
13
|
|
|
10
|
-
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["OPSQLite_kotlinVersion"]
|
|
11
|
-
|
|
12
14
|
dependencies {
|
|
13
|
-
classpath("com.android.tools.build:gradle:7.
|
|
15
|
+
classpath("com.android.tools.build:gradle:8.7.2")
|
|
14
16
|
// noinspection DifferentKotlinGradleVersion
|
|
15
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$
|
|
17
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
String tskReqStr = gradle.getStartParameter().getTaskRequests()['args'].toString()
|
|
21
|
+
apply plugin: "com.android.library"
|
|
22
|
+
apply plugin: "kotlin-android"
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
}
|
|
24
|
+
apply plugin: "com.facebook.react"
|
|
25
25
|
|
|
26
|
-
def
|
|
27
|
-
return
|
|
26
|
+
def getExtOrIntegerDefault(name) {
|
|
27
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["OPSQLite_" + name]).toInteger()
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
def useSQLCipher = false
|
|
@@ -66,8 +66,7 @@ def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
|
|
|
66
66
|
def opsqliteConfig = packageJson["op-sqlite"]
|
|
67
67
|
|
|
68
68
|
if(opsqliteConfig) {
|
|
69
|
-
println "[OP-SQLITE] Detected op-sqlite config from package.json at: " + packageJsonFile.absolutePath
|
|
70
|
-
|
|
69
|
+
println "[OP-SQLITE] Detected op-sqlite config from package.json at: " + packageJsonFile.absolutePath
|
|
71
70
|
useSQLCipher = opsqliteConfig["sqlcipher"]
|
|
72
71
|
useCRSQLite = opsqliteConfig["crsqlite"]
|
|
73
72
|
useSqliteVec = opsqliteConfig["sqliteVec"]
|
|
@@ -80,12 +79,10 @@ println "[OP-SQLITE] Detected op-sqlite config from package.json at: " + package
|
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
if(useSQLCipher) {
|
|
83
|
-
println "[OP-SQLITE] using
|
|
82
|
+
println "[OP-SQLITE] using sqlcipher."
|
|
84
83
|
} else if(useLibsql) {
|
|
85
|
-
println "[OP-SQLITE] using libsql
|
|
86
|
-
}
|
|
87
|
-
println "[OP-SQLITE] using Vanilla SQLite"
|
|
88
|
-
}
|
|
84
|
+
println "[OP-SQLITE] using libsql. Report any issues to Turso"
|
|
85
|
+
}
|
|
89
86
|
|
|
90
87
|
if(useCRSQLite) {
|
|
91
88
|
println "[OP-SQLITE] using CR-SQLite 🤖"
|
|
@@ -112,132 +109,98 @@ if (!tokenizers.isEmpty()) {
|
|
|
112
109
|
println "[OP-SQLITE] Tokenizers enabled! 🧾 Tokenizers: " + tokenizers
|
|
113
110
|
}
|
|
114
111
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
apply plugin: 'com.android.library'
|
|
120
|
-
apply plugin: "kotlin-android"
|
|
112
|
+
android {
|
|
113
|
+
namespace "com.op.sqlite"
|
|
121
114
|
|
|
122
|
-
|
|
123
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
124
|
-
}
|
|
115
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
125
116
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
defaultConfig {
|
|
118
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
119
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
129
120
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
externalNativeBuild {
|
|
122
|
+
cmake {
|
|
123
|
+
if(useSQLCipher) {
|
|
124
|
+
cFlags += "-DOP_SQLITE_USE_SQLCIPHER=1"
|
|
125
|
+
cppFlags += "-DOP_SQLITE_USE_SQLCIPHER=1"
|
|
126
|
+
}
|
|
127
|
+
if(useLibsql) {
|
|
128
|
+
cFlags += "-DOP_SQLITE_USE_LIBSQL=1"
|
|
129
|
+
cppFlags += "-DOP_SQLITE_USE_LIBSQL=1"
|
|
130
|
+
}
|
|
131
|
+
if(useCRSQLite) {
|
|
132
|
+
cFlags += "-DOP_SQLITE_USE_CRSQLITE=1"
|
|
133
|
+
cppFlags += "-DOP_SQLITE_USE_CRSQLITE=1"
|
|
134
|
+
}
|
|
135
|
+
if(performanceMode) {
|
|
136
|
+
cFlags += ["-DSQLITE_DQS=0", "-DSQLITE_THREADSAFE=1", "-DSQLITE_DEFAULT_MEMSTATUS=0", "-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1", "-DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1", "-DSQLITE_MAX_EXPR_DEPTH=0", "-DSQLITE_OMIT_DEPRECATED=1", "-DSQLITE_OMIT_PROGRESS_CALLBACK=1", "-DSQLITE_OMIT_SHARED_CACHE=1", "-DSQLITE_USE_ALLOCA=1"]
|
|
137
|
+
}
|
|
138
|
+
if(enableFTS5) {
|
|
139
|
+
cFlags += ["-DSQLITE_ENABLE_FTS5=1"]
|
|
140
|
+
}
|
|
141
|
+
if(enableRtree) {
|
|
142
|
+
cFlags += ["-DSQLITE_ENABLE_RTREE=1"]
|
|
143
|
+
}
|
|
144
|
+
if(useSqliteVec) {
|
|
145
|
+
cFlags += "-DOP_SQLITE_USE_SQLITE_VEC=1"
|
|
146
|
+
cppFlags += "-DOP_SQLITE_USE_SQLITE_VEC=1"
|
|
147
|
+
}
|
|
134
148
|
|
|
135
|
-
|
|
149
|
+
// This are zeroes because they will be passed as C flags, so they become falsy
|
|
150
|
+
def sourceFiles = 0
|
|
151
|
+
// def tokenizerInitStrings = 0
|
|
152
|
+
def tokenizersHeaderPath = 0
|
|
153
|
+
if (!tokenizers.isEmpty()) {
|
|
154
|
+
def sourceDir = isUserApp ? file("$rootDir/../../../c_sources") : file("$rootDir/../c_sources")
|
|
155
|
+
def destDir = file("$buildscript.sourceFile.parentFile/c_sources")
|
|
156
|
+
copy {
|
|
157
|
+
from sourceDir
|
|
158
|
+
into destDir
|
|
159
|
+
include "**/*.cpp", "**/*.h"
|
|
160
|
+
}
|
|
161
|
+
sourceFiles = fileTree(dir: destDir, include: ["**/*.cpp", "**/*.h"]).files.join(";")
|
|
162
|
+
tokenizersHeaderPath = "../c_sources/tokenizers.h"
|
|
163
|
+
}
|
|
136
164
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
165
|
+
cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all"
|
|
166
|
+
arguments "-DANDROID_STL=c++_shared",
|
|
167
|
+
"-DSQLITE_FLAGS='$sqliteFlags'",
|
|
168
|
+
"-DUSE_SQLCIPHER=${useSQLCipher ? 1 : 0}",
|
|
169
|
+
"-DUSE_CRSQLITE=${useCRSQLite ? 1 : 0}",
|
|
170
|
+
"-DUSE_LIBSQL=${useLibsql ? 1 : 0}",
|
|
171
|
+
"-DUSE_SQLITE_VEC=${useSqliteVec ? 1 : 0}",
|
|
172
|
+
"-DUSER_DEFINED_SOURCE_FILES=${sourceFiles}",
|
|
173
|
+
"-DUSER_DEFINED_TOKENIZERS_HEADER_PATH='${tokenizersHeaderPath}'",
|
|
174
|
+
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
146
177
|
}
|
|
147
178
|
|
|
148
179
|
buildFeatures {
|
|
180
|
+
buildConfig true
|
|
149
181
|
prefab true
|
|
150
182
|
prefabPublishing true
|
|
151
183
|
}
|
|
152
184
|
|
|
185
|
+
buildTypes {
|
|
186
|
+
release {
|
|
187
|
+
minifyEnabled false
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
153
191
|
prefab {
|
|
154
192
|
"op-sqlite" {
|
|
155
193
|
headers "${project.buildDir}/headers/op-sqlite/"
|
|
156
194
|
}
|
|
157
195
|
}
|
|
158
196
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
targetSdkVersion safeExtGet('targetSdkVersion', 35)
|
|
162
|
-
versionCode 1
|
|
163
|
-
versionName "1.0"
|
|
164
|
-
|
|
165
|
-
externalNativeBuild {
|
|
166
|
-
cmake {
|
|
167
|
-
if(useSQLCipher) {
|
|
168
|
-
cFlags += "-DOP_SQLITE_USE_SQLCIPHER=1"
|
|
169
|
-
cppFlags += "-DOP_SQLITE_USE_SQLCIPHER=1"
|
|
170
|
-
}
|
|
171
|
-
if(useLibsql) {
|
|
172
|
-
cFlags += "-DOP_SQLITE_USE_LIBSQL=1"
|
|
173
|
-
cppFlags += "-DOP_SQLITE_USE_LIBSQL=1"
|
|
174
|
-
}
|
|
175
|
-
if(useCRSQLite) {
|
|
176
|
-
cFlags += "-DOP_SQLITE_USE_CRSQLITE=1"
|
|
177
|
-
cppFlags += "-DOP_SQLITE_USE_CRSQLITE=1"
|
|
178
|
-
}
|
|
179
|
-
if(performanceMode) {
|
|
180
|
-
cFlags += ["-DSQLITE_DQS=0", "-DSQLITE_THREADSAFE=1", "-DSQLITE_DEFAULT_MEMSTATUS=0", "-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1", "-DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1", "-DSQLITE_MAX_EXPR_DEPTH=0", "-DSQLITE_OMIT_DEPRECATED=1", "-DSQLITE_OMIT_PROGRESS_CALLBACK=1", "-DSQLITE_OMIT_SHARED_CACHE=1", "-DSQLITE_USE_ALLOCA=1"]
|
|
181
|
-
}
|
|
182
|
-
if(enableFTS5) {
|
|
183
|
-
cFlags += ["-DSQLITE_ENABLE_FTS5=1"]
|
|
184
|
-
}
|
|
185
|
-
if(enableRtree) {
|
|
186
|
-
cFlags += ["-DSQLITE_ENABLE_RTREE=1"]
|
|
187
|
-
}
|
|
188
|
-
if(useSqliteVec) {
|
|
189
|
-
cFlags += "-DOP_SQLITE_USE_SQLITE_VEC=1"
|
|
190
|
-
cppFlags += "-DOP_SQLITE_USE_SQLITE_VEC=1"
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// This are zeroes because they will be passed as C flags, so they become falsy
|
|
194
|
-
def sourceFiles = 0
|
|
195
|
-
// def tokenizerInitStrings = 0
|
|
196
|
-
def tokenizersHeaderPath = 0
|
|
197
|
-
if (!tokenizers.isEmpty()) {
|
|
198
|
-
def sourceDir = isUserApp ? file("$rootDir/../../../c_sources") : file("$rootDir/../c_sources")
|
|
199
|
-
def destDir = file("$buildscript.sourceFile.parentFile/c_sources")
|
|
200
|
-
copy {
|
|
201
|
-
from sourceDir
|
|
202
|
-
into destDir
|
|
203
|
-
include "**/*.cpp", "**/*.h"
|
|
204
|
-
}
|
|
205
|
-
sourceFiles = fileTree(dir: destDir, include: ["**/*.cpp", "**/*.h"]).files.join(";")
|
|
206
|
-
tokenizersHeaderPath = "../c_sources/tokenizers.h"
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all"
|
|
210
|
-
abiFilters(*reactNativeArchitectures())
|
|
211
|
-
arguments "-DANDROID_STL=c++_shared",
|
|
212
|
-
"-DSQLITE_FLAGS='$sqliteFlags'",
|
|
213
|
-
"-DUSE_SQLCIPHER=${useSQLCipher ? 1 : 0}",
|
|
214
|
-
"-DUSE_CRSQLITE=${useCRSQLite ? 1 : 0}",
|
|
215
|
-
"-DUSE_LIBSQL=${useLibsql ? 1 : 0}",
|
|
216
|
-
"-DUSE_SQLITE_VEC=${useSqliteVec ? 1 : 0}",
|
|
217
|
-
"-DUSER_DEFINED_SOURCE_FILES=${sourceFiles}",
|
|
218
|
-
"-DUSER_DEFINED_TOKENIZERS_HEADER_PATH='${tokenizersHeaderPath}'",
|
|
219
|
-
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
packagingOptions {
|
|
224
|
-
doNotStrip resolveBuildType() == 'debug' ? "**/**/*.so" : ''
|
|
225
|
-
excludes = [
|
|
226
|
-
"META-INF",
|
|
227
|
-
"META-INF/**",
|
|
228
|
-
"**/libjsi.so",
|
|
229
|
-
"**/libreact_nativemodule_core.so",
|
|
230
|
-
"**/libturbomodulejsijni.so",
|
|
231
|
-
"**/libc++_shared.so",
|
|
232
|
-
"**/libfbjni.so",
|
|
233
|
-
"**/libreactnative.so",
|
|
234
|
-
]
|
|
235
|
-
}
|
|
197
|
+
lintOptions {
|
|
198
|
+
disable "GradleCompatible"
|
|
236
199
|
}
|
|
237
200
|
|
|
238
201
|
compileOptions {
|
|
239
|
-
sourceCompatibility JavaVersion.
|
|
240
|
-
targetCompatibility JavaVersion.
|
|
202
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
203
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
241
204
|
}
|
|
242
205
|
|
|
243
206
|
externalNativeBuild {
|
|
@@ -246,21 +209,20 @@ android {
|
|
|
246
209
|
}
|
|
247
210
|
}
|
|
248
211
|
|
|
249
|
-
sourceSets
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
srcDirs += 'src/main/libsqlitevec'
|
|
212
|
+
sourceSets {
|
|
213
|
+
main {
|
|
214
|
+
java.srcDirs += [
|
|
215
|
+
"generated/java",
|
|
216
|
+
"generated/jni"
|
|
217
|
+
]
|
|
218
|
+
jniLibs {
|
|
219
|
+
srcDirs = []
|
|
220
|
+
if (useCRSQLite) {
|
|
221
|
+
srcDirs += 'src/main/libcrsqlite'
|
|
222
|
+
}
|
|
223
|
+
if (useSqliteVec) {
|
|
224
|
+
srcDirs += 'src/main/libsqlitevec'
|
|
225
|
+
}
|
|
264
226
|
}
|
|
265
227
|
}
|
|
266
228
|
}
|
|
@@ -272,11 +234,12 @@ repositories {
|
|
|
272
234
|
}
|
|
273
235
|
|
|
274
236
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
237
|
+
|
|
275
238
|
dependencies {
|
|
276
|
-
implementation
|
|
239
|
+
implementation "com.facebook.react:react-android"
|
|
277
240
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
278
241
|
if (useSQLCipher) {
|
|
279
|
-
implementation('io.github.ronickg:openssl:3.3.2')
|
|
242
|
+
implementation('io.github.ronickg:openssl:3.3.2-1')
|
|
280
243
|
}
|
|
281
244
|
}
|
|
282
245
|
|
|
@@ -288,26 +251,3 @@ tasks.register('prepareHeaders', Copy) {
|
|
|
288
251
|
}
|
|
289
252
|
|
|
290
253
|
preBuild.dependsOn(prepareHeaders)
|
|
291
|
-
|
|
292
|
-
// Resolves "LOCAL_SRC_FILES points to a missing file, Check that libfb.so exists or that its path is correct".
|
|
293
|
-
tasks.configureEach { task ->
|
|
294
|
-
if (task.name.contains("configureCMakeDebug")) {
|
|
295
|
-
rootProject.getTasksByName("packageReactNdkDebugLibs", true).forEach {
|
|
296
|
-
task.dependsOn(it)
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
// We want to add a dependency for both configureCMakeRelease and configureCMakeRelWithDebInfo
|
|
300
|
-
if (task.name.contains("configureCMakeRel")) {
|
|
301
|
-
rootProject.getTasksByName("packageReactNdkReleaseLibs", true).forEach {
|
|
302
|
-
task.dependsOn(it)
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
if (isNewArchitectureEnabled()) {
|
|
308
|
-
react {
|
|
309
|
-
jsRootDir = file("../src/")
|
|
310
|
-
libraryName = "opsqlite"
|
|
311
|
-
codegenJavaPackageName = "com.op.sqlite.example"
|
|
312
|
-
}
|
|
313
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
</manifest>
|
package/cpp/DBHostObject.cpp
CHANGED
|
@@ -157,13 +157,15 @@ DBHostObject::DBHostObject(jsi::Runtime &rt,
|
|
|
157
157
|
std::string &db_name, std::string &path,
|
|
158
158
|
std::string &url, std::string &auth_token,
|
|
159
159
|
int sync_interval, bool offline,
|
|
160
|
-
std::string &encryption_key
|
|
160
|
+
std::string &encryption_key,
|
|
161
|
+
std::string &remote_encryption_key)
|
|
161
162
|
: db_name(db_name), invoker(std::move(invoker)), rt(rt) {
|
|
162
163
|
|
|
163
164
|
_thread_pool = std::make_shared<ThreadPool>();
|
|
164
165
|
|
|
165
166
|
db = opsqlite_libsql_open_sync(db_name, path, url, auth_token,
|
|
166
|
-
sync_interval, offline, encryption_key
|
|
167
|
+
sync_interval, offline, encryption_key,
|
|
168
|
+
remote_encryption_key);
|
|
167
169
|
|
|
168
170
|
create_jsi_functions();
|
|
169
171
|
}
|
|
@@ -359,6 +361,23 @@ void DBHostObject::create_jsi_functions() {
|
|
|
359
361
|
|
|
360
362
|
return create_js_rows(rt, status);
|
|
361
363
|
});
|
|
364
|
+
|
|
365
|
+
function_map["executeRawSync"] = HOSTFN("executeRawSync") {
|
|
366
|
+
const std::string query = args[0].asString(rt).utf8(rt);
|
|
367
|
+
std::vector<JSVariant> params = count == 2 && args[1].isObject()
|
|
368
|
+
? to_variant_vec(rt, args[1])
|
|
369
|
+
: std::vector<JSVariant>();
|
|
370
|
+
|
|
371
|
+
std::vector<std::vector<JSVariant>> results;
|
|
372
|
+
|
|
373
|
+
#ifdef OP_SQLITE_USE_LIBSQL
|
|
374
|
+
auto status = opsqlite_libsql_execute_raw(db, query, ¶ms, &results);
|
|
375
|
+
#else
|
|
376
|
+
auto status = opsqlite_execute_raw(db, query, ¶ms, &results);
|
|
377
|
+
#endif
|
|
378
|
+
|
|
379
|
+
return create_raw_result(rt, status, &results);
|
|
380
|
+
});
|
|
362
381
|
|
|
363
382
|
function_map["execute"] = HOSTFN("execute") {
|
|
364
383
|
const std::string query = args[0].asString(rt).utf8(rt);
|
package/cpp/DBHostObject.h
CHANGED
|
@@ -59,7 +59,8 @@ class JSI_EXPORT DBHostObject : public jsi::HostObject {
|
|
|
59
59
|
DBHostObject(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> invoker,
|
|
60
60
|
std::string &db_name, std::string &path, std::string &url,
|
|
61
61
|
std::string &auth_token, int sync_interval, bool offline,
|
|
62
|
-
std::string &encryption_key
|
|
62
|
+
std::string &encryption_key,
|
|
63
|
+
std::string &remote_encryption_key);
|
|
63
64
|
#endif
|
|
64
65
|
|
|
65
66
|
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
|
package/cpp/bindings.cpp
CHANGED
|
@@ -150,6 +150,12 @@ void install(jsi::Runtime &rt,
|
|
|
150
150
|
options.getProperty(rt, "encryptionKey").asString(rt).utf8(rt);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
std::string remote_encryption_key;
|
|
154
|
+
if (options.hasProperty(rt, "remoteEncryptionKey")) {
|
|
155
|
+
encryption_key =
|
|
156
|
+
options.getProperty(rt, "remoteEncryptionKey").asString(rt).utf8(rt);
|
|
157
|
+
}
|
|
158
|
+
|
|
153
159
|
std::string location;
|
|
154
160
|
if (options.hasProperty(rt, "location")) {
|
|
155
161
|
location =
|
|
@@ -166,7 +172,7 @@ void install(jsi::Runtime &rt,
|
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
std::shared_ptr<DBHostObject> db = std::make_shared<DBHostObject>(
|
|
169
|
-
rt, invoker, name, path, url, auth_token, sync_interval, offline, encryption_key);
|
|
175
|
+
rt, invoker, name, path, url, auth_token, sync_interval, offline, encryption_key, remote_encryption_key);
|
|
170
176
|
return jsi::Object::createFromHostObject(rt, db);
|
|
171
177
|
});
|
|
172
178
|
#endif
|
package/cpp/libsql/bridge.cpp
CHANGED
|
@@ -40,7 +40,8 @@ DB opsqlite_libsql_open_sync(std::string const &name,
|
|
|
40
40
|
std::string const &base_path,
|
|
41
41
|
std::string const &url,
|
|
42
42
|
std::string const &auth_token, int sync_interval,
|
|
43
|
-
bool offline, std::string const &encryption_key
|
|
43
|
+
bool offline, std::string const &encryption_key,
|
|
44
|
+
std::string const &remote_encryption_key) {
|
|
44
45
|
std::string path = opsqlite_get_db_path(name, base_path);
|
|
45
46
|
|
|
46
47
|
int status;
|
|
@@ -53,6 +54,7 @@ DB opsqlite_libsql_open_sync(std::string const &name,
|
|
|
53
54
|
.auth_token = auth_token.c_str(),
|
|
54
55
|
.read_your_writes = '1',
|
|
55
56
|
.encryption_key = encryption_key.c_str(),
|
|
57
|
+
.remote_encryption_key = remote_encryption_key.c_str(),
|
|
56
58
|
.sync_interval = sync_interval,
|
|
57
59
|
.with_webpki = '1',
|
|
58
60
|
.offline = offline};
|
package/cpp/libsql/bridge.h
CHANGED
|
@@ -41,7 +41,8 @@ DB opsqlite_libsql_open_remote(std::string const &url,
|
|
|
41
41
|
DB opsqlite_libsql_open_sync(std::string const &name, std::string const &path,
|
|
42
42
|
std::string const &url,
|
|
43
43
|
std::string const &auth_token, int sync_interval,
|
|
44
|
-
bool offline, std::string const &encryption_key
|
|
44
|
+
bool offline, std::string const &encryption_key,
|
|
45
|
+
std::string const &remote_encryption_key);
|
|
45
46
|
|
|
46
47
|
void opsqlite_libsql_close(DB &db);
|
|
47
48
|
|