@bobfrankston/mailx-imap 0.1.45 → 0.1.46
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/index.d.ts +13 -4
- package/index.js +16 -8
- package/package.json +5 -5
package/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Syncs messages to local store, emits events for new mail.
|
|
5
5
|
*/
|
|
6
6
|
import type { TransportFactory } from "@bobfrankston/tcp-transport";
|
|
7
|
-
import {
|
|
7
|
+
import { FileMessageStore, Store } from "@bobfrankston/mailx-store";
|
|
8
8
|
import type { AccountConfig, MessageEnvelope, Folder } from "@bobfrankston/mailx-types";
|
|
9
9
|
import { EventEmitter } from "node:events";
|
|
10
10
|
/** Events emitted by the IMAP manager */
|
|
@@ -60,8 +60,17 @@ export declare class ImapManager extends EventEmitter {
|
|
|
60
60
|
private configs;
|
|
61
61
|
private watchers;
|
|
62
62
|
private fetchClients;
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
/** The Store is the architectural nexus — owner of MailxDB +
|
|
64
|
+
* FileMessageStore + the event bus. This package (mailx-imap) is a
|
|
65
|
+
* *consumer* of the Store. `this.db` and `this.bodyStore` are getters
|
|
66
|
+
* onto Store-owned objects, kept as fields here for source-diff
|
|
67
|
+
* compatibility during the inversion (so the ~120 existing
|
|
68
|
+
* `this.db.X(...)` callsites don't all need touching at once). Future:
|
|
69
|
+
* every mutation moves to `this.store.X(...)` with bus-emit baked in;
|
|
70
|
+
* these fields shrink to read-only convenience refs. */
|
|
71
|
+
private store;
|
|
72
|
+
private get db();
|
|
73
|
+
private get bodyStore();
|
|
65
74
|
private syncIntervals;
|
|
66
75
|
/** Track which accounts have already shown an error banner — only emit once per session */
|
|
67
76
|
private accountErrorShown;
|
|
@@ -88,7 +97,7 @@ export declare class ImapManager extends EventEmitter {
|
|
|
88
97
|
/** Public read for the IPC surface: snapshot of all account diagnostics. */
|
|
89
98
|
getDiagnosticsSnapshot(): AccountDiagnostics[];
|
|
90
99
|
private transportFactory;
|
|
91
|
-
constructor(
|
|
100
|
+
constructor(store: Store, transportFactory: TransportFactory);
|
|
92
101
|
/** Get OAuth access token for an account (for SMTP auth) */
|
|
93
102
|
getOAuthToken(accountId: string): Promise<string | null>;
|
|
94
103
|
/** Accounts currently re-authenticating — all operations skip these */
|
package/index.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { createAutoImapConfig, CompatImapClient } from "@bobfrankston/iflow-direct";
|
|
7
7
|
import { authenticateOAuth } from "@bobfrankston/oauthsupport";
|
|
8
|
-
import {
|
|
9
|
-
import { loadSettings,
|
|
8
|
+
import { parseSerial, storeBus } from "@bobfrankston/mailx-store";
|
|
9
|
+
import { loadSettings, getConfigDir, getHistoryDays, getPrefetch } from "@bobfrankston/mailx-settings";
|
|
10
10
|
import { EventEmitter } from "node:events";
|
|
11
11
|
import * as fs from "node:fs";
|
|
12
12
|
import * as path from "node:path";
|
|
@@ -135,8 +135,17 @@ export class ImapManager extends EventEmitter {
|
|
|
135
135
|
configs = new Map();
|
|
136
136
|
watchers = new Map();
|
|
137
137
|
fetchClients = new Map();
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
/** The Store is the architectural nexus — owner of MailxDB +
|
|
139
|
+
* FileMessageStore + the event bus. This package (mailx-imap) is a
|
|
140
|
+
* *consumer* of the Store. `this.db` and `this.bodyStore` are getters
|
|
141
|
+
* onto Store-owned objects, kept as fields here for source-diff
|
|
142
|
+
* compatibility during the inversion (so the ~120 existing
|
|
143
|
+
* `this.db.X(...)` callsites don't all need touching at once). Future:
|
|
144
|
+
* every mutation moves to `this.store.X(...)` with bus-emit baked in;
|
|
145
|
+
* these fields shrink to read-only convenience refs. */
|
|
146
|
+
store;
|
|
147
|
+
get db() { return this.store.db; }
|
|
148
|
+
get bodyStore() { return this.store.bodyStore; }
|
|
140
149
|
syncIntervals = new Map();
|
|
141
150
|
/** Track which accounts have already shown an error banner — only emit once per session */
|
|
142
151
|
accountErrorShown = new Set();
|
|
@@ -197,12 +206,11 @@ export class ImapManager extends EventEmitter {
|
|
|
197
206
|
return Array.from(this.diagnostics.values()).map(d => ({ ...d }));
|
|
198
207
|
}
|
|
199
208
|
transportFactory;
|
|
200
|
-
constructor(
|
|
209
|
+
constructor(store, transportFactory) {
|
|
201
210
|
super();
|
|
202
|
-
this.
|
|
211
|
+
this.store = store;
|
|
203
212
|
this.transportFactory = transportFactory;
|
|
204
|
-
|
|
205
|
-
this.bodyStore = new FileMessageStore(storePath);
|
|
213
|
+
// bodyStore is now owned by Store; getter above forwards to it.
|
|
206
214
|
// Cancel pending deferred-delete when move-detect rebinds a row.
|
|
207
215
|
// Without this, the source folder's reconcile-delete grace timer
|
|
208
216
|
// would fire 30 minutes after detection for a row that's already
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@bobfrankston/mailx-types": "^0.1.13",
|
|
13
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
13
|
+
"@bobfrankston/mailx-settings": "^0.1.17",
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.25",
|
|
15
15
|
"@bobfrankston/iflow-direct": "^0.1.44",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
".transformedSnapshot": {
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@bobfrankston/mailx-types": "^0.1.13",
|
|
41
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
41
|
+
"@bobfrankston/mailx-settings": "^0.1.17",
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.25",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.44",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.8",
|