@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.
Files changed (142) hide show
  1. package/README.md +152 -183
  2. package/dist/backend.d.ts +151 -0
  3. package/dist/backend.js +3 -0
  4. package/dist/backend.js.map +1 -0
  5. package/dist/bridge.d.ts +56 -0
  6. package/dist/bridge.js +507 -0
  7. package/dist/bridge.js.map +1 -0
  8. package/dist/errors.d.ts +79 -43
  9. package/dist/errors.js +93 -52
  10. package/dist/errors.js.map +1 -1
  11. package/dist/index.d.ts +10 -10
  12. package/dist/index.js +25 -52
  13. package/dist/index.js.map +1 -1
  14. package/dist/mac/accounts.d.ts +7 -2
  15. package/dist/mac/accounts.js +23 -6
  16. package/dist/mac/accounts.js.map +1 -1
  17. package/dist/mac/attachments.d.ts +5 -25
  18. package/dist/mac/attachments.js +40 -99
  19. package/dist/mac/attachments.js.map +1 -1
  20. package/dist/mac/bounces.d.ts +12 -27
  21. package/dist/mac/bounces.js +96 -117
  22. package/dist/mac/bounces.js.map +1 -1
  23. package/dist/mac/cleanup.d.ts +11 -25
  24. package/dist/mac/cleanup.js +44 -107
  25. package/dist/mac/cleanup.js.map +1 -1
  26. package/dist/mac/drafts.d.ts +15 -34
  27. package/dist/mac/drafts.js +113 -186
  28. package/dist/mac/drafts.js.map +1 -1
  29. package/dist/mac/folders.d.ts +12 -21
  30. package/dist/mac/folders.js +44 -59
  31. package/dist/mac/folders.js.map +1 -1
  32. package/dist/mac/index.d.ts +2 -22
  33. package/dist/mac/index.js +19 -81
  34. package/dist/mac/index.js.map +1 -1
  35. package/dist/mac/profile.d.ts +13 -0
  36. package/dist/mac/profile.js +149 -0
  37. package/dist/mac/profile.js.map +1 -0
  38. package/dist/mac/read.d.ts +21 -37
  39. package/dist/mac/read.js +198 -216
  40. package/dist/mac/read.js.map +1 -1
  41. package/dist/mac/run.d.ts +51 -38
  42. package/dist/mac/run.js +138 -103
  43. package/dist/mac/run.js.map +1 -1
  44. package/dist/mac/scripts.d.ts +90 -91
  45. package/dist/mac/scripts.js +167 -126
  46. package/dist/mac/scripts.js.map +1 -1
  47. package/dist/mac/send.d.ts +10 -20
  48. package/dist/mac/send.js +99 -89
  49. package/dist/mac/send.js.map +1 -1
  50. package/dist/mac/signatures.d.ts +2 -2
  51. package/dist/mac/signatures.js +9 -11
  52. package/dist/mac/signatures.js.map +1 -1
  53. package/dist/mac/templates.d.ts +14 -26
  54. package/dist/mac/templates.js +79 -120
  55. package/dist/mac/templates.js.map +1 -1
  56. package/dist/mail.d.ts +80 -46
  57. package/dist/mail.js +179 -73
  58. package/dist/mail.js.map +1 -1
  59. package/dist/runtime.d.ts +76 -43
  60. package/dist/runtime.js +103 -48
  61. package/dist/runtime.js.map +1 -1
  62. package/dist/shared/args.d.ts +48 -0
  63. package/dist/shared/args.js +216 -0
  64. package/dist/shared/args.js.map +1 -0
  65. package/dist/shared/attachmentMatch.d.ts +26 -20
  66. package/dist/shared/attachmentMatch.js +60 -23
  67. package/dist/shared/attachmentMatch.js.map +1 -1
  68. package/dist/shared/bounceReport.d.ts +11 -0
  69. package/dist/shared/bounceReport.js +45 -0
  70. package/dist/shared/bounceReport.js.map +1 -0
  71. package/dist/shared/bounceRules.d.ts +38 -10
  72. package/dist/shared/bounceRules.js +50 -32
  73. package/dist/shared/bounceRules.js.map +1 -1
  74. package/dist/shared/exec.d.ts +21 -0
  75. package/dist/shared/exec.js +47 -0
  76. package/dist/shared/exec.js.map +1 -0
  77. package/dist/shared/json.d.ts +17 -6
  78. package/dist/shared/json.js +35 -24
  79. package/dist/shared/json.js.map +1 -1
  80. package/dist/shared/locate.d.ts +31 -0
  81. package/dist/shared/locate.js +128 -0
  82. package/dist/shared/locate.js.map +1 -0
  83. package/dist/shared/replyBody.d.ts +31 -36
  84. package/dist/shared/replyBody.js +83 -72
  85. package/dist/shared/replyBody.js.map +1 -1
  86. package/dist/shared/templateLimits.d.ts +14 -0
  87. package/dist/shared/templateLimits.js +21 -0
  88. package/dist/shared/templateLimits.js.map +1 -0
  89. package/dist/templateBody.d.ts +69 -0
  90. package/dist/{outlookTemplateSections.js → templateBody.js} +80 -73
  91. package/dist/templateBody.js.map +1 -0
  92. package/dist/types.d.ts +381 -168
  93. package/dist/types.js +8 -9
  94. package/dist/types.js.map +1 -1
  95. package/dist/windows/accounts.d.ts +7 -12
  96. package/dist/windows/accounts.js +19 -34
  97. package/dist/windows/accounts.js.map +1 -1
  98. package/dist/windows/attachments.d.ts +9 -24
  99. package/dist/windows/attachments.js +94 -119
  100. package/dist/windows/attachments.js.map +1 -1
  101. package/dist/windows/bounces.d.ts +13 -26
  102. package/dist/windows/bounces.js +168 -200
  103. package/dist/windows/bounces.js.map +1 -1
  104. package/dist/windows/cleanup.d.ts +23 -23
  105. package/dist/windows/cleanup.js +99 -113
  106. package/dist/windows/cleanup.js.map +1 -1
  107. package/dist/windows/drafts.d.ts +16 -35
  108. package/dist/windows/drafts.js +156 -253
  109. package/dist/windows/drafts.js.map +1 -1
  110. package/dist/windows/folders.d.ts +8 -13
  111. package/dist/windows/folders.js +44 -52
  112. package/dist/windows/folders.js.map +1 -1
  113. package/dist/windows/index.d.ts +2 -27
  114. package/dist/windows/index.js +11 -66
  115. package/dist/windows/index.js.map +1 -1
  116. package/dist/windows/read.d.ts +24 -60
  117. package/dist/windows/read.js +265 -306
  118. package/dist/windows/read.js.map +1 -1
  119. package/dist/windows/run.d.ts +38 -40
  120. package/dist/windows/run.js +151 -112
  121. package/dist/windows/run.js.map +1 -1
  122. package/dist/windows/scripts.d.ts +65 -55
  123. package/dist/windows/scripts.js +109 -85
  124. package/dist/windows/scripts.js.map +1 -1
  125. package/dist/windows/send.d.ts +9 -9
  126. package/dist/windows/send.js +76 -88
  127. package/dist/windows/send.js.map +1 -1
  128. package/dist/windows/signatures.d.ts +4 -10
  129. package/dist/windows/signatures.js +30 -37
  130. package/dist/windows/signatures.js.map +1 -1
  131. package/dist/windows/templates.d.ts +12 -18
  132. package/dist/windows/templates.js +117 -150
  133. package/dist/windows/templates.js.map +1 -1
  134. package/package.json +5 -4
  135. package/dist/OutlookService.d.ts +0 -43
  136. package/dist/OutlookService.js +0 -137
  137. package/dist/OutlookService.js.map +0 -1
  138. package/dist/outlookTemplateSections.d.ts +0 -62
  139. package/dist/outlookTemplateSections.js.map +0 -1
  140. package/dist/shared/capabilities.d.ts +0 -3
  141. package/dist/shared/capabilities.js +0 -9
  142. package/dist/shared/capabilities.js.map +0 -1
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIST_ACCOUNTS_SNIPPET = exports.FIND_FOLDER_HANDLER = exports.MessageDetail = exports.MAC_ROOT_TERMS = void 0;
4
+ exports.resolveMacAccount = resolveMacAccount;
4
5
  exports.accountLookupSnippet = accountLookupSnippet;
