@capacitor-community/sqlite 3.4.2 → 3.4.3-1
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 +9 -2
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsUpgrade.java +8 -4
- package/dist/esm/definitions.d.ts +3 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +19 -11
- package/dist/esm/web.js +277 -473
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +251 -447
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +251 -447
- package/dist/plugin.js.map +1 -1
- package/electron/dist/plugin.js +489 -701
- package/electron/dist/plugin.js.map +1 -1
- package/ios/Plugin/Utils/UtilsUpgrade.swift +33 -12
- package/package.json +6 -6
package/dist/plugin.cjs.js
CHANGED
|
@@ -656,563 +656,340 @@ const CapacitorSQLite = core.registerPlugin('CapacitorSQLite', {
|
|
|
656
656
|
class CapacitorSQLiteWeb extends core.WebPlugin {
|
|
657
657
|
constructor() {
|
|
658
658
|
super(...arguments);
|
|
659
|
-
this.
|
|
660
|
-
this.
|
|
659
|
+
this.jeepSqliteElement = null;
|
|
660
|
+
this.isWebStoreOpen = false;
|
|
661
661
|
}
|
|
662
662
|
async initWebStore() {
|
|
663
663
|
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
|
-
}
|
|
664
|
+
this.jeepSqliteElement = document.querySelector('jeep-sqlite');
|
|
665
|
+
this.ensureJeepSqliteIsAvailable();
|
|
666
|
+
this.jeepSqliteElement.addEventListener('jeepSqliteImportProgress', (event) => {
|
|
667
|
+
this.notifyListeners('sqliteImportProgressEvent', event.detail);
|
|
668
|
+
});
|
|
669
|
+
this.jeepSqliteElement.addEventListener('jeepSqliteExportProgress', (event) => {
|
|
670
|
+
this.notifyListeners('sqliteExportProgressEvent', event.detail);
|
|
671
|
+
});
|
|
672
|
+
if (!this.isWebStoreOpen) {
|
|
673
|
+
this.isWebStoreOpen = await this.jeepSqliteElement.isStoreOpen();
|
|
674
|
+
}
|
|
675
|
+
return;
|
|
679
676
|
}
|
|
680
677
|
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
|
-
}
|
|
678
|
+
this.ensureJeepSqliteIsAvailable();
|
|
679
|
+
this.ensureWebstoreIsOpen();
|
|
680
|
+
try {
|
|
681
|
+
await this.jeepSqliteElement.saveToStore(options);
|
|
682
|
+
return;
|
|
694
683
|
}
|
|
695
|
-
|
|
696
|
-
throw
|
|
684
|
+
catch (err) {
|
|
685
|
+
throw new Error(`${err}`);
|
|
697
686
|
}
|
|
698
687
|
}
|
|
699
688
|
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.');
|
|
689
|
+
this.ensureJeepSqliteIsAvailable();
|
|
690
|
+
const echoResult = await this.jeepSqliteElement.echo(options);
|
|
691
|
+
return echoResult;
|
|
734
692
|
}
|
|
735
693
|
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
|
-
}
|
|
694
|
+
this.ensureJeepSqliteIsAvailable();
|
|
695
|
+
this.ensureWebstoreIsOpen();
|
|
696
|
+
try {
|
|
697
|
+
await this.jeepSqliteElement.createConnection(options);
|
|
698
|
+
return;
|
|
749
699
|
}
|
|
750
|
-
|
|
751
|
-
throw
|
|
700
|
+
catch (err) {
|
|
701
|
+
throw new Error(`${err}`);
|
|
752
702
|
}
|
|
753
703
|
}
|
|
754
704
|
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
|
-
}
|
|
705
|
+
this.ensureJeepSqliteIsAvailable();
|
|
706
|
+
this.ensureWebstoreIsOpen();
|
|
707
|
+
try {
|
|
708
|
+
await this.jeepSqliteElement.open(options);
|
|
709
|
+
return;
|
|
768
710
|
}
|
|
769
|
-
|
|
770
|
-
throw
|
|
711
|
+
catch (err) {
|
|
712
|
+
throw new Error(`${err}`);
|
|
771
713
|
}
|
|
772
714
|
}
|
|
773
715
|
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
|
-
}
|
|
716
|
+
this.ensureJeepSqliteIsAvailable();
|
|
717
|
+
this.ensureWebstoreIsOpen();
|
|
718
|
+
try {
|
|
719
|
+
await this.jeepSqliteElement.closeConnection(options);
|
|
720
|
+
return;
|
|
787
721
|
}
|
|
788
|
-
|
|
789
|
-
throw
|
|
722
|
+
catch (err) {
|
|
723
|
+
throw new Error(`${err}`);
|
|
790
724
|
}
|
|
791
725
|
}
|
|
792
|
-
async getUrl() {
|
|
793
|
-
throw this.unimplemented('Not implemented on web.');
|
|
794
|
-
}
|
|
795
726
|
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
|
-
}
|
|
727
|
+
this.ensureJeepSqliteIsAvailable();
|
|
728
|
+
this.ensureWebstoreIsOpen();
|
|
729
|
+
try {
|
|
730
|
+
const versionResult = await this.jeepSqliteElement.getVersion(options);
|
|
731
|
+
return versionResult;
|
|
809
732
|
}
|
|
810
|
-
|
|
811
|
-
throw
|
|
733
|
+
catch (err) {
|
|
734
|
+
throw new Error(`${err}`);
|
|
812
735
|
}
|
|
813
736
|
}
|
|
814
737
|
async checkConnectionsConsistency(options) {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
catch (err) {
|
|
821
|
-
return Promise.reject(`${err}`);
|
|
822
|
-
}
|
|
738
|
+
this.ensureJeepSqliteIsAvailable();
|
|
739
|
+
try {
|
|
740
|
+
const consistencyResult = await this.jeepSqliteElement.checkConnectionsConsistency(options);
|
|
741
|
+
return consistencyResult;
|
|
823
742
|
}
|
|
824
|
-
|
|
825
|
-
throw
|
|
743
|
+
catch (err) {
|
|
744
|
+
throw new Error(`${err}`);
|
|
826
745
|
}
|
|
827
746
|
}
|
|
828
747
|
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
|
-
}
|
|
748
|
+
this.ensureJeepSqliteIsAvailable();
|
|
749
|
+
this.ensureWebstoreIsOpen();
|
|
750
|
+
try {
|
|
751
|
+
await this.jeepSqliteElement.close(options);
|
|
752
|
+
return;
|
|
842
753
|
}
|
|
843
|
-
|
|
844
|
-
throw
|
|
754
|
+
catch (err) {
|
|
755
|
+
throw new Error(`${err}`);
|
|
845
756
|
}
|
|
846
757
|
}
|
|
847
758
|
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
|
-
}
|
|
759
|
+
this.ensureJeepSqliteIsAvailable();
|
|
760
|
+
this.ensureWebstoreIsOpen();
|
|
761
|
+
try {
|
|
762
|
+
const tableListResult = await this.jeepSqliteElement.getTableList(options);
|
|
763
|
+
return tableListResult;
|
|
861
764
|
}
|
|
862
|
-
|
|
863
|
-
throw
|
|
765
|
+
catch (err) {
|
|
766
|
+
throw new Error(`${err}`);
|
|
864
767
|
}
|
|
865
768
|
}
|
|
866
769
|
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
|
-
}
|
|
770
|
+
this.ensureJeepSqliteIsAvailable();
|
|
771
|
+
this.ensureWebstoreIsOpen();
|
|
772
|
+
try {
|
|
773
|
+
const executeResult = await this.jeepSqliteElement.execute(options);
|
|
774
|
+
return executeResult;
|
|
880
775
|
}
|
|
881
|
-
|
|
882
|
-
throw
|
|
776
|
+
catch (err) {
|
|
777
|
+
throw new Error(`${err}`);
|
|
883
778
|
}
|
|
884
779
|
}
|
|
885
780
|
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
|
-
}
|
|
781
|
+
this.ensureJeepSqliteIsAvailable();
|
|
782
|
+
this.ensureWebstoreIsOpen();
|
|
783
|
+
try {
|
|
784
|
+
const executeResult = await this.jeepSqliteElement.executeSet(options);
|
|
785
|
+
return executeResult;
|
|
899
786
|
}
|
|
900
|
-
|
|
901
|
-
throw
|
|
787
|
+
catch (err) {
|
|
788
|
+
throw new Error(`${err}`);
|
|
902
789
|
}
|
|
903
790
|
}
|
|
904
791
|
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
|
-
}
|
|
792
|
+
this.ensureJeepSqliteIsAvailable();
|
|
793
|
+
this.ensureWebstoreIsOpen();
|
|
794
|
+
try {
|
|
795
|
+
const runResult = await this.jeepSqliteElement.run(options);
|
|
796
|
+
return runResult;
|
|
918
797
|
}
|
|
919
|
-
|
|
920
|
-
throw
|
|
798
|
+
catch (err) {
|
|
799
|
+
throw new Error(`${err}`);
|
|
921
800
|
}
|
|
922
801
|
}
|
|
923
802
|
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
|
-
}
|
|
803
|
+
this.ensureJeepSqliteIsAvailable();
|
|
804
|
+
this.ensureWebstoreIsOpen();
|
|
805
|
+
try {
|
|
806
|
+
const queryResult = await this.jeepSqliteElement.query(options);
|
|
807
|
+
return queryResult;
|
|
937
808
|
}
|
|
938
|
-
|
|
939
|
-
throw
|
|
809
|
+
catch (err) {
|
|
810
|
+
throw new Error(`${err}`);
|
|
940
811
|
}
|
|
941
812
|
}
|
|
942
813
|
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
|
-
}
|
|
814
|
+
this.ensureJeepSqliteIsAvailable();
|
|
815
|
+
this.ensureWebstoreIsOpen();
|
|
816
|
+
try {
|
|
817
|
+
const dbExistsResult = await this.jeepSqliteElement.isDBExists(options);
|
|
818
|
+
return dbExistsResult;
|
|
956
819
|
}
|
|
957
|
-
|
|
958
|
-
throw
|
|
820
|
+
catch (err) {
|
|
821
|
+
throw new Error(`${err}`);
|
|
959
822
|
}
|
|
960
823
|
}
|
|
961
824
|
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
|
-
}
|
|
825
|
+
this.ensureJeepSqliteIsAvailable();
|
|
826
|
+
this.ensureWebstoreIsOpen();
|
|
827
|
+
try {
|
|
828
|
+
const isDBOpenResult = await this.jeepSqliteElement.isDBOpen(options);
|
|
829
|
+
return isDBOpenResult;
|
|
975
830
|
}
|
|
976
|
-
|
|
977
|
-
throw
|
|
831
|
+
catch (err) {
|
|
832
|
+
throw new Error(`${err}`);
|
|
978
833
|
}
|
|
979
834
|
}
|
|
980
835
|
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
|
-
}
|
|
836
|
+
this.ensureJeepSqliteIsAvailable();
|
|
837
|
+
this.ensureWebstoreIsOpen();
|
|
838
|
+
try {
|
|
839
|
+
const isDatabaseResult = await this.jeepSqliteElement.isDatabase(options);
|
|
840
|
+
return isDatabaseResult;
|
|
996
841
|
}
|
|
997
|
-
|
|
998
|
-
throw
|
|
842
|
+
catch (err) {
|
|
843
|
+
throw new Error(`${err}`);
|
|
999
844
|
}
|
|
1000
845
|
}
|
|
1001
846
|
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
|
-
}
|
|
847
|
+
this.ensureJeepSqliteIsAvailable();
|
|
848
|
+
this.ensureWebstoreIsOpen();
|
|
849
|
+
try {
|
|
850
|
+
const tableExistsResult = await this.jeepSqliteElement.isTableExists(options);
|
|
851
|
+
return tableExistsResult;
|
|
1015
852
|
}
|
|
1016
|
-
|
|
1017
|
-
throw
|
|
853
|
+
catch (err) {
|
|
854
|
+
throw new Error(`${err}`);
|
|
1018
855
|
}
|
|
1019
856
|
}
|
|
1020
857
|
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
|
-
}
|
|
858
|
+
this.ensureJeepSqliteIsAvailable();
|
|
859
|
+
this.ensureWebstoreIsOpen();
|
|
860
|
+
try {
|
|
861
|
+
await this.jeepSqliteElement.deleteDatabase(options);
|
|
862
|
+
return;
|
|
1034
863
|
}
|
|
1035
|
-
|
|
1036
|
-
throw
|
|
864
|
+
catch (err) {
|
|
865
|
+
throw new Error(`${err}`);
|
|
1037
866
|
}
|
|
1038
867
|
}
|
|
1039
868
|
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
|
-
}
|
|
869
|
+
this.ensureJeepSqliteIsAvailable();
|
|
870
|
+
this.ensureWebstoreIsOpen();
|
|
871
|
+
try {
|
|
872
|
+
const isJsonValidResult = await this.jeepSqliteElement.isJsonValid(options);
|
|
873
|
+
return isJsonValidResult;
|
|
1055
874
|
}
|
|
1056
|
-
|
|
1057
|
-
throw
|
|
875
|
+
catch (err) {
|
|
876
|
+
throw new Error(`${err}`);
|
|
1058
877
|
}
|
|
1059
878
|
}
|
|
1060
879
|
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
|
-
}
|
|
880
|
+
this.ensureJeepSqliteIsAvailable();
|
|
881
|
+
this.ensureWebstoreIsOpen();
|
|
882
|
+
try {
|
|
883
|
+
const importFromJsonResult = await this.jeepSqliteElement.importFromJson(options);
|
|
884
|
+
return importFromJsonResult;
|
|
1076
885
|
}
|
|
1077
|
-
|
|
1078
|
-
throw
|
|
886
|
+
catch (err) {
|
|
887
|
+
throw new Error(`${err}`);
|
|
1079
888
|
}
|
|
1080
889
|
}
|
|
1081
890
|
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
|
-
}
|
|
891
|
+
this.ensureJeepSqliteIsAvailable();
|
|
892
|
+
this.ensureWebstoreIsOpen();
|
|
893
|
+
try {
|
|
894
|
+
const exportToJsonResult = await this.jeepSqliteElement.exportToJson(options);
|
|
895
|
+
return exportToJsonResult;
|
|
1095
896
|
}
|
|
1096
|
-
|
|
1097
|
-
throw
|
|
897
|
+
catch (err) {
|
|
898
|
+
throw new Error(`${err}`);
|
|
1098
899
|
}
|
|
1099
900
|
}
|
|
1100
901
|
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
|
-
}
|
|
902
|
+
this.ensureJeepSqliteIsAvailable();
|
|
903
|
+
this.ensureWebstoreIsOpen();
|
|
904
|
+
try {
|
|
905
|
+
const createSyncTableResult = await this.jeepSqliteElement.createSyncTable(options);
|
|
906
|
+
return createSyncTableResult;
|
|
1114
907
|
}
|
|
1115
|
-
|
|
1116
|
-
throw
|
|
908
|
+
catch (err) {
|
|
909
|
+
throw new Error(`${err}`);
|
|
1117
910
|
}
|
|
1118
911
|
}
|
|
1119
912
|
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
|
-
}
|
|
913
|
+
this.ensureJeepSqliteIsAvailable();
|
|
914
|
+
this.ensureWebstoreIsOpen();
|
|
915
|
+
try {
|
|
916
|
+
await this.jeepSqliteElement.setSyncDate(options);
|
|
917
|
+
return;
|
|
1133
918
|
}
|
|
1134
|
-
|
|
1135
|
-
throw
|
|
919
|
+
catch (err) {
|
|
920
|
+
throw new Error(`${err}`);
|
|
1136
921
|
}
|
|
1137
922
|
}
|
|
1138
923
|
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
|
-
}
|
|
924
|
+
this.ensureJeepSqliteIsAvailable();
|
|
925
|
+
this.ensureWebstoreIsOpen();
|
|
926
|
+
try {
|
|
927
|
+
const getSyncDateResult = await this.jeepSqliteElement.getSyncDate(options);
|
|
928
|
+
return getSyncDateResult;
|
|
1152
929
|
}
|
|
1153
|
-
|
|
1154
|
-
throw
|
|
930
|
+
catch (err) {
|
|
931
|
+
throw new Error(`${err}`);
|
|
1155
932
|
}
|
|
1156
933
|
}
|
|
1157
934
|
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
|
-
}
|
|
935
|
+
this.ensureJeepSqliteIsAvailable();
|
|
936
|
+
this.ensureWebstoreIsOpen();
|
|
937
|
+
try {
|
|
938
|
+
await this.jeepSqliteElement.addUpgradeStatement(options);
|
|
939
|
+
return;
|
|
1171
940
|
}
|
|
1172
|
-
|
|
1173
|
-
throw
|
|
941
|
+
catch (err) {
|
|
942
|
+
throw new Error(`${err}`);
|
|
1174
943
|
}
|
|
1175
944
|
}
|
|
1176
945
|
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
|
-
}
|
|
946
|
+
this.ensureJeepSqliteIsAvailable();
|
|
947
|
+
this.ensureWebstoreIsOpen();
|
|
948
|
+
try {
|
|
949
|
+
await this.jeepSqliteElement.copyFromAssets(options);
|
|
950
|
+
return;
|
|
1190
951
|
}
|
|
1191
|
-
|
|
1192
|
-
throw
|
|
952
|
+
catch (err) {
|
|
953
|
+
throw new Error(`${err}`);
|
|
1193
954
|
}
|
|
1194
955
|
}
|
|
1195
956
|
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
|
-
}
|
|
957
|
+
this.ensureJeepSqliteIsAvailable();
|
|
958
|
+
this.ensureWebstoreIsOpen();
|
|
959
|
+
try {
|
|
960
|
+
const databaseListResult = await this.jeepSqliteElement.getDatabaseList();
|
|
961
|
+
return databaseListResult;
|
|
1211
962
|
}
|
|
1212
|
-
|
|
1213
|
-
throw
|
|
963
|
+
catch (err) {
|
|
964
|
+
throw new Error(`${err}`);
|
|
1214
965
|
}
|
|
1215
966
|
}
|
|
967
|
+
/**
|
|
968
|
+
* Checks if the `jeep-sqlite` element is present in the DOM.
|
|
969
|
+
* If it's not in the DOM, this method throws an Error.
|
|
970
|
+
*
|
|
971
|
+
* Attention: This will always fail, if the `intWebStore()` method wasn't called before.
|
|
972
|
+
*/
|
|
973
|
+
ensureJeepSqliteIsAvailable() {
|
|
974
|
+
if (this.jeepSqliteElement === null) {
|
|
975
|
+
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.`);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
ensureWebstoreIsOpen() {
|
|
979
|
+
if (!this.isWebStoreOpen) {
|
|
980
|
+
/**
|
|
981
|
+
* if (!this.isWebStoreOpen)
|
|
982
|
+
this.isWebStoreOpen = await this.jeepSqliteElement.isStoreOpen();
|
|
983
|
+
*/
|
|
984
|
+
throw new Error('WebStore is not open yet. You have to call "initWebStore()" first.');
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
////////////////////////////////////
|
|
988
|
+
////// UNIMPLEMENTED METHODS
|
|
989
|
+
////////////////////////////////////
|
|
990
|
+
async getUrl() {
|
|
991
|
+
throw this.unimplemented('Not implemented on web.');
|
|
992
|
+
}
|
|
1216
993
|
async getMigratableDbList(options) {
|
|
1217
994
|
console.log('getMigratableDbList', options);
|
|
1218
995
|
throw this.unimplemented('Not implemented on web.');
|
|
@@ -1225,6 +1002,33 @@ class CapacitorSQLiteWeb extends core.WebPlugin {
|
|
|
1225
1002
|
console.log('deleteOldDatabases', options);
|
|
1226
1003
|
throw this.unimplemented('Not implemented on web.');
|
|
1227
1004
|
}
|
|
1005
|
+
async isSecretStored() {
|
|
1006
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1007
|
+
}
|
|
1008
|
+
async setEncryptionSecret(options) {
|
|
1009
|
+
console.log('setEncryptionSecret', options);
|
|
1010
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1011
|
+
}
|
|
1012
|
+
async changeEncryptionSecret(options) {
|
|
1013
|
+
console.log('changeEncryptionSecret', options);
|
|
1014
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1015
|
+
}
|
|
1016
|
+
async getNCDatabasePath(options) {
|
|
1017
|
+
console.log('getNCDatabasePath', options);
|
|
1018
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1019
|
+
}
|
|
1020
|
+
async createNCConnection(options) {
|
|
1021
|
+
console.log('createNCConnection', options);
|
|
1022
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1023
|
+
}
|
|
1024
|
+
async closeNCConnection(options) {
|
|
1025
|
+
console.log('closeNCConnection', options);
|
|
1026
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1027
|
+
}
|
|
1028
|
+
async isNCDatabase(options) {
|
|
1029
|
+
console.log('isNCDatabase', options);
|
|
1030
|
+
throw this.unimplemented('Not implemented on web.');
|
|
1031
|
+
}
|
|
1228
1032
|
}
|
|
1229
1033
|
|
|
1230
1034
|
var web = /*#__PURE__*/Object.freeze({
|