@capacitor-community/sqlite 3.4.2 → 3.4.3-3
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 +42 -2
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/CapacitorSQLite.java +41 -2
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/CapacitorSQLitePlugin.java +26 -0
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/NotificationCenter.java +1 -1
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/Database.java +220 -7
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/ExportToJson.java +100 -3
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/ImportFromJson.java +37 -34
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsUpgrade.java +8 -4
- package/dist/esm/definitions.d.ts +17 -1
- package/dist/esm/definitions.js +9 -17
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +20 -11
- package/dist/esm/web.js +288 -473
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +273 -466
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1036 -1229
- package/dist/plugin.js.map +1 -1
- package/electron/dist/plugin.js +1147 -1032
- package/electron/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorSQLite.swift +34 -1
- package/ios/Plugin/CapacitorSQLitePlugin.m +1 -0
- package/ios/Plugin/CapacitorSQLitePlugin.swift +25 -0
- package/ios/Plugin/Database.swift +29 -1
- package/ios/Plugin/Extensions/String.swift +8 -0
- package/ios/Plugin/ImportExportJson/ExportToJson.swift +154 -25
- package/ios/Plugin/ImportExportJson/ImportFromJson.swift +53 -27
- package/ios/Plugin/Utils/UtilsDrop.swift +2 -2
- package/ios/Plugin/Utils/UtilsSQLCipher.swift +277 -8
- package/ios/Plugin/Utils/UtilsUpgrade.swift +33 -13
- package/package.json +6 -6
package/dist/esm/web.js
CHANGED
|
@@ -2,562 +2,350 @@ import { WebPlugin } from '@capacitor/core';
|
|
|
2
2
|
export class CapacitorSQLiteWeb extends WebPlugin {
|
|
3
3
|
constructor() {
|
|
4
4
|
super(...arguments);
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
5
|
+
this.jeepSqliteElement = null;
|
|
6
|
+
this.isWebStoreOpen = false;
|
|
7
7
|
}
|
|
8
8
|
async initWebStore() {
|
|
9
9
|
await customElements.whenDefined('jeep-sqlite');
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
else {
|
|
23
|
-
return Promise.reject('InitWeb: this.sqliteEl is null');
|
|
24
|
-
}
|
|
10
|
+
this.jeepSqliteElement = document.querySelector('jeep-sqlite');
|
|
11
|
+
this.ensureJeepSqliteIsAvailable();
|
|
12
|
+
this.jeepSqliteElement.addEventListener('jeepSqliteImportProgress', (event) => {
|
|
13
|
+
this.notifyListeners('sqliteImportProgressEvent', event.detail);
|
|
14
|
+
});
|
|
15
|
+
this.jeepSqliteElement.addEventListener('jeepSqliteExportProgress', (event) => {
|
|
16
|
+
this.notifyListeners('sqliteExportProgressEvent', event.detail);
|
|
17
|
+
});
|
|
18
|
+
if (!this.isWebStoreOpen) {
|
|
19
|
+
this.isWebStoreOpen = await this.jeepSqliteElement.isStoreOpen();
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
25
22
|
}
|
|
26
23
|
async saveToStore(options) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
return Promise.reject(`${err}`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
throw this.unimplemented('Not implemented on web.');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async echo(options) {
|
|
46
|
-
if (this.sqliteEl != null) {
|
|
47
|
-
const echo = await this.sqliteEl.echo(options);
|
|
48
|
-
return echo;
|
|
24
|
+
this.ensureJeepSqliteIsAvailable();
|
|
25
|
+
this.ensureWebstoreIsOpen();
|
|
26
|
+
try {
|
|
27
|
+
await this.jeepSqliteElement.saveToStore(options);
|
|
28
|
+
return;
|
|
49
29
|
}
|
|
50
|
-
|
|
51
|
-
throw
|
|
30
|
+
catch (err) {
|
|
31
|
+
throw new Error(`${err}`);
|
|
52
32
|
}
|
|
53
33
|
}
|
|
54
|
-
async
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
console.log('setEncryptionSecret', options);
|
|
59
|
-
throw this.unimplemented('Not implemented on web.');
|
|
60
|
-
}
|
|
61
|
-
async changeEncryptionSecret(options) {
|
|
62
|
-
console.log('changeEncryptionSecret', options);
|
|
63
|
-
throw this.unimplemented('Not implemented on web.');
|
|
64
|
-
}
|
|
65
|
-
async getNCDatabasePath(options) {
|
|
66
|
-
console.log('getNCDatabasePath', options);
|
|
67
|
-
throw this.unimplemented('Not implemented on web.');
|
|
68
|
-
}
|
|
69
|
-
async createNCConnection(options) {
|
|
70
|
-
console.log('createNCConnection', options);
|
|
71
|
-
throw this.unimplemented('Not implemented on web.');
|
|
72
|
-
}
|
|
73
|
-
async closeNCConnection(options) {
|
|
74
|
-
console.log('closeNCConnection', options);
|
|
75
|
-
throw this.unimplemented('Not implemented on web.');
|
|
76
|
-
}
|
|
77
|
-
async isNCDatabase(options) {
|
|
78
|
-
console.log('isNCDatabase', options);
|
|
79
|
-
throw this.unimplemented('Not implemented on web.');
|
|
34
|
+
async echo(options) {
|
|
35
|
+
this.ensureJeepSqliteIsAvailable();
|
|
36
|
+
const echoResult = await this.jeepSqliteElement.echo(options);
|
|
37
|
+
return echoResult;
|
|
80
38
|
}
|
|
81
39
|
async createConnection(options) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
throw this.unimplemented('Not implemented on web.');
|
|
40
|
+
this.ensureJeepSqliteIsAvailable();
|
|
41
|
+
this.ensureWebstoreIsOpen();
|
|
42
|
+
try {
|
|
43
|
+
await this.jeepSqliteElement.createConnection(options);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
throw new Error(`${err}`);
|
|
98
48
|
}
|
|
99
49
|
}
|
|
100
50
|
async open(options) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
throw this.unimplemented('Not implemented on web.');
|
|
51
|
+
this.ensureJeepSqliteIsAvailable();
|
|
52
|
+
this.ensureWebstoreIsOpen();
|
|
53
|
+
try {
|
|
54
|
+
await this.jeepSqliteElement.open(options);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
throw new Error(`${err}`);
|
|
117
59
|
}
|
|
118
60
|
}
|
|
119
61
|
async closeConnection(options) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
throw this.unimplemented('Not implemented on web.');
|
|
62
|
+
this.ensureJeepSqliteIsAvailable();
|
|
63
|
+
this.ensureWebstoreIsOpen();
|
|
64
|
+
try {
|
|
65
|
+
await this.jeepSqliteElement.closeConnection(options);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
throw new Error(`${err}`);
|
|
136
70
|
}
|
|
137
|
-
}
|
|
138
|
-
async getUrl() {
|
|
139
|
-
throw this.unimplemented('Not implemented on web.');
|
|
140
71
|
}
|
|
141
72
|
async getVersion(options) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
throw this.unimplemented('Not implemented on web.');
|
|
73
|
+
this.ensureJeepSqliteIsAvailable();
|
|
74
|
+
this.ensureWebstoreIsOpen();
|
|
75
|
+
try {
|
|
76
|
+
const versionResult = await this.jeepSqliteElement.getVersion(options);
|
|
77
|
+
return versionResult;
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
throw new Error(`${err}`);
|
|
158
81
|
}
|
|
159
82
|
}
|
|
160
83
|
async checkConnectionsConsistency(options) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
catch (err) {
|
|
167
|
-
return Promise.reject(`${err}`);
|
|
168
|
-
}
|
|
84
|
+
this.ensureJeepSqliteIsAvailable();
|
|
85
|
+
try {
|
|
86
|
+
const consistencyResult = await this.jeepSqliteElement.checkConnectionsConsistency(options);
|
|
87
|
+
return consistencyResult;
|
|
169
88
|
}
|
|
170
|
-
|
|
171
|
-
throw
|
|
89
|
+
catch (err) {
|
|
90
|
+
throw new Error(`${err}`);
|
|
172
91
|
}
|
|
173
92
|
}
|
|
174
93
|
async close(options) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
throw this.unimplemented('Not implemented on web.');
|
|
94
|
+
this.ensureJeepSqliteIsAvailable();
|
|
95
|
+
this.ensureWebstoreIsOpen();
|
|
96
|
+
try {
|
|
97
|
+
await this.jeepSqliteElement.close(options);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
throw new Error(`${err}`);
|
|
191
102
|
}
|
|
192
103
|
}
|
|
193
104
|
async getTableList(options) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
throw this.unimplemented('Not implemented on web.');
|
|
105
|
+
this.ensureJeepSqliteIsAvailable();
|
|
106
|
+
this.ensureWebstoreIsOpen();
|
|
107
|
+
try {
|
|
108
|
+
const tableListResult = await this.jeepSqliteElement.getTableList(options);
|
|
109
|
+
return tableListResult;
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
throw new Error(`${err}`);
|
|
210
113
|
}
|
|
211
114
|
}
|
|
212
115
|
async execute(options) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
throw this.unimplemented('Not implemented on web.');
|
|
116
|
+
this.ensureJeepSqliteIsAvailable();
|
|
117
|
+
this.ensureWebstoreIsOpen();
|
|
118
|
+
try {
|
|
119
|
+
const executeResult = await this.jeepSqliteElement.execute(options);
|
|
120
|
+
return executeResult;
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
throw new Error(`${err}`);
|
|
229
124
|
}
|
|
230
125
|
}
|
|
231
126
|
async executeSet(options) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
throw this.unimplemented('Not implemented on web.');
|
|
127
|
+
this.ensureJeepSqliteIsAvailable();
|
|
128
|
+
this.ensureWebstoreIsOpen();
|
|
129
|
+
try {
|
|
130
|
+
const executeResult = await this.jeepSqliteElement.executeSet(options);
|
|
131
|
+
return executeResult;
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
throw new Error(`${err}`);
|
|
248
135
|
}
|
|
249
136
|
}
|
|
250
137
|
async run(options) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
throw this.unimplemented('Not implemented on web.');
|
|
138
|
+
this.ensureJeepSqliteIsAvailable();
|
|
139
|
+
this.ensureWebstoreIsOpen();
|
|
140
|
+
try {
|
|
141
|
+
const runResult = await this.jeepSqliteElement.run(options);
|
|
142
|
+
return runResult;
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
throw new Error(`${err}`);
|
|
267
146
|
}
|
|
268
147
|
}
|
|
269
148
|
async query(options) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
throw this.unimplemented('Not implemented on web.');
|
|
149
|
+
this.ensureJeepSqliteIsAvailable();
|
|
150
|
+
this.ensureWebstoreIsOpen();
|
|
151
|
+
try {
|
|
152
|
+
const queryResult = await this.jeepSqliteElement.query(options);
|
|
153
|
+
return queryResult;
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
throw new Error(`${err}`);
|
|
286
157
|
}
|
|
287
158
|
}
|
|
288
159
|
async isDBExists(options) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
throw this.unimplemented('Not implemented on web.');
|
|
160
|
+
this.ensureJeepSqliteIsAvailable();
|
|
161
|
+
this.ensureWebstoreIsOpen();
|
|
162
|
+
try {
|
|
163
|
+
const dbExistsResult = await this.jeepSqliteElement.isDBExists(options);
|
|
164
|
+
return dbExistsResult;
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
throw new Error(`${err}`);
|
|
305
168
|
}
|
|
306
169
|
}
|
|
307
170
|
async isDBOpen(options) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
throw this.unimplemented('Not implemented on web.');
|
|
171
|
+
this.ensureJeepSqliteIsAvailable();
|
|
172
|
+
this.ensureWebstoreIsOpen();
|
|
173
|
+
try {
|
|
174
|
+
const isDBOpenResult = await this.jeepSqliteElement.isDBOpen(options);
|
|
175
|
+
return isDBOpenResult;
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
throw new Error(`${err}`);
|
|
324
179
|
}
|
|
325
180
|
}
|
|
326
181
|
async isDatabase(options) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
catch (err) {
|
|
336
|
-
return Promise.reject(`${err}`);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
throw this.unimplemented('Not implemented on web.');
|
|
182
|
+
this.ensureJeepSqliteIsAvailable();
|
|
183
|
+
this.ensureWebstoreIsOpen();
|
|
184
|
+
try {
|
|
185
|
+
const isDatabaseResult = await this.jeepSqliteElement.isDatabase(options);
|
|
186
|
+
return isDatabaseResult;
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
throw new Error(`${err}`);
|
|
345
190
|
}
|
|
346
191
|
}
|
|
347
192
|
async isTableExists(options) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
throw this.unimplemented('Not implemented on web.');
|
|
193
|
+
this.ensureJeepSqliteIsAvailable();
|
|
194
|
+
this.ensureWebstoreIsOpen();
|
|
195
|
+
try {
|
|
196
|
+
const tableExistsResult = await this.jeepSqliteElement.isTableExists(options);
|
|
197
|
+
return tableExistsResult;
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
throw new Error(`${err}`);
|
|
364
201
|
}
|
|
365
202
|
}
|
|
366
203
|
async deleteDatabase(options) {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
else {
|
|
378
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
throw this.unimplemented('Not implemented on web.');
|
|
204
|
+
this.ensureJeepSqliteIsAvailable();
|
|
205
|
+
this.ensureWebstoreIsOpen();
|
|
206
|
+
try {
|
|
207
|
+
await this.jeepSqliteElement.deleteDatabase(options);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
throw new Error(`${err}`);
|
|
383
212
|
}
|
|
384
213
|
}
|
|
385
214
|
async isJsonValid(options) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
catch (err) {
|
|
395
|
-
return Promise.reject(`${err}`);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
else {
|
|
403
|
-
throw this.unimplemented('Not implemented on web.');
|
|
215
|
+
this.ensureJeepSqliteIsAvailable();
|
|
216
|
+
this.ensureWebstoreIsOpen();
|
|
217
|
+
try {
|
|
218
|
+
const isJsonValidResult = await this.jeepSqliteElement.isJsonValid(options);
|
|
219
|
+
return isJsonValidResult;
|
|
220
|
+
}
|
|
221
|
+
catch (err) {
|
|
222
|
+
throw new Error(`${err}`);
|
|
404
223
|
}
|
|
405
224
|
}
|
|
406
225
|
async importFromJson(options) {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
catch (err) {
|
|
416
|
-
return Promise.reject(`${err}`);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
throw this.unimplemented('Not implemented on web.');
|
|
226
|
+
this.ensureJeepSqliteIsAvailable();
|
|
227
|
+
this.ensureWebstoreIsOpen();
|
|
228
|
+
try {
|
|
229
|
+
const importFromJsonResult = await this.jeepSqliteElement.importFromJson(options);
|
|
230
|
+
return importFromJsonResult;
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
throw new Error(`${err}`);
|
|
425
234
|
}
|
|
426
235
|
}
|
|
427
236
|
async exportToJson(options) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
else {
|
|
439
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
throw this.unimplemented('Not implemented on web.');
|
|
237
|
+
this.ensureJeepSqliteIsAvailable();
|
|
238
|
+
this.ensureWebstoreIsOpen();
|
|
239
|
+
try {
|
|
240
|
+
const exportToJsonResult = await this.jeepSqliteElement.exportToJson(options);
|
|
241
|
+
return exportToJsonResult;
|
|
242
|
+
}
|
|
243
|
+
catch (err) {
|
|
244
|
+
throw new Error(`${err}`);
|
|
444
245
|
}
|
|
445
246
|
}
|
|
446
247
|
async createSyncTable(options) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
else {
|
|
462
|
-
throw this.unimplemented('Not implemented on web.');
|
|
248
|
+
this.ensureJeepSqliteIsAvailable();
|
|
249
|
+
this.ensureWebstoreIsOpen();
|
|
250
|
+
try {
|
|
251
|
+
const createSyncTableResult = await this.jeepSqliteElement.createSyncTable(options);
|
|
252
|
+
return createSyncTableResult;
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
throw new Error(`${err}`);
|
|
463
256
|
}
|
|
464
257
|
}
|
|
465
258
|
async setSyncDate(options) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
throw this.unimplemented('Not implemented on web.');
|
|
259
|
+
this.ensureJeepSqliteIsAvailable();
|
|
260
|
+
this.ensureWebstoreIsOpen();
|
|
261
|
+
try {
|
|
262
|
+
await this.jeepSqliteElement.setSyncDate(options);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
catch (err) {
|
|
266
|
+
throw new Error(`${err}`);
|
|
482
267
|
}
|
|
483
268
|
}
|
|
484
269
|
async getSyncDate(options) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
270
|
+
this.ensureJeepSqliteIsAvailable();
|
|
271
|
+
this.ensureWebstoreIsOpen();
|
|
272
|
+
try {
|
|
273
|
+
const getSyncDateResult = await this.jeepSqliteElement.getSyncDate(options);
|
|
274
|
+
return getSyncDateResult;
|
|
275
|
+
}
|
|
276
|
+
catch (err) {
|
|
277
|
+
throw new Error(`${err}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async deleteExportedRows(options) {
|
|
281
|
+
this.ensureJeepSqliteIsAvailable();
|
|
282
|
+
this.ensureWebstoreIsOpen();
|
|
283
|
+
try {
|
|
284
|
+
await this.jeepSqliteElement.deleteExportedRows(options);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
catch (err) {
|
|
288
|
+
throw new Error(`${err}`);
|
|
501
289
|
}
|
|
502
290
|
}
|
|
503
291
|
async addUpgradeStatement(options) {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
else {
|
|
515
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
else {
|
|
519
|
-
throw this.unimplemented('Not implemented on web.');
|
|
292
|
+
this.ensureJeepSqliteIsAvailable();
|
|
293
|
+
this.ensureWebstoreIsOpen();
|
|
294
|
+
try {
|
|
295
|
+
await this.jeepSqliteElement.addUpgradeStatement(options);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
catch (err) {
|
|
299
|
+
throw new Error(`${err}`);
|
|
520
300
|
}
|
|
521
301
|
}
|
|
522
302
|
async copyFromAssets(options) {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
else {
|
|
534
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
else {
|
|
538
|
-
throw this.unimplemented('Not implemented on web.');
|
|
303
|
+
this.ensureJeepSqliteIsAvailable();
|
|
304
|
+
this.ensureWebstoreIsOpen();
|
|
305
|
+
try {
|
|
306
|
+
await this.jeepSqliteElement.copyFromAssets(options);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
catch (err) {
|
|
310
|
+
throw new Error(`${err}`);
|
|
539
311
|
}
|
|
540
312
|
}
|
|
541
313
|
async getDatabaseList() {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
314
|
+
this.ensureJeepSqliteIsAvailable();
|
|
315
|
+
this.ensureWebstoreIsOpen();
|
|
316
|
+
try {
|
|
317
|
+
const databaseListResult = await this.jeepSqliteElement.getDatabaseList();
|
|
318
|
+
return databaseListResult;
|
|
319
|
+
}
|
|
320
|
+
catch (err) {
|
|
321
|
+
throw new Error(`${err}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Checks if the `jeep-sqlite` element is present in the DOM.
|
|
326
|
+
* If it's not in the DOM, this method throws an Error.
|
|
327
|
+
*
|
|
328
|
+
* Attention: This will always fail, if the `intWebStore()` method wasn't called before.
|
|
329
|
+
*/
|
|
330
|
+
ensureJeepSqliteIsAvailable() {
|
|
331
|
+
if (this.jeepSqliteElement === null) {
|
|
332
|
+
throw new Error(`The jeep-sqlite element is not present in the DOM! Please check the @capacitor-community/sqlite documentation for instructions regarding the web platform.`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
ensureWebstoreIsOpen() {
|
|
336
|
+
if (!this.isWebStoreOpen) {
|
|
337
|
+
/**
|
|
338
|
+
* if (!this.isWebStoreOpen)
|
|
339
|
+
this.isWebStoreOpen = await this.jeepSqliteElement.isStoreOpen();
|
|
340
|
+
*/
|
|
341
|
+
throw new Error('WebStore is not open yet. You have to call "initWebStore()" first.');
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
////////////////////////////////////
|
|
345
|
+
////// UNIMPLEMENTED METHODS
|
|
346
|
+
////////////////////////////////////
|
|
347
|
+
async getUrl() {
|
|
348
|
+
throw this.unimplemented('Not implemented on web.');
|
|
561
349
|
}
|
|
562
350
|
async getMigratableDbList(options) {
|
|
563
351
|
console.log('getMigratableDbList', options);
|
|
@@ -571,5 +359,32 @@ export class CapacitorSQLiteWeb extends WebPlugin {
|
|
|
571
359
|
console.log('deleteOldDatabases', options);
|
|
572
360
|
throw this.unimplemented('Not implemented on web.');
|
|
573
361
|
}
|
|
362
|
+
async isSecretStored() {
|
|
363
|
+
throw this.unimplemented('Not implemented on web.');
|
|
364
|
+
}
|
|
365
|
+
async setEncryptionSecret(options) {
|
|
366
|
+
console.log('setEncryptionSecret', options);
|
|
367
|
+
throw this.unimplemented('Not implemented on web.');
|
|
368
|
+
}
|
|
369
|
+
async changeEncryptionSecret(options) {
|
|
370
|
+
console.log('changeEncryptionSecret', options);
|
|
371
|
+
throw this.unimplemented('Not implemented on web.');
|
|
372
|
+
}
|
|
373
|
+
async getNCDatabasePath(options) {
|
|
374
|
+
console.log('getNCDatabasePath', options);
|
|
375
|
+
throw this.unimplemented('Not implemented on web.');
|
|
376
|
+
}
|
|
377
|
+
async createNCConnection(options) {
|
|
378
|
+
console.log('createNCConnection', options);
|
|
379
|
+
throw this.unimplemented('Not implemented on web.');
|
|
380
|
+
}
|
|
381
|
+
async closeNCConnection(options) {
|
|
382
|
+
console.log('closeNCConnection', options);
|
|
383
|
+
throw this.unimplemented('Not implemented on web.');
|
|
384
|
+
}
|
|
385
|
+
async isNCDatabase(options) {
|
|
386
|
+
console.log('isNCDatabase', options);
|
|
387
|
+
throw this.unimplemented('Not implemented on web.');
|
|
388
|
+
}
|
|
574
389
|
}
|
|
575
390
|
//# sourceMappingURL=web.js.map
|