@datasynx/agentic-crm 1.3.0 → 1.5.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 (38) hide show
  1. package/README.md +17 -0
  2. package/dist/{attachments-rLa96rOK.js → attachments-BddHbCt8.js} +51 -32
  3. package/dist/{attachments-D207gXfN.js.map → attachments-BddHbCt8.js.map} +1 -1
  4. package/dist/{attachments-D207gXfN.js → attachments-Co3kXIvu.js} +46 -31
  5. package/dist/{attachments-rLa96rOK.js.map → attachments-Co3kXIvu.js.map} +1 -1
  6. package/dist/{attachments-CX2GAtsw.cjs → attachments-Dbe7Bidz.cjs} +46 -31
  7. package/dist/{attachments-CX2GAtsw.cjs.map → attachments-Dbe7Bidz.cjs.map} +1 -1
  8. package/dist/attachments-YQKYmg6N.js +2 -0
  9. package/dist/cli.js +168 -3
  10. package/dist/cli.js.map +1 -1
  11. package/dist/daemon/worker.js +1 -1
  12. package/dist/{gmail-sync-DIbrPnTK.js → gmail-sync-BHLa8v51.js} +2 -2
  13. package/dist/{gmail-sync-DIbrPnTK.js.map → gmail-sync-BHLa8v51.js.map} +1 -1
  14. package/dist/{gmail-sync-BpSVESSe.cjs → gmail-sync-CodrUNR4.cjs} +2 -2
  15. package/dist/{gmail-sync-BpSVESSe.cjs.map → gmail-sync-CodrUNR4.cjs.map} +1 -1
  16. package/dist/{gmail-sync-B4Iu3AQb.js → gmail-sync-SvECok5p.js} +2 -2
  17. package/dist/{gmail-sync-B4Iu3AQb.js.map → gmail-sync-SvECok5p.js.map} +1 -1
  18. package/dist/imap-o6PRuBvm.js +270 -0
  19. package/dist/imap-o6PRuBvm.js.map +1 -0
  20. package/dist/{index-DMTVVYwr.d.cts → index-B5_QnkG8.d.cts} +16 -16
  21. package/dist/{index-DMTVVYwr.d.cts.map → index-B5_QnkG8.d.cts.map} +1 -1
  22. package/dist/{index-BBAlKZg6.d.ts → index-FzDsNSSb.d.ts} +3 -3
  23. package/dist/{index-BBAlKZg6.d.ts.map → index-FzDsNSSb.d.ts.map} +1 -1
  24. package/dist/index.d.cts +16 -16
  25. package/dist/index.d.cts.map +1 -1
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/login-CYgla6-A.js +73 -0
  29. package/dist/login-CYgla6-A.js.map +1 -0
  30. package/dist/mcp.cjs +2 -2
  31. package/dist/mcp.js +2 -2
  32. package/dist/microsoft-DgbVlHdT.js +159 -0
  33. package/dist/microsoft-DgbVlHdT.js.map +1 -0
  34. package/dist/{server-BhNLrnAD.js → server-uqXUhF4H.js} +3 -3
  35. package/dist/{server-BhNLrnAD.js.map → server-uqXUhF4H.js.map} +1 -1
  36. package/dist/token-resolver-BRLOmRvF.js +50 -0
  37. package/dist/token-resolver-BRLOmRvF.js.map +1 -0
  38. package/package.json +4 -1
