react-native-nitro-sqlite 9.2.2 → 9.4.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 +1 -1
- package/cpp/NitroSQLiteException.hpp +1 -2
- package/cpp/{specs → hybridObjects}/HybridNitroSQLite.cpp +64 -16
- package/cpp/{specs → hybridObjects}/HybridNitroSQLite.hpp +6 -6
- package/cpp/hybridObjects/HybridNitroSQLiteQueryResult.cpp +93 -0
- package/cpp/hybridObjects/HybridNitroSQLiteQueryResult.hpp +47 -0
- package/cpp/operations.cpp +16 -12
- package/cpp/operations.hpp +3 -1
- package/cpp/sqliteExecuteBatch.cpp +2 -2
- package/cpp/sqliteExecuteBatch.hpp +2 -2
- package/cpp/types.hpp +4 -14
- package/ios/NitroSQLite.xcodeproj/project.pbxproj +2 -2
- package/lib/commonjs/index.js +0 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/operations/execute.js +19 -32
- package/lib/commonjs/operations/execute.js.map +1 -1
- package/lib/commonjs/operations/executeBatch.js +2 -19
- package/lib/commonjs/operations/executeBatch.js.map +1 -1
- package/lib/commonjs/specs/{NativeQueryResult.nitro.js → NitroSQLiteQueryResult.nitro.js} +1 -1
- package/lib/commonjs/specs/NitroSQLiteQueryResult.nitro.js.map +1 -0
- package/lib/commonjs/types.js +1 -8
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/operations/execute.js +19 -33
- package/lib/module/operations/execute.js.map +1 -1
- package/lib/module/operations/executeBatch.js +2 -19
- package/lib/module/operations/executeBatch.js.map +1 -1
- package/lib/module/specs/NitroSQLiteQueryResult.nitro.js +4 -0
- package/lib/module/specs/NitroSQLiteQueryResult.nitro.js.map +1 -0
- package/lib/module/types.js +0 -12
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +0 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/execute.d.ts +1 -1
- package/lib/typescript/commonjs/operations/execute.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/executeBatch.d.ts +1 -1
- package/lib/typescript/commonjs/operations/executeBatch.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/transaction.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts +6 -6
- package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts.map +1 -1
- package/lib/typescript/{module/specs/NativeQueryResult.nitro.d.ts → commonjs/specs/NitroSQLiteQueryResult.nitro.d.ts} +7 -13
- package/lib/typescript/commonjs/specs/NitroSQLiteQueryResult.nitro.d.ts.map +1 -0
- package/lib/typescript/commonjs/typeORM.d.ts +1 -1
- package/lib/typescript/commonjs/typeORM.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +21 -37
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +0 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/operations/execute.d.ts +1 -1
- package/lib/typescript/module/operations/execute.d.ts.map +1 -1
- package/lib/typescript/module/operations/executeBatch.d.ts +1 -1
- package/lib/typescript/module/operations/executeBatch.d.ts.map +1 -1
- package/lib/typescript/module/operations/transaction.d.ts.map +1 -1
- package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts +6 -6
- package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts.map +1 -1
- package/lib/typescript/{commonjs/specs/NativeQueryResult.nitro.d.ts → module/specs/NitroSQLiteQueryResult.nitro.d.ts} +7 -13
- package/lib/typescript/module/specs/NitroSQLiteQueryResult.nitro.d.ts.map +1 -0
- package/lib/typescript/module/typeORM.d.ts +1 -1
- package/lib/typescript/module/typeORM.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +21 -37
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake +9 -6
- package/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle +1 -1
- package/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp +2 -4
- package/nitrogen/generated/android/RNNitroSQLiteOnLoad.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp +14 -1
- package/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.hpp +4 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec.kt +8 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb +2 -2
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm +1 -1
- package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.swift +5 -1
- package/nitrogen/generated/shared/c++/BatchQueryCommand.hpp +92 -0
- package/nitrogen/generated/shared/c++/BatchQueryResult.hpp +25 -11
- package/nitrogen/generated/shared/c++/ColumnType.hpp +5 -7
- package/nitrogen/generated/shared/c++/FileLoadResult.hpp +28 -14
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteQueryResultSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteQueryResultSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp +12 -16
- package/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.hpp +93 -0
- package/package.json +5 -5
- package/src/index.ts +0 -6
- package/src/operations/execute.ts +23 -58
- package/src/operations/executeBatch.ts +3 -41
- package/src/operations/session.ts +1 -1
- package/src/operations/transaction.ts +1 -1
- package/src/specs/NitroSQLite.nitro.ts +9 -12
- package/src/specs/{NativeQueryResult.nitro.ts → NitroSQLiteQueryResult.nitro.ts} +15 -17
- package/src/typeORM.ts +1 -1
- package/src/types.ts +28 -45
- package/cpp/specs/HybridNativeQueryResult.cpp +0 -21
- package/cpp/specs/HybridNativeQueryResult.hpp +0 -27
- package/lib/commonjs/nullHandling.js +0 -33
- package/lib/commonjs/nullHandling.js.map +0 -1
- package/lib/commonjs/specs/NativeQueryResult.nitro.js.map +0 -1
- package/lib/module/nullHandling.js +0 -25
- package/lib/module/nullHandling.js.map +0 -1
- package/lib/module/specs/NativeQueryResult.nitro.js +0 -4
- package/lib/module/specs/NativeQueryResult.nitro.js.map +0 -1
- package/lib/typescript/commonjs/nullHandling.d.ts +0 -8
- package/lib/typescript/commonjs/nullHandling.d.ts.map +0 -1
- package/lib/typescript/commonjs/specs/NativeQueryResult.nitro.d.ts.map +0 -1
- package/lib/typescript/module/nullHandling.d.ts +0 -8
- package/lib/typescript/module/nullHandling.d.ts.map +0 -1
- package/lib/typescript/module/specs/NativeQueryResult.nitro.d.ts.map +0 -1
- package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.cpp +0 -24
- package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.hpp +0 -77
- package/nitrogen/generated/shared/c++/NativeBatchQueryCommand.hpp +0 -81
- package/nitrogen/generated/shared/c++/SQLiteNullValue.hpp +0 -69
- package/nitrogen/generated/shared/c++/SQLiteQueryColumnMetadata.hpp +0 -79
- package/src/nullHandling.ts +0 -35
|
@@ -5,43 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.executeBatch = executeBatch;
|
|
7
7
|
exports.executeBatchAsync = executeBatchAsync;
|
|
8
|
-
var _nullHandling = require("../nullHandling.js");
|
|
9
8
|
var _nitro = require("../nitro.js");
|
|
10
9
|
var _DatabaseQueue = require("../DatabaseQueue.js");
|
|
11
10
|
var _NitroSQLiteError = _interopRequireDefault(require("../NitroSQLiteError.js"));
|
|
12
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
function executeBatch(dbName, commands) {
|
|
14
13
|
(0, _DatabaseQueue.throwIfDatabaseIsNotOpen)(dbName);
|
|
15
|
-
const transformedCommands = (0, _nullHandling.isSimpleNullHandlingEnabled)() ? toNativeBatchQueryCommands(commands) : commands;
|
|
16
14
|
try {
|
|
17
|
-
return (0, _DatabaseQueue.startOperationSync)(dbName, () => _nitro.HybridNitroSQLite.executeBatch(dbName,
|
|
15
|
+
return (0, _DatabaseQueue.startOperationSync)(dbName, () => _nitro.HybridNitroSQLite.executeBatch(dbName, commands));
|
|
18
16
|
} catch (error) {
|
|
19
17
|
throw _NitroSQLiteError.default.fromError(error);
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
20
|
async function executeBatchAsync(dbName, commands) {
|
|
23
21
|
(0, _DatabaseQueue.throwIfDatabaseIsNotOpen)(dbName);
|
|
24
|
-
const transformedCommands = (0, _nullHandling.isSimpleNullHandlingEnabled)() ? toNativeBatchQueryCommands(commands) : commands;
|
|
25
22
|
return (0, _DatabaseQueue.queueOperationAsync)(dbName, async () => {
|
|
26
23
|
try {
|
|
27
|
-
return await _nitro.HybridNitroSQLite.executeBatchAsync(dbName,
|
|
24
|
+
return await _nitro.HybridNitroSQLite.executeBatchAsync(dbName, commands);
|
|
28
25
|
} catch (error) {
|
|
29
26
|
throw _NitroSQLiteError.default.fromError(error);
|
|
30
27
|
}
|
|
31
28
|
});
|
|
32
29
|
}
|
|
33
|
-
function toNativeBatchQueryCommands(commands) {
|
|
34
|
-
return commands.map(command => {
|
|
35
|
-
const transformedParams = command.params?.map(param => {
|
|
36
|
-
if (Array.isArray(param)) {
|
|
37
|
-
return param.map(p => (0, _nullHandling.replaceWithNativeNullValue)(p));
|
|
38
|
-
}
|
|
39
|
-
return (0, _nullHandling.replaceWithNativeNullValue)(param);
|
|
40
|
-
});
|
|
41
|
-
return {
|
|
42
|
-
query: command.query,
|
|
43
|
-
params: transformedParams
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
30
|
//# sourceMappingURL=executeBatch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_nitro","require","_DatabaseQueue","_NitroSQLiteError","_interopRequireDefault","e","__esModule","default","executeBatch","dbName","commands","throwIfDatabaseIsNotOpen","startOperationSync","HybridNitroSQLite","error","NitroSQLiteError","fromError","executeBatchAsync","queueOperationAsync"],"sourceRoot":"../../../src","sources":["operations/executeBatch.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAkD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG3C,SAASG,YAAYA,CAC1BC,MAAc,EACdC,QAA6B,EACX;EAClB,IAAAC,uCAAwB,EAACF,MAAM,CAAC;EAEhC,IAAI;IACF,OAAO,IAAAG,iCAAkB,EAACH,MAAM,EAAE,MAChCI,wBAAiB,CAACL,YAAY,CAACC,MAAM,EAAEC,QAAQ,CACjD,CAAC;EACH,CAAC,CAAC,OAAOI,KAAK,EAAE;IACd,MAAMC,yBAAgB,CAACC,SAAS,CAACF,KAAK,CAAC;EACzC;AACF;AAEO,eAAeG,iBAAiBA,CACrCR,MAAc,EACdC,QAA6B,EACF;EAC3B,IAAAC,uCAAwB,EAACF,MAAM,CAAC;EAEhC,OAAO,IAAAS,kCAAmB,EAACT,MAAM,EAAE,YAAY;IAC7C,IAAI;MACF,OAAO,MAAMI,wBAAiB,CAACI,iBAAiB,CAACR,MAAM,EAAEC,QAAQ,CAAC;IACpE,CAAC,CAAC,OAAOI,KAAK,EAAE;MACd,MAAMC,yBAAgB,CAACC,SAAS,CAACF,KAAK,CAAC;IACzC;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/NitroSQLiteQueryResult.nitro.ts"],"mappings":"","ignoreList":[]}
|
package/lib/commonjs/types.js
CHANGED
|
@@ -12,20 +12,13 @@ let ColumnType = exports.ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
|
12
12
|
ColumnType[ColumnType["ARRAY_BUFFER"] = 4] = "ARRAY_BUFFER";
|
|
13
13
|
ColumnType[ColumnType["NULL_VALUE"] = 5] = "NULL_VALUE";
|
|
14
14
|
return ColumnType;
|
|
15
|
-
}({});
|
|
16
|
-
/** Used internally to transform the query params into a native format without nullish values */
|
|
17
|
-
/**
|
|
18
|
-
* Represents a value that can be stored in a SQLite database
|
|
19
|
-
*/
|
|
15
|
+
}({});
|
|
20
16
|
/**
|
|
21
17
|
* Allows the execution of bulk of sql commands
|
|
22
18
|
* inside a transaction
|
|
23
19
|
* If a single query must be executed many times with different arguments, its preferred
|
|
24
20
|
* to declare it a single time, and use an array of array parameters.
|
|
25
21
|
*/
|
|
26
|
-
/**
|
|
27
|
-
* Used internally to transform the batch query commands into a native format without nullish values
|
|
28
|
-
*/
|
|
29
22
|
/**
|
|
30
23
|
* status: 0 or undefined for correct execution, 1 for error
|
|
31
24
|
* message: if status === 1, here you will find error description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ColumnType","exports"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["ColumnType","exports"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;;;;;IAuBYA,UAAU,GAAAC,OAAA,CAAAD,UAAA,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAsDtB;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -21,7 +21,6 @@ export const NitroSQLite = {
|
|
|
21
21
|
executeBatchAsync
|
|
22
22
|
};
|
|
23
23
|
export { open } from "./operations/session.js";
|
|
24
|
-
export { isNitroSQLiteNull, NITRO_SQLITE_NULL, isSimpleNullHandlingEnabled, enableSimpleNullHandling } from "./nullHandling.js";
|
|
25
24
|
export { default as NitroSQLiteError } from "./NitroSQLiteError.js";
|
|
26
25
|
export { typeORMDriver } from "./typeORM.js";
|
|
27
26
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["transaction","HybridNitroSQLite","open","execute","executeAsync","init","executeBatch","executeBatchAsync","NitroSQLite","native","
|
|
1
|
+
{"version":3,"names":["transaction","HybridNitroSQLite","open","execute","executeAsync","init","executeBatch","executeBatchAsync","NitroSQLite","native","default","NitroSQLiteError","typeORMDriver"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,6BAA0B;AACtD,SAASC,iBAAiB,QAAQ,YAAS;AAC3C,SAASC,IAAI,QAAQ,yBAAsB;AAC3C,SAASC,OAAO,EAAEC,YAAY,QAAQ,yBAAsB;AAC5D,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,YAAY,EAAEC,iBAAiB,QAAQ,8BAA2B;AAE3EF,IAAI,CAAC,CAAC;AAEN,OAAO,MAAMG,WAAW,GAAG;EACzB,GAAGP,iBAAiB;EACpBQ,MAAM,EAAER,iBAAiB;EACzB;EACA;EACAC,IAAI;EACJ;EACAF,WAAW;EACXG,OAAO;EACPC,YAAY;EACZE,YAAY;EACZC;AACF,CAAC;AAED,SAASL,IAAI,QAAQ,yBAAsB;AAC3C,SAASQ,OAAO,IAAIC,gBAAgB,QAAQ,uBAAoB;AAEhE,SAASC,aAAa,QAAQ,cAAW","ignoreList":[]}
|
|
@@ -1,52 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { isNitroSQLiteNull, isSimpleNullHandlingEnabled } from "../nullHandling.js";
|
|
4
3
|
import { HybridNitroSQLite } from "../nitro.js";
|
|
5
|
-
import { replaceWithNativeNullValue } from "../nullHandling.js";
|
|
6
4
|
import NitroSQLiteError from "../NitroSQLiteError.js";
|
|
7
5
|
export function execute(dbName, query, params) {
|
|
8
|
-
const transformedParams = isSimpleNullHandlingEnabled() ? toNativeQueryParams(params) : params;
|
|
9
6
|
try {
|
|
10
|
-
const nativeResult = HybridNitroSQLite.execute(dbName, query,
|
|
11
|
-
return
|
|
7
|
+
const nativeResult = HybridNitroSQLite.execute(dbName, query, params);
|
|
8
|
+
return buildJSQueryResult(nativeResult);
|
|
12
9
|
} catch (error) {
|
|
13
10
|
throw NitroSQLiteError.fromError(error);
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
13
|
export async function executeAsync(dbName, query, params) {
|
|
17
|
-
const transformedParams = isSimpleNullHandlingEnabled() ? toNativeQueryParams(params) : params;
|
|
18
14
|
try {
|
|
19
|
-
const nativeResult = await HybridNitroSQLite.executeAsync(dbName, query,
|
|
20
|
-
return
|
|
15
|
+
const nativeResult = await HybridNitroSQLite.executeAsync(dbName, query, params);
|
|
16
|
+
return buildJSQueryResult(nativeResult);
|
|
21
17
|
} catch (error) {
|
|
22
18
|
throw NitroSQLiteError.fromError(error);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
results
|
|
32
|
-
}) {
|
|
33
|
-
let data = results;
|
|
34
|
-
if (isSimpleNullHandlingEnabled()) {
|
|
35
|
-
data = results.map(row => Object.fromEntries(Object.entries(row).map(([key, value]) => {
|
|
36
|
-
if (isNitroSQLiteNull(value)) {
|
|
37
|
-
return [key, null];
|
|
38
|
-
}
|
|
39
|
-
return [key, value];
|
|
40
|
-
})));
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
insertId,
|
|
44
|
-
rowsAffected,
|
|
45
|
-
rows: {
|
|
46
|
-
_array: data,
|
|
47
|
-
length: data.length,
|
|
48
|
-
item: idx => data[idx]
|
|
49
|
-
}
|
|
21
|
+
function buildJSQueryResult(result) {
|
|
22
|
+
const resultWithRows = result;
|
|
23
|
+
resultWithRows.rows = {
|
|
24
|
+
_array: result.results,
|
|
25
|
+
length: result.results.length,
|
|
26
|
+
item: idx => result.results[idx]
|
|
50
27
|
};
|
|
28
|
+
return resultWithRows;
|
|
29
|
+
|
|
30
|
+
// return Object.assign(result, {
|
|
31
|
+
// rows: {
|
|
32
|
+
// _array: result.results,
|
|
33
|
+
// length: result.results.length,
|
|
34
|
+
// item: (idx: number) => result.results[idx],
|
|
35
|
+
// },
|
|
36
|
+
// })
|
|
51
37
|
}
|
|
52
38
|
//# sourceMappingURL=execute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["HybridNitroSQLite","NitroSQLiteError","execute","dbName","query","params","nativeResult","buildJSQueryResult","error","fromError","executeAsync","result","resultWithRows","rows","_array","results","length","item","idx"],"sourceRoot":"../../../src","sources":["operations/execute.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,aAAU;AAE5C,OAAOC,gBAAgB,MAAM,wBAAqB;AAGlD,OAAO,SAASC,OAAOA,CACrBC,MAAc,EACdC,KAAa,EACbC,MAA0B,EACR;EAClB,IAAI;IACF,MAAMC,YAAY,GAAGN,iBAAiB,CAACE,OAAO,CAACC,MAAM,EAAEC,KAAK,EAAEC,MAAM,CAAC;IACrE,OAAOE,kBAAkB,CAAMD,YAAY,CAAC;EAC9C,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,MAAMP,gBAAgB,CAACQ,SAAS,CAACD,KAAK,CAAC;EACzC;AACF;AAEA,OAAO,eAAeE,YAAYA,CAChCP,MAAc,EACdC,KAAa,EACbC,MAA0B,EACC;EAC3B,IAAI;IACF,MAAMC,YAAY,GAAG,MAAMN,iBAAiB,CAACU,YAAY,CACvDP,MAAM,EACNC,KAAK,EACLC,MACF,CAAC;IACD,OAAOE,kBAAkB,CAAMD,YAAY,CAAC;EAC9C,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,MAAMP,gBAAgB,CAACQ,SAAS,CAACD,KAAK,CAAC;EACzC;AACF;AAEA,SAASD,kBAAkBA,CACzBI,MAA8B,EACZ;EAClB,MAAMC,cAAc,GAAGD,MAA0B;EAEjDC,cAAc,CAACC,IAAI,GAAG;IACpBC,MAAM,EAAEH,MAAM,CAACI,OAAgB;IAC/BC,MAAM,EAAEL,MAAM,CAACI,OAAO,CAACC,MAAM;IAC7BC,IAAI,EAAGC,GAAW,IAAKP,MAAM,CAACI,OAAO,CAACG,GAAG;EAC3C,CAAC;EAED,OAAON,cAAc;;EAErB;EACA;EACA;EACA;EACA;EACA;EACA;AACF","ignoreList":[]}
|
|
@@ -1,41 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { isSimpleNullHandlingEnabled, replaceWithNativeNullValue } from "../nullHandling.js";
|
|
4
3
|
import { HybridNitroSQLite } from "../nitro.js";
|
|
5
4
|
import { queueOperationAsync, startOperationSync, throwIfDatabaseIsNotOpen } from "../DatabaseQueue.js";
|
|
6
5
|
import NitroSQLiteError from "../NitroSQLiteError.js";
|
|
7
6
|
export function executeBatch(dbName, commands) {
|
|
8
7
|
throwIfDatabaseIsNotOpen(dbName);
|
|
9
|
-
const transformedCommands = isSimpleNullHandlingEnabled() ? toNativeBatchQueryCommands(commands) : commands;
|
|
10
8
|
try {
|
|
11
|
-
return startOperationSync(dbName, () => HybridNitroSQLite.executeBatch(dbName,
|
|
9
|
+
return startOperationSync(dbName, () => HybridNitroSQLite.executeBatch(dbName, commands));
|
|
12
10
|
} catch (error) {
|
|
13
11
|
throw NitroSQLiteError.fromError(error);
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
export async function executeBatchAsync(dbName, commands) {
|
|
17
15
|
throwIfDatabaseIsNotOpen(dbName);
|
|
18
|
-
const transformedCommands = isSimpleNullHandlingEnabled() ? toNativeBatchQueryCommands(commands) : commands;
|
|
19
16
|
return queueOperationAsync(dbName, async () => {
|
|
20
17
|
try {
|
|
21
|
-
return await HybridNitroSQLite.executeBatchAsync(dbName,
|
|
18
|
+
return await HybridNitroSQLite.executeBatchAsync(dbName, commands);
|
|
22
19
|
} catch (error) {
|
|
23
20
|
throw NitroSQLiteError.fromError(error);
|
|
24
21
|
}
|
|
25
22
|
});
|
|
26
23
|
}
|
|
27
|
-
function toNativeBatchQueryCommands(commands) {
|
|
28
|
-
return commands.map(command => {
|
|
29
|
-
const transformedParams = command.params?.map(param => {
|
|
30
|
-
if (Array.isArray(param)) {
|
|
31
|
-
return param.map(p => replaceWithNativeNullValue(p));
|
|
32
|
-
}
|
|
33
|
-
return replaceWithNativeNullValue(param);
|
|
34
|
-
});
|
|
35
|
-
return {
|
|
36
|
-
query: command.query,
|
|
37
|
-
params: transformedParams
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
24
|
//# sourceMappingURL=executeBatch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["HybridNitroSQLite","queueOperationAsync","startOperationSync","throwIfDatabaseIsNotOpen","NitroSQLiteError","executeBatch","dbName","commands","error","fromError","executeBatchAsync"],"sourceRoot":"../../../src","sources":["operations/executeBatch.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,aAAU;AAC5C,SACEC,mBAAmB,EACnBC,kBAAkB,EAClBC,wBAAwB,QACnB,qBAAkB;AACzB,OAAOC,gBAAgB,MAAM,wBAAqB;AAGlD,OAAO,SAASC,YAAYA,CAC1BC,MAAc,EACdC,QAA6B,EACX;EAClBJ,wBAAwB,CAACG,MAAM,CAAC;EAEhC,IAAI;IACF,OAAOJ,kBAAkB,CAACI,MAAM,EAAE,MAChCN,iBAAiB,CAACK,YAAY,CAACC,MAAM,EAAEC,QAAQ,CACjD,CAAC;EACH,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,MAAMJ,gBAAgB,CAACK,SAAS,CAACD,KAAK,CAAC;EACzC;AACF;AAEA,OAAO,eAAeE,iBAAiBA,CACrCJ,MAAc,EACdC,QAA6B,EACF;EAC3BJ,wBAAwB,CAACG,MAAM,CAAC;EAEhC,OAAOL,mBAAmB,CAACK,MAAM,EAAE,YAAY;IAC7C,IAAI;MACF,OAAO,MAAMN,iBAAiB,CAACU,iBAAiB,CAACJ,MAAM,EAAEC,QAAQ,CAAC;IACpE,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAMJ,gBAAgB,CAACK,SAAS,CAACD,KAAK,CAAC;IACzC;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/NitroSQLiteQueryResult.nitro.ts"],"mappings":"","ignoreList":[]}
|
package/lib/module/types.js
CHANGED
|
@@ -10,14 +10,6 @@ export let ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
|
10
10
|
return ColumnType;
|
|
11
11
|
}({});
|
|
12
12
|
|
|
13
|
-
// Passing null/undefined in array types is not possible, so we us a special struct as a workaround.
|
|
14
|
-
|
|
15
|
-
/** Used internally to transform the query params into a native format without nullish values */
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Represents a value that can be stored in a SQLite database
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
13
|
/**
|
|
22
14
|
* Allows the execution of bulk of sql commands
|
|
23
15
|
* inside a transaction
|
|
@@ -25,10 +17,6 @@ export let ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
|
25
17
|
* to declare it a single time, and use an array of array parameters.
|
|
26
18
|
*/
|
|
27
19
|
|
|
28
|
-
/**
|
|
29
|
-
* Used internally to transform the batch query commands into a native format without nullish values
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
20
|
/**
|
|
33
21
|
* status: 0 or undefined for correct execution, 1 for error
|
|
34
22
|
* message: if status === 1, here you will find error description
|
package/lib/module/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ColumnType"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["ColumnType"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAuBA,WAAYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;;AAsDtB;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -25,7 +25,6 @@ export declare const NitroSQLite: {
|
|
|
25
25
|
dispose(): void;
|
|
26
26
|
};
|
|
27
27
|
export { open } from './operations/session';
|
|
28
|
-
export { isNitroSQLiteNull, NITRO_SQLITE_NULL, isSimpleNullHandlingEnabled, enableSimpleNullHandling, } from './nullHandling';
|
|
29
28
|
export { default as NitroSQLiteError } from './NitroSQLiteError';
|
|
30
29
|
export type * from './types';
|
|
31
30
|
export { typeORMDriver } from './typeORM';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAI3E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;CAYvB,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAI3E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;CAYvB,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAChE,mBAAmB,SAAS,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QueryResult,
|
|
1
|
+
import type { QueryResult, QueryResultRow, SQLiteQueryParams } from '../types';
|
|
2
2
|
export declare function execute<Row extends QueryResultRow = never>(dbName: string, query: string, params?: SQLiteQueryParams): QueryResult<Row>;
|
|
3
3
|
export declare function executeAsync<Row extends QueryResultRow = never>(dbName: string, query: string, params?: SQLiteQueryParams): Promise<QueryResult<Row>>;
|
|
4
4
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/operations/execute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/operations/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAI9E,wBAAgB,OAAO,CAAC,GAAG,SAAS,cAAc,GAAG,KAAK,EACxD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,WAAW,CAAC,GAAG,CAAC,CAOlB;AAED,wBAAsB,YAAY,CAAC,GAAG,SAAS,cAAc,GAAG,KAAK,EACnE,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAW3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BatchQueryCommand, BatchQueryResult } from '../types';
|
|
2
2
|
export declare function executeBatch(dbName: string, commands: BatchQueryCommand[]): BatchQueryResult;
|
|
3
3
|
export declare function executeBatchAsync(dbName: string, commands: BatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
4
4
|
//# sourceMappingURL=executeBatch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeBatch.d.ts","sourceRoot":"","sources":["../../../../src/operations/executeBatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executeBatch.d.ts","sourceRoot":"","sources":["../../../../src/operations/executeBatch.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEnE,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,gBAAgB,CAUlB;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAU3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/operations/transaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/operations/transaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAIZ,MAAM,UAAU,CAAA;AAIjB,eAAO,MAAM,WAAW,GAAU,MAAM,GAAG,IAAI,EAC7C,QAAQ,MAAM,EACd,qBAAqB,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,EACzD,qBAAmB,oBA+EpB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
-
import type { BatchQueryResult, FileLoadResult,
|
|
3
|
-
import type {
|
|
2
|
+
import type { BatchQueryCommand, BatchQueryResult, FileLoadResult, SQLiteQueryParams } from '../types';
|
|
3
|
+
import type { NitroSQLiteQueryResult } from './NitroSQLiteQueryResult.nitro';
|
|
4
4
|
export interface NitroSQLite extends HybridObject<{
|
|
5
5
|
ios: 'c++';
|
|
6
6
|
android: 'c++';
|
|
@@ -10,10 +10,10 @@ export interface NitroSQLite extends HybridObject<{
|
|
|
10
10
|
drop(dbName: string, location?: string): void;
|
|
11
11
|
attach(mainDbName: string, dbNameToAttach: string, alias: string, location?: string): void;
|
|
12
12
|
detach(mainDbName: string, alias: string): void;
|
|
13
|
-
execute(dbName: string, query: string, params?:
|
|
14
|
-
executeAsync(dbName: string, query: string, params?:
|
|
15
|
-
executeBatch(dbName: string, commands:
|
|
16
|
-
executeBatchAsync(dbName: string, commands:
|
|
13
|
+
execute(dbName: string, query: string, params?: SQLiteQueryParams): NitroSQLiteQueryResult;
|
|
14
|
+
executeAsync(dbName: string, query: string, params?: SQLiteQueryParams): Promise<NitroSQLiteQueryResult>;
|
|
15
|
+
executeBatch(dbName: string, commands: BatchQueryCommand[]): BatchQueryResult;
|
|
16
|
+
executeBatchAsync(dbName: string, commands: BatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
17
17
|
loadFile(dbName: string, location: string): FileLoadResult;
|
|
18
18
|
loadFileAsync(dbName: string, location: string): Promise<FileLoadResult>;
|
|
19
19
|
}
|
|
@@ -1 +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,
|
|
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,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EAClB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAE5E,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,sBAAsB,CAAA;IACzB,YAAY,CACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAClC,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"}
|
|
@@ -8,31 +8,25 @@ import type { ColumnType, SQLiteValue } from '../types';
|
|
|
8
8
|
* rows: if status is undefined or 0 this object will contain the query results
|
|
9
9
|
* }
|
|
10
10
|
*
|
|
11
|
-
* @interface
|
|
11
|
+
* @interface QueryResult
|
|
12
12
|
*/
|
|
13
|
-
export interface
|
|
13
|
+
export interface NitroSQLiteQueryResult extends HybridObject<{
|
|
14
14
|
ios: 'c++';
|
|
15
15
|
android: 'c++';
|
|
16
16
|
}> {
|
|
17
17
|
readonly rowsAffected: number;
|
|
18
18
|
readonly insertId?: number;
|
|
19
19
|
/** Query results */
|
|
20
|
-
readonly results:
|
|
20
|
+
readonly results: Record<string, SQLiteValue>[];
|
|
21
21
|
/** Table metadata */
|
|
22
|
-
readonly metadata?: Record<string,
|
|
22
|
+
readonly metadata?: Record<string, NitroSQLiteQueryColumnMetadata>;
|
|
23
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 NativeSQLiteQueryResults = Record<string, SQLiteValue>[];
|
|
30
|
-
export interface SQLiteQueryColumnMetadata {
|
|
24
|
+
export type NitroSQLiteQueryColumnMetadata = {
|
|
31
25
|
/** The name used for this column for this result set */
|
|
32
26
|
name: string;
|
|
33
27
|
/** 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
28
|
type: ColumnType;
|
|
35
29
|
/** The index for this column for this result set */
|
|
36
30
|
index: number;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=NitroSQLiteQueryResult.nitro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NitroSQLiteQueryResult.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NitroSQLiteQueryResult.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,sBACf,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,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAA;IAE/C,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAA;CACnE;AASD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAA;IAEZ,uLAAuL;IACvL,IAAI,EAAE,UAAU,CAAA;IAEhB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;CACd,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Transaction, SQLiteQueryParams, QueryResultRow, QueryResult } from './types';
|
|
2
2
|
interface TypeOrmNitroSQLiteConnection {
|
|
3
3
|
executeSql: <RowData extends QueryResultRow = never>(sql: string, params: SQLiteQueryParams | undefined, okExecute: (res: QueryResult<RowData>) => void, failExecute: (msg: string) => void) => Promise<void>;
|
|
4
4
|
transaction: (fn: (tx: Transaction) => Promise<void>) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeORM.d.ts","sourceRoot":"","sources":["../../../src/typeORM.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"typeORM.d.ts","sourceRoot":"","sources":["../../../src/typeORM.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,WAAW,EACZ,MAAM,SAAS,CAAA;AAGhB,UAAU,4BAA4B;IACpC,UAAU,EAAE,CAAC,OAAO,SAAS,cAAc,GAAG,KAAK,EACjD,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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NitroSQLiteQueryResult } from './specs/NitroSQLiteQueryResult.nitro';
|
|
1
2
|
export interface NitroSQLiteConnectionOptions {
|
|
2
3
|
name: string;
|
|
3
4
|
location?: string;
|
|
@@ -23,39 +24,29 @@ export declare enum ColumnType {
|
|
|
23
24
|
ARRAY_BUFFER = 4,
|
|
24
25
|
NULL_VALUE = 5
|
|
25
26
|
}
|
|
26
|
-
export type
|
|
27
|
-
|
|
27
|
+
export type SQLiteValue = boolean | number | string | ArrayBuffer | null;
|
|
28
|
+
export type SQLiteQueryParams = SQLiteValue[];
|
|
29
|
+
export type QueryResultRow = Record<string, SQLiteValue>;
|
|
30
|
+
export type QueryResult<Row extends QueryResultRow = QueryResultRow> = NitroSQLiteQueryResult & {
|
|
31
|
+
/** Query results in a row format for TypeORM compatibility */
|
|
32
|
+
rows: NitroSQLiteQueryResultRows<Row>;
|
|
28
33
|
};
|
|
29
|
-
export type
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
readonly rowsAffected: number;
|
|
42
|
-
readonly rows?: {
|
|
43
|
-
/** Raw array with all dataset */
|
|
44
|
-
_array: Row[];
|
|
45
|
-
/** The lengh of the dataset */
|
|
46
|
-
length: number;
|
|
47
|
-
/** A convenience function to acess the index based the row object
|
|
48
|
-
* @param idx the row index
|
|
49
|
-
* @returns the row structure identified by column names
|
|
50
|
-
*/
|
|
51
|
-
item: (idx: number) => Row | undefined;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export type ExecuteQuery = <Row extends QueryResultRow = QueryResultRow>(query: string, params?: SQLiteQueryParams) => QueryResult<Row>;
|
|
34
|
+
export type NitroSQLiteQueryResultRows<Row extends Record<string, SQLiteValue> = Record<string, SQLiteValue>> = {
|
|
35
|
+
/** Raw array with all dataset */
|
|
36
|
+
_array: Row[];
|
|
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) => Row | undefined;
|
|
44
|
+
};
|
|
45
|
+
export type ExecuteQuery = <Row extends QueryResultRow = QueryResultRow>(query: string, params?: SQLiteValue[]) => QueryResult<Row>;
|
|
55
46
|
export type ExecuteAsyncQuery = <Row extends QueryResultRow = QueryResultRow>(query: string, params?: SQLiteQueryParams) => Promise<QueryResult<Row>>;
|
|
56
47
|
export interface Transaction {
|
|
57
|
-
commit():
|
|
58
|
-
rollback():
|
|
48
|
+
commit(): NitroSQLiteQueryResult;
|
|
49
|
+
rollback(): NitroSQLiteQueryResult;
|
|
59
50
|
execute: ExecuteQuery;
|
|
60
51
|
executeAsync: ExecuteAsyncQuery;
|
|
61
52
|
}
|
|
@@ -69,13 +60,6 @@ export interface BatchQueryCommand {
|
|
|
69
60
|
query: string;
|
|
70
61
|
params?: SQLiteQueryParams | SQLiteQueryParams[];
|
|
71
62
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Used internally to transform the batch query commands into a native format without nullish values
|
|
74
|
-
*/
|
|
75
|
-
export interface NativeBatchQueryCommand {
|
|
76
|
-
query: string;
|
|
77
|
-
params?: NativeSQLiteQueryParams | NativeSQLiteQueryParams[];
|
|
78
|
-
}
|
|
79
63
|
/**
|
|
80
64
|
* status: 0 or undefined for correct execution, 1 for error
|
|
81
65
|
* message: if status === 1, here you will find error description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,IAAI,IAAI,CAAA;IACb,MAAM,IAAI,IAAI,CAAA;IACd,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,EAAE,CAAC,MAAM,GAAG,IAAI,EACzB,mBAAmB,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,KACtD,OAAO,CAAC,MAAM,CAAC,CAAA;IACpB,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,iBAAiB,CAAA;IAC/B,YAAY,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAA;IAC7D,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC3E,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAA;IAC1C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;CACzD;AAED,oBAAY,UAAU;IACpB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,YAAY,IAAA;IACZ,UAAU,IAAA;CACX;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -25,7 +25,6 @@ export declare const NitroSQLite: {
|
|
|
25
25
|
dispose(): void;
|
|
26
26
|
};
|
|
27
27
|
export { open } from './operations/session';
|
|
28
|
-
export { isNitroSQLiteNull, NITRO_SQLITE_NULL, isSimpleNullHandlingEnabled, enableSimpleNullHandling, } from './nullHandling';
|
|
29
28
|
export { default as NitroSQLiteError } from './NitroSQLiteError';
|
|
30
29
|
export type * from './types';
|
|
31
30
|
export { typeORMDriver } from './typeORM';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAI3E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;CAYvB,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAI3E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;CAYvB,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAChE,mBAAmB,SAAS,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QueryResult,
|
|
1
|
+
import type { QueryResult, QueryResultRow, SQLiteQueryParams } from '../types';
|
|
2
2
|
export declare function execute<Row extends QueryResultRow = never>(dbName: string, query: string, params?: SQLiteQueryParams): QueryResult<Row>;
|
|
3
3
|
export declare function executeAsync<Row extends QueryResultRow = never>(dbName: string, query: string, params?: SQLiteQueryParams): Promise<QueryResult<Row>>;
|
|
4
4
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/operations/execute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/operations/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAI9E,wBAAgB,OAAO,CAAC,GAAG,SAAS,cAAc,GAAG,KAAK,EACxD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,WAAW,CAAC,GAAG,CAAC,CAOlB;AAED,wBAAsB,YAAY,CAAC,GAAG,SAAS,cAAc,GAAG,KAAK,EACnE,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAW3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BatchQueryCommand, BatchQueryResult } from '../types';
|
|
2
2
|
export declare function executeBatch(dbName: string, commands: BatchQueryCommand[]): BatchQueryResult;
|
|
3
3
|
export declare function executeBatchAsync(dbName: string, commands: BatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
4
4
|
//# sourceMappingURL=executeBatch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeBatch.d.ts","sourceRoot":"","sources":["../../../../src/operations/executeBatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executeBatch.d.ts","sourceRoot":"","sources":["../../../../src/operations/executeBatch.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEnE,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,gBAAgB,CAUlB;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAU3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/operations/transaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/operations/transaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAIZ,MAAM,UAAU,CAAA;AAIjB,eAAO,MAAM,WAAW,GAAU,MAAM,GAAG,IAAI,EAC7C,QAAQ,MAAM,EACd,qBAAqB,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,EACzD,qBAAmB,oBA+EpB,CAAA"}
|