@op-engineering/op-sqlite 0.0.0-resolution-test

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.
Files changed (99) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +31 -0
  3. package/android/.project +17 -0
  4. package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
  5. package/android/CMakeLists.txt +141 -0
  6. package/android/build.gradle +266 -0
  7. package/android/c_sources/tokenizers.cpp +88 -0
  8. package/android/c_sources/tokenizers.h +15 -0
  9. package/android/cpp-adapter.cpp +46 -0
  10. package/android/gradle.properties +1 -0
  11. package/android/jniLibs/arm64-v8a/libsql_experimental.a +0 -0
  12. package/android/jniLibs/armeabi-v7a/libsql_experimental.a +0 -0
  13. package/android/jniLibs/x86/libsql_experimental.a +0 -0
  14. package/android/jniLibs/x86_64/libsql_experimental.a +0 -0
  15. package/android/src/main/AndroidManifest.xml +1 -0
  16. package/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt +37 -0
  17. package/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt +119 -0
  18. package/android/src/main/java/com/op/sqlite/OPSQLitePackage.kt +18 -0
  19. package/android/src/main/jniLibs/arm64-v8a/libcrsqlite.so +0 -0
  20. package/android/src/main/jniLibs/arm64-v8a/libsqlite_vec.so +0 -0
  21. package/android/src/main/jniLibs/armeabi-v7a/libcrsqlite.so +0 -0
  22. package/android/src/main/jniLibs/armeabi-v7a/libsqlite_vec.so +0 -0
  23. package/android/src/main/jniLibs/x86/libcrsqlite.so +0 -0
  24. package/android/src/main/jniLibs/x86/libsqlite_vec.so +0 -0
  25. package/android/src/main/jniLibs/x86_64/libcrsqlite.so +0 -0
  26. package/android/src/main/jniLibs/x86_64/libsqlite_vec.so +0 -0
  27. package/android/src/paper/java/com/op/sqlite/NativeOPSQLiteSpec.java +77 -0
  28. package/cpp/DBHostObject.cpp +852 -0
  29. package/cpp/DBHostObject.h +99 -0
  30. package/cpp/DumbHostObject.cpp +72 -0
  31. package/cpp/DumbHostObject.h +36 -0
  32. package/cpp/OPThreadPool.cpp +120 -0
  33. package/cpp/OPThreadPool.h +44 -0
  34. package/cpp/PreparedStatementHostObject.cpp +151 -0
  35. package/cpp/PreparedStatementHostObject.h +59 -0
  36. package/cpp/SmartHostObject.cpp +34 -0
  37. package/cpp/SmartHostObject.h +24 -0
  38. package/cpp/bindings.cpp +182 -0
  39. package/cpp/bindings.h +19 -0
  40. package/cpp/bridge.cpp +873 -0
  41. package/cpp/bridge.h +80 -0
  42. package/cpp/libsql/bridge.cpp +738 -0
  43. package/cpp/libsql/bridge.h +85 -0
  44. package/cpp/libsql/libsql.h +172 -0
  45. package/cpp/logs.h +40 -0
  46. package/cpp/macros.h +15 -0
  47. package/cpp/sqlcipher/sqlite3.c +262970 -0
  48. package/cpp/sqlcipher/sqlite3.h +13485 -0
  49. package/cpp/sqlite3.c +261454 -0
  50. package/cpp/sqlite3.h +13715 -0
  51. package/cpp/types.h +33 -0
  52. package/cpp/utils.cpp +327 -0
  53. package/cpp/utils.h +47 -0
  54. package/generate_tokenizers_header_file.rb +29 -0
  55. package/ios/OPSQLite.h +7 -0
  56. package/ios/OPSQLite.mm +157 -0
  57. package/ios/OPSQLite.xcodeproj/project.pbxproj +275 -0
  58. package/ios/crsqlite.xcframework/Info.plist +46 -0
  59. package/ios/crsqlite.xcframework/ios-arm64/crsqlite.framework/Info.plist +24 -0
  60. package/ios/crsqlite.xcframework/ios-arm64/crsqlite.framework/crsqlite +0 -0
  61. package/ios/crsqlite.xcframework/ios-arm64_x86_64-simulator/crsqlite.framework/Info.plist +24 -0
  62. package/ios/crsqlite.xcframework/ios-arm64_x86_64-simulator/crsqlite.framework/crsqlite +0 -0
  63. package/ios/libsql.xcframework/Info.plist +48 -0
  64. package/ios/libsql.xcframework/ios-arm64/Headers/libsql.h +172 -0
  65. package/ios/libsql.xcframework/ios-arm64/libsql_experimental.a +0 -0
  66. package/ios/libsql.xcframework/ios-arm64_x86_64-simulator/Headers/libsql.h +172 -0
  67. package/ios/libsql.xcframework/ios-arm64_x86_64-simulator/libsql_experimental.a +0 -0
  68. package/ios/sqlitevec.xcframework/Info.plist +71 -0
  69. package/ios/sqlitevec.xcframework/ios-arm64/sqlitevec.framework/Info.plist +24 -0
  70. package/ios/sqlitevec.xcframework/ios-arm64/sqlitevec.framework/sqlitevec +0 -0
  71. package/ios/sqlitevec.xcframework/ios-arm64_x86_64-simulator/sqlitevec.framework/Info.plist +24 -0
  72. package/ios/sqlitevec.xcframework/ios-arm64_x86_64-simulator/sqlitevec.framework/sqlitevec +0 -0
  73. package/ios/sqlitevec.xcframework/tvos-arm64/sqlitevec.framework/Info.plist +24 -0
  74. package/ios/sqlitevec.xcframework/tvos-arm64/sqlitevec.framework/sqlitevec +0 -0
  75. package/ios/sqlitevec.xcframework/tvos-arm64_x86_64-simulator/sqlitevec.framework/Info.plist +24 -0
  76. package/ios/sqlitevec.xcframework/tvos-arm64_x86_64-simulator/sqlitevec.framework/sqlitevec +0 -0
  77. package/lib/commonjs/NativeOPSQLite.js +9 -0
  78. package/lib/commonjs/NativeOPSQLite.js.map +1 -0
  79. package/lib/commonjs/Storage.js +60 -0
  80. package/lib/commonjs/Storage.js.map +1 -0
  81. package/lib/commonjs/index.js +365 -0
  82. package/lib/commonjs/index.js.map +1 -0
  83. package/lib/module/NativeOPSQLite.js +3 -0
  84. package/lib/module/NativeOPSQLite.js.map +1 -0
  85. package/lib/module/Storage.js +53 -0
  86. package/lib/module/Storage.js.map +1 -0
  87. package/lib/module/index.js +340 -0
  88. package/lib/module/index.js.map +1 -0
  89. package/lib/typescript/src/NativeOPSQLite.d.ts +15 -0
  90. package/lib/typescript/src/NativeOPSQLite.d.ts.map +1 -0
  91. package/lib/typescript/src/Storage.d.ts +23 -0
  92. package/lib/typescript/src/Storage.d.ts.map +1 -0
  93. package/lib/typescript/src/index.d.ts +319 -0
  94. package/lib/typescript/src/index.d.ts.map +1 -0
  95. package/op-sqlite.podspec +212 -0
  96. package/package.json +85 -0
  97. package/src/NativeOPSQLite.ts +17 -0
  98. package/src/Storage.ts +85 -0
  99. package/src/index.ts +722 -0
