@capawesome/capacitor-libsql 0.2.0 → 0.2.2

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/README.md CHANGED
@@ -191,7 +191,8 @@ execute(options: ExecuteOptions) => Promise<void>
191
191
 
192
192
  Execute a single SQL statement on the specified database connection.
193
193
 
194
- This method can be used to execute any SQL statement, including `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.
194
+ This method can be used to execute any SQL statement, including
195
+ `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.
195
196
 
196
197
  | Param | Type |
197
198
  | ------------- | --------------------------------------------------------- |
@@ -229,7 +230,8 @@ query(options: QueryOptions) => Promise<QueryResult>
229
230
 
230
231
  Query the database and return the result set.
231
232
 
232
- This method can be used to execute `SELECT` statements and retrieve the result set.
233
+ This method can be used to execute `SELECT` statements
234
+ and retrieve the result set.
233
235
 
234
236
  | Param | Type |
235
237
  | ------------- | ----------------------------------------------------- |
@@ -271,7 +273,7 @@ sync(options: SyncOptions) => Promise<void>
271
273
 
272
274
  Synchronize the database with the remote server.
273
275
 
274
- Only available on iOS.
276
+ Available on iOS and Android.
275
277
 
276
278
  | Param | Type |
277
279
  | ------------- | --------------------------------------------------- |
@@ -335,11 +337,11 @@ Only available on iOS.
335
337
 
336
338
  #### ExecuteBatchOptions
337
339
 
338
- | Prop | Type | Description | Since |
339
- | ------------------ | ---------------------- | ------------------------------------------------------------------- | ----- |
340
- | **`connectionId`** | <code>string</code> | The ID of the connection to execute the batch on. | 0.0.0 |
341
- | **`statement`** | <code>string[]</code> | The SQL statements to execute in the batch. | 0.0.0 |
342
- | **`values`** | <code>Value[][]</code> | The transaction ID to use for the batch. Only available on Android. | 0.0.0 |
340
+ | Prop | Type | Description | Since |
341
+ | ------------------ | ---------------------- | ------------------------------------------------- | ----- |
342
+ | **`connectionId`** | <code>string</code> | The ID of the connection to execute the batch on. | 0.0.0 |
343
+ | **`statement`** | <code>string[]</code> | The SQL statements to execute in the batch. | 0.0.0 |
344
+ | **`values`** | <code>Value[][]</code> | The values to bind to the SQL statements. | 0.0.0 |
343
345
 
344
346
 
345
347
  #### QueryResult
