@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.
package/dist/index.cjs CHANGED
@@ -12528,8 +12528,20 @@ var GroupChatModule = class {
12528
12528
  }
12529
12529
  }
12530
12530
  }
12531
- destroy() {
12531
+ async destroy() {
12532
12532
  this.destroyConnection();
12533
+ if (this.persistTimer) {
12534
+ clearTimeout(this.persistTimer);
12535
+ this.persistTimer = null;
12536
+ }
12537
+ if (this.deps) {
12538
+ try {
12539
+ if (this.persistPromise) await this.persistPromise;
12540
+ await this.doPersistAll();
12541
+ } catch (err) {
12542
+ logger.debug("GroupChat", "Persist on destroy failed", err);
12543
+ }
12544
+ }
12533
12545
  this.groups.clear();
12534
12546
  this.messages.clear();
12535
12547
  this.members.clear();
@@ -12538,10 +12550,7 @@ var GroupChatModule = class {
12538
12550
  this.messageHandlers.clear();
12539
12551
  this.relayAdminPubkeys = null;
12540
12552
  this.relayAdminFetchPromise = null;
12541
- if (this.persistTimer) {
12542
- clearTimeout(this.persistTimer);
12543
- this.persistTimer = null;
12544
- }
12553
+ this.persistPromise = null;
12545
12554
  this.deps = null;
12546
12555
  }
12547
12556
  destroyConnection() {
@@ -12678,16 +12687,14 @@ var GroupChatModule = class {
12678
12687
  this.trackSubscription(
12679
12688
  createNip29Filter({
12680
12689
  kinds: [NIP29_KINDS.GROUP_METADATA, NIP29_KINDS.GROUP_MEMBERS, NIP29_KINDS.GROUP_ADMINS],
12681
- "#d": groupIds,
12682
- ...sinceTimestamp ? { since: sinceTimestamp } : {}
12690
+ "#d": groupIds
12683
12691
  }),
12684
12692
  { onEvent: (event) => this.handleMetadataEvent(event) }
12685
12693
  );
12686
12694
  this.trackSubscription(
12687
12695
  createNip29Filter({
12688
12696
  kinds: [NIP29_KINDS.DELETE_EVENT, NIP29_KINDS.REMOVE_USER, NIP29_KINDS.DELETE_GROUP],
12689
- "#h": groupIds,
12690
- ...sinceTimestamp ? { since: sinceTimestamp } : {}
12697
+ "#h": groupIds
12691
12698
  }),
12692
12699
  { onEvent: (event) => this.handleModerationEvent(event) }
12693
12700
  );
@@ -12706,8 +12713,7 @@ var GroupChatModule = class {
12706
12713
  this.trackSubscription(
12707
12714
  createNip29Filter({
12708
12715
  kinds: [NIP29_KINDS.DELETE_EVENT, NIP29_KINDS.REMOVE_USER, NIP29_KINDS.DELETE_GROUP],
12709
- "#h": [groupId],
12710
- ...sinceTimestamp ? { since: sinceTimestamp } : {}
12716
+ "#h": [groupId]
12711
12717
  }),
12712
12718
  { onEvent: (event) => this.handleModerationEvent(event) }
12713
12719
  );