@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/plugin.cjs.js
CHANGED
|
@@ -574,6 +574,15 @@ class SQLiteDBConnection {
|
|
|
574
574
|
return Promise.reject(err);
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
|
+
async deleteExportedRows() {
|
|
578
|
+
try {
|
|
579
|
+
await this.sqlite.deleteExportedRows({ database: this.dbName });
|
|
580
|
+
return Promise.resolve();
|
|
581
|
+
}
|
|
582
|
+
catch (err) {
|
|
583
|
+
return Promise.reject(err);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
577
586
|
async executeTransaction(txn) {
|
|
578
587
|
try {
|
|
579
588
|
const ret = await this.sqlite.execute({
|
|
@@ -630,23 +639,6 @@ class SQLiteDBConnection {
|
|
|
630
639
|
}
|
|
631
640
|
}
|
|
632
641
|
}
|
|
633
|
-
/*
|
|
634
|
-
if (Object.keys(res.values[0]).includes("ios_columns")) {
|
|
635
|
-
const columnList = res.values[0]["ios_columns"];
|
|
636
|
-
console.log(`in DBconnection query ${columnList}`);
|
|
637
|
-
const iosRes = []
|
|
638
|
-
for (let i = 1; i < res.values.length; i++) {
|
|
639
|
-
const rowJson = res.values[i];
|
|
640
|
-
const resRowJson = {};
|
|
641
|
-
for (const item of columnList) {
|
|
642
|
-
resRowJson[item] = rowJson[item];
|
|
643
|
-
}
|
|
644
|
-
console.log(`resRowJson: ${JSON.stringify(resRowJson)}`)
|
|
645
|
-
iosRes.push(resRowJson);
|
|
646
|
-
}
|
|
647
|
-
console.log(`iosRes ${JSON.stringify(iosRes)}`);
|
|
648
|
-
}
|
|
649
|
-
*/
|
|
650
642
|
|
|
651
643
|
const CapacitorSQLite = core.registerPlugin('CapacitorSQLite', {
|
|
652
644
|
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorSQLiteWeb()),
|
|
@@ -656,563 +648,351 @@ const CapacitorSQLite = core.registerPlugin('CapacitorSQLite', {
|
|
|
656
648
|
class CapacitorSQLiteWeb extends core.WebPlugin {
|
|
657
649
|
constructor() {
|
|
658
650
|
super(...arguments);
|
|
659
|
-
this.
|
|
660
|
-
this.
|
|
651
|
+
this.jeepSqliteElement = null;
|
|
652
|
+
this.isWebStoreOpen = false;
|
|
661
653
|
}
|
|
662
654
|
async initWebStore() {
|
|
663
655
|
await customElements.whenDefined('jeep-sqlite');
|
|
664
|
-
this.
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
else {
|
|
677
|
-
return Promise.reject('InitWeb: this.sqliteEl is null');
|
|
678
|
-
}
|
|
656
|
+
this.jeepSqliteElement = document.querySelector('jeep-sqlite');
|
|
657
|
+
this.ensureJeepSqliteIsAvailable();
|
|
658
|
+
this.jeepSqliteElement.addEventListener('jeepSqliteImportProgress', (event) => {
|
|
659
|
+
this.notifyListeners('sqliteImportProgressEvent', event.detail);
|
|
660
|
+
});
|
|
661
|
+
this.jeepSqliteElement.addEventListener('jeepSqliteExportProgress', (event) => {
|
|
662
|
+
this.notifyListeners('sqliteExportProgressEvent', event.detail);
|
|
663
|
+
});
|
|
664
|
+
if (!this.isWebStoreOpen) {
|
|
665
|
+
this.isWebStoreOpen = await this.jeepSqliteElement.isStoreOpen();
|
|
666
|
+
}
|
|
667
|
+
return;
|
|
679
668
|
}
|
|
680
669
|
async saveToStore(options) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}
|
|
687
|
-
catch (err) {
|
|
688
|
-
return Promise.reject(`${err}`);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
else {
|
|
692
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
693
|
-
}
|
|
670
|
+
this.ensureJeepSqliteIsAvailable();
|
|
671
|
+
this.ensureWebstoreIsOpen();
|
|
672
|
+
try {
|
|
673
|
+
await this.jeepSqliteElement.saveToStore(options);
|
|
674
|
+
return;
|
|
694
675
|
}
|
|
695
|
-
|
|
696
|
-
throw
|
|
676
|
+
catch (err) {
|
|
677
|
+
throw new Error(`${err}`);
|
|
697
678
|
}
|
|
698
679
|
}
|
|
699
680
|
async echo(options) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
}
|
|
704
|
-
else {
|
|
705
|
-
throw this.unimplemented('Not implemented on web.');
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
async isSecretStored() {
|
|
709
|
-
throw this.unimplemented('Not implemented on web.');
|
|
710
|
-
}
|
|
711
|
-
async setEncryptionSecret(options) {
|
|
712
|
-
console.log('setEncryptionSecret', options);
|
|
713
|
-
throw this.unimplemented('Not implemented on web.');
|
|
714
|
-
}
|
|
715
|
-
async changeEncryptionSecret(options) {
|
|
716
|
-
console.log('changeEncryptionSecret', options);
|
|
717
|
-
throw this.unimplemented('Not implemented on web.');
|
|
718
|
-
}
|
|
719
|
-
async getNCDatabasePath(options) {
|
|
720
|
-
console.log('getNCDatabasePath', options);
|
|
721
|
-
throw this.unimplemented('Not implemented on web.');
|
|
722
|
-
}
|
|
723
|
-
async createNCConnection(options) {
|
|
724
|
-
console.log('createNCConnection', options);
|
|
725
|
-
throw this.unimplemented('Not implemented on web.');
|
|
726
|
-
}
|
|
727
|
-
async closeNCConnection(options) {
|
|
728
|
-
console.log('closeNCConnection', options);
|
|
729
|
-
throw this.unimplemented('Not implemented on web.');
|
|
730
|
-
}
|
|
731
|
-
async isNCDatabase(options) {
|
|
732
|
-
console.log('isNCDatabase', options);
|
|
733
|
-
throw this.unimplemented('Not implemented on web.');
|
|
681
|
+
this.ensureJeepSqliteIsAvailable();
|
|
682
|
+
const echoResult = await this.jeepSqliteElement.echo(options);
|
|
683
|
+
return echoResult;
|
|
734
684
|
}
|
|
735
685
|
async createConnection(options) {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
catch (err) {
|
|
743
|
-
return Promise.reject(`${err}`);
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
else {
|
|
747
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
748
|
-
}
|
|
686
|
+
this.ensureJeepSqliteIsAvailable();
|
|
687
|
+
this.ensureWebstoreIsOpen();
|
|
688
|
+
try {
|
|
689
|
+
await this.jeepSqliteElement.createConnection(options);
|
|
690
|
+
return;
|
|
749
691
|
}
|
|
750
|
-
|
|
751
|
-
throw
|
|
692
|
+
catch (err) {
|
|
693
|
+
throw new Error(`${err}`);
|
|
752
694
|
}
|
|
753
695
|
}
|
|
754
696
|
async open(options) {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
}
|
|
761
|
-
catch (err) {
|
|
762
|
-
return Promise.reject(`${err}`);
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
else {
|
|
766
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
767
|
-
}
|
|
697
|
+
this.ensureJeepSqliteIsAvailable();
|
|
698
|
+
this.ensureWebstoreIsOpen();
|
|
699
|
+
try {
|
|
700
|
+
await this.jeepSqliteElement.open(options);
|
|
701
|
+
return;
|
|
768
702
|
}
|
|
769
|
-
|
|
770
|
-
throw
|
|
703
|
+
catch (err) {
|
|
704
|
+
throw new Error(`${err}`);
|
|
771
705
|
}
|
|
772
706
|
}
|
|
773
707
|
async closeConnection(options) {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
catch (err) {
|
|
781
|
-
return Promise.reject(`${err}`);
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
else {
|
|
785
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
786
|
-
}
|
|
708
|
+
this.ensureJeepSqliteIsAvailable();
|
|
709
|
+
this.ensureWebstoreIsOpen();
|
|
710
|
+
try {
|
|
711
|
+
await this.jeepSqliteElement.closeConnection(options);
|
|
712
|
+
return;
|
|
787
713
|
}
|
|
788
|
-
|
|
789
|
-
throw
|
|
714
|
+
catch (err) {
|
|
715
|
+
throw new Error(`${err}`);
|
|
790
716
|
}
|
|
791
717
|
}
|
|
792
|
-
async getUrl() {
|
|
793
|
-
throw this.unimplemented('Not implemented on web.');
|
|
794
|
-
}
|
|
795
718
|
async getVersion(options) {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
}
|
|
802
|
-
catch (err) {
|
|
803
|
-
return Promise.reject(`${err}`);
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
else {
|
|
807
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
808
|
-
}
|
|
719
|
+
this.ensureJeepSqliteIsAvailable();
|
|
720
|
+
this.ensureWebstoreIsOpen();
|
|
721
|
+
try {
|
|
722
|
+
const versionResult = await this.jeepSqliteElement.getVersion(options);
|
|
723
|
+
return versionResult;
|
|
809
724
|
}
|
|
810
|
-
|
|
811
|
-
throw
|
|
725
|
+
catch (err) {
|
|
726
|
+
throw new Error(`${err}`);
|
|
812
727
|
}
|
|
813
728
|
}
|
|
814
729
|
async checkConnectionsConsistency(options) {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
catch (err) {
|
|
821
|
-
return Promise.reject(`${err}`);
|
|
822
|
-
}
|
|
730
|
+
this.ensureJeepSqliteIsAvailable();
|
|
731
|
+
try {
|
|
732
|
+
const consistencyResult = await this.jeepSqliteElement.checkConnectionsConsistency(options);
|
|
733
|
+
return consistencyResult;
|
|
823
734
|
}
|
|
824
|
-
|
|
825
|
-
throw
|
|
735
|
+
catch (err) {
|
|
736
|
+
throw new Error(`${err}`);
|
|
826
737
|
}
|
|
827
738
|
}
|
|
828
739
|
async close(options) {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
}
|
|
835
|
-
catch (err) {
|
|
836
|
-
return Promise.reject(`${err}`);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
else {
|
|
840
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
841
|
-
}
|
|
740
|
+
this.ensureJeepSqliteIsAvailable();
|
|
741
|
+
this.ensureWebstoreIsOpen();
|
|
742
|
+
try {
|
|
743
|
+
await this.jeepSqliteElement.close(options);
|
|
744
|
+
return;
|
|
842
745
|
}
|
|
843
|
-
|
|
844
|
-
throw
|
|
746
|
+
catch (err) {
|
|
747
|
+
throw new Error(`${err}`);
|
|
845
748
|
}
|
|
846
749
|
}
|
|
847
750
|
async getTableList(options) {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}
|
|
854
|
-
catch (err) {
|
|
855
|
-
return Promise.reject(`${err}`);
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
else {
|
|
859
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
860
|
-
}
|
|
751
|
+
this.ensureJeepSqliteIsAvailable();
|
|
752
|
+
this.ensureWebstoreIsOpen();
|
|
753
|
+
try {
|
|
754
|
+
const tableListResult = await this.jeepSqliteElement.getTableList(options);
|
|
755
|
+
return tableListResult;
|
|
861
756
|
}
|
|
862
|
-
|
|
863
|
-
throw
|
|
757
|
+
catch (err) {
|
|
758
|
+
throw new Error(`${err}`);
|
|
864
759
|
}
|
|
865
760
|
}
|
|
866
761
|
async execute(options) {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}
|
|
873
|
-
catch (err) {
|
|
874
|
-
return Promise.reject(`${err}`);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
else {
|
|
878
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
879
|
-
}
|
|
762
|
+
this.ensureJeepSqliteIsAvailable();
|
|
763
|
+
this.ensureWebstoreIsOpen();
|
|
764
|
+
try {
|
|
765
|
+
const executeResult = await this.jeepSqliteElement.execute(options);
|
|
766
|
+
return executeResult;
|
|
880
767
|
}
|
|
881
|
-
|
|
882
|
-
throw
|
|
768
|
+
catch (err) {
|
|
769
|
+
throw new Error(`${err}`);
|
|
883
770
|
}
|
|
884
771
|
}
|
|
885
772
|
async executeSet(options) {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
catch (err) {
|
|
893
|
-
return Promise.reject(`${err}`);
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
else {
|
|
897
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
898
|
-
}
|
|
773
|
+
this.ensureJeepSqliteIsAvailable();
|
|
774
|
+
this.ensureWebstoreIsOpen();
|
|
775
|
+
try {
|
|
776
|
+
const executeResult = await this.jeepSqliteElement.executeSet(options);
|
|
777
|
+
return executeResult;
|
|
899
778
|
}
|
|
900
|
-
|
|
901
|
-
throw
|
|
779
|
+
catch (err) {
|
|
780
|
+
throw new Error(`${err}`);
|
|
902
781
|
}
|
|
903
782
|
}
|
|
904
783
|
async run(options) {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
}
|
|
911
|
-
catch (err) {
|
|
912
|
-
return Promise.reject(`${err}`);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
else {
|
|
916
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
917
|
-
}
|
|
784
|
+
this.ensureJeepSqliteIsAvailable();
|
|
785
|
+
this.ensureWebstoreIsOpen();
|
|
786
|
+
try {
|
|
787
|
+
const runResult = await this.jeepSqliteElement.run(options);
|
|
788
|
+
return runResult;
|
|
918
789
|
}
|
|
919
|
-
|
|
920
|
-
throw
|
|
790
|
+
catch (err) {
|
|
791
|
+
throw new Error(`${err}`);
|
|
921
792
|
}
|
|
922
793
|
}
|
|
923
794
|
async query(options) {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
}
|
|
930
|
-
catch (err) {
|
|
931
|
-
return Promise.reject(`${err}`);
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
else {
|
|
935
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
936
|
-
}
|
|
795
|
+
this.ensureJeepSqliteIsAvailable();
|
|
796
|
+
this.ensureWebstoreIsOpen();
|
|
797
|
+
try {
|
|
798
|
+
const queryResult = await this.jeepSqliteElement.query(options);
|
|
799
|
+
return queryResult;
|
|
937
800
|
}
|
|
938
|
-
|
|
939
|
-
throw
|
|
801
|
+
catch (err) {
|
|
802
|
+
throw new Error(`${err}`);
|
|
940
803
|
}
|
|
941
804
|
}
|
|
942
805
|
async isDBExists(options) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
-
catch (err) {
|
|
950
|
-
return Promise.reject(`${err}`);
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
else {
|
|
954
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
955
|
-
}
|
|
806
|
+
this.ensureJeepSqliteIsAvailable();
|
|
807
|
+
this.ensureWebstoreIsOpen();
|
|
808
|
+
try {
|
|
809
|
+
const dbExistsResult = await this.jeepSqliteElement.isDBExists(options);
|
|
810
|
+
return dbExistsResult;
|
|
956
811
|
}
|
|
957
|
-
|
|
958
|
-
throw
|
|
812
|
+
catch (err) {
|
|
813
|
+
throw new Error(`${err}`);
|
|
959
814
|
}
|
|
960
815
|
}
|
|
961
816
|
async isDBOpen(options) {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
}
|
|
968
|
-
catch (err) {
|
|
969
|
-
return Promise.reject(`${err}`);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
else {
|
|
973
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
974
|
-
}
|
|
817
|
+
this.ensureJeepSqliteIsAvailable();
|
|
818
|
+
this.ensureWebstoreIsOpen();
|
|
819
|
+
try {
|
|
820
|
+
const isDBOpenResult = await this.jeepSqliteElement.isDBOpen(options);
|
|
821
|
+
return isDBOpenResult;
|
|
975
822
|
}
|
|
976
|
-
|
|
977
|
-
throw
|
|
823
|
+
catch (err) {
|
|
824
|
+
throw new Error(`${err}`);
|
|
978
825
|
}
|
|
979
826
|
}
|
|
980
827
|
async isDatabase(options) {
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
const ret = await this.sqliteEl.isDatabase(options);
|
|
987
|
-
return Promise.resolve(ret);
|
|
988
|
-
}
|
|
989
|
-
catch (err) {
|
|
990
|
-
return Promise.reject(`${err}`);
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
else {
|
|
994
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
995
|
-
}
|
|
828
|
+
this.ensureJeepSqliteIsAvailable();
|
|
829
|
+
this.ensureWebstoreIsOpen();
|
|
830
|
+
try {
|
|
831
|
+
const isDatabaseResult = await this.jeepSqliteElement.isDatabase(options);
|
|
832
|
+
return isDatabaseResult;
|
|
996
833
|
}
|
|
997
|
-
|
|
998
|
-
throw
|
|
834
|
+
catch (err) {
|
|
835
|
+
throw new Error(`${err}`);
|
|
999
836
|
}
|
|
1000
837
|
}
|
|
1001
838
|
async isTableExists(options) {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
}
|
|
1008
|
-
catch (err) {
|
|
1009
|
-
return Promise.reject(`${err}`);
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
else {
|
|
1013
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1014
|
-
}
|
|
839
|
+
this.ensureJeepSqliteIsAvailable();
|
|
840
|
+
this.ensureWebstoreIsOpen();
|
|
841
|
+
try {
|
|
842
|
+
const tableExistsResult = await this.jeepSqliteElement.isTableExists(options);
|
|
843
|
+
return tableExistsResult;
|
|
1015
844
|
}
|
|
1016
|
-
|
|
1017
|
-
throw
|
|
845
|
+
catch (err) {
|
|
846
|
+
throw new Error(`${err}`);
|
|
1018
847
|
}
|
|
1019
848
|
}
|
|
1020
849
|
async deleteDatabase(options) {
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}
|
|
1027
|
-
catch (err) {
|
|
1028
|
-
return Promise.reject(`${err}`);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
else {
|
|
1032
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1033
|
-
}
|
|
850
|
+
this.ensureJeepSqliteIsAvailable();
|
|
851
|
+
this.ensureWebstoreIsOpen();
|
|
852
|
+
try {
|
|
853
|
+
await this.jeepSqliteElement.deleteDatabase(options);
|
|
854
|
+
return;
|
|
1034
855
|
}
|
|
1035
|
-
|
|
1036
|
-
throw
|
|
856
|
+
catch (err) {
|
|
857
|
+
throw new Error(`${err}`);
|
|
1037
858
|
}
|
|
1038
859
|
}
|
|
1039
860
|
async isJsonValid(options) {
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
const ret = await this.sqliteEl.isJsonValid(options);
|
|
1046
|
-
return Promise.resolve(ret);
|
|
1047
|
-
}
|
|
1048
|
-
catch (err) {
|
|
1049
|
-
return Promise.reject(`${err}`);
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
else {
|
|
1053
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1054
|
-
}
|
|
861
|
+
this.ensureJeepSqliteIsAvailable();
|
|
862
|
+
this.ensureWebstoreIsOpen();
|
|
863
|
+
try {
|
|
864
|
+
const isJsonValidResult = await this.jeepSqliteElement.isJsonValid(options);
|
|
865
|
+
return isJsonValidResult;
|
|
1055
866
|
}
|
|
1056
|
-
|
|
1057
|
-
throw
|
|
867
|
+
catch (err) {
|
|
868
|
+
throw new Error(`${err}`);
|
|
1058
869
|
}
|
|
1059
870
|
}
|
|
1060
871
|
async importFromJson(options) {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
const ret = await this.sqliteEl.importFromJson(options);
|
|
1067
|
-
return Promise.resolve(ret);
|
|
1068
|
-
}
|
|
1069
|
-
catch (err) {
|
|
1070
|
-
return Promise.reject(`${err}`);
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
else {
|
|
1074
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1075
|
-
}
|
|
872
|
+
this.ensureJeepSqliteIsAvailable();
|
|
873
|
+
this.ensureWebstoreIsOpen();
|
|
874
|
+
try {
|
|
875
|
+
const importFromJsonResult = await this.jeepSqliteElement.importFromJson(options);
|
|
876
|
+
return importFromJsonResult;
|
|
1076
877
|
}
|
|
1077
|
-
|
|
1078
|
-
throw
|
|
878
|
+
catch (err) {
|
|
879
|
+
throw new Error(`${err}`);
|
|
1079
880
|
}
|
|
1080
881
|
}
|
|
1081
882
|
async exportToJson(options) {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
}
|
|
1088
|
-
catch (err) {
|
|
1089
|
-
return Promise.reject(`${err}`);
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
else {
|
|
1093
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1094
|
-
}
|
|
883
|
+
this.ensureJeepSqliteIsAvailable();
|
|
884
|
+
this.ensureWebstoreIsOpen();
|
|
885
|
+
try {
|
|
886
|
+
const exportToJsonResult = await this.jeepSqliteElement.exportToJson(options);
|
|
887
|
+
return exportToJsonResult;
|
|
1095
888
|
}
|
|
1096
|
-
|
|
1097
|
-
throw
|
|
889
|
+
catch (err) {
|
|
890
|
+
throw new Error(`${err}`);
|
|
1098
891
|
}
|
|
1099
892
|
}
|
|
1100
893
|
async createSyncTable(options) {
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
}
|
|
1107
|
-
catch (err) {
|
|
1108
|
-
return Promise.reject(`${err}`);
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
else {
|
|
1112
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1113
|
-
}
|
|
894
|
+
this.ensureJeepSqliteIsAvailable();
|
|
895
|
+
this.ensureWebstoreIsOpen();
|
|
896
|
+
try {
|
|
897
|
+
const createSyncTableResult = await this.jeepSqliteElement.createSyncTable(options);
|
|
898
|
+
return createSyncTableResult;
|
|
1114
899
|
}
|
|
1115
|
-
|
|
1116
|
-
throw
|
|
900
|
+
catch (err) {
|
|
901
|
+
throw new Error(`${err}`);
|
|
1117
902
|
}
|
|
1118
903
|
}
|
|
1119
904
|
async setSyncDate(options) {
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
}
|
|
1126
|
-
catch (err) {
|
|
1127
|
-
return Promise.reject(`${err}`);
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
else {
|
|
1131
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1132
|
-
}
|
|
905
|
+
this.ensureJeepSqliteIsAvailable();
|
|
906
|
+
this.ensureWebstoreIsOpen();
|
|
907
|
+
try {
|
|
908
|
+
await this.jeepSqliteElement.setSyncDate(options);
|
|
909
|
+
return;
|
|
1133
910
|
}
|
|
1134
|
-
|
|
1135
|
-
throw
|
|
911
|
+
catch (err) {
|
|
912
|
+
throw new Error(`${err}`);
|
|
1136
913
|
}
|
|
1137
914
|
}
|
|
1138
915
|
async getSyncDate(options) {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1145
|
-
catch (err) {
|
|
1146
|
-
return Promise.reject(`${err}`);
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
else {
|
|
1150
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1151
|
-
}
|
|
916
|
+
this.ensureJeepSqliteIsAvailable();
|
|
917
|
+
this.ensureWebstoreIsOpen();
|
|
918
|
+
try {
|
|
919
|
+
const getSyncDateResult = await this.jeepSqliteElement.getSyncDate(options);
|
|
920
|
+
return getSyncDateResult;
|
|
1152
921
|
}
|
|
1153
|
-
|
|
1154
|
-
throw
|
|
922
|
+
catch (err) {
|
|
923
|
+
throw new Error(`${err}`);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
async deleteExportedRows(options) {
|
|
927
|
+
this.ensureJeepSqliteIsAvailable();
|
|
928
|
+
this.ensureWebstoreIsOpen();
|
|
929
|
+
try {
|
|
930
|
+
await this.jeepSqliteElement.deleteExportedRows(options);
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
catch (err) {
|
|
934
|
+
throw new Error(`${err}`);
|
|
1155
935
|
}
|
|
1156
936
|
}
|
|
1157
937
|
async addUpgradeStatement(options) {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1164
|
-
catch (err) {
|
|
1165
|
-
return Promise.reject(`${err}`);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
else {
|
|
1169
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1170
|
-
}
|
|
938
|
+
this.ensureJeepSqliteIsAvailable();
|
|
939
|
+
this.ensureWebstoreIsOpen();
|
|
940
|
+
try {
|
|
941
|
+
await this.jeepSqliteElement.addUpgradeStatement(options);
|
|
942
|
+
return;
|
|
1171
943
|
}
|
|
1172
|
-
|
|
1173
|
-
throw
|
|
944
|
+
catch (err) {
|
|
945
|
+
throw new Error(`${err}`);
|
|
1174
946
|
}
|
|
1175
947
|
}
|
|
1176
948
|
async copyFromAssets(options) {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
}
|
|
1183
|
-
catch (err) {
|
|
1184
|
-
return Promise.reject(`${err}`);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
else {
|
|
1188
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1189
|
-
}
|
|
949
|
+
this.ensureJeepSqliteIsAvailable();
|
|
950
|
+
this.ensureWebstoreIsOpen();
|
|
951
|
+
try {
|
|
952
|
+
await this.jeepSqliteElement.copyFromAssets(options);
|
|
953
|
+
return;
|
|
1190
954
|
}
|
|
1191
|
-
|
|
1192
|
-
throw
|
|
955
|
+
catch (err) {
|
|
956
|
+
throw new Error(`${err}`);
|
|
1193
957
|
}
|
|
1194
958
|
}
|
|
1195
959
|
async getDatabaseList() {
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
const ret = await this.sqliteEl.getDatabaseList();
|
|
1202
|
-
return Promise.resolve(ret);
|
|
1203
|
-
}
|
|
1204
|
-
catch (err) {
|
|
1205
|
-
return Promise.reject(`${err}`);
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
else {
|
|
1209
|
-
return Promise.reject(`Store "jeepSqliteStore" failed to open`);
|
|
1210
|
-
}
|
|
960
|
+
this.ensureJeepSqliteIsAvailable();
|
|
961
|
+
this.ensureWebstoreIsOpen();
|
|
962
|
+
try {
|
|
963
|
+
const databaseListResult = await this.jeepSqliteElement.getDatabaseList();
|
|
964
|
+
return databaseListResult;
|
|
1211
965
|
}
|
|
1212
|
-
|
|
1213
|
-
throw
|
|
966
|
+
catch (err) {
|
|
967
|
+
throw new Error(`${err}`);
|
|
1214
968
|
}
|
|
1215
969
|
}
|
|
970
|
+
/**
|
|
971
|
+
* Checks if the `jeep-sqlite` element is present in the DOM.
|
|
972
|
+
* If it's not in the DOM, this method throws an Error.
|
|
973
|
+
*
|
|
974
|
+
* Attention: This will always fail, if the `intWebStore()` method wasn't called before.
|
|
975
|
+
*/
|
|
976
|
+
ensureJeepSqliteIsAvailable() {
|
|
977
|
+
if (this.jeepSqliteElement === null) {
|
|
978
|
+
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.`);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
ensureWebstoreIsOpen() {
|
|
982
|
+
if (!this.isWebStoreOpen) {
|
|
983
|
+
/**
|
|
984
|
+
* if (!this.isWebStoreOpen)
|
|
985
|
+
this.isWebStoreOpen = await this.jeepSqliteElement.isStoreOpen();
|
|
986
|
+
*/
|
|
987
|
+
throw new Error('WebStore is not open yet. You have to call "initWebStore()" first.');
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
////////////////////////////////////
|
|
991
|
+
////// UNIMPLEMENTED METHODS
|
|
992
|
+
////////////////////////////////////
|
|
993
|
+
async getUrl() {
|
|
994
|
+
throw this.unimplemented('Not implemented on web.');
|
|
995
|
+
}
|
|
1216
996
|
async getMigratableDbList(options) {
|
|
1217
997
|
console.log('getMigratableDbList', options);
|
|
1218
998
|
throw this.unimplemented('Not implemented on web.');
|
|
@@ -1225,11 +1005,38 @@ class CapacitorSQLiteWeb extends core.WebPlugin {
|
|
|
1225
1005
|
console.log('deleteOldDatabases', options);
|
|
1226
1006
|
throw this.unimplemented('Not implemented on web.');
|
|
1227
1007
|
}
|
|
1008
|
+
async isSecretStored() {
|
|
1009
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1010
|
+
}
|
|
1011
|
+
async setEncryptionSecret(options) {
|
|
1012
|
+
console.log('setEncryptionSecret', options);
|
|
1013
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1014
|
+
}
|
|
1015
|
+
async changeEncryptionSecret(options) {
|
|
1016
|
+
console.log('changeEncryptionSecret', options);
|
|
1017
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1018
|
+
}
|
|
1019
|
+
async getNCDatabasePath(options) {
|
|
1020
|
+
console.log('getNCDatabasePath', options);
|
|
1021
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1022
|
+
}
|
|
1023
|
+
async createNCConnection(options) {
|
|
1024
|
+
console.log('createNCConnection', options);
|
|
1025
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1026
|
+
}
|
|
1027
|
+
async closeNCConnection(options) {
|
|
1028
|
+
console.log('closeNCConnection', options);
|
|
1029
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1030
|
+
}
|
|
1031
|
+
async isNCDatabase(options) {
|
|
1032
|
+
console.log('isNCDatabase', options);
|
|
1033
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1034
|
+
}
|
|
1228
1035
|
}
|
|
1229
1036
|
|
|
1230
1037
|
var web = /*#__PURE__*/Object.freeze({
|
|
1231
|
-
|
|
1232
|
-
|
|
1038
|
+
__proto__: null,
|
|
1039
|
+
CapacitorSQLiteWeb: CapacitorSQLiteWeb
|
|
1233
1040
|
});
|
|
1234
1041
|
|
|
1235
1042
|
exports.CapacitorSQLite = CapacitorSQLite;
|