6
+ exports.rootFolderSnippet = rootFolderSnippet;
5
7
  exports.dateProperty = dateProperty;
6
8
  exports.macFolderPath = macFolderPath;
7
- exports.rootTerm = rootTerm;
9
+ exports.folderChainSnippet = folderChainSnippet;
8
10
  exports.mailScopeSnippet = mailScopeSnippet;
9
11
  exports.macMessageId = macMessageId;
10
12
  exports.partitionMessageIds = partitionMessageIds;
@@ -16,125 +18,193 @@ exports.firstRecipientSnippet = firstRecipientSnippet;
16
18
  exports.allRecipientsSnippet = allRecipientsSnippet;
17
19
  // The AppleScript fragments more than one macOS operation is built from.
18
20
  const run_1 = require("./run");
21
+ const profile_1 = require("./profile");
19
22
  const errors_1 = require("../errors");
20
23
  const mail_1 = require("../mail");
24
+ /** Look an address up in Outlook's profile database, for the folder ids it can add. */
25
+ async function resolveMacAccount(emailAccount) {
26
+ const wanted = emailAccount.trim().toLowerCase();
27
+ const found = (await (0, profile_1.readProfileAccounts)())
28
+ .find(account => account.emailAccount.trim().toLowerCase() === wanted);
29
+ return found ? { emailAccount, folderIds: found.folderIds } : { emailAccount };
30
+ }
21
31
  /**
22
- * Resolve the account whose SMTP address matches, or raise. Emitted into a
23
- * `tell application "Microsoft Outlook"` block; binds `targetAcct`.
32
+ * Resolve the account whose address matches into `targetAcct`, inside a
33
+ * `tell application "Microsoft Outlook"` block.
24
34
  *
25
- * `every account` errors even in legacy mode, so probe the typed classes. A
26
- * `whose email address is ...` filter can't be used either: `email address` is
27
- * also a class name, and AppleScript resolves it as one ("into type specifier").
35
+ * `every account` errors even in legacy mode, so the typed classes are probed.
36
+ * A `whose email address is …` filter can't be used either: `email address` is
37
+ * also a class name, and AppleScript resolves it as one.
28
38
  *
29
- * The thrown sentence is the one `classifyRunFailure` recognises to raise
30
- * `AccountNotFoundError`, so its wording is load-bearing.
39
+ * A mailbox the dictionary publishes no account object for leaves `targetAcct`
40
+ * as `missing value` rather than failing, provided the profile gave a folder id
41
+ * to reach it by. `needsAccountObject` is for composing mail, which can't work
42
+ * without the object: the account a message is sent from can only be set from
43
+ * it, and a message composed without it goes out from the default mailbox.
31
44
  */