@@ -0,0 +1,159 @@
1
+ import { t as writeFileAtomic } from "./atomic-write-8yjqqLtS.js";
2
+ import path from "path";
3
+ import fs from "fs";
4
+ import { OAuth2Client } from "google-auth-library";
5
+ //#region src/sync/oauth/token-store.ts
6
+ function tokensPath(dataDir) {
7
+ return path.join(dataDir, ".agentic", "mailbox-tokens.json");
8
+ }
9
+ function keyOf(provider, user) {
10
+ return `${provider}:${user.toLowerCase()}`;
11
+ }
12
+ function readAll(dataDir) {
13
+ const file = tokensPath(dataDir);
14
+ if (!fs.existsSync(file)) return {};
15
+ try {
16
+ return JSON.parse(fs.readFileSync(file, "utf-8"));
17
+ } catch {
18
+ return {};
19
+ }
20
+ }
21
+ /** Persist (upsert) a mailbox OAuth token. */
22
+ function saveMailboxToken(dataDir, token) {
23
+ const all = readAll(dataDir);
24
+ all[keyOf(token.provider, token.user)] = token;
25
+ const file = tokensPath(dataDir);
26
+ fs.mkdirSync(path.dirname(file), { recursive: true });
27
+ writeFileAtomic(file, JSON.stringify(all, null, 2));
28
+ }
29
+ /** Load a stored token for a provider+user, or undefined. */
30
+ function loadMailboxToken(dataDir, provider, user) {
31
+ return readAll(dataDir)[keyOf(provider, user)];
32
+ }
33
+ /** True when the access token is missing or expires within `skewMs` (default 60s). */
34
+ function isTokenExpired(token, skewMs = 6e4, now = Date.now()) {
35
+ return !token.accessToken || token.expiresAt <= now + skewMs;
36
+ }
37
+ //#endregion
38
+ //#region src/sync/oauth/google.ts
39
+ const GMAIL_IMAP_SCOPE = "https://mail.google.com/";
40
+ /** Loopback redirect for the desktop/installed-app flow. */
41
+ const DEFAULT_REDIRECT = "http://127.0.0.1";
42
+ /** Build a real Google OAuth2 client for an installed/desktop app. */
43
+ function createOAuthClient(clientId, clientSecret, redirectUri = DEFAULT_REDIRECT) {
44
+ return new OAuth2Client(clientId, clientSecret, redirectUri);
45
+ }
46
+ /** The consent URL — offline access + forced consent so a refresh token is issued. */
47
+ function buildAuthUrl(client, redirectUri) {
48
+ return client.generateAuthUrl({
49
+ access_type: "offline",
50
+ prompt: "consent",
51
+ scope: GMAIL_IMAP_SCOPE,
52
+ ...redirectUri ? { redirect_uri: redirectUri } : {}
53
+ });
54
+ }
55
+ /** Exchange an authorization code for tokens. */
56
+ async function exchangeCodeForTokens(client, code, now = Date.now) {
57
+ const { tokens } = await client.getToken(code);
58
+ if (!tokens.access_token) throw new Error("Google did not return an access token");
59
+ return {
60
+ accessToken: tokens.access_token,
61
+ ...tokens.refresh_token ? { refreshToken: tokens.refresh_token } : {},
62
+ expiresAt: tokens.expiry_date ?? now() + 36e5
63
+ };
64
+ }
65
+ /** Mint a fresh access token from a stored refresh token. */
66
+ async function refreshGoogleToken(clientId, clientSecret, refreshToken, clientFactory = createOAuthClient, now = Date.now) {
67
+ const client = clientFactory(clientId, clientSecret);
68
+ client.setCredentials({ refresh_token: refreshToken });
69
+ const { credentials } = await client.refreshAccessToken();
70
+ if (!credentials.access_token) throw new Error("Google refresh did not return an access token");
71
+ return {
72
+ accessToken: credentials.access_token,
73
+ refreshToken,
74
+ expiresAt: credentials.expiry_date ?? now() + 36e5
75
+ };
76
+ }
77
+ //#endregion
78
+ //#region src/sync/oauth/microsoft.ts
79
+ const MS_IMAP_SCOPE = "offline_access https://outlook.office365.com/IMAP.AccessAsUser.All";
80
+ function endpoint(tenant, kind) {
81
+ return `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/${kind}`;
82
+ }
83
+ /** Start the device-code flow; returns the user code + verification URL to show. */
84
+ async function requestDeviceCode(clientId, tenant = "common", fetchFn = fetch) {
85
+ const res = await fetchFn(endpoint(tenant, "devicecode"), {
86
+ method: "POST",
87
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
88
+ body: new URLSearchParams({
89
+ client_id: clientId,
90
+ scope: MS_IMAP_SCOPE
91
+ }).toString()
92
+ });
93
+ if (!res.ok) throw new Error(`device code request failed: ${res.status} ${await res.text()}`);
94
+ return await res.json();
95
+ }
96
+ /**
97
+ * Poll the token endpoint until the user authorizes (or the code expires).
98
+ * Honors `authorization_pending` (keep waiting) and `slow_down` (back off).
99
+ */
100
+ async function pollForToken(opts) {
101
+ const tenant = opts.tenant ?? "common";
102
+ const fetchFn = opts.fetchFn ?? fetch;
103
+ const sleepFn = opts.sleepFn ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
104
+ const now = opts.now ?? Date.now;
105
+ let intervalMs = (opts.interval ?? 5) * 1e3;
106
+ const deadline = now() + (opts.expiresIn ?? 900) * 1e3;
107
+ for (;;) {
108
+ if (now() >= deadline) throw new Error("device code expired before authorization");
109
+ await sleepFn(intervalMs);
110
+ const res = await fetchFn(endpoint(tenant, "token"), {
111
+ method: "POST",
112
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
113
+ body: new URLSearchParams({
114
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
115
+ client_id: opts.clientId,
116
+ device_code: opts.deviceCode
117
+ }).toString()
118
+ });
119
+ const data = await res.json();
120
+ if (res.ok && "access_token" in data) return tokensFromSuccess(data, now());
121
+ const err = data.error;
122
+ if (err === "authorization_pending") continue;
123
+ if (err === "slow_down") {
124
+ intervalMs += 5e3;
125
+ continue;
126
+ }
127
+ throw new Error(`device flow failed: ${err}${describe(data)}`);
128
+ }
129
+ }
130
+ /** Exchange a refresh token for a fresh access token. */
131
+ async function refreshMicrosoftToken(clientId, refreshToken, tenant = "common", fetchFn = fetch, now = Date.now) {
132
+ const res = await fetchFn(endpoint(tenant, "token"), {
133
+ method: "POST",
134
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
135
+ body: new URLSearchParams({
136
+ grant_type: "refresh_token",
137
+ client_id: clientId,
138
+ refresh_token: refreshToken,
139
+ scope: MS_IMAP_SCOPE
140
+ }).toString()
141
+ });
142
+ const data = await res.json();
143
+ if (!res.ok || !("access_token" in data)) throw new Error(`token refresh failed: ${data.error ?? res.status}`);
144
+ return tokensFromSuccess(data, now());
145
+ }
146
+ function tokensFromSuccess(data, nowMs) {
147
+ return {
148
+ accessToken: data.access_token,
149
+ ...data.refresh_token ? { refreshToken: data.refresh_token } : {},
150
+ expiresAt: nowMs + data.expires_in * 1e3
151
+ };
152
+ }
153
+ function describe(e) {
154
+ return e.error_description ? ` (${e.error_description.split("\n")[0]})` : "";
155
+ }
156
+ //#endregion
157
+ export { buildAuthUrl as a, refreshGoogleToken as c, saveMailboxToken as d, DEFAULT_REDIRECT as i, isTokenExpired as l, refreshMicrosoftToken as n, createOAuthClient as o, requestDeviceCode as r, exchangeCodeForTokens as s, pollForToken as t, loadMailboxToken as u };
158
+
159
+ //# sourceMappingURL=microsoft-DgbVlHdT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft-DgbVlHdT.js","names":[],"sources":["../src/sync/oauth/token-store.ts","../src/sync/oauth/google.ts","../src/sync/oauth/microsoft.ts"],"sourcesContent":["// src/sync/oauth/token-store.ts\nimport fs from \"fs\";\nimport path from \"path\";\nimport { writeFileAtomic } from \"../../fs/atomic-write.js\";\n\nexport type MailboxProvider = \"gmail\" | \"microsoft\" | \"imap\";\n\nexport interface MailboxToken {\n provider: MailboxProvider;\n /** Mailbox login (email address). */\n user: string;\n accessToken: string;\n /** Long-lived refresh token used to mint new access tokens. */\n refreshToken?: string;\n /** Access-token expiry as epoch milliseconds. */\n expiresAt: number;\n scope?: string;\n}\n\nfunction tokensPath(dataDir: string): string {\n return path.join(dataDir, \".agentic\", \"mailbox-tokens.json\");\n}\n\nfunction keyOf(provider: MailboxProvider, user: string): string {\n return `${provider}:${user.toLowerCase()}`;\n}\n\nfunction readAll(dataDir: string): Record<string, MailboxToken> {\n const file = tokensPath(dataDir);\n if (!fs.existsSync(file)) return {};\n try {\n return JSON.parse(fs.readFileSync(file, \"utf-8\") as string) as Record<string, MailboxToken>;\n } catch {\n return {};\n }\n}\n\n/** Persist (upsert) a mailbox OAuth token. */\nexport function saveMailboxToken(dataDir: string, token: MailboxToken): void {\n const all = readAll(dataDir);\n all[keyOf(token.provider, token.user)] = token;\n const file = tokensPath(dataDir);\n fs.mkdirSync(path.dirname(file), { recursive: true });\n writeFileAtomic(file, JSON.stringify(all, null, 2));\n}\n\n/** Load a stored token for a provider+user, or undefined. */\nexport function loadMailboxToken(\n dataDir: string,\n provider: MailboxProvider,\n user: string\n): MailboxToken | undefined {\n return readAll(dataDir)[keyOf(provider, user)];\n}\n\n/** List all stored mailbox tokens. */\nexport function listMailboxTokens(dataDir: string): MailboxToken[] {\n return Object.values(readAll(dataDir));\n}\n\n/** True when the access token is missing or expires within `skewMs` (default 60s). */\nexport function isTokenExpired(token: MailboxToken, skewMs = 60_000, now = Date.now()): boolean {\n return !token.accessToken || token.expiresAt <= now + skewMs;\n}\n","// src/sync/oauth/google.ts\n//\n// Google OAuth2 for Gmail IMAP (XOAUTH2). IMAP requires the FULL mail scope\n// `https://mail.google.com/` — the gmail.readonly scope does NOT grant IMAP.\nimport { OAuth2Client } from \"google-auth-library\";\n\nexport const GMAIL_IMAP_SCOPE = \"https://mail.google.com/\";\n/** Loopback redirect for the desktop/installed-app flow. */\nexport const DEFAULT_REDIRECT = \"http://127.0.0.1\";\n\nexport interface GoogleTokens {\n accessToken: string;\n refreshToken?: string;\n expiresAt: number;\n}\n\n/** Minimal slice of OAuth2Client we use (lets tests inject a fake). */\nexport interface GoogleOAuthClient {\n generateAuthUrl(opts: {\n access_type?: string;\n scope?: string | string[];\n prompt?: string;\n redirect_uri?: string;\n }): string;\n getToken(code: string): Promise<{\n tokens: {\n access_token?: string | null;\n refresh_token?: string | null;\n expiry_date?: number | null;\n };\n }>;\n setCredentials(creds: { refresh_token?: string }): void;\n refreshAccessToken(): Promise<{\n credentials: { access_token?: string | null; expiry_date?: number | null };\n }>;\n}\n\n/** Build a real Google OAuth2 client for an installed/desktop app. */\nexport function createOAuthClient(\n clientId: string,\n clientSecret: string,\n redirectUri: string = DEFAULT_REDIRECT\n): GoogleOAuthClient {\n return new OAuth2Client(clientId, clientSecret, redirectUri) as unknown as GoogleOAuthClient;\n}\n\n/** The consent URL — offline access + forced consent so a refresh token is issued. */\nexport function buildAuthUrl(client: GoogleOAuthClient, redirectUri?: string): string {\n return client.generateAuthUrl({\n access_type: \"offline\",\n prompt: \"consent\",\n scope: GMAIL_IMAP_SCOPE,\n ...(redirectUri ? { redirect_uri: redirectUri } : {}),\n });\n}\n\n/** Exchange an authorization code for tokens. */\nexport async function exchangeCodeForTokens(\n client: GoogleOAuthClient,\n code: string,\n now: () => number = Date.now\n): Promise<GoogleTokens> {\n const { tokens } = await client.getToken(code);\n if (!tokens.access_token) throw new Error(\"Google did not return an access token\");\n return {\n accessToken: tokens.access_token,\n ...(tokens.refresh_token ? { refreshToken: tokens.refresh_token } : {}),\n expiresAt: tokens.expiry_date ?? now() + 3600_000,\n };\n}\n\n/** Mint a fresh access token from a stored refresh token. */\nexport async function refreshGoogleToken(\n clientId: string,\n clientSecret: string,\n refreshToken: string,\n clientFactory: (id: string, secret: string) => GoogleOAuthClient = createOAuthClient,\n now: () => number = Date.now\n): Promise<GoogleTokens> {\n const client = clientFactory(clientId, clientSecret);\n client.setCredentials({ refresh_token: refreshToken });\n const { credentials } = await client.refreshAccessToken();\n if (!credentials.access_token) throw new Error(\"Google refresh did not return an access token\");\n return {\n accessToken: credentials.access_token,\n refreshToken,\n expiresAt: credentials.expiry_date ?? now() + 3600_000,\n };\n}\n","// src/sync/oauth/microsoft.ts\n//\n// Microsoft OAuth2 *device code* flow for IMAP access (outlook.office365.com).\n// Device code suits a CLI: the user opens a URL on any device and enters a\n// short code — no local redirect server or client secret (public client).\n\nexport const MS_IMAP_SCOPE = \"offline_access https://outlook.office365.com/IMAP.AccessAsUser.All\";\n\ntype FetchFn = typeof fetch;\n\nfunction endpoint(tenant: string, kind: \"devicecode\" | \"token\"): string {\n return `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/${kind}`;\n}\n\nexport interface DeviceCodeResponse {\n device_code: string;\n user_code: string;\n verification_uri: string;\n expires_in: number;\n interval: number;\n message: string;\n}\n\nexport interface MicrosoftTokens {\n accessToken: string;\n refreshToken?: string;\n expiresAt: number;\n}\n\n/** Start the device-code flow; returns the user code + verification URL to show. */\nexport async function requestDeviceCode(\n clientId: string,\n tenant = \"common\",\n fetchFn: FetchFn = fetch\n): Promise<DeviceCodeResponse> {\n const res = await fetchFn(endpoint(tenant, \"devicecode\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body: new URLSearchParams({ client_id: clientId, scope: MS_IMAP_SCOPE }).toString(),\n });\n if (!res.ok) throw new Error(`device code request failed: ${res.status} ${await res.text()}`);\n return (await res.json()) as DeviceCodeResponse;\n}\n\ninterface TokenSuccess {\n access_token: string;\n refresh_token?: string;\n expires_in: number;\n}\ninterface TokenError {\n error: string;\n error_description?: string;\n}\n\n/**\n * Poll the token endpoint until the user authorizes (or the code expires).\n * Honors `authorization_pending` (keep waiting) and `slow_down` (back off).\n */\nexport async function pollForToken(opts: {\n clientId: string;\n deviceCode: string;\n tenant?: string;\n interval?: number;\n expiresIn?: number;\n fetchFn?: FetchFn;\n sleepFn?: (ms: number) => Promise<void>;\n now?: () => number;\n}): Promise<MicrosoftTokens> {\n const tenant = opts.tenant ?? \"common\";\n const fetchFn = opts.fetchFn ?? fetch;\n const sleepFn = opts.sleepFn ?? ((ms) => new Promise((r) => setTimeout(r, ms)));\n const now = opts.now ?? Date.now;\n let intervalMs = (opts.interval ?? 5) * 1000;\n const deadline = now() + (opts.expiresIn ?? 900) * 1000;\n\n for (;;) {\n if (now() >= deadline) throw new Error(\"device code expired before authorization\");\n await sleepFn(intervalMs);\n\n const res = await fetchFn(endpoint(tenant, \"token\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body: new URLSearchParams({\n grant_type: \"urn:ietf:params:oauth:grant-type:device_code\",\n client_id: opts.clientId,\n device_code: opts.deviceCode,\n }).toString(),\n });\n\n const data = (await res.json()) as TokenSuccess | TokenError;\n if (res.ok && \"access_token\" in data) {\n return tokensFromSuccess(data, now());\n }\n const err = (data as TokenError).error;\n if (err === \"authorization_pending\") continue;\n if (err === \"slow_down\") {\n intervalMs += 5000;\n continue;\n }\n throw new Error(`device flow failed: ${err}${describe(data as TokenError)}`);\n }\n}\n\n/** Exchange a refresh token for a fresh access token. */\nexport async function refreshMicrosoftToken(\n clientId: string,\n refreshToken: string,\n tenant = \"common\",\n fetchFn: FetchFn = fetch,\n now: () => number = Date.now\n): Promise<MicrosoftTokens> {\n const res = await fetchFn(endpoint(tenant, \"token\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body: new URLSearchParams({\n grant_type: \"refresh_token\",\n client_id: clientId,\n refresh_token: refreshToken,\n scope: MS_IMAP_SCOPE,\n }).toString(),\n });\n const data = (await res.json()) as TokenSuccess | TokenError;\n if (!res.ok || !(\"access_token\" in data)) {\n throw new Error(`token refresh failed: ${(data as TokenError).error ?? res.status}`);\n }\n return tokensFromSuccess(data, now());\n}\n\nfunction tokensFromSuccess(data: TokenSuccess, nowMs: number): MicrosoftTokens {\n return {\n accessToken: data.access_token,\n ...(data.refresh_token ? { refreshToken: data.refresh_token } : {}),\n expiresAt: nowMs + data.expires_in * 1000,\n };\n}\n\nfunction describe(e: TokenError): string {\n return e.error_description ? ` (${e.error_description.split(\"\\n\")[0]})` : \"\";\n}\n"],"mappings":";;;;;AAmBA,SAAS,WAAW,SAAyB;CAC3C,OAAO,KAAK,KAAK,SAAS,YAAY,qBAAqB;AAC7D;AAEA,SAAS,MAAM,UAA2B,MAAsB;CAC9D,OAAO,GAAG,SAAS,GAAG,KAAK,YAAY;AACzC;AAEA,SAAS,QAAQ,SAA+C;CAC9D,MAAM,OAAO,WAAW,OAAO;CAC/B,IAAI,CAAC,GAAG,WAAW,IAAI,GAAG,OAAO,CAAC;CAClC,IAAI;EACF,OAAO,KAAK,MAAM,GAAG,aAAa,MAAM,OAAO,CAAW;CAC5D,QAAQ;EACN,OAAO,CAAC;CACV;AACF;;AAGA,SAAgB,iBAAiB,SAAiB,OAA2B;CAC3E,MAAM,MAAM,QAAQ,OAAO;CAC3B,IAAI,MAAM,MAAM,UAAU,MAAM,IAAI,KAAK;CACzC,MAAM,OAAO,WAAW,OAAO;CAC/B,GAAG,UAAU,KAAK,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;CACpD,gBAAgB,MAAM,KAAK,UAAU,KAAK,MAAM,CAAC,CAAC;AACpD;;AAGA,SAAgB,iBACd,SACA,UACA,MAC0B;CAC1B,OAAO,QAAQ,OAAO,EAAE,MAAM,UAAU,IAAI;AAC9C;;AAQA,SAAgB,eAAe,OAAqB,SAAS,KAAQ,MAAM,KAAK,IAAI,GAAY;CAC9F,OAAO,CAAC,MAAM,eAAe,MAAM,aAAa,MAAM;AACxD;;;ACzDA,MAAa,mBAAmB;;AAEhC,MAAa,mBAAmB;;AA8BhC,SAAgB,kBACd,UACA,cACA,cAAsB,kBACH;CACnB,OAAO,IAAI,aAAa,UAAU,cAAc,WAAW;AAC7D;;AAGA,SAAgB,aAAa,QAA2B,aAA8B;CACpF,OAAO,OAAO,gBAAgB;EAC5B,aAAa;EACb,Q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AAoB,SAAS,IAAI,QAAQ;CAErF,OAAO,kBAAkB,MAAM,IAAI,CAAC;AACtC;AAEA,SAAS,kBAAkB,MAAoB,OAAgC;CAC7E,OAAO;EACL,aAAa,KAAK;EAClB,GAAI,KAAK,gBAAgB,EAAE,cAAc,KAAK,cAAc,IAAI,CAAC;EACjE,WAAW,QAAQ,KAAK,aAAa;CACvC;AACF;AAEA,SAAS,SAAS,GAAuB;CACvC,OAAO,EAAE,oBAAoB,KAAK,EAAE,kBAAkB,MAAM,IAAI,EAAE,GAAG,KAAK;AAC5E"}
@@ -268,7 +268,7 @@ function triggerOnQuerySync(dataDir, slug) {
268
268
  const sources = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
269
269
  if (!sources.gmail?.enabled || !sources.gmail.query) return;
270
270
  const query = sources.gmail.query;
271
- import("./gmail-sync-B4Iu3AQb.js").then(({ syncGmail }) => syncGmail({
271
+ import("./gmail-sync-SvECok5p.js").then(({ syncGmail }) => syncGmail({
272
272
  slug,
273
273
  dataDir,
274
274
  auth,
@@ -3745,7 +3745,7 @@ async function handleTriggerSync(input, dataDir = DATA_DIR$5) {
3745
3745
  try {
3746
3746
  const sources = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
3747
3747
  if (!sources.gmail?.enabled || !sources.gmail.query) continue;
3748
- const { syncGmail } = await import("./gmail-sync-B4Iu3AQb.js");
3748
+ const { syncGmail } = await import("./gmail-sync-SvECok5p.js");
3749
3749
  const result = await syncGmail({
3750
3750
  slug,
3751
3751
  dataDir,
@@ -4398,4 +4398,4 @@ else startStdio().catch((err) => {
4398
4398
  //#endregion
4399
4399
  export { startHttp, startStdio };
4400
4400
 
4401
- //# sourceMappingURL=server-BhNLrnAD.js.map
4401
+ //# sourceMappingURL=server-uqXUhF4H.js.map