@remit/mailbox-service 0.0.3 → 0.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/mailbox-service",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -158,4 +158,26 @@ describe("ImapFlowConnection.getMailboxStatus — deletedCount (#1042)", () => {
158
158
 
159
159
  assert.strictEqual(status.deletedCount, 0);
160
160
  });
161
+
162
+ it("carries highestModseq above 2^53 as a lossless decimal string (reader#9)", async () => {
163
+ const modseq = 18446744073709551615n;
164
+ const connection = buildConnectionWithClient({
165
+ status: async () => ({
166
+ path: "INBOX",
167
+ messages: 1,
168
+ recent: 0,
169
+ unseen: 0,
170
+ uidNext: 2,
171
+ uidValidity: 1n,
172
+ highestModseq: modseq,
173
+ }),
174
+ mailboxOpen: async (path: string) => fakeMailbox(path, 1),
175
+ search: async () => false,
176
+ });
177
+
178
+ const status = await connection.getMailboxStatus("INBOX");
179
+
180
+ assert.strictEqual(status.highestModseq, "18446744073709551615");
181
+ assert.strictEqual(BigInt(status.highestModseq), modseq);
182
+ });
161
183
  });
@@ -1193,7 +1193,7 @@ export class ImapFlowConnection {
1193
1193
  unseen: status.unseen ?? 0,
1194
1194
  uidNext: status.uidNext ?? 0,
1195
1195
  uidValidity: Number(status.uidValidity ?? 0),
1196
- highestModseq: Number(status.highestModseq ?? 0),
1196
+ highestModseq: (status.highestModseq ?? 0n).toString(),
1197
1197
  deletedCount,
1198
1198
  };
1199
1199
  };
@@ -62,7 +62,7 @@ describe("MailboxSyncService.syncMailboxes — UIDVALIDITY cursor detection (#12
62
62
  unseen: 1,
63
63
  uidNext: 100,
64
64
  uidValidity,
65
- highestModseq: 0,
65
+ highestModseq: "0",
66
66
  deletedCount: 0,
67
67
  }),
68
68
  }) as unknown as IImapConnection;
@@ -83,7 +83,7 @@ describe("MailboxSyncService.syncMailboxes — UIDVALIDITY cursor detection (#12
83
83
  messageCount: 5,
84
84
  unseenCount: 1,
85
85
  deletedCount: 0,
86
- highestModseq: 0,
86
+ highestModseq: "0",
87
87
  specialUse: undefined,
88
88
  cursorState: existingCursorState,
89
89
  },
@@ -429,7 +429,7 @@ export class MailboxSyncService {
429
429
  existing.messageCount !== status.messages ||
430
430
  existing.unseenCount !== status.unseen ||
431
431
  existing.deletedCount !== status.deletedCount ||
432
- (status.highestModseq > 0 &&
432
+ (BigInt(status.highestModseq) > 0n &&
433
433
  existing.highestModseq !== status.highestModseq) ||
434
434
  specialUseChanged;
435
435
 
@@ -459,7 +459,7 @@ export class MailboxSyncService {
459
459
  `deletedCount: ${existing.deletedCount} -> ${status.deletedCount}`,
460
460
  );
461
461
  if (
462
- status.highestModseq > 0 &&
462
+ BigInt(status.highestModseq) > 0n &&
463
463
  existing.highestModseq !== status.highestModseq
464
464
  )
465
465
  changes.push(
package/src/types.ts CHANGED
@@ -114,8 +114,8 @@ export interface ImapMailboxStatus {
114
114
  unseen: number;
115
115
  uidNext: number;
116
116
  uidValidity: number;
117
- /** Highest modification sequence (CONDSTORE). 0 if server doesn't support CONDSTORE. */
118
- highestModseq: number;
117
+ /** Highest modification sequence (CONDSTORE) as decimal digits of an unsigned 64-bit value. "0" if the server does not support CONDSTORE. */
118
+ highestModseq: string;
119
119
  /** Count of messages flagged \Deleted but not yet expunged. */
120
120
  deletedCount: number;
121
121
  }