tevrocsdk 0.1.29 → 0.1.31
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 +132 -68
- package/package.json +4 -2
- package/tevroc-sdk.esm.js +2209 -151
- package/tevroc-sdk.min.js +1 -1
- package/tevroc-sdk.umd.js +2211 -151
package/tevroc-sdk.umd.js
CHANGED
|
@@ -237,8 +237,8 @@ var Tevroc = (() => {
|
|
|
237
237
|
}
|
|
238
238
|
addListener(eventName, listenerFunc) {
|
|
239
239
|
let firstListener = false;
|
|
240
|
-
const
|
|
241
|
-
if (!
|
|
240
|
+
const listeners2 = this.listeners[eventName];
|
|
241
|
+
if (!listeners2) {
|
|
242
242
|
this.listeners[eventName] = [];
|
|
243
243
|
firstListener = true;
|
|
244
244
|
}
|
|
@@ -262,8 +262,8 @@ var Tevroc = (() => {
|
|
|
262
262
|
this.windowListeners = {};
|
|
263
263
|
}
|
|
264
264
|
notifyListeners(eventName, data, retainUntilConsumed) {
|
|
265
|
-
const
|
|
266
|
-
if (!
|
|
265
|
+
const listeners2 = this.listeners[eventName];
|
|
266
|
+
if (!listeners2) {
|
|
267
267
|
if (retainUntilConsumed) {
|
|
268
268
|
let args = this.retainedEventArguments[eventName];
|
|
269
269
|
if (!args) {
|
|
@@ -274,7 +274,7 @@ var Tevroc = (() => {
|
|
|
274
274
|
}
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
|
-
|
|
277
|
+
listeners2.forEach((listener) => listener(data));
|
|
278
278
|
}
|
|
279
279
|
hasListeners(eventName) {
|
|
280
280
|
var _a;
|
|
@@ -297,11 +297,11 @@ var Tevroc = (() => {
|
|
|
297
297
|
return new Capacitor.Exception(msg, ExceptionCode.Unavailable);
|
|
298
298
|
}
|
|
299
299
|
async removeListener(eventName, listenerFunc) {
|
|
300
|
-
const
|
|
301
|
-
if (!
|
|
300
|
+
const listeners2 = this.listeners[eventName];
|
|
301
|
+
if (!listeners2) {
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
|
-
const index =
|
|
304
|
+
const index = listeners2.indexOf(listenerFunc);
|
|
305
305
|
this.listeners[eventName].splice(index, 1);
|
|
306
306
|
if (!this.listeners[eventName].length) {
|
|
307
307
|
this.removeWindowListener(this.windowListeners[eventName]);
|
|
@@ -567,19 +567,1592 @@ var Tevroc = (() => {
|
|
|
567
567
|
}
|
|
568
568
|
});
|
|
569
569
|
|
|
570
|
+
// node_modules/@capacitor-community/sqlite/dist/esm/definitions.js
|
|
571
|
+
var SQLiteConnection, SQLiteDBConnection;
|
|
572
|
+
var init_definitions = __esm({
|
|
573
|
+
"node_modules/@capacitor-community/sqlite/dist/esm/definitions.js"() {
|
|
574
|
+
SQLiteConnection = class {
|
|
575
|
+
constructor(sqlite) {
|
|
576
|
+
this.sqlite = sqlite;
|
|
577
|
+
this._connectionDict = /* @__PURE__ */ new Map();
|
|
578
|
+
}
|
|
579
|
+
async initWebStore() {
|
|
580
|
+
try {
|
|
581
|
+
await this.sqlite.initWebStore();
|
|
582
|
+
return Promise.resolve();
|
|
583
|
+
} catch (err) {
|
|
584
|
+
return Promise.reject(err);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
async saveToStore(database) {
|
|
588
|
+
try {
|
|
589
|
+
await this.sqlite.saveToStore({ database });
|
|
590
|
+
return Promise.resolve();
|
|
591
|
+
} catch (err) {
|
|
592
|
+
return Promise.reject(err);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
async saveToLocalDisk(database) {
|
|
596
|
+
try {
|
|
597
|
+
await this.sqlite.saveToLocalDisk({ database });
|
|
598
|
+
return Promise.resolve();
|
|
599
|
+
} catch (err) {
|
|
600
|
+
return Promise.reject(err);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
async getFromLocalDiskToStore(overwrite) {
|
|
604
|
+
const mOverwrite = overwrite != null ? overwrite : true;
|
|
605
|
+
try {
|
|
606
|
+
await this.sqlite.getFromLocalDiskToStore({ overwrite: mOverwrite });
|
|
607
|
+
return Promise.resolve();
|
|
608
|
+
} catch (err) {
|
|
609
|
+
return Promise.reject(err);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
async echo(value) {
|
|
613
|
+
try {
|
|
614
|
+
const res = await this.sqlite.echo({ value });
|
|
615
|
+
return Promise.resolve(res);
|
|
616
|
+
} catch (err) {
|
|
617
|
+
return Promise.reject(err);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
async isSecretStored() {
|
|
621
|
+
try {
|
|
622
|
+
const res = await this.sqlite.isSecretStored();
|
|
623
|
+
return Promise.resolve(res);
|
|
624
|
+
} catch (err) {
|
|
625
|
+
return Promise.reject(err);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
async setEncryptionSecret(passphrase) {
|
|
629
|
+
try {
|
|
630
|
+
await this.sqlite.setEncryptionSecret({ passphrase });
|
|
631
|
+
return Promise.resolve();
|
|
632
|
+
} catch (err) {
|
|
633
|
+
return Promise.reject(err);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
async changeEncryptionSecret(passphrase, oldpassphrase) {
|
|
637
|
+
try {
|
|
638
|
+
await this.sqlite.changeEncryptionSecret({
|
|
639
|
+
passphrase,
|
|
640
|
+
oldpassphrase
|
|
641
|
+
});
|
|
642
|
+
return Promise.resolve();
|
|
643
|
+
} catch (err) {
|
|
644
|
+
return Promise.reject(err);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
async clearEncryptionSecret() {
|
|
648
|
+
try {
|
|
649
|
+
await this.sqlite.clearEncryptionSecret();
|
|
650
|
+
return Promise.resolve();
|
|
651
|
+
} catch (err) {
|
|
652
|
+
return Promise.reject(err);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
async checkEncryptionSecret(passphrase) {
|
|
656
|
+
try {
|
|
657
|
+
const res = await this.sqlite.checkEncryptionSecret({
|
|
658
|
+
passphrase
|
|
659
|
+
});
|
|
660
|
+
return Promise.resolve(res);
|
|
661
|
+
} catch (err) {
|
|
662
|
+
return Promise.reject(err);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
async addUpgradeStatement(database, upgrade) {
|
|
666
|
+
try {
|
|
667
|
+
if (database.endsWith(".db"))
|
|
668
|
+
database = database.slice(0, -3);
|
|
669
|
+
await this.sqlite.addUpgradeStatement({
|
|
670
|
+
database,
|
|
671
|
+
upgrade
|
|
672
|
+
});
|
|
673
|
+
return Promise.resolve();
|
|
674
|
+
} catch (err) {
|
|
675
|
+
return Promise.reject(err);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
async createConnection(database, encrypted, mode, version, readonly) {
|
|
679
|
+
try {
|
|
680
|
+
if (database.endsWith(".db"))
|
|
681
|
+
database = database.slice(0, -3);
|
|
682
|
+
await this.sqlite.createConnection({
|
|
683
|
+
database,
|
|
684
|
+
encrypted,
|
|
685
|
+
mode,
|
|
686
|
+
version,
|
|
687
|
+
readonly
|
|
688
|
+
});
|
|
689
|
+
const conn = new SQLiteDBConnection(database, readonly, this.sqlite);
|
|
690
|
+
const connName = readonly ? `RO_${database}` : `RW_${database}`;
|
|
691
|
+
this._connectionDict.set(connName, conn);
|
|
692
|
+
return Promise.resolve(conn);
|
|
693
|
+
} catch (err) {
|
|
694
|
+
return Promise.reject(err);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
async closeConnection(database, readonly) {
|
|
698
|
+
try {
|
|
699
|
+
if (database.endsWith(".db"))
|
|
700
|
+
database = database.slice(0, -3);
|
|
701
|
+
await this.sqlite.closeConnection({ database, readonly });
|
|
702
|
+
const connName = readonly ? `RO_${database}` : `RW_${database}`;
|
|
703
|
+
this._connectionDict.delete(connName);
|
|
704
|
+
return Promise.resolve();
|
|
705
|
+
} catch (err) {
|
|
706
|
+
return Promise.reject(err);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
async isConnection(database, readonly) {
|
|
710
|
+
const res = {};
|
|
711
|
+
if (database.endsWith(".db"))
|
|
712
|
+
database = database.slice(0, -3);
|
|
713
|
+
const connName = readonly ? `RO_${database}` : `RW_${database}`;
|
|
714
|
+
res.result = this._connectionDict.has(connName);
|
|
715
|
+
return Promise.resolve(res);
|
|
716
|
+
}
|
|
717
|
+
async retrieveConnection(database, readonly) {
|
|
718
|
+
if (database.endsWith(".db"))
|
|
719
|
+
database = database.slice(0, -3);
|
|
720
|
+
const connName = readonly ? `RO_${database}` : `RW_${database}`;
|
|
721
|
+
if (this._connectionDict.has(connName)) {
|
|
722
|
+
const conn = this._connectionDict.get(connName);
|
|
723
|
+
if (typeof conn != "undefined")
|
|
724
|
+
return Promise.resolve(conn);
|
|
725
|
+
else {
|
|
726
|
+
return Promise.reject(`Connection ${database} is undefined`);
|
|
727
|
+
}
|
|
728
|
+
} else {
|
|
729
|
+
return Promise.reject(`Connection ${database} does not exist`);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
async getNCDatabasePath(path, database) {
|
|
733
|
+
try {
|
|
734
|
+
const databasePath = await this.sqlite.getNCDatabasePath({
|
|
735
|
+
path,
|
|
736
|
+
database
|
|
737
|
+
});
|
|
738
|
+
return Promise.resolve(databasePath);
|
|
739
|
+
} catch (err) {
|
|
740
|
+
return Promise.reject(err);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
async createNCConnection(databasePath, version) {
|
|
744
|
+
try {
|
|
745
|
+
await this.sqlite.createNCConnection({
|
|
746
|
+
databasePath,
|
|
747
|
+
version
|
|
748
|
+
});
|
|
749
|
+
const conn = new SQLiteDBConnection(databasePath, true, this.sqlite);
|
|
750
|
+
const connName = `RO_${databasePath})`;
|
|
751
|
+
this._connectionDict.set(connName, conn);
|
|
752
|
+
return Promise.resolve(conn);
|
|
753
|
+
} catch (err) {
|
|
754
|
+
return Promise.reject(err);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
async closeNCConnection(databasePath) {
|
|
758
|
+
try {
|
|
759
|
+
await this.sqlite.closeNCConnection({ databasePath });
|
|
760
|
+
const connName = `RO_${databasePath})`;
|
|
761
|
+
this._connectionDict.delete(connName);
|
|
762
|
+
return Promise.resolve();
|
|
763
|
+
} catch (err) {
|
|
764
|
+
return Promise.reject(err);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
async isNCConnection(databasePath) {
|
|
768
|
+
const res = {};
|
|
769
|
+
const connName = `RO_${databasePath})`;
|
|
770
|
+
res.result = this._connectionDict.has(connName);
|
|
771
|
+
return Promise.resolve(res);
|
|
772
|
+
}
|
|
773
|
+
async retrieveNCConnection(databasePath) {
|
|
774
|
+
if (this._connectionDict.has(databasePath)) {
|
|
775
|
+
const connName = `RO_${databasePath})`;
|
|
776
|
+
const conn = this._connectionDict.get(connName);
|
|
777
|
+
if (typeof conn != "undefined")
|
|
778
|
+
return Promise.resolve(conn);
|
|
779
|
+
else {
|
|
780
|
+
return Promise.reject(`Connection ${databasePath} is undefined`);
|
|
781
|
+
}
|
|
782
|
+
} else {
|
|
783
|
+
return Promise.reject(`Connection ${databasePath} does not exist`);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
async isNCDatabase(databasePath) {
|
|
787
|
+
try {
|
|
788
|
+
const res = await this.sqlite.isNCDatabase({ databasePath });
|
|
789
|
+
return Promise.resolve(res);
|
|
790
|
+
} catch (err) {
|
|
791
|
+
return Promise.reject(err);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
async retrieveAllConnections() {
|
|
795
|
+
return this._connectionDict;
|
|
796
|
+
}
|
|
797
|
+
async closeAllConnections() {
|
|
798
|
+
const delDict = /* @__PURE__ */ new Map();
|
|
799
|
+
try {
|
|
800
|
+
for (const key of this._connectionDict.keys()) {
|
|
801
|
+
const database = key.substring(3);
|
|
802
|
+
const readonly = key.substring(0, 3) === "RO_" ? true : false;
|
|
803
|
+
await this.sqlite.closeConnection({ database, readonly });
|
|
804
|
+
delDict.set(key, null);
|
|
805
|
+
}
|
|
806
|
+
for (const key of delDict.keys()) {
|
|
807
|
+
this._connectionDict.delete(key);
|
|
808
|
+
}
|
|
809
|
+
return Promise.resolve();
|
|
810
|
+
} catch (err) {
|
|
811
|
+
return Promise.reject(err);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
async checkConnectionsConsistency() {
|
|
815
|
+
try {
|
|
816
|
+
const keys = [...this._connectionDict.keys()];
|
|
817
|
+
const openModes = [];
|
|
818
|
+
const dbNames = [];
|
|
819
|
+
for (const key of keys) {
|
|
820
|
+
openModes.push(key.substring(0, 2));
|
|
821
|
+
dbNames.push(key.substring(3));
|
|
822
|
+
}
|
|
823
|
+
const res = await this.sqlite.checkConnectionsConsistency({
|
|
824
|
+
dbNames,
|
|
825
|
+
openModes
|
|
826
|
+
});
|
|
827
|
+
if (!res.result)
|
|
828
|
+
this._connectionDict = /* @__PURE__ */ new Map();
|
|
829
|
+
return Promise.resolve(res);
|
|
830
|
+
} catch (err) {
|
|
831
|
+
this._connectionDict = /* @__PURE__ */ new Map();
|
|
832
|
+
return Promise.reject(err);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
async importFromJson(jsonstring) {
|
|
836
|
+
try {
|
|
837
|
+
const ret = await this.sqlite.importFromJson({ jsonstring });
|
|
838
|
+
return Promise.resolve(ret);
|
|
839
|
+
} catch (err) {
|
|
840
|
+
return Promise.reject(err);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
async isJsonValid(jsonstring) {
|
|
844
|
+
try {
|
|
845
|
+
const ret = await this.sqlite.isJsonValid({ jsonstring });
|
|
846
|
+
return Promise.resolve(ret);
|
|
847
|
+
} catch (err) {
|
|
848
|
+
return Promise.reject(err);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
async copyFromAssets(overwrite) {
|
|
852
|
+
const mOverwrite = overwrite != null ? overwrite : true;
|
|
853
|
+
try {
|
|
854
|
+
await this.sqlite.copyFromAssets({ overwrite: mOverwrite });
|
|
855
|
+
return Promise.resolve();
|
|
856
|
+
} catch (err) {
|
|
857
|
+
return Promise.reject(err);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
async getFromHTTPRequest(url, overwrite) {
|
|
861
|
+
const mOverwrite = overwrite != null ? overwrite : true;
|
|
862
|
+
try {
|
|
863
|
+
await this.sqlite.getFromHTTPRequest({ url, overwrite: mOverwrite });
|
|
864
|
+
return Promise.resolve();
|
|
865
|
+
} catch (err) {
|
|
866
|
+
return Promise.reject(err);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
async isDatabaseEncrypted(database) {
|
|
870
|
+
if (database.endsWith(".db"))
|
|
871
|
+
database = database.slice(0, -3);
|
|
872
|
+
try {
|
|
873
|
+
const res = await this.sqlite.isDatabaseEncrypted({ database });
|
|
874
|
+
return Promise.resolve(res);
|
|
875
|
+
} catch (err) {
|
|
876
|
+
return Promise.reject(err);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
async isInConfigEncryption() {
|
|
880
|
+
try {
|
|
881
|
+
const res = await this.sqlite.isInConfigEncryption();
|
|
882
|
+
return Promise.resolve(res);
|
|
883
|
+
} catch (err) {
|
|
884
|
+
return Promise.reject(err);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
async isInConfigBiometricAuth() {
|
|
888
|
+
try {
|
|
889
|
+
const res = await this.sqlite.isInConfigBiometricAuth();
|
|
890
|
+
return Promise.resolve(res);
|
|
891
|
+
} catch (err) {
|
|
892
|
+
return Promise.reject(err);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
async isDatabase(database) {
|
|
896
|
+
if (database.endsWith(".db"))
|
|
897
|
+
database = database.slice(0, -3);
|
|
898
|
+
try {
|
|
899
|
+
const res = await this.sqlite.isDatabase({ database });
|
|
900
|
+
return Promise.resolve(res);
|
|
901
|
+
} catch (err) {
|
|
902
|
+
return Promise.reject(err);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
async getDatabaseList() {
|
|
906
|
+
try {
|
|
907
|
+
const res = await this.sqlite.getDatabaseList();
|
|
908
|
+
const values = res.values;
|
|
909
|
+
values.sort();
|
|
910
|
+
const ret = { values };
|
|
911
|
+
return Promise.resolve(ret);
|
|
912
|
+
} catch (err) {
|
|
913
|
+
return Promise.reject(err);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
async getMigratableDbList(folderPath) {
|
|
917
|
+
const path = folderPath ? folderPath : "default";
|
|
918
|
+
try {
|
|
919
|
+
const res = await this.sqlite.getMigratableDbList({
|
|
920
|
+
folderPath: path
|
|
921
|
+
});
|
|
922
|
+
return Promise.resolve(res);
|
|
923
|
+
} catch (err) {
|
|
924
|
+
return Promise.reject(err);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
async addSQLiteSuffix(folderPath, dbNameList) {
|
|
928
|
+
const path = folderPath ? folderPath : "default";
|
|
929
|
+
const dbList = dbNameList ? dbNameList : [];
|
|
930
|
+
try {
|
|
931
|
+
const res = await this.sqlite.addSQLiteSuffix({
|
|
932
|
+
folderPath: path,
|
|
933
|
+
dbNameList: dbList
|
|
934
|
+
});
|
|
935
|
+
return Promise.resolve(res);
|
|
936
|
+
} catch (err) {
|
|
937
|
+
return Promise.reject(err);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
async deleteOldDatabases(folderPath, dbNameList) {
|
|
941
|
+
const path = folderPath ? folderPath : "default";
|
|
942
|
+
const dbList = dbNameList ? dbNameList : [];
|
|
943
|
+
try {
|
|
944
|
+
const res = await this.sqlite.deleteOldDatabases({
|
|
945
|
+
folderPath: path,
|
|
946
|
+
dbNameList: dbList
|
|
947
|
+
});
|
|
948
|
+
return Promise.resolve(res);
|
|
949
|
+
} catch (err) {
|
|
950
|
+
return Promise.reject(err);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
async moveDatabasesAndAddSuffix(folderPath, dbNameList) {
|
|
954
|
+
const path = folderPath ? folderPath : "default";
|
|
955
|
+
const dbList = dbNameList ? dbNameList : [];
|
|
956
|
+
return this.sqlite.moveDatabasesAndAddSuffix({
|
|
957
|
+
folderPath: path,
|
|
958
|
+
dbNameList: dbList
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
SQLiteDBConnection = class {
|
|
963
|
+
constructor(dbName2, readonly, sqlite) {
|
|
964
|
+
this.dbName = dbName2;
|
|
965
|
+
this.readonly = readonly;
|
|
966
|
+
this.sqlite = sqlite;
|
|
967
|
+
}
|
|
968
|
+
getConnectionDBName() {
|
|
969
|
+
return this.dbName;
|
|
970
|
+
}
|
|
971
|
+
getConnectionReadOnly() {
|
|
972
|
+
return this.readonly;
|
|
973
|
+
}
|
|
974
|
+
async open() {
|
|
975
|
+
try {
|
|
976
|
+
await this.sqlite.open({
|
|
977
|
+
database: this.dbName,
|
|
978
|
+
readonly: this.readonly
|
|
979
|
+
});
|
|
980
|
+
return Promise.resolve();
|
|
981
|
+
} catch (err) {
|
|
982
|
+
return Promise.reject(err);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
async close() {
|
|
986
|
+
try {
|
|
987
|
+
await this.sqlite.close({
|
|
988
|
+
database: this.dbName,
|
|
989
|
+
readonly: this.readonly
|
|
990
|
+
});
|
|
991
|
+
return Promise.resolve();
|
|
992
|
+
} catch (err) {
|
|
993
|
+
return Promise.reject(err);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
async beginTransaction() {
|
|
997
|
+
try {
|
|
998
|
+
const changes = await this.sqlite.beginTransaction({
|
|
999
|
+
database: this.dbName
|
|
1000
|
+
});
|
|
1001
|
+
return Promise.resolve(changes);
|
|
1002
|
+
} catch (err) {
|
|
1003
|
+
return Promise.reject(err);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
async commitTransaction() {
|
|
1007
|
+
try {
|
|
1008
|
+
const changes = await this.sqlite.commitTransaction({
|
|
1009
|
+
database: this.dbName
|
|
1010
|
+
});
|
|
1011
|
+
return Promise.resolve(changes);
|
|
1012
|
+
} catch (err) {
|
|
1013
|
+
return Promise.reject(err);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
async rollbackTransaction() {
|
|
1017
|
+
try {
|
|
1018
|
+
const changes = await this.sqlite.rollbackTransaction({
|
|
1019
|
+
database: this.dbName
|
|
1020
|
+
});
|
|
1021
|
+
return Promise.resolve(changes);
|
|
1022
|
+
} catch (err) {
|
|
1023
|
+
return Promise.reject(err);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
async isTransactionActive() {
|
|
1027
|
+
try {
|
|
1028
|
+
const result = await this.sqlite.isTransactionActive({
|
|
1029
|
+
database: this.dbName
|
|
1030
|
+
});
|
|
1031
|
+
return Promise.resolve(result);
|
|
1032
|
+
} catch (err) {
|
|
1033
|
+
return Promise.reject(err);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
async loadExtension(path) {
|
|
1037
|
+
try {
|
|
1038
|
+
await this.sqlite.loadExtension({
|
|
1039
|
+
database: this.dbName,
|
|
1040
|
+
path,
|
|
1041
|
+
readonly: this.readonly
|
|
1042
|
+
});
|
|
1043
|
+
return Promise.resolve();
|
|
1044
|
+
} catch (err) {
|
|
1045
|
+
return Promise.reject(err);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
async enableLoadExtension(toggle) {
|
|
1049
|
+
try {
|
|
1050
|
+
await this.sqlite.enableLoadExtension({
|
|
1051
|
+
database: this.dbName,
|
|
1052
|
+
toggle,
|
|
1053
|
+
readonly: this.readonly
|
|
1054
|
+
});
|
|
1055
|
+
return Promise.resolve();
|
|
1056
|
+
} catch (err) {
|
|
1057
|
+
return Promise.reject(err);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
async getUrl() {
|
|
1061
|
+
try {
|
|
1062
|
+
const res = await this.sqlite.getUrl({
|
|
1063
|
+
database: this.dbName,
|
|
1064
|
+
readonly: this.readonly
|
|
1065
|
+
});
|
|
1066
|
+
return Promise.resolve(res);
|
|
1067
|
+
} catch (err) {
|
|
1068
|
+
return Promise.reject(err);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
async getVersion() {
|
|
1072
|
+
try {
|
|
1073
|
+
const version = await this.sqlite.getVersion({
|
|
1074
|
+
database: this.dbName,
|
|
1075
|
+
readonly: this.readonly
|
|
1076
|
+
});
|
|
1077
|
+
return Promise.resolve(version);
|
|
1078
|
+
} catch (err) {
|
|
1079
|
+
return Promise.reject(err);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
async getTableList() {
|
|
1083
|
+
try {
|
|
1084
|
+
const res = await this.sqlite.getTableList({
|
|
1085
|
+
database: this.dbName,
|
|
1086
|
+
readonly: this.readonly
|
|
1087
|
+
});
|
|
1088
|
+
return Promise.resolve(res);
|
|
1089
|
+
} catch (err) {
|
|
1090
|
+
return Promise.reject(err);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
async execute(statements, transaction = true, isSQL92 = true) {
|
|
1094
|
+
try {
|
|
1095
|
+
if (!this.readonly) {
|
|
1096
|
+
const res = await this.sqlite.execute({
|
|
1097
|
+
database: this.dbName,
|
|
1098
|
+
statements,
|
|
1099
|
+
transaction,
|
|
1100
|
+
readonly: false,
|
|
1101
|
+
isSQL92
|
|
1102
|
+
});
|
|
1103
|
+
return Promise.resolve(res);
|
|
1104
|
+
} else {
|
|
1105
|
+
return Promise.reject("not allowed in read-only mode");
|
|
1106
|
+
}
|
|
1107
|
+
} catch (err) {
|
|
1108
|
+
return Promise.reject(err);
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
async query(statement, values, isSQL92 = true) {
|
|
1112
|
+
let res;
|
|
1113
|
+
try {
|
|
1114
|
+
if (values && values.length > 0) {
|
|
1115
|
+
res = await this.sqlite.query({
|
|
1116
|
+
database: this.dbName,
|
|
1117
|
+
statement,
|
|
1118
|
+
values,
|
|
1119
|
+
readonly: this.readonly,
|
|
1120
|
+
isSQL92: true
|
|
1121
|
+
});
|
|
1122
|
+
} else {
|
|
1123
|
+
res = await this.sqlite.query({
|
|
1124
|
+
database: this.dbName,
|
|
1125
|
+
statement,
|
|
1126
|
+
values: [],
|
|
1127
|
+
readonly: this.readonly,
|
|
1128
|
+
isSQL92
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
res = await this.reorderRows(res);
|
|
1132
|
+
return Promise.resolve(res);
|
|
1133
|
+
} catch (err) {
|
|
1134
|
+
return Promise.reject(err);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
async run(statement, values, transaction = true, returnMode = "no", isSQL92 = true) {
|
|
1138
|
+
let res;
|
|
1139
|
+
try {
|
|
1140
|
+
if (!this.readonly) {
|
|
1141
|
+
if (values && values.length > 0) {
|
|
1142
|
+
res = await this.sqlite.run({
|
|
1143
|
+
database: this.dbName,
|
|
1144
|
+
statement,
|
|
1145
|
+
values,
|
|
1146
|
+
transaction,
|
|
1147
|
+
readonly: false,
|
|
1148
|
+
returnMode,
|
|
1149
|
+
isSQL92: true
|
|
1150
|
+
});
|
|
1151
|
+
} else {
|
|
1152
|
+
res = await this.sqlite.run({
|
|
1153
|
+
database: this.dbName,
|
|
1154
|
+
statement,
|
|
1155
|
+
values: [],
|
|
1156
|
+
transaction,
|
|
1157
|
+
readonly: false,
|
|
1158
|
+
returnMode,
|
|
1159
|
+
isSQL92
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
res.changes = await this.reorderRows(res.changes);
|
|
1163
|
+
return Promise.resolve(res);
|
|
1164
|
+
} else {
|
|
1165
|
+
return Promise.reject("not allowed in read-only mode");
|
|
1166
|
+
}
|
|
1167
|
+
} catch (err) {
|
|
1168
|
+
return Promise.reject(err);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
async executeSet(set, transaction = true, returnMode = "no", isSQL92 = true) {
|
|
1172
|
+
let res;
|
|
1173
|
+
try {
|
|
1174
|
+
if (!this.readonly) {
|
|
1175
|
+
res = await this.sqlite.executeSet({
|
|
1176
|
+
database: this.dbName,
|
|
1177
|
+
set,
|
|
1178
|
+
transaction,
|
|
1179
|
+
readonly: false,
|
|
1180
|
+
returnMode,
|
|
1181
|
+
isSQL92
|
|
1182
|
+
});
|
|
1183
|
+
res.changes = await this.reorderRows(res.changes);
|
|
1184
|
+
return Promise.resolve(res);
|
|
1185
|
+
} else {
|
|
1186
|
+
return Promise.reject("not allowed in read-only mode");
|
|
1187
|
+
}
|
|
1188
|
+
} catch (err) {
|
|
1189
|
+
return Promise.reject(err);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
async isExists() {
|
|
1193
|
+
try {
|
|
1194
|
+
const res = await this.sqlite.isDBExists({
|
|
1195
|
+
database: this.dbName,
|
|
1196
|
+
readonly: this.readonly
|
|
1197
|
+
});
|
|
1198
|
+
return Promise.resolve(res);
|
|
1199
|
+
} catch (err) {
|
|
1200
|
+
return Promise.reject(err);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
async isTable(table) {
|
|
1204
|
+
try {
|
|
1205
|
+
const res = await this.sqlite.isTableExists({
|
|
1206
|
+
database: this.dbName,
|
|
1207
|
+
table,
|
|
1208
|
+
readonly: this.readonly
|
|
1209
|
+
});
|
|
1210
|
+
return Promise.resolve(res);
|
|
1211
|
+
} catch (err) {
|
|
1212
|
+
return Promise.reject(err);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
async isDBOpen() {
|
|
1216
|
+
try {
|
|
1217
|
+
const res = await this.sqlite.isDBOpen({
|
|
1218
|
+
database: this.dbName,
|
|
1219
|
+
readonly: this.readonly
|
|
1220
|
+
});
|
|
1221
|
+
return Promise.resolve(res);
|
|
1222
|
+
} catch (err) {
|
|
1223
|
+
return Promise.reject(err);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
async delete() {
|
|
1227
|
+
try {
|
|
1228
|
+
if (!this.readonly) {
|
|
1229
|
+
await this.sqlite.deleteDatabase({
|
|
1230
|
+
database: this.dbName,
|
|
1231
|
+
readonly: false
|
|
1232
|
+
});
|
|
1233
|
+
return Promise.resolve();
|
|
1234
|
+
} else {
|
|
1235
|
+
return Promise.reject("not allowed in read-only mode");
|
|
1236
|
+
}
|
|
1237
|
+
} catch (err) {
|
|
1238
|
+
return Promise.reject(err);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
async createSyncTable() {
|
|
1242
|
+
try {
|
|
1243
|
+
if (!this.readonly) {
|
|
1244
|
+
const res = await this.sqlite.createSyncTable({
|
|
1245
|
+
database: this.dbName,
|
|
1246
|
+
readonly: false
|
|
1247
|
+
});
|
|
1248
|
+
return Promise.resolve(res);
|
|
1249
|
+
} else {
|
|
1250
|
+
return Promise.reject("not allowed in read-only mode");
|
|
1251
|
+
}
|
|
1252
|
+
} catch (err) {
|
|
1253
|
+
return Promise.reject(err);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
async setSyncDate(syncdate) {
|
|
1257
|
+
try {
|
|
1258
|
+
if (!this.readonly) {
|
|
1259
|
+
await this.sqlite.setSyncDate({
|
|
1260
|
+
database: this.dbName,
|
|
1261
|
+
syncdate,
|
|
1262
|
+
readonly: false
|
|
1263
|
+
});
|
|
1264
|
+
return Promise.resolve();
|
|
1265
|
+
} else {
|
|
1266
|
+
return Promise.reject("not allowed in read-only mode");
|
|
1267
|
+
}
|
|
1268
|
+
} catch (err) {
|
|
1269
|
+
return Promise.reject(err);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
async getSyncDate() {
|
|
1273
|
+
try {
|
|
1274
|
+
const res = await this.sqlite.getSyncDate({
|
|
1275
|
+
database: this.dbName,
|
|
1276
|
+
readonly: this.readonly
|
|
1277
|
+
});
|
|
1278
|
+
let retDate = "";
|
|
1279
|
+
if (res.syncDate > 0)
|
|
1280
|
+
retDate = new Date(res.syncDate * 1e3).toISOString();
|
|
1281
|
+
return Promise.resolve(retDate);
|
|
1282
|
+
} catch (err) {
|
|
1283
|
+
return Promise.reject(err);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
async exportToJson(mode, encrypted = false) {
|
|
1287
|
+
try {
|
|
1288
|
+
const res = await this.sqlite.exportToJson({
|
|
1289
|
+
database: this.dbName,
|
|
1290
|
+
jsonexportmode: mode,
|
|
1291
|
+
readonly: this.readonly,
|
|
1292
|
+
encrypted
|
|
1293
|
+
});
|
|
1294
|
+
return Promise.resolve(res);
|
|
1295
|
+
} catch (err) {
|
|
1296
|
+
return Promise.reject(err);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
async deleteExportedRows() {
|
|
1300
|
+
try {
|
|
1301
|
+
if (!this.readonly) {
|
|
1302
|
+
await this.sqlite.deleteExportedRows({
|
|
1303
|
+
database: this.dbName,
|
|
1304
|
+
readonly: false
|
|
1305
|
+
});
|
|
1306
|
+
return Promise.resolve();
|
|
1307
|
+
} else {
|
|
1308
|
+
return Promise.reject("not allowed in read-only mode");
|
|
1309
|
+
}
|
|
1310
|
+
} catch (err) {
|
|
1311
|
+
return Promise.reject(err);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
async executeTransaction(txn, isSQL92 = true) {
|
|
1315
|
+
let changes = 0;
|
|
1316
|
+
let isActive = false;
|
|
1317
|
+
if (!this.readonly) {
|
|
1318
|
+
await this.sqlite.beginTransaction({
|
|
1319
|
+
database: this.dbName
|
|
1320
|
+
});
|
|
1321
|
+
isActive = await this.sqlite.isTransactionActive({
|
|
1322
|
+
database: this.dbName
|
|
1323
|
+
});
|
|
1324
|
+
if (!isActive) {
|
|
1325
|
+
return Promise.reject("After Begin Transaction, no transaction active");
|
|
1326
|
+
}
|
|
1327
|
+
try {
|
|
1328
|
+
for (const task of txn) {
|
|
1329
|
+
if (typeof task !== "object" || !("statement" in task)) {
|
|
1330
|
+
throw new Error("Error a task.statement must be provided");
|
|
1331
|
+
}
|
|
1332
|
+
if ("values" in task && task.values && task.values.length > 0) {
|
|
1333
|
+
const retMode = task.statement.toUpperCase().includes("RETURNING") ? "all" : "no";
|
|
1334
|
+
const ret = await this.sqlite.run({
|
|
1335
|
+
database: this.dbName,
|
|
1336
|
+
statement: task.statement,
|
|
1337
|
+
values: task.values,
|
|
1338
|
+
transaction: false,
|
|
1339
|
+
readonly: false,
|
|
1340
|
+
returnMode: retMode,
|
|
1341
|
+
isSQL92
|
|
1342
|
+
});
|
|
1343
|
+
if (ret.changes.changes < 0) {
|
|
1344
|
+
throw new Error("Error in transaction method run ");
|
|
1345
|
+
}
|
|
1346
|
+
changes += ret.changes.changes;
|
|
1347
|
+
} else {
|
|
1348
|
+
const ret = await this.sqlite.execute({
|
|
1349
|
+
database: this.dbName,
|
|
1350
|
+
statements: task.statement,
|
|
1351
|
+
transaction: false,
|
|
1352
|
+
readonly: false
|
|
1353
|
+
});
|
|
1354
|
+
if (ret.changes.changes < 0) {
|
|
1355
|
+
throw new Error("Error in transaction method execute ");
|
|
1356
|
+
}
|
|
1357
|
+
changes += ret.changes.changes;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
const retC = await this.sqlite.commitTransaction({
|
|
1361
|
+
database: this.dbName
|
|
1362
|
+
});
|
|
1363
|
+
changes += retC.changes.changes;
|
|
1364
|
+
const retChanges = { changes: { changes } };
|
|
1365
|
+
return Promise.resolve(retChanges);
|
|
1366
|
+
} catch (err) {
|
|
1367
|
+
const msg = err.message ? err.message : err;
|
|
1368
|
+
await this.sqlite.rollbackTransaction({
|
|
1369
|
+
database: this.dbName
|
|
1370
|
+
});
|
|
1371
|
+
return Promise.reject(msg);
|
|
1372
|
+
}
|
|
1373
|
+
} else {
|
|
1374
|
+
return Promise.reject("not allowed in read-only mode");
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
async reorderRows(res) {
|
|
1378
|
+
const retRes = res;
|
|
1379
|
+
if (res?.values && typeof res.values[0] === "object") {
|
|
1380
|
+
if (Object.keys(res.values[0]).includes("ios_columns")) {
|
|
1381
|
+
const columnList = res.values[0]["ios_columns"];
|
|
1382
|
+
const iosRes = [];
|
|
1383
|
+
for (let i = 1; i < res.values.length; i++) {
|
|
1384
|
+
const rowJson = res.values[i];
|
|
1385
|
+
const resRowJson = {};
|
|
1386
|
+
for (const item of columnList) {
|
|
1387
|
+
resRowJson[item] = rowJson[item];
|
|
1388
|
+
}
|
|
1389
|
+
iosRes.push(resRowJson);
|
|
1390
|
+
}
|
|
1391
|
+
retRes["values"] = iosRes;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
return Promise.resolve(retRes);
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
// node_modules/@capacitor-community/sqlite/dist/esm/web.js
|
|
1401
|
+
var web_exports = {};
|
|
1402
|
+
__export(web_exports, {
|
|
1403
|
+
CapacitorSQLiteWeb: () => CapacitorSQLiteWeb
|
|
1404
|
+
});
|
|
1405
|
+
var CapacitorSQLiteWeb;
|
|
1406
|
+
var init_web = __esm({
|
|
1407
|
+
"node_modules/@capacitor-community/sqlite/dist/esm/web.js"() {
|
|
1408
|
+
init_dist();
|
|
1409
|
+
CapacitorSQLiteWeb = class extends WebPlugin {
|
|
1410
|
+
constructor() {
|
|
1411
|
+
super(...arguments);
|
|
1412
|
+
this.jeepSqliteElement = null;
|
|
1413
|
+
this.isWebStoreOpen = false;
|
|
1414
|
+
}
|
|
1415
|
+
async initWebStore() {
|
|
1416
|
+
await customElements.whenDefined("jeep-sqlite");
|
|
1417
|
+
this.jeepSqliteElement = document.querySelector("jeep-sqlite");
|
|
1418
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1419
|
+
this.jeepSqliteElement.addEventListener("jeepSqliteImportProgress", (event) => {
|
|
1420
|
+
this.notifyListeners("sqliteImportProgressEvent", event.detail);
|
|
1421
|
+
});
|
|
1422
|
+
this.jeepSqliteElement.addEventListener("jeepSqliteExportProgress", (event) => {
|
|
1423
|
+
this.notifyListeners("sqliteExportProgressEvent", event.detail);
|
|
1424
|
+
});
|
|
1425
|
+
this.jeepSqliteElement.addEventListener("jeepSqliteHTTPRequestEnded", (event) => {
|
|
1426
|
+
this.notifyListeners("sqliteHTTPRequestEndedEvent", event.detail);
|
|
1427
|
+
});
|
|
1428
|
+
this.jeepSqliteElement.addEventListener("jeepSqlitePickDatabaseEnded", (event) => {
|
|
1429
|
+
this.notifyListeners("sqlitePickDatabaseEndedEvent", event.detail);
|
|
1430
|
+
});
|
|
1431
|
+
this.jeepSqliteElement.addEventListener("jeepSqliteSaveDatabaseToDisk", (event) => {
|
|
1432
|
+
this.notifyListeners("sqliteSaveDatabaseToDiskEvent", event.detail);
|
|
1433
|
+
});
|
|
1434
|
+
if (!this.isWebStoreOpen) {
|
|
1435
|
+
this.isWebStoreOpen = await this.jeepSqliteElement.isStoreOpen();
|
|
1436
|
+
}
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
async saveToStore(options) {
|
|
1440
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1441
|
+
this.ensureWebstoreIsOpen();
|
|
1442
|
+
try {
|
|
1443
|
+
await this.jeepSqliteElement.saveToStore(options);
|
|
1444
|
+
return;
|
|
1445
|
+
} catch (err) {
|
|
1446
|
+
throw new Error(`${err}`);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
async getFromLocalDiskToStore(options) {
|
|
1450
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1451
|
+
this.ensureWebstoreIsOpen();
|
|
1452
|
+
try {
|
|
1453
|
+
await this.jeepSqliteElement.getFromLocalDiskToStore(options);
|
|
1454
|
+
return;
|
|
1455
|
+
} catch (err) {
|
|
1456
|
+
throw new Error(`${err}`);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
async saveToLocalDisk(options) {
|
|
1460
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1461
|
+
this.ensureWebstoreIsOpen();
|
|
1462
|
+
try {
|
|
1463
|
+
await this.jeepSqliteElement.saveToLocalDisk(options);
|
|
1464
|
+
return;
|
|
1465
|
+
} catch (err) {
|
|
1466
|
+
throw new Error(`${err}`);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
async echo(options) {
|
|
1470
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1471
|
+
const echoResult = await this.jeepSqliteElement.echo(options);
|
|
1472
|
+
return echoResult;
|
|
1473
|
+
}
|
|
1474
|
+
async createConnection(options) {
|
|
1475
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1476
|
+
this.ensureWebstoreIsOpen();
|
|
1477
|
+
try {
|
|
1478
|
+
await this.jeepSqliteElement.createConnection(options);
|
|
1479
|
+
return;
|
|
1480
|
+
} catch (err) {
|
|
1481
|
+
throw new Error(`${err}`);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
async open(options) {
|
|
1485
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1486
|
+
this.ensureWebstoreIsOpen();
|
|
1487
|
+
try {
|
|
1488
|
+
await this.jeepSqliteElement.open(options);
|
|
1489
|
+
return;
|
|
1490
|
+
} catch (err) {
|
|
1491
|
+
throw new Error(`${err}`);
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
async closeConnection(options) {
|
|
1495
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1496
|
+
this.ensureWebstoreIsOpen();
|
|
1497
|
+
try {
|
|
1498
|
+
await this.jeepSqliteElement.closeConnection(options);
|
|
1499
|
+
return;
|
|
1500
|
+
} catch (err) {
|
|
1501
|
+
throw new Error(`${err}`);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
async getVersion(options) {
|
|
1505
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1506
|
+
this.ensureWebstoreIsOpen();
|
|
1507
|
+
try {
|
|
1508
|
+
const versionResult = await this.jeepSqliteElement.getVersion(options);
|
|
1509
|
+
return versionResult;
|
|
1510
|
+
} catch (err) {
|
|
1511
|
+
throw new Error(`${err}`);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
async checkConnectionsConsistency(options) {
|
|
1515
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1516
|
+
try {
|
|
1517
|
+
const consistencyResult = await this.jeepSqliteElement.checkConnectionsConsistency(options);
|
|
1518
|
+
return consistencyResult;
|
|
1519
|
+
} catch (err) {
|
|
1520
|
+
throw new Error(`${err}`);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
async close(options) {
|
|
1524
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1525
|
+
this.ensureWebstoreIsOpen();
|
|
1526
|
+
try {
|
|
1527
|
+
await this.jeepSqliteElement.close(options);
|
|
1528
|
+
return;
|
|
1529
|
+
} catch (err) {
|
|
1530
|
+
throw new Error(`${err}`);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
async beginTransaction(options) {
|
|
1534
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1535
|
+
this.ensureWebstoreIsOpen();
|
|
1536
|
+
try {
|
|
1537
|
+
const changes = await this.jeepSqliteElement.beginTransaction(options);
|
|
1538
|
+
return changes;
|
|
1539
|
+
} catch (err) {
|
|
1540
|
+
throw new Error(`${err}`);
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
async commitTransaction(options) {
|
|
1544
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1545
|
+
this.ensureWebstoreIsOpen();
|
|
1546
|
+
try {
|
|
1547
|
+
const changes = await this.jeepSqliteElement.commitTransaction(options);
|
|
1548
|
+
return changes;
|
|
1549
|
+
} catch (err) {
|
|
1550
|
+
throw new Error(`${err}`);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
async rollbackTransaction(options) {
|
|
1554
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1555
|
+
this.ensureWebstoreIsOpen();
|
|
1556
|
+
try {
|
|
1557
|
+
const changes = await this.jeepSqliteElement.rollbackTransaction(options);
|
|
1558
|
+
return changes;
|
|
1559
|
+
} catch (err) {
|
|
1560
|
+
throw new Error(`${err}`);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
async isTransactionActive(options) {
|
|
1564
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1565
|
+
this.ensureWebstoreIsOpen();
|
|
1566
|
+
try {
|
|
1567
|
+
const result = await this.jeepSqliteElement.isTransactionActive(options);
|
|
1568
|
+
return result;
|
|
1569
|
+
} catch (err) {
|
|
1570
|
+
throw new Error(`${err}`);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
async getTableList(options) {
|
|
1574
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1575
|
+
this.ensureWebstoreIsOpen();
|
|
1576
|
+
try {
|
|
1577
|
+
const tableListResult = await this.jeepSqliteElement.getTableList(options);
|
|
1578
|
+
return tableListResult;
|
|
1579
|
+
} catch (err) {
|
|
1580
|
+
throw new Error(`${err}`);
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
async execute(options) {
|
|
1584
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1585
|
+
this.ensureWebstoreIsOpen();
|
|
1586
|
+
try {
|
|
1587
|
+
const executeResult = await this.jeepSqliteElement.execute(options);
|
|
1588
|
+
return executeResult;
|
|
1589
|
+
} catch (err) {
|
|
1590
|
+
throw new Error(`${err}`);
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
async executeSet(options) {
|
|
1594
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1595
|
+
this.ensureWebstoreIsOpen();
|
|
1596
|
+
try {
|
|
1597
|
+
const executeResult = await this.jeepSqliteElement.executeSet(options);
|
|
1598
|
+
return executeResult;
|
|
1599
|
+
} catch (err) {
|
|
1600
|
+
throw new Error(`${err}`);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
async run(options) {
|
|
1604
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1605
|
+
this.ensureWebstoreIsOpen();
|
|
1606
|
+
try {
|
|
1607
|
+
const runResult = await this.jeepSqliteElement.run(options);
|
|
1608
|
+
return runResult;
|
|
1609
|
+
} catch (err) {
|
|
1610
|
+
throw new Error(`${err}`);
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
async query(options) {
|
|
1614
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1615
|
+
this.ensureWebstoreIsOpen();
|
|
1616
|
+
try {
|
|
1617
|
+
const queryResult = await this.jeepSqliteElement.query(options);
|
|
1618
|
+
return queryResult;
|
|
1619
|
+
} catch (err) {
|
|
1620
|
+
throw new Error(`${err}`);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
async isDBExists(options) {
|
|
1624
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1625
|
+
this.ensureWebstoreIsOpen();
|
|
1626
|
+
try {
|
|
1627
|
+
const dbExistsResult = await this.jeepSqliteElement.isDBExists(options);
|
|
1628
|
+
return dbExistsResult;
|
|
1629
|
+
} catch (err) {
|
|
1630
|
+
throw new Error(`${err}`);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
async isDBOpen(options) {
|
|
1634
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1635
|
+
this.ensureWebstoreIsOpen();
|
|
1636
|
+
try {
|
|
1637
|
+
const isDBOpenResult = await this.jeepSqliteElement.isDBOpen(options);
|
|
1638
|
+
return isDBOpenResult;
|
|
1639
|
+
} catch (err) {
|
|
1640
|
+
throw new Error(`${err}`);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
async isDatabase(options) {
|
|
1644
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1645
|
+
this.ensureWebstoreIsOpen();
|
|
1646
|
+
try {
|
|
1647
|
+
const isDatabaseResult = await this.jeepSqliteElement.isDatabase(options);
|
|
1648
|
+
return isDatabaseResult;
|
|
1649
|
+
} catch (err) {
|
|
1650
|
+
throw new Error(`${err}`);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
async isTableExists(options) {
|
|
1654
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1655
|
+
this.ensureWebstoreIsOpen();
|
|
1656
|
+
try {
|
|
1657
|
+
const tableExistsResult = await this.jeepSqliteElement.isTableExists(options);
|
|
1658
|
+
return tableExistsResult;
|
|
1659
|
+
} catch (err) {
|
|
1660
|
+
throw new Error(`${err}`);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
async deleteDatabase(options) {
|
|
1664
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1665
|
+
this.ensureWebstoreIsOpen();
|
|
1666
|
+
try {
|
|
1667
|
+
await this.jeepSqliteElement.deleteDatabase(options);
|
|
1668
|
+
return;
|
|
1669
|
+
} catch (err) {
|
|
1670
|
+
throw new Error(`${err}`);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
async isJsonValid(options) {
|
|
1674
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1675
|
+
this.ensureWebstoreIsOpen();
|
|
1676
|
+
try {
|
|
1677
|
+
const isJsonValidResult = await this.jeepSqliteElement.isJsonValid(options);
|
|
1678
|
+
return isJsonValidResult;
|
|
1679
|
+
} catch (err) {
|
|
1680
|
+
throw new Error(`${err}`);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
async importFromJson(options) {
|
|
1684
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1685
|
+
this.ensureWebstoreIsOpen();
|
|
1686
|
+
try {
|
|
1687
|
+
const importFromJsonResult = await this.jeepSqliteElement.importFromJson(options);
|
|
1688
|
+
return importFromJsonResult;
|
|
1689
|
+
} catch (err) {
|
|
1690
|
+
throw new Error(`${err}`);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
async exportToJson(options) {
|
|
1694
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1695
|
+
this.ensureWebstoreIsOpen();
|
|
1696
|
+
try {
|
|
1697
|
+
const exportToJsonResult = await this.jeepSqliteElement.exportToJson(options);
|
|
1698
|
+
return exportToJsonResult;
|
|
1699
|
+
} catch (err) {
|
|
1700
|
+
throw new Error(`${err}`);
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
async createSyncTable(options) {
|
|
1704
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1705
|
+
this.ensureWebstoreIsOpen();
|
|
1706
|
+
try {
|
|
1707
|
+
const createSyncTableResult = await this.jeepSqliteElement.createSyncTable(options);
|
|
1708
|
+
return createSyncTableResult;
|
|
1709
|
+
} catch (err) {
|
|
1710
|
+
throw new Error(`${err}`);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
async setSyncDate(options) {
|
|
1714
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1715
|
+
this.ensureWebstoreIsOpen();
|
|
1716
|
+
try {
|
|
1717
|
+
await this.jeepSqliteElement.setSyncDate(options);
|
|
1718
|
+
return;
|
|
1719
|
+
} catch (err) {
|
|
1720
|
+
throw new Error(`${err}`);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
async getSyncDate(options) {
|
|
1724
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1725
|
+
this.ensureWebstoreIsOpen();
|
|
1726
|
+
try {
|
|
1727
|
+
const getSyncDateResult = await this.jeepSqliteElement.getSyncDate(options);
|
|
1728
|
+
return getSyncDateResult;
|
|
1729
|
+
} catch (err) {
|
|
1730
|
+
throw new Error(`${err}`);
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
async deleteExportedRows(options) {
|
|
1734
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1735
|
+
this.ensureWebstoreIsOpen();
|
|
1736
|
+
try {
|
|
1737
|
+
await this.jeepSqliteElement.deleteExportedRows(options);
|
|
1738
|
+
return;
|
|
1739
|
+
} catch (err) {
|
|
1740
|
+
throw new Error(`${err}`);
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
async addUpgradeStatement(options) {
|
|
1744
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1745
|
+
this.ensureWebstoreIsOpen();
|
|
1746
|
+
try {
|
|
1747
|
+
await this.jeepSqliteElement.addUpgradeStatement(options);
|
|
1748
|
+
return;
|
|
1749
|
+
} catch (err) {
|
|
1750
|
+
throw new Error(`${err}`);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
async copyFromAssets(options) {
|
|
1754
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1755
|
+
this.ensureWebstoreIsOpen();
|
|
1756
|
+
try {
|
|
1757
|
+
await this.jeepSqliteElement.copyFromAssets(options);
|
|
1758
|
+
return;
|
|
1759
|
+
} catch (err) {
|
|
1760
|
+
throw new Error(`${err}`);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
async getFromHTTPRequest(options) {
|
|
1764
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1765
|
+
this.ensureWebstoreIsOpen();
|
|
1766
|
+
try {
|
|
1767
|
+
await this.jeepSqliteElement.getFromHTTPRequest(options);
|
|
1768
|
+
return;
|
|
1769
|
+
} catch (err) {
|
|
1770
|
+
throw new Error(`${err}`);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
async getDatabaseList() {
|
|
1774
|
+
this.ensureJeepSqliteIsAvailable();
|
|
1775
|
+
this.ensureWebstoreIsOpen();
|
|
1776
|
+
try {
|
|
1777
|
+
const databaseListResult = await this.jeepSqliteElement.getDatabaseList();
|
|
1778
|
+
return databaseListResult;
|
|
1779
|
+
} catch (err) {
|
|
1780
|
+
throw new Error(`${err}`);
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Checks if the `jeep-sqlite` element is present in the DOM.
|
|
1785
|
+
* If it's not in the DOM, this method throws an Error.
|
|
1786
|
+
*
|
|
1787
|
+
* Attention: This will always fail, if the `intWebStore()` method wasn't called before.
|
|
1788
|
+
*/
|
|
1789
|
+
ensureJeepSqliteIsAvailable() {
|
|
1790
|
+
if (this.jeepSqliteElement === null) {
|
|
1791
|
+
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.`);
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
ensureWebstoreIsOpen() {
|
|
1795
|
+
if (!this.isWebStoreOpen) {
|
|
1796
|
+
throw new Error('WebStore is not open yet. You have to call "initWebStore()" first.');
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
////////////////////////////////////
|
|
1800
|
+
////// UNIMPLEMENTED METHODS
|
|
1801
|
+
////////////////////////////////////
|
|
1802
|
+
async getUrl() {
|
|
1803
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1804
|
+
}
|
|
1805
|
+
async getMigratableDbList(options) {
|
|
1806
|
+
console.log("getMigratableDbList", options);
|
|
1807
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1808
|
+
}
|
|
1809
|
+
async addSQLiteSuffix(options) {
|
|
1810
|
+
console.log("addSQLiteSuffix", options);
|
|
1811
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1812
|
+
}
|
|
1813
|
+
async deleteOldDatabases(options) {
|
|
1814
|
+
console.log("deleteOldDatabases", options);
|
|
1815
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1816
|
+
}
|
|
1817
|
+
async moveDatabasesAndAddSuffix(options) {
|
|
1818
|
+
console.log("moveDatabasesAndAddSuffix", options);
|
|
1819
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1820
|
+
}
|
|
1821
|
+
async isSecretStored() {
|
|
1822
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1823
|
+
}
|
|
1824
|
+
async setEncryptionSecret(options) {
|
|
1825
|
+
console.log("setEncryptionSecret", options);
|
|
1826
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1827
|
+
}
|
|
1828
|
+
async changeEncryptionSecret(options) {
|
|
1829
|
+
console.log("changeEncryptionSecret", options);
|
|
1830
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1831
|
+
}
|
|
1832
|
+
async clearEncryptionSecret() {
|
|
1833
|
+
console.log("clearEncryptionSecret");
|
|
1834
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1835
|
+
}
|
|
1836
|
+
async checkEncryptionSecret(options) {
|
|
1837
|
+
console.log("checkEncryptionPassPhrase", options);
|
|
1838
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1839
|
+
}
|
|
1840
|
+
async getNCDatabasePath(options) {
|
|
1841
|
+
console.log("getNCDatabasePath", options);
|
|
1842
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1843
|
+
}
|
|
1844
|
+
async createNCConnection(options) {
|
|
1845
|
+
console.log("createNCConnection", options);
|
|
1846
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1847
|
+
}
|
|
1848
|
+
async closeNCConnection(options) {
|
|
1849
|
+
console.log("closeNCConnection", options);
|
|
1850
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1851
|
+
}
|
|
1852
|
+
async isNCDatabase(options) {
|
|
1853
|
+
console.log("isNCDatabase", options);
|
|
1854
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1855
|
+
}
|
|
1856
|
+
async isDatabaseEncrypted(options) {
|
|
1857
|
+
console.log("isDatabaseEncrypted", options);
|
|
1858
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1859
|
+
}
|
|
1860
|
+
async isInConfigEncryption() {
|
|
1861
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1862
|
+
}
|
|
1863
|
+
async isInConfigBiometricAuth() {
|
|
1864
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1865
|
+
}
|
|
1866
|
+
async loadExtension(options) {
|
|
1867
|
+
console.log("loadExtension", options);
|
|
1868
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1869
|
+
}
|
|
1870
|
+
async enableLoadExtension(options) {
|
|
1871
|
+
console.log("enableLoadExtension", options);
|
|
1872
|
+
throw this.unimplemented("Not implemented on web.");
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
|
|
1878
|
+
// node_modules/@capacitor-community/sqlite/dist/esm/index.js
|
|
1879
|
+
var esm_exports = {};
|
|
1880
|
+
__export(esm_exports, {
|
|
1881
|
+
CapacitorSQLite: () => CapacitorSQLite,
|
|
1882
|
+
SQLiteConnection: () => SQLiteConnection,
|
|
1883
|
+
SQLiteDBConnection: () => SQLiteDBConnection
|
|
1884
|
+
});
|
|
1885
|
+
var CapacitorSQLite;
|
|
1886
|
+
var init_esm = __esm({
|
|
1887
|
+
"node_modules/@capacitor-community/sqlite/dist/esm/index.js"() {
|
|
1888
|
+
init_dist();
|
|
1889
|
+
init_definitions();
|
|
1890
|
+
CapacitorSQLite = registerPlugin("CapacitorSQLite", {
|
|
1891
|
+
web: () => Promise.resolve().then(() => (init_web(), web_exports)).then((m) => new m.CapacitorSQLiteWeb()),
|
|
1892
|
+
electron: () => window.CapacitorCustomPlatform.plugins.CapacitorSQLite
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
});
|
|
1896
|
+
|
|
1897
|
+
// node_modules/@tauri-apps/api/external/tslib/tslib.es6.js
|
|
1898
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
1899
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1900
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1901
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1902
|
+
}
|
|
1903
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
1904
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1905
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1906
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1907
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1908
|
+
}
|
|
1909
|
+
var init_tslib_es6 = __esm({
|
|
1910
|
+
"node_modules/@tauri-apps/api/external/tslib/tslib.es6.js"() {
|
|
1911
|
+
}
|
|
1912
|
+
});
|
|
1913
|
+
|
|
1914
|
+
// node_modules/@tauri-apps/api/core.js
|
|
1915
|
+
function transformCallback(callback, once2 = false) {
|
|
1916
|
+
return window.__TAURI_INTERNALS__.transformCallback(callback, once2);
|
|
1917
|
+
}
|
|
1918
|
+
async function invoke(cmd, args = {}, options) {
|
|
1919
|
+
return window.__TAURI_INTERNALS__.invoke(cmd, args, options);
|
|
1920
|
+
}
|
|
1921
|
+
var _Channel_onmessage, _Channel_nextMessageIndex, _Channel_pendingMessages, _Channel_messageEndIndex, _Resource_rid, SERIALIZE_TO_IPC_FN, Channel, Resource;
|
|
1922
|
+
var init_core = __esm({
|
|
1923
|
+
"node_modules/@tauri-apps/api/core.js"() {
|
|
1924
|
+
init_tslib_es6();
|
|
1925
|
+
SERIALIZE_TO_IPC_FN = "__TAURI_TO_IPC_KEY__";
|
|
1926
|
+
Channel = class {
|
|
1927
|
+
constructor(onmessage) {
|
|
1928
|
+
_Channel_onmessage.set(this, void 0);
|
|
1929
|
+
_Channel_nextMessageIndex.set(this, 0);
|
|
1930
|
+
_Channel_pendingMessages.set(this, []);
|
|
1931
|
+
_Channel_messageEndIndex.set(this, void 0);
|
|
1932
|
+
__classPrivateFieldSet(this, _Channel_onmessage, onmessage || (() => {
|
|
1933
|
+
}), "f");
|
|
1934
|
+
this.id = transformCallback((rawMessage) => {
|
|
1935
|
+
const index = rawMessage.index;
|
|
1936
|
+
if ("end" in rawMessage) {
|
|
1937
|
+
if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {
|
|
1938
|
+
this.cleanupCallback();
|
|
1939
|
+
} else {
|
|
1940
|
+
__classPrivateFieldSet(this, _Channel_messageEndIndex, index, "f");
|
|
1941
|
+
}
|
|
1942
|
+
return;
|
|
1943
|
+
}
|
|
1944
|
+
const message = rawMessage.message;
|
|
1945
|
+
if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {
|
|
1946
|
+
__classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message);
|
|
1947
|
+
__classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");
|
|
1948
|
+
while (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") in __classPrivateFieldGet(this, _Channel_pendingMessages, "f")) {
|
|
1949
|
+
const message2 = __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];
|
|
1950
|
+
__classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message2);
|
|
1951
|
+
delete __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];
|
|
1952
|
+
__classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");
|
|
1953
|
+
}
|
|
1954
|
+
if (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") === __classPrivateFieldGet(this, _Channel_messageEndIndex, "f")) {
|
|
1955
|
+
this.cleanupCallback();
|
|
1956
|
+
}
|
|
1957
|
+
} else {
|
|
1958
|
+
__classPrivateFieldGet(this, _Channel_pendingMessages, "f")[index] = message;
|
|
1959
|
+
}
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
cleanupCallback() {
|
|
1963
|
+
window.__TAURI_INTERNALS__.unregisterCallback(this.id);
|
|
1964
|
+
}
|
|
1965
|
+
set onmessage(handler) {
|
|
1966
|
+
__classPrivateFieldSet(this, _Channel_onmessage, handler, "f");
|
|
1967
|
+
}
|
|
1968
|
+
get onmessage() {
|
|
1969
|
+
return __classPrivateFieldGet(this, _Channel_onmessage, "f");
|
|
1970
|
+
}
|
|
1971
|
+
[(_Channel_onmessage = /* @__PURE__ */ new WeakMap(), _Channel_nextMessageIndex = /* @__PURE__ */ new WeakMap(), _Channel_pendingMessages = /* @__PURE__ */ new WeakMap(), _Channel_messageEndIndex = /* @__PURE__ */ new WeakMap(), SERIALIZE_TO_IPC_FN)]() {
|
|
1972
|
+
return `__CHANNEL__:${this.id}`;
|
|
1973
|
+
}
|
|
1974
|
+
toJSON() {
|
|
1975
|
+
return this[SERIALIZE_TO_IPC_FN]();
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
Resource = class {
|
|
1979
|
+
get rid() {
|
|
1980
|
+
return __classPrivateFieldGet(this, _Resource_rid, "f");
|
|
1981
|
+
}
|
|
1982
|
+
constructor(rid) {
|
|
1983
|
+
_Resource_rid.set(this, void 0);
|
|
1984
|
+
__classPrivateFieldSet(this, _Resource_rid, rid, "f");
|
|
1985
|
+
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Destroys and cleans up this resource from memory.
|
|
1988
|
+
* **You should not call any method on this object anymore and should drop any reference to it.**
|
|
1989
|
+
*/
|
|
1990
|
+
async close() {
|
|
1991
|
+
return invoke("plugin:resources|close", {
|
|
1992
|
+
rid: this.rid
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
_Resource_rid = /* @__PURE__ */ new WeakMap();
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
|
|
2000
|
+
// node_modules/@tauri-apps/plugin-sql/dist-js/index.js
|
|
2001
|
+
var dist_js_exports = {};
|
|
2002
|
+
__export(dist_js_exports, {
|
|
2003
|
+
default: () => Database
|
|
2004
|
+
});
|
|
2005
|
+
var Database;
|
|
2006
|
+
var init_dist_js = __esm({
|
|
2007
|
+
"node_modules/@tauri-apps/plugin-sql/dist-js/index.js"() {
|
|
2008
|
+
init_core();
|
|
2009
|
+
Database = class _Database {
|
|
2010
|
+
constructor(path) {
|
|
2011
|
+
this.path = path;
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* **load**
|
|
2015
|
+
*
|
|
2016
|
+
* A static initializer which connects to the underlying database and
|
|
2017
|
+
* returns a `Database` instance once a connection to the database is established.
|
|
2018
|
+
*
|
|
2019
|
+
* # Sqlite
|
|
2020
|
+
*
|
|
2021
|
+
* The path is relative to `tauri::path::BaseDirectory::App` and must start with `sqlite:`.
|
|
2022
|
+
*
|
|
2023
|
+
* @example
|
|
2024
|
+
* ```ts
|
|
2025
|
+
* const db = await Database.load("sqlite:test.db");
|
|
2026
|
+
* ```
|
|
2027
|
+
*/
|
|
2028
|
+
static async load(path) {
|
|
2029
|
+
const _path = await invoke("plugin:sql|load", {
|
|
2030
|
+
db: path
|
|
2031
|
+
});
|
|
2032
|
+
return new _Database(_path);
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* **get**
|
|
2036
|
+
*
|
|
2037
|
+
* A static initializer which synchronously returns an instance of
|
|
2038
|
+
* the Database class while deferring the actual database connection
|
|
2039
|
+
* until the first invocation or selection on the database.
|
|
2040
|
+
*
|
|
2041
|
+
* # Sqlite
|
|
2042
|
+
*
|
|
2043
|
+
* The path is relative to `tauri::path::BaseDirectory::App` and must start with `sqlite:`.
|
|
2044
|
+
*
|
|
2045
|
+
* @example
|
|
2046
|
+
* ```ts
|
|
2047
|
+
* const db = Database.get("sqlite:test.db");
|
|
2048
|
+
* ```
|
|
2049
|
+
*/
|
|
2050
|
+
static get(path) {
|
|
2051
|
+
return new _Database(path);
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* **execute**
|
|
2055
|
+
*
|
|
2056
|
+
* Passes a SQL expression to the database for execution.
|
|
2057
|
+
*
|
|
2058
|
+
* @example
|
|
2059
|
+
* ```ts
|
|
2060
|
+
* // for sqlite & postgres
|
|
2061
|
+
* // INSERT example
|
|
2062
|
+
* const result = await db.execute(
|
|
2063
|
+
* "INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
|
|
2064
|
+
* [ todos.id, todos.title, todos.status ]
|
|
2065
|
+
* );
|
|
2066
|
+
* // UPDATE example
|
|
2067
|
+
* const result = await db.execute(
|
|
2068
|
+
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
|
2069
|
+
* [ todos.title, todos.status, todos.id ]
|
|
2070
|
+
* );
|
|
2071
|
+
*
|
|
2072
|
+
* // for mysql
|
|
2073
|
+
* // INSERT example
|
|
2074
|
+
* const result = await db.execute(
|
|
2075
|
+
* "INSERT into todos (id, title, status) VALUES (?, ?, ?)",
|
|
2076
|
+
* [ todos.id, todos.title, todos.status ]
|
|
2077
|
+
* );
|
|
2078
|
+
* // UPDATE example
|
|
2079
|
+
* const result = await db.execute(
|
|
2080
|
+
* "UPDATE todos SET title = ?, completed = ? WHERE id = ?",
|
|
2081
|
+
* [ todos.title, todos.status, todos.id ]
|
|
2082
|
+
* );
|
|
2083
|
+
* ```
|
|
2084
|
+
*/
|
|
2085
|
+
async execute(query, bindValues) {
|
|
2086
|
+
const [rowsAffected, lastInsertId] = await invoke("plugin:sql|execute", {
|
|
2087
|
+
db: this.path,
|
|
2088
|
+
query,
|
|
2089
|
+
values: bindValues ?? []
|
|
2090
|
+
});
|
|
2091
|
+
return {
|
|
2092
|
+
lastInsertId,
|
|
2093
|
+
rowsAffected
|
|
2094
|
+
};
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* **select**
|
|
2098
|
+
*
|
|
2099
|
+
* Passes in a SELECT query to the database for execution.
|
|
2100
|
+
*
|
|
2101
|
+
* @example
|
|
2102
|
+
* ```ts
|
|
2103
|
+
* // for sqlite & postgres
|
|
2104
|
+
* const result = await db.select(
|
|
2105
|
+
* "SELECT * from todos WHERE id = $1", [ id ]
|
|
2106
|
+
* );
|
|
2107
|
+
*
|
|
2108
|
+
* // for mysql
|
|
2109
|
+
* const result = await db.select(
|
|
2110
|
+
* "SELECT * from todos WHERE id = ?", [ id ]
|
|
2111
|
+
* );
|
|
2112
|
+
* ```
|
|
2113
|
+
*/
|
|
2114
|
+
async select(query, bindValues) {
|
|
2115
|
+
const result = await invoke("plugin:sql|select", {
|
|
2116
|
+
db: this.path,
|
|
2117
|
+
query,
|
|
2118
|
+
values: bindValues ?? []
|
|
2119
|
+
});
|
|
2120
|
+
return result;
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* **close**
|
|
2124
|
+
*
|
|
2125
|
+
* Closes the database connection pool.
|
|
2126
|
+
*
|
|
2127
|
+
* @example
|
|
2128
|
+
* ```ts
|
|
2129
|
+
* const success = await db.close()
|
|
2130
|
+
* ```
|
|
2131
|
+
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
|
2132
|
+
*/
|
|
2133
|
+
async close(db) {
|
|
2134
|
+
const success = await invoke("plugin:sql|close", {
|
|
2135
|
+
db
|
|
2136
|
+
});
|
|
2137
|
+
return success;
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
});
|
|
2142
|
+
|
|
570
2143
|
// node_modules/@capacitor/app/dist/esm/definitions.js
|
|
571
|
-
var
|
|
2144
|
+
var init_definitions2 = __esm({
|
|
572
2145
|
"node_modules/@capacitor/app/dist/esm/definitions.js"() {
|
|
573
2146
|
}
|
|
574
2147
|
});
|
|
575
2148
|
|
|
576
2149
|
// node_modules/@capacitor/app/dist/esm/web.js
|
|
577
|
-
var
|
|
578
|
-
__export(
|
|
2150
|
+
var web_exports2 = {};
|
|
2151
|
+
__export(web_exports2, {
|
|
579
2152
|
AppWeb: () => AppWeb
|
|
580
2153
|
});
|
|
581
2154
|
var AppWeb;
|
|
582
|
-
var
|
|
2155
|
+
var init_web2 = __esm({
|
|
583
2156
|
"node_modules/@capacitor/app/dist/esm/web.js"() {
|
|
584
2157
|
init_dist();
|
|
585
2158
|
AppWeb = class extends WebPlugin {
|
|
@@ -627,30 +2200,30 @@ var Tevroc = (() => {
|
|
|
627
2200
|
|
|
628
2201
|
// node_modules/@capacitor/app/dist/esm/index.js
|
|
629
2202
|
var App;
|
|
630
|
-
var
|
|
2203
|
+
var init_esm2 = __esm({
|
|
631
2204
|
"node_modules/@capacitor/app/dist/esm/index.js"() {
|
|
632
2205
|
init_dist();
|
|
633
|
-
|
|
2206
|
+
init_definitions2();
|
|
634
2207
|
App = registerPlugin("App", {
|
|
635
|
-
web: () => Promise.resolve().then(() => (
|
|
2208
|
+
web: () => Promise.resolve().then(() => (init_web2(), web_exports2)).then((m) => new m.AppWeb())
|
|
636
2209
|
});
|
|
637
2210
|
}
|
|
638
2211
|
});
|
|
639
2212
|
|
|
640
2213
|
// node_modules/@capacitor/browser/dist/esm/definitions.js
|
|
641
|
-
var
|
|
2214
|
+
var init_definitions3 = __esm({
|
|
642
2215
|
"node_modules/@capacitor/browser/dist/esm/definitions.js"() {
|
|
643
2216
|
}
|
|
644
2217
|
});
|
|
645
2218
|
|
|
646
2219
|
// node_modules/@capacitor/browser/dist/esm/web.js
|
|
647
|
-
var
|
|
648
|
-
__export(
|
|
2220
|
+
var web_exports3 = {};
|
|
2221
|
+
__export(web_exports3, {
|
|
649
2222
|
Browser: () => Browser,
|
|
650
2223
|
BrowserWeb: () => BrowserWeb
|
|
651
2224
|
});
|
|
652
2225
|
var BrowserWeb, Browser;
|
|
653
|
-
var
|
|
2226
|
+
var init_web3 = __esm({
|
|
654
2227
|
"node_modules/@capacitor/browser/dist/esm/web.js"() {
|
|
655
2228
|
init_dist();
|
|
656
2229
|
BrowserWeb = class extends WebPlugin {
|
|
@@ -679,119 +2252,16 @@ var Tevroc = (() => {
|
|
|
679
2252
|
|
|
680
2253
|
// node_modules/@capacitor/browser/dist/esm/index.js
|
|
681
2254
|
var Browser2;
|
|
682
|
-
var
|
|
2255
|
+
var init_esm3 = __esm({
|
|
683
2256
|
"node_modules/@capacitor/browser/dist/esm/index.js"() {
|
|
684
2257
|
init_dist();
|
|
685
|
-
|
|
2258
|
+
init_definitions3();
|
|
686
2259
|
Browser2 = registerPlugin("Browser", {
|
|
687
|
-
web: () => Promise.resolve().then(() => (
|
|
2260
|
+
web: () => Promise.resolve().then(() => (init_web3(), web_exports3)).then((m) => new m.BrowserWeb())
|
|
688
2261
|
});
|
|
689
2262
|
}
|
|
690
2263
|
});
|
|
691
2264
|
|
|
692
|
-
// node_modules/@tauri-apps/api/external/tslib/tslib.es6.js
|
|
693
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
694
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
695
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
696
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
697
|
-
}
|
|
698
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
699
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
700
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
701
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
702
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
703
|
-
}
|
|
704
|
-
var init_tslib_es6 = __esm({
|
|
705
|
-
"node_modules/@tauri-apps/api/external/tslib/tslib.es6.js"() {
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
|
|
709
|
-
// node_modules/@tauri-apps/api/core.js
|
|
710
|
-
function transformCallback(callback, once2 = false) {
|
|
711
|
-
return window.__TAURI_INTERNALS__.transformCallback(callback, once2);
|
|
712
|
-
}
|
|
713
|
-
async function invoke(cmd, args = {}, options) {
|
|
714
|
-
return window.__TAURI_INTERNALS__.invoke(cmd, args, options);
|
|
715
|
-
}
|
|
716
|
-
var _Channel_onmessage, _Channel_nextMessageIndex, _Channel_pendingMessages, _Channel_messageEndIndex, _Resource_rid, SERIALIZE_TO_IPC_FN, Channel, Resource;
|
|
717
|
-
var init_core = __esm({
|
|
718
|
-
"node_modules/@tauri-apps/api/core.js"() {
|
|
719
|
-
init_tslib_es6();
|
|
720
|
-
SERIALIZE_TO_IPC_FN = "__TAURI_TO_IPC_KEY__";
|
|
721
|
-
Channel = class {
|
|
722
|
-
constructor(onmessage) {
|
|
723
|
-
_Channel_onmessage.set(this, void 0);
|
|
724
|
-
_Channel_nextMessageIndex.set(this, 0);
|
|
725
|
-
_Channel_pendingMessages.set(this, []);
|
|
726
|
-
_Channel_messageEndIndex.set(this, void 0);
|
|
727
|
-
__classPrivateFieldSet(this, _Channel_onmessage, onmessage || (() => {
|
|
728
|
-
}), "f");
|
|
729
|
-
this.id = transformCallback((rawMessage) => {
|
|
730
|
-
const index = rawMessage.index;
|
|
731
|
-
if ("end" in rawMessage) {
|
|
732
|
-
if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {
|
|
733
|
-
this.cleanupCallback();
|
|
734
|
-
} else {
|
|
735
|
-
__classPrivateFieldSet(this, _Channel_messageEndIndex, index, "f");
|
|
736
|
-
}
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
const message = rawMessage.message;
|
|
740
|
-
if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {
|
|
741
|
-
__classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message);
|
|
742
|
-
__classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");
|
|
743
|
-
while (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") in __classPrivateFieldGet(this, _Channel_pendingMessages, "f")) {
|
|
744
|
-
const message2 = __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];
|
|
745
|
-
__classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message2);
|
|
746
|
-
delete __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];
|
|
747
|
-
__classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");
|
|
748
|
-
}
|
|
749
|
-
if (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") === __classPrivateFieldGet(this, _Channel_messageEndIndex, "f")) {
|
|
750
|
-
this.cleanupCallback();
|
|
751
|
-
}
|
|
752
|
-
} else {
|
|
753
|
-
__classPrivateFieldGet(this, _Channel_pendingMessages, "f")[index] = message;
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
cleanupCallback() {
|
|
758
|
-
window.__TAURI_INTERNALS__.unregisterCallback(this.id);
|
|
759
|
-
}
|
|
760
|
-
set onmessage(handler) {
|
|
761
|
-
__classPrivateFieldSet(this, _Channel_onmessage, handler, "f");
|
|
762
|
-
}
|
|
763
|
-
get onmessage() {
|
|
764
|
-
return __classPrivateFieldGet(this, _Channel_onmessage, "f");
|
|
765
|
-
}
|
|
766
|
-
[(_Channel_onmessage = /* @__PURE__ */ new WeakMap(), _Channel_nextMessageIndex = /* @__PURE__ */ new WeakMap(), _Channel_pendingMessages = /* @__PURE__ */ new WeakMap(), _Channel_messageEndIndex = /* @__PURE__ */ new WeakMap(), SERIALIZE_TO_IPC_FN)]() {
|
|
767
|
-
return `__CHANNEL__:${this.id}`;
|
|
768
|
-
}
|
|
769
|
-
toJSON() {
|
|
770
|
-
return this[SERIALIZE_TO_IPC_FN]();
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
Resource = class {
|
|
774
|
-
get rid() {
|
|
775
|
-
return __classPrivateFieldGet(this, _Resource_rid, "f");
|
|
776
|
-
}
|
|
777
|
-
constructor(rid) {
|
|
778
|
-
_Resource_rid.set(this, void 0);
|
|
779
|
-
__classPrivateFieldSet(this, _Resource_rid, rid, "f");
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Destroys and cleans up this resource from memory.
|
|
783
|
-
* **You should not call any method on this object anymore and should drop any reference to it.**
|
|
784
|
-
*/
|
|
785
|
-
async close() {
|
|
786
|
-
return invoke("plugin:resources|close", {
|
|
787
|
-
rid: this.rid
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
_Resource_rid = /* @__PURE__ */ new WeakMap();
|
|
792
|
-
}
|
|
793
|
-
});
|
|
794
|
-
|
|
795
2265
|
// node_modules/@tauri-apps/api/dpi.js
|
|
796
2266
|
var LogicalSize, PhysicalSize, Size, LogicalPosition, PhysicalPosition, Position;
|
|
797
2267
|
var init_dpi = __esm({
|
|
@@ -1306,8 +2776,8 @@ var Tevroc = (() => {
|
|
|
1306
2776
|
async listen(event, handler) {
|
|
1307
2777
|
if (this._handleTauriEvent(event, handler)) {
|
|
1308
2778
|
return () => {
|
|
1309
|
-
const
|
|
1310
|
-
|
|
2779
|
+
const listeners2 = this.listeners[event];
|
|
2780
|
+
listeners2.splice(listeners2.indexOf(handler), 1);
|
|
1311
2781
|
};
|
|
1312
2782
|
}
|
|
1313
2783
|
return listen(event, handler, {
|
|
@@ -1336,8 +2806,8 @@ var Tevroc = (() => {
|
|
|
1336
2806
|
async once(event, handler) {
|
|
1337
2807
|
if (this._handleTauriEvent(event, handler)) {
|
|
1338
2808
|
return () => {
|
|
1339
|
-
const
|
|
1340
|
-
|
|
2809
|
+
const listeners2 = this.listeners[event];
|
|
2810
|
+
listeners2.splice(listeners2.indexOf(handler), 1);
|
|
1341
2811
|
};
|
|
1342
2812
|
}
|
|
1343
2813
|
return once(event, handler, {
|
|
@@ -3005,8 +4475,8 @@ var Tevroc = (() => {
|
|
|
3005
4475
|
async listen(event, handler) {
|
|
3006
4476
|
if (this._handleTauriEvent(event, handler)) {
|
|
3007
4477
|
return () => {
|
|
3008
|
-
const
|
|
3009
|
-
|
|
4478
|
+
const listeners2 = this.listeners[event];
|
|
4479
|
+
listeners2.splice(listeners2.indexOf(handler), 1);
|
|
3010
4480
|
};
|
|
3011
4481
|
}
|
|
3012
4482
|
return listen(event, handler, {
|
|
@@ -3035,8 +4505,8 @@ var Tevroc = (() => {
|
|
|
3035
4505
|
async once(event, handler) {
|
|
3036
4506
|
if (this._handleTauriEvent(event, handler)) {
|
|
3037
4507
|
return () => {
|
|
3038
|
-
const
|
|
3039
|
-
|
|
4508
|
+
const listeners2 = this.listeners[event];
|
|
4509
|
+
listeners2.splice(listeners2.indexOf(handler), 1);
|
|
3040
4510
|
};
|
|
3041
4511
|
}
|
|
3042
4512
|
return once(event, handler, {
|
|
@@ -3504,8 +4974,8 @@ var Tevroc = (() => {
|
|
|
3504
4974
|
async listen(event, handler) {
|
|
3505
4975
|
if (this._handleTauriEvent(event, handler)) {
|
|
3506
4976
|
return () => {
|
|
3507
|
-
const
|
|
3508
|
-
|
|
4977
|
+
const listeners2 = this.listeners[event];
|
|
4978
|
+
listeners2.splice(listeners2.indexOf(handler), 1);
|
|
3509
4979
|
};
|
|
3510
4980
|
}
|
|
3511
4981
|
return listen(event, handler, {
|
|
@@ -3534,8 +5004,8 @@ var Tevroc = (() => {
|
|
|
3534
5004
|
async once(event, handler) {
|
|
3535
5005
|
if (this._handleTauriEvent(event, handler)) {
|
|
3536
5006
|
return () => {
|
|
3537
|
-
const
|
|
3538
|
-
|
|
5007
|
+
const listeners2 = this.listeners[event];
|
|
5008
|
+
listeners2.splice(listeners2.indexOf(handler), 1);
|
|
3539
5009
|
};
|
|
3540
5010
|
}
|
|
3541
5011
|
return once(event, handler, {
|
|
@@ -3594,8 +5064,8 @@ var Tevroc = (() => {
|
|
|
3594
5064
|
var googleInitialized, googleListeners, authWindowRef, handleCallback, initializeGoogleLogin, createGoogleLogin2;
|
|
3595
5065
|
var init_useGoogleAuth = __esm({
|
|
3596
5066
|
"src/services/useGoogleAuth.js"() {
|
|
3597
|
-
init_esm();
|
|
3598
5067
|
init_esm2();
|
|
5068
|
+
init_esm3();
|
|
3599
5069
|
init_webviewWindow();
|
|
3600
5070
|
init_usePlatform();
|
|
3601
5071
|
googleInitialized = false;
|
|
@@ -3766,8 +5236,8 @@ var Tevroc = (() => {
|
|
|
3766
5236
|
var paymentInitialized, paymentStatusListeners, paymentWindowRef, logs, addLog, handlePaymentCallback, initializePayment, createPayment;
|
|
3767
5237
|
var init_useYocoPayment = __esm({
|
|
3768
5238
|
"src/services/useYocoPayment.js"() {
|
|
3769
|
-
init_esm();
|
|
3770
5239
|
init_esm2();
|
|
5240
|
+
init_esm3();
|
|
3771
5241
|
init_webviewWindow();
|
|
3772
5242
|
init_usePlatform();
|
|
3773
5243
|
paymentInitialized = false;
|
|
@@ -3888,6 +5358,539 @@ var Tevroc = (() => {
|
|
|
3888
5358
|
TevrocError: () => TevrocError,
|
|
3889
5359
|
createClient: () => createClient
|
|
3890
5360
|
});
|
|
5361
|
+
|
|
5362
|
+
// src/services/useEntities.js
|
|
5363
|
+
init_usePlatform();
|
|
5364
|
+
var isMobile = platform === "android" || platform === "ios";
|
|
5365
|
+
var isDesktop = platform === "tauri";
|
|
5366
|
+
var sqliteReady = null;
|
|
5367
|
+
var sqliteDb = null;
|
|
5368
|
+
function dbName(appId = "default") {
|
|
5369
|
+
return `tevroc_${String(appId || "default").replace(/[^a-z0-9_-]/gi, "_")}`;
|
|
5370
|
+
}
|
|
5371
|
+
function memoryKey(appId) {
|
|
5372
|
+
return `tevroc_native_db_${appId || "default"}`;
|
|
5373
|
+
}
|
|
5374
|
+
async function openSqlite(appId) {
|
|
5375
|
+
if (sqliteDb) return sqliteDb;
|
|
5376
|
+
if (sqliteReady) return sqliteReady;
|
|
5377
|
+
sqliteReady = (async () => {
|
|
5378
|
+
if (isMobile) {
|
|
5379
|
+
const mod = await Promise.resolve().then(() => (init_esm(), esm_exports));
|
|
5380
|
+
const sqlite = new mod.SQLiteConnection(mod.CapacitorSQLite);
|
|
5381
|
+
const name = dbName(appId);
|
|
5382
|
+
const db = await sqlite.createConnection(name, false, "no-encryption", 1, false);
|
|
5383
|
+
await db.open();
|
|
5384
|
+
await db.execute("CREATE TABLE IF NOT EXISTS kv (key TEXT PRIMARY KEY, value TEXT NOT NULL)");
|
|
5385
|
+
return {
|
|
5386
|
+
async get(key) {
|
|
5387
|
+
const res = await db.query("SELECT value FROM kv WHERE key = ? LIMIT 1", [key]);
|
|
5388
|
+
return res.values?.[0]?.value ?? null;
|
|
5389
|
+
},
|
|
5390
|
+
async set(key, value) {
|
|
5391
|
+
await db.run("INSERT OR REPLACE INTO kv (key, value) VALUES (?, ?)", [key, value]);
|
|
5392
|
+
}
|
|
5393
|
+
};
|
|
5394
|
+
}
|
|
5395
|
+
if (isDesktop) {
|
|
5396
|
+
const mod = await Promise.resolve().then(() => (init_dist_js(), dist_js_exports));
|
|
5397
|
+
const Database2 = mod.default || mod.Database;
|
|
5398
|
+
const db = await Database2.load(`sqlite:${dbName(appId)}.db`);
|
|
5399
|
+
await db.execute("CREATE TABLE IF NOT EXISTS kv (key TEXT PRIMARY KEY, value TEXT NOT NULL)");
|
|
5400
|
+
return {
|
|
5401
|
+
async get(key) {
|
|
5402
|
+
const rows = await db.select("SELECT value FROM kv WHERE key = ? LIMIT 1", [key]);
|
|
5403
|
+
return rows?.[0]?.value ?? null;
|
|
5404
|
+
},
|
|
5405
|
+
async set(key, value) {
|
|
5406
|
+
await db.execute("INSERT OR REPLACE INTO kv (key, value) VALUES (?, ?)", [key, value]);
|
|
5407
|
+
}
|
|
5408
|
+
};
|
|
5409
|
+
}
|
|
5410
|
+
return null;
|
|
5411
|
+
})();
|
|
5412
|
+
sqliteDb = await sqliteReady;
|
|
5413
|
+
return sqliteDb;
|
|
5414
|
+
}
|
|
5415
|
+
async function readDB(appId) {
|
|
5416
|
+
try {
|
|
5417
|
+
const db = await openSqlite(appId);
|
|
5418
|
+
if (db) return parseStoredJson(await db.get("db"));
|
|
5419
|
+
return parseStoredJson(globalThis.localStorage?.getItem(memoryKey(appId)));
|
|
5420
|
+
} catch (error) {
|
|
5421
|
+
console.warn("Tevroc native SQLite unavailable; using localStorage fallback", error);
|
|
5422
|
+
return parseStoredJson(globalThis.localStorage?.getItem(memoryKey(appId)));
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
5425
|
+
async function writeDB(appId, data) {
|
|
5426
|
+
const json = JSON.stringify(data || {}, null, 2);
|
|
5427
|
+
try {
|
|
5428
|
+
const db = await openSqlite(appId);
|
|
5429
|
+
if (db) {
|
|
5430
|
+
await db.set("db", json);
|
|
5431
|
+
return;
|
|
5432
|
+
}
|
|
5433
|
+
} catch (error) {
|
|
5434
|
+
console.warn("Tevroc native SQLite write failed; using localStorage fallback", error);
|
|
5435
|
+
}
|
|
5436
|
+
globalThis.localStorage?.setItem(memoryKey(appId), json);
|
|
5437
|
+
}
|
|
5438
|
+
function parseStoredJson(value) {
|
|
5439
|
+
if (!value) return {};
|
|
5440
|
+
if (typeof value === "object") return value;
|
|
5441
|
+
if (typeof value !== "string") return {};
|
|
5442
|
+
try {
|
|
5443
|
+
return JSON.parse(value);
|
|
5444
|
+
} catch {
|
|
5445
|
+
}
|
|
5446
|
+
try {
|
|
5447
|
+
return JSON.parse(atob(value));
|
|
5448
|
+
} catch {
|
|
5449
|
+
}
|
|
5450
|
+
return {};
|
|
5451
|
+
}
|
|
5452
|
+
function resolvePath(obj, path, create = false) {
|
|
5453
|
+
const parts = String(path || "").split("/").filter(Boolean);
|
|
5454
|
+
let ref = obj;
|
|
5455
|
+
for (let i = 0; i < parts.length - 1; i += 1) {
|
|
5456
|
+
const part = parts[i];
|
|
5457
|
+
if (!(part in ref)) {
|
|
5458
|
+
if (!create) return null;
|
|
5459
|
+
ref[part] = {};
|
|
5460
|
+
}
|
|
5461
|
+
ref = ref[part];
|
|
5462
|
+
}
|
|
5463
|
+
return { ref, key: parts.at(-1) };
|
|
5464
|
+
}
|
|
5465
|
+
function deepMerge(target = {}, source = {}) {
|
|
5466
|
+
for (const key of Object.keys(source || {})) {
|
|
5467
|
+
if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
|
|
5468
|
+
if (!target[key] || typeof target[key] !== "object") target[key] = {};
|
|
5469
|
+
deepMerge(target[key], source[key]);
|
|
5470
|
+
} else {
|
|
5471
|
+
target[key] = source[key];
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
return target;
|
|
5475
|
+
}
|
|
5476
|
+
var listeners = /* @__PURE__ */ new Map();
|
|
5477
|
+
var lastSnapshot = /* @__PURE__ */ new Map();
|
|
5478
|
+
function isEqual(a, b) {
|
|
5479
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
5480
|
+
}
|
|
5481
|
+
function snap(value) {
|
|
5482
|
+
return {
|
|
5483
|
+
exists: () => value !== void 0 && value !== null,
|
|
5484
|
+
val: () => value ?? null
|
|
5485
|
+
};
|
|
5486
|
+
}
|
|
5487
|
+
function createNativeStore(appId = "default") {
|
|
5488
|
+
async function getValue(pathRef) {
|
|
5489
|
+
const db = await readDB(appId);
|
|
5490
|
+
const path = pathRef?.path || pathRef || "";
|
|
5491
|
+
const parts = String(path).split("/").filter(Boolean);
|
|
5492
|
+
let value = db;
|
|
5493
|
+
for (const part of parts) {
|
|
5494
|
+
value = value?.[part];
|
|
5495
|
+
if (value === void 0) break;
|
|
5496
|
+
}
|
|
5497
|
+
return snap(value);
|
|
5498
|
+
}
|
|
5499
|
+
async function setValue(pathRef, value) {
|
|
5500
|
+
const db = await readDB(appId);
|
|
5501
|
+
const path = pathRef?.path || pathRef || "";
|
|
5502
|
+
const node = resolvePath(db, path, true);
|
|
5503
|
+
if (!node) return;
|
|
5504
|
+
if (isEqual(node.ref[node.key], value)) return;
|
|
5505
|
+
node.ref[node.key] = value;
|
|
5506
|
+
await writeDB(appId, db);
|
|
5507
|
+
}
|
|
5508
|
+
async function updateValue(pathRef, value) {
|
|
5509
|
+
const db = await readDB(appId);
|
|
5510
|
+
const path = pathRef?.path || pathRef || "";
|
|
5511
|
+
const node = resolvePath(db, path, true);
|
|
5512
|
+
if (!node) return;
|
|
5513
|
+
const prev = node.ref[node.key] || {};
|
|
5514
|
+
const next = deepMerge(structuredClone(prev), value);
|
|
5515
|
+
if (isEqual(prev, next)) return;
|
|
5516
|
+
node.ref[node.key] = next;
|
|
5517
|
+
await writeDB(appId, db);
|
|
5518
|
+
}
|
|
5519
|
+
async function removeValue(pathRef) {
|
|
5520
|
+
const db = await readDB(appId);
|
|
5521
|
+
const path = pathRef?.path || pathRef || "";
|
|
5522
|
+
const node = resolvePath(db, path);
|
|
5523
|
+
if (!node || node.ref[node.key] === void 0) return;
|
|
5524
|
+
delete node.ref[node.key];
|
|
5525
|
+
await writeDB(appId, db);
|
|
5526
|
+
}
|
|
5527
|
+
function ref(_db, path) {
|
|
5528
|
+
return { path };
|
|
5529
|
+
}
|
|
5530
|
+
function child(pathRef, childPath) {
|
|
5531
|
+
const base = pathRef?.path || pathRef || "";
|
|
5532
|
+
return { path: `${base}/${childPath}` };
|
|
5533
|
+
}
|
|
5534
|
+
function push(pathRef) {
|
|
5535
|
+
const path = pathRef?.path || pathRef || "";
|
|
5536
|
+
const key = `id_${crypto.randomUUID?.().replaceAll("-", "") || Math.random().toString(36).slice(2)}`;
|
|
5537
|
+
return { key, path: `${path}/${key}` };
|
|
5538
|
+
}
|
|
5539
|
+
function onValue(pathRef, callback) {
|
|
5540
|
+
const path = pathRef?.path || pathRef || "";
|
|
5541
|
+
getValue(path).then((snapshot) => {
|
|
5542
|
+
lastSnapshot.set(path, snapshot.val());
|
|
5543
|
+
callback(snapshot);
|
|
5544
|
+
});
|
|
5545
|
+
if (listeners.has(path)) {
|
|
5546
|
+
listeners.get(path).add(callback);
|
|
5547
|
+
return () => listeners.get(path)?.delete(callback);
|
|
5548
|
+
}
|
|
5549
|
+
const group = /* @__PURE__ */ new Set([callback]);
|
|
5550
|
+
group.interval = setInterval(async () => {
|
|
5551
|
+
const snapshot = await getValue(path);
|
|
5552
|
+
const value = snapshot.val();
|
|
5553
|
+
if (isEqual(lastSnapshot.get(path), value)) return;
|
|
5554
|
+
lastSnapshot.set(path, value);
|
|
5555
|
+
group.forEach((cb) => cb(snapshot));
|
|
5556
|
+
}, 1e3);
|
|
5557
|
+
listeners.set(path, group);
|
|
5558
|
+
return () => {
|
|
5559
|
+
group.delete(callback);
|
|
5560
|
+
if (group.size === 0) {
|
|
5561
|
+
clearInterval(group.interval);
|
|
5562
|
+
listeners.delete(path);
|
|
5563
|
+
lastSnapshot.delete(path);
|
|
5564
|
+
}
|
|
5565
|
+
};
|
|
5566
|
+
}
|
|
5567
|
+
function off(pathRef, _event, callback) {
|
|
5568
|
+
const path = pathRef?.path || pathRef || "";
|
|
5569
|
+
if (!listeners.has(path)) return;
|
|
5570
|
+
if (callback) listeners.get(path).delete(callback);
|
|
5571
|
+
}
|
|
5572
|
+
return {
|
|
5573
|
+
ref,
|
|
5574
|
+
child,
|
|
5575
|
+
push,
|
|
5576
|
+
get: getValue,
|
|
5577
|
+
set: setValue,
|
|
5578
|
+
update: updateValue,
|
|
5579
|
+
remove: removeValue,
|
|
5580
|
+
onValue,
|
|
5581
|
+
off,
|
|
5582
|
+
serverTimestamp: () => Date.now(),
|
|
5583
|
+
increment: (num = 1) => ({ __increment__: num }),
|
|
5584
|
+
runTransaction: async (pathRef, updater) => {
|
|
5585
|
+
const current = await getValue(pathRef);
|
|
5586
|
+
const updated = await updater(current.val());
|
|
5587
|
+
await setValue(pathRef, updated);
|
|
5588
|
+
return { committed: true, snapshot: snap(updated) };
|
|
5589
|
+
},
|
|
5590
|
+
exportDB: () => readDB(appId),
|
|
5591
|
+
importDB: (data) => writeDB(appId, data || {}),
|
|
5592
|
+
exists: async (pathRef) => (await getValue(pathRef)).exists()
|
|
5593
|
+
};
|
|
5594
|
+
}
|
|
5595
|
+
function nowIso() {
|
|
5596
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
5597
|
+
}
|
|
5598
|
+
function normalizeListArgs(sortOrOptions, limit) {
|
|
5599
|
+
if (sortOrOptions && typeof sortOrOptions === "object") return sortOrOptions;
|
|
5600
|
+
const options = {};
|
|
5601
|
+
if (sortOrOptions) options.sort = sortOrOptions;
|
|
5602
|
+
if (limit !== void 0) options.limit = limit;
|
|
5603
|
+
return options;
|
|
5604
|
+
}
|
|
5605
|
+
function sortRecords(records, sort) {
|
|
5606
|
+
if (!sort) return records;
|
|
5607
|
+
const desc = String(sort).startsWith("-");
|
|
5608
|
+
const field = desc ? String(sort).slice(1) : String(sort);
|
|
5609
|
+
return [...records].sort((a, b) => {
|
|
5610
|
+
const av = a?.[field] ?? "";
|
|
5611
|
+
const bv = b?.[field] ?? "";
|
|
5612
|
+
if (av === bv) return 0;
|
|
5613
|
+
return (av > bv ? 1 : -1) * (desc ? -1 : 1);
|
|
5614
|
+
});
|
|
5615
|
+
}
|
|
5616
|
+
function getFilters(input = {}) {
|
|
5617
|
+
return input.filter || input.filters || input.where || {};
|
|
5618
|
+
}
|
|
5619
|
+
function matchesFilter(record, filter = {}) {
|
|
5620
|
+
return Object.entries(filter).every(([key, expected]) => {
|
|
5621
|
+
const actual = record?.[key];
|
|
5622
|
+
if (expected && typeof expected === "object" && !Array.isArray(expected)) {
|
|
5623
|
+
if ("$eq" in expected && actual !== expected.$eq) return false;
|
|
5624
|
+
if ("$ne" in expected && actual === expected.$ne) return false;
|
|
5625
|
+
if ("$in" in expected && Array.isArray(expected.$in) && !expected.$in.includes(actual)) return false;
|
|
5626
|
+
if ("$contains" in expected && typeof actual === "string" && typeof expected.$contains === "string") return actual.includes(expected.$contains);
|
|
5627
|
+
return true;
|
|
5628
|
+
}
|
|
5629
|
+
return actual === expected;
|
|
5630
|
+
});
|
|
5631
|
+
}
|
|
5632
|
+
function createEntityApi(store, entity) {
|
|
5633
|
+
const base = `entities/${entity}`;
|
|
5634
|
+
return {
|
|
5635
|
+
list: async (sortOrOptions, limit) => {
|
|
5636
|
+
const options = normalizeListArgs(sortOrOptions, limit);
|
|
5637
|
+
const snapshot = await store.get(base);
|
|
5638
|
+
const rows = Object.values(snapshot.val() || {});
|
|
5639
|
+
const sorted = sortRecords(rows, options.sort);
|
|
5640
|
+
return { data: sorted.slice(options.offset || 0, options.limit ? (options.offset || 0) + options.limit : void 0), limit: options.limit, offset: options.offset || 0 };
|
|
5641
|
+
},
|
|
5642
|
+
get: async (id) => ({ data: (await store.get(`${base}/${id}`)).val() }),
|
|
5643
|
+
create: async (record = {}) => {
|
|
5644
|
+
const id = typeof record.id === "string" ? record.id : `ent_${crypto.randomUUID?.().replaceAll("-", "") || Date.now()}`;
|
|
5645
|
+
const time = nowIso();
|
|
5646
|
+
const data = { ...record, id, createdAt: record.createdAt || time, updatedAt: time, created_date: record.created_date || time, updated_date: time };
|
|
5647
|
+
await store.set(`${base}/${id}`, data);
|
|
5648
|
+
return { data };
|
|
5649
|
+
},
|
|
5650
|
+
update: async (id, patch = {}) => {
|
|
5651
|
+
const existing = (await store.get(`${base}/${id}`)).val() || { id };
|
|
5652
|
+
const time = nowIso();
|
|
5653
|
+
const data = { ...existing, ...patch, id, updatedAt: time, updated_date: time };
|
|
5654
|
+
await store.set(`${base}/${id}`, data);
|
|
5655
|
+
return { data };
|
|
5656
|
+
},
|
|
5657
|
+
delete: async (id) => {
|
|
5658
|
+
await store.remove(`${base}/${id}`);
|
|
5659
|
+
return { deleted: true, id };
|
|
5660
|
+
},
|
|
5661
|
+
query: async (input = {}) => {
|
|
5662
|
+
const options = normalizeListArgs(input, input.limit);
|
|
5663
|
+
const snapshot = await store.get(base);
|
|
5664
|
+
const rows = Object.values(snapshot.val() || {}).filter((record) => matchesFilter(record, getFilters(input)));
|
|
5665
|
+
const sorted = sortRecords(rows, input.sort || options.sort);
|
|
5666
|
+
return { data: sorted.slice(0, input.limit || 200), limit: input.limit };
|
|
5667
|
+
},
|
|
5668
|
+
filter: async (filter = {}, sortOrOptions, limit) => {
|
|
5669
|
+
const options = normalizeListArgs(sortOrOptions, limit);
|
|
5670
|
+
return createEntityApi(store, entity).query({ ...options, filter });
|
|
5671
|
+
},
|
|
5672
|
+
bulkCreate: async (records = []) => ({ inserted: (await Promise.all(records.map((record) => createEntityApi(store, entity).create(record)))).length }),
|
|
5673
|
+
bulkUpdate: async (records = []) => {
|
|
5674
|
+
let updated = 0;
|
|
5675
|
+
for (const record of records) {
|
|
5676
|
+
if (!record?.id) continue;
|
|
5677
|
+
await createEntityApi(store, entity).update(record.id, record);
|
|
5678
|
+
updated += 1;
|
|
5679
|
+
}
|
|
5680
|
+
return { updated };
|
|
5681
|
+
},
|
|
5682
|
+
bulkDelete: async (ids = []) => {
|
|
5683
|
+
for (const id of ids) await store.remove(`${base}/${id}`);
|
|
5684
|
+
return { deleted: ids.length };
|
|
5685
|
+
},
|
|
5686
|
+
import: async (records = []) => ({ imported: (await Promise.all(records.map((record) => createEntityApi(store, entity).create(record)))).length })
|
|
5687
|
+
};
|
|
5688
|
+
}
|
|
5689
|
+
function createNativeEntityRegistry(appId) {
|
|
5690
|
+
const store = createNativeStore(appId);
|
|
5691
|
+
return new Proxy({}, {
|
|
5692
|
+
get(_target, entity) {
|
|
5693
|
+
if (typeof entity !== "string") return void 0;
|
|
5694
|
+
return createEntityApi(store, entity);
|
|
5695
|
+
}
|
|
5696
|
+
});
|
|
5697
|
+
}
|
|
5698
|
+
async function resolveFileContext(store, userId) {
|
|
5699
|
+
const ownedCache = (await store.get(`drive/${userId}`)).val() || {};
|
|
5700
|
+
const collabCache = (await store.get(`collaborators/${userId}`)).val() || {};
|
|
5701
|
+
const result = [];
|
|
5702
|
+
for (const projectId of Object.keys(ownedCache)) {
|
|
5703
|
+
const project = ownedCache[projectId];
|
|
5704
|
+
if (project?.fileId && !project.deleted) {
|
|
5705
|
+
result.push({ fileId: project.fileId, projectId, ownerUid: userId, isOwner: true, isNew: false, collaborators: Object.keys(project.collaborators || {}).filter((key) => key !== userId).length });
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5708
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5709
|
+
for (const [projectId, ownersObj] of Object.entries(collabCache || {})) {
|
|
5710
|
+
for (const ownerUid of Object.keys(ownersObj || {})) {
|
|
5711
|
+
const key = `${ownerUid}_${projectId}`;
|
|
5712
|
+
if (seen.has(key)) continue;
|
|
5713
|
+
seen.add(key);
|
|
5714
|
+
const project = (await store.get(`drive/${ownerUid}/${projectId}`)).val();
|
|
5715
|
+
if (!project?.fileId || project.deleted) continue;
|
|
5716
|
+
result.push({ fileId: project.fileId, projectId, ownerUid, isOwner: false, isNew: false, collaborators: 0 });
|
|
5717
|
+
}
|
|
5718
|
+
}
|
|
5719
|
+
return result;
|
|
5720
|
+
}
|
|
5721
|
+
function createNativeFileApi(appId) {
|
|
5722
|
+
const store = createNativeStore(appId);
|
|
5723
|
+
return {
|
|
5724
|
+
saveJsonToDrive: async (filename, jsonData, existingFileId, userId = "local") => {
|
|
5725
|
+
const context = (await resolveFileContext(store, userId)).filter((item) => item.fileId === existingFileId);
|
|
5726
|
+
const isNew = !existingFileId || context.length === 0;
|
|
5727
|
+
const fileId = existingFileId || `file_${Date.now()}`;
|
|
5728
|
+
const ownerUid = isNew ? userId : context[0].ownerUid;
|
|
5729
|
+
const path = `drive/${ownerUid}/${fileId}`;
|
|
5730
|
+
const existing = (await store.get(path)).val() || {};
|
|
5731
|
+
const time = nowIso();
|
|
5732
|
+
await store.set(path, { ...existing, name: filename, data: jsonData, updatedAt: time, createdAt: existing.createdAt || time });
|
|
5733
|
+
await store.set(`files/${ownerUid}/${context[0]?.projectId || fileId}`, { fileId, name: filename, ownerUid, collaborators: existing.collaborators || { [userId]: "admin" }, deleted: false });
|
|
5734
|
+
return { fileId, fileName: filename, webViewLink: `filebase://${path}`, downloadLink: `filebase://${path}` };
|
|
5735
|
+
},
|
|
5736
|
+
readJsonFromDrive: async (fileId, userId = "local") => {
|
|
5737
|
+
const own = (await store.get(`drive/${userId}/${fileId}`)).val();
|
|
5738
|
+
if (own?.data) return own.data;
|
|
5739
|
+
const contexts = await resolveFileContext(store, userId);
|
|
5740
|
+
const context = contexts.find((item) => item.fileId === fileId);
|
|
5741
|
+
if (!context) return {};
|
|
5742
|
+
return (await store.get(`drive/${context.ownerUid}/${fileId}`)).val()?.data || {};
|
|
5743
|
+
},
|
|
5744
|
+
deleteFromDrive: async (fileId, userId = "local") => {
|
|
5745
|
+
const contexts = await resolveFileContext(store, userId);
|
|
5746
|
+
const context = contexts.find((item) => item.fileId === fileId) || { ownerUid: userId };
|
|
5747
|
+
const path = `drive/${context.ownerUid}/${fileId}`;
|
|
5748
|
+
const file = (await store.get(path)).val() || {};
|
|
5749
|
+
await store.set(path, { ...file, deleted: true, deletedAt: nowIso() });
|
|
5750
|
+
},
|
|
5751
|
+
grantDriveAccess: async (fileId, email, role = "reader", userId = "local") => {
|
|
5752
|
+
const contexts = await resolveFileContext(store, userId);
|
|
5753
|
+
const context = contexts.find((item) => item.fileId === fileId);
|
|
5754
|
+
if (!context) return;
|
|
5755
|
+
await store.update(`drive/${context.ownerUid}/${context.projectId}`, { collaborators: { [email]: role } });
|
|
5756
|
+
await store.update(`collaborators/${email}/${context.projectId}`, { [context.ownerUid]: role });
|
|
5757
|
+
},
|
|
5758
|
+
revokeDriveAccess: async (fileId, email, userId = "local") => {
|
|
5759
|
+
const contexts = await resolveFileContext(store, userId);
|
|
5760
|
+
const context = contexts.find((item) => item.fileId === fileId);
|
|
5761
|
+
if (!context) return;
|
|
5762
|
+
const project = (await store.get(`drive/${context.ownerUid}/${context.projectId}`)).val() || {};
|
|
5763
|
+
delete project.collaborators?.[email];
|
|
5764
|
+
await store.set(`drive/${context.ownerUid}/${context.projectId}`, project);
|
|
5765
|
+
await store.remove(`collaborators/${email}/${context.projectId}/${context.ownerUid}`);
|
|
5766
|
+
},
|
|
5767
|
+
ref: store.ref,
|
|
5768
|
+
child: store.child,
|
|
5769
|
+
push: store.push,
|
|
5770
|
+
get: store.get,
|
|
5771
|
+
set: store.set,
|
|
5772
|
+
update: store.update,
|
|
5773
|
+
remove: store.remove,
|
|
5774
|
+
onValue: store.onValue,
|
|
5775
|
+
off: store.off,
|
|
5776
|
+
serverTimestamp: store.serverTimestamp,
|
|
5777
|
+
increment: store.increment,
|
|
5778
|
+
runTransaction: store.runTransaction,
|
|
5779
|
+
exportDB: store.exportDB,
|
|
5780
|
+
importDB: store.importDB,
|
|
5781
|
+
exists: store.exists
|
|
5782
|
+
};
|
|
5783
|
+
}
|
|
5784
|
+
var DRIVE_API = "https://www.googleapis.com/drive/v3";
|
|
5785
|
+
var UPLOAD_API = "https://www.googleapis.com/upload/drive/v3";
|
|
5786
|
+
function getGoogleToken() {
|
|
5787
|
+
return globalThis.sessionStorage?.getItem("gAccessToken") || globalThis.localStorage?.getItem("gAccessToken");
|
|
5788
|
+
}
|
|
5789
|
+
function createGoogleDriveApi(appId) {
|
|
5790
|
+
const localFiles = createNativeFileApi(appId);
|
|
5791
|
+
return {
|
|
5792
|
+
...localFiles,
|
|
5793
|
+
saveJsonToDrive: async (filename, jsonData, existingFileId, userId) => {
|
|
5794
|
+
const token = getGoogleToken();
|
|
5795
|
+
if (!token) return localFiles.saveJsonToDrive(filename, jsonData, existingFileId, userId);
|
|
5796
|
+
const content = JSON.stringify(jsonData, null, 2);
|
|
5797
|
+
const blob = new Blob([content], { type: "application/json" });
|
|
5798
|
+
const form = new FormData();
|
|
5799
|
+
form.append("metadata", new Blob([JSON.stringify({ name: `${filename}.json`, mimeType: "application/json" })], { type: "application/json" }));
|
|
5800
|
+
form.append("file", blob);
|
|
5801
|
+
const url = existingFileId ? `${UPLOAD_API}/files/${existingFileId}?uploadType=multipart` : `${UPLOAD_API}/files?uploadType=multipart`;
|
|
5802
|
+
const res = await fetch(url, { method: existingFileId ? "PATCH" : "POST", headers: { Authorization: `Bearer ${token}` }, body: form });
|
|
5803
|
+
if (!res.ok) throw new Error((await res.json().catch(() => ({})))?.error?.message || "Drive upload failed");
|
|
5804
|
+
const file = await res.json();
|
|
5805
|
+
return { fileId: file.id, fileName: file.name, webViewLink: `https://drive.google.com/file/d/${file.id}/view`, downloadLink: `${DRIVE_API}/files/${file.id}?alt=media` };
|
|
5806
|
+
},
|
|
5807
|
+
readJsonFromDrive: async (fileId, userId) => {
|
|
5808
|
+
const token = getGoogleToken();
|
|
5809
|
+
if (!token) return localFiles.readJsonFromDrive(fileId, userId);
|
|
5810
|
+
const res = await fetch(`${DRIVE_API}/files/${fileId}?alt=media`, { headers: { Authorization: `Bearer ${token}` } });
|
|
5811
|
+
if (!res.ok) throw new Error("Could not read file from Drive");
|
|
5812
|
+
return res.json();
|
|
5813
|
+
},
|
|
5814
|
+
deleteFromDrive: async (fileId, userId) => {
|
|
5815
|
+
const token = getGoogleToken();
|
|
5816
|
+
if (!token) return localFiles.deleteFromDrive(fileId, userId);
|
|
5817
|
+
const res = await fetch(`${DRIVE_API}/files/${fileId}`, { method: "DELETE", headers: { Authorization: `Bearer ${token}` } });
|
|
5818
|
+
if (!res.ok && res.status !== 404) throw new Error("Failed to delete file from Drive");
|
|
5819
|
+
}
|
|
5820
|
+
};
|
|
5821
|
+
}
|
|
5822
|
+
function createProjectStore(appId) {
|
|
5823
|
+
const store = createNativeStore(appId);
|
|
5824
|
+
const encodeEmail = (email) => typeof email === "string" && email ? email.replace(/\./g, "_").replace(/@/g, "__at__") : "";
|
|
5825
|
+
return {
|
|
5826
|
+
encodeEmail,
|
|
5827
|
+
upsertUser: async (user) => {
|
|
5828
|
+
await store.set(`users/${user.uid}`, { email: user.email, displayName: user.displayName, photoURL: user.photoURL || "" });
|
|
5829
|
+
await store.set(`usersByEmail/${encodeEmail(user.email)}`, user.uid);
|
|
5830
|
+
},
|
|
5831
|
+
resolveOrCreateUser: async (email) => (await store.get(`usersByEmail/${encodeEmail(email)}`)).val() || `email:${encodeEmail(email)}`,
|
|
5832
|
+
saveProjectMeta: (ownerUid, projectId, meta) => store.set(`projects/${ownerUid}/${projectId}`, meta),
|
|
5833
|
+
getProject: async (ownerUid, projectId) => (await store.get(`projects/${ownerUid}/${projectId}`)).val(),
|
|
5834
|
+
deleteProject: async (ownerUid, projectId) => store.remove(`projects/${ownerUid}/${projectId}`),
|
|
5835
|
+
addCollaborator: (ownerUid, projectId, uid, role) => store.set(`projects/${ownerUid}/${projectId}/collaborators/${uid}`, role),
|
|
5836
|
+
removeCollaborator: (ownerUid, projectId, uid) => store.remove(`projects/${ownerUid}/${projectId}/collaborators/${uid}`),
|
|
5837
|
+
getUser: async (uid) => (await store.get(`users/${uid}`)).val(),
|
|
5838
|
+
subscribeProjects: (currentUid, callback, email) => {
|
|
5839
|
+
const emailKey = `email:${encodeEmail(email?.trim().toLowerCase())}`;
|
|
5840
|
+
let ownedCache = {};
|
|
5841
|
+
let collabCache = {};
|
|
5842
|
+
let collabCache2 = {};
|
|
5843
|
+
const emit2 = async () => {
|
|
5844
|
+
const visible = [];
|
|
5845
|
+
const loaded = /* @__PURE__ */ new Set();
|
|
5846
|
+
Object.entries(ownedCache || {}).forEach(([projectId, project]) => {
|
|
5847
|
+
if (!project || project.deleted) return;
|
|
5848
|
+
visible.push({ ...project, projectId, ownerUid: currentUid, isOwner: true });
|
|
5849
|
+
loaded.add(`${currentUid}_${projectId}`);
|
|
5850
|
+
});
|
|
5851
|
+
for (const cache of [collabCache, collabCache2]) {
|
|
5852
|
+
for (const [projectId, ownersObj] of Object.entries(cache || {})) {
|
|
5853
|
+
for (const ownerUid of Object.keys(ownersObj || {})) {
|
|
5854
|
+
const key = `${ownerUid}_${projectId}`;
|
|
5855
|
+
if (loaded.has(key)) continue;
|
|
5856
|
+
loaded.add(key);
|
|
5857
|
+
const project = (await store.get(`projects/${ownerUid}/${projectId}`)).val();
|
|
5858
|
+
if (project && !project.deleted) visible.push({ ...project, projectId, ownerUid, isOwner: false });
|
|
5859
|
+
}
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5862
|
+
callback(visible);
|
|
5863
|
+
};
|
|
5864
|
+
const unsub1 = store.onValue(`projects/${currentUid}`, (snapshot) => {
|
|
5865
|
+
ownedCache = snapshot.val() || {};
|
|
5866
|
+
emit2();
|
|
5867
|
+
});
|
|
5868
|
+
const unsub2 = store.onValue(`collaborators/${currentUid}`, (snapshot) => {
|
|
5869
|
+
collabCache = snapshot.val() || {};
|
|
5870
|
+
emit2();
|
|
5871
|
+
});
|
|
5872
|
+
const unsub3 = store.onValue(`collaborators/${emailKey}`, (snapshot) => {
|
|
5873
|
+
collabCache2 = snapshot.val() || {};
|
|
5874
|
+
emit2();
|
|
5875
|
+
});
|
|
5876
|
+
return () => {
|
|
5877
|
+
unsub1?.();
|
|
5878
|
+
unsub2?.();
|
|
5879
|
+
unsub3?.();
|
|
5880
|
+
};
|
|
5881
|
+
},
|
|
5882
|
+
subscribePresence: (roomId, uid, userInfo, callback) => {
|
|
5883
|
+
store.set(`presence/${roomId}/${uid}`, { ...userInfo, ts: Date.now() });
|
|
5884
|
+
const unsub = store.onValue(`presence/${roomId}`, (snapshot) => callback(Object.values(snapshot.val() || {})));
|
|
5885
|
+
return () => {
|
|
5886
|
+
store.remove(`presence/${roomId}/${uid}`);
|
|
5887
|
+
unsub?.();
|
|
5888
|
+
};
|
|
5889
|
+
}
|
|
5890
|
+
};
|
|
5891
|
+
}
|
|
5892
|
+
|
|
5893
|
+
// src/index.js
|
|
3891
5894
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
3892
5895
|
var platformModule = null;
|
|
3893
5896
|
async function getPlatformModule() {
|
|
@@ -3925,7 +5928,6 @@ var Tevroc = (() => {
|
|
|
3925
5928
|
}
|
|
3926
5929
|
var TevrocClient = class {
|
|
3927
5930
|
constructor(options = {}) {
|
|
3928
|
-
console.log(options);
|
|
3929
5931
|
const baseUrl = options.baseUrl ?? options.url;
|
|
3930
5932
|
const serviceUrl = options.serviceUrl ?? options.url;
|
|
3931
5933
|
if (!baseUrl) throw new TypeError("createClient requires a baseUrl");
|
|
@@ -3933,15 +5935,17 @@ var Tevroc = (() => {
|
|
|
3933
5935
|
this.serviceUrl = normalizeBaseUrl(serviceUrl);
|
|
3934
5936
|
this.appId = options.appId;
|
|
3935
5937
|
this.appName = options.appName;
|
|
3936
|
-
this.
|
|
3937
|
-
|
|
5938
|
+
this.isNative = options.isNative ?? false;
|
|
5939
|
+
this.transport = options.axios ?? null;
|
|
5940
|
+
this.fetch = options.fetch ?? globalThis.fetch;
|
|
5941
|
+
if (!this.transport && typeof this.fetch !== "function") {
|
|
3938
5942
|
throw new TypeError("No fetch implementation available");
|
|
3939
5943
|
}
|
|
3940
5944
|
this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
3941
5945
|
this.defaultHeaders = normalizeHeaders(options.headers);
|
|
3942
5946
|
this.token = options.token ?? null;
|
|
3943
5947
|
this.auth = createAuthApi(this);
|
|
3944
|
-
this.entities = createEntityRegistry(this);
|
|
5948
|
+
this.entities = this.isNative ? createNativeEntityRegistry(this.appId) : createEntityRegistry(this);
|
|
3945
5949
|
this.functions = createFunctionRegistry(this);
|
|
3946
5950
|
this.integrations = createIntegrationApi(this);
|
|
3947
5951
|
this.agents = createAgentRegistry(this);
|
|
@@ -3949,22 +5953,28 @@ var Tevroc = (() => {
|
|
|
3949
5953
|
this.connectors = createConnectorApi(this);
|
|
3950
5954
|
this.customIntegrations = createCustomIntegrationRegistry(this);
|
|
3951
5955
|
this.sso = createSsoApi(this);
|
|
3952
|
-
this.files = createFileApi(this);
|
|
5956
|
+
this.files = this.isNative ? createNativeFileApi(this.appId) : createFileApi(this);
|
|
5957
|
+
this.native = {
|
|
5958
|
+
store: createNativeStore(this.appId),
|
|
5959
|
+
files: createNativeFileApi(this.appId),
|
|
5960
|
+
googleDrive: createGoogleDriveApi(this.appId),
|
|
5961
|
+
projects: createProjectStore(this.appId)
|
|
5962
|
+
};
|
|
3953
5963
|
this.payments = createPaymentApi(this);
|
|
3954
5964
|
this.platform = createPlatformApi(this);
|
|
3955
5965
|
}
|
|
3956
5966
|
setToken(token) {
|
|
3957
5967
|
this.token = token || null;
|
|
3958
5968
|
if (this.token) {
|
|
3959
|
-
|
|
5969
|
+
safeLocalStorage()?.setItem("tevroc_access_token", this.token);
|
|
3960
5970
|
} else {
|
|
3961
|
-
|
|
5971
|
+
safeLocalStorage()?.removeItem("tevroc_access_token");
|
|
3962
5972
|
}
|
|
3963
5973
|
return this;
|
|
3964
5974
|
}
|
|
3965
5975
|
clearToken() {
|
|
3966
5976
|
this.token = null;
|
|
3967
|
-
|
|
5977
|
+
safeLocalStorage()?.removeItem("tevroc_access_token");
|
|
3968
5978
|
return this;
|
|
3969
5979
|
}
|
|
3970
5980
|
async request(path, options = {}) {
|
|
@@ -3974,11 +5984,13 @@ var Tevroc = (() => {
|
|
|
3974
5984
|
const url = `${this.baseUrl}${path.startsWith("/") ? path : `/${path}`}${query}`;
|
|
3975
5985
|
const controller = new AbortController();
|
|
3976
5986
|
const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? this.timeoutMs);
|
|
3977
|
-
const token = this.token ||
|
|
5987
|
+
const token = this.token || getStoredToken();
|
|
3978
5988
|
if (token && options.auth !== false) {
|
|
3979
5989
|
headers.set("authorization", `Bearer ${token}`);
|
|
3980
5990
|
}
|
|
3981
|
-
|
|
5991
|
+
if (this.appId) {
|
|
5992
|
+
headers.set("x-app-id", this.appId);
|
|
5993
|
+
}
|
|
3982
5994
|
let body = options.body;
|
|
3983
5995
|
if (body !== void 0 && body !== null && isJsonBody(body)) {
|
|
3984
5996
|
headers.set("content-type", "application/json");
|
|
@@ -3990,6 +6002,18 @@ var Tevroc = (() => {
|
|
|
3990
6002
|
}
|
|
3991
6003
|
}
|
|
3992
6004
|
try {
|
|
6005
|
+
if (this.transport) {
|
|
6006
|
+
const response2 = await this.transport.request({
|
|
6007
|
+
url,
|
|
6008
|
+
method,
|
|
6009
|
+
headers: Object.fromEntries(headers.entries()),
|
|
6010
|
+
data: body,
|
|
6011
|
+
signal: options.signal ?? controller.signal,
|
|
6012
|
+
timeout: options.timeoutMs ?? this.timeoutMs,
|
|
6013
|
+
validateStatus: () => true
|
|
6014
|
+
});
|
|
6015
|
+
return await parseAxiosResponse(response2, options.parseAs);
|
|
6016
|
+
}
|
|
3993
6017
|
const response = await this.fetch(url, {
|
|
3994
6018
|
method,
|
|
3995
6019
|
headers,
|
|
@@ -4086,6 +6110,11 @@ var Tevroc = (() => {
|
|
|
4086
6110
|
if (result.token) client.setToken(result.token);
|
|
4087
6111
|
return result;
|
|
4088
6112
|
},
|
|
6113
|
+
loginViaEmailPassword: (email, password) => client.auth.login({ email, password }),
|
|
6114
|
+
loginWithGoogle: (input) => client.request("/auth/google", { method: "POST", body: input, auth: false }).then((result) => {
|
|
6115
|
+
if (result.token) client.setToken(result.token);
|
|
6116
|
+
return result;
|
|
6117
|
+
}),
|
|
4089
6118
|
async logout() {
|
|
4090
6119
|
const result = await client.request("/auth/logout", { method: "POST" });
|
|
4091
6120
|
client.clearToken();
|
|
@@ -4104,12 +6133,12 @@ var Tevroc = (() => {
|
|
|
4104
6133
|
{
|
|
4105
6134
|
get(_target, entity) {
|
|
4106
6135
|
if (typeof entity !== "string") return void 0;
|
|
4107
|
-
return
|
|
6136
|
+
return createEntityApi2(client, entity);
|
|
4108
6137
|
}
|
|
4109
6138
|
}
|
|
4110
6139
|
);
|
|
4111
6140
|
}
|
|
4112
|
-
function
|
|
6141
|
+
function createEntityApi2(client, entity) {
|
|
4113
6142
|
const base = `/entities/${encodeURIComponent(entity)}`;
|
|
4114
6143
|
return {
|
|
4115
6144
|
list: (options) => client.request(base, { query: options }),
|
|
@@ -4118,6 +6147,7 @@ var Tevroc = (() => {
|
|
|
4118
6147
|
update: (id, patch) => client.request(`${base}/${encodeURIComponent(id)}`, { method: "PATCH", body: patch }),
|
|
4119
6148
|
delete: (id) => client.request(`${base}/${encodeURIComponent(id)}`, { method: "DELETE" }),
|
|
4120
6149
|
query: (input = {}) => client.request(`${base}/query`, { method: "POST", body: input }),
|
|
6150
|
+
filter: (filter = {}, sortOrOptions, limit) => client.request(`${base}/query`, { method: "POST", body: normalizeFilterInput(filter, sortOrOptions, limit) }),
|
|
4121
6151
|
bulkCreate: (records) => client.request(`${base}/bulk`, { method: "POST", body: { records } }),
|
|
4122
6152
|
bulkUpdate: (records) => client.request(`${base}/bulk`, { method: "PATCH", body: { records } }),
|
|
4123
6153
|
bulkDelete: (ids) => client.request(`${base}/bulk`, { method: "DELETE", body: { ids } }),
|
|
@@ -4240,6 +6270,23 @@ var Tevroc = (() => {
|
|
|
4240
6270
|
if (options.contentType) headers["content-type"] = options.contentType;
|
|
4241
6271
|
return client.request(path, { method: "POST", body: file, headers });
|
|
4242
6272
|
}
|
|
6273
|
+
async function parseAxiosResponse(response, parseAs) {
|
|
6274
|
+
if (parseAs === "response") return response;
|
|
6275
|
+
const headers = response.headers ?? {};
|
|
6276
|
+
const contentType = typeof headers.get === "function" ? headers.get("content-type") ?? "" : String(headers["content-type"] ?? headers["Content-Type"] ?? "");
|
|
6277
|
+
const isJson = contentType.includes("application/json");
|
|
6278
|
+
const data = response.data;
|
|
6279
|
+
if (response.status < 200 || response.status >= 300) {
|
|
6280
|
+
const error = isJson && data?.error ? data.error : {};
|
|
6281
|
+
throw new TevrocError(error.message ?? response.statusText ?? "Request failed", {
|
|
6282
|
+
status: response.status,
|
|
6283
|
+
code: error.code ?? "api_error",
|
|
6284
|
+
details: error.details ?? data,
|
|
6285
|
+
response
|
|
6286
|
+
});
|
|
6287
|
+
}
|
|
6288
|
+
return data;
|
|
6289
|
+
}
|
|
4243
6290
|
async function parseResponse(response, parseAs) {
|
|
4244
6291
|
if (parseAs === "response") return response;
|
|
4245
6292
|
const contentType = response.headers.get("content-type") ?? "";
|
|
@@ -4275,6 +6322,19 @@ var Tevroc = (() => {
|
|
|
4275
6322
|
function normalizeHeaders(headers = {}) {
|
|
4276
6323
|
return Object.fromEntries(new Headers(headers).entries());
|
|
4277
6324
|
}
|
|
6325
|
+
function safeLocalStorage() {
|
|
6326
|
+
return typeof globalThis !== "undefined" ? globalThis.localStorage : void 0;
|
|
6327
|
+
}
|
|
6328
|
+
function getStoredToken() {
|
|
6329
|
+
return safeLocalStorage()?.getItem("tevroc_access_token") ?? null;
|
|
6330
|
+
}
|
|
6331
|
+
function normalizeFilterInput(filter = {}, sortOrOptions, limit) {
|
|
6332
|
+
const input = { filter };
|
|
6333
|
+
if (typeof sortOrOptions === "string") input.sort = sortOrOptions;
|
|
6334
|
+
else if (sortOrOptions && typeof sortOrOptions === "object") Object.assign(input, sortOrOptions);
|
|
6335
|
+
if (limit !== void 0) input.limit = limit;
|
|
6336
|
+
return input;
|
|
6337
|
+
}
|
|
4278
6338
|
function isJsonBody(body) {
|
|
4279
6339
|
const isArrayBuffer = typeof ArrayBuffer !== "undefined" && body instanceof ArrayBuffer;
|
|
4280
6340
|
const isBlob = typeof Blob !== "undefined" && body instanceof Blob;
|