@op-engineering/op-sqlite 14.1.4 → 15.0.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/android/CMakeLists.txt +23 -62
- package/android/build.gradle +103 -163
- package/android/gradle.properties +5 -1
- package/android/src/main/AndroidManifest.xml +2 -1
- package/cpp/DBHostObject.cpp +17 -0
- package/lib/module/Storage.js +9 -2
- package/lib/module/Storage.js.map +1 -1
- package/lib/{commonjs/index.js → module/functions.js} +20 -82
- package/lib/module/functions.js.map +1 -0
- package/lib/module/index.js +3 -319
- 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/functions.d.ts +61 -0
- package/lib/typescript/src/functions.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -62
- 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 +10 -2
- package/src/functions.ts +456 -0
- package/src/index.ts +14 -445
- 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.map +0 -1
- package/lib/commonjs/package.json +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Storage } from './Storage';
|
|
2
|
+
export * from './functions';
|
|
2
3
|
export type Scalar = string | number | boolean | null | ArrayBuffer | ArrayBufferView;
|
|
3
4
|
/**
|
|
4
5
|
* Object returned by SQL Query executions {
|
|
@@ -63,12 +64,15 @@ export type Transaction = {
|
|
|
63
64
|
execute: (query: string, params?: Scalar[]) => Promise<QueryResult>;
|
|
64
65
|
rollback: () => QueryResult;
|
|
65
66
|
};
|
|
67
|
+
export type _PendingTransaction = {
|
|
68
|
+
start: () => void;
|
|
69
|
+
};
|
|
66
70
|
export type PreparedStatement = {
|
|
67
71
|
bind: (params: any[]) => Promise<void>;
|
|
68
72
|
bindSync: (params: any[]) => void;
|
|
69
73
|
execute: () => Promise<QueryResult>;
|
|
70
74
|
};
|
|
71
|
-
type
|
|
75
|
+
export type _InternalDB = {
|
|
72
76
|
close: () => void;
|
|
73
77
|
delete: (location?: string) => void;
|
|
74
78
|
attach: (params: {
|
|
@@ -94,6 +98,7 @@ type InternalDB = {
|
|
|
94
98
|
prepareStatement: (query: string) => PreparedStatement;
|
|
95
99
|
loadExtension: (path: string, entryPoint?: string) => void;
|
|
96
100
|
executeRaw: (query: string, params?: Scalar[]) => Promise<any[]>;
|
|
101
|
+
executeRawSync: (query: string, params?: Scalar[]) => any[];
|
|
97
102
|
getDbPath: (location?: string) => string;
|
|
98
103
|
reactiveExecute: (params: {
|
|
99
104
|
query: string;
|
|
@@ -214,6 +219,11 @@ export type DB = {
|
|
|
214
219
|
* It will be faster since a lot of repeated work is skipped and only the values you care about are returned
|
|
215
220
|
*/
|
|
216
221
|
executeRaw: (query: string, params?: Scalar[]) => Promise<any[]>;
|
|
222
|
+
/**
|
|
223
|
+
* Same as `executeRaw` but it will block the JS thread and therefore your UI and should be used with caution
|
|
224
|
+
* It will return an array of arrays with just the values and not the keys
|
|
225
|
+
*/
|
|
226
|
+
executeRawSync: (query: string, params?: Scalar[]) => any[];
|
|
217
227
|
/**
|
|
218
228
|
* Get's the absolute path to the db file. Useful for debugging on local builds and for attaching the DB from users devices
|
|
219
229
|
*/
|
|
@@ -251,73 +261,15 @@ export type OPSQLiteProxy = {
|
|
|
251
261
|
name: string;
|
|
252
262
|
location?: string;
|
|
253
263
|
encryptionKey?: string;
|
|
254
|
-
}) =>
|
|
264
|
+
}) => _InternalDB;
|
|
255
265
|
openRemote: (options: {
|
|
256
266
|
url: string;
|
|
257
267
|
authToken: string;
|
|
258
|
-
}) =>
|
|
259
|
-
openSync: (options: DBParams) =>
|
|
268
|
+
}) => _InternalDB;
|
|
269
|
+
openSync: (options: DBParams) => _InternalDB;
|
|
260
270
|
isSQLCipher: () => boolean;
|
|
261
271
|
isLibsql: () => boolean;
|
|
262
272
|
isIOSEmbedded: () => boolean;
|
|
263
273
|
};
|
|
264
|
-
declare global {
|
|
265
|
-
var __OPSQLiteProxy: object | undefined;
|
|
266
|
-
}
|
|
267
274
|
export declare const IOS_DOCUMENT_PATH: any, IOS_LIBRARY_PATH: any, ANDROID_DATABASE_PATH: any, ANDROID_FILES_PATH: any, ANDROID_EXTERNAL_FILES_PATH: any;
|
|
268
|
-
/**
|
|
269
|
-
* Open a replicating connection via libsql to a turso db
|
|
270
|
-
* libsql needs to be enabled on your package.json
|
|
271
|
-
*/
|
|
272
|
-
export declare const openSync: (params: {
|
|
273
|
-
url: string;
|
|
274
|
-
authToken: string;
|
|
275
|
-
name: string;
|
|
276
|
-
location?: string;
|
|
277
|
-
libsqlSyncInterval?: number;
|
|
278
|
-
libsqlOffline?: boolean;
|
|
279
|
-
encryptionKey?: string;
|
|
280
|
-
remoteEncryptionKey?: string;
|
|
281
|
-
}) => DB;
|
|
282
|
-
/**
|
|
283
|
-
* Open a remote connection via libsql to a turso db
|
|
284
|
-
* libsql needs to be enabled on your package.json
|
|
285
|
-
*/
|
|
286
|
-
export declare const openRemote: (params: {
|
|
287
|
-
url: string;
|
|
288
|
-
authToken: string;
|
|
289
|
-
}) => DB;
|
|
290
|
-
/**
|
|
291
|
-
* Open a connection to a local sqlite or sqlcipher database
|
|
292
|
-
* If you want libsql remote or sync connections, use openSync or openRemote
|
|
293
|
-
*/
|
|
294
|
-
export declare const open: (params: {
|
|
295
|
-
name: string;
|
|
296
|
-
location?: string;
|
|
297
|
-
encryptionKey?: string;
|
|
298
|
-
}) => DB;
|
|
299
|
-
/**
|
|
300
|
-
* Moves the database from the assets folder to the default path (check the docs) or to a custom path
|
|
301
|
-
* It DOES NOT OVERWRITE the database if it already exists in the destination path
|
|
302
|
-
* if you want to overwrite the database, you need to pass the overwrite flag as true
|
|
303
|
-
* @param args object with the parameters for the operaiton
|
|
304
|
-
* @returns promise, rejects if failed to move the database, resolves if the operation was successful
|
|
305
|
-
*/
|
|
306
|
-
export declare const moveAssetsDatabase: (args: {
|
|
307
|
-
filename: string;
|
|
308
|
-
path?: string;
|
|
309
|
-
overwrite?: boolean;
|
|
310
|
-
}) => Promise<boolean>;
|
|
311
|
-
/**
|
|
312
|
-
* Used to load a dylib file that contains a sqlite 3 extension/plugin
|
|
313
|
-
* It returns the raw path to the actual file which then needs to be passed to the loadExtension function
|
|
314
|
-
* Check the docs for more information
|
|
315
|
-
* @param bundle the iOS bundle identifier of the .framework
|
|
316
|
-
* @param name the file name of the dylib file
|
|
317
|
-
* @returns
|
|
318
|
-
*/
|
|
319
|
-
export declare const getDylibPath: (bundle: string, name: string) => string;
|
|
320
|
-
export declare const isSQLCipher: () => boolean;
|
|
321
|
-
export declare const isLibsql: () => boolean;
|
|
322
|
-
export declare const isIOSEmbeeded: () => boolean;
|
|
323
275
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,cAAc,aAAa,CAAC;AAE5B,MAAM,MAAM,MAAM,GACd,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,WAAW,GACX,eAAe,CAAC;AAEpB;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IAC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AM,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,CAAC,OAAO,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,KAAK,WAAW,CAAC;IAClB,UAAU,EAAE,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,WAAW,CAAC;IACzE,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,WAAW,CAAC;IAC7C,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,OAAO,CAAC;CAC9B,CAAC;AAEF,eAAO,MACL,iBAAiB,OACjB,gBAAgB,OAChB,qBAAqB,OACrB,kBAAkB,OAClB,2BAA2B,KAGH,CAAC"}
|
package/op-sqlite.podspec
CHANGED
|
@@ -7,9 +7,6 @@ end
|
|
|
7
7
|
|
|
8
8
|
is_user_app = __dir__.include?("node_modules")
|
|
9
9
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
10
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
11
|
-
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
12
|
-
|
|
13
10
|
parent_folder_name = File.basename(__dir__)
|
|
14
11
|
app_package = nil
|
|
15
12
|
package_json_path = nil
|
|
@@ -95,6 +92,8 @@ Pod::Spec.new do |s|
|
|
|
95
92
|
|
|
96
93
|
s.platforms = { :ios => "13.0", :tvos => "13.0", :osx => "10.15", :visionos => "1.0" }
|
|
97
94
|
s.source = { :git => "https://github.com/op-engineering/op-sqlite.git", :tag => "#{s.version}" }
|
|
95
|
+
|
|
96
|
+
install_modules_dependencies(s)
|
|
98
97
|
|
|
99
98
|
# Base source files
|
|
100
99
|
source_files = Dir.glob("ios/**/*.{h,m,mm}") + Dir.glob("cpp/**/*.{h,cpp,c}")
|
|
@@ -139,14 +138,6 @@ Pod::Spec.new do |s|
|
|
|
139
138
|
exclude_files += ["cpp/sqlcipher/sqlite3.c", "cpp/sqlcipher/sqlite3.h", "cpp/libsql/bridge.c", "cpp/libsql/bridge.h", "cpp/libsql/bridge.cpp", "cpp/libsql/libsql.h"]
|
|
140
139
|
end
|
|
141
140
|
|
|
142
|
-
s.dependency "React-callinvoker"
|
|
143
|
-
s.dependency "React"
|
|
144
|
-
if fabric_enabled then
|
|
145
|
-
install_modules_dependencies(s)
|
|
146
|
-
else
|
|
147
|
-
s.dependency "React-Core"
|
|
148
|
-
end
|
|
149
|
-
|
|
150
141
|
other_cflags = '-DSQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION=1'
|
|
151
142
|
optimizedCflags = '$(inherited) -DSQLITE_DQS=0 -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 -DSQLITE_THREADSAFE=1'
|
|
152
143
|
frameworks = []
|
package/package.json
CHANGED
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@op-engineering/op-sqlite",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.1",
|
|
4
4
|
"description": "Next generation SQLite for React Native",
|
|
5
|
-
"main": "lib/
|
|
6
|
-
"
|
|
7
|
-
"types": "lib/typescript/src/index.d.ts",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
8
7
|
"react-native": "src/index",
|
|
9
|
-
"
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
10
16
|
"files": [
|
|
11
17
|
"src",
|
|
12
18
|
"lib",
|
|
13
19
|
"android",
|
|
14
20
|
"ios",
|
|
15
21
|
"cpp",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
22
|
+
"*.podspec",
|
|
23
|
+
"*.rb",
|
|
24
|
+
"react-native.config.js",
|
|
18
25
|
"ios/**.xcframework",
|
|
19
|
-
"!lib/typescript/example",
|
|
20
|
-
"!android/build",
|
|
21
|
-
"!android/.cxx",
|
|
22
26
|
"!ios/build",
|
|
27
|
+
"!android/build",
|
|
28
|
+
"!android/gradle",
|
|
29
|
+
"!android/gradlew",
|
|
30
|
+
"!android/gradlew.bat",
|
|
31
|
+
"!android/local.properties",
|
|
23
32
|
"!**/__tests__",
|
|
24
33
|
"!**/__fixtures__",
|
|
25
|
-
"!**/__mocks__"
|
|
34
|
+
"!**/__mocks__",
|
|
35
|
+
"!**/.*"
|
|
26
36
|
],
|
|
27
37
|
"scripts": {
|
|
28
|
-
"
|
|
38
|
+
"example": "yarn workspace op_sqlite_example",
|
|
39
|
+
"typecheck": "tsc",
|
|
29
40
|
"prepare": "bob build",
|
|
30
41
|
"pods": "cd example && yarn pods",
|
|
31
42
|
"clang-format-check": "clang-format -i cpp/*.cpp cpp/*.h"
|
|
@@ -33,7 +44,8 @@
|
|
|
33
44
|
"keywords": [
|
|
34
45
|
"react-native",
|
|
35
46
|
"ios",
|
|
36
|
-
"android"
|
|
47
|
+
"android",
|
|
48
|
+
"sqlite"
|
|
37
49
|
],
|
|
38
50
|
"repository": "https://github.com/OP-Engineering/op-sqlite",
|
|
39
51
|
"author": "Oscar Franco <ospfranco@protonmail.com> (https://github.com/ospfranco)",
|
|
@@ -48,10 +60,10 @@
|
|
|
48
60
|
"devDependencies": {
|
|
49
61
|
"clang-format": "^1.8.0",
|
|
50
62
|
"lefthook": "^1.5.5",
|
|
51
|
-
"react": "
|
|
52
|
-
"react-native": "0.
|
|
53
|
-
"react-native-builder-bob": "^0.40.
|
|
54
|
-
"typescript": "5.
|
|
63
|
+
"react": "19.1.1",
|
|
64
|
+
"react-native": "0.81.0",
|
|
65
|
+
"react-native-builder-bob": "^0.40.13",
|
|
66
|
+
"typescript": "5.8.3"
|
|
55
67
|
},
|
|
56
68
|
"peerDependencies": {
|
|
57
69
|
"react": "*",
|
|
@@ -71,8 +83,12 @@
|
|
|
71
83
|
"source": "src",
|
|
72
84
|
"output": "lib",
|
|
73
85
|
"targets": [
|
|
74
|
-
|
|
75
|
-
|
|
86
|
+
[
|
|
87
|
+
"module",
|
|
88
|
+
{
|
|
89
|
+
"esm": true
|
|
90
|
+
}
|
|
91
|
+
],
|
|
76
92
|
[
|
|
77
93
|
"typescript",
|
|
78
94
|
{
|
|
@@ -81,5 +97,18 @@
|
|
|
81
97
|
]
|
|
82
98
|
]
|
|
83
99
|
},
|
|
100
|
+
"codegenConfig": {
|
|
101
|
+
"name": "OPSQLiteSpec",
|
|
102
|
+
"type": "modules",
|
|
103
|
+
"jsSrcsDir": "src",
|
|
104
|
+
"android": {
|
|
105
|
+
"javaPackageName": "com.op.sqlite"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"create-react-native-library": {
|
|
109
|
+
"languages": "kotlin-objc",
|
|
110
|
+
"type": "turbo-module",
|
|
111
|
+
"version": "0.52.1"
|
|
112
|
+
},
|
|
84
113
|
"packageManager": "yarn@4.3.1"
|
|
85
114
|
}
|
package/src/Storage.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type DB } from './index';
|
|
2
|
+
import { open } from './functions';
|
|
2
3
|
|
|
3
4
|
type StorageOptions = {
|
|
4
5
|
location?: string;
|
|
@@ -13,7 +14,7 @@ export class Storage {
|
|
|
13
14
|
private db: DB;
|
|
14
15
|
|
|
15
16
|
constructor(options: StorageOptions) {
|
|
16
|
-
this.db = open({ ...options, name: '__opsqlite_storage' });
|
|
17
|
+
this.db = open({ ...options, name: '__opsqlite_storage.sqlite' });
|
|
17
18
|
this.db.executeSync('PRAGMA mmap_size=268435456');
|
|
18
19
|
this.db.executeSync(
|
|
19
20
|
'CREATE TABLE IF NOT EXISTS storage (key TEXT PRIMARY KEY, value TEXT) WITHOUT ROWID'
|
|
@@ -82,4 +83,11 @@ export class Storage {
|
|
|
82
83
|
.executeSync('SELECT key FROM storage')
|
|
83
84
|
.rows.map((row: any) => row.key);
|
|
84
85
|
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Deletes the underlying database file.
|
|
89
|
+
*/
|
|
90
|
+
delete() {
|
|
91
|
+
this.db.delete();
|
|
92
|
+
}
|
|
85
93
|
}
|