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.
Files changed (118) hide show
  1. package/android/CMakeLists.txt +1 -1
  2. package/cpp/NitroSQLiteException.hpp +1 -2
  3. package/cpp/{specs → hybridObjects}/HybridNitroSQLite.cpp +64 -16
  4. package/cpp/{specs → hybridObjects}/HybridNitroSQLite.hpp +6 -6
  5. package/cpp/hybridObjects/HybridNitroSQLiteQueryResult.cpp +93 -0
  6. package/cpp/hybridObjects/HybridNitroSQLiteQueryResult.hpp +47 -0
  7. package/cpp/operations.cpp +16 -12
  8. package/cpp/operations.hpp +3 -1
  9. package/cpp/sqliteExecuteBatch.cpp +2 -2
  10. package/cpp/sqliteExecuteBatch.hpp +2 -2
  11. package/cpp/types.hpp +4 -14
  12. package/ios/NitroSQLite.xcodeproj/project.pbxproj +2 -2
  13. package/lib/commonjs/index.js +0 -25
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/operations/execute.js +19 -32
  16. package/lib/commonjs/operations/execute.js.map +1 -1
  17. package/lib/commonjs/operations/executeBatch.js +2 -19
  18. package/lib/commonjs/operations/executeBatch.js.map +1 -1
  19. package/lib/commonjs/specs/{NativeQueryResult.nitro.js → NitroSQLiteQueryResult.nitro.js} +1 -1
  20. package/lib/commonjs/specs/NitroSQLiteQueryResult.nitro.js.map +1 -0
  21. package/lib/commonjs/types.js +1 -8
  22. package/lib/commonjs/types.js.map +1 -1
  23. package/lib/module/index.js +0 -1
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/operations/execute.js +19 -33
  26. package/lib/module/operations/execute.js.map +1 -1
  27. package/lib/module/operations/executeBatch.js +2 -19
  28. package/lib/module/operations/executeBatch.js.map +1 -1
  29. package/lib/module/specs/NitroSQLiteQueryResult.nitro.js +4 -0
  30. package/lib/module/specs/NitroSQLiteQueryResult.nitro.js.map +1 -0
  31. package/lib/module/types.js +0 -12
  32. package/lib/module/types.js.map +1 -1
  33. package/lib/typescript/commonjs/index.d.ts +0 -1
  34. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/operations/execute.d.ts +1 -1
  36. package/lib/typescript/commonjs/operations/execute.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/operations/executeBatch.d.ts +1 -1
  38. package/lib/typescript/commonjs/operations/executeBatch.d.ts.map +1 -1
  39. package/lib/typescript/commonjs/operations/transaction.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts +6 -6
  41. package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts.map +1 -1
  42. package/lib/typescript/{module/specs/NativeQueryResult.nitro.d.ts → commonjs/specs/NitroSQLiteQueryResult.nitro.d.ts} +7 -13
  43. package/lib/typescript/commonjs/specs/NitroSQLiteQueryResult.nitro.d.ts.map +1 -0
  44. package/lib/typescript/commonjs/typeORM.d.ts +1 -1
  45. package/lib/typescript/commonjs/typeORM.d.ts.map +1 -1
  46. package/lib/typescript/commonjs/types.d.ts +21 -37
  47. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  48. package/lib/typescript/module/index.d.ts +0 -1
  49. package/lib/typescript/module/index.d.ts.map +1 -1
  50. package/lib/typescript/module/operations/execute.d.ts +1 -1
  51. package/lib/typescript/module/operations/execute.d.ts.map +1 -1
  52. package/lib/typescript/module/operations/executeBatch.d.ts +1 -1
  53. package/lib/typescript/module/operations/executeBatch.d.ts.map +1 -1
  54. package/lib/typescript/module/operations/transaction.d.ts.map +1 -1
  55. package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts +6 -6
  56. package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts.map +1 -1
  57. package/lib/typescript/{commonjs/specs/NativeQueryResult.nitro.d.ts → module/specs/NitroSQLiteQueryResult.nitro.d.ts} +7 -13
  58. package/lib/typescript/module/specs/NitroSQLiteQueryResult.nitro.d.ts.map +1 -0
  59. package/lib/typescript/module/typeORM.d.ts +1 -1
  60. package/lib/typescript/module/typeORM.d.ts.map +1 -1
  61. package/lib/typescript/module/types.d.ts +21 -37
  62. package/lib/typescript/module/types.d.ts.map +1 -1
  63. package/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake +9 -6
  64. package/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle +1 -1
  65. package/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp +2 -4
  66. package/nitrogen/generated/android/RNNitroSQLiteOnLoad.hpp +1 -1
  67. package/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp +14 -1
  68. package/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.hpp +4 -1
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec.kt +8 -3
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt +1 -1
  71. package/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb +2 -2
  72. package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp +1 -1
  73. package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp +1 -1
  74. package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Umbrella.hpp +1 -1
  75. package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm +1 -1
  76. package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.swift +5 -1
  77. package/nitrogen/generated/shared/c++/BatchQueryCommand.hpp +92 -0
  78. package/nitrogen/generated/shared/c++/BatchQueryResult.hpp +25 -11
  79. package/nitrogen/generated/shared/c++/ColumnType.hpp +5 -7
  80. package/nitrogen/generated/shared/c++/FileLoadResult.hpp +28 -14
  81. package/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.cpp +1 -1
  82. package/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.hpp +1 -1
  83. package/nitrogen/generated/shared/c++/HybridNitroSQLiteQueryResultSpec.cpp +24 -0
  84. package/nitrogen/generated/shared/c++/HybridNitroSQLiteQueryResultSpec.hpp +73 -0
  85. package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp +1 -1
  86. package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp +12 -16
  87. package/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.hpp +93 -0
  88. package/package.json +5 -5
  89. package/src/index.ts +0 -6
  90. package/src/operations/execute.ts +23 -58
  91. package/src/operations/executeBatch.ts +3 -41
  92. package/src/operations/session.ts +1 -1
  93. package/src/operations/transaction.ts +1 -1
  94. package/src/specs/NitroSQLite.nitro.ts +9 -12
  95. package/src/specs/{NativeQueryResult.nitro.ts → NitroSQLiteQueryResult.nitro.ts} +15 -17
  96. package/src/typeORM.ts +1 -1
  97. package/src/types.ts +28 -45
  98. package/cpp/specs/HybridNativeQueryResult.cpp +0 -21
  99. package/cpp/specs/HybridNativeQueryResult.hpp +0 -27
  100. package/lib/commonjs/nullHandling.js +0 -33
  101. package/lib/commonjs/nullHandling.js.map +0 -1
  102. package/lib/commonjs/specs/NativeQueryResult.nitro.js.map +0 -1
  103. package/lib/module/nullHandling.js +0 -25
  104. package/lib/module/nullHandling.js.map +0 -1
  105. package/lib/module/specs/NativeQueryResult.nitro.js +0 -4
  106. package/lib/module/specs/NativeQueryResult.nitro.js.map +0 -1
  107. package/lib/typescript/commonjs/nullHandling.d.ts +0 -8
  108. package/lib/typescript/commonjs/nullHandling.d.ts.map +0 -1
  109. package/lib/typescript/commonjs/specs/NativeQueryResult.nitro.d.ts.map +0 -1
  110. package/lib/typescript/module/nullHandling.d.ts +0 -8
  111. package/lib/typescript/module/nullHandling.d.ts.map +0 -1
  112. package/lib/typescript/module/specs/NativeQueryResult.nitro.d.ts.map +0 -1
  113. package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.cpp +0 -24
  114. package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.hpp +0 -77
  115. package/nitrogen/generated/shared/c++/NativeBatchQueryCommand.hpp +0 -81
  116. package/nitrogen/generated/shared/c++/SQLiteNullValue.hpp +0 -69
  117. package/nitrogen/generated/shared/c++/SQLiteQueryColumnMetadata.hpp +0 -79
  118. package/src/nullHandling.ts +0 -35
