@datasynx/agentic-crm 1.6.0 → 1.7.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/dist/cli.js +4 -65
- package/dist/cli.js.map +1 -1
- package/dist/daemon/worker.js +24 -1
- package/dist/daemon/worker.js.map +1 -1
- package/dist/{imap-o6PRuBvm.js → imap-BRgNh3T3.js} +2 -2
- package/dist/{imap-o6PRuBvm.js.map → imap-BRgNh3T3.js.map} +1 -1
- package/dist/imap-DzeqMdZ3.js +2 -0
- package/dist/{index-DNHsURo5.d.cts → index-DcDaz_cu.d.cts} +3 -3
- package/dist/{index-DNHsURo5.d.cts.map → index-DcDaz_cu.d.cts.map} +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/{login-CYgla6-A.js → login-yt9OOQQk.js} +3 -2
- package/dist/{login-CYgla6-A.js.map → login-yt9OOQQk.js.map} +1 -1
- package/dist/mailbox-config-Bu-J1O4I.js +2 -0
- package/dist/mailbox-config-Dn2xTn9N.js +67 -0
- package/dist/mailbox-config-Dn2xTn9N.js.map +1 -0
- package/dist/mailbox-poll-B8dvFAXT.js +80 -0
- package/dist/mailbox-poll-B8dvFAXT.js.map +1 -0
- package/dist/{microsoft-DgbVlHdT.js → microsoft-dsC1fQQG.js} +2 -38
- package/dist/microsoft-dsC1fQQG.js.map +1 -0
- package/dist/{token-resolver-BRLOmRvF.js → token-resolver-D98qPOOf.js} +3 -2
- package/dist/{token-resolver-BRLOmRvF.js.map → token-resolver-D98qPOOf.js.map} +1 -1
- package/dist/token-store-B0h0USqe.js +43 -0
- package/dist/token-store-B0h0USqe.js.map +1 -0
- package/dist/token-store-CEmz8d-0.js +2 -0
- package/package.json +1 -1
- package/dist/microsoft-DgbVlHdT.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -23,6 +23,7 @@ import { n as listQuotes, r as readQuote, t as generateQuote } from "./quote-gen
|
|
|
23
23
|
import { i as upsertTicket, n as nextTicketId, r as readTickets, t as listAllTickets } from "./ticket-writer-a9on36Wb.js";
|
|
24
24
|
import { i as loadSlaRules, t as calcSlaDue } from "./sla-engine-O-A1ntu_.js";
|
|
25
25
|
import { a as listSurveys, d as writeSurvey, i as getSurvey, l as savePendingSurvey, n as calcNpsScore, o as loadSurveyResponses, r as generateSurveyToken } from "./survey-engine-DngXBv47.js";
|
|
26
|
+
import { i as resolveAccountConfig, n as imapConfigFromEnv } from "./mailbox-config-Dn2xTn9N.js";
|
|
26
27
|
import { Command } from "commander";
|
|
27
28
|
import path from "path";
|
|
28
29
|
import fs from "fs";
|
|
@@ -4482,68 +4483,6 @@ complianceCommand.command("status", { isDefault: true }).description("Show the a
|
|
|
4482
4483
|
});
|
|
4483
4484
|
//#endregion
|
|
4484
4485
|
//#region src/commands/mailbox.ts
|
|
4485
|
-
/** Default IMAP endpoints for OAuth providers. */
|
|
4486
|
-
const PROVIDER_IMAP_HOST = {
|
|
4487
|
-
gmail: {
|
|
4488
|
-
host: "imap.gmail.com",
|
|
4489
|
-
port: 993
|
|
4490
|
-
},
|
|
4491
|
-
microsoft: {
|
|
4492
|
-
host: "outlook.office365.com",
|
|
4493
|
-
port: 993
|
|
4494
|
-
}
|
|
4495
|
-
};
|
|
4496
|
-
/** Read IMAP mailbox connection settings from the environment. */
|
|
4497
|
-
function imapConfigFromEnv(env = process.env) {
|
|
4498
|
-
const host = env["DXCRM_IMAP_HOST"];
|
|
4499
|
-
const user = env["DXCRM_IMAP_USER"];
|
|
4500
|
-
const pass = env["DXCRM_IMAP_PASS"];
|
|
4501
|
-
const accessToken = env["DXCRM_IMAP_TOKEN"];
|
|
4502
|
-
if (!host || !user || !pass && !accessToken) return null;
|
|
4503
|
-
return {
|
|
4504
|
-
host,
|
|
4505
|
-
port: env["DXCRM_IMAP_PORT"] ? Number(env["DXCRM_IMAP_PORT"]) : 993,
|
|
4506
|
-
secure: env["DXCRM_IMAP_SECURE"] !== "false",
|
|
4507
|
-
mailbox: env["DXCRM_IMAP_MAILBOX"] ?? "INBOX",
|
|
4508
|
-
auth: accessToken ? {
|
|
4509
|
-
user,
|
|
4510
|
-
accessToken
|
|
4511
|
-
} : {
|
|
4512
|
-
user,
|
|
4513
|
-
pass
|
|
4514
|
-
}
|
|
4515
|
-
};
|
|
4516
|
-
}
|
|
4517
|
-
/** Parse a "provider:user" account string. */
|
|
4518
|
-
function parseAccount(account) {
|
|
4519
|
-
const idx = account.indexOf(":");
|
|
4520
|
-
if (idx < 0) return null;
|
|
4521
|
-
const provider = account.slice(0, idx);
|
|
4522
|
-
const user = account.slice(idx + 1);
|
|
4523
|
-
if (provider !== "gmail" && provider !== "microsoft" || !user) return null;
|
|
4524
|
-
return {
|
|
4525
|
-
provider,
|
|
4526
|
-
user
|
|
4527
|
-
};
|
|
4528
|
-
}
|
|
4529
|
-
/** Build an IMAP config for a stored OAuth account, refreshing the token if needed. */
|
|
4530
|
-
async function resolveAccountConfig(dataDir, account, env = process.env, mailbox) {
|
|
4531
|
-
const parsed = parseAccount(account);
|
|
4532
|
-
if (!parsed) throw new Error(`Invalid --account '${account}'. Use 'gmail:you@gmail.com' or 'microsoft:you@org.com'.`);
|
|
4533
|
-
const { getFreshAccessToken } = await import("./token-resolver-BRLOmRvF.js");
|
|
4534
|
-
const accessToken = await getFreshAccessToken(dataDir, parsed.provider, parsed.user, { env });
|
|
4535
|
-
const { host, port } = PROVIDER_IMAP_HOST[parsed.provider];
|
|
4536
|
-
return {
|
|
4537
|
-
host,
|
|
4538
|
-
port,
|
|
4539
|
-
secure: true,
|
|
4540
|
-
mailbox: mailbox ?? env["DXCRM_IMAP_MAILBOX"] ?? "INBOX",
|
|
4541
|
-
auth: {
|
|
4542
|
-
user: parsed.user,
|
|
4543
|
-
accessToken
|
|
4544
|
-
}
|
|
4545
|
-
};
|
|
4546
|
-
}
|
|
4547
4486
|
/**
|
|
4548
4487
|
* Sync an IMAP mailbox (any provider). With a slug, all mail goes to that one
|
|
4549
4488
|
* customer; without, mail is auto-routed to customers by sender/recipient
|
|
@@ -4565,7 +4504,7 @@ async function runMailboxSync(opts) {
|
|
|
4565
4504
|
console.error(error(msg));
|
|
4566
4505
|
return { error: msg };
|
|
4567
4506
|
}
|
|
4568
|
-
const { syncImapMailbox } = await import("./imap-
|
|
4507
|
+
const { syncImapMailbox } = await import("./imap-DzeqMdZ3.js");
|
|
4569
4508
|
const result = await syncImapMailbox({
|
|
4570
4509
|
dataDir: opts.dataDir,
|
|
4571
4510
|
config,
|
|
@@ -4597,7 +4536,7 @@ async function runLogin(provider, user) {
|
|
|
4597
4536
|
return;
|
|
4598
4537
|
}
|
|
4599
4538
|
const account = user ?? (await ask("Gmail address: ")).trim();
|
|
4600
|
-
const { runGmailLogin } = await import("./login-
|
|
4539
|
+
const { runGmailLogin } = await import("./login-yt9OOQQk.js");
|
|
4601
4540
|
await runGmailLogin({
|
|
4602
4541
|
dataDir,
|
|
4603
4542
|
clientId,
|
|
@@ -4617,7 +4556,7 @@ async function runLogin(provider, user) {
|
|
|
4617
4556
|
}
|
|
4618
4557
|
const tenant = process.env["DXCRM_MS_TENANT"] ?? "common";
|
|
4619
4558
|
const account = user ?? (await ask("Outlook/Microsoft address: ")).trim();
|
|
4620
|
-
const { runMicrosoftLogin } = await import("./login-
|
|
4559
|
+
const { runMicrosoftLogin } = await import("./login-yt9OOQQk.js");
|
|
4621
4560
|
await runMicrosoftLogin({
|
|
4622
4561
|
dataDir,
|
|
4623
4562
|
clientId,
|