@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 personalUser = await (0, data_1.Users)(this.userDataContext).get(changedUser.userId);
195
- if (personalUser && !(0, lodash_1.isEqual)(personalUser, changedUser)) {
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) {
@@ -76,6 +76,8 @@ let UsersTable = (() => {
76
76
  }
77
77
  static isPassthrough = false;
78
78
  async save(user, opts) {
79
+ opts = opts || {};
80
+ opts = { saveAsSnapshot: true, ...opts };
79
81
  if (UsersTable.isPassthrough) {
80
82
  return super.save(user, opts);
81
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peers-app/peers-sdk",
3
- "version": "0.7.24",
3
+ "version": "0.7.25",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/peers-app/peers-sdk.git"