@@ -36,7 +36,7 @@ android {
36
36
  buildTypes {
37
37
  release {
38
38
  minifyEnabled false
39
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
39
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
40
40
  }
41
41
  }
42
42
  lintOptions {
@@ -4,6 +4,7 @@ import io.capawesome.capacitorjs.plugins.libsql.classes.options.*
4
4
  import io.capawesome.capacitorjs.plugins.libsql.classes.results.*
5
5
  import io.capawesome.capacitorjs.plugins.libsql.interfaces.*
6
6
  import tech.turso.libsql.Database
7
+ import tech.turso.libsql.EmbeddedReplicaDatabase
7
8
  import java.io.File
8
9
  import tech.turso.libsql.Connection as LibsqlConnection
9
10
  import java.util.concurrent.ConcurrentHashMap
@@ -22,7 +23,7 @@ class Libsql(private val plugin: LibsqlPlugin) {
22
23
 
23
24
  val database = when {
24
25
  options.url != null && options.path != null -> {
25
- // Embedded replica mode
26
+ // Embedded replica mode
26
27
  tech.turso.libsql.Libsql.open(
27
28
  url = options.url!!,
28
29
  authToken = options.authToken!!,
@@ -30,18 +31,18 @@ class Libsql(private val plugin: LibsqlPlugin) {
30
31
  )
31
32
  }
32
33
  options.url != null -> {
33
- // Remote-only mode
34
+ // Remote-only mode
34
35
  tech.turso.libsql.Libsql.open(
35
36
  url = options.url!!,
36
37
  authToken = options.authToken!!
37
38
  )
38
39
  }
39
40
  options.path != null -> {
40
- // Local-only mode
41
+ // Local-only mode
41
42
  tech.turso.libsql.Libsql.open(path = resolvePath(options.path!!))
42
43
  }
43
44
  else -> {
44
- // In-memory database
45
+ // In-memory database
45
46
  tech.turso.libsql.Libsql.open(path = ":memory:")
46
47
  }
47
48
  }
@@ -178,6 +179,25 @@ class Libsql(private val plugin: LibsqlPlugin) {
178
179
  }
179
180
  }
180
181
 
182
+
183
+ @Throws(Exception::class)
184
+ fun sync(options: SyncOptions, callback: EmptyCallback) {
185
+ try {
186
+ val database = databases[options.connectionId]
187
+ ?: throw Exception("Database not found: ${options.connectionId}")
188
+
189
+
190
+ val embeddedDb = database as? EmbeddedReplicaDatabase
191
+ ?: throw Exception("Sync is only available for embedded replica databases")
192
+
193
+ embeddedDb.sync()
194
+ callback.success()
195
+ } catch (exception: Exception) {
196
+ callback.error(exception)
197
+ }
198
+ }
199
+
200
+
181
201
  private fun resolvePath(path: String): String {
182
202
  var file = File(path)
183
203
  if (!file.isAbsolute) {
@@ -185,4 +205,4 @@ class Libsql(private val plugin: LibsqlPlugin) {
185
205
  }
186
206
  return file.absolutePath
187
207
  }
188
- }
208
+ }
@@ -187,7 +187,25 @@ public class LibsqlPlugin extends Plugin {
187
187
 
188
188
  @PluginMethod
189
189
  public void sync(PluginCall call) {
190
- rejectCallAsUnimplemented(call);
190
+ try {
191
+ SyncOptions options = new SyncOptions(call);
192
+ EmptyCallback callback = new EmptyCallback() {
193
+ @Override
194
+ public void success() {
195
+ resolveCall(call);
196
+ }
197
+
198
+ @Override
199
+ public void error(@NonNull Exception exception) {
200
+ rejectCall(call, exception);
201
+ }
202
+ };
203
+
204
+ assert implementation != null;
205
+ implementation.sync(options, callback);
206
+ } catch (Exception exception) {
207
+ rejectCall(call, exception);
208
+ }
191
209
  }
192
210
 
193
211
  private void rejectCall(@NonNull PluginCall call, @NonNull Exception exception) {
package/dist/docs.json CHANGED
@@ -93,7 +93,7 @@
93
93
  "text": "0.0.0"
94
94
  }
95
95
  ],
96
- "docs": "Execute a single SQL statement on the specified database connection.\n\nThis method can be used to execute any SQL statement, including `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.",
96
+ "docs": "Execute a single SQL statement on the specified database connection.\n\nThis method can be used to execute any SQL statement, including\n`INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.",
97
97
  "complexTypes": [
98
98
  "ExecuteOptions"
99
99
  ],
@@ -139,7 +139,7 @@
139
139
  "text": "0.0.0"
140
140
  }
141
141
  ],
142
- "docs": "Query the database and return the result set.\n\nThis method can be used to execute `SELECT` statements and retrieve the result set.",
142
+ "docs": "Query the database and return the result set.\n\nThis method can be used to execute `SELECT` statements\nand retrieve the result set.",
143
143
  "complexTypes": [
144
144
  "QueryResult",
145
145
  "QueryOptions"
@@ -186,7 +186,7 @@
186
186
  "text": "0.0.0"
187
187
  }
188
188
  ],
189
- "docs": "Synchronize the database with the remote server.\n\nOnly available on iOS.",
189
+ "docs": "Synchronize the database with the remote server.\n\nAvailable on iOS and Android.",
190
190
  "complexTypes": [
191
191
  "SyncOptions"
192
192
  ],
@@ -327,7 +327,7 @@
327
327
  "name": "since"
328
328
  }
329
329
  ],