@@ -1,11 +1,11 @@
1
1
  import type { HybridObject } from 'react-native-nitro-modules'
2
2
  import type {
3
+ BatchQueryCommand,
3
4
  BatchQueryResult,
4
5
  FileLoadResult,
5
- NativeSQLiteQueryParams,
6
- NativeBatchQueryCommand,
6
+ SQLiteQueryParams,
7
7
  } from '../types'
8
- import type { NativeQueryResult } from './NativeQueryResult.nitro'
8
+ import type { NitroSQLiteQueryResult } from './NitroSQLiteQueryResult.nitro'
9
9
 
10
10
  export interface NitroSQLite
11
11
  extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
@@ -22,20 +22,17 @@ export interface NitroSQLite
22
22
  execute(
23
23
  dbName: string,
24
24
  query: string,
25
- params?: NativeSQLiteQueryParams,
26
- ): NativeQueryResult
25
+ params?: SQLiteQueryParams,
26
+ ): NitroSQLiteQueryResult
27
27
  executeAsync(
28
28
  dbName: string,
29
29
  query: string,
30
- params?: NativeSQLiteQueryParams,
31
- ): Promise<NativeQueryResult>
32
- executeBatch(
33
- dbName: string,
34
- commands: NativeBatchQueryCommand[],
35
- ): BatchQueryResult
30
+ params?: SQLiteQueryParams,
31
+ ): Promise<NitroSQLiteQueryResult>
32
+ executeBatch(dbName: string, commands: BatchQueryCommand[]): BatchQueryResult
36
33
  executeBatchAsync(
37
34
  dbName: string,
38
- commands: NativeBatchQueryCommand[],
35
+ commands: BatchQueryCommand[],
39
36
  ): Promise<BatchQueryResult>