32
- function accountLookupSnippet(emailAccount) {
33
- return ` set targetAcct to missing value
45
+ function accountLookupSnippet(acct, needsAccountObject = false) {
46
+ const probe = ` set targetAcct to missing value
34
47
  try
35
48
  repeat with a in (exchange accounts & imap accounts & pop accounts)
36
- if (email address of a as string) is "${(0, run_1.asEscape)(emailAccount)}" then
49
+ if (email address of a as string) is ${(0, run_1.asString)(acct.emailAccount)} then
37
50
  set targetAcct to a
38
51
  exit repeat
39
52
  end if
40
53
  end repeat
41
- end try
42
- if targetAcct is missing value then error "Account '${(0, run_1.asEscape)(emailAccount)}' not found"`;
54
+ end try`;
55
+ if (acct.folderIds && !needsAccountObject)
56
+ return probe;
57
+ const complaint = acct.folderIds
58
+ ? `${(0, errors_1.failureTag)('INVALID_REQUEST')}Outlook publishes no account object for '${acct.emailAccount}', `
59
+ + 'so the account a message is sent from cannot be set. Its folders can be read; mail cannot be composed from it.'
60
+ : `${(0, errors_1.failureTag)('ACCOUNT_NOT_FOUND')}Account '${acct.emailAccount}' not found in Outlook.`;
61
+ return `${probe}
62
+ if targetAcct is missing value then error ${(0, run_1.asString)(complaint)}`;
43
63
  }
44
64
  /**
45
- * Outlook for Mac's dictionary term for each well-known root, keyed by the
46
- * olDefaultFolders id `mailFolderRef` resolves.
47
- *
48
- * Verified against the running app. The terms are NOT the ones the Windows ids
49
- * suggest — `sent mail` and `junk email` do not compile at all, while
50
- * `sent items` and `junk mail` do, and a bad term fails the whole script at
51
- * compile time rather than at the offending line.
65
+ * Bind `variable` to one of the account's well-known folders: through the
66
+ * account object when the probe found one, else by the folder's own id. `mail
67
+ * folder id N` resolves against the application rather than an account, and N is
68
+ * the id Outlook's profile database records for that folder.
69
+ */
70
+ function rootFolderSnippet(acct, term, variable) {
71
+ const viaAccount = ` set ${variable} to ${term} of targetAcct`;
72
+ const id = acct.folderIds?.[term];
73
+ if (id !== undefined) {
74
+ return ` if targetAcct is missing value then
75
+ set ${variable} to mail folder id ${id}
76
+ else
77
+ ${viaAccount}
78
+ end if`;
79
+ }
80
+ // The profile listed the mailbox but not this root, so the probe is the only
81
+ // way in — and it may have come up empty. Name the folder out of reach
82
+ // rather than let `<term> of missing value` say it.
83
+ if (acct.folderIds) {
84
+ const complaint = `${(0, errors_1.failureTag)('NOT_FOUND', 'folder')}Account '${acct.emailAccount}' has no ${term} folder AppleScript can reach.`;
85
+ return ` if targetAcct is missing value then error ${(0, run_1.asString)(complaint)}
86
+ ${viaAccount}`;
87
+ }
88
+ return viaAccount;
89
+ }
90
+ /**
91
+ * Outlook for Mac's dictionary term for each well-known root, by olDefaultFolders
92
+ * id. Verified against the running app: the terms are NOT what the Windows names
93
+ * suggest — `sent mail` and `junk email` don't compile, `sent items` and `junk
94
+ * mail` do — and one bad term fails the whole script at compile time.
52
95
  */
