@emailthing/cli 0.0.0-alpha.3 → 0.0.0-alpha.4
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/dist/agent.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import {
|
|
4
4
|
EmailThingCLI,
|
|
5
5
|
syncData
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-6p9vvb4b.js";
|
|
7
7
|
import {
|
|
8
8
|
getDB,
|
|
9
9
|
loadAuth
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-3r08bcy6.js";
|
|
11
11
|
import"./index-3t2e65zf.js";
|
|
12
12
|
|
|
13
13
|
// src/agent.ts
|
|
@@ -423,8 +423,8 @@ Run 'bunx @emailthing/cli agent mailboxes' to see your aliases.`), db2.close(),
|
|
|
423
423
|
from: values.from,
|
|
424
424
|
to
|
|
425
425
|
});
|
|
426
|
-
if (console.log(`Send successful! Email sent from ${values.from} to ${to.join(", ")}`), sendResult && sendResult.sync.draftSync)
|
|
427
|
-
console.log(`
|
|
426
|
+
if (console.log(`Send successful! Email sent from ${values.from} to ${to.map((t) => t.type === "cc" ? `${t.address} (cc)` : t.type === "bcc" ? `${t.address} (bcc)` : t.address).join(", ")}`), console.log(sendResult), sendResult && sendResult.sync.draftSync)
|
|
427
|
+
console.log(` Email id: ${sendResult.sync.emails[0].id} (should appear as sent email shortly)`);
|
|
428
428
|
} catch (err) {
|
|
429
429
|
console.error("Email sending failed:", err?.message || err);
|
|
430
430
|
}
|
|
@@ -35,6 +35,7 @@ function initDB(dbPath) {
|
|
|
35
35
|
snippet TEXT,
|
|
36
36
|
isRead BOOLEAN DEFAULT FALSE,
|
|
37
37
|
isStarred BOOLEAN DEFAULT FALSE,
|
|
38
|
+
isSender BOOLEAN DEFAULT FALSE,
|
|
38
39
|
createdAt TEXT NOT NULL,
|
|
39
40
|
headers TEXT,
|
|
40
41
|
raw TEXT,
|
|
@@ -90,11 +91,14 @@ function initDB(dbPath) {
|
|
|
90
91
|
CREATE INDEX IF NOT EXISTS idx_emails_mailbox ON emails(mailboxId);
|
|
91
92
|
CREATE INDEX IF NOT EXISTS idx_emails_created ON emails(createdAt);
|
|
92
93
|
CREATE INDEX IF NOT EXISTS idx_categories_mailbox ON categories(mailboxId);
|
|
93
|
-
`), currentVersion <
|
|
94
|
+
`), currentVersion < 2) {
|
|
94
95
|
try {
|
|
95
96
|
db.run("ALTER TABLE emails ADD COLUMN categoryId TEXT");
|
|
96
97
|
} catch (e) {}
|
|
97
|
-
|
|
98
|
+
try {
|
|
99
|
+
db.run("ALTER TABLE emails ADD COLUMN isSender BOOLEAN DEFAULT FALSE");
|
|
100
|
+
} catch (e) {}
|
|
101
|
+
db.run("PRAGMA user_version = 2");
|
|
98
102
|
}
|
|
99
103
|
return db;
|
|
100
104
|
}
|
|
@@ -132,12 +132,12 @@ async function syncData(client, db, silent = !1) {
|
|
|
132
132
|
if (db.run("BEGIN TRANSACTION"), !silent)
|
|
133
133
|
console.error("Inserting emails...");
|
|
134
134
|
let emailStmt = db.prepare(`
|
|
135
|
-
INSERT OR REPLACE INTO emails (id, mailboxId, subject, from_addr, to_addr, cc, bcc, replyTo, body, html, snippet, isRead, isStarred, createdAt, headers, categoryId, isDeleted)
|
|
136
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
135
|
+
INSERT OR REPLACE INTO emails (id, mailboxId, subject, from_addr, to_addr, cc, bcc, replyTo, body, html, snippet, isRead, isStarred, createdAt, headers, categoryId, isDeleted, isSender)
|
|
136
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
137
137
|
`);
|
|
138
138
|
for (let email of syncData2.emails) {
|
|
139
139
|
let from = email.sender?.address || "", to = email.recipients?.[0]?.address || "", cc = email.recipients?.filter((r) => r.cc).map((r) => r.address).join(", ") || null;
|
|
140
|
-
emailStmt.run(email.id, email.mailboxId, email.subject || null, from, to, cc, email.bcc || null, email.replyTo || null, email.body || null, email.html || null, email.snippet || null, email.isRead ? !0 : !1, email.isStarred ? !0 : !1, email.createdAt, email.headers ? JSON.stringify(email.headers) : null, email.categoryId || null, email.isDeleted ? !0 : !1);
|
|
140
|
+
emailStmt.run(email.id, email.mailboxId, email.subject || null, from, to, cc, email.bcc || null, email.replyTo || null, email.body || null, email.html || null, email.snippet || null, email.isRead ? !0 : !1, email.isStarred ? !0 : !1, email.createdAt, email.headers ? JSON.stringify(email.headers) : null, email.categoryId || null, email.isDeleted ? !0 : !1, email.isSender ? !0 : !1);
|
|
141
141
|
}
|
|
142
142
|
if (!silent)
|
|
143
143
|
console.error("Inserting mailboxes...");
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
if (process.argv.includes("logout")) {
|
|
9
|
-
let { getDB, clearAuth, resetDB } = await import("./config-
|
|
9
|
+
let { getDB, clearAuth, resetDB } = await import("./config-4f9b0snt.js"), db = getDB();
|
|
10
10
|
clearAuth(db), resetDB(db), console.log("Logged out successfully. Run again to login."), db.close();
|
|
11
11
|
} else if (process.argv.includes("agent") || (process.env.CLAUDECODE || process.env.OPENCODE || process.env.AGENT) === "1")
|
|
12
12
|
await import("./agent.js");
|
package/dist/main.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import {
|
|
4
4
|
EmailThingCLI,
|
|
5
5
|
syncData
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-6p9vvb4b.js";
|
|
7
7
|
import {
|
|
8
8
|
getDB,
|
|
9
9
|
loadAuth,
|
|
10
10
|
saveAuth
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-3r08bcy6.js";
|
|
12
12
|
import {
|
|
13
13
|
__callDispose,
|
|
14
14
|
__require,
|
|
@@ -1017,7 +1017,7 @@ async function main() {
|
|
|
1017
1017
|
case "switch": {
|
|
1018
1018
|
let newMailboxId = await mailboxSwitcher(db, route.mailboxId);
|
|
1019
1019
|
if (newMailboxId === "switch-user") {
|
|
1020
|
-
let { clearAuth, resetDB } = await import("./config-
|
|
1020
|
+
let { clearAuth, resetDB } = await import("./config-4f9b0snt.js");
|
|
1021
1021
|
return clearAuth(db), resetDB(db), main();
|
|
1022
1022
|
} else if (newMailboxId)
|
|
1023
1023
|
route = { route: "list", mailboxId: newMailboxId };
|