@capawesome/capacitor-libsql 0.1.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/Package.swift +30 -0
- package/README.md +301 -0
- package/android/build.gradle +66 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/Libsql.kt +188 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/LibsqlPlugin.java +217 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/options/BeginTransactionOptions.java +28 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/options/CommitTransactionOptions.java +46 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/options/ConnectOptions.java +37 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/options/ExecuteBatchOptions.java +103 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/options/ExecuteOptions.java +82 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/options/QueryOptions.java +82 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/options/RollbackTransactionOptions.java +46 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/options/SyncOptions.java +28 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/results/BeginTransactionResult.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/results/ConnectResult.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/classes/results/QueryResult.java +47 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/interfaces/Callback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/interfaces/EmptyCallback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/interfaces/NonEmptyCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/interfaces/NonEmptyResultCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/libsql/interfaces/Result.java +7 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +684 -0
- package/dist/esm/definitions.d.ts +287 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +12 -0
- package/dist/esm/web.js +36 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +50 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +53 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Classes/Options/BeginTransactionOptions.swift +14 -0
- package/ios/Plugin/Classes/Options/CommitTransactionOptions.swift +19 -0
- package/ios/Plugin/Classes/Options/ConnectOptions.swift +24 -0
- package/ios/Plugin/Classes/Options/ExecuteBatchOptions.swift +41 -0
- package/ios/Plugin/Classes/Options/ExecuteOptions.swift +23 -0
- package/ios/Plugin/Classes/Options/QueryOptions.swift +23 -0
- package/ios/Plugin/Classes/Options/RollbackTransactionOptions.swift +19 -0
- package/ios/Plugin/Classes/Options/SyncOptions.swift +14 -0
- package/ios/Plugin/Classes/Results/BeginTransactionResult.swift +16 -0
- package/ios/Plugin/Classes/Results/ConnectResult.swift +16 -0
- package/ios/Plugin/Classes/Results/QueryResult.swift +36 -0
- package/ios/Plugin/Enums/LibsqlError.swift +61 -0
- package/ios/Plugin/Libsql.swift +219 -0
- package/ios/Plugin/LibsqlPlugin.swift +166 -0
- package/ios/Plugin/Protocols/Result.swift +6 -0
- package/package.json +91 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
export interface LibsqlPlugin {
|
|
2
|
+
/**
|
|
3
|
+
* Begin a transaction on the specified database connection.
|
|
4
|
+
*
|
|
5
|
+
* Only available on Android.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.0.0
|
|
8
|
+
*/
|
|
9
|
+
beginTransaction(options: BeginTransactionOptions): Promise<BeginTransactionResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Commit the current transaction on the specified database connection.
|
|
12
|
+
*
|
|
13
|
+
* Only available on Android.
|
|
14
|
+
*
|
|
15
|
+
* @since 0.0.0
|
|
16
|
+
*/
|
|
17
|
+
commitTransaction(options: CommitTransactionOptions): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Connect to a database.
|
|
20
|
+
*
|
|
21
|
+
* This method must be called before any other methods that interact with the database.
|
|
22
|
+
*
|
|
23
|
+
* @since 0.0.0
|
|
24
|
+
*/
|
|
25
|
+
connect(options: ConnectOptions): Promise<ConnectResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Execute a single SQL statement on the specified database connection.
|
|
28
|
+
*
|
|
29
|
+
* This method can be used to execute any SQL statement, including `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE`.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.0.0
|
|
32
|
+
*/
|
|
33
|
+
execute(options: ExecuteOptions): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Execute a batch of SQL statements on the specified database connection.
|
|
36
|
+
*
|
|
37
|
+
* This method can be used to execute multiple SQL statements in a single call.
|
|
38
|
+
*
|
|
39
|
+
* @since 0.0.0
|
|
40
|
+
*/
|
|
41
|
+
executeBatch(options: ExecuteBatchOptions): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Query the database and return the result set.
|
|
44
|
+
*
|
|
45
|
+
* This method can be used to execute `SELECT` statements and retrieve the result set.
|
|
46
|
+
*
|
|
47
|
+
* @since 0.0.0
|
|
48
|
+
*/
|
|
49
|
+
query(options: QueryOptions): Promise<QueryResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Rollback the current transaction on the specified database connection.
|
|
52
|
+
*
|
|
53
|
+
* This method will undo all changes made in the current transaction.
|
|
54
|
+
*
|
|
55
|
+
* Only available on Android.
|
|
56
|
+
*
|
|
57
|
+
* @since 0.0.0
|
|
58
|
+
*/
|
|
59
|
+
rollbackTransaction(options: RollbackTransactionOptions): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Synchronize the database with the remote server.
|
|
62
|
+
*
|
|
63
|
+
* Only available on iOS.
|
|
64
|
+
*
|
|
65
|
+
* @since 0.0.0
|
|
66
|
+
*/
|
|
67
|
+
sync(options: SyncOptions): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @since 0.0.0
|
|
71
|
+
*/
|
|
72
|
+
export interface BeginTransactionOptions {
|
|
73
|
+
/**
|
|
74
|
+
* The ID of the connection to begin the transaction on.
|
|
75
|
+
*
|
|
76
|
+
* @since 0.0.0
|
|
77
|
+
*/
|
|
78
|
+
connectionId: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @since 0.0.0
|
|
82
|
+
*/
|
|
83
|
+
export interface BeginTransactionResult {
|
|
84
|
+
/**
|
|
85
|
+
* The ID of the transaction that was started.
|
|
86
|
+
*
|
|
87
|
+
* @since 0.0.0
|
|
88
|
+
*/
|
|
89
|
+
transactionId: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @since 0.0.0
|
|
93
|
+
*/
|
|
94
|
+
export interface CommitTransactionOptions {
|
|
95
|
+
/**
|
|
96
|
+
* The ID of the connection to commit the transaction on.
|
|
97
|
+
*
|
|
98
|
+
* @since 0.0.0
|
|
99
|
+
*/
|
|
100
|
+
connectionId: string;
|
|
101
|
+
/**
|
|
102
|
+
* The ID of the transaction to commit.
|
|
103
|
+
*
|
|
104
|
+
* @since 0.0.0
|
|
105
|
+
*/
|
|
106
|
+
transactionId: string;
|
|
107
|
+
}
|
|
108
|
+
export interface ConnectOptions {
|
|
109
|
+
/**
|
|
110
|
+
* The authentication token for the database.
|
|
111
|
+
*
|
|
112
|
+
* 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.
|
|
114
|
+
*
|
|
115
|
+
* @since 0.0.0
|
|
116
|
+
*/
|
|
117
|
+
authToken?: string;
|
|
118
|
+
/**
|
|
119
|
+
* The path to the database file.
|
|
120
|
+
*
|
|
121
|
+
* If no path or URL is provided, the plugin will create a new in-memory database.
|
|
122
|
+
*
|
|
123
|
+
* If no file exists at the specified path, a new file will be created.
|
|
124
|
+
*
|
|
125
|
+
* @since 0.0.0
|
|
126
|
+
* @example '/data/user/0/com.example.plugin/cache/data.db'
|
|
127
|
+
*/
|
|
128
|
+
path?: string;
|
|
129
|
+
/**
|
|
130
|
+
* The URL of the database.
|
|
131
|
+
*
|
|
132
|
+
* This can be used to connect to a remote database.
|
|
133
|
+
* If the URL is provided, the `authToken` must also be provided.
|
|
134
|
+
*
|
|
135
|
+
* If no path or URL is provided, the plugin will create a new in-memory database.
|
|
136
|
+
*
|
|
137
|
+
* @since 0.0.0
|
|
138
|
+
*/
|
|
139
|
+
url?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @since 0.0.0
|
|
143
|
+
*/
|
|
144
|
+
export interface ConnectResult {
|
|
145
|
+
/**
|
|
146
|
+
* The ID of the connection.
|
|
147
|
+
*
|
|
148
|
+
* @since 0.0.0
|
|
149
|
+
*/
|
|
150
|
+
connectionId: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @since 0.0.0
|
|
154
|
+
*/
|
|
155
|
+
export interface ExecuteOptions {
|
|
156
|
+
/**
|
|
157
|
+
* The ID of the connection to execute the SQL statement on.
|
|
158
|
+
*
|
|
159
|
+
* @since 0.0.0
|
|
160
|
+
*/
|
|
161
|
+
connectionId: string;
|
|
162
|
+
/**
|
|
163
|
+
* The SQL statement to execute.
|
|
164
|
+
*
|
|
165
|
+
* @since 0.0.0
|
|
166
|
+
* @example 'INSERT INTO users (name, age) VALUES (?, ?)'
|
|
167
|
+
*/
|
|
168
|
+
statement: string;
|
|
169
|
+
/**
|
|
170
|
+
* The transaction ID to use for the SQL statement.
|
|
171
|
+
*
|
|
172
|
+
* Only available on Android.
|
|
173
|
+
*
|
|
174
|
+
* @since 0.0.0
|
|
175
|
+
*/
|
|
176
|
+
transactionId?: string;
|
|
177
|
+
/**
|
|
178
|
+
* The values to bind to the SQL statement.
|
|
179
|
+
*
|
|
180
|
+
* @since 0.0.0
|
|
181
|
+
* @example ['Alice', 30]
|
|
182
|
+
*/
|
|
183
|
+
values?: Value[];
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @since 0.0.0
|
|
187
|
+
*/
|
|
188
|
+
export interface ExecuteBatchOptions {
|
|
189
|
+
/**
|
|
190
|
+
* The ID of the connection to execute the batch on.
|
|
191
|
+
*
|
|
192
|
+
* @since 0.0.0
|
|
193
|
+
*/
|
|
194
|
+
connectionId: string;
|
|
195
|
+
/**
|
|
196
|
+
* The SQL statements to execute in the batch.
|
|
197
|
+
*
|
|
198
|
+
* @since 0.0.0
|
|
199
|
+
* @example ['INSERT INTO users (name, age) VALUES (?, ?)', 'UPDATE users SET age = ? WHERE name = ?']
|
|
200
|
+
*/
|
|
201
|
+
statement: string[];
|
|
202
|
+
/**
|
|
203
|
+
* The transaction ID to use for the batch.
|
|
204
|
+
*
|
|
205
|
+
* Only available on Android.
|
|
206
|
+
*
|
|
207
|
+
* @since 0.0.0
|
|
208
|
+
*/
|
|
209
|
+
values?: Value[][];
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* @since 0.0.0
|
|
213
|
+
*/
|
|
214
|
+
export interface QueryOptions {
|
|
215
|
+
/**
|
|
216
|
+
* The ID of the connection to query.
|
|
217
|
+
*
|
|
218
|
+
* @since 0.0.0
|
|
219
|
+
*/
|
|
220
|
+
connectionId: string;
|
|
221
|
+
/**
|
|
222
|
+
* The SQL statement to execute.
|
|
223
|
+
*
|
|
224
|
+
* @since 0.0.0
|
|
225
|
+
* @example 'SELECT name, age FROM users WHERE age > ?'
|
|
226
|
+
*/
|
|
227
|
+
statement: string;
|
|
228
|
+
/**
|
|
229
|
+
* The transaction ID to use for the query.
|
|
230
|
+
*
|
|
231
|
+
* Only available on Android.
|
|
232
|
+
*
|
|
233
|
+
* @since 0.0.0
|
|
234
|
+
*/
|
|
235
|
+
transactionId?: string;
|
|
236
|
+
/**
|
|
237
|
+
* The values to bind to the SQL statement.
|
|
238
|
+
*
|
|
239
|
+
* @since 0.0.0
|
|
240
|
+
* @example ['Alice', 30]
|
|
241
|
+
*/
|
|
242
|
+
values?: Value[];
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* @since 0.0.0
|
|
246
|
+
*/
|
|
247
|
+
export interface QueryResult {
|
|
248
|
+
/**
|
|
249
|
+
* The values returned by the query.
|
|
250
|
+
*
|
|
251
|
+
* @since 0.0.0
|
|
252
|
+
* @example [['Alice', 30], ['Bob', 25]]
|
|
253
|
+
*/
|
|
254
|
+
rows: Value[][];
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* @since 0.0.0
|
|
258
|
+
*/
|
|
259
|
+
export interface RollbackTransactionOptions {
|
|
260
|
+
/**
|
|
261
|
+
* The ID of the connection to rollback the transaction on.
|
|
262
|
+
*
|
|
263
|
+
* @since 0.0.0
|
|
264
|
+
*/
|
|
265
|
+
connectionId: string;
|
|
266
|
+
/**
|
|
267
|
+
* The ID of the transaction to rollback.
|
|
268
|
+
*
|
|
269
|
+
* @since 0.0.0
|
|
270
|
+
*/
|
|
271
|
+
transactionId: string;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* @since 0.0.0
|
|
275
|
+
*/
|
|
276
|
+
export interface SyncOptions {
|
|
277
|
+
/**
|
|
278
|
+
* The ID of the connection to sync.
|
|
279
|
+
*
|
|
280
|
+
* @since 0.0.0
|
|
281
|
+
*/
|
|
282
|
+
connectionId: string;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* @since 0.0.0
|
|
286
|
+
*/
|
|
287
|
+
export declare type Value = string | number | null;
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,MAAM,GAAG,cAAc,CAAe,QAAQ,EAAE;IACpD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;CACxD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { LibsqlPlugin } from './definitions';\n\nconst Libsql = registerPlugin<LibsqlPlugin>('Libsql', {\n web: () => import('./web').then(m => new m.LibsqlWeb()),\n});\n\nexport * from './definitions';\nexport { Libsql };\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { BeginTransactionOptions, BeginTransactionResult, CommitTransactionOptions, ConnectOptions, ConnectResult, ExecuteBatchOptions, ExecuteOptions, LibsqlPlugin, QueryOptions, QueryResult, RollbackTransactionOptions, SyncOptions } from './definitions';
|
|
3
|
+
export declare class LibsqlWeb extends WebPlugin implements LibsqlPlugin {
|
|
4
|
+
beginTransaction(options: BeginTransactionOptions): Promise<BeginTransactionResult>;
|
|
5
|
+
commitTransaction(options: CommitTransactionOptions): Promise<void>;
|
|
6
|
+
connect(options: ConnectOptions): Promise<ConnectResult>;
|
|
7
|
+
execute(options: ExecuteOptions): Promise<void>;
|
|
8
|
+
executeBatch(options: ExecuteBatchOptions): Promise<void>;
|
|
9
|
+
query(options: QueryOptions): Promise<QueryResult>;
|
|
10
|
+
rollbackTransaction(options: RollbackTransactionOptions): Promise<void>;
|
|
11
|
+
sync(options: SyncOptions): Promise<void>;
|
|
12
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class LibsqlWeb extends WebPlugin {
|
|
3
|
+
async beginTransaction(options) {
|
|
4
|
+
console.log('beginTransaction', options);
|
|
5
|
+
throw this.unimplemented('Not implemented on web.');
|
|
6
|
+
}
|
|
7
|
+
async commitTransaction(options) {
|
|
8
|
+
console.log('commitTransaction', options);
|
|
9
|
+
throw this.unimplemented('Not implemented on web.');
|
|
10
|
+
}
|
|
11
|
+
async connect(options) {
|
|
12
|
+
console.log('connect', options);
|
|
13
|
+
throw this.unimplemented('Not implemented on web.');
|
|
14
|
+
}
|
|
15
|
+
async execute(options) {
|
|
16
|
+
console.log('execute', options);
|
|
17
|
+
throw this.unimplemented('Not implemented on web.');
|
|
18
|
+
}
|
|
19
|
+
async executeBatch(options) {
|
|
20
|
+
console.log('executeBatch', options);
|
|
21
|
+
throw this.unimplemented('Not implemented on web.');
|
|
22
|
+
}
|
|
23
|
+
async query(options) {
|
|
24
|
+
console.log('query', options);
|
|
25
|
+
throw this.unimplemented('Not implemented on web.');
|
|
26
|
+
}
|
|
27
|
+
async rollbackTransaction(options) {
|
|
28
|
+
console.log('rollbackTransaction', options);
|
|
29
|
+
throw this.unimplemented('Not implemented on web.');
|
|
30
|
+
}
|
|
31
|
+
async sync(options) {
|
|
32
|
+
console.log('sync', options);
|
|
33
|
+
throw this.unimplemented('Not implemented on web.');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAiB5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,KAAK,CAAC,gBAAgB,CACpB,OAAgC;QAEhC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QACzC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAiC;QACvD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QAC1C,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAuB;QACnC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAuB;QACnC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA4B;QAC7C,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACrC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAqB;QAC/B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,OAAmC;QAEnC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QAC5C,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n BeginTransactionOptions,\n BeginTransactionResult,\n CommitTransactionOptions,\n ConnectOptions,\n ConnectResult,\n ExecuteBatchOptions,\n ExecuteOptions,\n LibsqlPlugin,\n QueryOptions,\n QueryResult,\n RollbackTransactionOptions,\n SyncOptions,\n} from './definitions';\n\nexport class LibsqlWeb extends WebPlugin implements LibsqlPlugin {\n async beginTransaction(\n options: BeginTransactionOptions,\n ): Promise<BeginTransactionResult> {\n console.log('beginTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n\n async commitTransaction(options: CommitTransactionOptions): Promise<void> {\n console.log('commitTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n\n async connect(options: ConnectOptions): Promise<ConnectResult> {\n console.log('connect', options);\n throw this.unimplemented('Not implemented on web.');\n }\n\n async execute(options: ExecuteOptions): Promise<void> {\n console.log('execute', options);\n throw this.unimplemented('Not implemented on web.');\n }\n\n async executeBatch(options: ExecuteBatchOptions): Promise<void> {\n console.log('executeBatch', options);\n throw this.unimplemented('Not implemented on web.');\n }\n\n async query(options: QueryOptions): Promise<QueryResult> {\n console.log('query', options);\n throw this.unimplemented('Not implemented on web.');\n }\n\n async rollbackTransaction(\n options: RollbackTransactionOptions,\n ): Promise<void> {\n console.log('rollbackTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n\n async sync(options: SyncOptions): Promise<void> {\n console.log('sync', options);\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const Libsql = core.registerPlugin('Libsql', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.LibsqlWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
class LibsqlWeb extends core.WebPlugin {
|
|
10
|
+
async beginTransaction(options) {
|
|
11
|
+
console.log('beginTransaction', options);
|
|
12
|
+
throw this.unimplemented('Not implemented on web.');
|
|
13
|
+
}
|
|
14
|
+
async commitTransaction(options) {
|
|
15
|
+
console.log('commitTransaction', options);
|
|
16
|
+
throw this.unimplemented('Not implemented on web.');
|
|
17
|
+
}
|
|
18
|
+
async connect(options) {
|
|
19
|
+
console.log('connect', options);
|
|
20
|
+
throw this.unimplemented('Not implemented on web.');
|
|
21
|
+
}
|
|
22
|
+
async execute(options) {
|
|
23
|
+
console.log('execute', options);
|
|
24
|
+
throw this.unimplemented('Not implemented on web.');
|
|
25
|
+
}
|
|
26
|
+
async executeBatch(options) {
|
|
27
|
+
console.log('executeBatch', options);
|
|
28
|
+
throw this.unimplemented('Not implemented on web.');
|
|
29
|
+
}
|
|
30
|
+
async query(options) {
|
|
31
|
+
console.log('query', options);
|
|
32
|
+
throw this.unimplemented('Not implemented on web.');
|
|
33
|
+
}
|
|
34
|
+
async rollbackTransaction(options) {
|
|
35
|
+
console.log('rollbackTransaction', options);
|
|
36
|
+
throw this.unimplemented('Not implemented on web.');
|
|
37
|
+
}
|
|
38
|
+
async sync(options) {
|
|
39
|
+
console.log('sync', options);
|
|
40
|
+
throw this.unimplemented('Not implemented on web.');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
45
|
+
__proto__: null,
|
|
46
|
+
LibsqlWeb: LibsqlWeb
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
exports.Libsql = Libsql;
|
|
50
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Libsql = registerPlugin('Libsql', {\n web: () => import('./web').then(m => new m.LibsqlWeb()),\n});\nexport * from './definitions';\nexport { Libsql };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LibsqlWeb extends WebPlugin {\n async beginTransaction(options) {\n console.log('beginTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async commitTransaction(options) {\n console.log('commitTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async connect(options) {\n console.log('connect', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async execute(options) {\n console.log('execute', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async executeBatch(options) {\n console.log('executeBatch', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async query(options) {\n console.log('query', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async rollbackTransaction(options) {\n console.log('rollbackTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async sync(options) {\n console.log('sync', options);\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACFM,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,MAAM,gBAAgB,CAAC,OAAO,EAAE;AACpC,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC;AAChD,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA,IAAI,MAAM,iBAAiB,CAAC,OAAO,EAAE;AACrC,QAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC;AACjD,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE;AAC3B,QAAQ,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC;AACvC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE;AAC3B,QAAQ,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC;AACvC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;AAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC;AAC5C,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;AACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC;AACrC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;AACvC,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC;AACnD,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var capacitorLibsql = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Libsql = core.registerPlugin('Libsql', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.LibsqlWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class LibsqlWeb extends core.WebPlugin {
|
|
9
|
+
async beginTransaction(options) {
|
|
10
|
+
console.log('beginTransaction', options);
|
|
11
|
+
throw this.unimplemented('Not implemented on web.');
|
|
12
|
+
}
|
|
13
|
+
async commitTransaction(options) {
|
|
14
|
+
console.log('commitTransaction', options);
|
|
15
|
+
throw this.unimplemented('Not implemented on web.');
|
|
16
|
+
}
|
|
17
|
+
async connect(options) {
|
|
18
|
+
console.log('connect', options);
|
|
19
|
+
throw this.unimplemented('Not implemented on web.');
|
|
20
|
+
}
|
|
21
|
+
async execute(options) {
|
|
22
|
+
console.log('execute', options);
|
|
23
|
+
throw this.unimplemented('Not implemented on web.');
|
|
24
|
+
}
|
|
25
|
+
async executeBatch(options) {
|
|
26
|
+
console.log('executeBatch', options);
|
|
27
|
+
throw this.unimplemented('Not implemented on web.');
|
|
28
|
+
}
|
|
29
|
+
async query(options) {
|
|
30
|
+
console.log('query', options);
|
|
31
|
+
throw this.unimplemented('Not implemented on web.');
|
|
32
|
+
}
|
|
33
|
+
async rollbackTransaction(options) {
|
|
34
|
+
console.log('rollbackTransaction', options);
|
|
35
|
+
throw this.unimplemented('Not implemented on web.');
|
|
36
|
+
}
|
|
37
|
+
async sync(options) {
|
|
38
|
+
console.log('sync', options);
|
|
39
|
+
throw this.unimplemented('Not implemented on web.');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
44
|
+
__proto__: null,
|
|
45
|
+
LibsqlWeb: LibsqlWeb
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
exports.Libsql = Libsql;
|
|
49
|
+
|
|
50
|
+
return exports;
|
|
51
|
+
|
|
52
|
+
})({}, capacitorExports);
|
|
53
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Libsql = registerPlugin('Libsql', {\n web: () => import('./web').then(m => new m.LibsqlWeb()),\n});\nexport * from './definitions';\nexport { Libsql };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LibsqlWeb extends WebPlugin {\n async beginTransaction(options) {\n console.log('beginTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async commitTransaction(options) {\n console.log('commitTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async connect(options) {\n console.log('connect', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async execute(options) {\n console.log('execute', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async executeBatch(options) {\n console.log('executeBatch', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async query(options) {\n console.log('query', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async rollbackTransaction(options) {\n console.log('rollbackTransaction', options);\n throw this.unimplemented('Not implemented on web.');\n }\n async sync(options) {\n console.log('sync', options);\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICFM,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,MAAM,gBAAgB,CAAC,OAAO,EAAE;IACpC,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAChD,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA,IAAI,MAAM,iBAAiB,CAAC,OAAO,EAAE;IACrC,QAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACjD,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE;IAC3B,QAAQ,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC;IACvC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE;IAC3B,QAAQ,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC;IACvC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;IAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC;IAC5C,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;IACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC;IACrC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;IACvC,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACnD,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class BeginTransactionOptions: NSObject {
|
|
5
|
+
let connectionId: String
|
|
6
|
+
|
|
7
|
+
init(_ call: CAPPluginCall) throws {
|
|
8
|
+
guard let connectionId = call.getString("connectionId") else {
|
|
9
|
+
throw LibsqlError.connectionIdMissing
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
self.connectionId = connectionId
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class CommitTransactionOptions: NSObject {
|
|
5
|
+
let connectionId: String
|
|
6
|
+
let transactionId: String
|
|
7
|
+
|
|
8
|
+
init(_ call: CAPPluginCall) throws {
|
|
9
|
+
guard let connectionId = call.getString("connectionId") else {
|
|
10
|
+
throw LibsqlError.connectionIdMissing
|
|
11
|
+
}
|
|
12
|
+
guard let transactionId = call.getString("transactionId") else {
|
|
13
|
+
throw LibsqlError.transactionIdMissing
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
self.connectionId = connectionId
|
|
17
|
+
self.transactionId = transactionId
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class ConnectOptions: NSObject {
|
|
5
|
+
let authToken: String?
|
|
6
|
+
private let path: String?
|
|
7
|
+
let url: String?
|
|
8
|
+
|
|
9
|
+
init(_ call: CAPPluginCall) throws {
|
|
10
|
+
self.authToken = call.getString("authToken")
|
|
11
|
+
if let path = call.getString("path") {
|
|
12
|
+
let documentsPath = NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true).first!
|
|
13
|
+
let databasePath = URL(fileURLWithPath: documentsPath).appendingPathComponent(path).path
|
|
14
|
+
self.path = databasePath
|
|
15
|
+
} else {
|
|
16
|
+
self.path = nil
|
|
17
|
+
}
|
|
18
|
+
self.url = call.getString("url")
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
func getPath() -> String? {
|
|
22
|
+
return path
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class ExecuteBatchOptions: NSObject {
|
|
5
|
+
let connectionId: String
|
|
6
|
+
let statement: [String]
|
|
7
|
+
let values: [[Any]]?
|
|
8
|
+
|
|
9
|
+
init(_ call: CAPPluginCall) throws {
|
|
10
|
+
guard let connectionId = call.getString("connectionId") else {
|
|
11
|
+
throw LibsqlError.connectionIdMissing
|
|
12
|
+
}
|
|
13
|
+
guard let statementArray = call.getArray("statement") else {
|
|
14
|
+
throw LibsqlError.statementMissing
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var statements: [String] = []
|
|
18
|
+
for item in statementArray.capacitor.replacingNullValues() {
|
|
19
|
+
guard let statement = item as? String else {
|
|
20
|
+
throw LibsqlError.invalidStatement
|
|
21
|
+
}
|
|
22
|
+
statements.append(statement)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
self.connectionId = connectionId
|
|
26
|
+
self.statement = statements
|
|
27
|
+
|
|
28
|
+
if let valuesArray = call.getArray("values") {
|
|
29
|
+
var allValues: [[Any]] = []
|
|
30
|
+
for item in valuesArray.capacitor.replacingNullValues() {
|
|
31
|
+
guard let subArray = item as? [Any] else {
|
|
32
|
+
throw LibsqlError.invalidValues
|
|
33
|
+
}
|
|
34
|
+
allValues.append(subArray)
|
|
35
|
+
}
|
|
36
|
+
self.values = allValues
|
|
37
|
+
} else {
|
|
38
|
+
self.values = nil
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class ExecuteOptions: NSObject {
|
|
5
|
+
let connectionId: String
|
|
6
|
+
let statement: String
|
|
7
|
+
let transactionId: String?
|
|
8
|
+
let values: [Any]?
|
|
9
|
+
|
|
10
|
+
init(_ call: CAPPluginCall) throws {
|
|
11
|
+
guard let connectionId = call.getString("connectionId") else {
|
|
12
|
+
throw LibsqlError.connectionIdMissing
|
|
13
|
+
}
|
|
14
|
+
guard let statement = call.getString("statement") else {
|
|
15
|
+
throw LibsqlError.statementMissing
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
self.connectionId = connectionId
|
|
19
|
+
self.statement = statement
|
|
20
|
+
self.transactionId = call.getString("transactionId")
|
|
21
|
+
self.values = call.getArray("values")?.capacitor.replacingNullValues()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class QueryOptions: NSObject {
|
|
5
|
+
let connectionId: String
|
|
6
|
+
let statement: String
|
|
7
|
+
let transactionId: String?
|
|
8
|
+
let values: [Any]?
|
|
9
|
+
|
|
10
|
+
init(_ call: CAPPluginCall) throws {
|
|
11
|
+
guard let connectionId = call.getString("connectionId") else {
|
|
12
|
+
throw LibsqlError.connectionIdMissing
|
|
13
|
+
}
|
|
14
|
+
guard let statement = call.getString("statement") else {
|
|
15
|
+
throw LibsqlError.statementMissing
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
self.connectionId = connectionId
|
|
19
|
+
self.statement = statement
|
|
20
|
+
self.transactionId = call.getString("transactionId")
|
|
21
|
+
self.values = call.getArray("values")?.capacitor.replacingNullValues()
|
|
22
|
+
}
|
|
23
|
+
}
|