@push.rocks/smartjmap 2.0.0 → 2.1.0
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/.smartconfig.json +1 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.jmapclient.d.ts +22 -13
- package/dist_ts/classes.jmapclient.js +294 -153
- package/dist_ts/classes.jmapserver.d.ts +49 -4
- package/dist_ts/classes.jmapserver.js +852 -330
- package/dist_ts/interfaces.backend.d.ts +19 -0
- package/dist_ts/interfaces.backend.js +1 -1
- package/package.json +5 -6
- package/readme.md +36 -5
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.jmapclient.ts +360 -157
- package/ts/classes.jmapserver.ts +1271 -439
- package/ts/interfaces.backend.ts +21 -0
package/.smartconfig.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartjmap',
|
|
6
|
-
version: '2.
|
|
6
|
+
version: '2.1.0',
|
|
7
7
|
description: 'A TypeScript JMAP toolkit (RFC 8620/8621): an event-driven mail client for reading, sending, and watching mail, plus an embeddable JMAP server core with pluggable storage.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx1QkFBdUI7SUFDN0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDZLQUE2SztDQUMzTCxDQUFBIn0=
|
|
@@ -166,18 +166,8 @@ export declare class JmapError extends Error {
|
|
|
166
166
|
}
|
|
167
167
|
export declare class JmapClient extends plugins.events.EventEmitter {
|
|
168
168
|
private config;
|
|
169
|
-
private
|
|
170
|
-
private
|
|
171
|
-
private apiUrl;
|
|
172
|
-
private mailbox;
|
|
173
|
-
private connected;
|
|
174
|
-
private stopped;
|
|
175
|
-
private lastEmailState;
|
|
176
|
-
private seenEmailIds;
|
|
177
|
-
private pollTimer;
|
|
178
|
-
private sseAbortController;
|
|
179
|
-
private fetchingDeltas;
|
|
180
|
-
private deltaQueued;
|
|
169
|
+
private generationCounter;
|
|
170
|
+
private connectionGeneration;
|
|
181
171
|
constructor(config: IJmapClientConfig);
|
|
182
172
|
/**
|
|
183
173
|
* Fetches and validates the JMAP session, resolves the target mailbox,
|
|
@@ -199,19 +189,34 @@ export declare class JmapClient extends plugins.events.EventEmitter {
|
|
|
199
189
|
* JmapError with `httpStatus`/`problemType`/`jmapErrorType` fields.
|
|
200
190
|
*/
|
|
201
191
|
request(methodCalls: TJmapMethodCall[]): Promise<TJmapMethodResponse[]>;
|
|
192
|
+
private requestWithGeneration;
|
|
202
193
|
/** Returns all mailboxes of the account (Mailbox/get with ids: null). */
|
|
203
194
|
getMailboxes(): Promise<IJmapMailbox[]>;
|
|
195
|
+
private getMailboxesWithGeneration;
|
|
204
196
|
/**
|
|
205
197
|
* Runs Email/query (default filter: the watched mailbox) followed by a full
|
|
206
198
|
* Email/get and returns resolved messages, newest first.
|
|
207
199
|
*/
|
|
208
200
|
queryEmails(filter?: Record<string, any>, limit?: number): Promise<ISmartJmapMessage[]>;
|
|
201
|
+
private queryEmailsWithGeneration;
|
|
209
202
|
/** Fetches a single email with all body values resolved (RFC 8621 §4.2, fetchAllBodyValues). */
|
|
210
203
|
getEmail(id: string): Promise<ISmartJmapMessage>;
|
|
211
204
|
/** Replaces the full keywords object of an email via Email/set. */
|
|
212
205
|
setKeywords(emailId: string, keywords: Record<string, boolean>): Promise<void>;
|
|
213
206
|
/** Convenience: sets the $seen keyword via an Email/set keywords patch. */
|
|
214
207
|
markSeen(emailId: string): Promise<void>;
|
|
208
|
+
/** Convenience: removes the $seen keyword via an Email/set keywords patch. */
|
|
209
|
+
markUnseen(emailId: string): Promise<void>;
|
|
210
|
+
/** Convenience: adds or removes the $flagged keyword. */
|
|
211
|
+
setFlagged(emailId: string, flagged: boolean): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Replaces the email's mailbox membership. Pass one mailbox id for a
|
|
214
|
+
* provider-style move, or multiple ids when the remote JMAP account
|
|
215
|
+
* supports multi-mailbox membership.
|
|
216
|
+
*/
|
|
217
|
+
setMailboxes(emailId: string, mailboxIds: string[]): Promise<void>;
|
|
218
|
+
/** Permanently destroys an email via Email/set. */
|
|
219
|
+
destroyEmail(emailId: string): Promise<void>;
|
|
215
220
|
/**
|
|
216
221
|
* Sends an email: Identity/get lookup, Email/set create (into the mailbox
|
|
217
222
|
* with role 'sent', falling back to 'drafts', then the watched mailbox) and
|
|
@@ -229,6 +234,11 @@ export declare class JmapClient extends plugins.events.EventEmitter {
|
|
|
229
234
|
* (RFC 8620 §6.2: {accountId}, {blobId}, {type}, {name}).
|
|
230
235
|
*/
|
|
231
236
|
downloadBlob(blobId: string, type?: string, name?: string): Promise<Uint8Array>;
|
|
237
|
+
private createConnectionGeneration;
|
|
238
|
+
private isCurrentGeneration;
|
|
239
|
+
private assertCurrentGeneration;
|
|
240
|
+
private requireConnectedGeneration;
|
|
241
|
+
private teardownGeneration;
|
|
232
242
|
private getAuthHeader;
|
|
233
243
|
private createHttpError;
|
|
234
244
|
private resolveMailbox;
|
|
@@ -253,5 +263,4 @@ export declare class JmapClient extends plugins.events.EventEmitter {
|
|
|
253
263
|
private fetchDeltasOnce;
|
|
254
264
|
/** Full resync fallback when the server cannot calculate changes. */
|
|
255
265
|
private resyncViaQuery;
|
|
256
|
-
private teardownWatchers;
|
|
257
266
|
}
|