react-native-nitro-sqlite 8.2.2-nitro.1 → 9.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/RNNitroSQLite.podspec +22 -5
- package/android/CMakeLists.txt +42 -5
- package/android/build.gradle +83 -23
- package/android/{src/main/cpp/cpp-adapter.cpp → cpp-adapter.cpp} +1 -1
- package/android/gradle.properties +5 -0
- package/android/src/main/java/com/margelo/rnnitrosqlite/DocPathSetter.kt +13 -0
- package/android/src/main/java/com/margelo/rnnitrosqlite/RNNitroSQLitePackage.kt +40 -0
- package/android/src/newarch/com/margelo/rnnitrosqlite/RNNitroSQLiteOnLoadModule.kt +41 -0
- package/android/src/oldarch/com/margelo/rnnitrosqlite/RNNitroSQLiteOnLoadModule.kt +43 -0
- package/cpp/operations.cpp +0 -3
- package/cpp/sqlite/sqlite3.c +41 -41
- package/cpp/sqliteExecuteBatch.cpp +0 -1
- package/lib/commonjs/index.js +6 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nitro.js.map +1 -1
- package/lib/commonjs/operations/execute.js +1 -1
- package/lib/commonjs/operations/execute.js.map +1 -1
- package/lib/commonjs/operations/session.js +3 -3
- package/lib/commonjs/operations/session.js.map +1 -1
- package/lib/commonjs/operations/transaction.js +4 -7
- package/lib/commonjs/operations/transaction.js.map +1 -1
- package/lib/commonjs/specs/NativeNitroSQLiteOnLoad.ios.js.map +1 -1
- package/lib/commonjs/specs/NativeNitroSQLiteOnLoad.js.map +1 -1
- package/lib/commonjs/specs/NativeQueryResult.nitro.js.map +1 -1
- package/lib/commonjs/specs/NitroSQLite.nitro.js.map +1 -1
- package/lib/commonjs/typeORM.js +1 -1
- package/lib/commonjs/typeORM.js.map +1 -1
- package/lib/commonjs/types.js +0 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/index.js +9 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/nitro.js +2 -0
- package/lib/module/nitro.js.map +1 -1
- package/lib/module/operations/execute.js +3 -1
- package/lib/module/operations/execute.js.map +1 -1
- package/lib/module/operations/session.js +5 -3
- package/lib/module/operations/session.js.map +1 -1
- package/lib/module/operations/transaction.js +6 -7
- package/lib/module/operations/transaction.js.map +1 -1
- package/lib/module/specs/NativeNitroSQLiteOnLoad.ios.js +2 -0
- package/lib/module/specs/NativeNitroSQLiteOnLoad.ios.js.map +1 -1
- package/lib/module/specs/NativeNitroSQLiteOnLoad.js +2 -0
- package/lib/module/specs/NativeNitroSQLiteOnLoad.js.map +1 -1
- package/lib/module/specs/NativeQueryResult.nitro.js +2 -0
- package/lib/module/specs/NativeQueryResult.nitro.js.map +1 -1
- package/lib/module/specs/NitroSQLite.nitro.js +2 -0
- package/lib/module/specs/NitroSQLite.nitro.js.map +1 -1
- package/lib/module/typeORM.js +3 -1
- package/lib/module/typeORM.js.map +1 -1
- package/lib/module/types.js +2 -1
- package/lib/module/types.js.map +1 -1
- package/lib/tsconfig.build.tsbuildinfo +1 -0
- package/lib/typescript/{index.d.ts → commonjs/index.d.ts} +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/{nitro.d.ts → commonjs/nitro.d.ts} +1 -0
- package/lib/typescript/commonjs/nitro.d.ts.map +1 -0
- package/lib/typescript/{operations → commonjs/operations}/execute.d.ts +1 -0
- package/lib/typescript/commonjs/operations/execute.d.ts.map +1 -0
- package/lib/typescript/{operations → commonjs/operations}/session.d.ts +1 -0
- package/lib/typescript/commonjs/operations/session.d.ts.map +1 -0
- package/lib/typescript/{operations → commonjs/operations}/transaction.d.ts +1 -0
- package/lib/typescript/commonjs/operations/transaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/{specs → commonjs/specs}/NativeNitroSQLiteOnLoad.d.ts +1 -0
- package/lib/typescript/commonjs/specs/NativeNitroSQLiteOnLoad.d.ts.map +1 -0
- package/lib/typescript/{specs → commonjs/specs}/NativeNitroSQLiteOnLoad.ios.d.ts +1 -0
- package/lib/typescript/commonjs/specs/NativeNitroSQLiteOnLoad.ios.d.ts.map +1 -0
- package/lib/typescript/{specs → commonjs/specs}/NativeQueryResult.nitro.d.ts +1 -0
- package/lib/typescript/commonjs/specs/NativeQueryResult.nitro.d.ts.map +1 -0
- package/lib/typescript/{specs → commonjs/specs}/NitroSQLite.nitro.d.ts +1 -0
- package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts.map +1 -0
- package/lib/typescript/{typeORM.d.ts → commonjs/typeORM.d.ts} +1 -0
- package/lib/typescript/commonjs/typeORM.d.ts.map +1 -0
- package/lib/typescript/{types.d.ts → commonjs/types.d.ts} +1 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +31 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/nitro.d.ts +8 -0
- package/lib/typescript/module/nitro.d.ts.map +1 -0
- package/lib/typescript/module/operations/execute.d.ts +4 -0
- package/lib/typescript/module/operations/execute.d.ts.map +1 -0
- package/lib/typescript/module/operations/session.d.ts +5 -0
- package/lib/typescript/module/operations/session.d.ts.map +1 -0
- package/lib/typescript/module/operations/transaction.d.ts +6 -0
- package/lib/typescript/module/operations/transaction.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/specs/NativeNitroSQLiteOnLoad.d.ts +7 -0
- package/lib/typescript/module/specs/NativeNitroSQLiteOnLoad.d.ts.map +1 -0
- package/lib/typescript/module/specs/NativeNitroSQLiteOnLoad.ios.d.ts +4 -0
- package/lib/typescript/module/specs/NativeNitroSQLiteOnLoad.ios.d.ts.map +1 -0
- package/lib/typescript/module/specs/NativeQueryResult.nitro.d.ts +38 -0
- package/lib/typescript/module/specs/NativeQueryResult.nitro.d.ts.map +1 -0
- package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts +20 -0
- package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts.map +1 -0
- package/lib/typescript/module/typeORM.d.ts +20 -0
- package/lib/typescript/module/typeORM.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +80 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake +13 -1
- package/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle +2 -0
- package/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp +0 -6
- package/package.json +87 -43
- package/src/operations/transaction.ts +2 -3
- package/src/types.ts +0 -1
- package/android/src/main/java/com/margelo/rnnitrosqlite/RNNitroSQLiteOnLoadModule.java +0 -57
- package/android/src/main/java/com/margelo/rnnitrosqlite/RNNitroSQLitePackage.java +0 -48
- package/lib/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NitroSQLiteConnection, NitroSQLiteConnectionOptions } from '../types';
|
|
2
|
+
export declare function open(options: NitroSQLiteConnectionOptions): NitroSQLiteConnection;
|
|
3
|
+
export declare function openDb(dbName: string, location?: string): void;
|
|
4
|
+
export declare function close(dbName: string): void;
|
|
5
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/operations/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,qBAAqB,EACrB,4BAA4B,EAK7B,MAAM,UAAU,CAAA;AAGjB,wBAAgB,IAAI,CAClB,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CA4BvB;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,QAOvD;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,QAGnC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Transaction } from '../types';
|
|
2
|
+
export interface PendingTransaction {
|
|
3
|
+
start: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const transaction: (dbName: string, fn: (tx: Transaction) => Promise<void> | void) => Promise<void>;
|
|
6
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/operations/transaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,WAAW,EACZ,MAAM,UAAU,CAAA;AAGjB,MAAM,WAAW,kBAAkB;IAUjC,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,eAAO,MAAM,WAAW,WACd,MAAM,MACV,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,KAC5C,OAAO,CAAC,IAAI,CA4Fd,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
onReactApplicationContextReady(callback: () => void): void;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: Spec;
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=NativeNitroSQLiteOnLoad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeNitroSQLiteOnLoad.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeNitroSQLiteOnLoad.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAEpE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,8BAA8B,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;CAC3D;;AAED,wBAA4E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeNitroSQLiteOnLoad.ios.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeNitroSQLiteOnLoad.ios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AAErF,eAAO,MAAM,IAAI,EAAE,4BAElB,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { ColumnType, SQLiteValue } from '../types';
|
|
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 NativeQueryResult
|
|
12
|
+
*/
|
|
13
|
+
export interface NativeQueryResult extends HybridObject<{
|
|
14
|
+
ios: 'c++';
|
|
15
|
+
android: 'c++';
|
|
16
|
+
}> {
|
|
17
|
+
readonly rowsAffected: number;
|
|
18
|
+
readonly insertId?: number;
|
|
19
|
+
/** Query results */
|
|
20
|
+
readonly results: SQLiteQueryResults;
|
|
21
|
+
/** Table metadata */
|
|
22
|
+
readonly metadata?: Record<string, SQLiteQueryColumnMetadata>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Table metadata
|
|
26
|
+
* Describes some information about the table and it's columns fetched by the query
|
|
27
|
+
* The index is the name of the column
|
|
28
|
+
*/
|
|
29
|
+
export type SQLiteQueryResults = Record<string, SQLiteValue>[];
|
|
30
|
+
export interface SQLiteQueryColumnMetadata {
|
|
31
|
+
/** The name used for this column for this result set */
|
|
32
|
+
name: string;
|
|
33
|
+
/** 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. */
|
|
34
|
+
type: ColumnType;
|
|
35
|
+
/** The index for this column for this result set */
|
|
36
|
+
index: number;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=NativeQueryResult.nitro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeQueryResult.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeQueryResult.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEvD;;;;;;;;;GASG;AACH,MAAM,WAAW,iBACf,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;IACpD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAE1B,oBAAoB;IACpB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;IACpC,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAA;CAC9D;AAED;;;;GAIG;AAIH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAA;AAI9D,MAAM,WAAW,yBAAyB;IACxC,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAA;IACZ,uLAAuL;IACvL,IAAI,EAAE,UAAU,CAAA;IAChB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;CACd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { BatchQueryResult, FileLoadResult, BatchQueryCommand, SQLiteQueryParams } from '../types';
|
|
3
|
+
import type { NativeQueryResult } from './NativeQueryResult.nitro';
|
|
4
|
+
export interface NitroSQLite extends HybridObject<{
|
|
5
|
+
ios: 'c++';
|
|
6
|
+
android: 'c++';
|
|
7
|
+
}> {
|
|
8
|
+
open(dbName: string, location?: string): void;
|
|
9
|
+
close(dbName: string): void;
|
|
10
|
+
drop(dbName: string, location?: string): void;
|
|
11
|
+
attach(mainDbName: string, dbNameToAttach: string, alias: string, location?: string): void;
|
|
12
|
+
detach(mainDbName: string, alias: string): void;
|
|
13
|
+
execute(dbName: string, query: string, params?: SQLiteQueryParams): NativeQueryResult;
|
|
14
|
+
executeAsync(dbName: string, query: string, params?: SQLiteQueryParams): Promise<NativeQueryResult>;
|
|
15
|
+
executeBatch(dbName: string, commands: BatchQueryCommand[]): BatchQueryResult;
|
|
16
|
+
executeBatchAsync(dbName: string, commands: BatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
17
|
+
loadFile(dbName: string, location: string): FileLoadResult;
|
|
18
|
+
loadFileAsync(dbName: string, location: string): Promise<FileLoadResult>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=NitroSQLite.nitro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NitroSQLite.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NitroSQLite.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,MAAM,WAAW,WACf,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;IACpD,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7C,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7C,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAAA;IACP,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/C,OAAO,CACL,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,iBAAiB,CAAA;IACpB,YAAY,CACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC7B,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAA;IAC7E,iBAAiB,CACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAA;IAC1D,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;CACzE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { QueryResult, SQLiteItem, SQLiteQueryParams, Transaction } from './types';
|
|
2
|
+
interface TypeOrmNitroSQLiteConnection {
|
|
3
|
+
executeSql: <RowData extends SQLiteItem = never>(sql: string, params: SQLiteQueryParams | undefined, okExecute: (res: QueryResult<RowData>) => void, failExecute: (msg: string) => void) => Promise<void>;
|
|
4
|
+
transaction: (fn: (tx: Transaction) => Promise<void>) => Promise<void>;
|
|
5
|
+
close: (okClose: () => void, failClose: (e: unknown) => void) => void;
|
|
6
|
+
attach: (dbNameToAttach: string, alias: string, location: string | undefined, callback: () => void) => void;
|
|
7
|
+
detach: (alias: string, callback: () => void) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* DO NOT USE THIS! THIS IS MEANT FOR TYPEORM
|
|
11
|
+
* If you are looking for a convenience wrapper use `connect`
|
|
12
|
+
*/
|
|
13
|
+
export declare const typeORMDriver: {
|
|
14
|
+
openDatabase: (options: {
|
|
15
|
+
name: string;
|
|
16
|
+
location?: string;
|
|
17
|
+
}, ok: (db: TypeOrmNitroSQLiteConnection) => void, fail: (msg: string) => void) => TypeOrmNitroSQLiteConnection | null;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=typeORM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeORM.d.ts","sourceRoot":"","sources":["../../../src/typeORM.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,WAAW,EACZ,MAAM,SAAS,CAAA;AAGhB,UAAU,4BAA4B;IACpC,UAAU,EAAE,CAAC,OAAO,SAAS,UAAU,GAAG,KAAK,EAC7C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,SAAS,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,IAAI,EAC9C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC/B,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAA;IACrE,MAAM,EAAE,CACN,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,IAAI,KACjB,IAAI,CAAA;IACT,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;CACtD;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;4BAEb;QACP,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,MACG,CAAC,EAAE,EAAE,4BAA4B,KAAK,IAAI,QACxC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC1B,4BAA4B,GAAG,IAAI;CAuDvC,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export interface NitroSQLiteConnectionOptions {
|
|
2
|
+
name: string;
|
|
3
|
+
location?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface NitroSQLiteConnection {
|
|
6
|
+
close(): void;
|
|
7
|
+
delete(): void;
|
|
8
|
+
attach(dbNameToAttach: string, alias: string, location?: string): void;
|
|
9
|
+
detach(alias: string): void;
|
|
10
|
+
transaction(fn: (tx: Transaction) => Promise<void> | void): Promise<void>;
|
|
11
|
+
execute: ExecuteQuery;
|
|
12
|
+
executeAsync: ExecuteAsyncQuery;
|
|
13
|
+
executeBatch(commands: BatchQueryCommand[]): BatchQueryResult;
|
|
14
|
+
executeBatchAsync(commands: BatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
15
|
+
loadFile(location: string): FileLoadResult;
|
|
16
|
+
loadFileAsync(location: string): Promise<FileLoadResult>;
|
|
17
|
+
}
|
|
18
|
+
export declare enum ColumnType {
|
|
19
|
+
BOOLEAN = 0,
|
|
20
|
+
NUMBER = 1,
|
|
21
|
+
INT64 = 2,
|
|
22
|
+
TEXT = 3,
|
|
23
|
+
ARRAY_BUFFER = 4,
|
|
24
|
+
NULL_VALUE = 5
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Represents a value that can be stored in a SQLite database
|
|
28
|
+
*/
|
|
29
|
+
export type SQLiteValue = boolean | number | bigint | string | ArrayBuffer | undefined;
|
|
30
|
+
export type SQLiteItem = Record<string, SQLiteValue>;
|
|
31
|
+
export interface QueryResult<RowData extends SQLiteItem = SQLiteItem> {
|
|
32
|
+
readonly insertId?: number;
|
|
33
|
+
readonly rowsAffected: number;
|
|
34
|
+
readonly rows?: {
|
|
35
|
+
/** Raw array with all dataset */
|
|
36
|
+
_array: RowData[];
|
|
37
|
+
/** The lengh of the dataset */
|
|
38
|
+
length: number;
|
|
39
|
+
/** A convenience function to acess the index based the row object
|
|
40
|
+
* @param idx the row index
|
|
41
|
+
* @returns the row structure identified by column names
|
|
42
|
+
*/
|
|
43
|
+
item: (idx: number) => RowData | undefined;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export type SQLiteQueryParams = SQLiteValue[];
|
|
47
|
+
export type ExecuteQuery = <RowData extends SQLiteItem = SQLiteItem>(query: string, params?: SQLiteQueryParams) => QueryResult<RowData>;
|
|
48
|
+
export type ExecuteAsyncQuery = <RowData extends SQLiteItem = SQLiteItem>(query: string, params?: SQLiteQueryParams) => Promise<QueryResult<RowData>>;
|
|
49
|
+
export interface Transaction {
|
|
50
|
+
commit(): QueryResult;
|
|
51
|
+
rollback(): QueryResult;
|
|
52
|
+
execute: ExecuteQuery;
|
|
53
|
+
executeAsync: ExecuteAsyncQuery;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Allows the execution of bulk of sql commands
|
|
57
|
+
* inside a transaction
|
|
58
|
+
* If a single query must be executed many times with different arguments, its preferred
|
|
59
|
+
* to declare it a single time, and use an array of array parameters.
|
|
60
|
+
*/
|
|
61
|
+
export interface BatchQueryCommand {
|
|
62
|
+
query: string;
|
|
63
|
+
params?: SQLiteQueryParams | SQLiteQueryParams[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* status: 0 or undefined for correct execution, 1 for error
|
|
67
|
+
* message: if status === 1, here you will find error description
|
|
68
|
+
* rowsAffected: Number of affected rows if status == 0
|
|
69
|
+
*/
|
|
70
|
+
export interface BatchQueryResult {
|
|
71
|
+
rowsAffected?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Result of loading a file and executing every line as a SQL command
|
|
75
|
+
* Similar to BatchQueryResult
|
|
76
|
+
*/
|
|
77
|
+
export interface FileLoadResult extends BatchQueryResult {
|
|
78
|
+
commands?: number;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -43,6 +43,18 @@ target_link_libraries(
|
|
|
43
43
|
RNNitroSQLite
|
|
44
44
|
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
45
45
|
ReactAndroid::jsi # <-- RN: JSI
|
|
46
|
-
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
47
46
|
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
48
47
|
)
|
|
48
|
+
|
|
49
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
50
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
51
|
+
target_link_libraries(
|
|
52
|
+
RNNitroSQLite
|
|
53
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
54
|
+
)
|
|
55
|
+
else()
|
|
56
|
+
target_link_libraries(
|
|
57
|
+
RNNitroSQLite
|
|
58
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
59
|
+
)
|
|
60
|
+
endif()
|
|
@@ -7,12 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
-
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
11
|
-
#include <NitroModules/NitroDefines.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
10
|
// Forward declarations of C++ defined types
|
|
17
11
|
|
|
18
12
|
|
package/package.json
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-sqlite",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Fast SQLite for
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"bugs": {
|
|
22
|
-
"url": "https://github.com/margelo/react-native-nitro-sqlite/issues"
|
|
23
|
-
},
|
|
24
|
-
"homepage": "https://github.com/margelo/react-native-nitro-sqlite#readme",
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"registry": "https://registry.npmjs.org/"
|
|
3
|
+
"version": "9.0.1",
|
|
4
|
+
"description": "Fast SQLite library for React Native built using Nitro Modules",
|
|
5
|
+
"source": "./src/index.ts",
|
|
6
|
+
"main": "./lib/commonjs/index",
|
|
7
|
+
"module": "./lib/module/index",
|
|
8
|
+
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./lib/typescript/module/index.d.ts",
|
|
13
|
+
"default": "./lib/module/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
17
|
+
"default": "./lib/commonjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
27
20
|
},
|
|
28
21
|
"files": [
|
|
29
22
|
"src",
|
|
@@ -43,28 +36,54 @@
|
|
|
43
36
|
"!**/__mocks__"
|
|
44
37
|
],
|
|
45
38
|
"scripts": {
|
|
39
|
+
"postinstall": "bun build || exit 0;",
|
|
40
|
+
"build": "bun typescript && bob build",
|
|
41
|
+
"specs": "bun typescript && bun nitro-codegen --logLevel=\"debug\"",
|
|
46
42
|
"typescript": "tsc --noEmit",
|
|
47
43
|
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
44
|
+
"lint-ci": "eslint \"**/*.{js,ts,tsx}\" -f @jamesacarr/github-actions",
|
|
45
|
+
"test": "jest",
|
|
46
|
+
"release": "release-it"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"react-native",
|
|
50
|
+
"sqlite",
|
|
51
|
+
"nitro-modules",
|
|
52
|
+
"ios",
|
|
53
|
+
"android"
|
|
54
|
+
],
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/margelo/react-native-nitro-sqlite.git"
|
|
58
|
+
},
|
|
59
|
+
"author": "Margelo <hello@margelo.com> (https://github.com/margelo)",
|
|
60
|
+
"license": "MIT",
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/margelo/react-native-nitro-sqlite/issues"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/margelo/react-native-nitro-sqlite#readme",
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"registry": "https://registry.npmjs.org/"
|
|
50
67
|
},
|
|
51
68
|
"dependencies": {
|
|
52
69
|
"typeorm": "^0.3.20"
|
|
53
70
|
},
|
|
54
71
|
"devDependencies": {
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"react": "
|
|
59
|
-
"react-native": "0.
|
|
60
|
-
"react-native-builder-bob": "^0.18.2",
|
|
72
|
+
"jest": "*",
|
|
73
|
+
"nitro-codegen": "*",
|
|
74
|
+
"react": "*",
|
|
75
|
+
"react-native": "*",
|
|
76
|
+
"react-native-builder-bob": "^0.31.0",
|
|
61
77
|
"react-native-nitro-modules": "*"
|
|
62
78
|
},
|
|
63
79
|
"peerDependencies": {
|
|
64
|
-
"react": "
|
|
80
|
+
"react": ">=17.0.0",
|
|
65
81
|
"react-native": ">=0.74.0",
|
|
66
82
|
"react-native-nitro-modules": "*"
|
|
67
83
|
},
|
|
84
|
+
"resolutions": {
|
|
85
|
+
"@types/react": "^18.2.44"
|
|
86
|
+
},
|
|
68
87
|
"codegenConfig": {
|
|
69
88
|
"name": "RNNitroSQLite",
|
|
70
89
|
"type": "modules",
|
|
@@ -73,25 +92,50 @@
|
|
|
73
92
|
"javaPackageName": "com.margelo.rnnitrosqlite"
|
|
74
93
|
}
|
|
75
94
|
},
|
|
95
|
+
"jest": {
|
|
96
|
+
"preset": "react-native",
|
|
97
|
+
"modulePathIgnorePatterns": [
|
|
98
|
+
"<rootDir>/example/node_modules",
|
|
99
|
+
"<rootDir>/lib/"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"release-it": {
|
|
103
|
+
"npm": {
|
|
104
|
+
"publish": true
|
|
105
|
+
},
|
|
106
|
+
"git": false,
|
|
107
|
+
"github": {
|
|
108
|
+
"release": false
|
|
109
|
+
},
|
|
110
|
+
"hooks": {
|
|
111
|
+
"before:init": "bun typescript && bun lint",
|
|
112
|
+
"after:bump": "bun run build"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
76
115
|
"react-native-builder-bob": {
|
|
77
116
|
"source": "src",
|
|
78
117
|
"output": "lib",
|
|
79
118
|
"targets": [
|
|
80
|
-
|
|
81
|
-
|
|
119
|
+
[
|
|
120
|
+
"commonjs",
|
|
121
|
+
{
|
|
122
|
+
"esm": true
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
"module",
|
|
127
|
+
{
|
|
128
|
+
"esm": true
|
|
129
|
+
}
|
|
130
|
+
],
|
|
82
131
|
[
|
|
83
132
|
"typescript",
|
|
84
133
|
{
|
|
85
|
-
"tsc": "../node_modules/.bin/tsc"
|
|
134
|
+
"tsc": "../node_modules/.bin/tsc",
|
|
135
|
+
"project": "tsconfig.build.json",
|
|
136
|
+
"esm": true
|
|
86
137
|
}
|
|
87
138
|
]
|
|
88
139
|
]
|
|
89
|
-
},
|
|
90
|
-
"release-it": {
|
|
91
|
-
"npm": {
|
|
92
|
-
"publish": true,
|
|
93
|
-
"publishPackageManager": "bun"
|
|
94
|
-
},
|
|
95
|
-
"git": false
|
|
96
140
|
}
|
|
97
141
|
}
|
|
@@ -20,7 +20,7 @@ export interface PendingTransaction {
|
|
|
20
20
|
start: () => void
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const transaction =
|
|
23
|
+
export const transaction = (
|
|
24
24
|
dbName: string,
|
|
25
25
|
fn: (tx: Transaction) => Promise<void> | void
|
|
26
26
|
): Promise<void> => {
|
|
@@ -99,7 +99,6 @@ export const transaction = async (
|
|
|
99
99
|
|
|
100
100
|
throw executionError
|
|
101
101
|
} finally {
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
102
|
locks[dbName]!.inProgress = false
|
|
104
103
|
isFinalized = false
|
|
105
104
|
startNextTransaction(dbName)
|
|
@@ -128,7 +127,7 @@ function startNextTransaction(dbName: string) {
|
|
|
128
127
|
|
|
129
128
|
if (locks[dbName].queue.length > 0) {
|
|
130
129
|
locks[dbName].inProgress = true
|
|
131
|
-
|
|
130
|
+
|
|
132
131
|
const tx = locks[dbName].queue.shift()!
|
|
133
132
|
setImmediate(() => {
|
|
134
133
|
tx.start()
|
package/src/types.ts
CHANGED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
package com.margelo.rnnitrosqlite;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.Callback;
|
|
6
|
-
import com.facebook.react.bridge.NativeModule;
|
|
7
|
-
import com.facebook.react.bridge.Promise;
|
|
8
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
9
|
-
import com.facebook.react.bridge.ReactContext;
|
|
10
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
11
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
12
|
-
import java.util.Map;
|
|
13
|
-
import java.util.HashMap;
|
|
14
|
-
import com.margelo.rnnitrosqlite.NativeNitroSQLiteOnLoadSpec;
|
|
15
|
-
|
|
16
|
-
public class RNNitroSQLiteOnLoadModule extends NativeNitroSQLiteOnLoadSpec {
|
|
17
|
-
private static ReactApplicationContext _reactContext;
|
|
18
|
-
private Callback reactApplicationContextReadyCallback;
|
|
19
|
-
|
|
20
|
-
public RNNitroSQLiteOnLoadModule(ReactApplicationContext reactContext) {
|
|
21
|
-
super(reactContext);
|
|
22
|
-
|
|
23
|
-
_reactContext = reactContext;
|
|
24
|
-
setDocPath(reactContext);
|
|
25
|
-
|
|
26
|
-
if (reactApplicationContextReadyCallback != null) {
|
|
27
|
-
reactApplicationContextReadyCallback.invoke();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public static void setDocPath(ReactApplicationContext context) {
|
|
32
|
-
final String path = context.getFilesDir().getAbsolutePath();
|
|
33
|
-
setDocPathInJNI(path);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@Override
|
|
37
|
-
@NonNull
|
|
38
|
-
public String getName() {
|
|
39
|
-
return NAME;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@Override
|
|
43
|
-
public void onReactApplicationContextReady(Callback callback) {
|
|
44
|
-
if (_reactContext != null) {
|
|
45
|
-
callback.invoke();
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
reactApplicationContextReadyCallback = callback;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public static ReactApplicationContext getReactContext() {
|
|
53
|
-
return _reactContext;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private native static void setDocPathInJNI(String docPath);
|
|
57
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
package com.margelo.rnnitrosqlite;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
import androidx.annotation.Nullable;
|
|
5
|
-
import com.facebook.react.bridge.NativeModule;
|
|
6
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.react.module.model.ReactModuleInfo;
|
|
8
|
-
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
9
|
-
import com.facebook.react.TurboReactPackage;
|
|
10
|
-
|
|
11
|
-
import java.util.Collections;
|
|
12
|
-
import java.util.HashMap;
|
|
13
|
-
import java.util.List;
|
|
14
|
-
import java.util.Map;
|
|
15
|
-
|
|
16
|
-
public class RNNitroSQLitePackage extends TurboReactPackage {
|
|
17
|
-
static {
|
|
18
|
-
System.loadLibrary("RNNitroSQLite");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Nullable
|
|
22
|
-
@Override
|
|
23
|
-
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
24
|
-
if (name.equals(RNNitroSQLiteOnLoadModule.NAME)) {
|
|
25
|
-
return new RNNitroSQLiteOnLoadModule(reactContext);
|
|
26
|
-
} else {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@Override
|
|
32
|
-
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
33
|
-
return () -> {
|
|
34
|
-
final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
|
|
35
|
-
moduleInfos.put(
|
|
36
|
-
RNNitroSQLiteOnLoadModule.NAME,
|
|
37
|
-
new ReactModuleInfo(
|
|
38
|
-
RNNitroSQLiteOnLoadModule.NAME,
|
|
39
|
-
RNNitroSQLiteOnLoadModule.NAME,
|
|
40
|
-
false,
|
|
41
|
-
true,
|
|
42
|
-
true,
|
|
43
|
-
false,
|
|
44
|
-
true));
|
|
45
|
-
return moduleInfos;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|