@capgo/capacitor-data-storage-sqlite 6.0.2 → 6.0.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/android/build.gradle +1 -1
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite/CapacitorDataStorageSqlite.java → capgocapacitordatastoragesqlite/CapgoCapacitorDataStorageSqlite.java} +7 -7
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite/CapacitorDataStorageSqlitePlugin.java → capgocapacitordatastoragesqlite/CapgoCapacitorDataStorageSqlitePlugin.java} +5 -5
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite → capgocapacitordatastoragesqlite}/RetHandler.java +1 -1
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite → capgocapacitordatastoragesqlite}/cdssUtils/Data.java +1 -1
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite → capgocapacitordatastoragesqlite}/cdssUtils/Global.java +1 -1
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite → capgocapacitordatastoragesqlite}/cdssUtils/ImportExportJson/JsonStore.java +1 -1
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite → capgocapacitordatastoragesqlite}/cdssUtils/ImportExportJson/JsonTable.java +1 -1
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite → capgocapacitordatastoragesqlite}/cdssUtils/ImportExportJson/JsonValue.java +1 -1
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite → capgocapacitordatastoragesqlite}/cdssUtils/StorageDatabaseHelper.java +4 -4
- package/android/src/main/java/com/jeep/plugin/capacitor/{capacitordatastoragesqlite → capgocapacitordatastoragesqlite}/cdssUtils/UtilsSQLCipher.java +1 -1
- package/dist/docs.json +2 -2
- package/dist/esm/definitions.d.ts +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +5 -5
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +6 -6
- package/dist/plugin.js.map +1 -1
- package/electron/dist/plugin.js +3 -3
- package/electron/dist/plugin.js.map +1 -1
- package/ios/Plugin/{CapacitorDataStorageSqlite.swift → CapgoCapacitorDataStorageSqlite.swift} +68 -68
- package/ios/Plugin/{CapacitorDataStorageSqlitePlugin.m → CapgoCapacitorDataStorageSqlitePlugin.m} +1 -1
- package/ios/Plugin/{CapacitorDataStorageSqlitePlugin.swift → CapgoCapacitorDataStorageSqlitePlugin.swift} +24 -24
- package/package.json +3 -3
- package/CapacitorDataStorageSqlite.podspec +0 -18
- /package/ios/Plugin/{CapacitorDataStorageSqlitePlugin.h → CapgoCapacitorDataStorageSqlitePlugin.h} +0 -0
package/ios/Plugin/{CapacitorDataStorageSqlite.swift → CapgoCapacitorDataStorageSqlite.swift}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
-
enum
|
|
3
|
+
enum CapgoCapacitorDataStorageSqliteError: Error {
|
|
4
4
|
case failed(message: String)
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
// swiftlint:disable file_length
|
|
8
8
|
// swiftlint:disable type_body_length
|
|
9
|
-
@objc public class
|
|
9
|
+
@objc public class CapgoCapacitorDataStorageSqlite: NSObject {
|
|
10
10
|
var mDb: StorageDatabaseHelper?
|
|
11
11
|
|
|
12
12
|
// MARK: - Echo
|
|
@@ -26,14 +26,14 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
26
26
|
tableName: tableName,
|
|
27
27
|
encrypted: encrypted, mode: inMode)
|
|
28
28
|
} catch StorageHelperError.initFailed(let message) {
|
|
29
|
-
throw
|
|
29
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
30
30
|
.failed(message: message)
|
|
31
31
|
} catch let error {
|
|
32
|
-
throw
|
|
32
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
33
33
|
.failed(message: error.localizedDescription)
|
|
34
34
|
}
|
|
35
35
|
if !(mDb?.isOpen ?? true) {
|
|
36
|
-
throw
|
|
36
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
37
37
|
.failed(message: "store not opened")
|
|
38
38
|
} else {
|
|
39
39
|
return
|
|
@@ -49,16 +49,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
49
49
|
try mDb?.close()
|
|
50
50
|
return
|
|
51
51
|
} catch StorageHelperError.close(let message) {
|
|
52
|
-
throw
|
|
52
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
53
53
|
.failed(message: message)
|
|
54
54
|
} catch let error {
|
|
55
55
|
let msg = error.localizedDescription
|
|
56
|
-
throw
|
|
56
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
57
57
|
.failed(message: msg)
|
|
58
58
|
}
|
|
59
59
|
} else {
|
|
60
60
|
let message = "No database connection"
|
|
61
|
-
throw
|
|
61
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
62
62
|
.failed(message: message)
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -88,7 +88,7 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
88
88
|
}
|
|
89
89
|
} else {
|
|
90
90
|
let message = "No database connection"
|
|
91
|
-
throw
|
|
91
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
92
92
|
.failed(message: message)
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -102,15 +102,15 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
102
102
|
try mDb?.setTable(tblName: tableName)
|
|
103
103
|
return
|
|
104
104
|
} catch StorageHelperError.setTable(let message) {
|
|
105
|
-
throw
|
|
105
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
106
106
|
.failed(message: message)
|
|
107
107
|
} catch let error {
|
|
108
|
-
throw
|
|
108
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
109
109
|
.failed(message: error.localizedDescription)
|
|
110
110
|
}
|
|
111
111
|
} else {
|
|
112
112
|
let message = "Must open a store first"
|
|
113
|
-
throw
|
|
113
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
114
114
|
.failed(message: message)
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -123,21 +123,21 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
123
123
|
do {
|
|
124
124
|
try mDb?.set(data: mData)
|
|
125
125
|
} catch StorageHelperError.setkey(let message) {
|
|
126
|
-
throw
|
|
126
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
127
127
|
.failed(message: message)
|
|
128
128
|
} catch let error {
|
|
129
129
|
let msg = error.localizedDescription
|
|
130
|
-
throw
|
|
130
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
131
131
|
.failed(message: msg)
|
|
132
132
|
}
|
|
133
133
|
} else {
|
|
134
134
|
let message = "data is not of type Data"
|
|
135
|
-
throw
|
|
135
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
136
136
|
.failed(message: message)
|
|
137
137
|
}
|
|
138
138
|
} else {
|
|
139
139
|
let message = "No database connection"
|
|
140
|
-
throw
|
|
140
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
141
141
|
.failed(message: message)
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -156,23 +156,23 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
156
156
|
}
|
|
157
157
|
} else {
|
|
158
158
|
let message = "No Data returned"
|
|
159
|
-
throw
|
|
159
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
160
160
|
.failed(message: message)
|
|
161
161
|
}
|
|
162
|
-
} catch
|
|
163
|
-
throw
|
|
162
|
+
} catch CapgoCapacitorDataStorageSqliteError.failed(let message) {
|
|
163
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
164
164
|
.failed(message: message)
|
|
165
165
|
} catch StorageHelperError.getkey(let message) {
|
|
166
|
-
throw
|
|
166
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
167
167
|
.failed(message: message)
|
|
168
168
|
} catch let error {
|
|
169
169
|
let msg = error.localizedDescription
|
|
170
|
-
throw
|
|
170
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
171
171
|
.failed(message: msg)
|
|
172
172
|
}
|
|
173
173
|
} else {
|
|
174
174
|
let message = "No database connection"
|
|
175
|
-
throw
|
|
175
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
176
176
|
.failed(message: message)
|
|
177
177
|
}
|
|
178
178
|
}
|
|
@@ -185,16 +185,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
185
185
|
try mDb?.remove(name: name)
|
|
186
186
|
return
|
|
187
187
|
} catch StorageHelperError.remove(let message) {
|
|
188
|
-
throw
|
|
188
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
189
189
|
.failed(message: message)
|
|
190
190
|
} catch let error {
|
|
191
191
|
let msg = error.localizedDescription
|
|
192
|
-
throw
|
|
192
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
193
193
|
.failed(message: msg)
|
|
194
194
|
}
|
|
195
195
|
} else {
|
|
196
196
|
let message = "No database connection"
|
|
197
|
-
throw
|
|
197
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
198
198
|
.failed(message: message)
|
|
199
199
|
}
|
|
200
200
|
|
|
@@ -208,16 +208,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
208
208
|
try mDb?.clear()
|
|
209
209
|
return
|
|
210
210
|
} catch StorageHelperError.clear(let message) {
|
|
211
|
-
throw
|
|
211
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
212
212
|
.failed(message: message)
|
|
213
213
|
} catch let error {
|
|
214
214
|
let msg = error.localizedDescription
|
|
215
|
-
throw
|
|
215
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
216
216
|
.failed(message: msg)
|
|
217
217
|
}
|
|
218
218
|
} else {
|
|
219
219
|
let message = "No database connection"
|
|
220
|
-
throw
|
|
220
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
221
221
|
.failed(message: message)
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -235,16 +235,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
235
235
|
return 0
|
|
236
236
|
}
|
|
237
237
|
} catch StorageHelperError.iskey(let message) {
|
|
238
|
-
throw
|
|
238
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
239
239
|
.failed(message: message)
|
|
240
240
|
} catch let error {
|
|
241
241
|
let msg = error.localizedDescription
|
|
242
|
-
throw
|
|
242
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
243
243
|
.failed(message: msg)
|
|
244
244
|
}
|
|
245
245
|
} else {
|
|
246
246
|
let message = "No database connection"
|
|
247
|
-
throw
|
|
247
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
248
248
|
.failed(message: message)
|
|
249
249
|
}
|
|
250
250
|
}
|
|
@@ -257,16 +257,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
257
257
|
let result = try mDb?.keys() ?? []
|
|
258
258
|
return result
|
|
259
259
|
} catch StorageHelperError.keys(let message) {
|
|
260
|
-
throw
|
|
260
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
261
261
|
.failed(message: message)
|
|
262
262
|
} catch let error {
|
|
263
263
|
let msg = error.localizedDescription
|
|
264
|
-
throw
|
|
264
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
265
265
|
.failed(message: msg)
|
|
266
266
|
}
|
|
267
267
|
} else {
|
|
268
268
|
let message = "No database connection"
|
|
269
|
-
throw
|
|
269
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
270
270
|
.failed(message: message)
|
|
271
271
|
}
|
|
272
272
|
}
|
|
@@ -279,16 +279,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
279
279
|
let result = try mDb?.values() ?? []
|
|
280
280
|
return result
|
|
281
281
|
} catch StorageHelperError.values(let message) {
|
|
282
|
-
throw
|
|
282
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
283
283
|
.failed(message: message)
|
|
284
284
|
} catch let error {
|
|
285
285
|
let msg = error.localizedDescription
|
|
286
|
-
throw
|
|
286
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
287
287
|
.failed(message: msg)
|
|
288
288
|
}
|
|
289
289
|
} else {
|
|
290
290
|
let message = "No database connection"
|
|
291
|
-
throw
|
|
291
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
292
292
|
.failed(message: message)
|
|
293
293
|
}
|
|
294
294
|
}
|
|
@@ -302,16 +302,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
302
302
|
return result
|
|
303
303
|
|
|
304
304
|
} catch StorageHelperError.filtervalues(let message) {
|
|
305
|
-
throw
|
|
305
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
306
306
|
.failed(message: message)
|
|
307
307
|
} catch let error {
|
|
308
308
|
let msg = error.localizedDescription
|
|
309
|
-
throw
|
|
309
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
310
310
|
.failed(message: msg)
|
|
311
311
|
}
|
|
312
312
|
} else {
|
|
313
313
|
let message = "No database connection"
|
|
314
|
-
throw
|
|
314
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
315
315
|
.failed(message: message)
|
|
316
316
|
}
|
|
317
317
|
}
|
|
@@ -331,16 +331,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
331
331
|
return dicArray
|
|
332
332
|
|
|
333
333
|
} catch StorageHelperError.keysvalues(let message) {
|
|
334
|
-
throw
|
|
334
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
335
335
|
.failed(message: message)
|
|
336
336
|
} catch let error {
|
|
337
337
|
let msg = error.localizedDescription
|
|
338
|
-
throw
|
|
338
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
339
339
|
.failed(message: msg)
|
|
340
340
|
}
|
|
341
341
|
} else {
|
|
342
342
|
let message = "No database connection"
|
|
343
|
-
throw
|
|
343
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
344
344
|
.failed(message: message)
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -353,11 +353,11 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
353
353
|
return
|
|
354
354
|
} catch UtilsFileError.deleteFileFailed {
|
|
355
355
|
let message = "Failed in delete file"
|
|
356
|
-
throw
|
|
356
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
357
357
|
.failed(message: message)
|
|
358
358
|
} catch let error {
|
|
359
359
|
let msg = error.localizedDescription
|
|
360
|
-
throw
|
|
360
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
361
361
|
.failed(message: msg)
|
|
362
362
|
}
|
|
363
363
|
}
|
|
@@ -374,16 +374,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
374
374
|
return 0
|
|
375
375
|
}
|
|
376
376
|
} catch StorageHelperError.isTable(let message) {
|
|
377
|
-
throw
|
|
377
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
378
378
|
.failed(message: message)
|
|
379
379
|
} catch let error {
|
|
380
380
|
let msg = error.localizedDescription
|
|
381
|
-
throw
|
|
381
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
382
382
|
.failed(message: msg)
|
|
383
383
|
}
|
|
384
384
|
} else {
|
|
385
385
|
let message = "No database connection"
|
|
386
|
-
throw
|
|
386
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
387
387
|
.failed(message: message)
|
|
388
388
|
}
|
|
389
389
|
}
|
|
@@ -396,16 +396,16 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
396
396
|
let result = try mDb?.tables() ?? []
|
|
397
397
|
return result
|
|
398
398
|
} catch StorageHelperError.tables(let message) {
|
|
399
|
-
throw
|
|
399
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
400
400
|
.failed(message: message)
|
|
401
401
|
} catch let error {
|
|
402
402
|
let msg = error.localizedDescription
|
|
403
|
-
throw
|
|
403
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
404
404
|
.failed(message: msg)
|
|
405
405
|
}
|
|
406
406
|
} else {
|
|
407
407
|
let message = "No database connection"
|
|
408
|
-
throw
|
|
408
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
409
409
|
.failed(message: message)
|
|
410
410
|
}
|
|
411
411
|
}
|
|
@@ -419,15 +419,15 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
419
419
|
try mDb?.deleteTable(tableName: tableName)
|
|
420
420
|
return
|
|
421
421
|
} catch StorageHelperError.deleteTable(let message) {
|
|
422
|
-
throw
|
|
422
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
423
423
|
.failed(message: message)
|
|
424
424
|
} catch let error {
|
|
425
|
-
throw
|
|
425
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
426
426
|
.failed(message: error.localizedDescription)
|
|
427
427
|
}
|
|
428
428
|
} else {
|
|
429
429
|
let message = "Must open a store first"
|
|
430
|
-
throw
|
|
430
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
431
431
|
.failed(message: message)
|
|
432
432
|
}
|
|
433
433
|
}
|
|
@@ -443,11 +443,11 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
443
443
|
return
|
|
444
444
|
} catch let error {
|
|
445
445
|
let msg: String = "\(error.localizedDescription)"
|
|
446
|
-
throw
|
|
446
|
+
throw CapgoCapacitorDataStorageSqliteError.failed(message: msg)
|
|
447
447
|
}
|
|
448
448
|
} else {
|
|
449
449
|
let msg: String = "Stringify Json Object not Valid"
|
|
450
|
-
throw
|
|
450
|
+
throw CapgoCapacitorDataStorageSqliteError.failed(message: msg)
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
|
|
@@ -466,7 +466,7 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
466
466
|
} catch let error {
|
|
467
467
|
var msg: String = "Stringify Json Object not Valid "
|
|
468
468
|
msg.append("\(error.localizedDescription)")
|
|
469
|
-
throw
|
|
469
|
+
throw CapgoCapacitorDataStorageSqliteError.failed(message: msg)
|
|
470
470
|
}
|
|
471
471
|
var totalChanges = 0
|
|
472
472
|
let encrypted: Bool = jsonStore[0].encrypted
|
|
@@ -480,7 +480,7 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
480
480
|
tableName: table.name,
|
|
481
481
|
encrypted: encrypted, mode: mode)
|
|
482
482
|
if !(mDb.isOpen ) {
|
|
483
|
-
throw
|
|
483
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
484
484
|
.failed(message: "store not opened")
|
|
485
485
|
}
|
|
486
486
|
|
|
@@ -489,7 +489,7 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
489
489
|
.importFromJson(values: table.values)
|
|
490
490
|
if changes < 1 {
|
|
491
491
|
let msg: String = "changes < 1"
|
|
492
|
-
throw
|
|
492
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
493
493
|
.failed(message: msg)
|
|
494
494
|
}
|
|
495
495
|
try mDb.close()
|
|
@@ -497,29 +497,29 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
497
497
|
}
|
|
498
498
|
return ["changes": totalChanges]
|
|
499
499
|
} catch StorageHelperError.initFailed(let message) {
|
|
500
|
-
throw
|
|
500
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
501
501
|
.failed(message: message)
|
|
502
502
|
} catch StorageHelperError.close(let message) {
|
|
503
|
-
throw
|
|
503
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
504
504
|
.failed(message: message)
|
|
505
505
|
} catch StorageHelperError.importFromJson(let message) {
|
|
506
506
|
let msg = message
|
|
507
507
|
do {
|
|
508
508
|
try closeStore(dbName)
|
|
509
|
-
throw
|
|
509
|
+
throw CapgoCapacitorDataStorageSqliteError.failed(message: msg)
|
|
510
510
|
} catch let error {
|
|
511
|
-
throw
|
|
511
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
512
512
|
.failed(message: error.localizedDescription)
|
|
513
513
|
}
|
|
514
514
|
} catch let error {
|
|
515
515
|
print("\(error)")
|
|
516
|
-
throw
|
|
516
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
517
517
|
.failed(message: error.localizedDescription)
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
} else {
|
|
521
521
|
let msg: String = "Stringify Json Object not Valid"
|
|
522
|
-
throw
|
|
522
|
+
throw CapgoCapacitorDataStorageSqliteError.failed(message: msg)
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
// swiftlint:enable function_body_length
|
|
@@ -534,14 +534,14 @@ enum CapacitorDataStorageSqliteError: Error {
|
|
|
534
534
|
mDb?.exportToJson() ?? [:]
|
|
535
535
|
return res
|
|
536
536
|
} catch StorageHelperError.exportToJson(let message) {
|
|
537
|
-
throw
|
|
537
|
+
throw CapgoCapacitorDataStorageSqliteError.failed(message: message)
|
|
538
538
|
} catch let error {
|
|
539
539
|
let msg: String = "\(error.localizedDescription)"
|
|
540
|
-
throw
|
|
540
|
+
throw CapgoCapacitorDataStorageSqliteError.failed(message: msg)
|
|
541
541
|
}
|
|
542
542
|
} else {
|
|
543
543
|
let message = "Must open a store first"
|
|
544
|
-
throw
|
|
544
|
+
throw CapgoCapacitorDataStorageSqliteError
|
|
545
545
|
.failed(message: message)
|
|
546
546
|
}
|
|
547
547
|
}
|
package/ios/Plugin/{CapacitorDataStorageSqlitePlugin.m → CapgoCapacitorDataStorageSqlitePlugin.m}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
5
|
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
-
CAP_PLUGIN(
|
|
6
|
+
CAP_PLUGIN(CapgoCapacitorDataStorageSqlitePlugin, "CapgoCapacitorDataStorageSqlite",
|
|
7
7
|
CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(openStore, CAPPluginReturnPromise);
|
|
9
9
|
CAP_PLUGIN_METHOD(closeStore, CAPPluginReturnPromise);
|
|
@@ -3,9 +3,9 @@ import Capacitor
|
|
|
3
3
|
|
|
4
4
|
// swiftlint:disable file_length
|
|
5
5
|
// swiftlint:disable type_body_length
|
|
6
|
-
@objc(
|
|
7
|
-
public class
|
|
8
|
-
private let implementation =
|
|
6
|
+
@objc(CapgoCapacitorDataStorageSqlitePlugin)
|
|
7
|
+
public class CapgoCapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
8
|
+
private let implementation = CapgoCapacitorDataStorageSqlite()
|
|
9
9
|
private let retHandler: ReturnHandler = ReturnHandler()
|
|
10
10
|
|
|
11
11
|
// MARK: - Echo
|
|
@@ -45,7 +45,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
45
45
|
encrypted: encrypted, inMode: inMode)
|
|
46
46
|
retHandler.rResult(call: call)
|
|
47
47
|
return
|
|
48
|
-
} catch
|
|
48
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
49
49
|
.failed(let message) {
|
|
50
50
|
let msg = "openStore: \(message)"
|
|
51
51
|
retHandler.rResult(call: call, message: msg)
|
|
@@ -72,7 +72,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
72
72
|
try implementation.closeStore(database)
|
|
73
73
|
retHandler.rResult(call: call)
|
|
74
74
|
return
|
|
75
|
-
} catch
|
|
75
|
+
} catch CapgoCapacitorDataStorageSqliteError.failed(let message) {
|
|
76
76
|
let msg = "closeStore: \(message)"
|
|
77
77
|
retHandler.rResult(call: call, ret: false, message: msg)
|
|
78
78
|
return
|
|
@@ -98,7 +98,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
98
98
|
let ret = res == 1 ? true : false
|
|
99
99
|
retHandler.rResult(call: call, ret: ret)
|
|
100
100
|
return
|
|
101
|
-
} catch
|
|
101
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
102
102
|
.failed(let message) {
|
|
103
103
|
let msg = "isStoreOpen: \(message)"
|
|
104
104
|
retHandler.rResult(call: call, ret: false, message: msg)
|
|
@@ -125,7 +125,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
125
125
|
let ret = res == 1 ? true : false
|
|
126
126
|
retHandler.rResult(call: call, ret: ret)
|
|
127
127
|
return
|
|
128
|
-
} catch
|
|
128
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
129
129
|
.failed(let message) {
|
|
130
130
|
let msg = "isStoreExists: \(message)"
|
|
131
131
|
retHandler.rResult(call: call, ret: false, message: msg)
|
|
@@ -151,7 +151,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
151
151
|
try implementation.setTable(tableName)
|
|
152
152
|
retHandler.rResult(call: call)
|
|
153
153
|
return
|
|
154
|
-
} catch
|
|
154
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
155
155
|
.failed(let message) {
|
|
156
156
|
let msg = "setTable: \(message)"
|
|
157
157
|
retHandler.rResult(call: call, message: msg)
|
|
@@ -186,7 +186,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
186
186
|
try implementation.set(data)
|
|
187
187
|
retHandler.rResult(call: call)
|
|
188
188
|
return
|
|
189
|
-
} catch
|
|
189
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
190
190
|
.failed(let message) {
|
|
191
191
|
let msg = "set: \(message)"
|
|
192
192
|
retHandler.rResult(call: call, message: msg)
|
|
@@ -212,7 +212,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
212
212
|
let ret = try implementation.get(key)
|
|
213
213
|
retHandler.rValue(call: call, ret: ret)
|
|
214
214
|
return
|
|
215
|
-
} catch
|
|
215
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
216
216
|
.failed(let message) {
|
|
217
217
|
let msg = "get: \(message)"
|
|
218
218
|
retHandler.rValue(call: call, ret: "", message: msg)
|
|
@@ -238,7 +238,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
238
238
|
try implementation.remove(key)
|
|
239
239
|
retHandler.rResult(call: call)
|
|
240
240
|
return
|
|
241
|
-
} catch
|
|
241
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
242
242
|
.failed(let message) {
|
|
243
243
|
let msg = "remove: \(message)"
|
|
244
244
|
retHandler.rResult(call: call, message: msg)
|
|
@@ -259,7 +259,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
259
259
|
try implementation.clear()
|
|
260
260
|
retHandler.rResult(call: call)
|
|
261
261
|
return
|
|
262
|
-
} catch
|
|
262
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
263
263
|
.failed(let message) {
|
|
264
264
|
let msg = "clear: \(message)"
|
|
265
265
|
retHandler.rResult(call: call, message: msg)
|
|
@@ -285,7 +285,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
285
285
|
let ret = res == 1 ? true : false
|
|
286
286
|
retHandler.rResult(call: call, ret: ret)
|
|
287
287
|
return
|
|
288
|
-
} catch
|
|
288
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
289
289
|
.failed(let message) {
|
|
290
290
|
let msg = "iskey: \(message)"
|
|
291
291
|
retHandler.rResult(call: call, ret: false, message: msg)
|
|
@@ -304,7 +304,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
304
304
|
do {
|
|
305
305
|
let ret = try implementation.keys()
|
|
306
306
|
retHandler.rDict(call: call, ret: ["keys": ret])
|
|
307
|
-
} catch
|
|
307
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
308
308
|
.failed(let message) {
|
|
309
309
|
let msg = "keys: \(message)"
|
|
310
310
|
retHandler.rDict(call: call, ret: ["keys": []], message: msg)
|
|
@@ -322,7 +322,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
322
322
|
do {
|
|
323
323
|
let ret = try implementation.values()
|
|
324
324
|
retHandler.rDict(call: call, ret: ["values": ret])
|
|
325
|
-
} catch
|
|
325
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
326
326
|
.failed(let message) {
|
|
327
327
|
let msg = "values: \(message)"
|
|
328
328
|
retHandler.rDict(call: call, ret: ["values": []], message: msg)
|
|
@@ -346,7 +346,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
346
346
|
do {
|
|
347
347
|
let ret = try implementation.filtervalues(filter: filter)
|
|
348
348
|
retHandler.rDict(call: call, ret: ["values": ret])
|
|
349
|
-
} catch
|
|
349
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
350
350
|
.failed(let message) {
|
|
351
351
|
let msg = "values: \(message)"
|
|
352
352
|
retHandler.rDict(call: call, ret: ["values": []], message: msg)
|
|
@@ -364,7 +364,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
364
364
|
do {
|
|
365
365
|
let ret = try implementation.keysvalues()
|
|
366
366
|
retHandler.rDict(call: call, ret: ["keysvalues": ret])
|
|
367
|
-
} catch
|
|
367
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
368
368
|
.failed(let message) {
|
|
369
369
|
let msg = "keysvalues: \(message)"
|
|
370
370
|
retHandler.rDict(call: call, ret: ["keysvalues": []],
|
|
@@ -387,7 +387,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
387
387
|
try implementation.deleteStore(storeName: storeName)
|
|
388
388
|
retHandler.rResult(call: call)
|
|
389
389
|
return
|
|
390
|
-
} catch
|
|
390
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
391
391
|
.failed(let message) {
|
|
392
392
|
let msg = "set: \(message)"
|
|
393
393
|
retHandler.rResult(call: call, message: msg)
|
|
@@ -413,7 +413,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
413
413
|
let ret = res == 1 ? true : false
|
|
414
414
|
retHandler.rResult(call: call, ret: ret)
|
|
415
415
|
return
|
|
416
|
-
} catch
|
|
416
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
417
417
|
.failed(let message) {
|
|
418
418
|
let msg = "istable: \(message)"
|
|
419
419
|
retHandler.rResult(call: call, ret: false, message: msg)
|
|
@@ -431,7 +431,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
431
431
|
do {
|
|
432
432
|
let ret = try implementation.tables()
|
|
433
433
|
retHandler.rDict(call: call, ret: ["tables": ret])
|
|
434
|
-
} catch
|
|
434
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
435
435
|
.failed(let message) {
|
|
436
436
|
let msg = "tables: \(message)"
|
|
437
437
|
retHandler.rDict(call: call, ret: ["tables": []], message: msg)
|
|
@@ -456,7 +456,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
456
456
|
try implementation.deleteTable(table)
|
|
457
457
|
retHandler.rResult(call: call)
|
|
458
458
|
return
|
|
459
|
-
} catch
|
|
459
|
+
} catch CapgoCapacitorDataStorageSqliteError
|
|
460
460
|
.failed(let message) {
|
|
461
461
|
let msg = "clear: \(message)"
|
|
462
462
|
retHandler.rResult(call: call, message: msg)
|
|
@@ -482,7 +482,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
482
482
|
try implementation.isJsonValid(parsingData)
|
|
483
483
|
retHandler.rResult(call: call, ret: true)
|
|
484
484
|
return
|
|
485
|
-
} catch
|
|
485
|
+
} catch CapgoCapacitorDataStorageSqliteError.failed(let message) {
|
|
486
486
|
let msg = "isJsonValid: \(message)"
|
|
487
487
|
retHandler.rResult(call: call, message: msg)
|
|
488
488
|
return
|
|
@@ -507,7 +507,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
507
507
|
let res: [String: Int] = try implementation.importFromJson(parsingData)
|
|
508
508
|
retHandler.rChanges(call: call, ret: res)
|
|
509
509
|
return
|
|
510
|
-
} catch
|
|
510
|
+
} catch CapgoCapacitorDataStorageSqliteError.failed(let message) {
|
|
511
511
|
retHandler.rChanges(
|
|
512
512
|
call: call, ret: ["changes": -1],
|
|
513
513
|
message: "importFromJson: \(message)")
|
|
@@ -531,7 +531,7 @@ public class CapacitorDataStorageSqlitePlugin: CAPPlugin {
|
|
|
531
531
|
let res: [String: Any] = try implementation.exportToJson()
|
|
532
532
|
retHandler.rJsonStore(call: call, ret: res)
|
|
533
533
|
return
|
|
534
|
-
} catch
|
|
534
|
+
} catch CapgoCapacitorDataStorageSqliteError.failed(let message) {
|
|
535
535
|
let msg = "exportToJson: \(message)"
|
|
536
536
|
retHandler.rJsonStore(call: call, ret: [:],
|
|
537
537
|
message: msg)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-data-storage-sqlite",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"description": "SQLite Storage of key/value strings pair",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dist/",
|
|
13
13
|
"ios/Plugin/",
|
|
14
14
|
"electron/",
|
|
15
|
-
"
|
|
15
|
+
"CapgoCapacitorDataStorageSqlite.podspec"
|
|
16
16
|
],
|
|
17
17
|
"author": "Martin Donadieu",
|
|
18
18
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"eslint": "eslint .",
|
|
43
43
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
44
44
|
"swiftlint": "node-swiftlint",
|
|
45
|
-
"docgen": "docgen --api
|
|
45
|
+
"docgen": "docgen --api CapgoCapacitorDataStorageSqlitePlugin --output-readme docs/API.md --output-json dist/docs.json",
|
|
46
46
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs && npm run build-electron",
|
|
47
47
|
"build-electron": "tsc --project electron/tsconfig.json && rollup -c electron/rollup.config.mjs && rimraf ./electron/build",
|
|
48
48
|
"clean": "rimraf ./dist",
|