40
37
  loadFile(dbName: string, location: string): FileLoadResult
41
38
  loadFileAsync(dbName: string, location: string): Promise<FileLoadResult>
@@ -9,36 +9,34 @@ import type { ColumnType, SQLiteValue } from '../types'
9
9
  * rows: if status is undefined or 0 this object will contain the query results
10
10
  * }
11
11
  *
12
- * @interface NativeQueryResult
12
+ * @interface QueryResult
13
13
  */
14
- export interface NativeQueryResult
14
+ export interface NitroSQLiteQueryResult
15
15
  extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
16
16
  readonly rowsAffected: number
17
17
  readonly insertId?: number
18
18
 
19
19
  /** Query results */
20
- readonly results: NativeSQLiteQueryResults
20
+ readonly results: Record<string, SQLiteValue>[]
21
+
21
22
  /** Table metadata */
22
- readonly metadata?: Record<string, SQLiteQueryColumnMetadata>
23
+ readonly metadata?: Record<string, NitroSQLiteQueryColumnMetadata>
23
24
  }
24
25
 
25
- /**
26
- * Table metadata
27
- * Describes some information about the table and it's columns fetched by the query
28
- * The index is the name of the column
29
- */
30
- // TODO: Investigate why this doesn't work with nitrogen
31
- // export type SQLiteQueryResultRow = Record<string, SQLiteValue>
32
- // export type SQLiteQueryResults = SQLiteQueryResultRow[]
33
- export type NativeSQLiteQueryResults = Record<string, SQLiteValue>[]
34
-
35
- // TODO: Investigate why this doesn't work with nitrogen
36
- // export type SQLiteQueryTableMetadata = Record<string, SQLiteQueryColumnMetadata>
37
- export interface SQLiteQueryColumnMetadata {
26
+ // TODO: Investigate why this cannot be represented in Nitro
27
+ // export type NitroQueryResultRow = {
28
+ // [key: string]: SQLiteValue
29
+ // }
30
+
31
+ // type NitroQueryResultRow = Record<string, SQLiteValue>
32
+
33
+ export type NitroSQLiteQueryColumnMetadata = {
38
34
  /** The name used for this column for this result set */
39
35
  name: string
36
+
40
37
  /** 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. */
41
38
  type: ColumnType
39
+
42
40
  /** The index for this column for this result set */
43
41
  index: number
44
42
  }
package/src/typeORM.ts CHANGED
@@ -6,10 +6,10 @@
6
6
  // |_| |_| |_| |______\____/|_| \_\_| |_| /_/ \_\_| |_____|
7
7
 
8
8
  import type {
9
- QueryResult,
10
9
  Transaction,
11
10
  SQLiteQueryParams,
12
11
  QueryResultRow,
12
+ QueryResult,
13
13
  } from './types'
14
14
  import * as Operations from './operations/session'
15
15
 
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { NitroSQLiteQueryResult } from './specs/NitroSQLiteQueryResult.nitro'
2
+
1
3
  export interface NitroSQLiteConnectionOptions {
2
4
  name: string
3
5
  location?: string
@@ -28,48 +30,37 @@ export enum ColumnType {
28
30
  NULL_VALUE,
29
31
  }
30
32
 
31
- // Passing null/undefined in array types is not possible, so we us a special struct as a workaround.
32
- export type SQLiteNullValue = {
33
- isNitroSQLiteNull: true
34
- }
35
- export type SQLiteValue =
36
- | boolean
37
- | number
38
- | string
39
- | ArrayBuffer
40
- | SQLiteNullValue
33
+ export type SQLiteValue = boolean | number | string | ArrayBuffer | null
41
34
 
42
- /** Used internally to transform the query params into a native format without nullish values */
43
- export type NativeSQLiteQueryParams = SQLiteValue[]
35
+ export type SQLiteQueryParams = SQLiteValue[]
44
36
 
45
- /**
46
- * Represents a value that can be stored in a SQLite database
47
- */
48
- export type SQLiteQueryParamItem = SQLiteValue | null | undefined
49
- export type SQLiteQueryParams = SQLiteQueryParamItem[]
50
-
51
- export type QueryResultRowItem = SQLiteValue | undefined
52
- export type QueryResultRow = Record<string, QueryResultRowItem>
53
- export interface QueryResult<Row extends QueryResultRow = QueryResultRow> {
54
- readonly insertId?: number
55
- readonly rowsAffected: number
56
-
57
- readonly rows?: {
58
- /** Raw array with all dataset */
59
- _array: Row[]
60
- /** The lengh of the dataset */
61
- length: number
62
- /** A convenience function to acess the index based the row object
63
- * @param idx the row index
64
- * @returns the row structure identified by column names
65
- */
66
- item: (idx: number) => Row | undefined
37
+ export type QueryResultRow = Record<string, SQLiteValue>
38
+
39
+ export type QueryResult<Row extends QueryResultRow = QueryResultRow> =
40
+ NitroSQLiteQueryResult & {
41
+ /** Query results in a row format for TypeORM compatibility */
42
+ rows: NitroSQLiteQueryResultRows<Row>
67
43
  }
44
+
45
+ export type NitroSQLiteQueryResultRows<
46
+ Row extends Record<string, SQLiteValue> = Record<string, SQLiteValue>,
47
+ > = {
48
+ /** Raw array with all dataset */
49
+ _array: Row[]
50
+
51
+ /** The lengh of the dataset */
52
+ length: number
53
+
54
+ /** A convenience function to acess the index based the row object
55
+ * @param idx the row index
56
+ * @returns the row structure identified by column names
57
+ */
58
+ item: (idx: number) => Row | undefined
68
59
  }
69
60
 
70
61
  export type ExecuteQuery = <Row extends QueryResultRow = QueryResultRow>(
71
62
  query: string,
72
- params?: SQLiteQueryParams,
63
+ params?: SQLiteValue[],
73
64
  ) => QueryResult<Row>
74
65
 
75
66
  export type ExecuteAsyncQuery = <Row extends QueryResultRow = QueryResultRow>(
@@ -78,8 +69,8 @@ export type ExecuteAsyncQuery = <Row extends QueryResultRow = QueryResultRow>(
78
69
  ) => Promise<QueryResult<Row>>
79
70
 
80
71
  export interface Transaction {
81
- commit(): QueryResult
82
- rollback(): QueryResult
72
+ commit(): NitroSQLiteQueryResult
73
+ rollback(): NitroSQLiteQueryResult
83
74
  execute: ExecuteQuery
84
75
  executeAsync: ExecuteAsyncQuery
85
76
  }
@@ -95,14 +86,6 @@ export interface BatchQueryCommand {
95
86
  params?: SQLiteQueryParams | SQLiteQueryParams[]
96
87
  }
97
88
 
98
- /**
99
- * Used internally to transform the batch query commands into a native format without nullish values
100
- */
101
- export interface NativeBatchQueryCommand {
102
- query: string
103
- params?: NativeSQLiteQueryParams | NativeSQLiteQueryParams[]
104
- }
105
-
106
89
  /**
107
90
  * status: 0 or undefined for correct execution, 1 for error
108
91
  * message: if status === 1, here you will find error description
@@ -1,21 +0,0 @@
1
- #include "HybridNativeQueryResult.hpp"
2
-
3
- namespace margelo::nitro::rnnitrosqlite {
4
-
5
- std::optional<double> HybridNativeQueryResult::getInsertId() {
6
- return _result.insertId;
7
- }
8
-
9
- double HybridNativeQueryResult::getRowsAffected() {
10
- return _result.rowsAffected;
11
- }
12
-
13
- SQLiteQueryResults HybridNativeQueryResult::getResults() {
14
- return _result.results;
15
- };
16
-
17
- std::optional<SQLiteQueryTableMetadata> HybridNativeQueryResult::getMetadata() {
18
- return _result.metadata;
19
- }
20
-
21
- } // namespace margelo::nitro::rnnitrosqlite
@@ -1,27 +0,0 @@
1
- #pragma once
2
-
3
- #include "HybridNativeQueryResultSpec.hpp"
4
- #include "types.hpp"
5
- #include <map>
6
-
7
- using namespace margelo::rnnitrosqlite;
8
-
9
- namespace margelo::nitro::rnnitrosqlite {
10
-
11
- class HybridNativeQueryResult : public HybridNativeQueryResultSpec {
12
- public:
13
- HybridNativeQueryResult() : HybridObject(TAG) {}
14
- HybridNativeQueryResult(SQLiteExecuteQueryResult&& result) : HybridObject(TAG), _result(std::move(result)) {}
15
-
16
- private:
17
- SQLiteExecuteQueryResult _result;
18
-
19
- public:
20
- // Properties
21
- std::optional<double> getInsertId() override;
22
- double getRowsAffected() override;
23
- SQLiteQueryResults getResults() override;
24
- std::optional<SQLiteQueryTableMetadata> getMetadata() override;
25
- };
26
-
27
- } // namespace margelo::nitro::rnnitrosqlite
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.NITRO_SQLITE_NULL = void 0;
7
- exports.enableSimpleNullHandling = enableSimpleNullHandling;
8
- exports.isNitroSQLiteNull = isNitroSQLiteNull;
9
- exports.isSimpleNullHandlingEnabled = isSimpleNullHandlingEnabled;
10
- exports.replaceWithNativeNullValue = replaceWithNativeNullValue;
11
- let ENABLE_SIMPLE_NULL_HANDLING = false;
12
- function enableSimpleNullHandling(shouldEnableSimpleNullHandling = true) {
13
- ENABLE_SIMPLE_NULL_HANDLING = shouldEnableSimpleNullHandling;
14
- }
15
- function isSimpleNullHandlingEnabled() {
16
- return ENABLE_SIMPLE_NULL_HANDLING;
17
- }
18
- const NITRO_SQLITE_NULL = exports.NITRO_SQLITE_NULL = {
19
- isNitroSQLiteNull: true
20
- };
21
- function isNitroSQLiteNull(value) {
22
- if (value !== null && typeof value === 'object' && 'isNitroSQLiteNull' in value) {
23
- return true;
24
- }
25
- return false;
26
- }
27
- function replaceWithNativeNullValue(value) {
28
- if (value === undefined || value === null) {
29
- return NITRO_SQLITE_NULL;
30
- }
31
- return value;
32
- }
33
- //# sourceMappingURL=nullHandling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ENABLE_SIMPLE_NULL_HANDLING","enableSimpleNullHandling","shouldEnableSimpleNullHandling","isSimpleNullHandlingEnabled","NITRO_SQLITE_NULL","exports","isNitroSQLiteNull","value","replaceWithNativeNullValue","undefined"],"sourceRoot":"../../src","sources":["nullHandling.ts"],"mappings":";;;;;;;;;;AAGA,IAAIA,2BAA2B,GAAG,KAAK;AAEhC,SAASC,wBAAwBA,CACtCC,8BAA8B,GAAG,IAAI,EACrC;EACAF,2BAA2B,GAAGE,8BAA8B;AAC9D;AAEO,SAASC,2BAA2BA,CAAA,EAAG;EAC5C,OAAOH,2BAA2B;AACpC;AAEO,MAAMI,iBAAkC,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAAEE,iBAAiB,EAAE;AAAK,CAAC;AACtE,SAASA,iBAAiBA,CAACC,KAAc,EAA4B;EAC1E,IACEA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACzB,mBAAmB,IAAIA,KAAK,EAC5B;IACA,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd;AAEO,SAASC,0BAA0BA,CACxCD,KAA2B,EACd;EACb,IAAIA,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACzC,OAAOH,iBAAiB;EAC1B;EACA,OAAOG,KAAK;AACd","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/NativeQueryResult.nitro.ts"],"mappings":"","ignoreList":[]}
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- let ENABLE_SIMPLE_NULL_HANDLING = false;
4
- export function enableSimpleNullHandling(shouldEnableSimpleNullHandling = true) {
5
- ENABLE_SIMPLE_NULL_HANDLING = shouldEnableSimpleNullHandling;
6
- }
7
- export function isSimpleNullHandlingEnabled() {
8
- return ENABLE_SIMPLE_NULL_HANDLING;
9
- }
10
- export const NITRO_SQLITE_NULL = {
11
- isNitroSQLiteNull: true
12
- };
13
- export function isNitroSQLiteNull(value) {
14
- if (value !== null && typeof value === 'object' && 'isNitroSQLiteNull' in value) {
15
- return true;
16
- }
17
- return false;
18
- }
19
- export function replaceWithNativeNullValue(value) {
20
- if (value === undefined || value === null) {
21
- return NITRO_SQLITE_NULL;
22
- }
23
- return value;
24
- }
25
- //# sourceMappingURL=nullHandling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ENABLE_SIMPLE_NULL_HANDLING","enableSimpleNullHandling","shouldEnableSimpleNullHandling","isSimpleNullHandlingEnabled","NITRO_SQLITE_NULL","isNitroSQLiteNull","value","replaceWithNativeNullValue","undefined"],"sourceRoot":"../../src","sources":["nullHandling.ts"],"mappings":";;AAGA,IAAIA,2BAA2B,GAAG,KAAK;AAEvC,OAAO,SAASC,wBAAwBA,CACtCC,8BAA8B,GAAG,IAAI,EACrC;EACAF,2BAA2B,GAAGE,8BAA8B;AAC9D;AAEA,OAAO,SAASC,2BAA2BA,CAAA,EAAG;EAC5C,OAAOH,2BAA2B;AACpC;AAEA,OAAO,MAAMI,iBAAkC,GAAG;EAAEC,iBAAiB,EAAE;AAAK,CAAC;AAC7E,OAAO,SAASA,iBAAiBA,CAACC,KAAc,EAA4B;EAC1E,IACEA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACzB,mBAAmB,IAAIA,KAAK,EAC5B;IACA,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd;AAEA,OAAO,SAASC,0BAA0BA,CACxCD,KAA2B,EACd;EACb,IAAIA,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACzC,OAAOF,iBAAiB;EAC1B;EACA,OAAOE,KAAK;AACd","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export {};
4
- //# sourceMappingURL=NativeQueryResult.nitro.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/NativeQueryResult.nitro.ts"],"mappings":"","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { SQLiteNullValue, SQLiteValue } from './types';
2
- import { SQLiteQueryParamItem } from './types';
3
- export declare function enableSimpleNullHandling(shouldEnableSimpleNullHandling?: boolean): void;
4
- export declare function isSimpleNullHandlingEnabled(): boolean;
5
- export declare const NITRO_SQLITE_NULL: SQLiteNullValue;
6
- export declare function isNitroSQLiteNull(value: unknown): value is SQLiteNullValue;
7
- export declare function replaceWithNativeNullValue(value: SQLiteQueryParamItem): SQLiteValue;
8
- //# sourceMappingURL=nullHandling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nullHandling.d.ts","sourceRoot":"","sources":["../../../src/nullHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAgB,wBAAwB,CACtC,8BAA8B,UAAO,QAGtC;AAED,wBAAgB,2BAA2B,YAE1C;AAED,eAAO,MAAM,iBAAiB,EAAE,eAA6C,CAAA;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAS1E;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,GAC1B,WAAW,CAKb"}
@@ -1 +0,0 @@
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,wBAAwB,CAAA;IAC1C,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAA;CAC9D;AAED;;;;GAIG;AAIH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAA;AAIpE,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"}
@@ -1,8 +0,0 @@
1
- import { SQLiteNullValue, SQLiteValue } from './types';
2
- import { SQLiteQueryParamItem } from './types';
3
- export declare function enableSimpleNullHandling(shouldEnableSimpleNullHandling?: boolean): void;
4
- export declare function isSimpleNullHandlingEnabled(): boolean;
5
- export declare const NITRO_SQLITE_NULL: SQLiteNullValue;
6
- export declare function isNitroSQLiteNull(value: unknown): value is SQLiteNullValue;
7
- export declare function replaceWithNativeNullValue(value: SQLiteQueryParamItem): SQLiteValue;
8
- //# sourceMappingURL=nullHandling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nullHandling.d.ts","sourceRoot":"","sources":["../../../src/nullHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAgB,wBAAwB,CACtC,8BAA8B,UAAO,QAGtC;AAED,wBAAgB,2BAA2B,YAE1C;AAED,eAAO,MAAM,iBAAiB,EAAE,eAA6C,CAAA;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAS1E;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,GAC1B,WAAW,CAKb"}
@@ -1 +0,0 @@
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,wBAAwB,CAAA;IAC1C,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAA;CAC9D;AAED;;;;GAIG;AAIH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAA;AAIpE,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"}
@@ -1,24 +0,0 @@
1
- ///
2
- /// HybridNativeQueryResultSpec.cpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #include "HybridNativeQueryResultSpec.hpp"
9
-
10
- namespace margelo::nitro::rnnitrosqlite {
11
-
12
- void HybridNativeQueryResultSpec::loadHybridMethods() {
13
- // load base methods/properties
14
- HybridObject::loadHybridMethods();
15
- // load custom methods/properties
16
- registerHybrids(this, [](Prototype& prototype) {
17
- prototype.registerHybridGetter("rowsAffected", &HybridNativeQueryResultSpec::getRowsAffected);
18
- prototype.registerHybridGetter("insertId", &HybridNativeQueryResultSpec::getInsertId);
19
- prototype.registerHybridGetter("results", &HybridNativeQueryResultSpec::getResults);
20
- prototype.registerHybridGetter("metadata", &HybridNativeQueryResultSpec::getMetadata);
21
- });
22
- }
23
-
24
- } // namespace margelo::nitro::rnnitrosqlite
@@ -1,77 +0,0 @@
1
- ///
2
- /// HybridNativeQueryResultSpec.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #if __has_include(<NitroModules/HybridObject.hpp>)
11
- #include <NitroModules/HybridObject.hpp>
12
- #else
13
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
- #endif
15
-
16
- // Forward declaration of `ArrayBuffer` to properly resolve imports.
17
- namespace NitroModules { class ArrayBuffer; }
18
- // Forward declaration of `SQLiteNullValue` to properly resolve imports.
19
- namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
20
- // Forward declaration of `SQLiteQueryColumnMetadata` to properly resolve imports.
21
- namespace margelo::nitro::rnnitrosqlite { struct SQLiteQueryColumnMetadata; }
22
-
23
- #include <optional>
24
- #include <string>
25
- #include <NitroModules/ArrayBuffer.hpp>
26
- #include "SQLiteNullValue.hpp"
27
- #include <variant>
28
- #include <unordered_map>
29
- #include <vector>
30
- #include "SQLiteQueryColumnMetadata.hpp"
31
-
32
- namespace margelo::nitro::rnnitrosqlite {
33
-
34
- using namespace margelo::nitro;
35
-
36
- /**
37
- * An abstract base class for `NativeQueryResult`
38
- * Inherit this class to create instances of `HybridNativeQueryResultSpec` in C++.
39
- * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
40
- * @example
41
- * ```cpp
42
- * class HybridNativeQueryResult: public HybridNativeQueryResultSpec {
43
- * public:
44
- * HybridNativeQueryResult(...): HybridObject(TAG) { ... }
45
- * // ...
46
- * };
47
- * ```
48
- */
49
- class HybridNativeQueryResultSpec: public virtual HybridObject {
50
- public:
51
- // Constructor
52
- explicit HybridNativeQueryResultSpec(): HybridObject(TAG) { }
53
-
54
- // Destructor
55
- ~HybridNativeQueryResultSpec() override = default;
56
-
57
- public:
58
- // Properties
59
- virtual double getRowsAffected() = 0;
60
- virtual std::optional<double> getInsertId() = 0;
61
- virtual std::vector<std::unordered_map<std::string, std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>> getResults() = 0;
62
- virtual std::optional<std::unordered_map<std::string, SQLiteQueryColumnMetadata>> getMetadata() = 0;
63
-
64
- public:
65
- // Methods
66
-
67
-
68
- protected:
69
- // Hybrid Setup
70
- void loadHybridMethods() override;
71
-
72
- protected:
73
- // Tag for logging
74
- static constexpr auto TAG = "NativeQueryResult";
75
- };
76
-
77
- } // namespace margelo::nitro::rnnitrosqlite
@@ -1,81 +0,0 @@
1
- ///
2
- /// NativeBatchQueryCommand.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #if __has_include(<NitroModules/JSIConverter.hpp>)
11
- #include <NitroModules/JSIConverter.hpp>
12
- #else
13
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
- #endif
15
- #if __has_include(<NitroModules/NitroDefines.hpp>)
16
- #include <NitroModules/NitroDefines.hpp>
17
- #else
18
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
- #endif
20
-
21
- // Forward declaration of `ArrayBuffer` to properly resolve imports.
22
- namespace NitroModules { class ArrayBuffer; }
23
- // Forward declaration of `SQLiteNullValue` to properly resolve imports.
24
- namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
25
-
26
- #include <string>
27
- #include <NitroModules/ArrayBuffer.hpp>
28
- #include "SQLiteNullValue.hpp"
29
- #include <variant>
30
- #include <vector>
31
- #include <optional>
32
-
33
- namespace margelo::nitro::rnnitrosqlite {
34
-
35
- /**
36
- * A struct which can be represented as a JavaScript object (NativeBatchQueryCommand).
37
- */
38
- struct NativeBatchQueryCommand {
39
- public:
40
- std::string query SWIFT_PRIVATE;
41
- std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>> params SWIFT_PRIVATE;
42
-
43
- public:
44
- NativeBatchQueryCommand() = default;
45
- explicit NativeBatchQueryCommand(std::string query, std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>> params): query(query), params(params) {}
46
- };
47
-
48
- } // namespace margelo::nitro::rnnitrosqlite
49
-
50
- namespace margelo::nitro {
51
-
52
- using namespace margelo::nitro::rnnitrosqlite;
53
-
54
- // C++ NativeBatchQueryCommand <> JS NativeBatchQueryCommand (object)
55
- template <>
56
- struct JSIConverter<NativeBatchQueryCommand> final {
57
- static inline NativeBatchQueryCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
58
- jsi::Object obj = arg.asObject(runtime);
59
- return NativeBatchQueryCommand(
60
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "query")),
61
- JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>>>::fromJSI(runtime, obj.getProperty(runtime, "params"))
62
- );
63
- }
64
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const NativeBatchQueryCommand& arg) {
65
- jsi::Object obj(runtime);
66
- obj.setProperty(runtime, "query", JSIConverter<std::string>::toJSI(runtime, arg.query));
67
- obj.setProperty(runtime, "params", JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>>>::toJSI(runtime, arg.params));
68
- return obj;
69
- }
70
- static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
71
- if (!value.isObject()) {
72
- return false;
73
- }
74
- jsi::Object obj = value.getObject(runtime);
75
- if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "query"))) return false;
76
- if (!JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>>>::canConvert(runtime, obj.getProperty(runtime, "params"))) return false;
77
- return true;
78
- }
79
- };
80
-
81
- } // namespace margelo::nitro
@@ -1,69 +0,0 @@
1
- ///
2
- /// SQLiteNullValue.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #if __has_include(<NitroModules/JSIConverter.hpp>)
11
- #include <NitroModules/JSIConverter.hpp>
12
- #else
13
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
- #endif
15
- #if __has_include(<NitroModules/NitroDefines.hpp>)
16
- #include <NitroModules/NitroDefines.hpp>
17
- #else
18
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
- #endif
20
-
21
-
22
-
23
-
24
-
25
- namespace margelo::nitro::rnnitrosqlite {
26
-
27
- /**
28
- * A struct which can be represented as a JavaScript object (SQLiteNullValue).
29
- */
30
- struct SQLiteNullValue {
31
- public:
32
- bool isNitroSQLiteNull SWIFT_PRIVATE;
33
-
34
- public:
35
- SQLiteNullValue() = default;
36
- explicit SQLiteNullValue(bool isNitroSQLiteNull): isNitroSQLiteNull(isNitroSQLiteNull) {}
37
- };
38
-
39
- } // namespace margelo::nitro::rnnitrosqlite
40
-
41
- namespace margelo::nitro {
42
-
43
- using namespace margelo::nitro::rnnitrosqlite;
44
-
45
- // C++ SQLiteNullValue <> JS SQLiteNullValue (object)
46
- template <>
47
- struct JSIConverter<SQLiteNullValue> final {
48
- static inline SQLiteNullValue fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
49
- jsi::Object obj = arg.asObject(runtime);
50
- return SQLiteNullValue(
51
- JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isNitroSQLiteNull"))
52
- );
53
- }
54
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const SQLiteNullValue& arg) {
55
- jsi::Object obj(runtime);
56
- obj.setProperty(runtime, "isNitroSQLiteNull", JSIConverter<bool>::toJSI(runtime, arg.isNitroSQLiteNull));
57
- return obj;
58
- }
59
- static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
60
- if (!value.isObject()) {
61
- return false;
62
- }
63
- jsi::Object obj = value.getObject(runtime);
64
- if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isNitroSQLiteNull"))) return false;
65
- return true;
66
- }
67
- };
68
-
69
- } // namespace margelo::nitro