shogun-core 4.2.1 → 4.2.2
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/dist/browser/shogun-core.js +64 -48
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/gundb/db.js +64 -48
- package/package.json +1 -1
|
@@ -134785,14 +134785,17 @@ class DataBase {
|
|
|
134785
134785
|
const aliasNode = this.gun.get(`~@${username}`);
|
|
134786
134786
|
// For Gun.js alias validation to pass, the data must be exactly equal to the key
|
|
134787
134787
|
// The key is `~@${username}`, so we store that as the data
|
|
134788
|
-
|
|
134789
|
-
|
|
134790
|
-
|
|
134791
|
-
|
|
134792
|
-
|
|
134793
|
-
|
|
134794
|
-
|
|
134795
|
-
|
|
134788
|
+
return new Promise((resolve) => {
|
|
134789
|
+
aliasNode.put(`~@${username}`, (ack) => {
|
|
134790
|
+
if (ack && ack.err) {
|
|
134791
|
+
console.error(`Error creating alias index: ${ack.err}`);
|
|
134792
|
+
resolve(false);
|
|
134793
|
+
}
|
|
134794
|
+
else {
|
|
134795
|
+
resolve(true);
|
|
134796
|
+
}
|
|
134797
|
+
});
|
|
134798
|
+
});
|
|
134796
134799
|
}
|
|
134797
134800
|
catch (error) {
|
|
134798
134801
|
console.error(`Error creating alias index: ${error}`);
|
|
@@ -134804,18 +134807,20 @@ class DataBase {
|
|
|
134804
134807
|
*/
|
|
134805
134808
|
async createUsernameMapping(username, userPub) {
|
|
134806
134809
|
try {
|
|
134807
|
-
|
|
134808
|
-
.
|
|
134809
|
-
|
|
134810
|
-
|
|
134811
|
-
|
|
134812
|
-
|
|
134813
|
-
|
|
134814
|
-
|
|
134815
|
-
|
|
134816
|
-
|
|
134817
|
-
|
|
134818
|
-
|
|
134810
|
+
return new Promise((resolve) => {
|
|
134811
|
+
this.node
|
|
134812
|
+
.get("usernames")
|
|
134813
|
+
.get(username)
|
|
134814
|
+
.put(userPub, (ack) => {
|
|
134815
|
+
if (ack && ack.err) {
|
|
134816
|
+
console.error(`Error creating username mapping: ${ack.err}`);
|
|
134817
|
+
resolve(false);
|
|
134818
|
+
}
|
|
134819
|
+
else {
|
|
134820
|
+
resolve(true);
|
|
134821
|
+
}
|
|
134822
|
+
});
|
|
134823
|
+
});
|
|
134819
134824
|
}
|
|
134820
134825
|
catch (error) {
|
|
134821
134826
|
console.error(`Error creating username mapping: ${error}`);
|
|
@@ -134834,18 +134839,20 @@ class DataBase {
|
|
|
134834
134839
|
registeredAt: Date.now().toString(),
|
|
134835
134840
|
lastSeen: Date.now().toString(),
|
|
134836
134841
|
};
|
|
134837
|
-
|
|
134838
|
-
.
|
|
134839
|
-
|
|
134840
|
-
|
|
134841
|
-
|
|
134842
|
-
|
|
134843
|
-
|
|
134844
|
-
|
|
134845
|
-
|
|
134846
|
-
|
|
134847
|
-
|
|
134848
|
-
|
|
134842
|
+
return new Promise((resolve) => {
|
|
134843
|
+
this.node
|
|
134844
|
+
.get("users")
|
|
134845
|
+
.get(userPub)
|
|
134846
|
+
.put(userData, (ack) => {
|
|
134847
|
+
if (ack && ack.err) {
|
|
134848
|
+
console.error(`Error creating user registry: ${ack.err}`);
|
|
134849
|
+
resolve(false);
|
|
134850
|
+
}
|
|
134851
|
+
else {
|
|
134852
|
+
resolve(true);
|
|
134853
|
+
}
|
|
134854
|
+
});
|
|
134855
|
+
});
|
|
134849
134856
|
}
|
|
134850
134857
|
catch (error) {
|
|
134851
134858
|
console.error(`Error creating user registry: ${error}`);
|
|
@@ -134880,14 +134887,20 @@ class DataBase {
|
|
|
134880
134887
|
*/
|
|
134881
134888
|
async createEpubIndex(epub, userPub) {
|
|
134882
134889
|
try {
|
|
134883
|
-
|
|
134884
|
-
|
|
134885
|
-
|
|
134886
|
-
|
|
134887
|
-
|
|
134888
|
-
|
|
134889
|
-
|
|
134890
|
-
|
|
134890
|
+
return new Promise((resolve) => {
|
|
134891
|
+
this.node
|
|
134892
|
+
.get("epubKeys")
|
|
134893
|
+
.get(epub)
|
|
134894
|
+
.put(userPub, (ack) => {
|
|
134895
|
+
if (ack && ack.err) {
|
|
134896
|
+
console.error(`Error creating epub index: ${ack.err}`);
|
|
134897
|
+
resolve(false);
|
|
134898
|
+
}
|
|
134899
|
+
else {
|
|
134900
|
+
resolve(true);
|
|
134901
|
+
}
|
|
134902
|
+
});
|
|
134903
|
+
});
|
|
134891
134904
|
}
|
|
134892
134905
|
catch (error) {
|
|
134893
134906
|
console.error(`Error creating epub index: ${error}`);
|
|
@@ -134905,14 +134918,17 @@ class DataBase {
|
|
|
134905
134918
|
registeredAt: Date.now(),
|
|
134906
134919
|
lastSeen: Date.now(),
|
|
134907
134920
|
};
|
|
134908
|
-
|
|
134909
|
-
|
|
134910
|
-
|
|
134911
|
-
|
|
134912
|
-
|
|
134913
|
-
|
|
134914
|
-
|
|
134915
|
-
|
|
134921
|
+
return new Promise((resolve) => {
|
|
134922
|
+
this.gun.get(userPub).put(userMetadata, (ack) => {
|
|
134923
|
+
if (ack && ack.err) {
|
|
134924
|
+
console.error(`Error creating user metadata: ${ack.err}`);
|
|
134925
|
+
resolve(false);
|
|
134926
|
+
}
|
|
134927
|
+
else {
|
|
134928
|
+
resolve(true);
|
|
134929
|
+
}
|
|
134930
|
+
});
|
|
134931
|
+
});
|
|
134916
134932
|
}
|
|
134917
134933
|
catch (error) {
|
|
134918
134934
|
console.error(`Error creating user metadata: ${error}`);
|