@capgo/capacitor-data-storage-sqlite 6.0.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/CapacitorDataStorageSqlite.podspec +18 -0
- package/LICENSE +21 -0
- package/android/build.gradle +63 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/CapacitorDataStorageSqlite.java +387 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/CapacitorDataStorageSqlitePlugin.java +447 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/RetHandler.java +117 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/cdssUtils/Data.java +8 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/cdssUtils/Global.java +7 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonStore.java +131 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonTable.java +110 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonValue.java +89 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/cdssUtils/StorageDatabaseHelper.java +691 -0
- package/android/src/main/java/com/jeep/plugin/capacitor/capacitordatastoragesqlite/cdssUtils/UtilsSQLCipher.java +162 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +995 -0
- package/dist/esm/definitions.d.ts +296 -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 +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web-utils/Data.d.ts +5 -0
- package/dist/esm/web-utils/Data.js +3 -0
- package/dist/esm/web-utils/Data.js.map +1 -0
- package/dist/esm/web-utils/StorageDatabaseHelper.d.ts +23 -0
- package/dist/esm/web-utils/StorageDatabaseHelper.js +247 -0
- package/dist/esm/web-utils/StorageDatabaseHelper.js.map +1 -0
- package/dist/esm/web-utils/json-utils.d.ts +15 -0
- package/dist/esm/web-utils/json-utils.js +76 -0
- package/dist/esm/web-utils/json-utils.js.map +1 -0
- package/dist/esm/web.d.ts +27 -0
- package/dist/esm/web.js +295 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +633 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +635 -0
- package/dist/plugin.js.map +1 -0
- package/electron/dist/plugin.js +1044 -0
- package/electron/dist/plugin.js.map +1 -0
- package/electron/rollup.config.mjs +17 -0
- package/electron/tsconfig.json +19 -0
- package/ios/Plugin/CapacitorDataStorageSqlite.swift +550 -0
- package/ios/Plugin/CapacitorDataStorageSqlitePlugin.h +10 -0
- package/ios/Plugin/CapacitorDataStorageSqlitePlugin.m +29 -0
- package/ios/Plugin/CapacitorDataStorageSqlitePlugin.swift +550 -0
- package/ios/Plugin/Data.swift +16 -0
- package/ios/Plugin/Global.swift +13 -0
- package/ios/Plugin/ImportExportJson/JsonStore.swift +47 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/ReturnHandler.swift +85 -0
- package/ios/Plugin/StorageDatabaseHelper.swift +603 -0
- package/ios/Plugin/Utils/Blob.swift +41 -0
- package/ios/Plugin/Utils/UtilsBinding.swift +73 -0
- package/ios/Plugin/Utils/UtilsEncryption.swift +79 -0
- package/ios/Plugin/Utils/UtilsFile.swift +244 -0
- package/ios/Plugin/Utils/UtilsSQLCipher.swift +605 -0
- package/package.json +96 -0
- package/readme.md +203 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
package com.jeep.plugin.capacitor.capacitordatastoragesqlite.cdssUtils.ImportExportJson;
|
|
2
|
+
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
import com.getcapacitor.JSObject;
|
|
5
|
+
import java.util.ArrayList;
|
|
6
|
+
import java.util.Arrays;
|
|
7
|
+
import java.util.Iterator;
|
|
8
|
+
import java.util.List;
|
|
9
|
+
import org.json.JSONArray;
|
|
10
|
+
import org.json.JSONException;
|
|
11
|
+
import org.json.JSONObject;
|
|
12
|
+
|
|
13
|
+
public class JsonTable {
|
|
14
|
+
|
|
15
|
+
private static final String TAG = "JsonTable";
|
|
16
|
+
private static final List<String> keyTableLevel = new ArrayList<String>(
|
|
17
|
+
Arrays.asList("name", "values")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
private String name = "";
|
|
21
|
+
private ArrayList<JsonValue> values = new ArrayList<JsonValue>();
|
|
22
|
+
|
|
23
|
+
// Getter
|
|
24
|
+
public String getName() {
|
|
25
|
+
return name;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public ArrayList<JsonValue> getValues() {
|
|
29
|
+
return values;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Setter
|
|
33
|
+
public void setName(String newName) {
|
|
34
|
+
this.name = newName;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public void setValues(ArrayList<JsonValue> newValues) {
|
|
38
|
+
this.values = newValues;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public ArrayList<String> getKeys() {
|
|
42
|
+
ArrayList<String> retArray = new ArrayList<String>();
|
|
43
|
+
if (getName().length() > 0) retArray.add("names");
|
|
44
|
+
if (getValues().size() > 0) retArray.add("values");
|
|
45
|
+
return retArray;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public boolean isTable(JSONObject jsObj) {
|
|
49
|
+
if (jsObj == null || jsObj.length() == 0) return false;
|
|
50
|
+
Iterator<String> keys = jsObj.keys();
|
|
51
|
+
while (keys.hasNext()) {
|
|
52
|
+
String key = keys.next();
|
|
53
|
+
if (!keyTableLevel.contains(key)) return false;
|
|
54
|
+
try {
|
|
55
|
+
Object value = jsObj.get(key);
|
|
56
|
+
if (key.equals("name")) {
|
|
57
|
+
if (!(value instanceof String)) {
|
|
58
|
+
return false;
|
|
59
|
+
} else {
|
|
60
|
+
name = (String) value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (key.equals("values")) {
|
|
64
|
+
if (!(value instanceof JSONArray) && !(value instanceof ArrayList)) {
|
|
65
|
+
return false;
|
|
66
|
+
} else {
|
|
67
|
+
values = new ArrayList<JsonValue>();
|
|
68
|
+
JSONArray arr = jsObj.getJSONArray(key);
|
|
69
|
+
for (int i = 0; i < arr.length(); i++) {
|
|
70
|
+
JSONObject row = arr.getJSONObject(i);
|
|
71
|
+
JsonValue arrRow = new JsonValue();
|
|
72
|
+
arrRow.setKey(row.getString("key"));
|
|
73
|
+
arrRow.setValue(row.getString("value"));
|
|
74
|
+
values.add(arrRow);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
} catch (JSONException e) {
|
|
79
|
+
e.printStackTrace();
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public void print() {
|
|
87
|
+
Log.d(TAG, "name: " + this.getName());
|
|
88
|
+
Log.d(TAG, "number of Values: " + this.getValues().size());
|
|
89
|
+
for (JsonValue row : this.getValues()) {
|
|
90
|
+
Log.d(TAG, "row: " + row);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public JSObject getTableAsJSObject() {
|
|
95
|
+
JSObject retObj = new JSObject();
|
|
96
|
+
retObj.put("name", getName());
|
|
97
|
+
JSONArray JSValues = new JSONArray();
|
|
98
|
+
if (this.values.size() > 0) {
|
|
99
|
+
if (this.values.size() > 0) {
|
|
100
|
+
for (JsonValue jVal : this.values) {
|
|
101
|
+
JSValues.put(jVal.getValueAsJSObject());
|
|
102
|
+
}
|
|
103
|
+
retObj.put("values", JSValues);
|
|
104
|
+
}
|
|
105
|
+
retObj.put("values", JSValues);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return retObj;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
package com.jeep.plugin.capacitor.capacitordatastoragesqlite.cdssUtils.ImportExportJson;
|
|
2
|
+
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
import com.getcapacitor.JSObject;
|
|
5
|
+
import java.util.ArrayList;
|
|
6
|
+
import java.util.Arrays;
|
|
7
|
+
import java.util.Iterator;
|
|
8
|
+
import java.util.List;
|
|
9
|
+
import org.json.JSONException;
|
|
10
|
+
import org.json.JSONObject;
|
|
11
|
+
|
|
12
|
+
public class JsonValue {
|
|
13
|
+
|
|
14
|
+
private static final String TAG = "JsonValue";
|
|
15
|
+
private static final List<String> keySchemaLevel = new ArrayList<String>(
|
|
16
|
+
Arrays.asList("key", "value")
|
|
17
|
+
);
|
|
18
|
+
private String key = null;
|
|
19
|
+
private String value = null;
|
|
20
|
+
|
|
21
|
+
// Getter
|
|
22
|
+
public String getKey() {
|
|
23
|
+
return key;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public String getValue() {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Setter
|
|
31
|
+
public void setKey(String newKey) {
|
|
32
|
+
this.key = newKey;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public void setValue(String newValue) {
|
|
36
|
+
this.value = newValue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public ArrayList<String> getKeys() {
|
|
40
|
+
ArrayList<String> retArray = new ArrayList<String>();
|
|
41
|
+
if (getKey() != null && getKey().length() > 0) retArray.add("key");
|
|
42
|
+
if (getValue() != null && getValue().length() > 0) retArray.add("value");
|
|
43
|
+
return retArray;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public boolean isValue(JSONObject jsObj) {
|
|
47
|
+
if (jsObj == null || jsObj.length() == 0) return false;
|
|
48
|
+
Iterator<String> keys = jsObj.keys();
|
|
49
|
+
while (keys.hasNext()) {
|
|
50
|
+
String key = keys.next();
|
|
51
|
+
if (!keySchemaLevel.contains(key)) return false;
|
|
52
|
+
try {
|
|
53
|
+
Object val = jsObj.get(key);
|
|
54
|
+
|
|
55
|
+
if (key.equals("key")) {
|
|
56
|
+
if (!(val instanceof String)) {
|
|
57
|
+
return false;
|
|
58
|
+
} else {
|
|
59
|
+
key = (String) val;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (key.equals("value")) {
|
|
63
|
+
if (!(val instanceof String)) {
|
|
64
|
+
return false;
|
|
65
|
+
} else {
|
|
66
|
+
value = (String) val;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
} catch (JSONException e) {
|
|
70
|
+
e.printStackTrace();
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public void print() {
|
|
78
|
+
String row = "";
|
|
79
|
+
if (this.getKey() != null) row = "key: " + this.getKey();
|
|
80
|
+
Log.d(TAG, row + " value: " + this.getValue());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public JSObject getValueAsJSObject() {
|
|
84
|
+
JSObject retObj = new JSObject();
|
|
85
|
+
if (this.key != null) retObj.put("key", this.key);
|
|
86
|
+
retObj.put("value", this.value);
|
|
87
|
+
return retObj;
|
|
88
|
+
}
|
|
89
|
+
}
|