@dawnlit/outlook-bridge 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -183
- package/dist/backend.d.ts +151 -0
- package/dist/backend.js +3 -0
- package/dist/backend.js.map +1 -0
- package/dist/bridge.d.ts +56 -0
- package/dist/bridge.js +507 -0
- package/dist/bridge.js.map +1 -0
- package/dist/errors.d.ts +81 -43
- package/dist/errors.js +98 -52
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +25 -52
- package/dist/index.js.map +1 -1
- package/dist/mac/accounts.d.ts +7 -2
- package/dist/mac/accounts.js +23 -6
- package/dist/mac/accounts.js.map +1 -1
- package/dist/mac/attachments.d.ts +5 -25
- package/dist/mac/attachments.js +40 -99
- package/dist/mac/attachments.js.map +1 -1
- package/dist/mac/bounces.d.ts +12 -27
- package/dist/mac/bounces.js +95 -112
- package/dist/mac/bounces.js.map +1 -1
- package/dist/mac/cleanup.d.ts +11 -25
- package/dist/mac/cleanup.js +50 -76
- package/dist/mac/cleanup.js.map +1 -1
- package/dist/mac/drafts.d.ts +13 -34
- package/dist/mac/drafts.js +95 -169
- package/dist/mac/drafts.js.map +1 -1
- package/dist/mac/folders.d.ts +10 -21
- package/dist/mac/folders.js +33 -47
- package/dist/mac/folders.js.map +1 -1
- package/dist/mac/index.d.ts +2 -22
- package/dist/mac/index.js +19 -81
- package/dist/mac/index.js.map +1 -1
- package/dist/mac/profile.d.ts +13 -0
- package/dist/mac/profile.js +149 -0
- package/dist/mac/profile.js.map +1 -0
- package/dist/mac/read.d.ts +18 -36
- package/dist/mac/read.js +154 -208
- package/dist/mac/read.js.map +1 -1
- package/dist/mac/run.d.ts +35 -39
- package/dist/mac/run.js +97 -102
- package/dist/mac/run.js.map +1 -1
- package/dist/mac/scripts.d.ts +78 -86
- package/dist/mac/scripts.js +125 -115
- package/dist/mac/scripts.js.map +1 -1
- package/dist/mac/send.d.ts +10 -20
- package/dist/mac/send.js +64 -86
- package/dist/mac/send.js.map +1 -1
- package/dist/mac/signatures.d.ts +2 -2
- package/dist/mac/signatures.js +9 -11
- package/dist/mac/signatures.js.map +1 -1
- package/dist/mac/templates.d.ts +14 -26
- package/dist/mac/templates.js +75 -113
- package/dist/mac/templates.js.map +1 -1
- package/dist/mail.d.ts +77 -45
- package/dist/mail.js +166 -73
- package/dist/mail.js.map +1 -1
- package/dist/runtime.d.ts +76 -43
- package/dist/runtime.js +103 -48
- package/dist/runtime.js.map +1 -1
- package/dist/shared/args.d.ts +48 -0
- package/dist/shared/args.js +216 -0
- package/dist/shared/args.js.map +1 -0
- package/dist/shared/attachmentMatch.d.ts +28 -16
- package/dist/shared/attachmentMatch.js +60 -22
- package/dist/shared/attachmentMatch.js.map +1 -1
- package/dist/shared/bounceReport.d.ts +11 -0
- package/dist/shared/bounceReport.js +45 -0
- package/dist/shared/bounceReport.js.map +1 -0
- package/dist/shared/bounceRules.d.ts +38 -10
- package/dist/shared/bounceRules.js +50 -32
- package/dist/shared/bounceRules.js.map +1 -1
- package/dist/shared/exec.d.ts +21 -0
- package/dist/shared/exec.js +47 -0
- package/dist/shared/exec.js.map +1 -0
- package/dist/shared/json.d.ts +12 -6
- package/dist/shared/json.js +29 -23
- package/dist/shared/json.js.map +1 -1
- package/dist/shared/locate.d.ts +39 -0
- package/dist/shared/locate.js +129 -0
- package/dist/shared/locate.js.map +1 -0
- package/dist/shared/replyBody.d.ts +42 -32
- package/dist/shared/replyBody.js +84 -71
- package/dist/shared/replyBody.js.map +1 -1
- package/dist/templateBody.d.ts +63 -0
- package/dist/{outlookTemplateSections.js → templateBody.js} +72 -72
- package/dist/templateBody.js.map +1 -0
- package/dist/types.d.ts +360 -165
- package/dist/types.js +8 -9
- package/dist/types.js.map +1 -1
- package/dist/windows/accounts.d.ts +10 -1
- package/dist/windows/accounts.js +25 -13
- package/dist/windows/accounts.js.map +1 -1
- package/dist/windows/attachments.d.ts +9 -24
- package/dist/windows/attachments.js +94 -119
- package/dist/windows/attachments.js.map +1 -1
- package/dist/windows/bounces.d.ts +13 -26
- package/dist/windows/bounces.js +169 -200
- package/dist/windows/bounces.js.map +1 -1
- package/dist/windows/cleanup.d.ts +19 -23
- package/dist/windows/cleanup.js +93 -111
- package/dist/windows/cleanup.js.map +1 -1
- package/dist/windows/drafts.d.ts +16 -35
- package/dist/windows/drafts.js +167 -253
- package/dist/windows/drafts.js.map +1 -1
- package/dist/windows/folders.d.ts +8 -13
- package/dist/windows/folders.js +45 -52
- package/dist/windows/folders.js.map +1 -1
- package/dist/windows/index.d.ts +2 -27
- package/dist/windows/index.js +11 -65
- package/dist/windows/index.js.map +1 -1
- package/dist/windows/read.d.ts +24 -45
- package/dist/windows/read.js +266 -279
- package/dist/windows/read.js.map +1 -1
- package/dist/windows/run.d.ts +39 -39
- package/dist/windows/run.js +151 -111
- package/dist/windows/run.js.map +1 -1
- package/dist/windows/scripts.d.ts +71 -38
- package/dist/windows/scripts.js +123 -71
- package/dist/windows/scripts.js.map +1 -1
- package/dist/windows/send.d.ts +6 -11
- package/dist/windows/send.js +70 -79
- package/dist/windows/send.js.map +1 -1
- package/dist/windows/signatures.d.ts +4 -10
- package/dist/windows/signatures.js +30 -37
- package/dist/windows/signatures.js.map +1 -1
- package/dist/windows/templates.d.ts +12 -18
- package/dist/windows/templates.js +126 -151
- package/dist/windows/templates.js.map +1 -1
- package/package.json +5 -4
- package/dist/OutlookService.d.ts +0 -43
- package/dist/OutlookService.js +0 -137
- package/dist/OutlookService.js.map +0 -1
- package/dist/outlookTemplateSections.d.ts +0 -62
- package/dist/outlookTemplateSections.js.map +0 -1
- package/dist/shared/capabilities.d.ts +0 -3
- package/dist/shared/capabilities.js +0 -9
- package/dist/shared/capabilities.js.map +0 -1
package/dist/mac/index.d.ts
CHANGED
|
@@ -1,22 +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: a signature that drifts from
|
|
7
|
-
* the Windows one has to fail here, in the package, rather than surface as a
|
|
8
|
-
* per-platform union in the consumer's editor.
|
|
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 declare const capabilities: CapabilityMap;
|
|
1
|
+
import type { Backend } from '../backend';
|
|
2
|
+
export declare const macBackend: Backend;
|
package/dist/mac/index.js
CHANGED
|
@@ -1,63 +1,37 @@
|
|
|
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 macOS
|
|
3
|
+
exports.macBackend = void 0;
|
|
4
|
+
// The macOS backend: Outlook driven through AppleScript (osascript).
|
|
19
5
|
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
// here fails loudly with "Account '…' not found" rather than quietly doing the
|
|
27
|
-
// wrong thing.
|
|
6
|
+
// This targets LEGACY Outlook for Mac, which implements enough of the AppleScript
|
|
7
|
+
// dictionary to enumerate accounts, read mailboxes, reply, file and delete mail.
|
|
8
|
+
// New Outlook implements only a slice of it — accounts don't enumerate and the
|
|
9
|
+
// inbox reports no messages — so there the account lookup finds nothing and
|
|
10
|
+
// every operation fails loudly as ACCOUNT_NOT_FOUND rather than quietly doing
|
|
11
|
+
// the wrong thing.
|
|
28
12
|
//
|
|
29
|
-
// Three dictionary traps are
|
|
13
|
+
// Three dictionary traps are handled where they bite:
|
|
30
14
|
// - `move`/`delete`/`close` report success even when they do nothing, so every
|
|
31
15
|
// mutation confirms with a count.
|
|
32
|
-
// - A new outgoing message lands in Temporary Items
|
|
33
|
-
// so a windowless draft
|
|
34
|
-
// -
|
|
35
|
-
// the offending line, which is why the root terms in scripts.ts are the
|
|
36
|
-
// verified ones
|
|
16
|
+
// - A new outgoing message lands in Temporary Items; `open` only displays it,
|
|
17
|
+
// so a windowless draft is moved into Drafts explicitly.
|
|
18
|
+
// - One bad dictionary term fails the WHOLE script at compile time rather than
|
|
19
|
+
// at the offending line, which is why the root terms in scripts.ts are the
|
|
20
|
+
// verified ones.
|
|
37
21
|
const accounts_1 = require("./accounts");
|
|
38
22
|
const send_1 = require("./send");
|
|
39
|
-
const drafts_1 = require("./drafts");
|
|
40
23
|
const read_1 = require("./read");
|
|
41
24
|
const folders_1 = require("./folders");
|
|
25
|
+
const drafts_1 = require("./drafts");
|
|
42
26
|
const cleanup_1 = require("./cleanup");
|
|
43
|
-
const bounces_1 = require("./bounces");
|
|
44
27
|
const attachments_1 = require("./attachments");
|
|
28
|
+
const bounces_1 = require("./bounces");
|
|
45
29
|
const signatures_1 = require("./signatures");
|
|
46
30
|
const templates_1 = require("./templates");
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The whole contract in one object — and the compile-time proof that this
|
|
50
|
-
* module answers all of it.
|
|
51
|
-
*
|
|
52
|
-
* Typed as `OutlookBridge` rather than inferred: a signature that drifts from
|
|
53
|
-
* the Windows one has to fail here, in the package, rather than surface as a
|
|
54
|
-
* per-platform union in the consumer's editor.
|
|
55
|
-
*/
|
|
56
|
-
const bridge = {
|
|
31
|
+
exports.macBackend = {
|
|
57
32
|
getOutlookAccounts: accounts_1.getOutlookAccounts,
|
|
58
33
|
sendOutlookEmail: send_1.sendOutlookEmail,
|
|
59
34
|
replyOutlookEmail: send_1.replyOutlookEmail,
|
|
60
|
-
sendAllDrafts: drafts_1.sendAllDrafts,
|
|
61
35
|
readInboxEmails: read_1.readInboxEmails,
|
|
62
36
|
searchInboxByFilter: read_1.searchInboxByFilter,
|
|
63
37
|
readSelectedEmail: read_1.readSelectedEmail,
|
|
@@ -66,12 +40,11 @@ const bridge = {
|
|
|
66
40
|
listInboxFolders: folders_1.listInboxFolders,
|
|
67
41
|
moveOutlookEmails: folders_1.moveOutlookEmails,
|
|
68
42
|
listOutlookDrafts: drafts_1.listOutlookDrafts,
|
|
69
|
-
deleteOutlookDrafts: drafts_1.deleteOutlookDrafts,
|
|
70
43
|
sendDrafts: drafts_1.sendDrafts,
|
|
44
|
+
sendAllDrafts: drafts_1.sendAllDrafts,
|
|
45
|
+
deleteOutlookDrafts: drafts_1.deleteOutlookDrafts,
|
|
71
46
|
deleteOutlookEmails: cleanup_1.deleteOutlookEmails,
|
|
72
47
|
purgeDeletedItems: cleanup_1.purgeDeletedItems,
|
|
73
|
-
saveEmailAttachment: attachments_1.saveEmailAttachment,
|
|
74
|
-
saveEmailAttachmentDetailed: attachments_1.saveEmailAttachmentDetailed,
|
|
75
48
|
saveEmailAttachments: attachments_1.saveEmailAttachments,
|
|
76
49
|
cleanUndeliverableEmails: bounces_1.cleanUndeliverableEmails,
|
|
77
50
|
collectBouncedRecipients: bounces_1.collectBouncedRecipients,
|
|
@@ -82,39 +55,4 @@ const bridge = {
|
|
|
82
55
|
saveTemplateEmail: templates_1.saveTemplateEmail,
|
|
83
56
|
editEmailTemplate: templates_1.editEmailTemplate,
|
|
84
57
|
};
|
|
85
|
-
exports.bridge = bridge;
|
|
86
|
-
// Re-exported one module at a time rather than by name: every feature module
|
|
87
|
-
// here exports exactly its bridge functions and nothing else, so the name list
|
|
88
|
-
// this replaces was a copy of the `bridge` literal above with no way to drift
|
|
89
|
-
// from it usefully.
|
|
90
|
-
__exportStar(require("./accounts"), exports);
|
|
91
|
-
__exportStar(require("./send"), exports);
|
|
92
|
-
__exportStar(require("./drafts"), exports);
|
|
93
|
-
__exportStar(require("./read"), exports);
|
|
94
|
-
__exportStar(require("./folders"), exports);
|
|
95
|
-
__exportStar(require("./cleanup"), exports);
|
|
96
|
-
__exportStar(require("./bounces"), exports);
|
|
97
|
-
__exportStar(require("./attachments"), exports);
|
|
98
|
-
__exportStar(require("./signatures"), exports);
|
|
99
|
-
__exportStar(require("./templates"), exports);
|
|
100
|
-
/**
|
|
101
|
-
* What is ported to macOS.
|
|
102
|
-
*
|
|
103
|
-
* The whole contract is, now — the gaps this map existed to announce (replies,
|
|
104
|
-
* drafts, attachments, deletion, templates, bounce handling and the Inbox-tree
|
|
105
|
-
* search) are implemented against the AppleScript dictionary rather than
|
|
106
|
-
* throwing NOT_IMPLEMENTED, so `NOT_PORTED` is empty and stays the place to
|
|
107
|
-
* name one if that ever stops being true.
|
|
108
|
-
*
|
|
109
|
-
* Two differences survive that no capability flag can express, and a caller
|
|
110
|
-
* moving between platforms has to know them:
|
|
111
|
-
* - **Ids are not portable.** macOS message ids are small integers, Windows
|
|
112
|
-
* EntryIDs are long MAPI strings; each platform rejects the other's. `storeId`
|
|
113
|
-
* has no macOS equivalent and is accepted-and-ignored throughout.
|
|
114
|
-
* - **`searchInboxByFilter` filters here, not in Outlook.** There is no
|
|
115
|
-
* AppleScript counterpart to COM's server-side `Items.Restrict`, so a
|
|
116
|
-
* `daysBack` of 0 over a large mailbox tree costs considerably more here.
|
|
117
|
-
*/
|
|
118
|
-
const NOT_PORTED = [];
|
|
119
|
-
exports.capabilities = (0, capabilities_1.capabilityMap)(bridge, NOT_PORTED);
|
|
120
58
|
//# sourceMappingURL=index.js.map
|
package/dist/mac/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mac/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mac/index.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,mBAAmB;AACnB,EAAE;AACF,sDAAsD;AACtD,gFAAgF;AAChF,qCAAqC;AACrC,+EAA+E;AAC/E,4DAA4D;AAC5D,gFAAgF;AAChF,8EAA8E;AAC9E,oBAAoB;AACpB,yCAAgD;AAChD,iCAA6D;AAC7D,iCAAkH;AAClH,uCAAgE;AAChE,qCAA6F;AAC7F,uCAAmE;AACnE,+CAAqD;AACrD,uCAAwG;AACxG,6CAA+E;AAC/E,2CAAuF;AAG1E,QAAA,UAAU,GAAY;IAC/B,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 macOS backend: Outlook driven through AppleScript (osascript).\n//\n// This targets LEGACY Outlook for Mac, which implements enough of the AppleScript\n// dictionary to enumerate accounts, read mailboxes, reply, file and delete mail.\n// New Outlook implements only a slice of it — accounts don't enumerate and the\n// inbox reports no messages — so there the account lookup finds nothing and\n// every operation fails loudly as ACCOUNT_NOT_FOUND rather than quietly doing\n// the wrong thing.\n//\n// Three dictionary traps are handled where they bite:\n// - `move`/`delete`/`close` report success even when they do nothing, so every\n// mutation confirms with a count.\n// - A new outgoing message lands in Temporary Items; `open` only displays it,\n// so a windowless draft is moved into Drafts explicitly.\n// - One bad dictionary term fails the WHOLE script at compile time rather than\n// at the offending line, which is why the root terms in scripts.ts are the\n// verified ones.\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 macBackend: 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"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** One mail account as the profile database records it. */
|
|
2
|
+
export interface ProfileAccount {
|
|
3
|
+
emailAccount: string;
|
|
4
|
+
/** AppleScript folder id per root term — the keys of `ROOT_SPECIAL_TYPES`. */
|
|
5
|
+
folderIds: Record<string, number>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Every mail account the profile knows, whether or not AppleScript can see it.
|
|
9
|
+
*
|
|
10
|
+
* An account whose row is missing a given root simply has no id for it, and the
|
|
11
|
+
* caller keeps whatever the account probe would have done.
|
|
12
|
+
*/
|
|
13
|
+
export declare function readProfileAccounts(): Promise<ProfileAccount[]>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readProfileAccounts = readProfileAccounts;
|
|
7
|
+
// Outlook's own profile database, read for the mailboxes the dictionary omits.
|
|
8
|
+
//
|
|
9
|
+
// `getOutlookAccounts` can only enumerate `exchange accounts`, `imap accounts`
|
|
10
|
+
// and `pop accounts`, and a Microsoft 365 mailbox added by the modern sync
|
|
11
|
+
// engine is none of those: Outlook files it in `AccountsMail` under a 'SHDO'
|
|
12
|
+
// server type, publishes no account object for it, and answers `every account`
|
|
13
|
+
// with -1728 rather than listing it. Even `account of <folder>` and
|
|
14
|
+
// `account of <message>` come back `missing value` inside that mailbox's own
|
|
15
|
+
// tree, so there is nothing to match an address against — the mailbox is
|
|
16
|
+
// invisible to every function in this directory while its mail sits in plain
|
|
17
|
+
// sight in the folder list.
|
|
18
|
+
//
|
|
19
|
+
// The folders themselves are reachable, because `mail folder id N` resolves
|
|
20
|
+
// against the application rather than through an account, and N is exactly the
|
|
21
|
+
// `Record_RecordID` Outlook's profile database gives that folder. So the
|
|
22
|
+
// addresses AppleScript can't report, and the ids of their well-known folders,
|
|
23
|
+
// are read from that database instead, and the generated scripts fall back to a
|
|
24
|
+
// folder id wherever the account probe comes up empty.
|
|
25
|
+
//
|
|
26
|
+
// Strictly read-only, and never fatal: every failure here leaves the caller with
|
|
27
|
+
// exactly what AppleScript could see on its own.
|
|
28
|
+
const child_process_1 = require("child_process");
|
|
29
|
+
const fs_1 = __importDefault(require("fs"));
|
|
30
|
+
const os_1 = __importDefault(require("os"));
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
32
|
+
/** Where Outlook keeps its profiles, and the profile used when there are several. */
|
|
33
|
+
const PROFILES_DIR = path_1.default.join(os_1.default.homedir(), 'Library', 'Group Containers', 'UBF8T346G9.Office', 'Outlook', 'Outlook 15 Profiles');
|
|
34
|
+
const DEFAULT_PROFILE = 'Main Profile';
|
|
35
|
+
/**
|
|
36
|
+
* `Folder_SpecialFolderType` for each root the generated scripts ask for, keyed
|
|
37
|
+
* by the dictionary term `MAC_ROOT_TERMS` resolves.
|
|
38
|
+
*
|
|
39
|
+
* These are Outlook's own numbering, confirmed against a profile's local "On My
|
|
40
|
+
* Computer" store, where every one of them appears exactly once: 1 Inbox,
|
|
41
|
+
* 2 Outbox, 8 Sent Items, 9 Deleted Items, 10 Drafts, 12 Junk, 99 the account
|
|
42
|
+
* root. Outbox is left out: a caller can still name it (`MAC_ROOT_TERMS` maps it),
|
|
43
|
+
* but nothing here files mail into one, so it is not worth an id — that request
|
|
44
|
+
* falls back to the account probe like any root the profile has no row for.
|
|
45
|
+
*/
|
|
46
|
+
const ROOT_SPECIAL_TYPES = {
|
|
47
|
+
'inbox': 1,
|
|
48
|
+
'sent items': 8,
|
|
49
|
+
'deleted items': 9,
|
|
50
|
+
'drafts': 10,
|
|
51
|
+
'junk mail': 12,
|
|
52
|
+
'root folder': 99,
|
|
53
|
+
};
|
|
54
|
+
/** Column separator for the query output - a unit separator cannot occur in a row. */
|
|
55
|
+
const SEP = '\x1f';
|
|
56
|
+
/**
|
|
57
|
+
* Address and well-known folder ids for every mail account in the profile.
|
|
58
|
+
*
|
|
59
|
+
* `Record_AccountUID` is a tagged id — the account's `Record_RecordID` in its low
|
|
60
|
+
* 32 bits, a table tag above — so the join masks rather than assuming the tag,
|
|
61
|
+
* and drops UID 0, which is the local "On My Computer" store rather than an
|
|
62
|
+
* account.
|
|
63
|
+
*/
|
|
64
|
+
const ACCOUNTS_SQL = `
|
|
65
|
+
SELECT a.Account_EmailAddress, f.Folder_SpecialFolderType, f.Record_RecordID
|
|
66
|
+
FROM AccountsMail a
|
|
67
|
+
JOIN Folders f ON (f.Record_AccountUID & 4294967295) = a.Record_RecordID
|
|
68
|
+
WHERE f.Record_AccountUID <> 0
|
|
69
|
+
AND a.Account_EmailAddress IS NOT NULL
|
|
70
|
+
AND a.Account_EmailAddress <> ''
|
|
71
|
+
AND f.Folder_SpecialFolderType IN (${Object.values(ROOT_SPECIAL_TYPES).join(', ')})
|
|
72
|
+
ORDER BY a.Record_RecordID, f.Folder_SpecialFolderType`;
|
|
73
|
+
/** The profile whose database to read, or '' when there is none to read. */
|
|
74
|
+
function profileDatabase() {
|
|
75
|
+
let names;
|
|
76
|
+
try {
|
|
77
|
+
names = fs_1.default.readdirSync(PROFILES_DIR);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return '';
|
|
81
|
+
}
|
|
82
|
+
// Outlook records no "default profile" anywhere reachable — not in its
|
|
83
|
+
// preferences, not beside the profiles — so with more than one the newest
|
|
84
|
+
// wins, after the name Outlook itself creates and all but everyone keeps.
|
|
85
|
+
const dbOf = (name) => path_1.default.join(PROFILES_DIR, name, 'Data', 'Outlook.sqlite');
|
|
86
|
+
// Outlook rewrites these files while it runs, and the whole directory sits
|
|
87
|
+
// behind macOS privacy control, so a database that existed a moment ago need
|
|
88
|
+
// not stat. An unreadable timestamp sorts last rather than throwing: this
|
|
89
|
+
// runs on nearly every macOS operation (resolveMacAccount), and a mailbox
|
|
90
|
+
// AppleScript could have named on its own must not be lost to it.
|
|
91
|
+
const mtimeOf = (db) => {
|
|
92
|
+
try {
|
|
93
|
+
return fs_1.default.statSync(db).mtimeMs;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return -Infinity;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const candidates = names
|
|
100
|
+
.map(dbOf)
|
|
101
|
+
.filter(db => fs_1.default.existsSync(db))
|
|
102
|
+
.sort((a, b) => mtimeOf(b) - mtimeOf(a));
|
|
103
|
+
const preferred = dbOf(DEFAULT_PROFILE);
|
|
104
|
+
if (candidates.includes(preferred))
|
|
105
|
+
return preferred;
|
|
106
|
+
return candidates[0] ?? '';
|
|
107
|
+
}
|
|
108
|
+
/** Run one read-only query, or return '' if anything at all gets in the way. */
|
|
109
|
+
function query(database, sql) {
|
|
110
|
+
return new Promise(resolve => {
|
|
111
|
+
(0, child_process_1.execFile)('sqlite3', ['-readonly', '-list', '-noheader', '-separator', SEP, database, sql], { timeout: 5000, maxBuffer: 1024 * 1024 }, (error, stdout) => resolve(error ? '' : stdout));
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Every mail account the profile knows, whether or not AppleScript can see it.
|
|
116
|
+
*
|
|
117
|
+
* An account whose row is missing a given root simply has no id for it, and the
|
|
118
|
+
* caller keeps whatever the account probe would have done.
|
|
119
|
+
*/
|
|
120
|
+
async function readProfileAccounts() {
|
|
121
|
+
try {
|
|
122
|
+
return await readAccounts();
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// The module's contract, enforced at its one exit: this is an enrichment
|
|
126
|
+
// pass over what AppleScript already found, so nothing that happens in it
|
|
127
|
+
// is worth failing an operation that would otherwise have worked.
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async function readAccounts() {
|
|
132
|
+
const database = profileDatabase();
|
|
133
|
+
if (!database)
|
|
134
|
+
return [];
|
|
135
|
+
const termOf = new Map(Object.entries(ROOT_SPECIAL_TYPES).map(([term, type]) => [type, term]));
|
|
136
|
+
const byAddress = new Map();
|
|
137
|
+
for (const line of (await query(database, ACCOUNTS_SQL)).split('\n')) {
|
|
138
|
+
const [address, specialType, folderId] = line.split(SEP);
|
|
139
|
+
const term = termOf.get(Number(specialType));
|
|
140
|
+
if (!address || !term || !/^\d+$/.test(folderId ?? ''))
|
|
141
|
+
continue;
|
|
142
|
+
const account = byAddress.get(address.toLowerCase())
|
|
143
|
+
?? { emailAccount: address, folderIds: {} };
|
|
144
|
+
account.folderIds[term] = Number(folderId);
|
|
145
|
+
byAddress.set(address.toLowerCase(), account);
|
|
146
|
+
}
|
|
147
|
+
return [...byAddress.values()];
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/mac/profile.ts"],"names":[],"mappings":";;;;;AAoIA,kDASC;AA7ID,+EAA+E;AAC/E,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,oEAAoE;AACpE,6EAA6E;AAC7E,yEAAyE;AACzE,6EAA6E;AAC7E,4BAA4B;AAC5B,EAAE;AACF,4EAA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CAAC,CAAC;IAClD,CAAC;IACD,OAAO,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// Outlook's own profile database, read for the mailboxes the dictionary omits.\n//\n// `getOutlookAccounts` can only enumerate `exchange accounts`, `imap accounts`\n// and `pop accounts`, and a Microsoft 365 mailbox added by the modern sync\n// engine is none of those: Outlook files it in `AccountsMail` under a 'SHDO'\n// server type, publishes no account object for it, and answers `every account`\n// with -1728 rather than listing it. Even `account of <folder>` and\n// `account of <message>` come back `missing value` inside that mailbox's own\n// tree, so there is nothing to match an address against — the mailbox is\n// invisible to every function in this directory while its mail sits in plain\n// sight in the folder list.\n//\n// The folders themselves are reachable, because `mail folder id N` resolves\n// against the application rather than through an account, and N is exactly the\n// `Record_RecordID` Outlook's profile database gives that folder. So the\n// addresses AppleScript can't report, and the ids of their well-known folders,\n// are read from that database instead, and the generated scripts fall back to a\n// folder id wherever the account probe comes up empty.\n//\n// Strictly read-only, and never fatal: every failure here leaves the caller with\n// exactly what AppleScript could see on its own.\nimport { execFile } from 'child_process';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\n/** Where Outlook keeps its profiles, and the profile used when there are several. */\nconst PROFILES_DIR = path.join(\n os.homedir(),\n 'Library', 'Group Containers', 'UBF8T346G9.Office', 'Outlook', 'Outlook 15 Profiles',\n);\nconst DEFAULT_PROFILE = 'Main Profile';\n\n/**\n * `Folder_SpecialFolderType` for each root the generated scripts ask for, keyed\n * by the dictionary term `MAC_ROOT_TERMS` resolves.\n *\n * These are Outlook's own numbering, confirmed against a profile's local \"On My\n * Computer\" store, where every one of them appears exactly once: 1 Inbox,\n * 2 Outbox, 8 Sent Items, 9 Deleted Items, 10 Drafts, 12 Junk, 99 the account\n * root. Outbox is left out: a caller can still name it (`MAC_ROOT_TERMS` maps it),\n * but nothing here files mail into one, so it is not worth an id — that request\n * falls back to the account probe like any root the profile has no row for.\n */\nconst ROOT_SPECIAL_TYPES: Readonly<Record<string, number>> = {\n 'inbox': 1,\n 'sent items': 8,\n 'deleted items': 9,\n 'drafts': 10,\n 'junk mail': 12,\n 'root folder': 99,\n};\n\n/** One mail account as the profile database records it. */\nexport interface ProfileAccount {\n emailAccount: string;\n /** AppleScript folder id per root term — the keys of `ROOT_SPECIAL_TYPES`. */\n folderIds: Record<string, number>;\n}\n\n/** Column separator for the query output - a unit separator cannot occur in a row. */\nconst SEP = '\\x1f';\n\n/**\n * Address and well-known folder ids for every mail account in the profile.\n *\n * `Record_AccountUID` is a tagged id — the account's `Record_RecordID` in its low\n * 32 bits, a table tag above — so the join masks rather than assuming the tag,\n * and drops UID 0, which is the local \"On My Computer\" store rather than an\n * account.\n */\nconst ACCOUNTS_SQL = `\n SELECT a.Account_EmailAddress, f.Folder_SpecialFolderType, f.Record_RecordID\n FROM AccountsMail a\n JOIN Folders f ON (f.Record_AccountUID & 4294967295) = a.Record_RecordID\n WHERE f.Record_AccountUID <> 0\n AND a.Account_EmailAddress IS NOT NULL\n AND a.Account_EmailAddress <> ''\n AND f.Folder_SpecialFolderType IN (${Object.values(ROOT_SPECIAL_TYPES).join(', ')})\n ORDER BY a.Record_RecordID, f.Folder_SpecialFolderType`;\n\n/** The profile whose database to read, or '' when there is none to read. */\nfunction profileDatabase(): string {\n let names: string[];\n try {\n names = fs.readdirSync(PROFILES_DIR);\n } catch {\n return '';\n }\n // Outlook records no \"default profile\" anywhere reachable — not in its\n // preferences, not beside the profiles — so with more than one the newest\n // wins, after the name Outlook itself creates and all but everyone keeps.\n const dbOf = (name: string) => path.join(PROFILES_DIR, name, 'Data', 'Outlook.sqlite');\n // Outlook rewrites these files while it runs, and the whole directory sits\n // behind macOS privacy control, so a database that existed a moment ago need\n // not stat. An unreadable timestamp sorts last rather than throwing: this\n // runs on nearly every macOS operation (resolveMacAccount), and a mailbox\n // AppleScript could have named on its own must not be lost to it.\n const mtimeOf = (db: string) => {\n try {\n return fs.statSync(db).mtimeMs;\n } catch {\n return -Infinity;\n }\n };\n const candidates = names\n .map(dbOf)\n .filter(db => fs.existsSync(db))\n .sort((a, b) => mtimeOf(b) - mtimeOf(a));\n const preferred = dbOf(DEFAULT_PROFILE);\n if (candidates.includes(preferred)) return preferred;\n return candidates[0] ?? '';\n}\n\n/** Run one read-only query, or return '' if anything at all gets in the way. */\nfunction query(database: string, sql: string): Promise<string> {\n return new Promise(resolve => {\n execFile(\n 'sqlite3',\n ['-readonly', '-list', '-noheader', '-separator', SEP, database, sql],\n {timeout: 5000, maxBuffer: 1024 * 1024},\n (error, stdout) => resolve(error ? '' : stdout),\n );\n });\n}\n\n/**\n * Every mail account the profile knows, whether or not AppleScript can see it.\n *\n * An account whose row is missing a given root simply has no id for it, and the\n * caller keeps whatever the account probe would have done.\n */\nexport async function readProfileAccounts(): Promise<ProfileAccount[]> {\n try {\n return await readAccounts();\n } catch {\n // The module's contract, enforced at its one exit: this is an enrichment\n // pass over what AppleScript already found, so nothing that happens in it\n // is worth failing an operation that would otherwise have worked.\n return [];\n }\n}\n\nasync function readAccounts(): Promise<ProfileAccount[]> {\n const database = profileDatabase();\n if (!database) return [];\n const termOf = new Map(Object.entries(ROOT_SPECIAL_TYPES).map(([term, type]) => [type, term]));\n const byAddress = new Map<string, ProfileAccount>();\n for (const line of (await query(database, ACCOUNTS_SQL)).split('\\n')) {\n const [address, specialType, folderId] = line.split(SEP);\n const term = termOf.get(Number(specialType));\n if (!address || !term || !/^\\d+$/.test(folderId ?? '')) continue;\n const account = byAddress.get(address.toLowerCase())\n ?? {emailAccount: address, folderIds: {}};\n account.folderIds[term] = Number(folderId);\n byAddress.set(address.toLowerCase(), account);\n }\n return [...byAddress.values()];\n}\n"]}
|
package/dist/mac/read.d.ts
CHANGED
|
@@ -1,46 +1,28 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RawEmail, ReadInboxRequest, SearchRequest } from '../backend';
|
|
2
|
+
import type { EmailLocator, InboxEmail, InboxSearchMatch, SelectedEmail } from '../types';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* `entryId` here is Outlook for Mac's small integer message id (e.g. "779"), not
|
|
6
|
-
* the MAPI EntryID string Windows returns. The two are not interchangeable, so
|
|
7
|
-
* don't persist one and look it up on the other platform.
|
|
4
|
+
* Recent mail from the Inbox root or one folder, newest first. Entry ids here
|
|
5
|
+
* are Outlook for Mac's integer message ids, not Windows EntryIDs.
|
|
8
6
|
*/
|
|
9
|
-
export declare function readInboxEmails(
|
|
7
|
+
export declare function readInboxEmails(request: ReadInboxRequest): Promise<InboxEmail[]>;
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `storeId` is accepted for signature parity and ignored: macOS has no StoreID,
|
|
14
|
-
* and `message id N` resolves against the application rather than one folder, so
|
|
15
|
-
* the message is found wherever it currently sits — including a subfolder.
|
|
16
|
-
*
|
|
17
|
-
* Uses `plain text content`, matching the Windows reader's use of `.Body`: the
|
|
18
|
-
* same tradeoff applies, so an HTML table's rows flatten and tabular figures are
|
|
19
|
-
* better read from an attachment.
|
|
9
|
+
* One email's full plain-text body. `storeId` has no macOS meaning: `message id
|
|
10
|
+
* N` resolves against the application, wherever the message sits.
|
|
20
11
|
*/
|
|
21
|
-
export declare function readEmailBody(
|
|
12
|
+
export declare function readEmailBody(email: EmailLocator): Promise<RawEmail>;
|
|
22
13
|
/**
|
|
23
|
-
* Walk every folder under the Inbox
|
|
24
|
-
* emails matching `filter` — full body included, attachments listed by name but
|
|
25
|
-
* not saved.
|
|
14
|
+
* Walk every folder under the Inbox for the mail matching the request.
|
|
26
15
|
*
|
|
27
|
-
* The filtering happens here rather than in Outlook:
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* 0 over a large mailbox tree is correspondingly heavier here.
|
|
32
|
-
*
|
|
33
|
-
* `subjectPattern` is applied case-insensitively regardless of the RegExp's own
|
|
34
|
-
* flags, matching PowerShell's `-match`.
|
|
16
|
+
* The filtering happens here rather than in Outlook: there is no AppleScript
|
|
17
|
+
* counterpart to COM's server-side `Items.Restrict`, so each folder is indexed in
|
|
18
|
+
* bulk reads and the subject and date tests run on the index. The results match
|
|
19
|
+
* Windows; the cost doesn't, and a wide window over a big tree is heavier here.
|
|
35
20
|
*/
|
|
36
|
-
export declare function searchInboxByFilter(
|
|
21
|
+
export declare function searchInboxByFilter(request: SearchRequest): Promise<InboxSearchMatch[]>;
|
|
37
22
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `current messages` covers both cases the Windows reader handles separately
|
|
42
|
-
* (an explorer selection and an open item), so there is no second lookup here.
|
|
23
|
+
* The email currently selected — or open — in Outlook. `current messages`
|
|
24
|
+
* covers both cases the Windows reader handles separately.
|
|
43
25
|
*/
|
|
44
26
|
export declare function readSelectedEmail(): Promise<SelectedEmail>;
|
|
45
|
-
/** Open an email in Outlook
|
|
46
|
-
export declare function openOutlookEmail(
|
|
27
|
+
/** Open an email in Outlook and bring Outlook forward. */
|
|
28
|
+
export declare function openOutlookEmail(email: EmailLocator): Promise<void>;
|