@dawnlit/outlook-bridge 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -183
- package/dist/backend.d.ts +151 -0
- package/dist/backend.js +3 -0
- package/dist/backend.js.map +1 -0
- package/dist/bridge.d.ts +56 -0
- package/dist/bridge.js +507 -0
- package/dist/bridge.js.map +1 -0
- package/dist/errors.d.ts +81 -43
- package/dist/errors.js +98 -52
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +25 -52
- package/dist/index.js.map +1 -1
- package/dist/mac/accounts.d.ts +7 -2
- package/dist/mac/accounts.js +23 -6
- package/dist/mac/accounts.js.map +1 -1
- package/dist/mac/attachments.d.ts +5 -25
- package/dist/mac/attachments.js +40 -99
- package/dist/mac/attachments.js.map +1 -1
- package/dist/mac/bounces.d.ts +12 -27
- package/dist/mac/bounces.js +95 -112
- package/dist/mac/bounces.js.map +1 -1
- package/dist/mac/cleanup.d.ts +11 -25
- package/dist/mac/cleanup.js +50 -76
- package/dist/mac/cleanup.js.map +1 -1
- package/dist/mac/drafts.d.ts +13 -34
- package/dist/mac/drafts.js +95 -169
- package/dist/mac/drafts.js.map +1 -1
- package/dist/mac/folders.d.ts +10 -21
- package/dist/mac/folders.js +33 -47
- package/dist/mac/folders.js.map +1 -1
- package/dist/mac/index.d.ts +2 -22
- package/dist/mac/index.js +19 -81
- package/dist/mac/index.js.map +1 -1
- package/dist/mac/profile.d.ts +13 -0
- package/dist/mac/profile.js +149 -0
- package/dist/mac/profile.js.map +1 -0
- package/dist/mac/read.d.ts +18 -36
- package/dist/mac/read.js +154 -208
- package/dist/mac/read.js.map +1 -1
- package/dist/mac/run.d.ts +35 -39
- package/dist/mac/run.js +97 -102
- package/dist/mac/run.js.map +1 -1
- package/dist/mac/scripts.d.ts +78 -86
- package/dist/mac/scripts.js +125 -115
- package/dist/mac/scripts.js.map +1 -1
- package/dist/mac/send.d.ts +10 -20
- package/dist/mac/send.js +64 -86
- package/dist/mac/send.js.map +1 -1
- package/dist/mac/signatures.d.ts +2 -2
- package/dist/mac/signatures.js +9 -11
- package/dist/mac/signatures.js.map +1 -1
- package/dist/mac/templates.d.ts +14 -26
- package/dist/mac/templates.js +75 -113
- package/dist/mac/templates.js.map +1 -1
- package/dist/mail.d.ts +77 -45
- package/dist/mail.js +166 -73
- package/dist/mail.js.map +1 -1
- package/dist/runtime.d.ts +76 -43
- package/dist/runtime.js +103 -48
- package/dist/runtime.js.map +1 -1
- package/dist/shared/args.d.ts +48 -0
- package/dist/shared/args.js +216 -0
- package/dist/shared/args.js.map +1 -0
- package/dist/shared/attachmentMatch.d.ts +28 -16
- package/dist/shared/attachmentMatch.js +60 -22
- package/dist/shared/attachmentMatch.js.map +1 -1
- package/dist/shared/bounceReport.d.ts +11 -0
- package/dist/shared/bounceReport.js +45 -0
- package/dist/shared/bounceReport.js.map +1 -0
- package/dist/shared/bounceRules.d.ts +38 -10
- package/dist/shared/bounceRules.js +50 -32
- package/dist/shared/bounceRules.js.map +1 -1
- package/dist/shared/exec.d.ts +21 -0
- package/dist/shared/exec.js +47 -0
- package/dist/shared/exec.js.map +1 -0
- package/dist/shared/json.d.ts +12 -6
- package/dist/shared/json.js +29 -23
- package/dist/shared/json.js.map +1 -1
- package/dist/shared/locate.d.ts +39 -0
- package/dist/shared/locate.js +129 -0
- package/dist/shared/locate.js.map +1 -0
- package/dist/shared/replyBody.d.ts +42 -32
- package/dist/shared/replyBody.js +84 -71
- package/dist/shared/replyBody.js.map +1 -1
- package/dist/templateBody.d.ts +63 -0
- package/dist/{outlookTemplateSections.js → templateBody.js} +72 -72
- package/dist/templateBody.js.map +1 -0
- package/dist/types.d.ts +360 -165
- package/dist/types.js +8 -9
- package/dist/types.js.map +1 -1
- package/dist/windows/accounts.d.ts +10 -1
- package/dist/windows/accounts.js +25 -13
- package/dist/windows/accounts.js.map +1 -1
- package/dist/windows/attachments.d.ts +9 -24
- package/dist/windows/attachments.js +94 -119
- package/dist/windows/attachments.js.map +1 -1
- package/dist/windows/bounces.d.ts +13 -26
- package/dist/windows/bounces.js +169 -200
- package/dist/windows/bounces.js.map +1 -1
- package/dist/windows/cleanup.d.ts +19 -23
- package/dist/windows/cleanup.js +93 -111
- package/dist/windows/cleanup.js.map +1 -1
- package/dist/windows/drafts.d.ts +16 -35
- package/dist/windows/drafts.js +167 -253
- package/dist/windows/drafts.js.map +1 -1
- package/dist/windows/folders.d.ts +8 -13
- package/dist/windows/folders.js +45 -52
- package/dist/windows/folders.js.map +1 -1
- package/dist/windows/index.d.ts +2 -27
- package/dist/windows/index.js +11 -65
- package/dist/windows/index.js.map +1 -1
- package/dist/windows/read.d.ts +24 -45
- package/dist/windows/read.js +266 -279
- package/dist/windows/read.js.map +1 -1
- package/dist/windows/run.d.ts +39 -39
- package/dist/windows/run.js +151 -111
- package/dist/windows/run.js.map +1 -1
- package/dist/windows/scripts.d.ts +71 -38
- package/dist/windows/scripts.js +123 -71
- package/dist/windows/scripts.js.map +1 -1
- package/dist/windows/send.d.ts +6 -11
- package/dist/windows/send.js +70 -79
- package/dist/windows/send.js.map +1 -1
- package/dist/windows/signatures.d.ts +4 -10
- package/dist/windows/signatures.js +30 -37
- package/dist/windows/signatures.js.map +1 -1
- package/dist/windows/templates.d.ts +12 -18
- package/dist/windows/templates.js +126 -151
- package/dist/windows/templates.js.map +1 -1
- package/package.json +5 -4
- package/dist/OutlookService.d.ts +0 -43
- package/dist/OutlookService.js +0 -137
- package/dist/OutlookService.js.map +0 -1
- package/dist/outlookTemplateSections.d.ts +0 -62
- package/dist/outlookTemplateSections.js.map +0 -1
- package/dist/shared/capabilities.d.ts +0 -3
- package/dist/shared/capabilities.js +0 -9
- package/dist/shared/capabilities.js.map +0 -1
package/dist/windows/folders.js
CHANGED
|
@@ -7,29 +7,31 @@ const run_1 = require("./run");
|
|
|
7
7
|
const scripts_1 = require("./scripts");
|
|
8
8
|
const json_1 = require("../shared/json");
|
|
9
9
|
const mail_1 = require("../mail");
|
|
10
|
-
/**
|
|
11
|
-
async function listInboxFolders(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
$
|
|
17
|
-
function
|
|
10
|
+
/** The folders under an account's Inbox, depth-first. */
|
|
11
|
+
async function listInboxFolders(request) {
|
|
12
|
+
const output = await (0, run_1.runPowerShellJson)(`${(0, scripts_1.accountScript)(request.account)}
|
|
13
|
+
${scripts_1.DELIVERY_STORE_PS}
|
|
14
|
+
$inbox = $store.GetDefaultFolder(${(0, run_1.psInt)(mail_1.FolderId.Inbox)})
|
|
15
|
+
$maxDepth = ${(0, run_1.psInt)(request.maxDepth)}
|
|
16
|
+
$rows = New-Object System.Collections.ArrayList
|
|
17
|
+
function Add-Folders($folder, [int]$level) {
|
|
18
18
|
foreach ($f in $folder.Folders) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
$itemCount = 0
|
|
20
|
+
try { $itemCount = [int]$f.Items.Count } catch {}
|
|
21
|
+
[void]$rows.Add([PSCustomObject]@{
|
|
22
|
+
name = [string]$f.Name
|
|
23
|
+
folderPath = [string]$f.FolderPath
|
|
24
|
+
itemCount = $itemCount
|
|
23
25
|
depth = $level
|
|
24
|
-
}
|
|
25
|
-
if ($level -lt $
|
|
26
|
+
})
|
|
27
|
+
if ($level -lt $maxDepth) { Add-Folders $f ($level + 1) }
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
|
-
|
|
29
|
-
ConvertTo-Json
|
|
30
|
-
|
|
31
|
-
return (0, json_1.
|
|
32
|
-
const e = (0, json_1.record)(
|
|
30
|
+
Add-Folders $inbox 1
|
|
31
|
+
ConvertTo-Json -Depth 3 -InputObject @($rows)
|
|
32
|
+
`, 'standard');
|
|
33
|
+
return (0, json_1.toArray)(output).map(row => {
|
|
34
|
+
const e = (0, json_1.record)(row);
|
|
33
35
|
return {
|
|
34
36
|
name: (0, json_1.str)(e.name),
|
|
35
37
|
folderPath: (0, json_1.str)(e.folderPath),
|
|
@@ -39,50 +41,41 @@ ConvertTo-Json $results -Depth 3
|
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
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.
|
|
44
|
+
* File emails into a folder of the account: one under the Inbox, or a
|
|
45
|
+
* well-known one by name. Moving to Deleted Items is how mail is deleted
|
|
46
|
+
* recoverably. Moving rewrites each item's entry id, so the ids passed in are
|
|
47
|
+
* dead afterwards.
|
|
52
48
|
*/
|
|
53
|
-
async function moveOutlookEmails(
|
|
54
|
-
(0, run_1.
|
|
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)}
|
|
49
|
+
async function moveOutlookEmails(request) {
|
|
50
|
+
const output = await (0, run_1.runPowerShellJson)(`${(0, scripts_1.accountScript)(request.account)}
|
|
60
51
|
${scripts_1.DELIVERY_STORE_PS}
|
|
61
|
-
${(0, scripts_1.mailScopeScript)(
|
|
62
|
-
$folder = $scope
|
|
63
|
-
$folderCreated = $scopeCreated
|
|
52
|
+
${(0, scripts_1.mailScopeScript)(request.folder, request.folderLabel, request.createIfMissing)}
|
|
64
53
|
$moved = 0
|
|
65
54
|
$failed = @()
|
|
66
|
-
foreach ($id in
|
|
55
|
+
foreach ($id in ${(0, run_1.psArray)(request.entryIds)}) {
|
|
56
|
+
$subject = ''
|
|
67
57
|
try {
|
|
68
58
|
$it = $ns.GetItemFromID($id, $store.StoreID)
|
|
69
|
-
[
|
|
59
|
+
try { $subject = [string]$it.Subject } catch {}
|
|
60
|
+
[void]$it.Move($scope)
|
|
70
61
|
$moved++
|
|
71
62
|
} catch {
|
|
72
|
-
$failed += [PSCustomObject]@{ entryId = $id; error = $_.Exception.Message }
|
|
63
|
+
$failed += [PSCustomObject]@{ entryId = $id; subject = $subject; error = $_.Exception.Message }
|
|
73
64
|
}
|
|
74
65
|
}
|
|
75
|
-
ConvertTo-Json
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
ConvertTo-Json -Depth 3 -InputObject ([PSCustomObject]@{
|
|
67
|
+
folderPath = [string]$scope.FolderPath
|
|
68
|
+
folderCreated = $scopeCreated
|
|
69
|
+
moved = $moved
|
|
70
|
+
failed = @($failed)
|
|
71
|
+
})
|
|
72
|
+
`, 'scan');
|
|
73
|
+
const e = (0, json_1.record)(output);
|
|
78
74
|
return {
|
|
79
|
-
folderPath: (0, json_1.str)(
|
|
80
|
-
folderCreated:
|
|
81
|
-
moved: (0, json_1.num)(
|
|
82
|
-
failed: (0, json_1.
|
|
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
|
-
}),
|
|
75
|
+
folderPath: (0, json_1.str)(e.folderPath),
|
|
76
|
+
folderCreated: (0, json_1.bool)(e.folderCreated),
|
|
77
|
+
moved: (0, json_1.num)(e.moved),
|
|
78
|
+
failed: (0, json_1.itemFailures)(e.failed),
|
|
86
79
|
};
|
|
87
80
|
}
|
|
88
81
|
//# sourceMappingURL=folders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folders.js","sourceRoot":"","sources":["../../src/windows/folders.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"folders.js","sourceRoot":"","sources":["../../src/windows/folders.ts"],"names":[],"mappings":";;AASA,4CA+BC;AAQD,8CA+BC;AA/ED,gEAAgE;AAChE,+BAA0D;AAC1D,uCAA8E;AAC9E,yCAA+E;AAC/E,kCAAmC;AAInC,yDAAyD;AAClD,KAAK,UAAU,gBAAgB,CAAC,OAA2B;IAC9D,MAAM,MAAM,GAAG,MAAM,IAAA,uBAAiB,EAAC,GAAG,IAAA,uBAAa,EAAC,OAAO,CAAC,OAAO,CAAC;EAC1E,2BAAiB;mCACgB,IAAA,WAAK,EAAC,eAAQ,CAAC,KAAK,CAAC;cAC1C,IAAA,WAAK,EAAC,OAAO,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;CAiBpC,EAAE,UAAU,CAAC,CAAC;IACX,OAAO,IAAA,cAAO,EAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QAC7B,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,GAAG,CAAC,CAAC;QACtB,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;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAC,OAAoB;IACxD,MAAM,MAAM,GAAG,MAAM,IAAA,uBAAiB,EAAC,GAAG,IAAA,uBAAa,EAAC,OAAO,CAAC,OAAO,CAAC;EAC1E,2BAAiB;EACjB,IAAA,yBAAe,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,eAAe,CAAC;;;kBAG7D,IAAA,aAAO,EAAC,OAAO,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;CAiB1C,EAAE,MAAM,CAAC,CAAC;IACP,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC;IACzB,OAAO;QACH,UAAU,EAAE,IAAA,UAAG,EAAC,CAAC,CAAC,UAAU,CAAC;QAC7B,aAAa,EAAE,IAAA,WAAI,EAAC,CAAC,CAAC,aAAa,CAAC;QACpC,KAAK,EAAE,IAAA,UAAG,EAAC,CAAC,CAAC,KAAK,CAAC;QACnB,MAAM,EAAE,IAAA,mBAAY,EAAC,CAAC,CAAC,MAAM,CAAC;KACjC,CAAC;AACN,CAAC","sourcesContent":["// Listing the folders under an Inbox, and filing mail into one.\nimport { psArray, psInt, runPowerShellJson } from './run';\nimport { accountScript, DELIVERY_STORE_PS, mailScopeScript } from './scripts';\nimport { bool, itemFailures, num, record, str, toArray } from '../shared/json';\nimport { FolderId } from '../mail';\nimport type { ListFoldersRequest, MoveRequest } from '../backend';\nimport type { InboxFolderInfo, MoveEmailsResult } from '../types';\n\n/** The folders under an account's Inbox, depth-first. */\nexport async function listInboxFolders(request: ListFoldersRequest): Promise<InboxFolderInfo[]> {\n const output = await runPowerShellJson(`${accountScript(request.account)}\n${DELIVERY_STORE_PS}\n$inbox = $store.GetDefaultFolder(${psInt(FolderId.Inbox)})\n$maxDepth = ${psInt(request.maxDepth)}\n$rows = New-Object System.Collections.ArrayList\nfunction Add-Folders($folder, [int]$level) {\n foreach ($f in $folder.Folders) {\n $itemCount = 0\n try { $itemCount = [int]$f.Items.Count } catch {}\n [void]$rows.Add([PSCustomObject]@{\n name = [string]$f.Name\n folderPath = [string]$f.FolderPath\n itemCount = $itemCount\n depth = $level\n })\n if ($level -lt $maxDepth) { Add-Folders $f ($level + 1) }\n }\n}\nAdd-Folders $inbox 1\nConvertTo-Json -Depth 3 -InputObject @($rows)\n`, 'standard');\n return toArray(output).map(row => {\n const e = record(row);\n return {\n name: str(e.name),\n folderPath: str(e.folderPath),\n itemCount: num(e.itemCount),\n depth: num(e.depth) || 1,\n };\n });\n}\n\n/**\n * File emails into a folder of the account: one under the Inbox, or a\n * well-known one by name. Moving to Deleted Items is how mail is deleted\n * recoverably. Moving rewrites each item's entry id, so the ids passed in are\n * dead afterwards.\n */\nexport async function moveOutlookEmails(request: MoveRequest): Promise<MoveEmailsResult> {\n const output = await runPowerShellJson(`${accountScript(request.account)}\n${DELIVERY_STORE_PS}\n${mailScopeScript(request.folder, request.folderLabel, request.createIfMissing)}\n$moved = 0\n$failed = @()\nforeach ($id in ${psArray(request.entryIds)}) {\n $subject = ''\n try {\n $it = $ns.GetItemFromID($id, $store.StoreID)\n try { $subject = [string]$it.Subject } catch {}\n [void]$it.Move($scope)\n $moved++\n } catch {\n $failed += [PSCustomObject]@{ entryId = $id; subject = $subject; error = $_.Exception.Message }\n }\n}\nConvertTo-Json -Depth 3 -InputObject ([PSCustomObject]@{\n folderPath = [string]$scope.FolderPath\n folderCreated = $scopeCreated\n moved = $moved\n failed = @($failed)\n})\n`, 'scan');\n const e = record(output);\n return {\n folderPath: str(e.folderPath),\n folderCreated: bool(e.folderCreated),\n moved: num(e.moved),\n failed: itemFailures(e.failed),\n };\n}\n"]}
|
package/dist/windows/index.d.ts
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
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;
|
|
1
|
+
import type { Backend } from '../backend';
|
|
2
|
+
export declare const windowsBackend: Backend;
|
package/dist/windows/index.js
CHANGED
|
@@ -1,54 +1,26 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
// The Windows
|
|
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.
|
|
3
|
+
exports.windowsBackend = void 0;
|
|
4
|
+
// The Windows backend: Outlook driven through PowerShell and its COM object model.
|
|
25
5
|
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
6
|
+
// Split by feature, since every operation is "generate a script, run it, read
|
|
7
|
+
// its output" and the interesting part of each is the script, which reads best
|
|
8
|
+
// beside the rules it encodes. `run.ts` owns running and escaping; `scripts.ts`
|
|
9
|
+
// holds the fragments several features emit.
|
|
28
10
|
const accounts_1 = require("./accounts");
|
|
29
11
|
const send_1 = require("./send");
|
|
30
|
-
const drafts_1 = require("./drafts");
|
|
31
12
|
const read_1 = require("./read");
|
|
32
13
|
const folders_1 = require("./folders");
|
|
14
|
+
const drafts_1 = require("./drafts");
|
|
33
15
|
const cleanup_1 = require("./cleanup");
|
|
34
|
-
const bounces_1 = require("./bounces");
|
|
35
16
|
const attachments_1 = require("./attachments");
|
|
17
|
+
const bounces_1 = require("./bounces");
|
|
36
18
|
const signatures_1 = require("./signatures");
|
|
37
19
|
const templates_1 = require("./templates");
|
|
38
|
-
|
|
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 = {
|
|
20
|
+
exports.windowsBackend = {
|
|
48
21
|
getOutlookAccounts: accounts_1.getOutlookAccounts,
|
|
49
22
|
sendOutlookEmail: send_1.sendOutlookEmail,
|
|
50
23
|
replyOutlookEmail: send_1.replyOutlookEmail,
|
|
51
|
-
sendAllDrafts: drafts_1.sendAllDrafts,
|
|
52
24
|
readInboxEmails: read_1.readInboxEmails,
|
|
53
25
|
searchInboxByFilter: read_1.searchInboxByFilter,
|
|
54
26
|
readSelectedEmail: read_1.readSelectedEmail,
|
|
@@ -57,12 +29,11 @@ const bridge = {
|
|
|
57
29
|
listInboxFolders: folders_1.listInboxFolders,
|
|
58
30
|
moveOutlookEmails: folders_1.moveOutlookEmails,
|
|
59
31
|
listOutlookDrafts: drafts_1.listOutlookDrafts,
|
|
60
|
-
deleteOutlookDrafts: drafts_1.deleteOutlookDrafts,
|
|
61
32
|
sendDrafts: drafts_1.sendDrafts,
|
|
33
|
+
sendAllDrafts: drafts_1.sendAllDrafts,
|
|
34
|
+
deleteOutlookDrafts: drafts_1.deleteOutlookDrafts,
|
|
62
35
|
deleteOutlookEmails: cleanup_1.deleteOutlookEmails,
|
|
63
36
|
purgeDeletedItems: cleanup_1.purgeDeletedItems,
|
|
64
|
-
saveEmailAttachment: attachments_1.saveEmailAttachment,
|
|
65
|
-
saveEmailAttachmentDetailed: attachments_1.saveEmailAttachmentDetailed,
|
|
66
37
|
saveEmailAttachments: attachments_1.saveEmailAttachments,
|
|
67
38
|
cleanUndeliverableEmails: bounces_1.cleanUndeliverableEmails,
|
|
68
39
|
collectBouncedRecipients: bounces_1.collectBouncedRecipients,
|
|
@@ -73,29 +44,4 @@ const bridge = {
|
|
|
73
44
|
saveTemplateEmail: templates_1.saveTemplateEmail,
|
|
74
45
|
editEmailTemplate: templates_1.editEmailTemplate,
|
|
75
46
|
};
|
|
76
|
-
exports.bridge = bridge;
|
|
77
|
-
// Re-exported one module at a time rather than by name: every feature module
|
|
78
|
-
// here exports exactly its bridge functions and nothing else, so the name list
|
|
79
|
-
// this replaces was a copy of the `bridge` literal above with no way to drift
|
|
80
|
-
// from it usefully.
|
|
81
|
-
__exportStar(require("./accounts"), exports);
|
|
82
|
-
__exportStar(require("./send"), exports);
|
|
83
|
-
__exportStar(require("./drafts"), exports);
|
|
84
|
-
__exportStar(require("./read"), exports);
|
|
85
|
-
__exportStar(require("./folders"), exports);
|
|
86
|
-
__exportStar(require("./cleanup"), exports);
|
|
87
|
-
__exportStar(require("./bounces"), exports);
|
|
88
|
-
__exportStar(require("./attachments"), exports);
|
|
89
|
-
__exportStar(require("./signatures"), exports);
|
|
90
|
-
__exportStar(require("./templates"), exports);
|
|
91
|
-
// The folder-scope emitter, exported so the generated script can be checked
|
|
92
|
-
// without an Outlook session — a syntax error in it would otherwise only ever
|
|
93
|
-
// surface as a failed live run.
|
|
94
|
-
var scripts_1 = require("./scripts");
|
|
95
|
-
Object.defineProperty(exports, "mailScopeScript", { enumerable: true, get: function () { return scripts_1.mailScopeScript; } });
|
|
96
|
-
/**
|
|
97
|
-
* Windows drives the full COM object model, so every operation is available —
|
|
98
|
-
* this is the reference the macOS map is measured against.
|
|
99
|
-
*/
|
|
100
|
-
exports.capabilities = (0, capabilities_1.capabilityMap)(bridge);
|
|
101
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/windows/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/windows/index.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,gFAAgF;AAChF,6CAA6C;AAC7C,yCAAgD;AAChD,iCAA6D;AAC7D,iCAAkH;AAClH,uCAAgE;AAChE,qCAA6F;AAC7F,uCAAmE;AACnE,+CAAqD;AACrD,uCAAwG;AACxG,6CAA+E;AAC/E,2CAAuF;AAG1E,QAAA,cAAc,GAAY;IACnC,kBAAkB,EAAlB,6BAAkB;IAClB,gBAAgB,EAAhB,uBAAgB;IAChB,iBAAiB,EAAjB,wBAAiB;IACjB,eAAe,EAAf,sBAAe;IACf,mBAAmB,EAAnB,0BAAmB;IACnB,iBAAiB,EAAjB,wBAAiB;IACjB,aAAa,EAAb,oBAAa;IACb,gBAAgB,EAAhB,uBAAgB;IAChB,gBAAgB,EAAhB,0BAAgB;IAChB,iBAAiB,EAAjB,2BAAiB;IACjB,iBAAiB,EAAjB,0BAAiB;IACjB,UAAU,EAAV,mBAAU;IACV,aAAa,EAAb,sBAAa;IACb,mBAAmB,EAAnB,4BAAmB;IACnB,mBAAmB,EAAnB,6BAAmB;IACnB,iBAAiB,EAAjB,2BAAiB;IACjB,oBAAoB,EAApB,kCAAoB;IACpB,wBAAwB,EAAxB,kCAAwB;IACxB,wBAAwB,EAAxB,kCAAwB;IACxB,uBAAuB,EAAvB,iCAAuB;IACvB,qBAAqB,EAArB,kCAAqB;IACrB,wBAAwB,EAAxB,qCAAwB;IACxB,kBAAkB,EAAlB,8BAAkB;IAClB,iBAAiB,EAAjB,6BAAiB;IACjB,iBAAiB,EAAjB,6BAAiB;CACpB,CAAC","sourcesContent":["// The Windows backend: Outlook driven through PowerShell and its COM object model.\n//\n// Split by feature, since every operation is \"generate a script, run it, read\n// its output\" and the interesting part of each is the script, which reads best\n// beside the rules it encodes. `run.ts` owns running and escaping; `scripts.ts`\n// holds the fragments several features emit.\nimport { getOutlookAccounts } from './accounts';\nimport { replyOutlookEmail, sendOutlookEmail } from './send';\nimport { openOutlookEmail, readEmailBody, readInboxEmails, readSelectedEmail, searchInboxByFilter } from './read';\nimport { listInboxFolders, moveOutlookEmails } from './folders';\nimport { deleteOutlookDrafts, listOutlookDrafts, sendAllDrafts, sendDrafts } from './drafts';\nimport { deleteOutlookEmails, purgeDeletedItems } from './cleanup';\nimport { saveEmailAttachments } from './attachments';\nimport { cleanUndeliverableEmails, collectBouncedRecipients, readSentRecipientGroups } from './bounces';\nimport { listOutlookSignatures, readOutlookSignatureHtml } from './signatures';\nimport { editEmailTemplate, readTemplateEmails, saveTemplateEmail } from './templates';\nimport type { Backend } from '../backend';\n\nexport const windowsBackend: Backend = {\n getOutlookAccounts,\n sendOutlookEmail,\n replyOutlookEmail,\n readInboxEmails,\n searchInboxByFilter,\n readSelectedEmail,\n readEmailBody,\n openOutlookEmail,\n listInboxFolders,\n moveOutlookEmails,\n listOutlookDrafts,\n sendDrafts,\n sendAllDrafts,\n deleteOutlookDrafts,\n deleteOutlookEmails,\n purgeDeletedItems,\n saveEmailAttachments,\n cleanUndeliverableEmails,\n collectBouncedRecipients,\n readSentRecipientGroups,\n listOutlookSignatures,\n readOutlookSignatureHtml,\n readTemplateEmails,\n saveTemplateEmail,\n editEmailTemplate,\n};\n"]}
|
package/dist/windows/read.d.ts
CHANGED
|
@@ -1,54 +1,33 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RawEmail, ReadInboxRequest, SearchRequest } from '../backend';
|
|
2
|
+
import type { EmailLocator, InboxEmail, InboxSearchMatch, SelectedEmail } from '../types';
|
|
3
|
+
/** Recent mail from the Inbox root or one folder, newest first. */
|
|
4
|
+
export declare function readInboxEmails(request: ReadInboxRequest): Promise<InboxEmail[]>;
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
4
|
-
* No subject filtering — returns everything within the date window, up to the limit.
|
|
5
|
-
* Does NOT download attachments; returns attachment names only.
|
|
6
|
+
* One email's full plain-text body, by id.
|
|
6
7
|
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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.
|
|
8
|
+
* `Body`, not `HTMLBody`: Outlook's own plain-text rendering is what every other
|
|
9
|
+
* reader here consumes, and markup costs an order of magnitude more for the same
|
|
10
|
+
* sentences. The tradeoff is that an HTML table's rows flatten.
|
|
13
11
|
*/
|
|
14
|
-
export declare function
|
|
12
|
+
export declare function readEmailBody(email: EmailLocator): Promise<RawEmail>;
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
14
|
+
* Walk every folder under the Inbox for the mail matching the request.
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
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.
|
|
16
|
+
* The window is enforced twice — a date Restrict per folder, then a per-item
|
|
17
|
+
* check — because Restrict is not reliable across stores, and a scan that
|
|
18
|
+
* silently widens on some mailboxes is the failure this guards against.
|
|
19
|
+
* `subjectLike` also drives a server-side prefilter, purely as an optimization:
|
|
20
|
+
* every subject is re-checked, so a store that can't run the query (IMAP stores
|
|
21
|
+
* accept it and match nothing) returns the same set, only slower.
|
|
31
22
|
*/
|
|
32
|
-
export declare function
|
|
23
|
+
export declare function searchInboxByFilter(request: SearchRequest): Promise<InboxSearchMatch[]>;
|
|
24
|
+
/** The email currently selected — or open — in Outlook. */
|
|
25
|
+
export declare function readSelectedEmail(): Promise<SelectedEmail>;
|
|
33
26
|
/**
|
|
34
|
-
*
|
|
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.
|
|
27
|
+
* Open an email in Outlook.
|
|
40
28
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* behavior, and is only sane paired with `filter.subjectLike` so Restrict can
|
|
45
|
-
* narrow the set server-side before anything crosses COM.
|
|
29
|
+
* Entry ids are rewritten when an item MOVES between folders, so an id recorded
|
|
30
|
+
* before its mail was filed can stop resolving. That fails as NOT_FOUND rather
|
|
31
|
+
* than guessing — the caller is the one who knows what the email was.
|
|
46
32
|
*/
|
|
47
|
-
export declare function
|
|
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>;
|
|
33
|
+
export declare function openOutlookEmail(email: EmailLocator): Promise<void>;
|