330
- "docs": "The authentication token for the database.\n\nThis is required for connecting to a remote database.\nIf the database is local (i.e., a file on the device), this can be omitted.",
330
+ "docs": "The authentication token for the database.\n\nThis is required for connecting to a remote database.\nIf the database is local (i.e., a file on the device),\nthis can be omitted.",
331
331
  "complexTypes": [],
332
332
  "type": "string | undefined"
333
333
  },
@@ -343,7 +343,7 @@
343
343
  "name": "example"
344
344
  }
345
345
  ],
346
- "docs": "The path to the database file.\n\nIf no path or URL is provided, the plugin will create a new in-memory database.\n\nIf no file exists at the specified path, a new file will be created.",
346
+ "docs": "The path to the database file.\n\nIf no path or URL is provided, the plugin will create\na new in-memory database.\n\nIf no file exists at the specified path,\na new file will be created.",
347
347
  "complexTypes": [],
348
348
  "type": "string | undefined"
349
349
  },
@@ -355,7 +355,7 @@
355
355
  "name": "since"
356
356
  }
357
357
  ],
358
- "docs": "The URL of the database.\n\nThis can be used to connect to a remote database.\nIf the URL is provided, the `authToken` must also be provided.\n\nIf no path or URL is provided, the plugin will create a new in-memory database.",
358
+ "docs": "The URL of the database.\n\nThis can be used to connect to a remote database.\nIf the URL is provided, the `authToken` must also be provided.\n\nIf no path or URL is provided, the plugin will create\na new in-memory database.",
359
359
  "complexTypes": [],
360
360
  "type": "string | undefined"
361
361
  }
@@ -465,7 +465,7 @@
465
465
  "name": "since"
466
466
  },
467
467
  {
468
- "text": "['INSERT INTO users (name, age) VALUES (?, ?)', 'UPDATE users SET age = ? WHERE name = ?']",
468
+ "text": "[\n'INSERT INTO users (name, age) VALUES (?, ?)',\n'UPDATE users SET age = ? WHERE name = ?'\n]",
469
469
  "name": "example"
470
470
  }
471
471
  ],
@@ -481,7 +481,7 @@
481
481
  "name": "since"
482
482
  }
483
483
  ],
484
- "docs": "The transaction ID to use for the batch.\n\nOnly available on Android.",
484
+ "docs": "The values to bind to the SQL statements.",
485
485
  "complexTypes": [
486
486
  "Value"
487
487
  ],
