@dawnlit/outlook-bridge 1.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.
Files changed (117) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +253 -0
  3. package/dist/OutlookService.d.ts +43 -0
  4. package/dist/OutlookService.js +137 -0
  5. package/dist/OutlookService.js.map +1 -0
  6. package/dist/errors.d.ts +112 -0
  7. package/dist/errors.js +140 -0
  8. package/dist/errors.js.map +1 -0
  9. package/dist/index.d.ts +11 -0
  10. package/dist/index.js +71 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/mac/accounts.d.ts +5 -0
  13. package/dist/mac/accounts.js +17 -0
  14. package/dist/mac/accounts.js.map +1 -0
  15. package/dist/mac/attachments.d.ts +28 -0
  16. package/dist/mac/attachments.js +120 -0
  17. package/dist/mac/attachments.js.map +1 -0
  18. package/dist/mac/bounces.d.ts +32 -0
  19. package/dist/mac/bounces.js +285 -0
  20. package/dist/mac/bounces.js.map +1 -0
  21. package/dist/mac/cleanup.d.ts +29 -0
  22. package/dist/mac/cleanup.js +219 -0
  23. package/dist/mac/cleanup.js.map +1 -0
  24. package/dist/mac/drafts.d.ts +27 -0
  25. package/dist/mac/drafts.js +214 -0
  26. package/dist/mac/drafts.js.map +1 -0
  27. package/dist/mac/folders.d.ts +28 -0
  28. package/dist/mac/folders.js +127 -0
  29. package/dist/mac/folders.js.map +1 -0
  30. package/dist/mac/index.d.ts +22 -0
  31. package/dist/mac/index.js +119 -0
  32. package/dist/mac/index.js.map +1 -0
  33. package/dist/mac/read.d.ts +46 -0
  34. package/dist/mac/read.js +406 -0
  35. package/dist/mac/read.js.map +1 -0
  36. package/dist/mac/run.d.ts +64 -0
  37. package/dist/mac/run.js +250 -0
  38. package/dist/mac/run.js.map +1 -0
  39. package/dist/mac/scripts.d.ts +137 -0
  40. package/dist/mac/scripts.js +337 -0
  41. package/dist/mac/scripts.js.map +1 -0
  42. package/dist/mac/send.d.ts +23 -0
  43. package/dist/mac/send.js +135 -0
  44. package/dist/mac/send.js.map +1 -0
  45. package/dist/mac/signatures.d.ts +4 -0
  46. package/dist/mac/signatures.js +36 -0
  47. package/dist/mac/signatures.js.map +1 -0
  48. package/dist/mac/templates.d.ts +34 -0
  49. package/dist/mac/templates.js +266 -0
  50. package/dist/mac/templates.js.map +1 -0
  51. package/dist/mail.d.ts +72 -0
  52. package/dist/mail.js +131 -0
  53. package/dist/mail.js.map +1 -0
  54. package/dist/outlookTemplateSections.d.ts +62 -0
  55. package/dist/outlookTemplateSections.js +313 -0
  56. package/dist/outlookTemplateSections.js.map +1 -0
  57. package/dist/runtime.d.ts +76 -0
  58. package/dist/runtime.js +123 -0
  59. package/dist/runtime.js.map +1 -0
  60. package/dist/shared/attachmentMatch.d.ts +32 -0
  61. package/dist/shared/attachmentMatch.js +50 -0
  62. package/dist/shared/attachmentMatch.js.map +1 -0
  63. package/dist/shared/bounceRules.d.ts +33 -0
  64. package/dist/shared/bounceRules.js +104 -0
  65. package/dist/shared/bounceRules.js.map +1 -0
  66. package/dist/shared/capabilities.d.ts +3 -0
  67. package/dist/shared/capabilities.js +9 -0
  68. package/dist/shared/capabilities.js.map +1 -0
  69. package/dist/shared/json.d.ts +11 -0
  70. package/dist/shared/json.js +45 -0
  71. package/dist/shared/json.js.map +1 -0
  72. package/dist/shared/replyBody.d.ts +49 -0
  73. package/dist/shared/replyBody.js +113 -0
  74. package/dist/shared/replyBody.js.map +1 -0
  75. package/dist/types.d.ts +365 -0
  76. package/dist/types.js +13 -0
  77. package/dist/types.js.map +1 -0
  78. package/dist/windows/accounts.d.ts +2 -0
  79. package/dist/windows/accounts.js +22 -0
  80. package/dist/windows/accounts.js.map +1 -0
  81. package/dist/windows/attachments.d.ts +28 -0
  82. package/dist/windows/attachments.js +141 -0
  83. package/dist/windows/attachments.js.map +1 -0
  84. package/dist/windows/bounces.d.ts +34 -0
  85. package/dist/windows/bounces.js +267 -0
  86. package/dist/windows/bounces.js.map +1 -0
  87. package/dist/windows/cleanup.d.ts +29 -0
  88. package/dist/windows/cleanup.js +165 -0
  89. package/dist/windows/cleanup.js.map +1 -0
  90. package/dist/windows/drafts.d.ts +29 -0
  91. package/dist/windows/drafts.js +253 -0
  92. package/dist/windows/drafts.js.map +1 -0
  93. package/dist/windows/folders.d.ts +16 -0
  94. package/dist/windows/folders.js +88 -0
  95. package/dist/windows/folders.js.map +1 -0
  96. package/dist/windows/index.d.ts +27 -0
  97. package/dist/windows/index.js +100 -0
  98. package/dist/windows/index.js.map +1 -0
  99. package/dist/windows/read.d.ts +54 -0
  100. package/dist/windows/read.js +372 -0
  101. package/dist/windows/read.js.map +1 -0
  102. package/dist/windows/run.d.ts +54 -0
  103. package/dist/windows/run.js +161 -0
  104. package/dist/windows/run.js.map +1 -0
  105. package/dist/windows/scripts.d.ts +56 -0
  106. package/dist/windows/scripts.js +163 -0
  107. package/dist/windows/scripts.js.map +1 -0
  108. package/dist/windows/send.d.ts +11 -0
  109. package/dist/windows/send.js +114 -0
  110. package/dist/windows/send.js.map +1 -0
  111. package/dist/windows/signatures.d.ts +14 -0
  112. package/dist/windows/signatures.js +69 -0
  113. package/dist/windows/signatures.js.map +1 -0
  114. package/dist/windows/templates.d.ts +25 -0
  115. package/dist/windows/templates.js +246 -0
  116. package/dist/windows/templates.js.map +1 -0
  117. package/package.json +50 -0
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendAllDrafts = sendAllDrafts;
4
+ exports.listOutlookDrafts = listOutlookDrafts;
5
+ exports.deleteOutlookDrafts = deleteOutlookDrafts;
6
+ // Drafts: which ones belong to an account, and sending, listing or deleting them.
7
+ const run_1 = require("./run");
8
+ const scripts_1 = require("./scripts");
9
+ const json_1 = require("../shared/json");
10
+ /**
11
+ * Resolve the Drafts folders belonging to one account into `$scan`, and define
12
+ * `Test-DraftMatches` over them. Emitted into every drafts script so listing,
13
+ * deleting and sending can never disagree about which drafts are "this account's".
14
+ * Expects `$target`, `$outlook`, `$ns` and `$account` to already be set.
15
+ *
16
+ * Two Drafts folders can hold drafts for one account, so both are scanned:
17
+ * - The account's OWN mailbox store Drafts folder (account.DeliveryStore) — where
18
+ * a draft composed while that mailbox is selected lands. A draft there with no
19
+ * explicit SendUsingAccount still belongs to this account, so null counts.
20
+ * - The DEFAULT store's Drafts folder — where the in-app "Create Drafts" flow
21
+ * files drafts via $mail.Save() regardless of send-account. Only drafts stamped
22
+ * with this account match here; a null SendUsingAccount means the default
23
+ * account, not necessarily this one, so it's left alone.
24
+ * (When those two resolve to the same folder — the account IS the default — it is
25
+ * scanned once, under the more permissive "own store" rule.)
26
+ *
27
+ * Drafts bound to another account never match, so nothing here can reach unrelated
28
+ * mail. Non-mail items (meeting requests, reports) are ignored.
29
+ */
30
+ const DRAFTS_SCAN_PS = `
31
+ # Collect the Drafts folders to scan, deduped by id. includeNull marks the account's
32
+ # own store, where a draft with no explicit send-account still belongs to it.
33
+ $scan = @()
34
+ $seen = @{}
35
+
36
+ $homeDrafts = $null
37
+ try { $homeDrafts = $account.DeliveryStore.GetDefaultFolder(16) } catch {} # olFolderDrafts
38
+ if ($homeDrafts -ne $null) {
39
+ $seen["$($homeDrafts.StoreID)|$($homeDrafts.EntryID)"] = $true
40
+ $scan += [pscustomobject]@{ folder = $homeDrafts; includeNull = $true }
41
+ }
42
+
43
+ $defDrafts = $null
44
+ try { $defDrafts = $ns.GetDefaultFolder(16) } catch {}
45
+ if ($defDrafts -ne $null) {
46
+ $k = "$($defDrafts.StoreID)|$($defDrafts.EntryID)"
47
+ if (-not $seen.ContainsKey($k)) {
48
+ $seen[$k] = $true
49
+ $scan += [pscustomobject]@{ folder = $defDrafts; includeNull = $false }
50
+ }
51
+ }
52
+
53
+ # SendUsingAccount is null for a draft that never set one, so guard the access.
54
+ function Test-DraftMatches($item, $includeNull) {
55
+ if ($item.Class -ne 43) { return $false } # olMail only
56
+ $acct = $null
57
+ try { $acct = $item.SendUsingAccount } catch {}
58
+ if ($acct -eq $null) { return $includeNull }
59
+ return ($acct.SmtpAddress -ieq $target)
60
+ }
61
+ `;
62
+ /** Session, account and the drafts scan rule — the prelude all three share. */
63
+ function draftsScript(emailAccount) {
64
+ return (0, scripts_1.accountScript)(emailAccount) + DRAFTS_SCAN_PS;
65
+ }
66
+ /**
67
+ * Send the mail drafts that belong to `emailAccount`, wherever Outlook filed them.
68
+ * Which drafts those are is DRAFTS_SCAN_PS's rule, not this function's.
69
+ *
70
+ * Item references are snapshotted before any Send() call: sending moves an item out
71
+ * of Drafts, and mutating the collection mid-enumeration would skip every other one.
72
+ */
73
+ async function sendAllDrafts(emailAccount) {
74
+ (0, run_1.requireWindows)();
75
+ const script = `${draftsScript(emailAccount)}
76
+ # Snapshot the matching mail items first — Send() removes each from Drafts, so
77
+ # sending inside a live enumeration would skip every other item.
78
+ $items = @()
79
+ foreach ($entry in $scan) {
80
+ foreach ($it in $entry.folder.Items) {
81
+ if (Test-DraftMatches $it $entry.includeNull) { $items += $it }
82
+ }
83
+ }
84
+
85
+ $sent = 0
86
+ $failed = @()
87
+ foreach ($m in $items) {
88
+ try {
89
+ $m.Send()
90
+ $sent++
91
+ } catch {
92
+ $subj = ''
93
+ try { $subj = $m.Subject } catch {}
94
+ $failed += [pscustomobject]@{ subject = $subj; error = $_.Exception.Message }
95
+ }
96
+ }
97
+
98
+ [pscustomobject]@{ sent = $sent; failed = @($failed) } | ConvertTo-Json -Compress -Depth 4
99
+ `;
100
+ try {
101
+ const parsed = (0, json_1.parseObject)(await (0, run_1.runPowerShell)(script, 300000));
102
+ return {
103
+ sent: (0, json_1.num)(parsed.sent),
104
+ failed: (0, json_1.toArray)(parsed.failed).map(f => {
105
+ const e = (0, json_1.record)(f);
106
+ return { subject: (0, json_1.str)(e.subject), error: (0, json_1.str)(e.error) };
107
+ }),
108
+ };
109
+ }
110
+ catch (error) {
111
+ // A malformed report is not worth failing a send that already happened;
112
+ // a run that never got that far has already rejected above.
113
+ if (error instanceof SyntaxError)
114
+ return { sent: 0, failed: [] };
115
+ throw error;
116
+ }
117
+ }
118
+ /**
119
+ * List the mail drafts belonging to `emailAccount`, newest first. Which drafts
120
+ * those are is DRAFTS_SCAN_PS's rule.
121
+ *
122
+ * Deliberately returns no StoreID: deleteOutlookDrafts re-resolves each EntryID
123
+ * against the same folders, so repeating a ~700-char store id on every row would be
124
+ * pure payload. Bodies are previewed, never returned whole — a templated reply body
125
+ * runs to tens of thousands of characters and a folder's worth would blow the cap.
126
+ */
127
+ async function listOutlookDrafts(emailAccount, limit = 100, previewChars = 300) {
128
+ (0, run_1.requireWindows)();
129
+ const script = `${draftsScript(emailAccount)}
130
+ $previewChars = ${previewChars}
131
+ $rows = @()
132
+ $folders = @()
133
+ foreach ($entry in $scan) {
134
+ $fp = ''
135
+ try { $fp = $entry.folder.FolderPath } catch {}
136
+ $folders += $fp
137
+ foreach ($it in $entry.folder.Items) {
138
+ if (-not (Test-DraftMatches $it $entry.includeNull)) { continue }
139
+ $subj = ''; try { $subj = $it.Subject } catch {}
140
+ $to = ''; try { $to = $it.To } catch {}
141
+ $addrs = @()
142
+ try {
143
+ foreach ($r in $it.Recipients) {
144
+ $a = ''
145
+ try { $a = $r.Address } catch {}
146
+ if ($a -and $a.StartsWith('/')) { try { $a = $r.Name } catch {} }
147
+ if ($a) { $addrs += $a }
148
+ }
149
+ } catch {}
150
+ $body = ''
151
+ try { $body = $it.Body } catch {}
152
+ if ($body -eq $null) { $body = '' }
153
+ $body = ($body -replace '\\s+', ' ').Trim()
154
+ if ($body.Length -gt $previewChars) { $body = $body.Substring(0, $previewChars) }
155
+ $mod = ''
156
+ try { $mod = $it.LastModificationTime.ToString('yyyy-MM-dd HH:mm') } catch {}
157
+ $att = $false
158
+ try { $att = ($it.Attachments.Count -gt 0) } catch {}
159
+ $rows += [pscustomobject]@{
160
+ entryId = $it.EntryID
161
+ subject = $subj
162
+ to = $to
163
+ toEmails = @($addrs)
164
+ bodyPreview = $body
165
+ hasAttachments = $att
166
+ lastModified = $mod
167
+ folderPath = $fp
168
+ }
169
+ }
170
+ }
171
+ $sorted = @($rows | Sort-Object -Property lastModified -Descending)
172
+ $total = $sorted.Count
173
+ if ($total -gt ${limit}) { $sorted = @($sorted[0..(${limit} - 1)]) }
174
+ ConvertTo-Json @{ account = $target; foldersScanned = @($folders); count = $total; truncated = ($total -gt ${limit}); drafts = @($sorted) } -Depth 4
175
+ `;
176
+ const parsed = (0, json_1.parseObject)(await (0, run_1.runPowerShell)(script, 300000));
177
+ return {
178
+ account: (0, json_1.str)(parsed.account) || emailAccount,
179
+ foldersScanned: (0, json_1.toArray)(parsed.foldersScanned).map(json_1.str),
180
+ count: (0, json_1.num)(parsed.count),
181
+ truncated: Boolean(parsed.truncated),
182
+ drafts: (0, json_1.toArray)(parsed.drafts).map(d => {
183
+ const e = (0, json_1.record)(d);
184
+ return {
185
+ entryId: (0, json_1.str)(e.entryId),
186
+ subject: (0, json_1.str)(e.subject),
187
+ to: (0, json_1.str)(e.to),
188
+ toEmails: (0, json_1.strList)(e.toEmails),
189
+ bodyPreview: (0, json_1.str)(e.bodyPreview),
190
+ hasAttachments: Boolean(e.hasAttachments),
191
+ lastModified: (0, json_1.str)(e.lastModified),
192
+ folderPath: (0, json_1.str)(e.folderPath),
193
+ };
194
+ }),
195
+ };
196
+ }
197
+ /**
198
+ * Delete mail drafts by EntryID. Outlook's Delete() moves the item to Deleted Items
199
+ * rather than destroying it, so a mistaken call stays recoverable from there.
200
+ *
201
+ * Every id must resolve to a mail item sitting in one of THIS account's Drafts
202
+ * folders before anything is deleted; an id pointing at ordinary mail, or at another
203
+ * account's draft, is refused and reported. Without that gate this would be a
204
+ * general-purpose "delete any email by id" tool, which is not what it is for.
205
+ */
206
+ async function deleteOutlookDrafts(emailAccount, entryIds) {
207
+ (0, run_1.requireWindows)();
208
+ if (entryIds.length === 0)
209
+ return { deleted: 0, failed: [] };
210
+ const script = `${draftsScript(emailAccount)}
211
+ # Index this account's Drafts folders by EntryID, so a resolved item can be PROVED
212
+ # to live in one of them before it is deleted.
213
+ $draftFolderIds = @{}
214
+ foreach ($entry in $scan) { $draftFolderIds[$entry.folder.EntryID] = $entry.includeNull }
215
+
216
+ $deleted = 0
217
+ $failed = @()
218
+ foreach ($id in @(${(0, run_1.psList)(entryIds)})) {
219
+ try {
220
+ $it = $null
221
+ foreach ($entry in $scan) {
222
+ try {
223
+ $it = $ns.GetItemFromID($id, $entry.folder.StoreID)
224
+ if ($it -ne $null) { break }
225
+ } catch { $it = $null }
226
+ }
227
+ if ($it -eq $null) { throw "no such item in this account's Drafts folders" }
228
+ $parentId = ''
229
+ try { $parentId = $it.Parent.EntryID } catch {}
230
+ if (-not $draftFolderIds.ContainsKey($parentId)) {
231
+ throw "item is not in this account's Drafts folder - refusing to delete"
232
+ }
233
+ if (-not (Test-DraftMatches $it $draftFolderIds[$parentId])) {
234
+ throw "draft is not bound to $target - refusing to delete"
235
+ }
236
+ $it.Delete()
237
+ $deleted++
238
+ } catch {
239
+ $failed += [pscustomobject]@{ entryId = $id; error = $_.Exception.Message }
240
+ }
241
+ }
242
+ ConvertTo-Json @{ deleted = $deleted; failed = @($failed) } -Depth 3
243
+ `;
244
+ const parsed = (0, json_1.parseObject)(await (0, run_1.runPowerShell)(script, 300000));
245
+ return {
246
+ deleted: (0, json_1.num)(parsed.deleted),
247
+ failed: (0, json_1.toArray)(parsed.failed).map(f => {
248
+ const e = (0, json_1.record)(f);
249
+ return { entryId: (0, json_1.str)(e.entryId), error: (0, json_1.str)(e.error) };
250
+ }),
251
+ };
252
+ }
253
+ //# sourceMappingURL=drafts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drafts.js","sourceRoot":"","sources":["../../src/windows/drafts.ts"],"names":[],"mappings":";;AAuEA,sCA0CC;AAWD,8CAyEC;AAWD,kDAgDC;AAhQD,kFAAkF;AAClF,+BAA8D;AAC9D,uCAA0C;AAC1C,yCAAiF;AAGjF;;;;;;;;;;;;;;;;;;;GAm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AC,UAAU,CAAC;aAChC,CAAC;QACN,CAAC,CAAC;KACL,CAAC;AACN,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,mBAAmB,CACrC,YAAoB,EACpB,QAAkB;IAElB,IAAA,oBAAc,GAAE,CAAC;IACjB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAC7D,MAAM,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC;;;;;;;;oBAQ5B,IAAA,YAAM,EAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyBnC,CAAC;IACE,MAAM,MAAM,GAAG,IAAA,kBAAW,EAAC,MAAM,IAAA,mBAAa,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChE,OAAO;QACH,OAAO,EAAE,IAAA,UAAG,EAAC,MAAM,CAAC,OAAO,CAAC;QAC5B,MAAM,EAAE,IAAA,cAAO,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACnC,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,CAAC,CAAC,CAAC;YACpB,OAAO,EAAE,OAAO,EAAE,IAAA,UAAG,EAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAA,UAAG,EAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5D,CAAC,CAAC;KACL,CAAC;AACN,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { InboxFolderInfo, MoveEmailsResult } from '../types';
2
+ /** List the folders under an account's Inbox (the user's filing folders). */
3
+ export declare function listInboxFolders(emailAccount: string, maxDepth?: number): Promise<InboxFolderInfo[]>;
4
+ /**
5
+ * Move emails (by EntryID) into any folder of the account — a filing folder under
6
+ * the Inbox, or a well-known folder by name (see WELL_KNOWN_FOLDERS).
7
+ *
8
+ * **Moving to "Deleted Items" is how mail gets deleted reversibly**, which is why
9
+ * this takes well-known roots at all: it means the destructive path and the filing
10
+ * path are one tool, and the destructive one is undoable from the folder it lands in.
11
+ *
12
+ * `createIfMissing` builds the WHOLE missing chain, so a nested destination
13
+ * ("Clients\\Acme\\2026") is one call rather than a manual mkdir first.
14
+ * NOTE: moving changes an item's EntryID — the passed ids are dead afterwards.
15
+ */
16
+ export declare function moveOutlookEmails(emailAccount: string, entryIds: string[], folderName: string, createIfMissing?: boolean): Promise<MoveEmailsResult>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listInboxFolders = listInboxFolders;
4
+ exports.moveOutlookEmails = moveOutlookEmails;
5
+ // Listing the folders under an Inbox, and filing mail into one.
6
+ const run_1 = require("./run");
7
+ const scripts_1 = require("./scripts");
8
+ const json_1 = require("../shared/json");
9
+ const mail_1 = require("../mail");
10
+ /** List the folders under an account's Inbox (the user's filing folders). */
11
+ async function listInboxFolders(emailAccount, maxDepth = 2) {
12
+ if (process.platform !== 'win32')
13
+ return [];
14
+ const depth = (0, mail_1.clamp)(maxDepth, 1, 4);
15
+ const script = `${(0, scripts_1.accountScript)(emailAccount)}
16
+ $inbox = $account.DeliveryStore.GetDefaultFolder(6)
17
+ function Walk-Folders($folder, $level) {
18
+ foreach ($f in $folder.Folders) {
19
+ [PSCustomObject]@{
20
+ name = $f.Name
21
+ folderPath = $f.FolderPath
22
+ itemCount = $f.Items.Count
23
+ depth = $level
24
+ }
25
+ if ($level -lt ${depth}) { Walk-Folders $f ($level + 1) }
26
+ }
27
+ }
28
+ $results = @(Walk-Folders $inbox 1)
29
+ ConvertTo-Json $results -Depth 3
30
+ `;
31
+ return (0, json_1.parseArray)(await (0, run_1.runPowerShell)(script, 60000)).map(item => {
32
+ const e = (0, json_1.record)(item);
33
+ return {
34
+ name: (0, json_1.str)(e.name),
35
+ folderPath: (0, json_1.str)(e.folderPath),
36
+ itemCount: (0, json_1.num)(e.itemCount),
37
+ depth: (0, json_1.num)(e.depth) || 1,
38
+ };
39
+ });
40
+ }
41
+ /**
42
+ * Move emails (by EntryID) into any folder of the account — a filing folder under
43
+ * the Inbox, or a well-known folder by name (see WELL_KNOWN_FOLDERS).
44
+ *
45
+ * **Moving to "Deleted Items" is how mail gets deleted reversibly**, which is why
46
+ * this takes well-known roots at all: it means the destructive path and the filing
47
+ * path are one tool, and the destructive one is undoable from the folder it lands in.
48
+ *
49
+ * `createIfMissing` builds the WHOLE missing chain, so a nested destination
50
+ * ("Clients\\Acme\\2026") is one call rather than a manual mkdir first.
51
+ * NOTE: moving changes an item's EntryID — the passed ids are dead afterwards.
52
+ */
53
+ async function moveOutlookEmails(emailAccount, entryIds, folderName, createIfMissing = false) {
54
+ (0, run_1.requireWindows)();
55
+ if (entryIds.length === 0) {
56
+ return { folderPath: '', folderCreated: false, moved: 0, failed: [] };
57
+ }
58
+ const ref = (0, mail_1.mailFolderRef)(folderName);
59
+ const script = `${(0, scripts_1.accountScript)(emailAccount)}
60
+ ${scripts_1.DELIVERY_STORE_PS}
61
+ ${(0, scripts_1.mailScopeScript)(ref, folderName, createIfMissing)}
62
+ $folder = $scope
63
+ $folderCreated = $scopeCreated
64
+ $moved = 0
65
+ $failed = @()
66
+ foreach ($id in @(${(0, run_1.psList)(entryIds)})) {
67
+ try {
68
+ $it = $ns.GetItemFromID($id, $store.StoreID)
69
+ [void]$it.Move($folder)
70
+ $moved++
71
+ } catch {
72
+ $failed += [PSCustomObject]@{ entryId = $id; error = $_.Exception.Message }
73
+ }
74
+ }
75
+ ConvertTo-Json @{ folderPath = $folder.FolderPath; folderCreated = $folderCreated; moved = $moved; failed = @($failed) } -Depth 3
76
+ `;
77
+ const parsed = (0, json_1.parseObject)(await (0, run_1.runPowerShell)(script, 300000));
78
+ return {
79
+ folderPath: (0, json_1.str)(parsed.folderPath),
80
+ folderCreated: Boolean(parsed.folderCreated),
81
+ moved: (0, json_1.num)(parsed.moved),
82
+ failed: (0, json_1.toArray)(parsed.failed).map(f => {
83
+ const e = (0, json_1.record)(f);
84
+ return { entryId: (0, json_1.str)(e.entryId), error: (0, json_1.str)(e.error) };
85
+ }),
86
+ };
87
+ }
88
+ //# sourceMappingURL=folders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folders.js","sourceRoot":"","sources":["../../src/windows/folders.ts"],"names":[],"mappings":";;AAQA,4CA+BC;AAcD,8CAuCC;AA5FD,gEAAgE;AAChE,+BAA8D;AAC9D,uCAA8E;AAC9E,yCAAoF;AACpF,kCAA+C;AAG/C,6EAA6E;AACtE,KAAK,UAAU,gBAAgB,CAClC,YAAoB,EACpB,QAAQ,GAAG,CAAC;IAEZ,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,EAAE,CAAC;IAC5C,MAAM,KAAK,GAAG,IAAA,YAAK,EAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAC,YAAY,CAAC;;;;;;;;;;yBAUxB,KAAK;;;;;CAK7B,CAAC;IACE,OAAO,IAAA,iBAAU,EAAC,MAAM,IAAA,mBAAa,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC7D,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,IAAI,CAAC,CAAC;QACvB,OAAO;YACH,IAAI,EAAE,IAAA,UAAG,EAAC,CAAC,CAAC,IAAI,CAAC;YACjB,UAAU,EAAE,IAAA,UAAG,EAAC,CAAC,CAAC,UAAU,CAAC;YAC7B,SAAS,EAAE,IAAA,UAAG,EAAC,CAAC,CAAC,SAAS,CAAC;YAC3B,KAAK,EAAE,IAAA,UAAG,EAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;SAC3B,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,iBAAiB,CACnC,YAAoB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 /**
3
+ * The whole contract in one object — and the compile-time proof that this
4
+ * module answers all of it.
5
+ *
6
+ * Typed as `OutlookBridge` rather than inferred: without that a signature could
7
+ * drift from the macOS one and only surface as a union in the published .d.ts,
8
+ * which is exactly how it drifted before.
9
+ */
10
+ declare const bridge: OutlookBridge;
11
+ export { bridge };
12
+ export * from './accounts';
13
+ export * from './send';
14
+ export * from './drafts';
15
+ export * from './read';
16
+ export * from './folders';
17
+ export * from './cleanup';
18
+ export * from './bounces';
19
+ export * from './attachments';
20
+ export * from './signatures';
21
+ export * from './templates';
22
+ export { mailScopeScript } from './scripts';
23
+ /**
24
+ * Windows drives the full COM object model, so every operation is available —
25
+ * this is the reference the macOS map is measured against.
26
+ */
27
+ export declare const capabilities: CapabilityMap;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.capabilities = exports.mailScopeScript = exports.bridge = void 0;
18
+ // The Windows implementation: Outlook driven through PowerShell + COM.
19
+ //
20
+ // Split by feature rather than kept as one file — every operation here is
21
+ // "generate a script, run it, coerce the result", and the interesting part of
22
+ // each is the script, which is only readable next to the rules it encodes.
23
+ // `scripts.ts` holds the fragments more than one feature emits; `run.ts` owns
24
+ // the run itself and the escaping.
25
+ //
26
+ // This is the reference implementation: everything in the platform contract
27
+ // works here, which is what the macOS capability map is measured against.
28
+ const accounts_1 = require("./accounts");
29
+ const send_1 = require("./send");
30
+ const drafts_1 = require("./drafts");
31
+ const read_1 = require("./read");
32
+ const folders_1 = require("./folders");
33
+ const cleanup_1 = require("./cleanup");
34
+ const bounces_1 = require("./bounces");
35
+ const attachments_1 = require("./attachments");
36
+ const signatures_1 = require("./signatures");
37
+ const templates_1 = require("./templates");
38
+ const capabilities_1 = require("../shared/capabilities");
39
+ /**
40
+ * The whole contract in one object — and the compile-time proof that this
41
+ * module answers all of it.
42
+ *
43
+ * Typed as `OutlookBridge` rather than inferred: without that a signature could
44
+ * drift from the macOS one and only surface as a union in the published .d.ts,
45
+ * which is exactly how it drifted before.
46
+ */
47
+ const bridge = {
48
+ getOutlookAccounts: accounts_1.getOutlookAccounts,
49
+ sendOutlookEmail: send_1.sendOutlookEmail,
50
+ replyOutlookEmail: send_1.replyOutlookEmail,
51
+ sendAllDrafts: drafts_1.sendAllDrafts,
52
+ readInboxEmails: read_1.readInboxEmails,
53
+ searchInboxByFilter: read_1.searchInboxByFilter,
54
+ readSelectedEmail: read_1.readSelectedEmail,
55
+ readEmailBody: read_1.readEmailBody,
56
+ openOutlookEmail: read_1.openOutlookEmail,
57
+ listInboxFolders: folders_1.listInboxFolders,
58
+ moveOutlookEmails: folders_1.moveOutlookEmails,
59
+ listOutlookDrafts: drafts_1.listOutlookDrafts,
60
+ deleteOutlookDrafts: drafts_1.deleteOutlookDrafts,
61
+ deleteOutlookEmails: cleanup_1.deleteOutlookEmails,
62
+ purgeDeletedItems: cleanup_1.purgeDeletedItems,
63
+ saveEmailAttachment: attachments_1.saveEmailAttachment,
64
+ saveEmailAttachmentDetailed: attachments_1.saveEmailAttachmentDetailed,
65
+ saveEmailAttachments: attachments_1.saveEmailAttachments,
66
+ cleanUndeliverableEmails: bounces_1.cleanUndeliverableEmails,
67
+ collectBouncedRecipients: bounces_1.collectBouncedRecipients,
68
+ readSentRecipientGroups: bounces_1.readSentRecipientGroups,
69
+ listOutlookSignatures: signatures_1.listOutlookSignatures,
70
+ readOutlookSignatureHtml: signatures_1.readOutlookSignatureHtml,
71
+ readTemplateEmails: templates_1.readTemplateEmails,
72
+ saveTemplateEmail: templates_1.saveTemplateEmail,
73
+ editEmailTemplate: templates_1.editEmailTemplate,
74
+ };
75
+ exports.bridge = bridge;
76
+ // Re-exported one module at a time rather than by name: every feature module
77
+ // here exports exactly its bridge functions and nothing else, so the name list
78
+ // this replaces was a copy of the `bridge` literal above with no way to drift
79
+ // from it usefully.
80
+ __exportStar(require("./accounts"), exports);
81
+ __exportStar(require("./send"), exports);
82
+ __exportStar(require("./drafts"), exports);
83
+ __exportStar(require("./read"), exports);
84
+ __exportStar(require("./folders"), exports);
85
+ __exportStar(require("./cleanup"), exports);
86
+ __exportStar(require("./bounces"), exports);
87
+ __exportStar(require("./attachments"), exports);
88
+ __exportStar(require("./signatures"), exports);
89
+ __exportStar(require("./templates"), exports);
90
+ // The folder-scope emitter, exported so the generated script can be checked
91
+ // without an Outlook session — a syntax error in it would otherwise only ever
92
+ // surface as a failed live run.
93
+ var scripts_1 = require("./scripts");
94
+ Object.defineProperty(exports, "mailScopeScript", { enumerable: true, get: function () { return scripts_1.mailScopeScript; } });
95
+ /**
96
+ * Windows drives the full COM object model, so every operation is available —
97
+ * this is the reference the macOS map is measured against.
98
+ */
99
+ exports.capabilities = (0, capabilities_1.capabilityMap)(bridge);
100
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/windows/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uEAAuE;AACvE,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,mCAAmC;AACnC,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,yCAAgD;AAChD,iCAA6D;AAC7D,qCAAiF;AACjF,iCAAmH;AACnH,u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ExB;;;GAGG;AACU,QAAA,YAAY,GAAkB,IAAA,4BAAa,EAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { EmailBodyResult, InboxEmail, InboxSearchFilter, InboxSearchMatch, SelectedEmail } from '../types';
2
+ /**
3
+ * Read recent emails from the Outlook inbox for the given account.
4
+ * No subject filtering — returns everything within the date window, up to the limit.
5
+ * Does NOT download attachments; returns attachment names only.
6
+ *
7
+ * `folder` scopes the read to one folder under the Inbox instead of the Inbox
8
+ * root. Without it, mail already filed away (Inbox\\Invoices) is unreachable —
9
+ * which is the normal state of any mailbox its owner keeps tidy. Segments are
10
+ * matched as direct children; a bare name that isn't a direct child falls back to
11
+ * the same recursive by-name search moveOutlookEmails uses, so one folder string
12
+ * works in both. Only the named folder is read — its own subfolders are not.
13
+ */
14
+ export declare function readInboxEmails(emailAccount: string, daysBack?: number, limit?: number, folder?: string): Promise<InboxEmail[]>;
15
+ /**
16
+ * Read one email's full plain-text body by EntryID.
17
+ *
18
+ * Uses `MailItem.Body`, not `HTMLBody`: Outlook's own plain-text rendering is
19
+ * what every other reader here consumes, and the markup costs an order of
20
+ * magnitude more for the same sentences. The tradeoff is that HTML tables
21
+ * flatten, so figures broken out in a table lose their row/column pairing — read
22
+ * those from the attachment where there is one.
23
+ *
24
+ * Exists because `readInboxEmails` caps its preview at 600 chars, and a reply
25
+ * whose first 600 chars read as complete can still carry a material detail below
26
+ * the cut. Nothing detects that from the preview alone.
27
+ *
28
+ * `includeQuoted` is off by default — see splitQuotedOriginal for why the
29
+ * quoted thread is a hazard to a caller reading figures out of a reply.
30
+ * `quotedLength` is reported either way so a caller can tell it exists and ask again.
31
+ */
32
+ export declare function readEmailBody(entryId: string, storeId?: string, maxChars?: number, includeQuoted?: boolean): Promise<EmailBodyResult>;
33
+ /**
34
+ * Walk every folder under the Inbox (recursively) for one account and return
35
+ * the emails matching `filter` — full body included, attachments listed by
36
+ * name but not saved.
37
+ *
38
+ * Built for a scan that doesn't know in advance which subfolder holds what
39
+ * it's after; `readInboxEmails` covers the cheaper "one known folder" case.
40
+ *
41
+ * `daysBack` bounds the scan to items received within that many days — what a
42
+ * daily batch run wants, since a subject filter alone walks the whole Inbox
43
+ * tree and returns every match ever received. 0 keeps that unbounded
44
+ * behavior, and is only sane paired with `filter.subjectLike` so Restrict can
45
+ * narrow the set server-side before anything crosses COM.
46
+ */
47
+ export declare function searchInboxByFilter(emailAccount: string, filter?: InboxSearchFilter, daysBack?: number): Promise<InboxSearchMatch[]>;
48
+ /**
49
+ * Read the email currently selected (or open) in Outlook — full body,
50
+ * attachments listed by name but not saved.
51
+ */
52
+ export declare function readSelectedEmail(): Promise<SelectedEmail>;
53
+ /** Open an email in Outlook by its EntryID. */
54
+ export declare function openOutlookEmail(entryId: string): Promise<void>;