@@ -0,0 +1,319 @@
1
+ export { Storage } from './Storage';
2
+ export type Scalar = string | number | boolean | null | ArrayBuffer | ArrayBufferView;
3
+ /**
4
+ * Object returned by SQL Query executions {
5
+ * insertId: Represent the auto-generated row id if applicable
6
+ * rowsAffected: Number of affected rows if result of a update query
7
+ * message: if status === 1, here you will find error description
8
+ * rows: if status is undefined or 0 this object will contain the query results
9
+ * }
10
+ *
11
+ * @interface QueryResult
12
+ */
13
+ export type QueryResult = {
14
+ insertId?: number;
15
+ rowsAffected: number;
16
+ res?: any[];
17
+ rows: Array<Record<string, Scalar>>;
18
+ rawRows?: Scalar[][];
19
+ columnNames?: string[];
20
+ /**
21
+ * Query metadata, available only for select query results
22
+ */
23
+ metadata?: ColumnMetadata[];
24
+ };
25
+ /**
26
+ * Column metadata
27
+ * Describes some information about columns fetched by the query
28
+ */
29
+ export type ColumnMetadata = {
30
+ /** The name used for this column for this result set */
31
+ name: string;
32
+ /** The declared column type for this column, when fetched directly from a table or a View resulting from a table column. "UNKNOWN" for dynamic values, like function returned ones. */
33
+ type: string;
34
+ /**
35
+ * The index for this column for this result set*/
36
+ index: number;
37
+ };
38
+ /**
39
+ * Allows the execution of bulk of sql commands
40
+ * inside a transaction
41
+ * If a single query must be executed many times with different arguments, its preferred
42
+ * to declare it a single time, and use an array of array parameters.
43
+ */
44
+ export type SQLBatchTuple = [string] | [string, Array<Scalar> | Array<Array<Scalar>>];
45
+ export type UpdateHookOperation = 'INSERT' | 'DELETE' | 'UPDATE';
46
+ /**
47
+ * status: 0 or undefined for correct execution, 1 for error
48
+ * message: if status === 1, here you will find error description
49
+ * rowsAffected: Number of affected rows if status == 0
50
+ */
51
+ export type BatchQueryResult = {
52
+ rowsAffected?: number;
53
+ };
54
+ /**
55
+ * Result of loading a file and executing every line as a SQL command
56
+ * Similar to BatchQueryResult
57
+ */
58
+ export type FileLoadResult = BatchQueryResult & {
59
+ commands?: number;
60
+ };
61
+ export type Transaction = {
62
+ commit: () => Promise<QueryResult>;
63
+ execute: (query: string, params?: Scalar[]) => Promise<QueryResult>;
64
+ rollback: () => Promise<QueryResult>;
65
+ };
66
+ export type PreparedStatement = {
67
+ bind: (params: any[]) => Promise<void>;
68
+ execute: () => Promise<QueryResult>;
69
+ };
70
+ type InternalDB = {
71
+ close: () => void;
72
+ delete: (location?: string) => void;
73
+ attach: (params: {
74
+ secondaryDbFileName: string;
75
+ alias: string;
76
+ location?: string;
77
+ }) => void;
78
+ detach: (alias: string) => void;
79
+ transaction: (fn: (tx: Transaction) => Promise<void>) => Promise<void>;
80
+ executeSync: (query: string, params?: Scalar[]) => QueryResult;
81
+ execute: (query: string, params?: Scalar[]) => Promise<QueryResult>;
82
+ executeWithHostObjects: (query: string, params?: Scalar[]) => Promise<QueryResult>;
83
+ executeBatch: (commands: SQLBatchTuple[]) => Promise<BatchQueryResult>;
84
+ loadFile: (location: string) => Promise<FileLoadResult>;
85
+ updateHook: (callback?: ((params: {
86
+ table: string;
87
+ operation: UpdateHookOperation;
88
+ row?: any;
89
+ rowId: number;
90
+ }) => void) | null) => void;
91
+ commitHook: (callback?: (() => void) | null) => void;
92
+ rollbackHook: (callback?: (() => void) | null) => void;
93
+ prepareStatement: (query: string) => PreparedStatement;
94
+ loadExtension: (path: string, entryPoint?: string) => void;
95
+ executeRaw: (query: string, params?: Scalar[]) => Promise<any[]>;
96
+ getDbPath: (location?: string) => string;
97
+ reactiveExecute: (params: {
98
+ query: string;
99
+ arguments: any[];
100
+ fireOn: {
101
+ table: string;
102
+ ids?: number[];
103
+ }[];
104
+ callback: (response: any) => void;
105
+ }) => () => void;
106
+ sync: () => void;
107
+ flushPendingReactiveQueries: () => Promise<void>;
108
+ };
109
+ export type DB = {
110
+ close: () => void;
111
+ delete: (location?: string) => void;
112
+ attach: (params: {
113
+ secondaryDbFileName: string;
114
+ alias: string;
115
+ location?: string;
116
+ }) => void;
117
+ detach: (alias: string) => void;
118
+ /**
119
+ * Wraps all the executions into a transaction. If an error is thrown it will rollback all of the changes
120
+ *
121
+ * You need to use this if you are using reactive queries for the queries to fire after the transaction is done
122
+ */
123
+ transaction: (fn: (tx: Transaction) => Promise<void>) => Promise<void>;
124
+ /**
125
+ * Sync version of the execute function
126
+ * It will block the JS thread and therefore your UI and should be used with caution
127
+ *
128
+ * When writing your queries, you can use the ? character as a placeholder for parameters
129
+ * The parameters will be automatically escaped and sanitized
130
+ *
131
+ * Example:
132
+ * db.executeSync('SELECT * FROM table WHERE id = ?', [1]);
133
+ *
134
+ * If you are writing a query that doesn't require parameters, you can omit the second argument
135
+ *
136
+ * If you are writing to the database YOU SHOULD BE USING TRANSACTIONS!
137
+ * Transactions protect you from partial writes and ensure that your data is always in a consistent state
138
+ *
139
+ * @param query
140
+ * @param params
141
+ * @returns QueryResult
142
+ */
143
+ executeSync: (query: string, params?: Scalar[]) => QueryResult;
144
+ /**
145
+ * Basic query execution function, it is async don't forget to await it
146
+ *
147
+ * When writing your queries, you can use the ? character as a placeholder for parameters
148
+ * The parameters will be automatically escaped and sanitized
149
+ *
150
+ * Example:
151
+ * await db.execute('SELECT * FROM table WHERE id = ?', [1]);
152
+ *
153
+ * If you are writing a query that doesn't require parameters, you can omit the second argument
154
+ *
155
+ * If you are writing to the database YOU SHOULD BE USING TRANSACTIONS!
156
+ * Transactions protect you from partial writes and ensure that your data is always in a consistent state
157
+ *
158
+ * If you need a large amount of queries ran as fast as possible you should be using `executeBatch`, `executeRaw`, `loadFile` or `executeWithHostObjects`
159
+ *
160
+ * @param query string of your SQL query
161
+ * @param params a list of parameters to bind to the query, if any
162
+ * @returns Promise<QueryResult> with the result of the query
163
+ */
164
+ execute: (query: string, params?: Scalar[]) => Promise<QueryResult>;
165
+ /**
166
+ * Similar to the execute function but returns the response in HostObjects
167
+ * Read more about HostObjects in the documentation and their pitfalls
168
+ *
169
+ * Will be a lot faster than the normal execute functions when returning data but you will pay when accessing the fields
170
+ * as the conversion is done the moment you access any field
171
+ * @param query
172
+ * @param params
173
+ * @returns
174
+ */
175
+ executeWithHostObjects: (query: string, params?: Scalar[]) => Promise<QueryResult>;
176
+ /**
177
+ * Executes all the queries in the params inside a single transaction
178
+ *
179
+ * It's faster than executing single queries as data is sent to the native side only once
180
+ * @param commands
181
+ * @returns Promise<BatchQueryResult>
182
+ */
183
+ executeBatch: (commands: SQLBatchTuple[]) => Promise<BatchQueryResult>;
184
+ /**
185
+ * Loads a SQLite Dump from disk. It will be the fastest way to execute a large set of queries as no JS is involved
186
+ */
187
+ loadFile: (location: string) => Promise<FileLoadResult>;
188
+ updateHook: (callback?: ((params: {
189
+ table: string;
190
+ operation: UpdateHookOperation;
191
+ row?: any;
192
+ rowId: number;
193
+ }) => void) | null) => void;
194
+ commitHook: (callback?: (() => void) | null) => void;
195
+ rollbackHook: (callback?: (() => void) | null) => void;
196
+ /**
197
+ * Constructs a prepared statement from the query string
198
+ * The statement can be re-bound with parameters and executed
199
+ * The performance gain is significant when the same query is executed multiple times, NOT when the query is executed (once)
200
+ * The cost lies in the preparation of the statement as it is compiled and optimized by the sqlite engine, the params can then rebound
201
+ * but the query itself is already optimized
202
+ *
203
+ * @param query string of your SQL query
204
+ * @returns Prepared statement object
205
+ */
206
+ prepareStatement: (query: string) => PreparedStatement;
207
+ /**
208
+ * Loads a runtime loadable sqlite extension. Libsql and iOS embedded version do not support loading extensions
209
+ */
210
+ loadExtension: (path: string, entryPoint?: string) => void;
211
+ /**
212
+ * Same as `execute` except the results are not returned in objects but rather in arrays with just the values and not the keys
213
+ * It will be faster since a lot of repeated work is skipped and only the values you care about are returned
214
+ */
215
+ executeRaw: (query: string, params?: Scalar[]) => Promise<any[]>;
216
+ /**
217
+ * Get's the absolute path to the db file. Useful for debugging on local builds and for attaching the DB from users devices
218
+ */
219
+ getDbPath: (location?: string) => string;
220
+ /**
221
+ * Reactive execution of queries when data is written to the database. Check the docs for how to use them.
222
+ */
223
+ reactiveExecute: (params: {
224
+ query: string;
225
+ arguments: any[];
226
+ fireOn: {
227
+ table: string;
228
+ ids?: number[];
229
+ }[];
230
+ callback: (response: any) => void;
231
+ }) => () => void;
232
+ /** This function is only available for libsql.
233
+ * Allows to trigger a sync the database with it's remote replica
234
+ * In order for this function to work you need to use openSync or openRemote functions
235
+ * with libsql: true in the package.json
236
+ *
237
+ * The database is hosted in turso
238
+ **/
239
+ sync: () => void;
240
+ };
241
+ export type DBParams = {
242
+ url?: string;
243
+ authToken?: string;
244
+ name?: string;
245
+ location?: string;
246
+ syncInterval?: number;
247
+ };
248
+ export type OPSQLiteProxy = {
249
+ open: (options: {
250
+ name: string;
251
+ location?: string;
252
+ encryptionKey?: string;
253
+ }) => InternalDB;
254
+ openRemote: (options: {
255
+ url: string;
256
+ authToken: string;
257
+ }) => InternalDB;
258
+ openSync: (options: DBParams) => InternalDB;
259
+ isSQLCipher: () => boolean;
260
+ isLibsql: () => boolean;
261
+ isIOSEmbedded: () => boolean;
262
+ };
263
+ declare global {
264
+ var __OPSQLiteProxy: object | undefined;
265
+ }
266
+ export declare const IOS_DOCUMENT_PATH: any, IOS_LIBRARY_PATH: any, ANDROID_DATABASE_PATH: any, ANDROID_FILES_PATH: any, ANDROID_EXTERNAL_FILES_PATH: any;
267
+ /**
268
+ * Open a replicating connection via libsql to a turso db
269
+ * libsql needs to be enabled on your package.json
270
+ */
271
+ export declare const openSync: (params: {
272
+ url: string;
273
+ authToken: string;
274
+ name: string;
275
+ location?: string;
276
+ syncInterval?: number;
277
+ }) => DB;
278
+ /**
279
+ * Open a remote connection via libsql to a turso db
280
+ * libsql needs to be enabled on your package.json
281
+ */
282
+ export declare const openRemote: (params: {
283
+ url: string;
284
+ authToken: string;
285
+ }) => DB;
286
+ /**
287
+ * Open a connection to a local sqlite or sqlcipher database
288
+ * If you want libsql remote or sync connections, use openSync or openRemote
289
+ */
290
+ export declare const open: (params: {
291
+ name: string;
292
+ location?: string;
293
+ encryptionKey?: string;
294
+ }) => DB;
295
+ /**
296
+ * Moves the database from the assets folder to the default path (check the docs) or to a custom path
297
+ * It DOES NOT OVERWRITE the database if it already exists in the destination path
298
+ * if you want to overwrite the database, you need to pass the overwrite flag as true
299
+ * @param args object with the parameters for the operaiton
300
+ * @returns promise, rejects if failed to move the database, resolves if the operation was successful
301
+ */
302
+ export declare const moveAssetsDatabase: (args: {
303
+ filename: string;
304
+ path?: string;
305
+ overwrite?: boolean;
306
+ }) => Promise<boolean>;
307
+ /**
308
+ * Used to load a dylib file that contains a sqlite 3 extension/plugin
309
+ * It returns the raw path to the actual file which then needs to be passed to the loadExtension function
310
+ * Check the docs for more information
311
+ * @param bundle the iOS bundle identifier of the .framework
312
+ * @param name the file name of the dylib file
313
+ * @returns
314
+ */
315
+ export declare const getDylibPath: (bundle: string, name: string) => string;
316
+ export declare const isSQLCipher: () => boolean;
317
+ export declare const isLibsql: () => boolean;
318
+ export declare const isIOSEmbeeded: () => boolean;
319
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,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;IACrB,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;IACZ,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEpC,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,cAA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AAM,aAAa,QAAO,OAMhC,CAAC"}
@@ -0,0 +1,212 @@
1
+ require "json"
2
+ require_relative "./generate_tokenizers_header_file"
3
+
4
+ log_message = lambda do |message|
5
+ puts "\e[34m#{message}\e[0m"
6
+ end
7
+
8
+ is_user_app = __dir__.include?("node_modules")
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
+ parent_folder_name = File.basename(__dir__)
14
+ app_package = nil
15
+
16
+ # When installed on user node_modules lives inside node_modules/@op-engineering/op-sqlite
17
+ if is_user_app
18
+ current_dir = File.expand_path(__dir__)
19
+ package_json_path = nil
20
+
21
+ # Find the package.json by searching up through parent directories
22
+ loop do
23
+ package_path = File.join(current_dir, "package.json")
24
+ if File.exist?(package_path)
25
+ package_json_path = package_path
26
+ break
27
+ end
28
+
29
+ parent_dir = File.dirname(current_dir)
30
+ break if parent_dir == current_dir # reached filesystem root
31
+ current_dir = parent_dir
32
+ end
33
+
34
+ raise "package.json not found" if package_json_path.nil?
35
+
36
+ app_package = JSON.parse(File.read(package_json_path))
37
+ # When running on the example app
38
+ else
39
+ app_package = JSON.parse(File.read(File.join(__dir__, "example", "package.json")))
40
+ end
41
+
42
+ op_sqlite_config = app_package["op-sqlite"]
43
+ use_sqlcipher = false
44
+ use_crsqlite = false
45
+ use_libsql = false
46
+ performance_mode = false
47
+ phone_version = false
48
+ sqlite_flags = ""
49
+ fts5 = false
50
+ rtree = false
51
+ use_sqlite_vec = false
52
+ tokenizers = []
53
+
54
+ if(op_sqlite_config != nil)
55
+ use_sqlcipher = op_sqlite_config["sqlcipher"] == true
56
+ use_crsqlite = op_sqlite_config["crsqlite"] == true
57
+ use_libsql = op_sqlite_config["libsql"] == true
58
+ performance_mode = op_sqlite_config["performanceMode"] || false
59
+ phone_version = op_sqlite_config["iosSqlite"] == true
60
+ sqlite_flags = op_sqlite_config["sqliteFlags"] || ""
61
+ fts5 = op_sqlite_config["fts5"] == true
62
+ rtree = op_sqlite_config["rtree"] == true
63
+ use_sqlite_vec = op_sqlite_config["sqliteVec"] == true
64
+ tokenizers = op_sqlite_config["tokenizers"] || []
65
+ end
66
+
67
+ if phone_version then
68
+ if use_sqlcipher then
69
+ raise "SQLCipher is not supported with phone version"
70
+ end
71
+
72
+ if use_crsqlite then
73
+ raise "CRSQLite is not supported with phone version"
74
+ end
75
+
76
+ if rtree then
77
+ raise "RTree is not supported with phone version"
78
+ end
79
+
80
+ if use_sqlite_vec then
81
+ raise "SQLite Vec is not supported with phone version"
82
+ end
83
+ end
84
+
85
+ Pod::Spec.new do |s|
86
+ s.name = "op-sqlite"
87
+ s.version = package["version"]
88
+ s.summary = package["description"]
89
+ s.homepage = package["homepage"]
90
+ s.license = package["license"]
91
+ s.authors = package["author"]
92
+
93
+ s.platforms = { :ios => "13.0", :tvos => "13.0", :osx => "10.15", :visionos => "1.0" }
94
+ s.source = { :git => "https://github.com/op-engineering/op-sqlite.git", :tag => "#{s.version}" }
95
+
96
+ # Base source files
97
+ source_files = Dir.glob("ios/**/*.{h,m,mm}") + Dir.glob("cpp/**/*.{h,cpp,c}")
98
+
99
+ # Set the path to the `c_sources` directory based on environment
100
+ if is_user_app
101
+ c_sources_dir = File.join("..", "..", "..", "c_sources")
102
+ else
103
+ c_sources_dir = File.join("example", "c_sources")
104
+ end
105
+
106
+ if tokenizers.any?
107
+ generate_tokenizers_header_file(tokenizers, File.join(c_sources_dir, "tokenizers.h"))
108
+ FileUtils.cp_r(c_sources_dir, __dir__)
109
+ # # Add all .h and .c files from the `c_sources` directory
110
+ source_files += Dir.glob(File.join("c_sources", "**/*.{h,cpp}"))
111
+ end
112
+
113
+ # Assign the collected source files to `s.source_files`
114
+ s.source_files = source_files
115
+
116
+ xcconfig = {
117
+ :GCC_PREPROCESSOR_DEFINITIONS => "HAVE_FULLFSYNC=1",
118
+ :WARNING_CFLAGS => "-Wno-shorten-64-to-32 -Wno-comma -Wno-unreachable-code -Wno-conditional-uninitialized -Wno-deprecated-declarations",
119
+ :CLANG_CXX_LANGUAGE_STANDARD => "c++17",
120
+ }
121
+
122
+ log_message.call("[OP-SQLITE] Configuration:")
123
+
124
+ exclude_files = []
125
+
126
+ if use_sqlcipher then
127
+ log_message.call("[OP-SQLITE] using SQLCipher 🔒")
128
+ exclude_files += ["cpp/sqlite3.c", "cpp/sqlite3.h", "cpp/libsql/bridge.c", "cpp/libsql/bridge.h", "cpp/libsql/bridge.cpp", "cpp/libsql/libsql.h"]
129
+ xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_SQLCIPHER=1 HAVE_FULLFSYNC=1 SQLITE_HAS_CODEC SQLITE_TEMP_STORE=2"
130
+ s.dependency "OpenSSL-Universal"
131
+ elsif use_libsql then
132
+ log_message.call("[OP-SQLITE] using libsql 📘")
133
+ exclude_files += ["cpp/sqlite3.c", "cpp/sqlite3.h", "cpp/sqlcipher/sqlite3.c", "cpp/sqlcipher/sqlite3.h", "cpp/bridge.h", "cpp/bridge.cpp"]
134
+ else
135
+ log_message.call("[OP-SQLITE] using vanilla SQLite 📦")
136
+ 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"]
137
+ end
138
+
139
+ s.dependency "React-callinvoker"
140
+ s.dependency "React"
141
+ if fabric_enabled then
142
+ install_modules_dependencies(s)
143
+ else
144
+ s.dependency "React-Core"
145
+ end
146
+
147
+ other_cflags = '-DSQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION=1'
148
+ 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'
149
+ frameworks = []
150
+
151
+ if fts5 then
152
+ log_message.call("[OP-SQLITE] FTS5 enabled 🔎")
153
+ xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " SQLITE_ENABLE_FTS5=1"
154
+ end
155
+
156
+ if rtree then
157
+ log_message.call("[OP-SQLITE] RTree enabled 🌲")
158
+ xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " SQLITE_ENABLE_RTREE=1"
159
+ end
160
+
161
+ if phone_version then
162
+ log_message.call("[OP-SQLITE] using iOS embedded SQLite 📱")
163
+ xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_PHONE_VERSION=1"
164
+ exclude_files += ["cpp/sqlite3.c", "cpp/sqlite3.h"]
165
+ s.library = "sqlite3"
166
+ end
167
+
168
+ if performance_mode then
169
+ log_message.call("[OP-SQLITE] Performance mode enabled, some features might be disabled 🚀")
170
+ other_cflags += optimizedCflags
171
+ end
172
+
173
+ if use_crsqlite then
174
+ log_message.call("[OP-SQLITE] using CRQSQLite 🤖")
175
+ xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_CRSQLITE=1"
176
+ frameworks.push("ios/crsqlite.xcframework")
177
+ end
178
+
179
+ if use_sqlite_vec then
180
+ log_message.call("[OP-SQLITE] using Sqlite Vec ↗️")
181
+ xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_SQLITE_VEC=1"
182
+ frameworks.push("ios/sqlitevec.xcframework")
183
+ end
184
+
185
+ if use_libsql then
186
+ xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_LIBSQL=1"
187
+ if use_crsqlite then
188
+ frameworks = ["ios/libsql.xcframework", "ios/crsqlite.xcframework"]
189
+ else
190
+ frameworks = ["ios/libsql.xcframework"]
191
+ end
192
+ end
193
+
194
+ if sqlite_flags != "" then
195
+ log_message.call("[OP-SQLITE] Custom SQLite flags: #{sqlite_flags}")
196
+ other_cflags += " #{sqlite_flags}"
197
+ end
198
+
199
+ if tokenizers.any? then
200
+ log_message.call("[OP_SQLITE] Tokenizers enabled: #{tokenizers}")
201
+ if is_user_app then
202
+ other_cflags += " -DTOKENIZERS_HEADER_PATH=\\\"../c_sources/tokenizers.h\\\""
203
+ else
204
+ other_cflags += " -DTOKENIZERS_HEADER_PATH=\\\"../example/c_sources/tokenizers.h\\\""
205
+ end
206
+ end
207
+
208
+ xcconfig[:OTHER_CFLAGS] = other_cflags
209
+ s.pod_target_xcconfig = xcconfig
210
+ s.vendored_frameworks = frameworks
211
+ s.exclude_files = exclude_files
212
+ end
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@op-engineering/op-sqlite",
3
+ "version": "0.0.0-resolution-test",
4
+ "description": "Next generation SQLite for React Native",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/src/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "op-sqlite.podspec",
17
+ "generate_tokenizers_header_file.rb",
18
+ "ios/**.xcframework",
19
+ "!lib/typescript/example",
20
+ "!android/build",
21
+ "!android/.cxx",
22
+ "!ios/build",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__"
26
+ ],
27
+ "scripts": {
28
+ "typecheck": "tsc --noEmit",
29
+ "prepare": "bob build",
30
+ "pods": "cd example && yarn pods",
31
+ "clang-format-check": "clang-format -i cpp/*.cpp cpp/*.h"
32
+ },
33
+ "keywords": [
34
+ "react-native",
35
+ "ios",
36
+ "android"
37
+ ],
38
+ "repository": "https://github.com/OP-Engineering/op-sqlite",
39
+ "author": "Oscar Franco <ospfranco@protonmail.com> (https://github.com/ospfranco)",
40
+ "license": "MIT",
41
+ "bugs": {
42
+ "url": "https://github.com/OP-Engineering/op-sqlite/issues"
43
+ },
44
+ "homepage": "https://github.com/OP-Engineering/op-sqlite#readme",
45
+ "publishConfig": {
46
+ "registry": "https://registry.npmjs.org/"
47
+ },
48
+ "devDependencies": {
49
+ "clang-format": "^1.8.0",
50
+ "lefthook": "^1.5.5",
51
+ "react": "18.3.1",
52
+ "react-native": "0.76.5",
53
+ "react-native-builder-bob": "^0.23.2",
54
+ "typescript": "5.0.4"
55
+ },
56
+ "peerDependencies": {
57
+ "react": "*",
58
+ "react-native": "*"
59
+ },
60
+ "workspaces": [
61
+ "example"
62
+ ],
63
+ "prettier": {
64
+ "quoteProps": "consistent",
65
+ "singleQuote": true,
66
+ "tabWidth": 2,
67
+ "trailingComma": "es5",
68
+ "useTabs": false
69
+ },
70
+ "react-native-builder-bob": {
71
+ "source": "src",
72
+ "output": "lib",
73
+ "targets": [
74
+ "commonjs",
75
+ "module",
76
+ [
77
+ "typescript",
78
+ {
79
+ "project": "tsconfig.build.json"
80
+ }
81
+ ]
82
+ ]
83
+ },
84
+ "packageManager": "yarn@4.3.1"
85
+ }
@@ -0,0 +1,17 @@
1
+ import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
+
3
+ export interface Spec extends TurboModule {
4
+ getConstants: () => {
5
+ IOS_DOCUMENT_PATH: string;
6
+ IOS_LIBRARY_PATH: string;
7
+ ANDROID_DATABASE_PATH: string;
8
+ ANDROID_FILES_PATH: string;
9
+ ANDROID_EXTERNAL_FILES_PATH: string;
10
+ };
11
+
12
+ install(): boolean;
13
+
14
+ moveAssetsDatabase(name: string, extension: string): boolean;
15
+ }
16
+
17
+ export default TurboModuleRegistry.getEnforcing<Spec>('OPSQLite');