@massalabs/gossip-sdk 0.0.2-dev.20260325152907 → 0.0.2-dev.20260330112729

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/db/db.d.ts CHANGED
@@ -145,6 +145,7 @@ export interface Discussion {
145
145
  pinned: boolean;
146
146
  messageRetentionDuration: number | null;
147
147
  retentionPolicySetAt: number | null;
148
+ mutedNotifications: boolean;
148
149
  killedNextRetryAt?: Date | null;
149
150
  saturatedRetryAt?: Date | null;
150
151
  saturatedRetryDone: boolean;
@@ -63,4 +63,12 @@ export const MIGRATIONS = [
63
63
  'ALTER TABLE `discussions` ADD COLUMN `retentionPolicySetAt` integer;',
64
64
  ],
65
65
  },
66
+ {
67
+ idx: 5,
68
+ tag: '0005_discussions_muted',
69
+ when: 1744000000000,
70
+ statements: [
71
+ 'ALTER TABLE `discussions` ADD COLUMN `mutedNotifications` integer NOT NULL DEFAULT 0;',
72
+ ],
73
+ },
66
74
  ];
@@ -362,6 +362,23 @@ export declare const discussions: import("drizzle-orm/sqlite-core").SQLiteTableW
362
362
  identity: undefined;
363
363
  generated: undefined;
364
364
  }, {}, {}>;
365
+ mutedNotifications: import("drizzle-orm/sqlite-core").SQLiteColumn<{
366
+ name: "mutedNotifications";
367
+ tableName: "discussions";
368
+ dataType: "boolean";
369
+ columnType: "SQLiteBoolean";
370
+ data: boolean;
371
+ driverParam: number;
372
+ notNull: true;
373
+ hasDefault: true;
374
+ isPrimaryKey: false;
375
+ isAutoincrement: false;
376
+ hasRuntimeDefault: false;
377
+ enumValues: undefined;
378
+ baseColumn: never;
379
+ identity: undefined;
380
+ generated: undefined;
381
+ }, {}, {}>;
365
382
  saturatedRetryDone: import("drizzle-orm/sqlite-core").SQLiteColumn<{
366
383
  name: "saturatedRetryDone";
367
384
  tableName: "discussions";
@@ -27,6 +27,9 @@ export const discussions = sqliteTable('discussions', {
27
27
  saturatedRetryAt: integer('saturatedRetryAt', { mode: 'timestamp_ms' }),
28
28
  messageRetentionDuration: integer('messageRetentionDuration'),
29
29
  retentionPolicySetAt: integer('retentionPolicySetAt'), // nullable, ms timestamp when policy was last configured
30
+ mutedNotifications: integer('mutedNotifications', { mode: 'boolean' })
31
+ .notNull()
32
+ .default(false),
30
33
  saturatedRetryDone: integer('saturatedRetryDone', { mode: 'boolean' })
31
34
  .notNull()
32
35
  .default(false),
@@ -106,6 +106,8 @@ export declare class DiscussionService {
106
106
  success: boolean;
107
107
  message?: string;
108
108
  }>;
109
+ /** Mute or unmute notifications for a discussion */
110
+ setMuted(discussionId: number, muted: boolean): Promise<void>;
109
111
  /**
110
112
  * Set the auto-delete retention policy for a discussion.
111
113
  * Updates the local DB and sends a control message to the peer so both sides
@@ -334,6 +334,13 @@ export class DiscussionService {
334
334
  pin(discussionId, pinned) {
335
335
  return updateDiscussionPin(discussionId, pinned, this.queries);
336
336
  }
337
+ /** Mute or unmute notifications for a discussion */
338
+ async setMuted(discussionId, muted) {
339
+ await this.queries.discussions.updateById(discussionId, {
340
+ mutedNotifications: muted,
341
+ });
342
+ await this.refreshService?.stateUpdate();
343
+ }
337
344
  /**
338
345
  * Set the auto-delete retention policy for a discussion.
339
346
  * Updates the local DB and sends a control message to the peer so both sides
@@ -347,7 +354,7 @@ export class DiscussionService {
347
354
  // Update local DB
348
355
  await this.queries.discussions.updateByOwnerAndContact(ownerUserId, contactUserId, {
349
356
  messageRetentionDuration: durationSeconds,
350
- retentionPolicySetAt: durationSeconds ? Date.now() : null,
357
+ retentionPolicySetAt: Date.now(),
351
358
  });
352
359
  // Send control message to peer so they apply the same policy
353
360
  if (this.messageService) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massalabs/gossip-sdk",
3
- "version": "0.0.2-dev.20260325152907",
3
+ "version": "0.0.2-dev.20260330112729",
4
4
  "description": "Gossip SDK for automation, chatbot, and integration use cases",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",