@dawnlit/outlook-bridge 2.0.0 → 2.2.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/README.md +16 -9
- package/dist/backend.d.ts +2 -2
- package/dist/backend.js.map +1 -1
- package/dist/bridge.js +3 -3
- package/dist/bridge.js.map +1 -1
- package/dist/errors.d.ts +17 -8
- package/dist/errors.js +17 -13
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/mac/accounts.d.ts +4 -0
- package/dist/mac/accounts.js +10 -0
- package/dist/mac/accounts.js.map +1 -1
- package/dist/mac/attachments.js +1 -1
- package/dist/mac/attachments.js.map +1 -1
- package/dist/mac/bounces.js +18 -31
- package/dist/mac/bounces.js.map +1 -1
- package/dist/mac/cleanup.d.ts +11 -3
- package/dist/mac/cleanup.js +30 -58
- package/dist/mac/cleanup.js.map +1 -1
- package/dist/mac/drafts.d.ts +3 -1
- package/dist/mac/drafts.js +37 -49
- package/dist/mac/drafts.js.map +1 -1
- package/dist/mac/folders.d.ts +10 -3
- package/dist/mac/folders.js +31 -23
- package/dist/mac/folders.js.map +1 -1
- package/dist/mac/profile.d.ts +12 -0
- package/dist/mac/profile.js +75 -1
- package/dist/mac/profile.js.map +1 -1
- package/dist/mac/read.d.ts +4 -0
- package/dist/mac/read.js +68 -42
- package/dist/mac/read.js.map +1 -1
- package/dist/mac/run.d.ts +19 -5
- package/dist/mac/run.js +49 -9
- package/dist/mac/run.js.map +1 -1
- package/dist/mac/scripts.d.ts +67 -14
- package/dist/mac/scripts.js +150 -31
- package/dist/mac/scripts.js.map +1 -1
- package/dist/mac/send.d.ts +5 -4
- package/dist/mac/send.js +52 -14
- package/dist/mac/send.js.map +1 -1
- package/dist/mac/templates.js +16 -22
- package/dist/mac/templates.js.map +1 -1
- package/dist/mail.d.ts +11 -3
- package/dist/mail.js +25 -6
- package/dist/mail.js.map +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/shared/args.js.map +1 -1
- package/dist/shared/attachmentMatch.d.ts +0 -6
- package/dist/shared/attachmentMatch.js +0 -1
- package/dist/shared/attachmentMatch.js.map +1 -1
- package/dist/shared/exec.js.map +1 -1
- package/dist/shared/locate.d.ts +0 -8
- package/dist/shared/locate.js +0 -1
- package/dist/shared/locate.js.map +1 -1
- package/dist/shared/replyBody.d.ts +0 -15
- package/dist/shared/replyBody.js +0 -2
- package/dist/shared/replyBody.js.map +1 -1
- package/dist/shared/templateLimits.d.ts +14 -0
- package/dist/shared/templateLimits.js +21 -0
- package/dist/shared/templateLimits.js.map +1 -0
- package/dist/templateBody.d.ts +6 -0
- package/dist/templateBody.js +8 -1
- package/dist/templateBody.js.map +1 -1
- package/dist/types.d.ts +43 -7
- package/dist/types.js.map +1 -1
- package/dist/windows/accounts.js +1 -1
- package/dist/windows/accounts.js.map +1 -1
- package/dist/windows/attachments.js +2 -2
- package/dist/windows/attachments.js.map +1 -1
- package/dist/windows/bounces.js +7 -7
- package/dist/windows/bounces.js.map +1 -1
- package/dist/windows/cleanup.d.ts +5 -1
- package/dist/windows/cleanup.js +18 -15
- package/dist/windows/cleanup.js.map +1 -1
- package/dist/windows/drafts.d.ts +4 -4
- package/dist/windows/drafts.js +22 -33
- package/dist/windows/drafts.js.map +1 -1
- package/dist/windows/folders.js +2 -2
- package/dist/windows/folders.js.map +1 -1
- package/dist/{shared → windows}/json.d.ts +11 -6
- package/dist/{shared → windows}/json.js +12 -7
- package/dist/windows/json.js.map +1 -0
- package/dist/windows/read.js +23 -16
- package/dist/windows/read.js.map +1 -1
- package/dist/windows/run.d.ts +0 -2
- package/dist/windows/run.js +1 -2
- package/dist/windows/run.js.map +1 -1
- package/dist/windows/scripts.d.ts +10 -4
- package/dist/windows/scripts.js +21 -12
- package/dist/windows/scripts.js.map +1 -1
- package/dist/windows/send.d.ts +13 -4
- package/dist/windows/send.js +24 -6
- package/dist/windows/send.js.map +1 -1
- package/dist/windows/templates.js +11 -17
- package/dist/windows/templates.js.map +1 -1
- package/package.json +2 -2
- package/dist/shared/json.js.map +0 -1
package/README.md
CHANGED
|
@@ -7,7 +7,10 @@ cloud permissions: this automates the desktop client itself, the way a person wo
|
|
|
7
7
|
- **Windows** — PowerShell and Outlook's COM object model.
|
|
8
8
|
- **macOS** — AppleScript. Requires **legacy** Outlook for Mac: New Outlook implements only a slice of the AppleScript
|
|
9
9
|
dictionary (accounts don't enumerate, the inbox reports no messages), so every call fails with `ACCOUNT_NOT_FOUND`
|
|
10
|
-
there rather than quietly doing the wrong thing.
|
|
10
|
+
there rather than quietly doing the wrong thing. A Microsoft 365 mailbox Outlook syncs through Microsoft's cloud is
|
|
11
|
+
listed only in Outlook's profile, which macOS lets an app read once it has **Full Disk Access** — the app running
|
|
12
|
+
this package, or the terminal or editor it was started from. Without it, calls about such a mailbox fail with
|
|
13
|
+
`PERMISSION_DENIED`, naming the app to turn on.
|
|
11
14
|
- **Anywhere else** — `capabilities()` reports nothing supported and every call rejects with `UNSUPPORTED_PLATFORM`.
|
|
12
15
|
|
|
13
16
|
## Install
|
|
@@ -50,7 +53,7 @@ same defaults and the same validation on both platforms.
|
|
|
50
53
|
| Accounts | `getOutlookAccounts` |
|
|
51
54
|
| Reading | `readInboxEmails` (the Inbox root, or any folder by name or path), `searchInboxByFilter` (walks the whole Inbox tree by subject glob or pattern, date window, attachments, folders), `readEmailBody` (the sender's own text, split from the quoted thread), `readSelectedEmail`, `openOutlookEmail`, `locateEmail` (finds an email again by subject, sender and time once its id has gone stale) |
|
|
52
55
|
| Folders | `listInboxFolders`, `moveOutlookEmails` (creates a missing destination chain on request) |
|
|
53
|
-
| Composing | `sendOutlookEmail` (to/cc/bcc, several attachments, a named signature, send or draft), `replyOutlookEmail` (reply or reply-all, from HTML or a saved template)
|
|
56
|
+
| Composing | `sendOutlookEmail` (to/cc/bcc, several attachments, a named signature, send or draft; a draft filed without a window returns its id, so a caller can later send exactly the drafts it made), `replyOutlookEmail` (reply or reply-all, from HTML or a saved template; a reply filed without a window returns its draft's id too) |
|
|
54
57
|
| Drafts | `listOutlookDrafts`, `sendDrafts` (a chosen subset), `sendAllDrafts`, `deleteOutlookDrafts` |
|
|
55
58
|
| Attachments | `saveEmailAttachment`, `saveEmailAttachments` |
|
|
56
59
|
| Cleanup | `deleteOutlookEmails` (refuses received and sent mail unless allowed; dry-run first), `purgeDeletedItems` |
|
|
@@ -71,10 +74,11 @@ to keep a `storeId` with its own `entryId`; the store id is what lets an email r
|
|
|
71
74
|
default one.
|
|
72
75
|
|
|
73
76
|
**Ids are not portable between platforms.** Windows returns MAPI EntryIDs; macOS returns Outlook for macOS small integer
|
|
74
|
-
message ids, and has no store id (it reports `''` and ignores one passed in).
|
|
75
|
-
`INVALID_REQUEST
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
message ids, and has no store id (it reports `''` and ignores one passed in). macOS refuses a Windows EntryID outright,
|
|
78
|
+
with `INVALID_REQUEST`; on Windows a macOS id simply resolves to nothing and fails as `NOT_FOUND`. A batch reports
|
|
79
|
+
either as that item's failure. **Moving an email rewrites its id** on both, so ids saved before a move are stale
|
|
80
|
+
afterward. Keep the subject, sender and received time beside a saved id, and `locateEmail` finds the email again from
|
|
81
|
+
them wherever it has moved under the Inbox, on either platform.
|
|
78
82
|
|
|
79
83
|
Timestamps are local time as `yyyy-MM-dd HH:mm`, which sorts correctly as a string.
|
|
80
84
|
|
|
@@ -170,6 +174,7 @@ try {
|
|
|
170
174
|
| `ACCOUNT_NOT_FOUND` | `AccountNotFoundError` | No mailbox in the profile matches the address. Carries `account`. |
|
|
171
175
|
| `NOT_FOUND` | `NotFoundError` | A `folder`, `email`, `attachment`, `template`, `signature` or `file` didn't resolve. Carries `kind`. |
|
|
172
176
|
| `INVALID_REQUEST` | `InvalidRequestError` | The arguments can't produce a call — a wrong type, a missing value, a template edited into an unusable state, or a mailbox that can be read but not sent from. |
|
|
177
|
+
| `PERMISSION_DENIED` | `PermissionDeniedError` | macOS refused Outlook's profile, so a mailbox only it lists could not be seen. The message names the app to give Full Disk Access. |
|
|
173
178
|
| `SCRIPT_FAILED` | `ScriptError` | The script ran and failed. Carries `script`, `line`, `stderr`, `runner`, `durationMs`. |
|
|
174
179
|
| `OUTPUT_TOO_LARGE` | `OutputTooLargeError` | The script printed more than `maxBufferBytes`. |
|
|
175
180
|
| `TIMEOUT` | `TimeoutError` | The run exceeded its time budget and was killed. Carries `timeoutMs`. |
|
|
@@ -209,9 +214,11 @@ helpers, the error taxonomy, and the generated scripts themselves:
|
|
|
209
214
|
- **On Windows**, every PowerShell script every operation generates is put through PowerShell's own parser, with
|
|
210
215
|
arguments built to break out of a badly escaped literal. The test fails on a syntax error, and on any caller text
|
|
211
216
|
inside a double-quoted string.
|
|
212
|
-
- **
|
|
213
|
-
|
|
214
|
-
|
|
217
|
+
- **Everywhere**, the AppleScript counterpart: every macOS script is checked for caller text outside its string
|
|
218
|
+
literals and for the two mistakes compiling can't catch — an assignment to a reserved AppleScript word, a record
|
|
219
|
+
field read through a nested accessor — and canned script output is decoded into the result shapes Windows returns.
|
|
220
|
+
- **On a Mac**, the hostile argument is also round-tripped through `osascript`, and with Outlook installed every
|
|
221
|
+
AppleScript is compiled with `osacompile`, which resolves dictionary terms without opening a session.
|
|
215
222
|
|
|
216
223
|
What no test covers is the automation itself: that a move really filed the mail, or a reply threaded correctly, is
|
|
217
224
|
verified against a live mailbox.
|
package/dist/backend.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CleanUndeliverableResult, DeleteDraftsResult, DeleteMailResult, EmailLocator, InboxEmail, InboxFolderInfo, InboxSearchMatch, ListDraftsResult, MailFolderRef, MoveEmailsResult, PurgeDeletedItemsResult, ReplyEmailResult, SavedAttachment, SaveTemplateResult, SelectedEmail, SendDraftsResult, SentRecipientGroup, TemplateFolderResult } from './types';
|
|
1
|
+
import type { CleanUndeliverableResult, DeleteDraftsResult, DeleteMailResult, EmailLocator, InboxEmail, InboxFolderInfo, InboxSearchMatch, ListDraftsResult, MailFolderRef, MoveEmailsResult, PurgeDeletedItemsResult, ReplyEmailResult, SavedAttachment, SaveTemplateResult, SelectedEmail, SendDraftsResult, SendEmailResult, SentRecipientGroup, TemplateFolderResult } from './types';
|
|
2
2
|
/** What to do with a composed email. */
|
|
3
3
|
export type Disposition =
|
|
4
4
|
/** Send it now. */
|
|
@@ -123,7 +123,7 @@ export interface EditTemplateRequest {
|
|
|
123
123
|
/** One platform's Outlook automation. */
|
|
124
124
|
export interface Backend {
|
|
125
125
|
getOutlookAccounts(): Promise<string[]>;
|
|
126
|
-
sendOutlookEmail(request: SendRequest): Promise<
|
|
126
|
+
sendOutlookEmail(request: SendRequest): Promise<SendEmailResult>;
|
|
127
127
|
replyOutlookEmail(request: ReplyRequest): Promise<ReplyEmailResult>;
|
|
128
128
|
readInboxEmails(request: ReadInboxRequest): Promise<InboxEmail[]>;
|
|
129
129
|
searchInboxByFilter(request: SearchRequest): Promise<InboxSearchMatch[]>;
|
package/dist/backend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"","sourcesContent":["// What a platform implements.\n//\n// The public operations (bridge.ts) check every argument, apply every default,\n// and do all the work that is the same on both platforms — composing a reply\n// from a template, splitting a body from its quoted thread, choosing where\n// attachments go. What reaches a backend is a request in its final shape: counts\n// are whole numbers in range, strings are trimmed, folders are parsed, and each\n// field the platform's script needs is present. A backend's job is only to turn\n// that request into Outlook automation and its output into the result.\nimport type {\n CleanUndeliverableResult,\n DeleteDraftsResult,\n DeleteMailResult,\n EmailLocator,\n InboxEmail,\n InboxFolderInfo,\n InboxSearchMatch,\n ListDraftsResult,\n MailFolderRef,\n MoveEmailsResult,\n PurgeDeletedItemsResult,\n ReplyEmailResult,\n SavedAttachment,\n SaveTemplateResult,\n SelectedEmail,\n SendDraftsResult,\n SentRecipientGroup,\n TemplateFolderResult,\n} from './types';\n\n/** What to do with a composed email. */\nexport type Disposition =\n/** Send it now. */\n | 'send'\n /** Open it in a compose window for review. */\n | 'display'\n /** File it into Drafts without a window. */\n | 'save';\n\nexport interface AccountRequest {\n /** The mailbox's SMTP address, trimmed. */\n readonly account: string;\n}\n\nexport interface SendRequest extends AccountRequest {\n /** One entry per recipient, each an address or a display-name form. */\n readonly to: readonly string[];\n readonly cc: readonly string[];\n readonly bcc: readonly string[];\n readonly subject: string;\n readonly htmlBody: string;\n /** Absolute paths, each verified to exist. */\n readonly attachments: readonly string[];\n readonly disposition: Disposition;\n}\n\nexport interface ReplyRequest extends AccountRequest {\n readonly email: EmailLocator;\n /** The HTML to insert above the quoted original, fully composed. */\n readonly html: string;\n readonly replyAll: boolean;\n readonly disposition: Disposition;\n}\n\nexport interface ReadInboxRequest extends AccountRequest {\n readonly folder: MailFolderRef;\n /** The folder as the caller wrote it, for messages. */\n readonly folderLabel: string;\n readonly daysBack: number;\n readonly limit: number;\n /** 0 means no body is read at all. */\n readonly previewChars: number;\n}\n\nexport interface SearchRequest extends AccountRequest {\n readonly daysBack: number;\n readonly subjectLike?: string;\n readonly subjectPattern?: RegExp;\n readonly excludeReplies: boolean;\n readonly requireAttachment: boolean;\n readonly includeFolders: readonly string[];\n readonly excludeFolders: readonly string[];\n readonly includeBody: boolean;\n}\n\n/** One email as a backend reads it, before any splitting or capping. */\nexport interface RawEmail {\n readonly entryId: string;\n readonly subject: string;\n readonly senderName: string;\n readonly senderEmail: string;\n readonly receivedTime: string;\n /** The full plain-text body. */\n readonly body: string;\n readonly attachmentNames: readonly string[];\n}\n\nexport interface ListFoldersRequest extends AccountRequest {\n readonly maxDepth: number;\n}\n\nexport interface MoveRequest extends AccountRequest {\n /** Non-empty, deduplicated. */\n readonly entryIds: readonly string[];\n readonly folder: MailFolderRef;\n readonly folderLabel: string;\n readonly createIfMissing: boolean;\n}\n\nexport interface ListDraftsRequest extends AccountRequest {\n readonly limit: number;\n readonly previewChars: number;\n}\n\nexport interface EntryIdsRequest extends AccountRequest {\n /** Non-empty, deduplicated. */\n readonly entryIds: readonly string[];\n}\n\nexport interface DeleteEmailsRequest extends EntryIdsRequest {\n readonly allowProtected: boolean;\n readonly dryRun: boolean;\n}\n\nexport interface PurgeRequest extends AccountRequest {\n readonly olderThanDays: number;\n readonly dryRun: boolean;\n}\n\nexport interface SaveAttachmentsRequest {\n readonly email: EmailLocator;\n /** Non-empty; matched exactly first, then ignoring case and whitespace. */\n readonly fileNames: readonly string[];\n /** An existing directory to save into. */\n readonly destDir: string;\n}\n\nexport interface CleanUndeliverableRequest extends AccountRequest {\n readonly daysBack: number;\n readonly dryRun: boolean;\n}\n\nexport interface CollectBouncesRequest extends AccountRequest {\n readonly daysBack: number;\n readonly includeDeletedItems: boolean;\n}\n\nexport interface SentGroupsRequest extends AccountRequest {\n readonly daysBack: number;\n readonly limit: number;\n}\n\nexport interface ReadTemplatesRequest extends AccountRequest {\n readonly folder: string;\n readonly limit: number;\n readonly includeBody: boolean;\n /** Only the template with this subject, case-insensitively. */\n readonly subject?: string;\n}\n\nexport interface SaveTemplateRequest extends AccountRequest {\n readonly folder: string;\n readonly subject: string;\n readonly htmlBody: string;\n}\n\nexport interface EditTemplateRequest {\n readonly label: string;\n readonly html: string;\n}\n\n/** One platform's Outlook automation. */\nexport interface Backend {\n getOutlookAccounts(): Promise<string[]>;\n\n sendOutlookEmail(request: SendRequest): Promise<
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"","sourcesContent":["// What a platform implements.\n//\n// The public operations (bridge.ts) check every argument, apply every default,\n// and do all the work that is the same on both platforms — composing a reply\n// from a template, splitting a body from its quoted thread, choosing where\n// attachments go. What reaches a backend is a request in its final shape: counts\n// are whole numbers in range, strings are trimmed, folders are parsed, and each\n// field the platform's script needs is present. A backend's job is only to turn\n// that request into Outlook automation and its output into the result.\nimport type {\n CleanUndeliverableResult,\n DeleteDraftsResult,\n DeleteMailResult,\n EmailLocator,\n InboxEmail,\n InboxFolderInfo,\n InboxSearchMatch,\n ListDraftsResult,\n MailFolderRef,\n MoveEmailsResult,\n PurgeDeletedItemsResult,\n ReplyEmailResult,\n SavedAttachment,\n SaveTemplateResult,\n SelectedEmail,\n SendDraftsResult,\n SendEmailResult,\n SentRecipientGroup,\n TemplateFolderResult,\n} from './types';\n\n/** What to do with a composed email. */\nexport type Disposition =\n/** Send it now. */\n | 'send'\n /** Open it in a compose window for review. */\n | 'display'\n /** File it into Drafts without a window. */\n | 'save';\n\nexport interface AccountRequest {\n /** The mailbox's SMTP address, trimmed. */\n readonly account: string;\n}\n\nexport interface SendRequest extends AccountRequest {\n /** One entry per recipient, each an address or a display-name form. */\n readonly to: readonly string[];\n readonly cc: readonly string[];\n readonly bcc: readonly string[];\n readonly subject: string;\n readonly htmlBody: string;\n /** Absolute paths, each verified to exist. */\n readonly attachments: readonly string[];\n readonly disposition: Disposition;\n}\n\nexport interface ReplyRequest extends AccountRequest {\n readonly email: EmailLocator;\n /** The HTML to insert above the quoted original, fully composed. */\n readonly html: string;\n readonly replyAll: boolean;\n readonly disposition: Disposition;\n}\n\nexport interface ReadInboxRequest extends AccountRequest {\n readonly folder: MailFolderRef;\n /** The folder as the caller wrote it, for messages. */\n readonly folderLabel: string;\n readonly daysBack: number;\n readonly limit: number;\n /** 0 means no body is read at all. */\n readonly previewChars: number;\n}\n\nexport interface SearchRequest extends AccountRequest {\n readonly daysBack: number;\n readonly subjectLike?: string;\n readonly subjectPattern?: RegExp;\n readonly excludeReplies: boolean;\n readonly requireAttachment: boolean;\n readonly includeFolders: readonly string[];\n readonly excludeFolders: readonly string[];\n readonly includeBody: boolean;\n}\n\n/** One email as a backend reads it, before any splitting or capping. */\nexport interface RawEmail {\n readonly entryId: string;\n readonly subject: string;\n readonly senderName: string;\n readonly senderEmail: string;\n readonly receivedTime: string;\n /** The full plain-text body. */\n readonly body: string;\n readonly attachmentNames: readonly string[];\n}\n\nexport interface ListFoldersRequest extends AccountRequest {\n readonly maxDepth: number;\n}\n\nexport interface MoveRequest extends AccountRequest {\n /** Non-empty, deduplicated. */\n readonly entryIds: readonly string[];\n readonly folder: MailFolderRef;\n readonly folderLabel: string;\n readonly createIfMissing: boolean;\n}\n\nexport interface ListDraftsRequest extends AccountRequest {\n readonly limit: number;\n readonly previewChars: number;\n}\n\nexport interface EntryIdsRequest extends AccountRequest {\n /** Non-empty, deduplicated. */\n readonly entryIds: readonly string[];\n}\n\nexport interface DeleteEmailsRequest extends EntryIdsRequest {\n readonly allowProtected: boolean;\n readonly dryRun: boolean;\n}\n\nexport interface PurgeRequest extends AccountRequest {\n readonly olderThanDays: number;\n readonly dryRun: boolean;\n}\n\nexport interface SaveAttachmentsRequest {\n readonly email: EmailLocator;\n /** Non-empty; matched exactly first, then ignoring case and whitespace. */\n readonly fileNames: readonly string[];\n /** An existing directory to save into. */\n readonly destDir: string;\n}\n\nexport interface CleanUndeliverableRequest extends AccountRequest {\n readonly daysBack: number;\n readonly dryRun: boolean;\n}\n\nexport interface CollectBouncesRequest extends AccountRequest {\n readonly daysBack: number;\n readonly includeDeletedItems: boolean;\n}\n\nexport interface SentGroupsRequest extends AccountRequest {\n readonly daysBack: number;\n readonly limit: number;\n}\n\nexport interface ReadTemplatesRequest extends AccountRequest {\n readonly folder: string;\n readonly limit: number;\n readonly includeBody: boolean;\n /** Only the template with this subject, case-insensitively. */\n readonly subject?: string;\n}\n\nexport interface SaveTemplateRequest extends AccountRequest {\n readonly folder: string;\n readonly subject: string;\n readonly htmlBody: string;\n}\n\nexport interface EditTemplateRequest {\n readonly label: string;\n readonly html: string;\n}\n\n/** One platform's Outlook automation. */\nexport interface Backend {\n getOutlookAccounts(): Promise<string[]>;\n\n sendOutlookEmail(request: SendRequest): Promise<SendEmailResult>;\n\n replyOutlookEmail(request: ReplyRequest): Promise<ReplyEmailResult>;\n\n readInboxEmails(request: ReadInboxRequest): Promise<InboxEmail[]>;\n\n searchInboxByFilter(request: SearchRequest): Promise<InboxSearchMatch[]>;\n\n readSelectedEmail(): Promise<SelectedEmail>;\n\n readEmailBody(email: EmailLocator): Promise<RawEmail>;\n\n openOutlookEmail(email: EmailLocator): Promise<void>;\n\n listInboxFolders(request: ListFoldersRequest): Promise<InboxFolderInfo[]>;\n\n moveOutlookEmails(request: MoveRequest): Promise<MoveEmailsResult>;\n\n listOutlookDrafts(request: ListDraftsRequest): Promise<ListDraftsResult>;\n\n sendDrafts(request: EntryIdsRequest): Promise<SendDraftsResult>;\n\n sendAllDrafts(request: AccountRequest): Promise<SendDraftsResult>;\n\n deleteOutlookDrafts(request: EntryIdsRequest): Promise<DeleteDraftsResult>;\n\n deleteOutlookEmails(request: DeleteEmailsRequest): Promise<DeleteMailResult>;\n\n purgeDeletedItems(request: PurgeRequest): Promise<PurgeDeletedItemsResult>;\n\n saveEmailAttachments(request: SaveAttachmentsRequest): Promise<SavedAttachment[]>;\n\n cleanUndeliverableEmails(request: CleanUndeliverableRequest): Promise<CleanUndeliverableResult>;\n\n collectBouncedRecipients(request: CollectBouncesRequest): Promise<string[]>;\n\n readSentRecipientGroups(request: SentGroupsRequest): Promise<SentRecipientGroup[]>;\n\n listOutlookSignatures(): Promise<string[]>;\n\n /** '' when there is no signature by that name. */\n readOutlookSignatureHtml(name: string): Promise<string>;\n\n readTemplateEmails(request: ReadTemplatesRequest): Promise<TemplateFolderResult>;\n\n saveTemplateEmail(request: SaveTemplateRequest): Promise<SaveTemplateResult>;\n\n editEmailTemplate(request: EditTemplateRequest): Promise<string>;\n}\n"]}
|
package/dist/bridge.js
CHANGED
|
@@ -163,7 +163,7 @@ function createOperations(backendOrNull) {
|
|
|
163
163
|
if (signatureName) {
|
|
164
164
|
request.htmlBody = (0, replyBody_1.placeSignature)(request.htmlBody, await (0, replyBody_1.resolveSignatureHtml)(platform, signatureName));
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
return platform.sendOutlookEmail(request);
|
|
167
167
|
},
|
|
168
168
|
async replyOutlookEmail(params) {
|
|
169
169
|
const platform = backend();
|
|
@@ -320,7 +320,7 @@ function createOperations(backendOrNull) {
|
|
|
320
320
|
entryIds: ids,
|
|
321
321
|
folder: ref,
|
|
322
322
|
folderLabel: label,
|
|
323
|
-
createIfMissing
|
|
323
|
+
createIfMissing,
|
|
324
324
|
});
|
|
325
325
|
},
|
|
326
326
|
async listOutlookDrafts(emailAccount, options) {
|
|
@@ -360,7 +360,7 @@ function createOperations(backendOrNull) {
|
|
|
360
360
|
const allowProtected = (0, args_1.flag)(o.allowProtected, 'allowProtected', false);
|
|
361
361
|
const dryRun = (0, args_1.flag)(o.dryRun, 'dryRun', false);
|
|
362
362
|
if (ids.length === 0)
|
|
363
|
-
return
|
|
363
|
+
return (0, mail_1.deleteMailResult)(dryRun, []);
|
|
364
364
|
return platform.deleteOutlookEmails({ account, entryIds: ids, allowProtected, dryRun });
|
|
365
365
|
},
|
|
366
366
|
async purgeDeletedItems(emailAccount, options) {
|
package/dist/bridge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":";;;;;;AA2IA,4CAuWC;AA0CD,oCAaC;AAYD,kDAEC;AAKD,oCAEC;AAGD,4BAEC;AAnkBD,8DAA8D;AAC9D,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,6EAA6E;AAC7E,4CAAoB;AACpB,gDAAwB;AACxB,uCAA2C;AAC3C,+BAAmC;AAEnC,wCAgBuB;AACvB,kDAA4F;AAC5F,4CAAkH;AAClH,wDAA0D;AAC1D,iCAA2D;AAC3D,qCAAsG;AACtG,uCAOmB;AAGnB,kCAAkC;AAClC,MAAM,QAAQ,GAAG;IACb,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,GAAG;IACjB,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,IAAI;IACpB,WAAW,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AM,EAAC,CAAC;QACnC,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG;QACvB,QAAQ,EAAE,CAAC,SAA2B,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,IAAI;QAClE,WAAW,EAAE,CAAC,OAAsB,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,IAAA,sBAAY,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChG,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,kBAAU,EAAE,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,IAAA,oBAAU,EAAC,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,QAA4C,CAAC;AACxD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,mBAAmB,CAAC,UAAyB,EAAE;IAC3D,OAAO,YAAY,CAAC,gBAAgB,EAAE,IAAA,sBAAY,EAAC,IAAA,yBAAe,GAAE,EAAE,OAAO,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,qBAAqB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAE9D,+FAA+F;AAC/F,SAAgB,YAAY;IACxB,OAAO,qBAAqB,CAAC;AACjC,CAAC;AAED,mDAAmD;AACnD,SAAgB,QAAQ,CAAC,SAA2B;IAChD,OAAO,qBAAqB,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,oGAAoG;AACvF,QAAA,aAAa,GAAkB,gBAAgB,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["// The public operations, implemented once for both platforms.\n//\n// Each operation checks its arguments, applies its defaults, does whatever work\n// is the same everywhere — composing a reply from a template, splitting a body\n// from its quoted thread, choosing where attachments go — and hands a finished\n// request to this machine's backend. Keeping that here means a default, a\n// range or a validation rule can't come to differ between Windows and macOS.\nimport fs from 'fs';\nimport path from 'path';\nimport { windowsBackend } from './windows';\nimport { macBackend } from './mac';\nimport type { Backend, Disposition } from './backend';\nimport {\n count,\n emailLocator,\n entryIdList,\n flag,\n nameList,\n optionalContent,\n optionalRegExp,\n optionalText,\n optionsObject,\n recipientList,\n requiredContent,\n requiredText,\n requireObject,\n stringRecord,\n textList,\n} from './shared/args';\nimport { composeReplyHtml, placeSignature, resolveSignatureHtml } from './shared/replyBody';\nimport { accountSearchOrder, bestMatch, daysBackFor, requireDescribed, subjectPrefilter, } from './shared/locate';\nimport { buildBounceReport } from './shared/bounceReport';\nimport { folderOption, splitQuotedOriginal } from './mail';\nimport { AbortedError, InvalidRequestError, NotFoundError, UnsupportedPlatformError } from './errors';\nimport {\n attachmentDestination,\n type BridgeOptions,\n getGlobalConfig,\n mergeOptions,\n type ResolvedConfig,\n withConfig,\n} from './runtime';\nimport type { BridgeCapability, CapabilityMap, OutlookBridge, SavedAttachment } from './types';\n\n/** Every default, stated once. */\nconst DEFAULTS = {\n daysBack: 60,\n inboxLimit: 50,\n previewChars: 600,\n bodyMaxChars: 8000,\n quotedMaxChars: 4000,\n folderDepth: 2,\n draftsLimit: 100,\n draftsPreviewChars: 300,\n bounceDaysBack: 30,\n sentGroupsLimit: 3000,\n templateFolder: 'Templates',\n templatesLimit: 20,\n} as const;\n\n/** The widest window any scan accepts, in days. */\nconst MAX_DAYS = 3650;\n\n/**\n * Every operation name. `satisfies` makes this list fail to compile the moment\n * it and the OutlookBridge interface disagree, in either direction.\n */\nconst OPERATION_NAMES = {\n getOutlookAccounts: true,\n sendOutlookEmail: true,\n replyOutlookEmail: true,\n readInboxEmails: true,\n searchInboxByFilter: true,\n readSelectedEmail: true,\n readEmailBody: true,\n openOutlookEmail: true,\n locateEmail: true,\n listInboxFolders: true,\n moveOutlookEmails: true,\n listOutlookDrafts: true,\n sendDrafts: true,\n sendAllDrafts: true,\n deleteOutlookDrafts: true,\n deleteOutlookEmails: true,\n purgeDeletedItems: true,\n saveEmailAttachment: true,\n saveEmailAttachments: true,\n cleanUndeliverableEmails: true,\n collectBouncedRecipients: true,\n readSentRecipientGroups: true,\n readBounceReport: true,\n listOutlookSignatures: true,\n readOutlookSignatureHtml: true,\n readTemplateEmails: true,\n saveTemplateEmail: true,\n editEmailTemplate: true,\n} satisfies Record<BridgeCapability, true>;\n\nexport const OPERATIONS = Object.freeze(Object.keys(OPERATION_NAMES) as BridgeCapability[]);\n\n/** This machine's backend, or null where Outlook can't be automated. */\nfunction platformBackend(): Backend | null {\n switch (process.platform) {\n case 'win32':\n return windowsBackend;\n case 'darwin':\n return macBackend;\n default:\n return null;\n }\n}\n\nconst PLATFORM_BACKEND = platformBackend();\n\nfunction dispositionOf(sendImmediately: unknown, openDraftWindow: unknown): Disposition {\n if (flag(sendImmediately, 'sendImmediately', false)) return 'send';\n return flag(openDraftWindow, 'openDraftWindow', true) ? 'display' : 'save';\n}\n\n/** Attachment paths as absolute paths to files that exist — Outlook resolves a relative path against its own directory, not the caller's. */\nfunction attachmentFiles(value: unknown): string[] {\n return textList(value, 'attachments').map(file => {\n const absolute = path.resolve(file);\n let isFile = false;\n try {\n isFile = fs.statSync(absolute).isFile();\n } catch {\n // Reported below.\n }\n if (!isFile) throw new NotFoundError('file', `Attachment file '${absolute}' does not exist.`);\n return absolute;\n });\n}\n\n/**\n * The operations over one backend. A null backend is a platform without Outlook\n * automation: every operation rejects with UNSUPPORTED_PLATFORM before looking\n * at its arguments, since nothing about them could make it work.\n */\nexport function createOperations(backendOrNull: Backend | null): OutlookBridge {\n const backend = (): Backend => {\n if (!backendOrNull) throw new UnsupportedPlatformError(process.platform);\n return backendOrNull;\n };\n\n async function saveEmailAttachments(\n email: Parameters<OutlookBridge['saveEmailAttachments']>[0],\n fileNames: readonly string[],\n options?: Parameters<OutlookBridge['saveEmailAttachments']>[2],\n ): Promise<SavedAttachment[]> {\n const platform = backend();\n const target = emailLocator(email);\n const names = nameList(fileNames, 'fileNames');\n const destDir = optionalText(optionsObject(options).destDir, 'destDir');\n if (names.length === 0) return [];\n const destination = attachmentDestination(destDir === undefined ? undefined : path.resolve(destDir));\n try {\n return await platform.saveEmailAttachments({email: target, fileNames: names, destDir: destination.dir});\n } catch (error) {\n destination.discardIfUnused();\n throw error;\n }\n }\n\n return {\n async getOutlookAccounts() {\n return backend().getOutlookAccounts();\n },\n\n async sendOutlookEmail(params) {\n const platform = backend();\n const p = requireObject(params, 'params');\n const signatureName = optionalText(p.signatureName, 'signatureName');\n const request = {\n account: requiredText(p.emailAccount, 'emailAccount'),\n to: recipientList(p.to, 'to'),\n cc: recipientList(p.cc, 'cc'),\n bcc: recipientList(p.bcc, 'bcc'),\n subject: requiredContent(p.subject, 'subject'),\n htmlBody: requiredContent(p.htmlBody, 'htmlBody'),\n attachments: attachmentFiles(p.attachments),\n disposition: dispositionOf(p.sendImmediately, p.openDraftWindow),\n };\n if (request.disposition === 'send' && request.to.length + request.cc.length + request.bcc.length === 0) {\n throw new InvalidRequestError('An email sent immediately needs at least one recipient.');\n }\n if (signatureName) {\n request.htmlBody = placeSignature(request.htmlBody, await resolveSignatureHtml(platform, signatureName));\n }\n await platform.sendOutlookEmail(request);\n },\n\n async replyOutlookEmail(params) {\n const platform = backend();\n const p = requireObject(params, 'params');\n const account = requiredText(p.emailAccount, 'emailAccount');\n const email = emailLocator({entryId: p.entryId as string, storeId: p.storeId}, 'params');\n const html = await composeReplyHtml({\n account,\n htmlBody: optionalContent(p.htmlBody, 'htmlBody'),\n templateSubject: optionalText(p.templateSubject, 'templateSubject'),\n templateFolder: optionalText(p.templateFolder, 'templateFolder') ?? DEFAULTS.templateFolder,\n templateSection: optionalText(p.templateSection, 'templateSection'),\n templatePlaceholders: stringRecord(p.templatePlaceholders, 'templatePlaceholders'),\n signatureName: optionalText(p.signatureName, 'signatureName'),\n }, platform);\n return platform.replyOutlookEmail({\n account,\n email,\n html,\n replyAll: flag(p.replyAll, 'replyAll', false),\n disposition: dispositionOf(p.sendImmediately, p.openDraftWindow),\n });\n },\n\n async readInboxEmails(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n const {ref, label} = folderOption(optionalText(o.folder, 'folder'));\n return platform.readInboxEmails({\n account: requiredText(emailAccount, 'emailAccount'),\n folder: ref,\n folderLabel: label,\n daysBack: count(o.daysBack, 'daysBack', DEFAULTS.daysBack, 1, MAX_DAYS),\n limit: count(o.limit, 'limit', DEFAULTS.inboxLimit, 1, 100_000),\n previewChars: count(o.previewChars, 'previewChars', DEFAULTS.previewChars, 0, 1_000_000),\n });\n },\n\n async searchInboxByFilter(emailAccount, filter) {\n const platform = backend();\n const f = optionsObject(filter, 'filter');\n return platform.searchInboxByFilter({\n account: requiredText(emailAccount, 'emailAccount'),\n daysBack: count(f.daysBack, 'daysBack', DEFAULTS.daysBack, 1, MAX_DAYS),\n subjectLike: optionalText(f.subjectLike, 'subjectLike'),\n subjectPattern: optionalRegExp(f.subjectPattern, 'subjectPattern'),\n excludeReplies: flag(f.excludeReplies, 'excludeReplies', false),\n requireAttachment: flag(f.requireAttachment, 'requireAttachment', false),\n includeFolders: textList(f.includeFolders, 'includeFolders'),\n excludeFolders: textList(f.excludeFolders, 'excludeFolders'),\n includeBody: flag(f.includeBody, 'includeBody', true),\n });\n },\n\n async readSelectedEmail() {\n return backend().readSelectedEmail();\n },\n\n async readEmailBody(email, options) {\n const platform = backend();\n const target = emailLocator(email);\n const o = optionsObject(options);\n const maxChars = count(o.maxChars, 'maxChars', DEFAULTS.bodyMaxChars, 1, 100_000_000);\n const maxQuotedChars = count(o.maxQuotedChars, 'maxQuotedChars', DEFAULTS.quotedMaxChars, 0, 100_000_000);\n const includeQuoted = flag(o.includeQuoted, 'includeQuoted', false);\n const raw = await platform.readEmailBody(target);\n // The quoted thread is context, never the sender's own answer, so it is\n // capped by the tighter of the two limits.\n const {body, quoted, separator} = splitQuotedOriginal(raw.body);\n return {\n entryId: raw.entryId,\n subject: raw.subject,\n senderName: raw.senderName,\n senderEmail: raw.senderEmail,\n receivedTime: raw.receivedTime,\n body: body.slice(0, maxChars),\n truncated: body.length > maxChars,\n bodyLength: body.length,\n quoteSeparator: separator,\n quotedLength: quoted.length,\n quotedOriginal: includeQuoted ? quoted.slice(0, Math.min(maxChars, maxQuotedChars)) : '',\n attachmentNames: [...raw.attachmentNames],\n attachmentCount: raw.attachmentNames.length,\n };\n },\n\n async openOutlookEmail(email) {\n const platform = backend();\n await platform.openOutlookEmail(emailLocator(email));\n },\n\n async locateEmail(description, options) {\n const platform = backend();\n const d = requireObject(description, 'description');\n const wanted = {\n subject: optionalText(d.subject, 'subject'),\n sender: optionalText(d.sender, 'sender'),\n receivedTime: optionalText(d.receivedTime, 'receivedTime'),\n };\n requireDescribed(wanted);\n const emailAccount = optionalText(d.emailAccount, 'emailAccount');\n const folderPath = optionalText(d.folderPath, 'folderPath');\n const fallbackDays = count(optionsObject(options).daysBack, 'daysBack', DEFAULTS.daysBack, 1, MAX_DAYS);\n const search = {\n daysBack: Math.min(MAX_DAYS, daysBackFor(wanted.receivedTime, fallbackDays)),\n subjectLike: subjectPrefilter(wanted.subject),\n excludeReplies: false,\n requireAttachment: false,\n includeFolders: [],\n excludeFolders: [],\n // Judging a match reads subjects, senders and times, so the bodies\n // (the heavy part of a scan) are left behind.\n includeBody: false,\n };\n const accounts = emailAccount\n ? [emailAccount]\n : accountSearchOrder(await platform.getOutlookAccounts(), folderPath);\n\n let searched = 0;\n let firstFailure: unknown;\n for (const account of accounts) {\n let matches;\n try {\n matches = await platform.searchInboxByFilter({account, ...search});\n } catch (error) {\n if (error instanceof AbortedError) throw error;\n // One mailbox that can't be read shouldn't decide the answer\n // for the rest; only every one failing is an error.\n firstFailure ??= error;\n continue;\n }\n searched++;\n const found = bestMatch(wanted, matches);\n if (found) return found;\n }\n if (searched === 0 && firstFailure !== undefined) throw firstFailure;\n return null;\n },\n\n async listInboxFolders(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.listInboxFolders({\n account: requiredText(emailAccount, 'emailAccount'),\n maxDepth: count(o.maxDepth, 'maxDepth', DEFAULTS.folderDepth, 1, 10),\n });\n },\n\n async moveOutlookEmails(emailAccount, entryIds, folder, options) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const ids = entryIdList(entryIds);\n const {ref, label} = folderOption(requiredText(folder, 'folder'));\n const createIfMissing = flag(optionsObject(options).createIfMissing, 'createIfMissing', false);\n if (ids.length === 0) return {folderPath: '', folderCreated: false, moved: 0, failed: []};\n return platform.moveOutlookEmails({\n account,\n entryIds: ids,\n folder: ref,\n folderLabel: label,\n createIfMissing\n });\n },\n\n async listOutlookDrafts(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.listOutlookDrafts({\n account: requiredText(emailAccount, 'emailAccount'),\n limit: count(o.limit, 'limit', DEFAULTS.draftsLimit, 1, 100_000),\n previewChars: count(o.previewChars, 'previewChars', DEFAULTS.draftsPreviewChars, 0, 1_000_000),\n });\n },\n\n async sendDrafts(emailAccount, entryIds) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const ids = entryIdList(entryIds);\n if (ids.length === 0) return {sent: 0, failed: []};\n return platform.sendDrafts({account, entryIds: ids});\n },\n\n async sendAllDrafts(emailAccount) {\n const platform = backend();\n return platform.sendAllDrafts({account: requiredText(emailAccount, 'emailAccount')});\n },\n\n async deleteOutlookDrafts(emailAccount, entryIds) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const ids = entryIdList(entryIds);\n if (ids.length === 0) return {deleted: 0, failed: []};\n return platform.deleteOutlookDrafts({account, entryIds: ids});\n },\n\n async deleteOutlookEmails(emailAccount, entryIds, options) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const ids = entryIdList(entryIds);\n const o = optionsObject(options);\n const allowProtected = flag(o.allowProtected, 'allowProtected', false);\n const dryRun = flag(o.dryRun, 'dryRun', false);\n if (ids.length === 0) return {dryRun, deleted: 0, refused: 0, failed: 0, items: []};\n return platform.deleteOutlookEmails({account, entryIds: ids, allowProtected, dryRun});\n },\n\n async purgeDeletedItems(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.purgeDeletedItems({\n account: requiredText(emailAccount, 'emailAccount'),\n olderThanDays: count(o.olderThanDays, 'olderThanDays', 0, 0, 36_500),\n dryRun: flag(o.dryRun, 'dryRun', false),\n });\n },\n\n async saveEmailAttachment(email, fileName, options) {\n const [saved] = await saveEmailAttachments(email, [fileName], options);\n if (!saved) throw new NotFoundError('attachment', `Attachment '${fileName}' was not saved.`);\n return saved;\n },\n\n saveEmailAttachments,\n\n async cleanUndeliverableEmails(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.cleanUndeliverableEmails({\n account: requiredText(emailAccount, 'emailAccount'),\n daysBack: count(o.daysBack, 'daysBack', DEFAULTS.bounceDaysBack, 1, MAX_DAYS),\n // Deleting has to be asked for.\n dryRun: flag(o.dryRun, 'dryRun', true),\n });\n },\n\n async collectBouncedRecipients(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.collectBouncedRecipients({\n account: requiredText(emailAccount, 'emailAccount'),\n daysBack: count(o.daysBack, 'daysBack', DEFAULTS.bounceDaysBack, 1, MAX_DAYS),\n includeDeletedItems: flag(o.includeDeletedItems, 'includeDeletedItems', true),\n });\n },\n\n async readSentRecipientGroups(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.readSentRecipientGroups({\n account: requiredText(emailAccount, 'emailAccount'),\n daysBack: count(o.daysBack, 'daysBack', DEFAULTS.bounceDaysBack, 1, MAX_DAYS),\n limit: count(o.limit, 'limit', DEFAULTS.sentGroupsLimit, 1, 100_000),\n });\n },\n\n async readBounceReport(emailAccount, options) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const o = optionsObject(options);\n const daysBack = count(o.daysBack, 'daysBack', DEFAULTS.bounceDaysBack, 1, MAX_DAYS);\n const includeDeletedItems = flag(o.includeDeletedItems, 'includeDeletedItems', true);\n const bounced = await platform.collectBouncedRecipients({account, daysBack, includeDeletedItems});\n const sent = await platform.readSentRecipientGroups({account, daysBack, limit: DEFAULTS.sentGroupsLimit});\n return buildBounceReport(account, daysBack, bounced, sent);\n },\n\n async listOutlookSignatures() {\n return backend().listOutlookSignatures();\n },\n\n async readOutlookSignatureHtml(name) {\n const platform = backend();\n return platform.readOutlookSignatureHtml(requiredText(name, 'name'));\n },\n\n async readTemplateEmails(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.readTemplateEmails({\n account: requiredText(emailAccount, 'emailAccount'),\n folder: optionalText(o.folder, 'folder') ?? DEFAULTS.templateFolder,\n limit: count(o.limit, 'limit', DEFAULTS.templatesLimit, 1, 200),\n includeBody: flag(o.includeBody, 'includeBody', true),\n subject: optionalText(o.subject, 'subject'),\n });\n },\n\n async saveTemplateEmail(emailAccount, template) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const t = requireObject(template, 'template');\n return platform.saveTemplateEmail({\n account,\n folder: optionalText(t.folder, 'folder') ?? DEFAULTS.templateFolder,\n subject: requiredText(t.subject, 'subject'),\n htmlBody: requiredContent(t.htmlBody, 'htmlBody'),\n });\n },\n\n async editEmailTemplate(label, currentHtml) {\n const platform = backend();\n return platform.editEmailTemplate({\n label: requiredText(label, 'label'),\n html: requiredContent(currentHtml, 'currentHtml'),\n });\n },\n };\n}\n\n// ── Instances and capabilities ───────────────────────────────────────────\n\n/**\n * A bridge carrying its own settings, plus capability discovery.\n *\n * The exported functions are the same operations under the process-wide\n * settings; an instance is what to use when the process holds more than one\n * caller, or when a call needs its own timeout or AbortSignal.\n */\nexport interface OutlookBridgeInstance extends OutlookBridge {\n /** The settings this bridge runs with. */\n readonly options: ResolvedConfig;\n\n /** Which operations work on this machine. */\n capabilities(): CapabilityMap;\n\n /** Whether one operation works on this machine. */\n supports(operation: BridgeCapability): boolean;\n\n /**\n * A bridge like this one with some settings changed — how one call gets its\n * own budget or cancellation: `bridge.withOptions({ signal }).readInboxEmails(...)`.\n */\n withOptions(options: BridgeOptions): OutlookBridgeInstance;\n}\n\nfunction capabilityMap(backend: Backend | null): CapabilityMap {\n return Object.freeze(Object.fromEntries(OPERATIONS.map(name => [name, backend !== null]))) as CapabilityMap;\n}\n\ntype AnyOperation = (...args: unknown[]) => Promise<unknown>;\n\n/**\n * A bridge over `backend` whose every call runs with `config` in force.\n *\n * The platform code reads settings through `getConfig()`, so the config is put\n * in place around each call rather than passed into it: `withConfig` scopes it\n * to the call's whole async subtree, which is why two bridges with different\n * settings can run concurrently without seeing each other's.\n */\nexport function createBridge(backend: Backend | null, config: ResolvedConfig): OutlookBridgeInstance {\n const operations = createOperations(backend) as unknown as Record<BridgeCapability, AnyOperation>;\n const map = capabilityMap(backend);\n const instance: Record<string, unknown> = {\n options: Object.freeze({...config}),\n capabilities: () => map,\n supports: (operation: BridgeCapability) => map[operation] === true,\n withOptions: (options: BridgeOptions) => createBridge(backend, mergeOptions(config, options)),\n };\n for (const name of OPERATIONS) {\n instance[name] = (...args: unknown[]) => withConfig(config, () => operations[name](...args));\n }\n return instance as unknown as OutlookBridgeInstance;\n}\n\n/**\n * A bridge with its own settings, isolated from `configure()` and from every\n * other bridge. Options left out take the process-wide values as they stand\n * when this is called.\n *\n * ```ts\n * const outlook = createOutlookBridge({ timeoutMs: 30_000 });\n * const recent = await outlook.readInboxEmails('me@example.com', { daysBack: 7 });\n * ```\n */\nexport function createOutlookBridge(options: BridgeOptions = {}): OutlookBridgeInstance {\n return createBridge(PLATFORM_BACKEND, mergeOptions(getGlobalConfig(), options));\n}\n\nconst PLATFORM_CAPABILITIES = capabilityMap(PLATFORM_BACKEND);\n\n/** Which operations work on this machine: all of them on Windows and macOS, none elsewhere. */\nexport function capabilities(): CapabilityMap {\n return PLATFORM_CAPABILITIES;\n}\n\n/** Whether one operation works on this machine. */\nexport function supports(operation: BridgeCapability): boolean {\n return PLATFORM_CAPABILITIES[operation] === true;\n}\n\n/** The operations under the process-wide settings — what the package exports as plain functions. */\nexport const defaultBridge: OutlookBridge = createOperations(PLATFORM_BACKEND);\n"]}
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":";;;;;;AA2IA,4CAuWC;AA0CD,oCAaC;AAYD,kDAEC;AAKD,oCAEC;AAGD,4BAEC;AAnkBD,8DAA8D;AAC9D,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,6EAA6E;AAC7E,4CAAoB;AACpB,gDAAwB;AACxB,uCAA2C;AAC3C,+BAAmC;AAEnC,wCAgBuB;AACvB,kDAA4F;AAC5F,4CAAiH;AACjH,wDAA0D;AAC1D,iCAA6E;AAC7E,qCAAsG;AACtG,uCAOmB;AAGnB,kCAAkC;AAClC,MAAM,QAAQ,GAAG;IACb,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,GAAG;IACjB,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,GAAG;IAChB,kBAAkB,EAAE,GAAG;IACvB,cAAc,EAAE,EAAE;IAClB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,WAAW;IAC3B,cAAc,EAAE,EAAE;CACZ,CAAC;AAEX,mDAAmD;AACnD,MAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB;;;GAGG;AACH,MAAM,eAAe,GAAG;IACpB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,IAAI;IACzB,iBAAiB,EAAE,IAAI;IACvB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,IAAI;IACtB,WAAW,EAAE,IAAI;IACjB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,iBAAi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3D,OAAO,YAAY,CAAC,gBAAgB,EAAE,IAAA,sBAAY,EAAC,IAAA,yBAAe,GAAE,EAAE,OAAO,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,qBAAqB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAE9D,+FAA+F;AAC/F,SAAgB,YAAY;IACxB,OAAO,qBAAqB,CAAC;AACjC,CAAC;AAED,mDAAmD;AACnD,SAAgB,QAAQ,CAAC,SAA2B;IAChD,OAAO,qBAAqB,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,oGAAoG;AACvF,QAAA,aAAa,GAAkB,gBAAgB,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["// The public operations, implemented once for both platforms.\n//\n// Each operation checks its arguments, applies its defaults, does whatever work\n// is the same everywhere — composing a reply from a template, splitting a body\n// from its quoted thread, choosing where attachments go — and hands a finished\n// request to this machine's backend. Keeping that here means a default, a\n// range or a validation rule can't come to differ between Windows and macOS.\nimport fs from 'fs';\nimport path from 'path';\nimport { windowsBackend } from './windows';\nimport { macBackend } from './mac';\nimport type { Backend, Disposition } from './backend';\nimport {\n count,\n emailLocator,\n entryIdList,\n flag,\n nameList,\n optionalContent,\n optionalRegExp,\n optionalText,\n optionsObject,\n recipientList,\n requiredContent,\n requiredText,\n requireObject,\n stringRecord,\n textList,\n} from './shared/args';\nimport { composeReplyHtml, placeSignature, resolveSignatureHtml } from './shared/replyBody';\nimport { accountSearchOrder, bestMatch, daysBackFor, requireDescribed, subjectPrefilter } from './shared/locate';\nimport { buildBounceReport } from './shared/bounceReport';\nimport { deleteMailResult, folderOption, splitQuotedOriginal } from './mail';\nimport { AbortedError, InvalidRequestError, NotFoundError, UnsupportedPlatformError } from './errors';\nimport {\n attachmentDestination,\n type BridgeOptions,\n getGlobalConfig,\n mergeOptions,\n type ResolvedConfig,\n withConfig,\n} from './runtime';\nimport type { BridgeCapability, CapabilityMap, OutlookBridge, SavedAttachment } from './types';\n\n/** Every default, stated once. */\nconst DEFAULTS = {\n daysBack: 60,\n inboxLimit: 50,\n previewChars: 600,\n bodyMaxChars: 8000,\n quotedMaxChars: 4000,\n folderDepth: 2,\n draftsLimit: 100,\n draftsPreviewChars: 300,\n bounceDaysBack: 30,\n sentGroupsLimit: 3000,\n templateFolder: 'Templates',\n templatesLimit: 20,\n} as const;\n\n/** The widest window any scan accepts, in days. */\nconst MAX_DAYS = 3650;\n\n/**\n * Every operation name. `satisfies` makes this list fail to compile the moment\n * it and the OutlookBridge interface disagree, in either direction.\n */\nconst OPERATION_NAMES = {\n getOutlookAccounts: true,\n sendOutlookEmail: true,\n replyOutlookEmail: true,\n readInboxEmails: true,\n searchInboxByFilter: true,\n readSelectedEmail: true,\n readEmailBody: true,\n openOutlookEmail: true,\n locateEmail: true,\n listInboxFolders: true,\n moveOutlookEmails: true,\n listOutlookDrafts: true,\n sendDrafts: true,\n sendAllDrafts: true,\n deleteOutlookDrafts: true,\n deleteOutlookEmails: true,\n purgeDeletedItems: true,\n saveEmailAttachment: true,\n saveEmailAttachments: true,\n cleanUndeliverableEmails: true,\n collectBouncedRecipients: true,\n readSentRecipientGroups: true,\n readBounceReport: true,\n listOutlookSignatures: true,\n readOutlookSignatureHtml: true,\n readTemplateEmails: true,\n saveTemplateEmail: true,\n editEmailTemplate: true,\n} satisfies Record<BridgeCapability, true>;\n\nexport const OPERATIONS = Object.freeze(Object.keys(OPERATION_NAMES) as BridgeCapability[]);\n\n/** This machine's backend, or null where Outlook can't be automated. */\nfunction platformBackend(): Backend | null {\n switch (process.platform) {\n case 'win32':\n return windowsBackend;\n case 'darwin':\n return macBackend;\n default:\n return null;\n }\n}\n\nconst PLATFORM_BACKEND = platformBackend();\n\nfunction dispositionOf(sendImmediately: unknown, openDraftWindow: unknown): Disposition {\n if (flag(sendImmediately, 'sendImmediately', false)) return 'send';\n return flag(openDraftWindow, 'openDraftWindow', true) ? 'display' : 'save';\n}\n\n/** Attachment paths as absolute paths to files that exist — Outlook resolves a relative path against its own directory, not the caller's. */\nfunction attachmentFiles(value: unknown): string[] {\n return textList(value, 'attachments').map(file => {\n const absolute = path.resolve(file);\n let isFile = false;\n try {\n isFile = fs.statSync(absolute).isFile();\n } catch {\n // Reported below.\n }\n if (!isFile) throw new NotFoundError('file', `Attachment file '${absolute}' does not exist.`);\n return absolute;\n });\n}\n\n/**\n * The operations over one backend. A null backend is a platform without Outlook\n * automation: every operation rejects with UNSUPPORTED_PLATFORM before looking\n * at its arguments, since nothing about them could make it work.\n */\nexport function createOperations(backendOrNull: Backend | null): OutlookBridge {\n const backend = (): Backend => {\n if (!backendOrNull) throw new UnsupportedPlatformError(process.platform);\n return backendOrNull;\n };\n\n async function saveEmailAttachments(\n email: Parameters<OutlookBridge['saveEmailAttachments']>[0],\n fileNames: readonly string[],\n options?: Parameters<OutlookBridge['saveEmailAttachments']>[2],\n ): Promise<SavedAttachment[]> {\n const platform = backend();\n const target = emailLocator(email);\n const names = nameList(fileNames, 'fileNames');\n const destDir = optionalText(optionsObject(options).destDir, 'destDir');\n if (names.length === 0) return [];\n const destination = attachmentDestination(destDir === undefined ? undefined : path.resolve(destDir));\n try {\n return await platform.saveEmailAttachments({ email: target, fileNames: names, destDir: destination.dir });\n } catch (error) {\n destination.discardIfUnused();\n throw error;\n }\n }\n\n return {\n async getOutlookAccounts() {\n return backend().getOutlookAccounts();\n },\n\n async sendOutlookEmail(params) {\n const platform = backend();\n const p = requireObject(params, 'params');\n const signatureName = optionalText(p.signatureName, 'signatureName');\n const request = {\n account: requiredText(p.emailAccount, 'emailAccount'),\n to: recipientList(p.to, 'to'),\n cc: recipientList(p.cc, 'cc'),\n bcc: recipientList(p.bcc, 'bcc'),\n subject: requiredContent(p.subject, 'subject'),\n htmlBody: requiredContent(p.htmlBody, 'htmlBody'),\n attachments: attachmentFiles(p.attachments),\n disposition: dispositionOf(p.sendImmediately, p.openDraftWindow),\n };\n if (request.disposition === 'send' && request.to.length + request.cc.length + request.bcc.length === 0) {\n throw new InvalidRequestError('An email sent immediately needs at least one recipient.');\n }\n if (signatureName) {\n request.htmlBody = placeSignature(request.htmlBody, await resolveSignatureHtml(platform, signatureName));\n }\n return platform.sendOutlookEmail(request);\n },\n\n async replyOutlookEmail(params) {\n const platform = backend();\n const p = requireObject(params, 'params');\n const account = requiredText(p.emailAccount, 'emailAccount');\n const email = emailLocator({ entryId: p.entryId as string, storeId: p.storeId }, 'params');\n const html = await composeReplyHtml({\n account,\n htmlBody: optionalContent(p.htmlBody, 'htmlBody'),\n templateSubject: optionalText(p.templateSubject, 'templateSubject'),\n templateFolder: optionalText(p.templateFolder, 'templateFolder') ?? DEFAULTS.templateFolder,\n templateSection: optionalText(p.templateSection, 'templateSection'),\n templatePlaceholders: stringRecord(p.templatePlaceholders, 'templatePlaceholders'),\n signatureName: optionalText(p.signatureName, 'signatureName'),\n }, platform);\n return platform.replyOutlookEmail({\n account,\n email,\n html,\n replyAll: flag(p.replyAll, 'replyAll', false),\n disposition: dispositionOf(p.sendImmediately, p.openDraftWindow),\n });\n },\n\n async readInboxEmails(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n const { ref, label } = folderOption(optionalText(o.folder, 'folder'));\n return platform.readInboxEmails({\n account: requiredText(emailAccount, 'emailAccount'),\n folder: ref,\n folderLabel: label,\n daysBack: count(o.daysBack, 'daysBack', DEFAULTS.daysBack, 1, MAX_DAYS),\n limit: count(o.limit, 'limit', DEFAULTS.inboxLimit, 1, 100_000),\n previewChars: count(o.previewChars, 'previewChars', DEFAULTS.previewChars, 0, 1_000_000),\n });\n },\n\n async searchInboxByFilter(emailAccount, filter) {\n const platform = backend();\n const f = optionsObject(filter, 'filter');\n return platform.searchInboxByFilter({\n account: requiredText(emailAccount, 'emailAccount'),\n daysBack: count(f.daysBack, 'daysBack', DEFAULTS.daysBack, 1, MAX_DAYS),\n subjectLike: optionalText(f.subjectLike, 'subjectLike'),\n subjectPattern: optionalRegExp(f.subjectPattern, 'subjectPattern'),\n excludeReplies: flag(f.excludeReplies, 'excludeReplies', false),\n requireAttachment: flag(f.requireAttachment, 'requireAttachment', false),\n includeFolders: textList(f.includeFolders, 'includeFolders'),\n excludeFolders: textList(f.excludeFolders, 'excludeFolders'),\n includeBody: flag(f.includeBody, 'includeBody', true),\n });\n },\n\n async readSelectedEmail() {\n return backend().readSelectedEmail();\n },\n\n async readEmailBody(email, options) {\n const platform = backend();\n const target = emailLocator(email);\n const o = optionsObject(options);\n const maxChars = count(o.maxChars, 'maxChars', DEFAULTS.bodyMaxChars, 1, 100_000_000);\n const maxQuotedChars = count(o.maxQuotedChars, 'maxQuotedChars', DEFAULTS.quotedMaxChars, 0, 100_000_000);\n const includeQuoted = flag(o.includeQuoted, 'includeQuoted', false);\n const raw = await platform.readEmailBody(target);\n // The quoted thread is context, never the sender's own answer, so it is\n // capped by the tighter of the two limits.\n const { body, quoted, separator } = splitQuotedOriginal(raw.body);\n return {\n entryId: raw.entryId,\n subject: raw.subject,\n senderName: raw.senderName,\n senderEmail: raw.senderEmail,\n receivedTime: raw.receivedTime,\n body: body.slice(0, maxChars),\n truncated: body.length > maxChars,\n bodyLength: body.length,\n quoteSeparator: separator,\n quotedLength: quoted.length,\n quotedOriginal: includeQuoted ? quoted.slice(0, Math.min(maxChars, maxQuotedChars)) : '',\n attachmentNames: [...raw.attachmentNames],\n attachmentCount: raw.attachmentNames.length,\n };\n },\n\n async openOutlookEmail(email) {\n const platform = backend();\n await platform.openOutlookEmail(emailLocator(email));\n },\n\n async locateEmail(description, options) {\n const platform = backend();\n const d = requireObject(description, 'description');\n const wanted = {\n subject: optionalText(d.subject, 'subject'),\n sender: optionalText(d.sender, 'sender'),\n receivedTime: optionalText(d.receivedTime, 'receivedTime'),\n };\n requireDescribed(wanted);\n const emailAccount = optionalText(d.emailAccount, 'emailAccount');\n const folderPath = optionalText(d.folderPath, 'folderPath');\n const fallbackDays = count(optionsObject(options).daysBack, 'daysBack', DEFAULTS.daysBack, 1, MAX_DAYS);\n const search = {\n daysBack: Math.min(MAX_DAYS, daysBackFor(wanted.receivedTime, fallbackDays)),\n subjectLike: subjectPrefilter(wanted.subject),\n excludeReplies: false,\n requireAttachment: false,\n includeFolders: [],\n excludeFolders: [],\n // Judging a match reads subjects, senders and times, so the bodies\n // (the heavy part of a scan) are left behind.\n includeBody: false,\n };\n const accounts = emailAccount\n ? [emailAccount]\n : accountSearchOrder(await platform.getOutlookAccounts(), folderPath);\n\n let searched = 0;\n let firstFailure: unknown;\n for (const account of accounts) {\n let matches;\n try {\n matches = await platform.searchInboxByFilter({ account, ...search });\n } catch (error) {\n if (error instanceof AbortedError) throw error;\n // One mailbox that can't be read shouldn't decide the answer\n // for the rest; only every one failing is an error.\n firstFailure ??= error;\n continue;\n }\n searched++;\n const found = bestMatch(wanted, matches);\n if (found) return found;\n }\n if (searched === 0 && firstFailure !== undefined) throw firstFailure;\n return null;\n },\n\n async listInboxFolders(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.listInboxFolders({\n account: requiredText(emailAccount, 'emailAccount'),\n maxDepth: count(o.maxDepth, 'maxDepth', DEFAULTS.folderDepth, 1, 10),\n });\n },\n\n async moveOutlookEmails(emailAccount, entryIds, folder, options) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const ids = entryIdList(entryIds);\n const { ref, label } = folderOption(requiredText(folder, 'folder'));\n const createIfMissing = flag(optionsObject(options).createIfMissing, 'createIfMissing', false);\n if (ids.length === 0) return { folderPath: '', folderCreated: false, moved: 0, failed: [] };\n return platform.moveOutlookEmails({\n account,\n entryIds: ids,\n folder: ref,\n folderLabel: label,\n createIfMissing,\n });\n },\n\n async listOutlookDrafts(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.listOutlookDrafts({\n account: requiredText(emailAccount, 'emailAccount'),\n limit: count(o.limit, 'limit', DEFAULTS.draftsLimit, 1, 100_000),\n previewChars: count(o.previewChars, 'previewChars', DEFAULTS.draftsPreviewChars, 0, 1_000_000),\n });\n },\n\n async sendDrafts(emailAccount, entryIds) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const ids = entryIdList(entryIds);\n if (ids.length === 0) return { sent: 0, failed: [] };\n return platform.sendDrafts({ account, entryIds: ids });\n },\n\n async sendAllDrafts(emailAccount) {\n const platform = backend();\n return platform.sendAllDrafts({ account: requiredText(emailAccount, 'emailAccount') });\n },\n\n async deleteOutlookDrafts(emailAccount, entryIds) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const ids = entryIdList(entryIds);\n if (ids.length === 0) return { deleted: 0, failed: [] };\n return platform.deleteOutlookDrafts({ account, entryIds: ids });\n },\n\n async deleteOutlookEmails(emailAccount, entryIds, options) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const ids = entryIdList(entryIds);\n const o = optionsObject(options);\n const allowProtected = flag(o.allowProtected, 'allowProtected', false);\n const dryRun = flag(o.dryRun, 'dryRun', false);\n if (ids.length === 0) return deleteMailResult(dryRun, []);\n return platform.deleteOutlookEmails({ account, entryIds: ids, allowProtected, dryRun });\n },\n\n async purgeDeletedItems(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.purgeDeletedItems({\n account: requiredText(emailAccount, 'emailAccount'),\n olderThanDays: count(o.olderThanDays, 'olderThanDays', 0, 0, 36_500),\n dryRun: flag(o.dryRun, 'dryRun', false),\n });\n },\n\n async saveEmailAttachment(email, fileName, options) {\n const [saved] = await saveEmailAttachments(email, [fileName], options);\n if (!saved) throw new NotFoundError('attachment', `Attachment '${fileName}' was not saved.`);\n return saved;\n },\n\n saveEmailAttachments,\n\n async cleanUndeliverableEmails(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.cleanUndeliverableEmails({\n account: requiredText(emailAccount, 'emailAccount'),\n daysBack: count(o.daysBack, 'daysBack', DEFAULTS.bounceDaysBack, 1, MAX_DAYS),\n // Deleting has to be asked for.\n dryRun: flag(o.dryRun, 'dryRun', true),\n });\n },\n\n async collectBouncedRecipients(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.collectBouncedRecipients({\n account: requiredText(emailAccount, 'emailAccount'),\n daysBack: count(o.daysBack, 'daysBack', DEFAULTS.bounceDaysBack, 1, MAX_DAYS),\n includeDeletedItems: flag(o.includeDeletedItems, 'includeDeletedItems', true),\n });\n },\n\n async readSentRecipientGroups(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.readSentRecipientGroups({\n account: requiredText(emailAccount, 'emailAccount'),\n daysBack: count(o.daysBack, 'daysBack', DEFAULTS.bounceDaysBack, 1, MAX_DAYS),\n limit: count(o.limit, 'limit', DEFAULTS.sentGroupsLimit, 1, 100_000),\n });\n },\n\n async readBounceReport(emailAccount, options) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const o = optionsObject(options);\n const daysBack = count(o.daysBack, 'daysBack', DEFAULTS.bounceDaysBack, 1, MAX_DAYS);\n const includeDeletedItems = flag(o.includeDeletedItems, 'includeDeletedItems', true);\n const bounced = await platform.collectBouncedRecipients({ account, daysBack, includeDeletedItems });\n const sent = await platform.readSentRecipientGroups({ account, daysBack, limit: DEFAULTS.sentGroupsLimit });\n return buildBounceReport(account, daysBack, bounced, sent);\n },\n\n async listOutlookSignatures() {\n return backend().listOutlookSignatures();\n },\n\n async readOutlookSignatureHtml(name) {\n const platform = backend();\n return platform.readOutlookSignatureHtml(requiredText(name, 'name'));\n },\n\n async readTemplateEmails(emailAccount, options) {\n const platform = backend();\n const o = optionsObject(options);\n return platform.readTemplateEmails({\n account: requiredText(emailAccount, 'emailAccount'),\n folder: optionalText(o.folder, 'folder') ?? DEFAULTS.templateFolder,\n limit: count(o.limit, 'limit', DEFAULTS.templatesLimit, 1, 200),\n includeBody: flag(o.includeBody, 'includeBody', true),\n subject: optionalText(o.subject, 'subject'),\n });\n },\n\n async saveTemplateEmail(emailAccount, template) {\n const platform = backend();\n const account = requiredText(emailAccount, 'emailAccount');\n const t = requireObject(template, 'template');\n return platform.saveTemplateEmail({\n account,\n folder: optionalText(t.folder, 'folder') ?? DEFAULTS.templateFolder,\n subject: requiredText(t.subject, 'subject'),\n htmlBody: requiredContent(t.htmlBody, 'htmlBody'),\n });\n },\n\n async editEmailTemplate(label, currentHtml) {\n const platform = backend();\n return platform.editEmailTemplate({\n label: requiredText(label, 'label'),\n html: requiredContent(currentHtml, 'currentHtml'),\n });\n },\n };\n}\n\n// ── Instances and capabilities ───────────────────────────────────────────\n\n/**\n * A bridge carrying its own settings, plus capability discovery.\n *\n * The exported functions are the same operations under the process-wide\n * settings; an instance is what to use when the process holds more than one\n * caller, or when a call needs its own timeout or AbortSignal.\n */\nexport interface OutlookBridgeInstance extends OutlookBridge {\n /** The settings this bridge runs with. */\n readonly options: ResolvedConfig;\n\n /** Which operations work on this machine. */\n capabilities(): CapabilityMap;\n\n /** Whether one operation works on this machine. */\n supports(operation: BridgeCapability): boolean;\n\n /**\n * A bridge like this one with some settings changed — how one call gets its\n * own budget or cancellation: `bridge.withOptions({ signal }).readInboxEmails(...)`.\n */\n withOptions(options: BridgeOptions): OutlookBridgeInstance;\n}\n\nfunction capabilityMap(backend: Backend | null): CapabilityMap {\n return Object.freeze(Object.fromEntries(OPERATIONS.map(name => [name, backend !== null]))) as CapabilityMap;\n}\n\ntype AnyOperation = (...args: unknown[]) => Promise<unknown>;\n\n/**\n * A bridge over `backend` whose every call runs with `config` in force.\n *\n * The platform code reads settings through `getConfig()`, so the config is put\n * in place around each call rather than passed into it: `withConfig` scopes it\n * to the call's whole async subtree, which is why two bridges with different\n * settings can run concurrently without seeing each other's.\n */\nexport function createBridge(backend: Backend | null, config: ResolvedConfig): OutlookBridgeInstance {\n const operations = createOperations(backend) as unknown as Record<BridgeCapability, AnyOperation>;\n const map = capabilityMap(backend);\n const instance: Record<string, unknown> = {\n options: Object.freeze({ ...config }),\n capabilities: () => map,\n supports: (operation: BridgeCapability) => map[operation] === true,\n withOptions: (options: BridgeOptions) => createBridge(backend, mergeOptions(config, options)),\n };\n for (const name of OPERATIONS) {\n instance[name] = (...args: unknown[]) => withConfig(config, () => operations[name](...args));\n }\n return instance as unknown as OutlookBridgeInstance;\n}\n\n/**\n * A bridge with its own settings, isolated from `configure()` and from every\n * other bridge. Options left out take the process-wide values as they stand\n * when this is called.\n *\n * ```ts\n * const outlook = createOutlookBridge({ timeoutMs: 30_000 });\n * const recent = await outlook.readInboxEmails('me@example.com', { daysBack: 7 });\n * ```\n */\nexport function createOutlookBridge(options: BridgeOptions = {}): OutlookBridgeInstance {\n return createBridge(PLATFORM_BACKEND, mergeOptions(getGlobalConfig(), options));\n}\n\nconst PLATFORM_CAPABILITIES = capabilityMap(PLATFORM_BACKEND);\n\n/** Which operations work on this machine: all of them on Windows and macOS, none elsewhere. */\nexport function capabilities(): CapabilityMap {\n return PLATFORM_CAPABILITIES;\n}\n\n/** Whether one operation works on this machine. */\nexport function supports(operation: BridgeCapability): boolean {\n return PLATFORM_CAPABILITIES[operation] === true;\n}\n\n/** The operations under the process-wide settings — what the package exports as plain functions. */\nexport const defaultBridge: OutlookBridge = createOperations(PLATFORM_BACKEND);\n"]}
|
package/dist/errors.d.ts
CHANGED
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
* - `ACCOUNT_NOT_FOUND` — no mailbox in the Outlook profile matches the address.
|
|
7
7
|
* - `NOT_FOUND` — a folder, email, attachment, template, signature or file didn't resolve.
|
|
8
8
|
* - `INVALID_REQUEST` — the arguments can't produce a call.
|
|
9
|
+
* - `PERMISSION_DENIED` — macOS privacy control kept the package from what it needed.
|
|
9
10
|
* - `SCRIPT_FAILED` — the automation script ran and failed.
|
|
10
11
|
* - `OUTPUT_TOO_LARGE` — the script printed more than `maxBufferBytes` and was killed.
|
|
11
12
|
* - `TIMEOUT` — the run exceeded its time budget and was killed.
|
|
12
13
|
* - `ABORTED` — the caller's AbortSignal fired.
|
|
13
14
|
*/
|
|
14
|
-
export type OutlookErrorCode = 'UNSUPPORTED_PLATFORM' | 'NOT_IMPLEMENTED' | 'ACCOUNT_NOT_FOUND' | 'NOT_FOUND' | 'INVALID_REQUEST' | 'SCRIPT_FAILED' | 'OUTPUT_TOO_LARGE' | 'TIMEOUT' | 'ABORTED';
|
|
15
|
+
export type OutlookErrorCode = 'UNSUPPORTED_PLATFORM' | 'NOT_IMPLEMENTED' | 'ACCOUNT_NOT_FOUND' | 'NOT_FOUND' | 'INVALID_REQUEST' | 'PERMISSION_DENIED' | 'SCRIPT_FAILED' | 'OUTPUT_TOO_LARGE' | 'TIMEOUT' | 'ABORTED';
|
|
15
16
|
/** The interpreter a script ran under. */
|
|
16
17
|
export type ScriptRunner = 'powershell' | 'osascript';
|
|
17
18
|
/** What a NOT_FOUND error failed to find. */
|
|
@@ -19,7 +20,11 @@ export type NotFoundKind = 'folder' | 'email' | 'attachment' | 'template' | 'sig
|
|
|
19
20
|
/** Base class for every error this package raises deliberately. */
|
|
20
21
|
export declare class OutlookError extends Error {
|
|
21
22
|
readonly code: OutlookErrorCode;
|
|
22
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The underlying failure, when there was one. Declared rather than defined:
|
|
25
|
+
* a class field would give every error a `cause` of undefined, and an error
|
|
26
|
+
* with no cause should not have the property at all.
|
|
27
|
+
*/
|
|
23
28
|
readonly cause?: unknown;
|
|
24
29
|
constructor(code: OutlookErrorCode, message: string, options?: {
|
|
25
30
|
cause?: unknown;
|
|
@@ -52,6 +57,14 @@ export declare class NotFoundError extends OutlookError {
|
|
|
52
57
|
export declare class InvalidRequestError extends OutlookError {
|
|
53
58
|
constructor(message: string);
|
|
54
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* macOS privacy control kept the package from what it needed: on a Mac, Outlook's
|
|
62
|
+
* profile, which is the only place a Microsoft 365 mailbox synced through
|
|
63
|
+
* Microsoft's cloud is listed. The message names the app to grant access to.
|
|
64
|
+
*/
|
|
65
|
+
export declare class PermissionDeniedError extends OutlookError {
|
|
66
|
+
constructor(message: string);
|
|
67
|
+
}
|
|
55
68
|
/**
|
|
56
69
|
* The script ran and failed.
|
|
57
70
|
*
|
|
@@ -64,7 +77,7 @@ export declare class ScriptError extends OutlookError {
|
|
|
64
77
|
readonly script: string;
|
|
65
78
|
readonly stderr: string;
|
|
66
79
|
readonly durationMs: number;
|
|
67
|
-
/** The line of `script` the failure was raised on, when the runner reports one. */
|
|
80
|
+
/** The line of `script` the failure was raised on, when the runner reports one; absent otherwise, as `cause` is. */
|
|
68
81
|
readonly line?: number;
|
|
69
82
|
constructor(init: {
|
|
70
83
|
runner: ScriptRunner;
|
|
@@ -103,22 +116,18 @@ export declare class AbortedError extends OutlookError {
|
|
|
103
116
|
readonly runner: ScriptRunner;
|
|
104
117
|
constructor(runner: ScriptRunner, reason?: unknown);
|
|
105
118
|
}
|
|
106
|
-
/** The codes a script may raise by tagging its failure message. */
|
|
107
|
-
export type ScriptFailureCode = 'ACCOUNT_NOT_FOUND' | 'NOT_FOUND' | 'INVALID_REQUEST';
|
|
108
119
|
/**
|
|
109
120
|
* The tag that opens a typed script failure, ready to be followed by the
|
|
110
121
|
* human-readable message. Plain ASCII with no quote or `$`, so it can sit
|
|
111
122
|
* inside a PowerShell or AppleScript string literal unescaped.
|
|
112
123
|
*/
|
|
113
|
-
export declare function failureTag(code: 'ACCOUNT_NOT_FOUND' | 'INVALID_REQUEST'): string;
|
|
124
|
+
export declare function failureTag(code: 'ACCOUNT_NOT_FOUND' | 'INVALID_REQUEST' | 'PERMISSION_DENIED'): string;
|
|
114
125
|
export declare function failureTag(code: 'NOT_FOUND', kind: NotFoundKind): string;
|
|
115
126
|
/**
|
|
116
127
|
* The typed error a tagged script message stands for, or null when the
|
|
117
128
|
* message carries no tag.
|
|
118
129
|
*/
|
|
119
130
|
export declare function errorFromTaggedMessage(message: string): OutlookError | null;
|
|
120
|
-
/** Remove any failure tags from a message meant for display — e.g. a per-item error. */
|
|
121
|
-
export declare function stripFailureTags(message: string): string;
|
|
122
131
|
/**
|
|
123
132
|
* Turn a failed run into the most specific error that can be proven.
|
|
124
133
|
*
|
package/dist/errors.js
CHANGED
|
@@ -7,23 +7,20 @@
|
|
|
7
7
|
// reworded without breaking anyone. `err instanceof OutlookError` alone
|
|
8
8
|
// separates an expected failure from a bug.
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.AbortedError = exports.TimeoutError = exports.OutputTooLargeError = exports.ScriptError = exports.InvalidRequestError = exports.NotFoundError = exports.AccountNotFoundError = exports.NotImplementedError = exports.UnsupportedPlatformError = exports.OutlookError = void 0;
|
|
10
|
+
exports.AbortedError = exports.TimeoutError = exports.OutputTooLargeError = exports.ScriptError = exports.PermissionDeniedError = exports.InvalidRequestError = exports.NotFoundError = exports.AccountNotFoundError = exports.NotImplementedError = exports.UnsupportedPlatformError = exports.OutlookError = void 0;
|
|
11
11
|
exports.failureTag = failureTag;
|
|
12
12
|
exports.errorFromTaggedMessage = errorFromTaggedMessage;
|
|
13
|
-
exports.stripFailureTags = stripFailureTags;
|
|
14
13
|
exports.classifyRunFailure = classifyRunFailure;
|
|
15
14
|
const NOT_FOUND_KINDS = ['folder', 'email', 'attachment', 'template', 'signature', 'file'];
|
|
16
15
|
/** Base class for every error this package raises deliberately. */
|
|
17
16
|
class OutlookError extends Error {
|
|
18
17
|
code;
|
|
19
|
-
/** The underlying failure, when there was one. */
|
|
20
|
-
cause;
|
|
21
18
|
constructor(code, message, options) {
|
|
22
19
|
// `cause` is an own enumerable field rather than `super`'s option: that
|
|
23
20
|
// is what puts it in a JSON dump of the error, which is where someone
|
|
24
21
|
// logging a failure looks for it.
|
|
25
22
|
super(message);
|
|
26
|
-
if (options
|
|
23
|
+
if (options?.cause !== undefined)
|
|
27
24
|
this.cause = options.cause;
|
|
28
25
|
this.code = code;
|
|
29
26
|
// `name` is what an unhandled-rejection dump shows, so make it the subclass.
|
|
@@ -78,6 +75,17 @@ class InvalidRequestError extends OutlookError {
|
|
|
78
75
|
}
|
|
79
76
|
}
|
|
80
77
|
exports.InvalidRequestError = InvalidRequestError;
|
|
78
|
+
/**
|
|
79
|
+
* macOS privacy control kept the package from what it needed: on a Mac, Outlook's
|
|
80
|
+
* profile, which is the only place a Microsoft 365 mailbox synced through
|
|
81
|
+
* Microsoft's cloud is listed. The message names the app to grant access to.
|
|
82
|
+
*/
|
|
83
|
+
class PermissionDeniedError extends OutlookError {
|
|
84
|
+
constructor(message) {
|
|
85
|
+
super('PERMISSION_DENIED', message);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.PermissionDeniedError = PermissionDeniedError;
|
|
81
89
|
/**
|
|
82
90
|
* The script ran and failed.
|
|
83
91
|
*
|
|
@@ -90,8 +98,6 @@ class ScriptError extends OutlookError {
|
|
|
90
98
|
script;
|
|
91
99
|
stderr;
|
|
92
100
|
durationMs;
|
|
93
|
-
/** The line of `script` the failure was raised on, when the runner reports one. */
|
|
94
|
-
line;
|
|
95
101
|
constructor(init) {
|
|
96
102
|
super('SCRIPT_FAILED', init.message || init.stderr || `${init.runner} failed with no output.`, { cause: init.cause });
|
|
97
103
|
this.runner = init.runner;
|
|
@@ -142,7 +148,7 @@ exports.AbortedError = AbortedError;
|
|
|
142
148
|
function failureTag(code, kind) {
|
|
143
149
|
return `[outlook-bridge:${code}${kind ? `:${kind}` : ''}] `;
|
|
144
150
|
}
|
|
145
|
-
const FAILURE_TAG = /\[outlook-bridge:(ACCOUNT_NOT_FOUND|NOT_FOUND|INVALID_REQUEST)(?::([a-z]+))?\]\s*/;
|
|
151
|
+
const FAILURE_TAG = /\[outlook-bridge:(ACCOUNT_NOT_FOUND|NOT_FOUND|INVALID_REQUEST|PERMISSION_DENIED)(?::([a-z]+))?\]\s*/;
|
|
146
152
|
/** A script's account-not-found message names the address in single quotes. */
|
|
147
153
|
const QUOTED_ACCOUNT = /'(.*)'/;
|
|
148
154
|
/**
|
|
@@ -157,6 +163,8 @@ function errorFromTaggedMessage(message) {
|
|
|
157
163
|
switch (match[1]) {
|
|
158
164
|
case 'ACCOUNT_NOT_FOUND':
|
|
159
165
|
return new AccountNotFoundError(QUOTED_ACCOUNT.exec(text)?.[1] ?? '', text);
|
|
166
|
+
case 'PERMISSION_DENIED':
|
|
167
|
+
return new PermissionDeniedError(text);
|
|
160
168
|
case 'NOT_FOUND': {
|
|
161
169
|
const kind = NOT_FOUND_KINDS.find(k => k === match[2]) ?? 'email';
|
|
162
170
|
return new NotFoundError(kind, text);
|
|
@@ -165,10 +173,6 @@ function errorFromTaggedMessage(message) {
|
|
|
165
173
|
return new InvalidRequestError(text);
|
|
166
174
|
}
|
|
167
175
|
}
|
|
168
|
-
/** Remove any failure tags from a message meant for display — e.g. a per-item error. */
|
|
169
|
-
function stripFailureTags(message) {
|
|
170
|
-
return message.replace(new RegExp(FAILURE_TAG.source, 'g'), '').trim();
|
|
171
|
-
}
|
|
172
176
|
/**
|
|
173
177
|
* Turn a failed run into the most specific error that can be proven.
|
|
174
178
|
*
|
|
@@ -199,7 +203,7 @@ function classifyRunFailure(init) {
|
|
|
199
203
|
durationMs,
|
|
200
204
|
message,
|
|
201
205
|
line: init.line,
|
|
202
|
-
cause: nodeError ?? undefined
|
|
206
|
+
cause: nodeError ?? undefined,
|
|
203
207
|
});
|
|
204
208
|
}
|
|
205
209
|
//# sourceMappingURL=errors.js.map
|