53
96
  exports.MAC_ROOT_TERMS = {
54
- 6: 'inbox',
55
- 5: 'sent items',
56
- 16: 'drafts',
57
- 3: 'deleted items',
58
- 4: 'outbox',
59
- 23: 'junk mail',
97
+ [mail_1.FolderId.Inbox]: 'inbox',
98
+ [mail_1.FolderId.SentMail]: 'sent items',
99
+ [mail_1.FolderId.Drafts]: 'drafts',
100
+ [mail_1.FolderId.DeletedItems]: 'deleted items',
101
+ [mail_1.FolderId.Outbox]: 'outbox',
102
+ [mail_1.FolderId.Junk]: 'junk mail',
60
103
  };
61
- /** The date property a folder's items actually carry. */
104
+ /** The date property a root's items carry. */
62
105
  function dateProperty(rootId) {
63
106
  return (0, mail_1.isOutgoingRoot)(rootId) ? 'time sent' : 'time received';
64
107
  }
65
108
  /**
66
- * The Windows `FolderPath` shape (`\\mailbox\Inbox\Invoices`), built here rather
67
- * than in AppleScript — escaping backslashes through a template literal and then
68
- * an AppleScript literal is unreadable, and TS already knows the parts.
109
+ * The Windows folder-path shape (`\\mailbox\Inbox\Invoices`), assembled in
110
+ * TypeScript: escaping backslashes through a template literal and then an
111
+ * AppleScript literal is unreadable, and the parts are known here anyway.
69
112
  */
70
113
  function macFolderPath(emailAccount, rootLabel, segments) {
71
114
  return ['\\\\' + emailAccount, rootLabel, ...segments].join('\\');
72
115
  }
73
- /** The dictionary term for a root, or a NOT_IMPLEMENTED naming what was asked. */
116
+ /**
117
+ * Walk a folder's `container` chain to the top as the list `chainNames`,
118
+ * nearest first. Requires `theFolder`, and leaves `cur` on the folder the walk
119
+ * stopped at: the account's nameless root folder, when it got that far.
120
+ *
121
+ * The chain's last element is the folder directly under the account, and an
122
+ * account can't hold two top-level folders of one name, so comparing that name
123
+ * is exact.
124
+ */
125
+ function folderChainSnippet(indent) {
126
+ return `${indent}set chainNames to {}
127
+ ${indent}set cur to theFolder
128
+ ${indent}set guard to 0
129
+ ${indent}repeat while cur is not missing value and guard < 25
130
+ ${indent} -- The account's root folder has a name of missing value, and coercing
131
+ ${indent} -- that yields the STRING "missing value" — so test before coercing.
132
+ ${indent} set rawName to missing value
133
+ ${indent} try
134
+ ${indent} set rawName to name of cur
135
+ ${indent} end try
136
+ ${indent} if rawName is missing value then exit repeat
137
+ ${indent} set nm to rawName as string
138
+ ${indent} if nm is "" then exit repeat
139
+ ${indent} set end of chainNames to nm
140
+ ${indent} set nextUp to missing value
141
+ ${indent} try
142
+ ${indent} set nextUp to container of cur
143
+ ${indent} end try
144
+ ${indent} set cur to nextUp
145
+ ${indent} set guard to guard + 1
146
+ ${indent}end repeat`;
147
+ }
148
+ /** The dictionary term for a root, or NOT_IMPLEMENTED naming what was asked. */
74
149
  function rootTerm(ref, folderLabel = '') {
75
150
  const term = exports.MAC_ROOT_TERMS[ref.rootId];
76
151
  if (!term) {
77
152
  const asked = folderLabel ? ` (asked for '${folderLabel}')` : '';
78
- throw new errors_1.NotImplementedError(`folder root '${ref.rootLabel}'${asked}`, `macOS — readable roots are ${Object.values(exports.MAC_ROOT_TERMS).join(', ')}`);
153
+ throw new errors_1.NotImplementedError(`Reading the '${ref.rootLabel}' folder${asked}`, `macOS, whose readable roots are ${Object.values(exports.MAC_ROOT_TERMS).join(', ')}`);
79
154
  }
80
155
  return term;
81
156
  }
