@peers-app/peers-sdk 0.7.24 → 0.7.25
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.
|
@@ -189,10 +189,10 @@ class UserContext {
|
|
|
189
189
|
if (!this.personalUserSubscription) {
|
|
190
190
|
this.personalUserSubscription = this.subscribeToDataChangedAcrossAllGroups('Users', async (evt) => {
|
|
191
191
|
const changedUser = evt.data.dataObject;
|
|
192
|
-
if (changedUser.userId !== this.userId) {
|
|
192
|
+
if (changedUser.userId !== this.userId && evt.dataContext.dataContextId !== this.userDataContext.dataContextId) {
|
|
193
193
|
// sync to my personal db if this is a user that I have there
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
194
|
+
const personalContact = await (0, data_1.Users)(this.userDataContext).get(changedUser.userId);
|
|
195
|
+
if (personalContact && !(0, lodash_1.isEqual)(personalContact, changedUser)) {
|
|
196
196
|
try {
|
|
197
197
|
await (0, data_1.Users)(this.userDataContext).save(changedUser);
|
|
198
198
|
}
|
|
@@ -58,6 +58,9 @@ const changeTrackingTableMetaData = {
|
|
|
58
58
|
{ fields: ['changeType'] },
|
|
59
59
|
{ fields: ['timestamp'] },
|
|
60
60
|
{ fields: ['timestampApplied'] },
|
|
61
|
+
// compound indexes for common queries
|
|
62
|
+
{ fields: ['tableName', 'recordId', 'timestamp'] },
|
|
63
|
+
{ fields: ['recordId', 'changeType'] },
|
|
61
64
|
],
|
|
62
65
|
localOnly: true,
|
|
63
66
|
};
|
|
@@ -55,6 +55,8 @@ class PersistentVarsTable extends table_1.Table {
|
|
|
55
55
|
persistentVar.value.value = await rpc_types_1.rpcServerCalls.encryptData(persistentVar.value.value || '', this.groupId);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
opts ??= {};
|
|
59
|
+
opts = { saveAsSnapshot: true, ...opts };
|
|
58
60
|
return super.save(persistentVar, opts);
|
|
59
61
|
}
|
|
60
62
|
async getPersistentVarValue(name) {
|
package/dist/data/users.js
CHANGED