@dawnlit/outlook-bridge 1.1.0 → 2.0.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 +150 -183
- package/dist/backend.d.ts +151 -0
- package/dist/backend.js +3 -0
- package/dist/backend.js.map +1 -0
- package/dist/bridge.d.ts +56 -0
- package/dist/bridge.js +507 -0
- package/dist/bridge.js.map +1 -0
- package/dist/errors.d.ts +81 -43
- package/dist/errors.js +98 -52
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +25 -52
- package/dist/index.js.map +1 -1
- package/dist/mac/accounts.d.ts +7 -2
- package/dist/mac/accounts.js +23 -6
- package/dist/mac/accounts.js.map +1 -1
- package/dist/mac/attachments.d.ts +5 -25
- package/dist/mac/attachments.js +40 -99
- package/dist/mac/attachments.js.map +1 -1
- package/dist/mac/bounces.d.ts +12 -27
- package/dist/mac/bounces.js +95 -112
- package/dist/mac/bounces.js.map +1 -1
- package/dist/mac/cleanup.d.ts +11 -25
- package/dist/mac/cleanup.js +50 -76
- package/dist/mac/cleanup.js.map +1 -1
- package/dist/mac/drafts.d.ts +13 -34
- package/dist/mac/drafts.js +95 -169
- package/dist/mac/drafts.js.map +1 -1
- package/dist/mac/folders.d.ts +10 -21
- package/dist/mac/folders.js +33 -47
- package/dist/mac/folders.js.map +1 -1
- package/dist/mac/index.d.ts +2 -22
- package/dist/mac/index.js +19 -81
- package/dist/mac/index.js.map +1 -1
- package/dist/mac/profile.d.ts +13 -0
- package/dist/mac/profile.js +149 -0
- package/dist/mac/profile.js.map +1 -0
- package/dist/mac/read.d.ts +18 -36
- package/dist/mac/read.js +154 -208
- package/dist/mac/read.js.map +1 -1
- package/dist/mac/run.d.ts +35 -39
- package/dist/mac/run.js +97 -102
- package/dist/mac/run.js.map +1 -1
- package/dist/mac/scripts.d.ts +78 -86
- package/dist/mac/scripts.js +125 -115
- package/dist/mac/scripts.js.map +1 -1
- package/dist/mac/send.d.ts +10 -20
- package/dist/mac/send.js +64 -86
- package/dist/mac/send.js.map +1 -1
- package/dist/mac/signatures.d.ts +2 -2
- package/dist/mac/signatures.js +9 -11
- package/dist/mac/signatures.js.map +1 -1
- package/dist/mac/templates.d.ts +14 -26
- package/dist/mac/templates.js +75 -113
- package/dist/mac/templates.js.map +1 -1
- package/dist/mail.d.ts +77 -45
- package/dist/mail.js +166 -73
- package/dist/mail.js.map +1 -1
- package/dist/runtime.d.ts +76 -43
- package/dist/runtime.js +103 -48
- package/dist/runtime.js.map +1 -1
- package/dist/shared/args.d.ts +48 -0
- package/dist/shared/args.js +216 -0
- package/dist/shared/args.js.map +1 -0
- package/dist/shared/attachmentMatch.d.ts +28 -16
- package/dist/shared/attachmentMatch.js +60 -22
- package/dist/shared/attachmentMatch.js.map +1 -1
- package/dist/shared/bounceReport.d.ts +11 -0
- package/dist/shared/bounceReport.js +45 -0
- package/dist/shared/bounceReport.js.map +1 -0
- package/dist/shared/bounceRules.d.ts +38 -10
- package/dist/shared/bounceRules.js +50 -32
- package/dist/shared/bounceRules.js.map +1 -1
- package/dist/shared/exec.d.ts +21 -0
- package/dist/shared/exec.js +47 -0
- package/dist/shared/exec.js.map +1 -0
- package/dist/shared/json.d.ts +12 -6
- package/dist/shared/json.js +29 -23
- package/dist/shared/json.js.map +1 -1
- package/dist/shared/locate.d.ts +39 -0
- package/dist/shared/locate.js +129 -0
- package/dist/shared/locate.js.map +1 -0
- package/dist/shared/replyBody.d.ts +42 -32
- package/dist/shared/replyBody.js +84 -71
- package/dist/shared/replyBody.js.map +1 -1
- package/dist/templateBody.d.ts +63 -0
- package/dist/{outlookTemplateSections.js → templateBody.js} +72 -72
- package/dist/templateBody.js.map +1 -0
- package/dist/types.d.ts +360 -165
- package/dist/types.js +8 -9
- package/dist/types.js.map +1 -1
- package/dist/windows/accounts.d.ts +10 -1
- package/dist/windows/accounts.js +25 -13
- package/dist/windows/accounts.js.map +1 -1
- package/dist/windows/attachments.d.ts +9 -24
- package/dist/windows/attachments.js +94 -119
- package/dist/windows/attachments.js.map +1 -1
- package/dist/windows/bounces.d.ts +13 -26
- package/dist/windows/bounces.js +169 -200
- package/dist/windows/bounces.js.map +1 -1
- package/dist/windows/cleanup.d.ts +19 -23
- package/dist/windows/cleanup.js +93 -111
- package/dist/windows/cleanup.js.map +1 -1
- package/dist/windows/drafts.d.ts +16 -35
- package/dist/windows/drafts.js +167 -253
- package/dist/windows/drafts.js.map +1 -1
- package/dist/windows/folders.d.ts +8 -13
- package/dist/windows/folders.js +45 -52
- package/dist/windows/folders.js.map +1 -1
- package/dist/windows/index.d.ts +2 -27
- package/dist/windows/index.js +11 -65
- package/dist/windows/index.js.map +1 -1
- package/dist/windows/read.d.ts +24 -45
- package/dist/windows/read.js +266 -279
- package/dist/windows/read.js.map +1 -1
- package/dist/windows/run.d.ts +39 -39
- package/dist/windows/run.js +151 -111
- package/dist/windows/run.js.map +1 -1
- package/dist/windows/scripts.d.ts +71 -38
- package/dist/windows/scripts.js +123 -71
- package/dist/windows/scripts.js.map +1 -1
- package/dist/windows/send.d.ts +6 -11
- package/dist/windows/send.js +70 -79
- package/dist/windows/send.js.map +1 -1
- package/dist/windows/signatures.d.ts +4 -10
- package/dist/windows/signatures.js +30 -37
- package/dist/windows/signatures.js.map +1 -1
- package/dist/windows/templates.d.ts +12 -18
- package/dist/windows/templates.js +126 -151
- package/dist/windows/templates.js.map +1 -1
- package/package.json +5 -4
- package/dist/OutlookService.d.ts +0 -43
- package/dist/OutlookService.js +0 -137
- package/dist/OutlookService.js.map +0 -1
- package/dist/outlookTemplateSections.d.ts +0 -62
- package/dist/outlookTemplateSections.js.map +0 -1
- package/dist/shared/capabilities.d.ts +0 -3
- package/dist/shared/capabilities.js +0 -9
- package/dist/shared/capabilities.js.map +0 -1
package/dist/mac/scripts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../src/mac/scripts.ts"],"names":[],"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M,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,2BAA2B,CAAC,CAAC;IAChH,IAAI,QAAQ;QAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,mDAAmD;AACtC,QAAA,aAAa,GAAG;IACzB,EAAE,EAAE,CAAC;IACL,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,eAAe,EAAE,CAAC;IAClB,IAAI,EAAE,CAAC;CACD,CAAC;AAEX;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,eAAe,GAAG,QAAQ,EAAE,MAAM,GAAG,MAAM;IAC7E,OAAO,GAAG,MAAM;EAClB,MAAM;EACN,MAAM;EACN,MAAM,oCAAoC,eAAe;EACzD,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM,SAAS,CAAC;AAClB,CAAC;AAED,qFAAqF;AACrF,SAAgB,oBAAoB,CAAC,eAAe,GAAG,QAAQ,EAAE,MAAM,GAAG,MAAM;IAC5E,OAAO,GAAG,MAAM;EAClB,MAAM;EACN,MAAM,4CAA4C,eAAe;EACjE,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM,SAAS,CAAC;AAClB,CAAC;AAED;;;GAGG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;CAelC,CAAC;AAEF;;;GAGG;AACU,QAAA,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;CAoBpC,CAAC","sourcesContent":["// The AppleScript fragments more than one macOS operation is built from.\nimport { asString } from './run';\nimport { readProfileAccounts } from './profile';\nimport { failureTag, InvalidRequestError, NotImplementedError } from '../errors';\nimport { FolderId, isOutgoingRoot } from '../mail';\nimport type { ItemFailure, MailFolderRef } from '../types';\n\n/**\n * An account as the generated AppleScript reaches it.\n *\n * `folderIds` carries what Outlook's profile database knows about the mailbox's\n * well-known folders — the only handle on a mailbox the dictionary publishes no\n * account object for (see profile.ts). It is filled in for every account the\n * profile lists, because the generated script chooses between the account\n * object and the folder id at run time; nothing here has to predict which kinds\n * of account a given Outlook build exposes.\n */\nexport interface MacAccount {\n readonly emailAccount: string;\n readonly folderIds?: Readonly<Record<string, number>>;\n}\n\n/** Look an address up in Outlook's profile database, for the folder ids it can add. */\nexport async function resolveMacAccount(emailAccount: string): Promise<MacAccount> {\n const wanted = emailAccount.trim().toLowerCase();\n const found = (await readProfileAccounts())\n .find(account => account.emailAccount.trim().toLowerCase() === wanted);\n return found ? {emailAccount, folderIds: found.folderIds} : {emailAccount};\n}\n\n/**\n * Resolve the account whose address matches into `targetAcct`, inside a\n * `tell application \"Microsoft Outlook\"` block.\n *\n * `every account` errors even in legacy mode, so the typed classes are probed.\n * A `whose email address is …` filter can't be used either: `email address` is\n * also a class name, and AppleScript resolves it as one.\n *\n * A mailbox the dictionary publishes no account object for leaves `targetAcct`\n * as `missing value` rather than failing, provided the profile gave a folder id\n * to reach it by. `needsAccountObject` is for composing mail, which can't work\n * without the object: the account a message is sent from can only be set from\n * it, and a message composed without it goes out from the default mailbox.\n */\nexport function accountLookupSnippet(acct: MacAccount, needsAccountObject = false): string {\n const probe = ` set targetAcct to missing value\n try\n repeat with a in (exchange accounts & imap accounts & pop accounts)\n if (email address of a as string) is ${asString(acct.emailAccount)} then\n set targetAcct to a\n exit repeat\n end if\n end repeat\n end try`;\n if (acct.folderIds && !needsAccountObject) return probe;\n const complaint = acct.folderIds\n ? `${failureTag('INVALID_REQUEST')}Outlook publishes no account object for '${acct.emailAccount}', `\n + 'so the account a message is sent from cannot be set. Its folders can be read; mail cannot be composed from it.'\n : `${failureTag('ACCOUNT_NOT_FOUND')}Account '${acct.emailAccount}' not found in Outlook.`;\n return `${probe}\n if targetAcct is missing value then error ${asString(complaint)}`;\n}\n\n/**\n * Bind `variable` to one of the account's well-known folders: through the\n * account object when the probe found one, else by the folder's own id. `mail\n * folder id N` resolves against the application rather than an account, and N is\n * the id Outlook's profile database records for that folder.\n */\nexport function rootFolderSnippet(acct: MacAccount, term: string, variable: string): string {\n const viaAccount = ` set ${variable} to ${term} of targetAcct`;\n const id = acct.folderIds?.[term];\n if (id !== undefined) {\n return ` if targetAcct is missing value then\n set ${variable} to mail folder id ${id}\n else\n${viaAccount}\n end if`;\n }\n // The profile listed the mailbox but not this root, so the probe is the only\n // way in — and it may have come up empty. Name the folder out of reach\n // rather than let `<term> of missing value` say it.\n if (acct.folderIds) {\n const complaint = `${failureTag('NOT_FOUND', 'folder')}Account '${acct.emailAccount}' has no ${term} folder AppleScript can reach.`;\n return ` if targetAcct is missing value then error ${asString(complaint)}\n${viaAccount}`;\n }\n return viaAccount;\n}\n\n/**\n * Outlook for Mac's dictionary term for each well-known root, by olDefaultFolders\n * id. Verified against the running app: the terms are NOT what the Windows names\n * suggest — `sent mail` and `junk email` don't compile, `sent items` and `junk\n * mail` do — and one bad term fails the whole script at compile time.\n */\nexport const MAC_ROOT_TERMS: Readonly<Record<number, string>> = {\n [FolderId.Inbox]: 'inbox',\n [FolderId.SentMail]: 'sent items',\n [FolderId.Drafts]: 'drafts',\n [FolderId.DeletedItems]: 'deleted items',\n [FolderId.Outbox]: 'outbox',\n [FolderId.Junk]: 'junk mail',\n};\n\n/** The date property a root's items carry. */\nexport function dateProperty(rootId: number): string {\n return isOutgoingRoot(rootId) ? 'time sent' : 'time received';\n}\n\n/**\n * The Windows folder-path shape (`\\\\mailbox\\Inbox\\Invoices`), assembled in\n * TypeScript: escaping backslashes through a template literal and then an\n * AppleScript literal is unreadable, and the parts are known here anyway.\n */\nexport function macFolderPath(emailAccount: string, rootLabel: string, segments: readonly string[]): string {\n return ['\\\\\\\\' + emailAccount, rootLabel, ...segments].join('\\\\');\n}\n\n/** The dictionary term for a root, or NOT_IMPLEMENTED naming what was asked. */\nexport function rootTerm(ref: MailFolderRef, folderLabel = ''): string {\n const term = MAC_ROOT_TERMS[ref.rootId];\n if (!term) {\n const asked = folderLabel ? ` (asked for '${folderLabel}')` : '';\n throw new NotImplementedError(\n `Reading the '${ref.rootLabel}' folder${asked}`,\n `macOS, whose readable roots are ${Object.values(MAC_ROOT_TERMS).join(', ')}`,\n );\n }\n return term;\n}\n\n/**\n * Resolve `scopeFolder` from `targetAcct`: a well-known root walked down through\n * any further segments. Also binds `scopeCreated`.\n *\n * Names compare with `is`, which is case-insensitive in AppleScript, matching\n * the Windows walk. A missing segment fails as NOT_FOUND rather than falling\n * back to the root; `createMissing` builds the chain instead.\n */\nexport function mailScopeSnippet(acct: MacAccount, ref: MailFolderRef, folderLabel = '', createMissing = false): string {\n const term = rootTerm(ref, folderLabel);\n const walk = ref.segments.map(segment => {\n const complaint = `${failureTag('NOT_FOUND', 'folder')}Folder '${segment}' not found under '${ref.rootLabel}'.`;\n const create = createMissing\n ? ` set foundFolder to (make new mail folder at scopeFolder with properties {name:${asString(segment)}})\n set scopeCreated to true`\n : ` error ${asString(complaint)}`;\n return `\n set foundFolder to missing value\n repeat with sf in (mail folders of scopeFolder)\n if (name of sf as string) is ${asString(segment)} then\n set foundFolder to sf\n exit repeat\n end if\n end repeat\n if foundFolder is missing value then\n${create}\n end if\n set scopeFolder to foundFolder`;\n }).join('');\n return ` set scopeCreated to false\n${rootFolderSnippet(acct, term, 'scopeFolder')}${walk}`;\n}\n\n/**\n * The message id text for a script, or INVALID_REQUEST.\n *\n * Outlook for Mac ids are small integers; a Windows EntryID is refused up front\n * rather than left to fail as a confusing \"not found\", because a caller that\n * persisted one from a Windows run needs to be told exactly that.\n */\nexport function macMessageId(entryId: string): string {\n const id = String(entryId ?? '').trim();\n if (!/^\\d+$/.test(id)) {\n throw new InvalidRequestError(\n `'${entryId}' is not an Outlook for Mac message id. Mac ids are small integers `\n + '(e.g. \"1263\") listed on this machine; a Windows EntryID cannot be resolved here.',\n );\n }\n return id;\n}\n\n/**\n * Split ids into those a script can look up and those that can only fail. A\n * batch reports an unusable id beside a genuine miss rather than throwing and\n * discarding the ids that would have worked.\n */\nexport function partitionMessageIds(entryIds: readonly string[]): { valid: string[]; invalid: ItemFailure[] } {\n const valid: string[] = [];\n const invalid: ItemFailure[] = [];\n for (const entryId of entryIds) {\n try {\n valid.push(macMessageId(entryId));\n } catch (error) {\n invalid.push({entryId: String(entryId), subject: '', error: (error as Error).message});\n }\n }\n return {valid, invalid};\n}\n\n/**\n * Resolve `variable` from a message id, or fail as NOT_FOUND. `message id N`\n * resolves against the application, so the message is found wherever it sits.\n */\nexport function messageLookupSnippet(id: string, variable = 'theMsg'): string {\n const complaint = `${failureTag('NOT_FOUND', 'email')}No email found for message id '${id}'. It may have been deleted - list the mail again for a current id.`;\n return ` set ${variable} to missing value\n try\n set ${variable} to message id ${id}\n end try\n if ${variable} is missing value then error ${asString(complaint)}`;\n}\n\n/**\n * The sender's display name and address as `sndName` / `sndAddr`. `sender` is a\n * record, and `address of sender of m` doesn't coerce, so the record is bound\n * first.\n */\nexport function senderSnippet(messageVariable = 'theMsg', indent = ' '): string {\n return `${indent}set sndName to \"\"\n${indent}set sndAddr to \"\"\n${indent}try\n${indent} set snd to sender of ${messageVariable}\n${indent} try\n${indent} set sndAddr to (address of snd) as string\n${indent} end try\n${indent} try\n${indent} set sndName to (name of snd) as string\n${indent} end try\n${indent}end try`;\n}\n\n/**\n * Everything a reader wants off one message bound to `theMsg`, emitted together\n * with the row it produces (see `messageDetailFields`) so the read order and the\n * positions the decoders index into cannot drift apart. `bodyText` is emitted\n * LAST when asked for, so a stray separator in an earlier field can't shift it.\n */\nexport function messageDetailSnippet(withBody = false, indent = ' '): string {\n return `${indent}set subj to \"\"\n${indent}try\n${indent} set subj to (subject of theMsg) as string\n${indent}end try\n${senderSnippet('theMsg', indent)}\n${indent}set recvd to \"\"\n${indent}try\n${indent} set recvd to my isoDate(time received of theMsg)\n${indent}on error\n${indent} try\n${indent} set recvd to my isoDate(time sent of theMsg)\n${indent} end try\n${indent}end try\n${indent}set attNames to {}\n${indent}try\n${indent} set attNames to name of every attachment of theMsg\n${indent}end try` + (withBody ? `\n${indent}set bodyText to \"\"\n${indent}try\n${indent} set bodyText to (plain text content of theMsg) as string\n${indent}end try` : '');\n}\n\n/** The fields `messageDetailSnippet` fills, in row order — see `MessageDetail`. */\nexport function messageDetailFields(withBody = false): string[] {\n const fields = ['(id of theMsg as string)', 'subj', 'sndName', 'sndAddr', 'recvd', 'my sanitizeList(attNames)'];\n if (withBody) fields.push('bodyText');\n return fields;\n}\n\n/** Where each of those fields lands in the row. */\nexport const MessageDetail = {\n id: 0,\n subject: 1,\n senderName: 2,\n senderEmail: 3,\n receivedTime: 4,\n attachmentNames: 5,\n body: 6,\n} as const;\n\n/**\n * The first recipient's name and address as `sndName` / `sndAddr` — what\n * outgoing mail reports in place of a sender.\n */\nexport function firstRecipientSnippet(messageVariable = 'theMsg', indent = ' '): string {\n return `${indent}set sndName to \"\"\n${indent}set sndAddr to \"\"\n${indent}try\n${indent} set rcps to to recipients of ${messageVariable}\n${indent} if (count of rcps) > 0 then\n${indent} set ea to email address of (item 1 of rcps)\n${indent} try\n${indent} set sndAddr to (address of ea) as string\n${indent} end try\n${indent} try\n${indent} set sndName to (name of ea) as string\n${indent} end try\n${indent} end if\n${indent}end try`;\n}\n\n/** Every address a message was sent to — To, CC and BCC — as the list `addrList`. */\nexport function allRecipientsSnippet(messageVariable = 'theMsg', indent = ' '): string {\n return `${indent}set addrList to {}\n${indent}try\n${indent} repeat with r in (every recipient of ${messageVariable})\n${indent} try\n${indent} -- The record is bound before its field is read: a nested\n${indent} -- 'address of (email address of r)' doesn't coerce, and fails\n${indent} -- inside the try as an empty list rather than an error.\n${indent} set ea to email address of r\n${indent} set oneAddr to (address of ea) as string\n${indent} if oneAddr is not \"\" then set end of addrList to oneAddr\n${indent} end try\n${indent} end repeat\n${indent}end try`;\n}\n\n/**\n * Recursive, case-insensitive, depth-capped folder search from `startFolder` —\n * the macOS counterpart of the Windows Find-FolderByName.\n */\nexport const FIND_FOLDER_HANDLER = `\non findFolderByName(startFolder, wantedName, depth)\n tell application \"Microsoft Outlook\"\n set subs to mail folders of startFolder\n end tell\n repeat with f in subs\n if (name of f as string) is wantedName then return f\n end repeat\n if depth is less than or equal to 1 then return missing value\n repeat with f in subs\n set hit to my findFolderByName(f, wantedName, depth - 1)\n if hit is not missing value then return hit\n end repeat\n return missing value\nend findFolderByName\n`;\n\n/**\n * Enumerate the accounts, probing each class separately: legacy Outlook errors\n * on `every account`, and New Outlook returns empty lists for the classes.\n */\nexport const LIST_ACCOUNTS_SNIPPET = `\nset acctList to {}\ntell application \"Microsoft Outlook\"\n repeat with acctClass in {\"exchange\", \"imap\", \"pop\"}\n try\n if (acctClass as string) is \"exchange\" then\n set accts to exchange accounts\n else if (acctClass as string) is \"imap\" then\n set accts to imap accounts\n else\n set accts to pop accounts\n end if\n repeat with a in accts\n try\n set end of acctList to (email address of a as string)\n end try\n end repeat\n end try\n end repeat\nend tell\n`;\n"]}
|
package/dist/mac/send.d.ts
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReplyRequest, SendRequest } from '../backend';
|
|
2
|
+
import type { ReplyEmailResult } from '../types';
|
|
3
|
+
/** Send, display or file a new email. */
|
|
4
|
+
export declare function sendOutlookEmail(request: SendRequest): Promise<void>;
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Mirrors the Windows COM contract from windows/send.ts.
|
|
5
|
-
*/
|
|
6
|
-
export declare function sendOutlookEmail(params: SendEmailParams): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* Reply to an email, inserting the caller's HTML above the quoted original.
|
|
9
|
-
*
|
|
10
|
-
* `entryId` is Outlook for Mac's small integer message id (see readInboxEmails),
|
|
11
|
-
* not a Windows MAPI EntryID; `storeId` is accepted for signature parity and
|
|
12
|
-
* ignored, since macOS has no StoreID and `message id N` resolves against the
|
|
13
|
-
* application rather than one folder.
|
|
14
|
-
*
|
|
15
|
-
* `reply to` builds the quoted body Outlook itself would have — the same thing
|
|
16
|
-
* COM's Reply() returns — so the insertion point is the one place the two
|
|
17
|
-
* platforms have to agree, and both look for WordSection1 then `<body>`.
|
|
6
|
+
* Reply to an email with the composed HTML above the quoted original.
|
|
18
7
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
8
|
+
* `reply to` builds the same quoted body COM's Reply() returns, so the insertion
|
|
9
|
+
* point is the one thing the platforms must agree on (see WORD_SECTION_ANCHOR).
|
|
10
|
+
* `to` comes back as the reply's resolved addresses: Outlook for Mac exposes
|
|
11
|
+
* recipients as records, and the address is the half worth checking.
|
|
22
12
|
*/
|
|
23
|
-
export declare function replyOutlookEmail(
|
|
13
|
+
export declare function replyOutlookEmail(request: ReplyRequest): Promise<ReplyEmailResult>;
|
package/dist/mac/send.js
CHANGED
|
@@ -5,90 +5,74 @@ exports.replyOutlookEmail = replyOutlookEmail;
|
|
|
5
5
|
// Composing outgoing mail on macOS: a new email, and a reply to an existing one.
|
|
6
6
|
const run_1 = require("./run");
|
|
7
7
|
const scripts_1 = require("./scripts");
|
|
8
|
-
const
|
|
9
|
-
const signatures_1 = require("./signatures");
|
|
10
|
-
const templates_1 = require("./templates");
|
|
11
|
-
/** Split a To/CC string the way the Windows contract accepts it. */
|
|
12
|
-
function splitAddresses(s) {
|
|
13
|
-
return s.split(/[,;]+/).map(x => x.trim()).filter(Boolean);
|
|
14
|
-
}
|
|
8
|
+
const args_1 = require("../shared/args");
|
|
15
9
|
/**
|
|
16
|
-
* What to do with a composed
|
|
10
|
+
* What to do with a composed message.
|
|
17
11
|
*
|
|
18
|
-
* A new outgoing message lands in Temporary Items, not Drafts — `open`
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* confirmed to have grown rather than risk reporting a draft that doesn't exist.
|
|
12
|
+
* A new outgoing message lands in Temporary Items, not Drafts — `open` only
|
|
13
|
+
* shows it — so a windowless draft is moved into Drafts explicitly. `move`
|
|
14
|
+
* reports success even where it silently does nothing, so the folder is
|
|
15
|
+
* confirmed to have grown rather than report a draft that doesn't exist.
|
|
23
16
|
*/
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
function dispose(variable, disposition) {
|
|
18
|
+
switch (disposition) {
|
|
19
|
+
case 'send':
|
|
20
|
+
return { prelude: '', action: ` send ${variable}` };
|
|
21
|
+
case 'display':
|
|
22
|
+
return { prelude: '', action: ` open ${variable}` };
|
|
23
|
+
case 'save':
|
|
24
|
+
return {
|
|
25
|
+
prelude: ` set draftsFolder to drafts of targetAcct
|
|
31
26
|
set draftsBefore to count of messages of draftsFolder`,
|
|
32
|
-
|
|
27
|
+
action: ` move ${variable} to draftsFolder
|
|
33
28
|
if (count of messages of draftsFolder) is not greater than draftsBefore then error "Outlook did not file the draft in the Drafts folder."`,
|
|
34
|
-
|
|
29
|
+
};
|
|
30
|
+
}
|
|
35
31
|
}
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
32
|
+
/** One `make new … recipient` line per entry, keeping a display name when given. */
|
|
33
|
+
function recipientLines(kind, entries) {
|
|
34
|
+
return entries.map(entry => {
|
|
35
|
+
const { name, address } = (0, args_1.parseRecipient)(entry);
|
|
36
|
+
const emailAddress = name
|
|
37
|
+
? `{name:${(0, run_1.asString)(name)}, address:${(0, run_1.asString)(address)}}`
|
|
38
|
+
: `{address:${(0, run_1.asString)(address)}}`;
|
|
39
|
+
return ` make new ${kind} recipient at newMsg with properties {email address:${emailAddress}}`;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** Send, display or file a new email. */
|
|
43
|
+
async function sendOutlookEmail(request) {
|
|
44
|
+
const acct = await (0, scripts_1.resolveMacAccount)(request.account);
|
|
45
|
+
const { prelude, action } = dispose('newMsg', request.disposition);
|
|
46
|
+
const lines = [
|
|
47
|
+
...recipientLines('to', request.to),
|
|
48
|
+
...recipientLines('cc', request.cc),
|
|
49
|
+
...recipientLines('bcc', request.bcc),
|
|
50
|
+
...request.attachments.map(file => ` make new attachment at newMsg with properties {file:POSIX file ${(0, run_1.asString)(file)}}`),
|
|
51
|
+
];
|
|
52
|
+
await (0, run_1.runOsaScript)(`
|
|
54
53
|
tell application "Microsoft Outlook"
|
|
55
|
-
${(0, scripts_1.accountLookupSnippet)(
|
|
54
|
+
${(0, scripts_1.accountLookupSnippet)(acct, true)}
|
|
56
55
|
${prelude}
|
|
57
|
-
set newMsg to make new outgoing message with properties {subject
|
|
58
|
-
${
|
|
56
|
+
set newMsg to make new outgoing message with properties {subject:${(0, run_1.asString)(request.subject)}, content:${(0, run_1.asString)(request.htmlBody)}}
|
|
57
|
+
${lines.join('\n')}
|
|
59
58
|
set account of newMsg to targetAcct
|
|
60
|
-
${attachLine}
|
|
61
59
|
${action}
|
|
62
|
-
end tell
|
|
63
|
-
await (0, run_1.runOsaScript)(script, 120000);
|
|
60
|
+
end tell`, 'standard');
|
|
64
61
|
}
|
|
65
62
|
/**
|
|
66
|
-
* Reply to an email
|
|
67
|
-
*
|
|
68
|
-
* `entryId` is Outlook for Mac's small integer message id (see readInboxEmails),
|
|
69
|
-
* not a Windows MAPI EntryID; `storeId` is accepted for signature parity and
|
|
70
|
-
* ignored, since macOS has no StoreID and `message id N` resolves against the
|
|
71
|
-
* application rather than one folder.
|
|
63
|
+
* Reply to an email with the composed HTML above the quoted original.
|
|
72
64
|
*
|
|
73
|
-
* `reply to` builds the quoted body
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* The `to` line is the reply's resolved recipient addresses rather than the
|
|
78
|
-
* display-name string Windows reports: Outlook for Mac exposes recipients as
|
|
79
|
-
* records, and an address is the more useful half to verify against.
|
|
65
|
+
* `reply to` builds the same quoted body COM's Reply() returns, so the insertion
|
|
66
|
+
* point is the one thing the platforms must agree on (see WORD_SECTION_ANCHOR).
|
|
67
|
+
* `to` comes back as the reply's resolved addresses: Outlook for Mac exposes
|
|
68
|
+
* recipients as records, and the address is the half worth checking.
|
|
80
69
|
*/
|
|
81
|
-
async function replyOutlookEmail(
|
|
82
|
-
const id = (0, scripts_1.macMessageId)(
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
});
|
|
88
|
-
const { prelude, action } = composeAction('theReply', params.sendImmediately, params.openDraftWindow);
|
|
89
|
-
const replyAll = params.replyAll ? 'reply to all true' : 'without reply to all';
|
|
90
|
-
const script = `tell application "Microsoft Outlook"
|
|
91
|
-
${(0, scripts_1.accountLookupSnippet)(params.emailAccount)}
|
|
70
|
+
async function replyOutlookEmail(request) {
|
|
71
|
+
const id = (0, scripts_1.macMessageId)(request.email.entryId);
|
|
72
|
+
const acct = await (0, scripts_1.resolveMacAccount)(request.account);
|
|
73
|
+
const { prelude, action } = dispose('theReply', request.disposition);
|
|
74
|
+
const raw = await (0, run_1.runOsaScript)(`tell application "Microsoft Outlook"
|
|
75
|
+
${(0, scripts_1.accountLookupSnippet)(acct, true)}
|
|
92
76
|
${(0, scripts_1.messageLookupSnippet)(id)}
|
|
93
77
|
set repliedTo to ""
|
|
94
78
|
try
|
|
@@ -98,16 +82,14 @@ ${(0, scripts_1.messageLookupSnippet)(id)}
|
|
|
98
82
|
set repliedTo to (address of origSender) as string
|
|
99
83
|
end try
|
|
100
84
|
${prelude}
|
|
101
|
-
set theReply to reply to theMsg opening window false ${replyAll}
|
|
102
|
-
-- Neither of these is wrapped in a try
|
|
103
|
-
--
|
|
104
|
-
--
|
|
105
|
-
-- caller's text missing — the two failures this package exists to prevent,
|
|
106
|
-
-- both of them invisible to the caller if tolerated here.
|
|
85
|
+
set theReply to reply to theMsg opening window false ${request.replyAll ? 'reply to all true' : 'without reply to all'}
|
|
86
|
+
-- Neither of these is wrapped in a try. A swallowed account assignment sends
|
|
87
|
+
-- from the default mailbox, and a swallowed insertion files a reply missing
|
|
88
|
+
-- its text — both invisible to the caller if tolerated here.
|
|
107
89
|
set account of theReply to targetAcct
|
|
108
|
-
set content of theReply to my insertAboveQuoted(content of theReply,
|
|
109
|
-
-- Read the outgoing fields BEFORE acting: sending moves the item,
|
|
110
|
-
--
|
|
90
|
+
set content of theReply to my insertAboveQuoted(content of theReply, ${(0, run_1.asString)(request.html)})
|
|
91
|
+
-- Read the outgoing fields BEFORE acting: sending moves the item, and the
|
|
92
|
+
-- reference can't be read afterwards.
|
|
111
93
|
set toList to {}
|
|
112
94
|
try
|
|
113
95
|
repeat with r in (every to recipient of theReply)
|
|
@@ -124,12 +106,8 @@ ${prelude}
|
|
|
124
106
|
end try
|
|
125
107
|
${action}
|
|
126
108
|
return my sanitize(toLine) & (character id 31) & my sanitize(subj) & (character id 31) & my sanitize(repliedTo)
|
|
127
|
-
end tell
|
|
128
|
-
const parts = (0, run_1.splitFields)(
|
|
129
|
-
return {
|
|
130
|
-
to: (0, run_1.field)(parts, 0),
|
|
131
|
-
subject: (0, run_1.field)(parts, 1),
|
|
132
|
-
repliedToSender: (0, run_1.field)(parts, 2),
|
|
133
|
-
};
|
|
109
|
+
end tell`, 'standard');
|
|
110
|
+
const parts = (0, run_1.splitFields)(raw);
|
|
111
|
+
return { to: (0, run_1.field)(parts, 0), subject: (0, run_1.field)(parts, 1), repliedToSender: (0, run_1.field)(parts, 2) };
|
|
134
112
|
}
|
|
135
113
|
//# sourceMappingURL=send.js.map
|
package/dist/mac/send.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../src/mac/send.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../src/mac/send.ts"],"names":[],"mappings":";;AA2CA,4CAkBC;AAUD,8CA0CC;AAjHD,iFAAiF;AACjF,+BAAmE;AACnE,uCAAwG;AACxG,yCAAgD;AAIhD;;;;;;;GAOG;AACH,SAAS,OAAO,CAAC,QAAgB,EAAE,WAAwB;IACvD,QAAQ,WAAW,EAAE,CAAC;QAClB,KAAK,MAAM;YACP,OAAO,EAAC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,QAAQ,EAAE,EAAC,CAAC;QACzD,KAAK,SAAS;YACV,OAAO,EAAC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,QAAQ,EAAE,EAAC,CAAC;QACzD,KAAK,MAAM;YACP,OAAO;gBACH,OAAO,EAAE;0DACiC;gBAC1C,MAAM,EAAE,YAAY,QAAQ;8IACkG;aACjI,CAAC;IACV,CAAC;AACL,CAAC;AAED,oFAAoF;AACpF,SAAS,cAAc,CAAC,IAAyB,EAAE,OAA0B;IACzE,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACvB,MAAM,EAAC,IAAI,EAAE,OAAO,EAAC,GAAG,IAAA,qBAAc,EAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,IAAI;YACrB,CAAC,CAAC,SAAS,IAAA,cAAQ,EAAC,IAAI,CAAC,aAAa,IAAA,cAAQ,EAAC,OAAO,CAAC,GAAG;YAC1D,CAAC,CAAC,YAAY,IAAA,cAAQ,EAAC,OAAO,CAAC,GAAG,CAAC;QACvC,OAAO,gBAAgB,IAAI,uDAAuD,YAAY,GAAG,CAAC;IACtG,CAAC,CAAC,CAAC;AACP,CAAC;AAED,yCAAyC;AAClC,KAAK,UAAU,gBAAgB,CAAC,OAAoB;IACvD,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAiB,EAAC,OAAO,CAAC,OAAO,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AO;2DACkD,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,sBAAsB;;;;;2EAK/C,IAAA,cAAQ,EAAC,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;EAiB/F,MAAM;;SAEC,EAAE,UAAU,CAAC,CAAC;IACnB,MAAM,KAAK,GAAG,IAAA,iBAAW,EAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,EAAC,EAAE,EAAE,IAAA,WAAK,EAAC,KAAK,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAA,WAAK,EAAC,KAAK,EAAE,CAAC,CAAC,EAAE,eAAe,EAAE,IAAA,WAAK,EAAC,KAAK,EAAE,CAAC,CAAC,EAAC,CAAC;AAC7F,CAAC","sourcesContent":["// Composing outgoing mail on macOS: a new email, and a reply to an existing one.\nimport { asString, field, runOsaScript, splitFields } from './run';\nimport { accountLookupSnippet, macMessageId, messageLookupSnippet, resolveMacAccount } from './scripts';\nimport { parseRecipient } from '../shared/args';\nimport type { Disposition, ReplyRequest, SendRequest } from '../backend';\nimport type { ReplyEmailResult } from '../types';\n\n/**\n * What to do with a composed message.\n *\n * A new outgoing message lands in Temporary Items, not Drafts — `open` only\n * shows it — so a windowless draft is moved into Drafts explicitly. `move`\n * reports success even where it silently does nothing, so the folder is\n * confirmed to have grown rather than report a draft that doesn't exist.\n */\nfunction dispose(variable: string, disposition: Disposition): { prelude: string; action: string } {\n switch (disposition) {\n case 'send':\n return {prelude: '', action: ` send ${variable}`};\n case 'display':\n return {prelude: '', action: ` open ${variable}`};\n case 'save':\n return {\n prelude: ` set draftsFolder to drafts of targetAcct\n set draftsBefore to count of messages of draftsFolder`,\n action: ` move ${variable} to draftsFolder\n if (count of messages of draftsFolder) is not greater than draftsBefore then error \"Outlook did not file the draft in the Drafts folder.\"`,\n };\n }\n}\n\n/** One `make new … recipient` line per entry, keeping a display name when given. */\nfunction recipientLines(kind: 'to' | 'cc' | 'bcc', entries: readonly string[]): string[] {\n return entries.map(entry => {\n const {name, address} = parseRecipient(entry);\n const emailAddress = name\n ? `{name:${asString(name)}, address:${asString(address)}}`\n : `{address:${asString(address)}}`;\n return ` make new ${kind} recipient at newMsg with properties {email address:${emailAddress}}`;\n });\n}\n\n/** Send, display or file a new email. */\nexport async function sendOutlookEmail(request: SendRequest): Promise<void> {\n const acct = await resolveMacAccount(request.account);\n const {prelude, action} = dispose('newMsg', request.disposition);\n const lines = [\n ...recipientLines('to', request.to),\n ...recipientLines('cc', request.cc),\n ...recipientLines('bcc', request.bcc),\n ...request.attachments.map(file => ` make new attachment at newMsg with properties {file:POSIX file ${asString(file)}}`),\n ];\n await runOsaScript(`\ntell application \"Microsoft Outlook\"\n${accountLookupSnippet(acct, true)}\n${prelude}\n set newMsg to make new outgoing message with properties {subject:${asString(request.subject)}, content:${asString(request.htmlBody)}}\n${lines.join('\\n')}\n set account of newMsg to targetAcct\n${action}\nend tell`, 'standard');\n}\n\n/**\n * Reply to an email with the composed HTML above the quoted original.\n *\n * `reply to` builds the same quoted body COM's Reply() returns, so the insertion\n * point is the one thing the platforms must agree on (see WORD_SECTION_ANCHOR).\n * `to` comes back as the reply's resolved addresses: Outlook for Mac exposes\n * recipients as records, and the address is the half worth checking.\n */\nexport async function replyOutlookEmail(request: ReplyRequest): Promise<ReplyEmailResult> {\n const id = macMessageId(request.email.entryId);\n const acct = await resolveMacAccount(request.account);\n const {prelude, action} = dispose('theReply', request.disposition);\n const raw = await runOsaScript(`tell application \"Microsoft Outlook\"\n${accountLookupSnippet(acct, true)}\n${messageLookupSnippet(id)}\n set repliedTo to \"\"\n try\n -- Bind the record before reading its field: a nested\n -- 'address of (sender of theMsg)' does not coerce.\n set origSender to sender of theMsg\n set repliedTo to (address of origSender) as string\n end try\n${prelude}\n set theReply to reply to theMsg opening window false ${request.replyAll ? 'reply to all true' : 'without reply to all'}\n -- Neither of these is wrapped in a try. A swallowed account assignment sends\n -- from the default mailbox, and a swallowed insertion files a reply missing\n -- its text — both invisible to the caller if tolerated here.\n set account of theReply to targetAcct\n set content of theReply to my insertAboveQuoted(content of theReply, ${asString(request.html)})\n -- Read the outgoing fields BEFORE acting: sending moves the item, and the\n -- reference can't be read afterwards.\n set toList to {}\n try\n repeat with r in (every to recipient of theReply)\n try\n set ea to email address of r\n set end of toList to (address of ea) as string\n end try\n end repeat\n end try\n set toLine to my joinList(toList, \", \")\n set subj to \"\"\n try\n set subj to (subject of theReply) as string\n end try\n${action}\n return my sanitize(toLine) & (character id 31) & my sanitize(subj) & (character id 31) & my sanitize(repliedTo)\nend tell`, 'standard');\n const parts = splitFields(raw);\n return {to: field(parts, 0), subject: field(parts, 1), repliedToSender: field(parts, 2)};\n}\n"]}
|
package/dist/mac/signatures.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** The signature names, sorted. */
|
|
2
2
|
export declare function listOutlookSignatures(): Promise<string[]>;
|
|
3
|
-
/**
|
|
3
|
+
/** A signature's HTML; '' when there is no signature by that name. */
|
|
4
4
|
export declare function readOutlookSignatureHtml(name: string): Promise<string>;
|
package/dist/mac/signatures.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listOutlookSignatures = listOutlookSignatures;
|
|
4
4
|
exports.readOutlookSignatureHtml = readOutlookSignatureHtml;
|
|
5
|
-
//
|
|
6
|
-
//
|
|
5
|
+
// Outlook for Mac serves signatures through AppleScript, images included
|
|
6
|
+
// (inline data or remote references), where Windows keeps them as files.
|
|
7
7
|
const run_1 = require("./run");
|
|
8
|
-
/**
|
|
8
|
+
/** The signature names, sorted. */
|
|
9
9
|
async function listOutlookSignatures() {
|
|
10
|
-
const
|
|
10
|
+
const raw = await (0, run_1.runOsaScript)(`
|
|
11
11
|
set sigNames to {}
|
|
12
12
|
tell application "Microsoft Outlook"
|
|
13
13
|
try
|
|
@@ -17,20 +17,18 @@ tell application "Microsoft Outlook"
|
|
|
17
17
|
end try
|
|
18
18
|
end tell
|
|
19
19
|
set AppleScript's text item delimiters to linefeed
|
|
20
|
-
return sigNames as string
|
|
21
|
-
const raw = await (0, run_1.runOsaScript)(script, 15000);
|
|
20
|
+
return sigNames as string`, 'quick');
|
|
22
21
|
return raw.split('\n').map(s => s.trim()).filter(Boolean).sort((a, b) => a.localeCompare(b));
|
|
23
22
|
}
|
|
24
|
-
/**
|
|
23
|
+
/** A signature's HTML; '' when there is no signature by that name. */
|
|
25
24
|
async function readOutlookSignatureHtml(name) {
|
|
26
|
-
|
|
25
|
+
return (0, run_1.runOsaScript)(`
|
|
27
26
|
tell application "Microsoft Outlook"
|
|
28
27
|
try
|
|
29
|
-
return content of (first signature whose name is
|
|
28
|
+
return content of (first signature whose name is ${(0, run_1.asString)(name)})
|
|
30
29
|
on error
|
|
31
30
|
return ""
|
|
32
31
|
end try
|
|
33
|
-
end tell
|
|
34
|
-
return (0, run_1.runOsaScript)(script, 15000);
|
|
32
|
+
end tell`, 'quick');
|
|
35
33
|
}
|
|
36
34
|
//# sourceMappingURL=signatures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatures.js","sourceRoot":"","sources":["../../src/mac/signatures.ts"],"names":[],"mappings":";;AAKA,
|
|
1
|
+
{"version":3,"file":"signatures.js","sourceRoot":"","sources":["../../src/mac/signatures.ts"],"names":[],"mappings":";;AAKA,sDAaC;AAGD,4DASC;AA9BD,yEAAyE;AACzE,yEAAyE;AACzE,+BAA+C;AAE/C,mCAAmC;AAC5B,KAAK,UAAU,qBAAqB;IACvC,MAAM,GAAG,GAAG,MAAM,IAAA,kBAAY,EAAC;;;;;;;;;;0BAUT,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC;AAED,sEAAsE;AAC/D,KAAK,UAAU,wBAAwB,CAAC,IAAY;IACvD,OAAO,IAAA,kBAAY,EAAC;;;2DAGmC,IAAA,cAAQ,EAAC,IAAI,CAAC;;;;SAIhE,EAAE,OAAO,CAAC,CAAC;AACpB,CAAC","sourcesContent":["// Outlook for Mac serves signatures through AppleScript, images included\n// (inline data or remote references), where Windows keeps them as files.\nimport { asString, runOsaScript } from './run';\n\n/** The signature names, sorted. */\nexport async function listOutlookSignatures(): Promise<string[]> {\n const raw = await runOsaScript(`\nset sigNames to {}\ntell application \"Microsoft Outlook\"\n try\n repeat with s in signatures\n set end of sigNames to (name of s as string)\n end repeat\n end try\nend tell\nset AppleScript's text item delimiters to linefeed\nreturn sigNames as string`, 'quick');\n return raw.split('\\n').map(s => s.trim()).filter(Boolean).sort((a, b) => a.localeCompare(b));\n}\n\n/** A signature's HTML; '' when there is no signature by that name. */\nexport async function readOutlookSignatureHtml(name: string): Promise<string> {\n return runOsaScript(`\ntell application \"Microsoft Outlook\"\n try\n return content of (first signature whose name is ${asString(name)})\n on error\n return \"\"\n end try\nend tell`, 'quick');\n}\n"]}
|
package/dist/mac/templates.d.ts
CHANGED
|
@@ -1,34 +1,22 @@
|
|
|
1
|
+
import type { EditTemplateRequest, ReadTemplatesRequest, SaveTemplateRequest } from '../backend';
|
|
1
2
|
import type { SaveTemplateResult, TemplateFolderResult } from '../types';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* folderFound:false plus the mailbox's folder names instead of throwing, so the
|
|
6
|
-
* caller can ask the user whether to create it rather than fail.
|
|
4
|
+
* The template emails in a mailbox folder, newest first; a missing folder is
|
|
5
|
+
* reported as folderFound:false with the mailbox's top-level folder names.
|
|
7
6
|
*
|
|
8
|
-
* Bodies are read in a second pass, for the chosen templates only
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the buffer — the same reason the Windows reader filters before reading.
|
|
7
|
+
* Bodies are read in a second pass, for the chosen templates only: a folder of
|
|
8
|
+
* Word-sized templates is megabytes, and pulling all of them through stdout on
|
|
9
|
+
* a call that wanted one is what overruns the output limit.
|
|
12
10
|
*/
|
|
13
|
-
export declare function readTemplateEmails(
|
|
11
|
+
export declare function readTemplateEmails(request: ReadTemplatesRequest): Promise<TemplateFolderResult>;
|
|
14
12
|
/**
|
|
15
|
-
* Save a new template email into a
|
|
16
|
-
*
|
|
17
|
-
* plain unsent mail (subject + HTML body) that can be edited in Outlook.
|
|
18
|
-
* Never overwrites an existing item — it always adds a new one, so check with
|
|
19
|
-
* readTemplateEmails first and only call after the user has agreed to create it.
|
|
13
|
+
* Save a new template email into a folder, creating the folder at the mailbox
|
|
14
|
+
* root when absent. Always adds a new item — never overwrites one.
|
|
20
15
|
*/
|
|
21
|
-
export declare function saveTemplateEmail(
|
|
16
|
+
export declare function saveTemplateEmail(request: SaveTemplateRequest): Promise<SaveTemplateResult>;
|
|
22
17
|
/**
|
|
23
|
-
* Open
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* Deliberately unbounded: the run lasts as long as the person is editing. Give
|
|
27
|
-
* it an AbortSignal (`bridge.withOptions({ signal })`) if the caller needs a way
|
|
28
|
-
* to give up on them.
|
|
29
|
-
*
|
|
30
|
-
* The macOS half of the round trip differs from Windows in one visible way: an
|
|
31
|
-
* edited draft is filed by answering Outlook's own "save this message?" prompt
|
|
32
|
-
* on close, so the subject tells the user to save rather than to press a key.
|
|
18
|
+
* Open a compose window pre-filled with the HTML, wait for it to close, and
|
|
19
|
+
* return the saved draft's HTML. On macOS the edit is kept by answering
|
|
20
|
+
* Outlook's own "save this message?" prompt on close.
|
|
33
21
|
*/
|
|
34
|
-
export declare function editEmailTemplate(
|
|
22
|
+
export declare function editEmailTemplate(request: EditTemplateRequest): Promise<string>;
|