@@ -26,7 +26,8 @@ export interface LibsqlPlugin {
26
26
  /**
27
27
  * Execute a single SQL statement on the specified database connection.
28
28
  *
29
- * This method can be used to execute any SQL statement, including `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.
29
+ * This method can be used to execute any SQL statement, including
30
+ * `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.
30
31
  *
31
32
  * @since 0.0.0
32
33
  */
@@ -42,7 +43,8 @@ export interface LibsqlPlugin {
42
43
  /**
43
44
  * Query the database and return the result set.
44
45
  *
45
- * This method can be used to execute `SELECT` statements and retrieve the result set.
46
+ * This method can be used to execute `SELECT` statements
47
+ * and retrieve the result set.
46
48
  *
47
49
  * @since 0.0.0
48
50
  */
@@ -60,7 +62,7 @@ export interface LibsqlPlugin {
60
62
  /**
61
63
  * Synchronize the database with the remote server.
62
64
  *
63
- * Only available on iOS.
65
+ * Available on iOS and Android.
64
66
  *
65
67
  * @since 0.0.0
66
68
  */
@@ -110,7 +112,8 @@ export interface ConnectOptions {
110
112
  * The authentication token for the database.
111
113
  *
112
114
  * This is required for connecting to a remote database.
113
- * If the database is local (i.e., a file on the device), this can be omitted.
115
+ * If the database is local (i.e., a file on the device),
116
+ * this can be omitted.
114
117
  *
115
118
  * @since 0.0.0
116
119
  */
@@ -118,9 +121,11 @@ export interface ConnectOptions {
118
121
  /**
119
122
  * The path to the database file.
120
123
  *
121
- * If no path or URL is provided, the plugin will create a new in-memory database.
124
+ * If no path or URL is provided, the plugin will create
125
+ * a new in-memory database.
122
126
  *
123
- * If no file exists at the specified path, a new file will be created.
127
+ * If no file exists at the specified path,
128
+ * a new file will be created.
124
129
  *
125
130
  * @since 0.0.0
126
131
  * @example '/data/user/0/com.example.plugin/cache/data.db'
@@ -132,7 +137,8 @@ export interface ConnectOptions {
132
137
  * This can be used to connect to a remote database.
133
138
  * If the URL is provided, the `authToken` must also be provided.
134
139
  *
135
- * If no path or URL is provided, the plugin will create a new in-memory database.
140
+ * If no path or URL is provided, the plugin will create
141
+ * a new in-memory database.
136
142
  *
137
143
  * @since 0.0.0
138
144
  */
@@ -196,13 +202,14 @@ export interface ExecuteBatchOptions {
196
202
  * The SQL statements to execute in the batch.
197
203
  *
198
204
  * @since 0.0.0
199
- * @example ['INSERT INTO users (name, age) VALUES (?, ?)', 'UPDATE users SET age = ? WHERE name = ?']
205
+ * @example [
206
+ * 'INSERT INTO users (name, age) VALUES (?, ?)',
207
+ * 'UPDATE users SET age = ? WHERE name = ?'
208
+ * ]
200
209
  */
201
210
  statement: string[];
202
211
  /**
203
- * The transaction ID to use for the batch.
204
- *
205
- * Only available on Android.
212
+ * The values to bind to the SQL statements.
206
213
  *
207
214
  * @since 0.0.0
208
215
  */
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface LibsqlPlugin {\n /**\n * Begin a transaction on the specified database connection.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n beginTransaction(\n options: BeginTransactionOptions,\n ): Promise<BeginTransactionResult>;\n /**\n * Commit the current transaction on the specified database connection.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n commitTransaction(options: CommitTransactionOptions): Promise<void>;\n /**\n * Connect to a database.\n *\n * This method must be called before any other methods that interact with the database.\n *\n * @since 0.0.0\n */\n connect(options: ConnectOptions): Promise<ConnectResult>;\n /**\n * Execute a single SQL statement on the specified database connection.\n *\n * This method can be used to execute any SQL statement, including `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.\n *\n * @since 0.0.0\n */\n execute(options: ExecuteOptions): Promise<void>;\n /**\n * Execute a batch of SQL statements on the specified database connection.\n *\n * This method can be used to execute multiple SQL statements in a single call.\n *\n * @since 0.0.0\n */\n executeBatch(options: ExecuteBatchOptions): Promise<void>;\n /**\n * Query the database and return the result set.\n *\n * This method can be used to execute `SELECT` statements and retrieve the result set.\n *\n * @since 0.0.0\n */\n query(options: QueryOptions): Promise<QueryResult>;\n /**\n * Rollback the current transaction on the specified database connection.\n *\n * This method will undo all changes made in the current transaction.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n rollbackTransaction(options: RollbackTransactionOptions): Promise<void>;\n /**\n * Synchronize the database with the remote server.\n *\n * Only available on iOS.\n *\n * @since 0.0.0\n */\n sync(options: SyncOptions): Promise<void>;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface BeginTransactionOptions {\n /**\n * The ID of the connection to begin the transaction on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface BeginTransactionResult {\n /**\n * The ID of the transaction that was started.\n *\n * @since 0.0.0\n */\n transactionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface CommitTransactionOptions {\n /**\n * The ID of the connection to commit the transaction on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The ID of the transaction to commit.\n *\n * @since 0.0.0\n */\n transactionId: string;\n}\n\nexport interface ConnectOptions {\n /**\n * The authentication token for the database.\n *\n * This is required for connecting to a remote database.\n * If the database is local (i.e., a file on the device), this can be omitted.\n *\n * @since 0.0.0\n */\n authToken?: string;\n /**\n * The path to the database file.\n *\n * If no path or URL is provided, the plugin will create a new in-memory database.\n *\n * If no file exists at the specified path, a new file will be created.\n *\n * @since 0.0.0\n * @example '/data/user/0/com.example.plugin/cache/data.db'\n */\n path?: string;\n /**\n * The URL of the database.\n *\n * This can be used to connect to a remote database.\n * If the URL is provided, the `authToken` must also be provided.\n *\n * If no path or URL is provided, the plugin will create a new in-memory database.\n *\n * @since 0.0.0\n */\n url?: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface ConnectResult {\n /**\n * The ID of the connection.\n *\n * @since 0.0.0\n */\n connectionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface ExecuteOptions {\n /**\n * The ID of the connection to execute the SQL statement on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The SQL statement to execute.\n *\n * @since 0.0.0\n * @example 'INSERT INTO users (name, age) VALUES (?, ?)'\n */\n statement: string;\n /**\n * The transaction ID to use for the SQL statement.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n transactionId?: string;\n /**\n * The values to bind to the SQL statement.\n *\n * @since 0.0.0\n * @example ['Alice', 30]\n */\n values?: Value[];\n}\n\n/**\n * @since 0.0.0\n */\nexport interface ExecuteBatchOptions {\n /**\n * The ID of the connection to execute the batch on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The SQL statements to execute in the batch.\n *\n * @since 0.0.0\n * @example ['INSERT INTO users (name, age) VALUES (?, ?)', 'UPDATE users SET age = ? WHERE name = ?']\n */\n statement: string[];\n /**\n * The transaction ID to use for the batch.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n values?: Value[][];\n}\n\n/**\n * @since 0.0.0\n */\nexport interface QueryOptions {\n /**\n * The ID of the connection to query.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The SQL statement to execute.\n *\n * @since 0.0.0\n * @example 'SELECT name, age FROM users WHERE age > ?'\n */\n statement: string;\n /**\n * The transaction ID to use for the query.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n transactionId?: string;\n /**\n * The values to bind to the SQL statement.\n *\n * @since 0.0.0\n * @example ['Alice', 30]\n */\n values?: Value[];\n}\n\n/**\n * @since 0.0.0\n */\nexport interface QueryResult {\n /**\n * The values returned by the query.\n *\n * @since 0.0.0\n * @example [['Alice', 30], ['Bob', 25]]\n */\n rows: Value[][];\n}\n\n/**\n * @since 0.0.0\n */\nexport interface RollbackTransactionOptions {\n /**\n * The ID of the connection to rollback the transaction on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The ID of the transaction to rollback.\n *\n * @since 0.0.0\n */\n transactionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface SyncOptions {\n /**\n * The ID of the connection to sync.\n *\n * @since 0.0.0\n */\n connectionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport type Value = string | number | null;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface LibsqlPlugin {\n /**\n * Begin a transaction on the specified database connection.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n beginTransaction(\n options: BeginTransactionOptions,\n ): Promise<BeginTransactionResult>;\n /**\n * Commit the current transaction on the specified database connection.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n commitTransaction(options: CommitTransactionOptions): Promise<void>;\n /**\n * Connect to a database.\n *\n * This method must be called before any other methods that interact with the database.\n *\n * @since 0.0.0\n */\n connect(options: ConnectOptions): Promise<ConnectResult>;\n /**\n * Execute a single SQL statement on the specified database connection.\n *\n * This method can be used to execute any SQL statement, including\n * `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.\n *\n * @since 0.0.0\n */\n execute(options: ExecuteOptions): Promise<void>;\n /**\n * Execute a batch of SQL statements on the specified database connection.\n *\n * This method can be used to execute multiple SQL statements in a single call.\n *\n * @since 0.0.0\n */\n executeBatch(options: ExecuteBatchOptions): Promise<void>;\n /**\n * Query the database and return the result set.\n *\n * This method can be used to execute `SELECT` statements\n * and retrieve the result set.\n *\n * @since 0.0.0\n */\n query(options: QueryOptions): Promise<QueryResult>;\n /**\n * Rollback the current transaction on the specified database connection.\n *\n * This method will undo all changes made in the current transaction.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n rollbackTransaction(options: RollbackTransactionOptions): Promise<void>;\n /**\n * Synchronize the database with the remote server.\n *\n * Available on iOS and Android.\n *\n * @since 0.0.0\n */\n sync(options: SyncOptions): Promise<void>;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface BeginTransactionOptions {\n /**\n * The ID of the connection to begin the transaction on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface BeginTransactionResult {\n /**\n * The ID of the transaction that was started.\n *\n * @since 0.0.0\n */\n transactionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface CommitTransactionOptions {\n /**\n * The ID of the connection to commit the transaction on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The ID of the transaction to commit.\n *\n * @since 0.0.0\n */\n transactionId: string;\n}\n\nexport interface ConnectOptions {\n /**\n * The authentication token for the database.\n *\n * This is required for connecting to a remote database.\n * If the database is local (i.e., a file on the device),\n * this can be omitted.\n *\n * @since 0.0.0\n */\n authToken?: string;\n /**\n * The path to the database file.\n *\n * If no path or URL is provided, the plugin will create\n * a new in-memory database.\n *\n * If no file exists at the specified path,\n * a new file will be created.\n *\n * @since 0.0.0\n * @example '/data/user/0/com.example.plugin/cache/data.db'\n */\n path?: string;\n /**\n * The URL of the database.\n *\n * This can be used to connect to a remote database.\n * If the URL is provided, the `authToken` must also be provided.\n *\n * If no path or URL is provided, the plugin will create\n * a new in-memory database.\n *\n * @since 0.0.0\n */\n url?: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface ConnectResult {\n /**\n * The ID of the connection.\n *\n * @since 0.0.0\n */\n connectionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface ExecuteOptions {\n /**\n * The ID of the connection to execute the SQL statement on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The SQL statement to execute.\n *\n * @since 0.0.0\n * @example 'INSERT INTO users (name, age) VALUES (?, ?)'\n */\n statement: string;\n /**\n * The transaction ID to use for the SQL statement.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n transactionId?: string;\n /**\n * The values to bind to the SQL statement.\n *\n * @since 0.0.0\n * @example ['Alice', 30]\n */\n values?: Value[];\n}\n\n/**\n * @since 0.0.0\n */\nexport interface ExecuteBatchOptions {\n /**\n * The ID of the connection to execute the batch on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The SQL statements to execute in the batch.\n *\n * @since 0.0.0\n * @example [\n * 'INSERT INTO users (name, age) VALUES (?, ?)',\n * 'UPDATE users SET age = ? WHERE name = ?'\n * ]\n */\n statement: string[];\n /**\n * The values to bind to the SQL statements.\n *\n * @since 0.0.0\n */\n values?: Value[][];\n}\n\n/**\n * @since 0.0.0\n */\nexport interface QueryOptions {\n /**\n * The ID of the connection to query.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The SQL statement to execute.\n *\n * @since 0.0.0\n * @example 'SELECT name, age FROM users WHERE age > ?'\n */\n statement: string;\n /**\n * The transaction ID to use for the query.\n *\n * Only available on Android.\n *\n * @since 0.0.0\n */\n transactionId?: string;\n /**\n * The values to bind to the SQL statement.\n *\n * @since 0.0.0\n * @example ['Alice', 30]\n */\n values?: Value[];\n}\n\n/**\n * @since 0.0.0\n */\nexport interface QueryResult {\n /**\n * The values returned by the query.\n *\n * @since 0.0.0\n * @example [['Alice', 30], ['Bob', 25]]\n */\n rows: Value[][];\n}\n\n/**\n * @since 0.0.0\n */\nexport interface RollbackTransactionOptions {\n /**\n * The ID of the connection to rollback the transaction on.\n *\n * @since 0.0.0\n */\n connectionId: string;\n /**\n * The ID of the transaction to rollback.\n *\n * @since 0.0.0\n */\n transactionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport interface SyncOptions {\n /**\n * The ID of the connection to sync.\n *\n * @since 0.0.0\n */\n connectionId: string;\n}\n\n/**\n * @since 0.0.0\n */\nexport type Value = string | number | null;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-libsql",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Capacitor plugin for libSQL databases.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",