@unicitylabs/sphere-sdk 0.6.10-dev.2 → 0.6.10-dev.3

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.
@@ -12188,8 +12188,20 @@ var GroupChatModule = class {
12188
12188
  }
12189
12189
  }
12190
12190
  }
12191
- destroy() {
12191
+ async destroy() {
12192
12192
  this.destroyConnection();
12193
+ if (this.persistTimer) {
12194
+ clearTimeout(this.persistTimer);
12195
+ this.persistTimer = null;
12196
+ }
12197
+ if (this.deps) {
12198
+ try {
12199
+ if (this.persistPromise) await this.persistPromise;
12200
+ await this.doPersistAll();
12201
+ } catch (err) {
12202
+ logger.debug("GroupChat", "Persist on destroy failed", err);
12203
+ }
12204
+ }
12193
12205
  this.groups.clear();
12194
12206
  this.messages.clear();
12195
12207
  this.members.clear();
@@ -12198,10 +12210,7 @@ var GroupChatModule = class {
12198
12210
  this.messageHandlers.clear();
12199
12211
  this.relayAdminPubkeys = null;
12200
12212
  this.relayAdminFetchPromise = null;
12201
- if (this.persistTimer) {
12202
- clearTimeout(this.persistTimer);
12203
- this.persistTimer = null;
12204
- }
12213
+ this.persistPromise = null;
12205
12214
  this.deps = null;
12206
12215
  }
12207
12216
  destroyConnection() {
@@ -12338,16 +12347,14 @@ var GroupChatModule = class {
12338
12347
  this.trackSubscription(
12339
12348
  createNip29Filter({
12340
12349
  kinds: [NIP29_KINDS.GROUP_METADATA, NIP29_KINDS.GROUP_MEMBERS, NIP29_KINDS.GROUP_ADMINS],
12341
- "#d": groupIds,
12342
- ...sinceTimestamp ? { since: sinceTimestamp } : {}
12350
+ "#d": groupIds
12343
12351
  }),
12344
12352
  { onEvent: (event) => this.handleMetadataEvent(event) }
12345
12353
  );
12346
12354
  this.trackSubscription(
12347
12355
  createNip29Filter({
12348
12356
  kinds: [NIP29_KINDS.DELETE_EVENT, NIP29_KINDS.REMOVE_USER, NIP29_KINDS.DELETE_GROUP],
12349
- "#h": groupIds,
12350
- ...sinceTimestamp ? { since: sinceTimestamp } : {}
12357
+ "#h": groupIds
12351
12358
  }),
12352
12359
  { onEvent: (event) => this.handleModerationEvent(event) }
12353
12360
  );
@@ -12366,8 +12373,7 @@ var GroupChatModule = class {
12366
12373
  this.trackSubscription(
12367
12374
  createNip29Filter({
12368
12375
  kinds: [NIP29_KINDS.DELETE_EVENT, NIP29_KINDS.REMOVE_USER, NIP29_KINDS.DELETE_GROUP],
12369
- "#h": [groupId],
12370
- ...sinceTimestamp ? { since: sinceTimestamp } : {}
12376
+ "#h": [groupId]
12371
12377
  }),
12372
12378
  { onEvent: (event) => this.handleModerationEvent(event) }
12373
12379
  );