82
157
  /**
83
- * Emit the AppleScript that resolves `scopeFolder` from `targetAcct`, walking a
84
- * well-known root down through any further path segments. Also binds
85
- * `scopeCreated`.
158
+ * Resolve `scopeFolder` from `targetAcct`: a well-known root walked down through
159
+ * any further segments. Also binds `scopeCreated`.
86
160
  *
87
- * Folder names are compared with `is`, which is case-insensitive in AppleScript —
88
- * matching the Windows walk's `-ieq` so 'invoices' finds 'Invoices' on both.
89
- * A missing segment errors by name instead of falling back to the root: silently
90
- * returning the Inbox for a caller that scoped to one folder hands back the wrong
91
- * emails under a name that says otherwise. `createMissing` builds the whole
92
- * chain instead, so a nested destination is one call.
161
+ * Names compare with `is`, which is case-insensitive in AppleScript, matching
162
+ * the Windows walk. A missing segment fails as NOT_FOUND rather than falling
163
+ * back to the root; `createMissing` builds the chain instead.
93
164
  */
94
- function mailScopeSnippet(ref, folderLabel = '', createMissing = false) {
165
+ function mailScopeSnippet(acct, ref, folderLabel = '', createMissing = false) {
95
166
  const term = rootTerm(ref, folderLabel);
96
- const walk = ref.segments.map(seg => `
167
+ const walk = ref.segments.map(segment => {
168
+ const complaint = `${(0, errors_1.failureTag)('NOT_FOUND', 'folder')}Folder '${segment}' not found under '${ref.rootLabel}'.`;
169
+ const create = createMissing
170
+ ? ` set foundFolder to (make new mail folder at scopeFolder with properties {name:${(0, run_1.asString)(segment)}})
171
+ set scopeCreated to true`
172
+ : ` error ${(0, run_1.asString)(complaint)}`;
173
+ return `
97
174
  set foundFolder to missing value
98
175
  repeat with sf in (mail folders of scopeFolder)
99
- if (name of sf as string) is "${(0, run_1.asEscape)(seg)}" then
176
+ if (name of sf as string) is ${(0, run_1.asString)(segment)} then
100
177
  set foundFolder to sf
101
178
  exit repeat
102
179
  end if
103
180
  end repeat
104
181
  if foundFolder is missing value then
105
- if ${(0, run_1.asBool)(createMissing)} then
106
- set foundFolder to (make new mail folder at scopeFolder with properties {name:"${(0, run_1.asEscape)(seg)}"})
107
- set scopeCreated to true
108
- else
109
- error "Folder '${(0, run_1.asEscape)(seg)}' not found under '${(0, run_1.asEscape)(ref.rootLabel)}'"
110
- end if
182
+ ${create}
111
183
  end if
112
- set scopeFolder to foundFolder`).join('');
184
+ set scopeFolder to foundFolder`;
185
+ }).join('');
113
186
  return ` set scopeCreated to false
114
- set scopeFolder to ${term} of targetAcct${walk}`;
187
+ ${rootFolderSnippet(acct, term, 'scopeFolder')}${walk}`;
115
188
  }
116
189
  /**
117
- * The message-id text for a script, or an InvalidRequestError.
190
+ * The message id text for a script, or INVALID_REQUEST.
118
191
  *
119
- * Outlook for Mac ids are small integers; a Windows MAPI EntryID is rejected up
120
- * front rather than left to fail as a confusing "not found", because a caller
121
- * that persisted one from a Windows run needs to be told exactly that.
192
+ * Outlook for Mac ids are small integers; a Windows EntryID is refused up front
193
+ * rather than left to fail as a confusing "not found", because a caller that
194
+ * persisted one from a Windows run needs to be told exactly that.
122
195
  */
123
196
  function macMessageId(entryId) {
124
197
  const id = String(entryId ?? '').trim();
125
198
  if (!/^\d+$/.test(id)) {
126
199
  throw new errors_1.InvalidRequestError(`'${entryId}' is not an Outlook for Mac message id. Mac ids are small integers `
127
- + `(e.g. "1263") returned by readInboxEmails on this machine; a Windows MAPI `
128
- + `EntryID cannot be resolved here.`);
200
+ + '(e.g. "1263") listed on this machine; a Windows EntryID cannot be resolved here.');
129
201
  }
130
202
  return id;
131
203
  }
132
204
  /**
133
- * Split ids into the ones a script can look up and the ones that can only fail.
134
- *
135
- * The per-id operations report failures rather than throwing, so an unusable id
136
- * belongs in the result's `failed` list beside a genuine lookup miss — not as an
137
- * exception that discards the ids that would have worked.
205
+ * Split ids into those a script can look up and those that can only fail. A
206
+ * batch reports an unusable id beside a genuine miss rather than throwing and
207
+ * discarding the ids that would have worked.
138
208
  */
139
209
  function partitionMessageIds(entryIds) {
140
210
  const valid = [];
@@ -144,35 +214,32 @@ function partitionMessageIds(entryIds) {
144
214
  valid.push(macMessageId(entryId));
145
215
  }
146
216
  catch (error) {
147
- invalid.push({ entryId: String(entryId), error: error.message });
217
+ invalid.push({ entryId: String(entryId), subject: '', error: error.message });
148
218
  }
149
219
  }
150
220
  return { valid, invalid };
151
221
  }
152
222
  /**
153
- * Resolve `theMsg` from a macOS message id, or raise.
154
- *
155
- * `message id N` resolves against the application rather than one folder, so the
156
- * message is found wherever it currently sits — including a subfolder.
223
+ * Bind `theMsg` to a message id, or fail as NOT_FOUND. `message id N` resolves
224
+ * against the application, so the message is found wherever it sits.
157
225
  */
158
- function messageLookupSnippet(id, variable = 'theMsg') {
159
- return ` set ${variable} to missing value
226
+ function messageLookupSnippet(id) {
227
+ const complaint = `${(0, errors_1.failureTag)('NOT_FOUND', 'email')}No email found for message id '${id}'. It may have been deleted - list the mail again for a current id.`;
228
+ return ` set theMsg to missing value
160
229
  try
161
- set ${variable} to message id ${id}
230
+ set theMsg to message id ${id}
162
231
  end try
163
- if ${variable} is missing value then error "Email not found for message id '${id}'"`;
232
+ if theMsg is missing value then error ${(0, run_1.asString)(complaint)}`;
164
233
  }
165
234
  /**
166
- * The sender's display name and address, as `sndName` / `sndAddr`.
167
- *
168
- * `sender` yields a record, and `address of sender of m` fails to coerce, so the
169
- * record has to be bound first. `name` is absent when there is no display name.
235
+ * `theMsg`'s sender as `sndName` / `sndAddr`. `sender` is a record, and
236
+ * `address of sender of m` doesn't coerce, so the record is bound first.
170
237
  */
171
- function senderSnippet(messageVariable = 'theMsg', indent = ' ') {
238
+ function senderSnippet(indent = ' ') {
172
239
  return `${indent}set sndName to ""
173
240
  ${indent}set sndAddr to ""
174
241
  ${indent}try
175
- ${indent} set snd to sender of ${messageVariable}
242
+ ${indent} set snd to sender of theMsg
176
243
  ${indent} try
177
244
  ${indent} set sndAddr to (address of snd) as string
178
245
  ${indent} end try
@@ -182,25 +249,17 @@ ${indent} end try
182
249
  ${indent}end try`;
183
250
  }
184
251
  /**
185
- * Everything a reader wants off ONE message already bound to `theMsg`, and the
186
- * row it produces — emitted together so the read order and the positions the
187
- * TypeScript decoders index into cannot drift apart.
188
- *
189
- * Three callers share it (`readEmailBody`, `readSelectedEmail`, and the
190
- * attachment resolver) and differ only in how they bind `theMsg`. They used to
191
- * share it by copy: thirty lines repeated, with the `time received` → `time sent`
192
- * fallback and the field order restated each time, so a dictionary fix reached
193
- * one reader and not the others.
194
- *
195
- * `bodyText` is emitted LAST when asked for, so a stray separator in an earlier
196
- * field cannot shift it.
252
+ * Everything a reader wants off one message bound to `theMsg`, emitted together
253
+ * with the row it produces (see `messageDetailFields`) so the read order and the
254
+ * positions the decoders index into cannot drift apart. `bodyText` is emitted
255
+ * LAST when asked for, so a stray separator in an earlier field can't shift it.
197
256
  */
198
257
  function messageDetailSnippet(withBody = false, indent = ' ') {
199
258
  return `${indent}set subj to ""
200
259
  ${indent}try
201
260
  ${indent} set subj to (subject of theMsg) as string
202
261
  ${indent}end try
203
- ${senderSnippet('theMsg', indent)}
262
+ ${senderSnippet(indent)}
204
263
  ${indent}set recvd to ""
205
264
  ${indent}try
206
265
  ${indent} set recvd to my isoDate(time received of theMsg)
@@ -218,24 +277,14 @@ ${indent}try
218
277
  ${indent} set bodyText to (plain text content of theMsg) as string
219
278
  ${indent}end try` : '');
220
279
  }
221
- /**
222
- * The fields `messageDetailSnippet` fills, in row order. The decoders read them
223
- * back by the positions in `MessageDetail`.
224
- */
280
+ /** The fields `messageDetailSnippet` fills, in row order — see `MessageDetail`. */
225
281
  function messageDetailFields(withBody = false) {
226
- const fields = [
227
- '(id of theMsg as string)',
228
- 'subj',
229
- 'sndName',
230
- 'sndAddr',
231
- 'recvd',
232
- 'my sanitizeList(attNames)',
233
- ];
282
+ const fields = ['(id of theMsg as string)', 'subj', 'sndName', 'sndAddr', 'recvd', 'my sanitizePositionalList(attNames)'];
234
283
  if (withBody)
235
284
  fields.push('bodyText');
236
285
  return fields;
237
286
  }
238
- /** Where each of those fields lands in the emitted row. */
287
+ /** Where each of those fields lands in the row. */
239
288
  exports.MessageDetail = {
240
289
  id: 0,
241
290
  subject: 1,
@@ -246,15 +295,14 @@ exports.MessageDetail = {
246
295
  body: 6,
247
296
  };
248
297
  /**
249
- * The first recipient's name and address, as `sndName` / `sndAddr` — what
250
- * outgoing mail reports in place of a sender, matching the Windows reader's
251
- * contract for Sent Items (a folder of mail from yourself is unreadable).
298
+ * `theMsg`'s first recipient as `sndName` / `sndAddr` — what outgoing mail
299
+ * reports in place of a sender.
252
300
  */
253
- function firstRecipientSnippet(messageVariable = 'theMsg', indent = ' ') {
301
+ function firstRecipientSnippet(indent = ' ') {
254
302
  return `${indent}set sndName to ""
255
303
  ${indent}set sndAddr to ""
256
304
  ${indent}try
257
- ${indent} set rcps to to recipients of ${messageVariable}
305
+ ${indent} set rcps to to recipients of theMsg
258
306
  ${indent} if (count of rcps) > 0 then
259
307
  ${indent} set ea to email address of (item 1 of rcps)
260
308
  ${indent} try
@@ -266,20 +314,15 @@ ${indent} end try
266
314
  ${indent} end if
267
315
  ${indent}end try`;
268
316
  }
269
- /**
270
- * Every SMTP address a message was addressed to, as the list `addrList`.
271
- *
272
- * `every recipient` covers To, CC and BCC — the full set, which is the whole
273
- * point of readSentRecipientGroups.
274
- */
275
- function allRecipientsSnippet(messageVariable = 'theMsg', indent = ' ') {
317
+ /** Every address `theMsg` was sent to — To, CC and BCC — as the list `addrList`. */
318
+ function allRecipientsSnippet(indent = ' ') {
276
319
  return `${indent}set addrList to {}
277
320
  ${indent}try
278
- ${indent} repeat with r in (every recipient of ${messageVariable})
321
+ ${indent} repeat with r in (every recipient of theMsg)
279
322
  ${indent} try
280
- ${indent} -- The record has to be bound before its field is read: a nested
281
- ${indent} -- 'address of (email address of r)' does not coerce, and fails
282
- ${indent} -- inside the try as an empty recipient list rather than an error.
323
+ ${indent} -- The record is bound before its field is read: a nested
324
+ ${indent} -- 'address of (email address of r)' doesn't coerce, and fails
325
+ ${indent} -- inside the try as an empty list rather than an error.
283
326
  ${indent} set ea to email address of r
284
327
  ${indent} set oneAddr to (address of ea) as string
285
328
  ${indent} if oneAddr is not "" then set end of addrList to oneAddr
@@ -288,9 +331,8 @@ ${indent} end repeat
288
331
  ${indent}end try`;
289
332
  }
290
333
  /**
291
- * Recursive folder-by-name search from `startFolder`, case-insensitive and
292
- * depth-capped — the macOS counterpart of the Windows Find-FolderByName, used to
293
- * resolve a template folder anywhere in the mailbox tree.
334
+ * Recursive, case-insensitive, depth-capped folder search from `startFolder` —
335
+ * the macOS counterpart of the Windows Find-FolderByName.
294
336
  */
295
337
  exports.FIND_FOLDER_HANDLER = `
296
338
  on findFolderByName(startFolder, wantedName, depth)
@@ -309,9 +351,8 @@ on findFolderByName(startFolder, wantedName, depth)
309
351
  end findFolderByName
310
352
  `;
311
353
  /**
312
- * Account enumeration only works when Outlook runs in legacy mode; New Outlook
313
- * errors on `every account` and returns empty lists for the typed classes, so
314
- * each class is probed independently and failures are ignored.
354
+ * Enumerate the accounts, probing each class separately: legacy Outlook errors
355
+ * on `every account`, and New Outlook returns empty lists for the classes.
315
356
  */
316
357
  exports.LIST_ACCOUNTS_SNIPPET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;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/**\n * Walk a folder's `container` chain to the top as the list `chainNames`,\n * nearest first. Requires `theFolder`, and leaves `cur` on the folder the walk\n * stopped at: the account's nameless root folder, when it got that far.\n *\n * The chain's last element is the folder directly under the account, and an\n * account can't hold two top-level folders of one name, so comparing that name\n * is exact.\n */\nexport function folderChainSnippet(indent: string): string {\n return `${indent}set chainNames to {}\n${indent}set cur to theFolder\n${indent}set guard to 0\n${indent}repeat while cur is not missing value and guard < 25\n${indent} -- The account's root folder has a name of missing value, and coercing\n${indent} -- that yields the STRING \"missing value\" — so test before coercing.\n${indent} set rawName to missing value\n${indent} try\n${indent} set rawName to name of cur\n${indent} end try\n${indent} if rawName is missing value then exit repeat\n${indent} set nm to rawName as string\n${indent} if nm is \"\" then exit repeat\n${indent} set end of chainNames to nm\n${indent} set nextUp to missing value\n${indent} try\n${indent} set nextUp to container of cur\n${indent} end try\n${indent} set cur to nextUp\n${indent} set guard to guard + 1\n${indent}end repeat`;\n}\n\n/** The dictionary term for a root, or NOT_IMPLEMENTED naming what was asked. */\nfunction 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 * Bind `theMsg` to a message id, or fail as NOT_FOUND. `message id N` resolves\n * against the application, so the message is found wherever it sits.\n */\nexport function messageLookupSnippet(id: string): 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 theMsg to missing value\n try\n set theMsg to message id ${id}\n end try\n if theMsg is missing value then error ${asString(complaint)}`;\n}\n\n/**\n * `theMsg`'s sender as `sndName` / `sndAddr`. `sender` is a record, and\n * `address of sender of m` doesn't coerce, so the record is bound first.\n */\nexport function senderSnippet(indent = ' '): string {\n return `${indent}set sndName to \"\"\n${indent}set sndAddr to \"\"\n${indent}try\n${indent} set snd to sender of theMsg\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(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 sanitizePositionalList(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 * `theMsg`'s first recipient as `sndName` / `sndAddr` — what outgoing mail\n * reports in place of a sender.\n */\nexport function firstRecipientSnippet(indent = ' '): string {\n return `${indent}set sndName to \"\"\n${indent}set sndAddr to \"\"\n${indent}try\n${indent} set rcps to to recipients of theMsg\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 `theMsg` was sent to — To, CC and BCC — as the list `addrList`. */\nexport function allRecipientsSnippet(indent = ' '): string {\n return `${indent}set addrList to {}\n${indent}try\n${indent} repeat with r in (every recipient of theMsg)\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"]}
@@ -1,23 +1,13 @@
1
- import type { ReplyEmailParams, ReplyEmailResult, SendEmailParams } from '../types';
1
+ import type { ReplyRequest, SendRequest } from '../backend';
2
+ import type { ReplyEmailResult, SendEmailResult } from '../types';
3
+ /** Send, display or file a new email; a filed draft reports its id. */
4
+ export declare function sendOutlookEmail(request: SendRequest): Promise<SendEmailResult>;
2
5
  /**
3
- * Create an Outlook email as a draft window (or send it) via AppleScript.
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
- * The `to` line is the reply's resolved recipient addresses rather than the
20
- * display-name string Windows reports: Outlook for Mac exposes recipients as
21
- * records, and an address is the more useful half to verify against.
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(params: ReplyEmailParams): Promise<ReplyEmailResult>;
13
+ export declare function replyOutlookEmail(request: ReplyRequest): Promise<ReplyEmailResult>;