@dawnlit/outlook-bridge 1.1.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -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 +79 -43
- package/dist/errors.js +93 -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 +96 -117
- package/dist/mac/bounces.js.map +1 -1
- package/dist/mac/cleanup.d.ts +11 -25
- package/dist/mac/cleanup.js +44 -107
- package/dist/mac/cleanup.js.map +1 -1
- package/dist/mac/drafts.d.ts +15 -34
- package/dist/mac/drafts.js +113 -186
- package/dist/mac/drafts.js.map +1 -1
- package/dist/mac/folders.d.ts +12 -21
- package/dist/mac/folders.js +44 -59
- 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 +21 -37
- package/dist/mac/read.js +198 -216
- package/dist/mac/read.js.map +1 -1
- package/dist/mac/run.d.ts +51 -38
- package/dist/mac/run.js +138 -103
- package/dist/mac/run.js.map +1 -1
- package/dist/mac/scripts.d.ts +90 -91
- package/dist/mac/scripts.js +167 -126
- package/dist/mac/scripts.js.map +1 -1
- package/dist/mac/send.d.ts +10 -20
- package/dist/mac/send.js +99 -89
- 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 +79 -120
- package/dist/mac/templates.js.map +1 -1
- package/dist/mail.d.ts +80 -46
- package/dist/mail.js +179 -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 +26 -20
- package/dist/shared/attachmentMatch.js +60 -23
- 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 +17 -6
- package/dist/shared/json.js +35 -24
- package/dist/shared/json.js.map +1 -1
- package/dist/shared/locate.d.ts +31 -0
- package/dist/shared/locate.js +128 -0
- package/dist/shared/locate.js.map +1 -0
- package/dist/shared/replyBody.d.ts +31 -36
- package/dist/shared/replyBody.js +83 -72
- 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 +69 -0
- package/dist/{outlookTemplateSections.js → templateBody.js} +80 -73
- package/dist/templateBody.js.map +1 -0
- package/dist/types.d.ts +381 -168
- package/dist/types.js +8 -9
- package/dist/types.js.map +1 -1
- package/dist/windows/accounts.d.ts +7 -12
- package/dist/windows/accounts.js +19 -34
- 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 +168 -200
- package/dist/windows/bounces.js.map +1 -1
- package/dist/windows/cleanup.d.ts +23 -23
- package/dist/windows/cleanup.js +99 -113
- package/dist/windows/cleanup.js.map +1 -1
- package/dist/windows/drafts.d.ts +16 -35
- package/dist/windows/drafts.js +156 -253
- package/dist/windows/drafts.js.map +1 -1
- package/dist/windows/folders.d.ts +8 -13
- package/dist/windows/folders.js +44 -52
- package/dist/windows/folders.js.map +1 -1
- package/dist/windows/index.d.ts +2 -27
- package/dist/windows/index.js +11 -66
- package/dist/windows/index.js.map +1 -1
- package/dist/windows/read.d.ts +24 -60
- package/dist/windows/read.js +265 -306
- package/dist/windows/read.js.map +1 -1
- package/dist/windows/run.d.ts +38 -40
- package/dist/windows/run.js +151 -112
- package/dist/windows/run.js.map +1 -1
- package/dist/windows/scripts.d.ts +65 -55
- package/dist/windows/scripts.js +109 -85
- package/dist/windows/scripts.js.map +1 -1
- package/dist/windows/send.d.ts +9 -9
- package/dist/windows/send.js +76 -88
- 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 +117 -150
- 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.d.ts
CHANGED
|
@@ -1,106 +1,113 @@
|
|
|
1
|
-
import type { MailFolderRef } from '../types';
|
|
1
|
+
import type { ItemFailure, MailFolderRef } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* `tell application "Microsoft Outlook"` block; binds `targetAcct`.
|
|
3
|
+
* An account as the generated AppleScript reaches it.
|
|
5
4
|
*
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* `folderIds` carries what Outlook's profile database knows about the mailbox's
|
|
6
|
+
* well-known folders — the only handle on a mailbox the dictionary publishes no
|
|
7
|
+
* account object for (see profile.ts). It is filled in for every account the
|
|
8
|
+
* profile lists, because the generated script chooses between the account
|
|
9
|
+
* object and the folder id at run time; nothing here has to predict which kinds
|
|
10
|
+
* of account a given Outlook build exposes.
|
|
12
11
|
*/
|
|
13
|
-
export
|
|
12
|
+
export interface MacAccount {
|
|
13
|
+
readonly emailAccount: string;
|
|
14
|
+
readonly folderIds?: Readonly<Record<string, number>>;
|
|
15
|
+
}
|
|
16
|
+
/** Look an address up in Outlook's profile database, for the folder ids it can add. */
|
|
17
|
+
export declare function resolveMacAccount(emailAccount: string): Promise<MacAccount>;
|
|
14
18
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
19
|
+
* Resolve the account whose address matches into `targetAcct`, inside a
|
|
20
|
+
* `tell application "Microsoft Outlook"` block.
|
|
21
|
+
*
|
|
22
|
+
* `every account` errors even in legacy mode, so the typed classes are probed.
|
|
23
|
+
* A `whose email address is …` filter can't be used either: `email address` is
|
|
24
|
+
* also a class name, and AppleScript resolves it as one.
|
|
17
25
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
26
|
+
* A mailbox the dictionary publishes no account object for leaves `targetAcct`
|
|
27
|
+
* as `missing value` rather than failing, provided the profile gave a folder id
|
|
28
|
+
* to reach it by. `needsAccountObject` is for composing mail, which can't work
|
|
29
|
+
* without the object: the account a message is sent from can only be set from
|
|
30
|
+
* it, and a message composed without it goes out from the default mailbox.
|
|
31
|
+
*/
|
|
32
|
+
export declare function accountLookupSnippet(acct: MacAccount, needsAccountObject?: boolean): string;
|
|
33
|
+
/**
|
|
34
|
+
* Bind `variable` to one of the account's well-known folders: through the
|
|
35
|
+
* account object when the probe found one, else by the folder's own id. `mail
|
|
36
|
+
* folder id N` resolves against the application rather than an account, and N is
|
|
37
|
+
* the id Outlook's profile database records for that folder.
|
|
38
|
+
*/
|
|
39
|
+
export declare function rootFolderSnippet(acct: MacAccount, term: string, variable: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Outlook for Mac's dictionary term for each well-known root, by olDefaultFolders
|
|
42
|
+
* id. Verified against the running app: the terms are NOT what the Windows names
|
|
43
|
+
* suggest — `sent mail` and `junk email` don't compile, `sent items` and `junk
|
|
44
|
+
* mail` do — and one bad term fails the whole script at compile time.
|
|
22
45
|
*/
|
|
23
|
-
export declare const MAC_ROOT_TERMS: Record<number, string
|
|
24
|
-
/** The date property a
|
|
46
|
+
export declare const MAC_ROOT_TERMS: Readonly<Record<number, string>>;
|
|
47
|
+
/** The date property a root's items carry. */
|
|
25
48
|
export declare function dateProperty(rootId: number): string;
|
|
26
49
|
/**
|
|
27
|
-
* The Windows
|
|
28
|
-
*
|
|
29
|
-
*
|
|
50
|
+
* The Windows folder-path shape (`\\mailbox\Inbox\Invoices`), assembled in
|
|
51
|
+
* TypeScript: escaping backslashes through a template literal and then an
|
|
52
|
+
* AppleScript literal is unreadable, and the parts are known here anyway.
|
|
30
53
|
*/
|
|
31
|
-
export declare function macFolderPath(emailAccount: string, rootLabel: string, segments: string[]): string;
|
|
32
|
-
/** The dictionary term for a root, or a NOT_IMPLEMENTED naming what was asked. */
|
|
33
|
-
export declare function rootTerm(ref: MailFolderRef, folderLabel?: string): string;
|
|
54
|
+
export declare function macFolderPath(emailAccount: string, rootLabel: string, segments: readonly string[]): string;
|
|
34
55
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
56
|
+
* Walk a folder's `container` chain to the top as the list `chainNames`,
|
|
57
|
+
* nearest first. Requires `theFolder`, and leaves `cur` on the folder the walk
|
|
58
|
+
* stopped at: the account's nameless root folder, when it got that far.
|
|
38
59
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* returning the Inbox for a caller that scoped to one folder hands back the wrong
|
|
43
|
-
* emails under a name that says otherwise. `createMissing` builds the whole
|
|
44
|
-
* chain instead, so a nested destination is one call.
|
|
60
|
+
* The chain's last element is the folder directly under the account, and an
|
|
61
|
+
* account can't hold two top-level folders of one name, so comparing that name
|
|
62
|
+
* is exact.
|
|
45
63
|
*/
|
|
46
|
-
export declare function
|
|
64
|
+
export declare function folderChainSnippet(indent: string): string;
|
|
47
65
|
/**
|
|
48
|
-
*
|
|
66
|
+
* Resolve `scopeFolder` from `targetAcct`: a well-known root walked down through
|
|
67
|
+
* any further segments. Also binds `scopeCreated`.
|
|
49
68
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
69
|
+
* Names compare with `is`, which is case-insensitive in AppleScript, matching
|
|
70
|
+
* the Windows walk. A missing segment fails as NOT_FOUND rather than falling
|
|
71
|
+
* back to the root; `createMissing` builds the chain instead.
|
|
53
72
|
*/
|
|
54
|
-
export declare function
|
|
73
|
+
export declare function mailScopeSnippet(acct: MacAccount, ref: MailFolderRef, folderLabel?: string, createMissing?: boolean): string;
|
|
55
74
|
/**
|
|
56
|
-
*
|
|
75
|
+
* The message id text for a script, or INVALID_REQUEST.
|
|
57
76
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
77
|
+
* Outlook for Mac ids are small integers; a Windows EntryID is refused up front
|
|
78
|
+
* rather than left to fail as a confusing "not found", because a caller that
|
|
79
|
+
* persisted one from a Windows run needs to be told exactly that.
|
|
80
|
+
*/
|
|
81
|
+
export declare function macMessageId(entryId: string): string;
|
|
82
|
+
/**
|
|
83
|
+
* Split ids into those a script can look up and those that can only fail. A
|
|
84
|
+
* batch reports an unusable id beside a genuine miss rather than throwing and
|
|
85
|
+
* discarding the ids that would have worked.
|
|
61
86
|
*/
|
|
62
87
|
export declare function partitionMessageIds(entryIds: readonly string[]): {
|
|
63
88
|
valid: string[];
|
|
64
|
-
invalid:
|
|
65
|
-
entryId: string;
|
|
66
|
-
error: string;
|
|
67
|
-
}[];
|
|
89
|
+
invalid: ItemFailure[];
|
|
68
90
|
};
|
|
69
91
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* `message id N` resolves against the application rather than one folder, so the
|
|
73
|
-
* message is found wherever it currently sits — including a subfolder.
|
|
92
|
+
* Bind `theMsg` to a message id, or fail as NOT_FOUND. `message id N` resolves
|
|
93
|
+
* against the application, so the message is found wherever it sits.
|
|
74
94
|
*/
|
|
75
|
-
export declare function messageLookupSnippet(id: string
|
|
95
|
+
export declare function messageLookupSnippet(id: string): string;
|
|
76
96
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* `sender` yields a record, and `address of sender of m` fails to coerce, so the
|
|
80
|
-
* record has to be bound first. `name` is absent when there is no display name.
|
|
97
|
+
* `theMsg`'s sender as `sndName` / `sndAddr`. `sender` is a record, and
|
|
98
|
+
* `address of sender of m` doesn't coerce, so the record is bound first.
|
|
81
99
|
*/
|
|
82
|
-
export declare function senderSnippet(
|
|
100
|
+
export declare function senderSnippet(indent?: string): string;
|
|
83
101
|
/**
|
|
84
|
-
* Everything a reader wants off
|
|
85
|
-
* row it produces
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* Three callers share it (`readEmailBody`, `readSelectedEmail`, and the
|
|
89
|
-
* attachment resolver) and differ only in how they bind `theMsg`. They used to
|
|
90
|
-
* share it by copy: thirty lines repeated, with the `time received` → `time sent`
|
|
91
|
-
* fallback and the field order restated each time, so a dictionary fix reached
|
|
92
|
-
* one reader and not the others.
|
|
93
|
-
*
|
|
94
|
-
* `bodyText` is emitted LAST when asked for, so a stray separator in an earlier
|
|
95
|
-
* field cannot shift it.
|
|
102
|
+
* Everything a reader wants off one message bound to `theMsg`, emitted together
|
|
103
|
+
* with the row it produces (see `messageDetailFields`) so the read order and the
|
|
104
|
+
* positions the decoders index into cannot drift apart. `bodyText` is emitted
|
|
105
|
+
* LAST when asked for, so a stray separator in an earlier field can't shift it.
|
|
96
106
|
*/
|
|
97
107
|
export declare function messageDetailSnippet(withBody?: boolean, indent?: string): string;
|
|
98
|
-
/**
|
|
99
|
-
* The fields `messageDetailSnippet` fills, in row order. The decoders read them
|
|
100
|
-
* back by the positions in `MessageDetail`.
|
|
101
|
-
*/
|
|
108
|
+
/** The fields `messageDetailSnippet` fills, in row order — see `MessageDetail`. */
|
|
102
109
|
export declare function messageDetailFields(withBody?: boolean): string[];
|
|
103
|
-
/** Where each of those fields lands in the
|
|
110
|
+
/** Where each of those fields lands in the row. */
|
|
104
111
|
export declare const MessageDetail: {
|
|
105
112
|
readonly id: 0;
|
|
106
113
|
readonly subject: 1;
|
|
@@ -111,27 +118,19 @@ export declare const MessageDetail: {
|
|
|
111
118
|
readonly body: 6;
|
|
112
119
|
};
|
|
113
120
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* contract for Sent Items (a folder of mail from yourself is unreadable).
|
|
117
|
-
*/
|
|
118
|
-
export declare function firstRecipientSnippet(messageVariable?: string, indent?: string): string;
|
|
119
|
-
/**
|
|
120
|
-
* Every SMTP address a message was addressed to, as the list `addrList`.
|
|
121
|
-
*
|
|
122
|
-
* `every recipient` covers To, CC and BCC — the full set, which is the whole
|
|
123
|
-
* point of readSentRecipientGroups.
|
|
121
|
+
* `theMsg`'s first recipient as `sndName` / `sndAddr` — what outgoing mail
|
|
122
|
+
* reports in place of a sender.
|
|
124
123
|
*/
|
|
125
|
-
export declare function
|
|
124
|
+
export declare function firstRecipientSnippet(indent?: string): string;
|
|
125
|
+
/** Every address `theMsg` was sent to — To, CC and BCC — as the list `addrList`. */
|
|
126
|
+
export declare function allRecipientsSnippet(indent?: string): string;
|
|
126
127
|
/**
|
|
127
|
-
* Recursive
|
|
128
|
-
*
|
|
129
|
-
* resolve a template folder anywhere in the mailbox tree.
|
|
128
|
+
* Recursive, case-insensitive, depth-capped folder search from `startFolder` —
|
|
129
|
+
* the macOS counterpart of the Windows Find-FolderByName.
|
|
130
130
|
*/
|
|
131
131
|
export declare 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";
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* each class is probed independently and failures are ignored.
|
|
133
|
+
* Enumerate the accounts, probing each class separately: legacy Outlook errors
|
|
134
|
+
* on `every account`, and New Outlook returns empty lists for the classes.
|
|
136
135
|
*/
|
|
137
136
|
export declare 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";
|