@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.
- package/README.md +17 -0
- package/dist/{attachments-rLa96rOK.js → attachments-BddHbCt8.js} +51 -32
- package/dist/{attachments-D207gXfN.js.map → attachments-BddHbCt8.js.map} +1 -1
- package/dist/{attachments-D207gXfN.js → attachments-Co3kXIvu.js} +46 -31
- package/dist/{attachments-rLa96rOK.js.map → attachments-Co3kXIvu.js.map} +1 -1
- package/dist/{attachments-CX2GAtsw.cjs → attachments-Dbe7Bidz.cjs} +46 -31
- package/dist/{attachments-CX2GAtsw.cjs.map → attachments-Dbe7Bidz.cjs.map} +1 -1
- package/dist/attachments-YQKYmg6N.js +2 -0
- package/dist/cli.js +168 -3
- package/dist/cli.js.map +1 -1
- package/dist/daemon/worker.js +1 -1
- package/dist/{gmail-sync-DIbrPnTK.js → gmail-sync-BHLa8v51.js} +2 -2
- package/dist/{gmail-sync-DIbrPnTK.js.map → gmail-sync-BHLa8v51.js.map} +1 -1
- package/dist/{gmail-sync-BpSVESSe.cjs → gmail-sync-CodrUNR4.cjs} +2 -2
- package/dist/{gmail-sync-BpSVESSe.cjs.map → gmail-sync-CodrUNR4.cjs.map} +1 -1
- package/dist/{gmail-sync-B4Iu3AQb.js → gmail-sync-SvECok5p.js} +2 -2
- package/dist/{gmail-sync-B4Iu3AQb.js.map → gmail-sync-SvECok5p.js.map} +1 -1
- package/dist/imap-o6PRuBvm.js +270 -0
- package/dist/imap-o6PRuBvm.js.map +1 -0
- package/dist/{index-DMTVVYwr.d.cts → index-B5_QnkG8.d.cts} +16 -16
- package/dist/{index-DMTVVYwr.d.cts.map → index-B5_QnkG8.d.cts.map} +1 -1
- package/dist/{index-BBAlKZg6.d.ts → index-FzDsNSSb.d.ts} +3 -3
- package/dist/{index-BBAlKZg6.d.ts.map → index-FzDsNSSb.d.ts.map} +1 -1
- package/dist/index.d.cts +16 -16
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/login-CYgla6-A.js +73 -0
- package/dist/login-CYgla6-A.js.map +1 -0
- package/dist/mcp.cjs +2 -2
- package/dist/mcp.js +2 -2
- package/dist/microsoft-DgbVlHdT.js +159 -0
- package/dist/microsoft-DgbVlHdT.js.map +1 -0
- package/dist/{server-BhNLrnAD.js → server-uqXUhF4H.js} +3 -3
- package/dist/{server-BhNLrnAD.js.map → server-uqXUhF4H.js.map} +1 -1
- package/dist/token-resolver-BRLOmRvF.js +50 -0
- package/dist/token-resolver-BRLOmRvF.js.map +1 -0
- package/package.json +4 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imap-o6PRuBvm.js","names":[],"sources":["../src/sync/email-ingest.ts","../src/sync/email-router.ts","../src/sync/connectors/imap.ts"],"sourcesContent":["// src/sync/email-ingest.ts\nimport { appendInteraction } from \"../fs/interactions-writer.js\";\nimport { persistAttachment, DEFAULT_MAX_ATTACHMENT_BYTES } from \"./attachments.js\";\nimport { chunkText } from \"../core/chunk.js\";\nimport { logger } from \"../core/logger.js\";\n\n/** An attachment with its bytes already in hand (no provider fetch needed). */\nexport interface NormalizedAttachment {\n filename: string;\n mimeType: string;\n content: Buffer;\n}\n\n/**\n * A provider-independent email, normalized from Gmail / IMAP / Graph into a\n * single shape so the downstream pipeline (summary, attachments→Markdown,\n * indexing, interaction log) is written once and reused everywhere.\n */\nexport interface NormalizedEmail {\n /** Stable id for dedup and as the attachment filename prefix. */\n messageId: string;\n /** Raw `From` header value (display name + address). */\n from: string;\n /** Recipient addresses (to + cc), lowercased. */\n toAddresses: string[];\n subject: string;\n /** Message date as YYYY-MM-DD. */\n date: string;\n /** Body already rendered to Markdown (plain verbatim or HTML→MD). */\n bodyMarkdown: string;\n attachments: NormalizedAttachment[];\n /** Canonical source ref, e.g. `imap://user@host/INBOX/42`. */\n sourceRef: string;\n}\n\nexport interface IngestOptions {\n includeAttachments?: boolean;\n maxAttachmentBytes?: number;\n direction?: \"inbound\" | \"outbound\";\n}\n\n/**\n * Ingest one normalized email into a customer: convert + index its\n * attachments, summarize it, append the interaction (with attachment links),\n * and index the full body (chunked) for semantic search. Caller is responsible\n * for deduplication (skip messages whose sourceRef is already logged).\n */\nexport async function ingestEmail(\n dataDir: string,\n slug: string,\n msg: NormalizedEmail,\n options: IngestOptions = {}\n): Promise<{ attachments: number; chunks: number }> {\n const includeAttachments = options.includeAttachments ?? true;\n const maxBytes = options.maxAttachmentBytes ?? DEFAULT_MAX_ATTACHMENT_BYTES;\n\n // Attachments first, so the interaction entry can link to the Markdown.\n const attachmentLinks: string[] = [];\n if (includeAttachments) {\n for (const att of msg.attachments) {\n if (att.content.length > maxBytes) {\n logger.warn(\"email-ingest\", \"skipping oversized attachment\", {\n filename: att.filename,\n bytes: att.content.length,\n });\n continue;\n }\n try {\n const saved = await persistAttachment({\n dataDir,\n slug,\n messageId: msg.messageId,\n source: msg.sourceRef,\n date: msg.date,\n filename: att.filename,\n mimeType: att.mimeType,\n buffer: att.content,\n });\n attachmentLinks.push(saved.markdownName);\n } catch (err) {\n logger.warn(\"email-ingest\", \"attachment failed\", {\n filename: att.filename,\n error: (err as Error).message,\n });\n }\n }\n }\n\n // LLM summary — non-blocking fallback to the raw body when no API key.\n const { summarizeEmail } = await import(\"../core/llm.js\");\n const summary = await summarizeEmail(msg.subject, msg.bodyMarkdown, msg.from);\n\n await appendInteraction(dataDir, slug, {\n date: msg.date,\n type: \"Email\",\n direction: options.direction ?? \"inbound\",\n with: msg.from,\n subject: msg.subject,\n summary: summary.summary,\n nextSteps: summary.nextSteps,\n ...(attachmentLinks.length > 0 ? { attachments: attachmentLinks } : {}),\n sourceRef: msg.sourceRef,\n synced: new Date().toISOString(),\n });\n\n // Index the full email (subject + body), chunked for long threads.\n const { indexInLanceDB } = await import(\"../core/lancedb.js\");\n const bodyChunks = chunkText(`${msg.subject}\\n${msg.bodyMarkdown}`);\n for (let i = 0; i < bodyChunks.length; i++) {\n const ref = i === 0 ? msg.sourceRef : `${msg.sourceRef}#${i}`;\n await indexInLanceDB(dataDir, slug, bodyChunks[i]!, ref, {\n date: msg.date,\n type: \"Email\",\n }).catch((err: unknown) => {\n logger.error(\"email-ingest\", \"LanceDB index failed\", { error: (err as Error).message });\n });\n }\n\n return { attachments: attachmentLinks.length, chunks: bodyChunks.length };\n}\n","// src/sync/email-router.ts\nimport fs from \"fs\";\nimport path from \"path\";\nimport matter from \"gray-matter\";\nimport { listCustomerSlugs } from \"../fs/customer-dir.js\";\n\nexport interface CustomerRoutingInfo {\n slug: string;\n /** Lowercased domains that identify this customer (e.g. \"acme.com\"). */\n domains: string[];\n /** Lowercased full email addresses that identify this customer. */\n emails: string[];\n}\n\n/** Extract the bare email address from a header value like `\"Name <a@b.com>\"`. */\nexport function extractEmailAddress(headerValue: string): string {\n const angle = headerValue.match(/<([^>]+)>/);\n const raw = (angle ? angle[1] : headerValue) ?? \"\";\n return raw.trim().toLowerCase();\n}\n\n/** The domain part of an email address, lowercased (empty string if malformed). */\nexport function domainOf(email: string): string {\n const at = email.lastIndexOf(\"@\");\n return at >= 0 ? email.slice(at + 1).trim().toLowerCase() : \"\";\n}\n\n/**\n * Split a header that may contain several comma-separated addresses\n * (To/Cc) into individual lowercased email addresses.\n */\nexport function parseAddressList(headerValue: string | undefined): string[] {\n if (!headerValue) return [];\n return headerValue\n .split(\",\")\n .map((part) => extractEmailAddress(part))\n .filter((a) => a.includes(\"@\"));\n}\n\n/** Read just the routing-relevant fields from a customer's main_facts (tolerant). */\nfunction readRoutingFields(\n dataDir: string,\n slug: string\n): { domain?: string | undefined; email?: string | undefined; primary_contact?: string | undefined } {\n const file = path.join(dataDir, \"customers\", slug, \"main_facts.md\");\n if (!fs.existsSync(file)) return {};\n try {\n const data = matter(fs.readFileSync(file, \"utf-8\")).data as Record<string, unknown>;\n return {\n domain: typeof data[\"domain\"] === \"string\" ? data[\"domain\"] : undefined,\n email: typeof data[\"email\"] === \"string\" ? data[\"email\"] : undefined,\n primary_contact:\n typeof data[\"primary_contact\"] === \"string\" ? data[\"primary_contact\"] : undefined,\n };\n } catch {\n return {};\n }\n}\n\n/**\n * Build the routing table from every customer's main_facts. A customer is\n * identified by its `domain`, `email`, and `primary_contact` (when it looks\n * like an email). Customers without any identifier are still listed (empty\n * arrays) so callers can see them, but they never match.\n */\nexport function buildRoutingTable(dataDir: string): CustomerRoutingInfo[] {\n return listCustomerSlugs(dataDir).map((slug) => {\n const facts = readRoutingFields(dataDir, slug);\n const domains = new Set<string>();\n const emails = new Set<string>();\n if (facts.domain) domains.add(facts.domain.trim().toLowerCase());\n for (const candidate of [facts.email, facts.primary_contact]) {\n if (candidate && candidate.includes(\"@\")) {\n const addr = candidate.trim().toLowerCase();\n emails.add(addr);\n const d = domainOf(addr);\n if (d) domains.add(d);\n }\n }\n return { slug, domains: [...domains], emails: [...emails] };\n });\n}\n\n/**\n * Route a message to a customer slug by matching any of its addresses\n * (from/to/cc) against the routing table. Exact email matches win over domain\n * matches. Returns the matched slug, or null when nothing matches (the message\n * is \"unrouted\").\n */\nexport function routeMessage(addresses: string[], table: CustomerRoutingInfo[]): string | null {\n const addrs = addresses.map((a) => a.trim().toLowerCase()).filter((a) => a.includes(\"@\"));\n if (addrs.length === 0) return null;\n const domains = new Set(addrs.map(domainOf).filter(Boolean));\n\n // Pass 1: exact email match (most specific).\n for (const c of table) {\n if (c.emails.some((e) => addrs.includes(e))) return c.slug;\n }\n // Pass 2: domain match.\n for (const c of table) {\n if (c.domains.some((d) => domains.has(d))) return c.slug;\n }\n return null;\n}\n","// src/sync/connectors/imap.ts\nimport { readInteractions } from \"../../fs/interactions-writer.js\";\nimport { ingestEmail, type NormalizedEmail } from \"../email-ingest.js\";\nimport { buildRoutingTable, routeMessage, domainOf } from \"../email-router.js\";\nimport { htmlToMarkdown } from \"../converters/html.js\";\nimport { logger } from \"../../core/logger.js\";\n\nexport interface ImapMailboxConfig {\n host: string;\n port?: number;\n secure?: boolean;\n /** Either a password (legacy IMAP) or an OAuth2 access token (XOAUTH2). */\n auth: { user: string; pass?: string; accessToken?: string };\n mailbox?: string;\n}\n\n/** Minimal slice of the ImapFlow client surface we depend on (for testability). */\nexport interface ImapMessage {\n uid: number;\n source: Buffer;\n}\nexport interface ImapClient {\n connect(): Promise<void>;\n getMailboxLock(mailbox: string): Promise<{ release: () => void }>;\n fetch(\n range: unknown,\n query: { uid?: boolean; source?: boolean }\n ): AsyncIterable<ImapMessage>;\n logout(): Promise<void>;\n}\n\nexport interface SyncImapOptions {\n dataDir: string;\n config: ImapMailboxConfig;\n since?: Date;\n /** Fixed customer slug. When omitted, messages are auto-routed by domain. */\n slug?: string;\n includeAttachments?: boolean;\n maxAttachmentBytes?: number;\n /** Inject a client (tests); defaults to a real ImapFlow connection. */\n clientFactory?: (config: ImapMailboxConfig) => ImapClient;\n}\n\nexport interface SyncImapResult {\n synced: number;\n skipped: number;\n unrouted: number;\n}\n\n/** Build a real ImapFlow client. Loaded lazily so the dep stays off hot paths. */\nasync function defaultClientFactory(config: ImapMailboxConfig): Promise<ImapClient> {\n const { ImapFlow } = await import(\"imapflow\");\n const auth = config.auth.accessToken\n ? { user: config.auth.user, accessToken: config.auth.accessToken }\n : { user: config.auth.user, pass: config.auth.pass ?? \"\" };\n return new ImapFlow({\n host: config.host,\n port: config.port ?? 993,\n secure: config.secure ?? true,\n auth,\n logger: false,\n }) as unknown as ImapClient;\n}\n\n/** Fields extracted from a parsed message, decoupled from mailparser's types. */\nexport interface ParsedEmailInput {\n messageId?: string | undefined;\n fromText?: string | undefined;\n toAddresses?: string[] | undefined;\n subject?: string | undefined;\n date?: Date | undefined;\n text?: string | undefined;\n html?: string | false | undefined;\n attachments?:\n | Array<{ filename?: string | undefined; contentType?: string | undefined; content: Buffer }>\n | undefined;\n}\n\n/** Normalize extracted email fields into the provider-independent email shape. */\nexport async function normalizeParsedEmail(\n parsed: ParsedEmailInput,\n ctx: { user: string; host: string; mailbox: string; uid: number }\n): Promise<NormalizedEmail> {\n const toAddresses = (parsed.toAddresses ?? [])\n .map((a) => a.toLowerCase())\n .filter((a) => a.includes(\"@\"));\n\n const plain = (parsed.text ?? \"\").trim();\n const bodyMarkdown = plain\n ? plain\n : parsed.html\n ? (await htmlToMarkdown(parsed.html)).trim()\n : \"\";\n\n const rawId = (parsed.messageId ?? \"\").replace(/[<>]/g, \"\").trim();\n const messageId = rawId || `uid-${ctx.uid}`;\n\n return {\n messageId,\n from: parsed.fromText ?? \"\",\n toAddresses,\n subject: parsed.subject ?? \"(no subject)\",\n date: (parsed.date ?? new Date()).toISOString().slice(0, 10),\n bodyMarkdown,\n attachments: (parsed.attachments ?? [])\n .filter((a) => a.filename)\n .map((a) => ({\n filename: a.filename!,\n mimeType: a.contentType ?? \"application/octet-stream\",\n content: a.content,\n })),\n sourceRef: `imap://${ctx.user}@${ctx.host}/${ctx.mailbox}/${ctx.uid}`,\n };\n}\n\n/** Flatten mailparser's AddressObject | AddressObject[] | undefined to addresses. */\nfunction flattenAddresses(\n field:\n | { value?: Array<{ address?: string | undefined }> }\n | Array<{ value?: Array<{ address?: string | undefined }> }>\n | undefined\n): string[] {\n if (!field) return [];\n const objects = Array.isArray(field) ? field : [field];\n return objects\n .flatMap((o) => o.value ?? [])\n .map((a) => (a.address ?? \"\").toLowerCase())\n .filter((a) => a.includes(\"@\"));\n}\n\n/**\n * Sync a whole IMAP mailbox (any provider). Each message is parsed, routed to a\n * customer — by a fixed `slug` or auto-routed by sender/recipient domain — and\n * ingested through the shared pipeline (attachments→Markdown, summary, index).\n * Messages that match no customer are counted as `unrouted` and skipped.\n */\nexport async function syncImapMailbox(opts: SyncImapOptions): Promise<SyncImapResult> {\n const result: SyncImapResult = { synced: 0, skipped: 0, unrouted: 0 };\n const mailbox = opts.config.mailbox ?? \"INBOX\";\n const { simpleParser } = await import(\"mailparser\");\n\n const client = opts.clientFactory\n ? opts.clientFactory(opts.config)\n : await defaultClientFactory(opts.config);\n\n // Routing table (auto-route mode) + per-slug dedup cache.\n const table = opts.slug ? null : buildRoutingTable(opts.dataDir);\n const dedupCache = new Map<string, string>();\n const seen = async (slug: string, sourceRef: string): Promise<boolean> => {\n let content = dedupCache.get(slug);\n if (content === undefined) {\n content = await readInteractions(opts.dataDir, slug).catch(() => \"\");\n dedupCache.set(slug, content);\n }\n return content.includes(sourceRef);\n };\n\n await client.connect();\n const lock = await client.getMailboxLock(mailbox);\n try {\n const range = opts.since ? { since: opts.since } : { all: true };\n for await (const message of client.fetch(range, { uid: true, source: true })) {\n try {\n const parsed = await simpleParser(message.source);\n const msg = await normalizeParsedEmail(\n {\n messageId: parsed.messageId,\n fromText: parsed.from?.text,\n toAddresses: [...flattenAddresses(parsed.to), ...flattenAddresses(parsed.cc)],\n subject: parsed.subject,\n date: parsed.date,\n text: parsed.text,\n html: parsed.html,\n attachments: parsed.attachments,\n },\n {\n user: opts.config.auth.user,\n host: opts.config.host,\n mailbox,\n uid: message.uid,\n }\n );\n\n // Route: fixed slug, or auto-route by any from/to/cc domain.\n let slug = opts.slug ?? null;\n if (!slug && table) {\n const fromAddr = (msg.from.match(/<([^>]+)>/)?.[1] ?? msg.from).toLowerCase();\n const addresses = [fromAddr, ...msg.toAddresses].filter((a) => domainOf(a));\n slug = routeMessage(addresses, table);\n }\n if (!slug) {\n result.unrouted++;\n continue;\n }\n\n if (await seen(slug, msg.sourceRef)) {\n result.skipped++;\n continue;\n }\n\n await ingestEmail(opts.dataDir, slug, msg, {\n ...(opts.includeAttachments !== undefined\n ? { includeAttachments: opts.includeAttachments }\n : {}),\n ...(opts.maxAttachmentBytes !== undefined\n ? { maxAttachmentBytes: opts.maxAttachmentBytes }\n : {}),\n direction: directionFor(msg, opts.config.auth.user),\n });\n dedupCache.set(slug, (dedupCache.get(slug) ?? \"\") + msg.sourceRef);\n result.synced++;\n } catch (err) {\n logger.warn(\"imap-sync\", \"message failed\", {\n uid: message.uid,\n error: (err as Error).message,\n });\n result.skipped++;\n }\n }\n } finally {\n lock.release();\n await client.logout().catch(() => undefined);\n }\n\n return result;\n}\n\n/** Inbound unless the mailbox owner is the sender. */\nfunction directionFor(msg: NormalizedEmail, user: string): \"inbound\" | \"outbound\" {\n const fromAddr = (msg.from.match(/<([^>]+)>/)?.[1] ?? msg.from).toLowerCase();\n return fromAddr === user.toLowerCase() ? \"outbound\" : \"inbound\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+CA,eAAsB,YACpB,SACA,MACA,KACA,UAAyB,CAAC,GACwB;CAClD,MAAM,qBAAqB,QAAQ,sBAAsB;CACzD,MAAM,WAAW,QAAQ,sBAAA;CAGzB,MAAM,kBAA4B,CAAC;CACnC,IAAI,oBACF,KAAK,MAAM,OAAO,IAAI,aAAa;EACjC,IAAI,IAAI,QAAQ,SAAS,UAAU;GACjC,OAAO,KAAK,gBAAgB,iCAAiC;IAC3D,UAAU,IAAI;IACd,OAAO,IAAI,QAAQ;GACrB,CAAC;GACD;EACF;EACA,IAAI;GACF,MAAM,QAAQ,MAAM,kBAAkB;IACpC;IACA;IACA,WAAW,IAAI;IACf,QAAQ,IAAI;IACZ,MAAM,IAAI;IACV,UAAU,IAAI;IACd,UAAU,IAAI;IACd,QAAQ,IAAI;GACd,CAAC;GACD,gBAAgB,KAAK,MAAM,YAAY;EACzC,SAAS,KAAK;GACZ,OAAO,KAAK,gBAAgB,qBAAqB;IAC/C,UAAU,IAAI;IACd,OAAQ,IAAc;GACxB,CAAC;EACH;CACF;CAIF,MAAM,EAAE,mBAAmB,MAAM,OAAO;CACxC,MAAM,UAAU,MAAM,eAAe,IAAI,SAAS,IAAI,cAAc,IAAI,IAAI;CAE5E,MAAM,kBAAkB,SAAS,MAAM;EACrC,MAAM,IAAI;EACV,MAAM;EACN,WAAW,QAAQ,aAAa;EAChC,MAAM,IAAI;EACV,SAAS,IAAI;EACb,SAAS,QAAQ;EACjB,WAAW,QAAQ;EACnB,GAAI,gBAAgB,SAAS,IAAI,EAAE,aAAa,gBA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,MAAM,WAAW,IAAI,MAAM,IAAI,MAAM,YACtC,GAAG,GAAG,IAAI,WAAW,EAAE,QAAQ,MAAM,SAAS,CAAC,CAC7C,GAAG,KAAK;GAEtC,IAAI,CAAC,MAAM;IACT,OAAO;IACP;GACF;GAEA,IAAI,MAAM,KAAK,MAAM,IAAI,SAAS,GAAG;IACnC,OAAO;IACP;GACF;GAEA,MAAM,YAAY,KAAK,SAAS,MAAM,KAAK;IACzC,GAAI,KAAK,uBAAuB,KAAA,IAC5B,EAAE,oBAAoB,KAAK,mBAAmB,IAC9C,CAAC;IACL,GAAI,KAAK,uBAAuB,KAAA,IAC5B,EAAE,oBAAoB,KAAK,mBAAmB,IAC9C,CAAC;IACL,WAAW,aAAa,KAAK,KAAK,OAAO,KAAK,IAAI;GACpD,CAAC;GACD,WAAW,IAAI,OAAO,WAAW,IAAI,IAAI,KAAK,MAAM,IAAI,SAAS;GACjE,OAAO;EACT,SAAS,KAAK;GACZ,OAAO,KAAK,aAAa,kBAAkB;IACzC,KAAK,QAAQ;IACb,OAAQ,IAAc;GACxB,CAAC;GACD,OAAO;EACT;CAEJ,UAAU;EACR,KAAK,QAAQ;EACb,MAAM,OAAO,OAAO,EAAE,YAAY,KAAA,CAAS;CAC7C;CAEA,OAAO;AACT;;AAGA,SAAS,aAAa,KAAsB,MAAsC;CAEhF,QADkB,IAAI,KAAK,MAAM,WAAW,IAAI,MAAM,IAAI,MAAM,YAClD,MAAM,KAAK,YAAY,IAAI,aAAa;AACxD"}
|
|
@@ -42,8 +42,8 @@ declare const GlobalSourcesSchema: z.ZodObject<{
|
|
|
42
42
|
version: z.ZodDefault<z.ZodNumber>;
|
|
43
43
|
created: z.ZodString;
|
|
44
44
|
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
version: number;
|
|
46
45
|
created: string;
|
|
46
|
+
version: number;
|
|
47
47
|
gmail?: {
|
|
48
48
|
type: "gmail";
|
|
49
49
|
query: string;
|
|
@@ -95,11 +95,11 @@ declare const MainFactsSchema: z.ZodObject<{
|
|
|
95
95
|
created: z.ZodEffects<z.ZodString, string, unknown>;
|
|
96
96
|
updated: z.ZodEffects<z.ZodString, string, unknown>;
|
|
97
97
|
}, "strip", z.ZodTypeAny, {
|
|
98
|
-
tags: string[];
|
|
99
|
-
created: string;
|
|
100
98
|
name: string;
|
|
101
99
|
currency: string;
|
|
102
100
|
updated: string;
|
|
101
|
+
created: string;
|
|
102
|
+
tags: string[];
|
|
103
103
|
relationship_stage: "prospect" | "active" | "churned" | "paused";
|
|
104
104
|
domain?: string | undefined;
|
|
105
105
|
email?: string | undefined;
|
|
@@ -111,10 +111,10 @@ declare const MainFactsSchema: z.ZodObject<{
|
|
|
111
111
|
}, {
|
|
112
112
|
name: string;
|
|
113
113
|
relationship_stage: "prospect" | "active" | "churned" | "paused";
|
|
114
|
-
tags?: string[] | undefined;
|
|
115
|
-
created?: unknown;
|
|
116
114
|
currency?: string | undefined;
|
|
117
115
|
updated?: unknown;
|
|
116
|
+
created?: unknown;
|
|
117
|
+
tags?: string[] | undefined;
|
|
118
118
|
domain?: string | undefined;
|
|
119
119
|
email?: string | undefined;
|
|
120
120
|
phone?: string | undefined;
|
|
@@ -140,8 +140,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
140
140
|
sourceRef: z.ZodString;
|
|
141
141
|
synced: z.ZodString;
|
|
142
142
|
}, "strip", z.ZodTypeAny, {
|
|
143
|
-
date: string;
|
|
144
143
|
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
144
|
+
date: string;
|
|
145
145
|
with: string;
|
|
146
146
|
summary: string;
|
|
147
147
|
nextSteps: string[];
|
|
@@ -151,8 +151,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
151
151
|
subject?: string | undefined;
|
|
152
152
|
attachments?: string[] | undefined;
|
|
153
153
|
}, {
|
|
154
|
-
date: string;
|
|
155
154
|
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
155
|
+
date: string;
|
|
156
156
|
with: string;
|
|
157
157
|
summary: string;
|
|
158
158
|
sourceRef: string;
|
|
@@ -214,8 +214,8 @@ declare const TicketSchema: z.ZodObject<{
|
|
|
214
214
|
status: "open" | "in-progress" | "waiting" | "resolved" | "closed";
|
|
215
215
|
id: string;
|
|
216
216
|
title: string;
|
|
217
|
-
created: string;
|
|
218
217
|
priority: "urgent" | "high" | "normal" | "low";
|
|
218
|
+
created: string;
|
|
219
219
|
resolved?: string | undefined;
|
|
220
220
|
assignee?: string | undefined;
|
|
221
221
|
slaDue?: string | undefined;
|
|
@@ -287,11 +287,10 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
287
287
|
htmlPath: z.ZodOptional<z.ZodString>;
|
|
288
288
|
}, "strip", z.ZodTypeAny, {
|
|
289
289
|
status: "draft" | "sent" | "viewed" | "accepted" | "declined";
|
|
290
|
-
createdAt: string;
|
|
291
290
|
currency: string;
|
|
292
|
-
slug: string;
|
|
293
291
|
total: number;
|
|
294
292
|
quoteNumber: string;
|
|
293
|
+
slug: string;
|
|
295
294
|
dealName: string;
|
|
296
295
|
lineItems: {
|
|
297
296
|
description: string;
|
|
@@ -302,16 +301,16 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
302
301
|
subtotal: number;
|
|
303
302
|
vatPercent: number;
|
|
304
303
|
vat: number;
|
|
304
|
+
createdAt: string;
|
|
305
305
|
validUntilDays: number;
|
|
306
306
|
validUntil: string;
|
|
307
307
|
viewedAt?: string | undefined;
|
|
308
308
|
acceptedAt?: string | undefined;
|
|
309
309
|
htmlPath?: string | undefined;
|
|
310
310
|
}, {
|
|
311
|
-
createdAt: string;
|
|
312
|
-
slug: string;
|
|
313
311
|
total: number;
|
|
314
312
|
quoteNumber: string;
|
|
313
|
+
slug: string;
|
|
315
314
|
dealName: string;
|
|
316
315
|
lineItems: {
|
|
317
316
|
description: string;
|
|
@@ -322,6 +321,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
322
321
|
subtotal: number;
|
|
323
322
|
vatPercent: number;
|
|
324
323
|
vat: number;
|
|
324
|
+
createdAt: string;
|
|
325
325
|
validUntil: string;
|
|
326
326
|
status?: "draft" | "sent" | "viewed" | "accepted" | "declined" | undefined;
|
|
327
327
|
currency?: string | undefined;
|
|
@@ -347,10 +347,10 @@ declare const KbArticleSchema: z.ZodObject<{
|
|
|
347
347
|
}, "strip", z.ZodTypeAny, {
|
|
348
348
|
id: string;
|
|
349
349
|
title: string;
|
|
350
|
+
createdAt: string;
|
|
350
351
|
category: string;
|
|
351
352
|
tags: string[];
|
|
352
353
|
public: boolean;
|
|
353
|
-
createdAt: string;
|
|
354
354
|
updatedAt: string;
|
|
355
355
|
sourceTicketId?: string | undefined;
|
|
356
356
|
}, {
|
|
@@ -420,8 +420,8 @@ declare const SurveyResponseSchema: z.ZodObject<{
|
|
|
420
420
|
token: z.ZodString;
|
|
421
421
|
sentAt: z.ZodString;
|
|
422
422
|
}, "strip", z.ZodTypeAny, {
|
|
423
|
-
surveyId: string;
|
|
424
423
|
slug: string;
|
|
424
|
+
surveyId: string;
|
|
425
425
|
contactEmail: string;
|
|
426
426
|
score: number;
|
|
427
427
|
respondedAt: string;
|
|
@@ -429,8 +429,8 @@ declare const SurveyResponseSchema: z.ZodObject<{
|
|
|
429
429
|
sentAt: string;
|
|
430
430
|
comment?: string | undefined;
|
|
431
431
|
}, {
|
|
432
|
-
surveyId: string;
|
|
433
432
|
slug: string;
|
|
433
|
+
surveyId: string;
|
|
434
434
|
contactEmail: string;
|
|
435
435
|
score: number;
|
|
436
436
|
respondedAt: string;
|
|
@@ -543,4 +543,4 @@ declare const VERSION = "0.1.0";
|
|
|
543
543
|
|
|
544
544
|
//#endregion
|
|
545
545
|
export { type GlobalSources, type InteractionEntry, type KbArticle, type MainFacts, type PipelineDeal, type QuoteLineItem, type Quote as QuoteRecord, type SurveyDefinition, type SurveyResponse, type TicketPriority, type Ticket as TicketRecord, type TicketStatus, VERSION, canSeeCustomer, clearSession, createCustomer, customerExists, filterAuditLog, getRbacConfig, getRole, getSession, readAuditLog, readMainFacts, runAudit, runBackup, runValidate, setSession };
|
|
546
|
-
//# sourceMappingURL=index-
|
|
546
|
+
//# sourceMappingURL=index-B5_QnkG8.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-B5_QnkG8.d.cts","names":[],"sources":["../src/schemas/sources.ts","../src/schemas/main-facts.ts","../src/schemas/interaction.ts","../src/schemas/pipeline.ts","../src/schemas/ticket.ts","../src/schemas/quote.ts","../src/schemas/kb-article.ts","../src/schemas/survey.ts","../src/commands/create.ts","../src/commands/backup.ts","../src/commands/audit.ts","../src/commands/validate.ts","../src/fs/customer-dir.ts","../src/fs/audit-log.ts","../src/core/rbac.ts","../src/core/session-store.ts","../src/version.ts"],"mappings":";;;;cAea,qBAAmB,CAAA,CAAA;;IAAA,IAAA,cAAA,CAAA,OAAA,CAAA;IAAA,KAAA,aAAA;IAUpB,OAAA,cAAa,aAAA,CAAA;EAAA,CAAA,EAAA,OAAA,cAAA,EAAA;IAAkB,IAAA,EAAA,OAAA;IAAf,KAAE,EAAA,MAAA;IAAK,OAAA,EAAA,OAAA;;;;ICvBtB,OAAA,CAAA,EAAA,OAoBX,GAAA,SAAA;EAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;SApB0B,EAAA,MAAA;EAAA,OAAA,EAAA,MAAA;EAsBhB,KAAA,CAAA,EAAA;IAAS,IAAA,EAAA,OAAA;IAAkB,KAAA,EAAA,MAAA;IAAf,OAAE,EAAA,OAAA;EAAK,CAAA,GAAA,SAAA;;;;ECtBlB,WAAA,CAAA,EAAA;IAYX,IAAA,EAAA,YAAA;;;;;;;;;;;;;;;;;;IAZiC,OAAA,CAAA,EAAA,OAAA,GAAA,SAAA;IAAA,UAAA,CAAA,EAAA,MAAA,EAAA,GAAA,SAAA;EAcvB,CAAA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;qBAAuD;;;iBCnB7D,cAAA;;;iBAsCM,aAAA,iCAA8C,QAAQ;;;;UCzD3D,UAAA;;;EbYJ,IAAA,EAAA,MAAA;EAMX,IAAA,EAAA,MAAA;;;iBacc,YAAA,mBAA+B;iBA6B/B,cAAA,UACL;;;;IAER;;;;KC/DS,IAAA;UAEK,UAAA;UACP,eAAe;EdQZ,OAAA,CAAA,EcPD,IdOC;EAMX,eAAA,CAAA,EcZkB,MdYlB,CAAA,MAAA,EAAA,MAAA,EAAA,CAAA;;ccVY,eAAe;;iBAsBb,aAAA,mBAAgC;iBAUhC,OAAA,kCAAyC;iBAuBzC,cAAA;;;;;;;;UClEC,OAAA;;;EfeJ,SAAA,EAAA,MAAA;EAMX,KAAA,CAAA,EAAA,MAAA;;iBeZc,UAAA,IAAc;iBAId,UAAA,CAAA,GAAc;iBAId,YAAA,CAAA;;;;cCjBH,OAAA"}
|
|
@@ -141,8 +141,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
141
141
|
sourceRef: z.ZodString;
|
|
142
142
|
synced: z.ZodString;
|
|
143
143
|
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
145
144
|
date: string;
|
|
145
|
+
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
146
146
|
with: string;
|
|
147
147
|
summary: string;
|
|
148
148
|
nextSteps: string[];
|
|
@@ -152,8 +152,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
152
152
|
subject?: string | undefined;
|
|
153
153
|
attachments?: string[] | undefined;
|
|
154
154
|
}, {
|
|
155
|
-
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
156
155
|
date: string;
|
|
156
|
+
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
157
157
|
with: string;
|
|
158
158
|
summary: string;
|
|
159
159
|
sourceRef: string;
|
|
@@ -544,4 +544,4 @@ declare const VERSION = "0.1.0";
|
|
|
544
544
|
|
|
545
545
|
//#endregion
|
|
546
546
|
export { type GlobalSources, type InteractionEntry, type KbArticle, type MainFacts, type PipelineDeal, type QuoteLineItem, type Quote as QuoteRecord, type SurveyDefinition, type SurveyResponse, type TicketPriority, type Ticket as TicketRecord, type TicketStatus, VERSION, canSeeCustomer, clearSession, createCustomer, customerExists, filterAuditLog, getRbacConfig, getRole, getSession, readAuditLog, readMainFacts, runAudit, runBackup, runValidate, setSession };
|
|
547
|
-
//# sourceMappingURL=index-
|
|
547
|
+
//# sourceMappingURL=index-FzDsNSSb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-FzDsNSSb.d.ts","names":[],"sources":["../src/schemas/sources.ts","../src/schemas/main-facts.ts","../src/schemas/interaction.ts","../src/schemas/pipeline.ts","../src/schemas/ticket.ts","../src/schemas/quote.ts","../src/schemas/kb-article.ts","../src/schemas/survey.ts","../src/commands/create.ts","../src/commands/backup.ts","../src/commands/audit.ts","../src/commands/validate.ts","../src/fs/customer-dir.ts","../src/fs/audit-log.ts","../src/core/rbac.ts","../src/core/session-store.ts","../src/version.ts"],"mappings":";;;;;cAea,qBAAmB,CAAA,CAAA;;;IAAA,KAAA,aAAA;IAAA,OAAA,cAAA,aAAA,CAAA;EAUpB,CAAA,EAAA,OAAA,cAAa,EAAA;IAAA,IAAA,EAAA,OAAA;IAAkB,KAAA,EAAA,MAAA;IAAf,OAAE,EAAA,OAAA;EAAK,CAAA,EAAA;;;;ECvBtB,CAAA,CAAA,CAAA;EAoBX,QAAA,eAAA,YAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;SApB0B,EAAA,MAAA;EAAA,KAAA,CAAA,EAAA;IAsBhB,IAAA,EAAA,OAAS;IAAA,KAAA,EAAA,MAAA;IAAkB,OAAA,EAAA,O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,iCAA8C,QAAQ;;;;UCzD3D,UAAA;;;;EbYJ,IAAA,EAAA,MAAA;EAMX,OAAA,EAAA,MAAA;;iBacc,YAAA,mBAA+B;iBA6B/B,cAAA,UACL;;;;IAER;;;;KC/DS,IAAA;UAEK,UAAA;UACP,eAAe;YACb;EdOC,eAAA,CAAA,EcNO,MdYlB,CAAA,MAAA,EAAA,MAAA,EAAA,CAAA;EAAA;ccVY,eAAe;;iBAsBb,aAAA,mBAAgC;iBAUhC,OAAA,kCAAyC;iBAuBzC,cAAA;;;;;;;;UClEC,OAAA;;;;EfeJ,KAAA,CAAA,EAAA,MAAA;;iBeNG,UAAA,IAAc;iBAId,UAAA,CAAA,GAAc;iBAId,YAAA,CAAA;;;;cCjBH,OAAA"}
|
package/dist/index.d.cts
CHANGED
|
@@ -42,8 +42,8 @@ declare const GlobalSourcesSchema: z.ZodObject<{
|
|
|
42
42
|
version: z.ZodDefault<z.ZodNumber>;
|
|
43
43
|
created: z.ZodString;
|
|
44
44
|
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
version: number;
|
|
46
45
|
created: string;
|
|
46
|
+
version: number;
|
|
47
47
|
gmail?: {
|
|
48
48
|
type: "gmail";
|
|
49
49
|
query: string;
|
|
@@ -95,11 +95,11 @@ declare const MainFactsSchema: z.ZodObject<{
|
|
|
95
95
|
created: z.ZodEffects<z.ZodString, string, unknown>;
|
|
96
96
|
updated: z.ZodEffects<z.ZodString, string, unknown>;
|
|
97
97
|
}, "strip", z.ZodTypeAny, {
|
|
98
|
-
tags: string[];
|
|
99
|
-
created: string;
|
|
100
98
|
name: string;
|
|
101
99
|
currency: string;
|
|
102
100
|
updated: string;
|
|
101
|
+
created: string;
|
|
102
|
+
tags: string[];
|
|
103
103
|
relationship_stage: "prospect" | "active" | "churned" | "paused";
|
|
104
104
|
domain?: string | undefined;
|
|
105
105
|
email?: string | undefined;
|
|
@@ -111,10 +111,10 @@ declare const MainFactsSchema: z.ZodObject<{
|
|
|
111
111
|
}, {
|
|
112
112
|
name: string;
|
|
113
113
|
relationship_stage: "prospect" | "active" | "churned" | "paused";
|
|
114
|
-
tags?: string[] | undefined;
|
|
115
|
-
created?: unknown;
|
|
116
114
|
currency?: string | undefined;
|
|
117
115
|
updated?: unknown;
|
|
116
|
+
created?: unknown;
|
|
117
|
+
tags?: string[] | undefined;
|
|
118
118
|
domain?: string | undefined;
|
|
119
119
|
email?: string | undefined;
|
|
120
120
|
phone?: string | undefined;
|
|
@@ -140,8 +140,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
140
140
|
sourceRef: z.ZodString;
|
|
141
141
|
synced: z.ZodString;
|
|
142
142
|
}, "strip", z.ZodTypeAny, {
|
|
143
|
-
date: string;
|
|
144
143
|
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
144
|
+
date: string;
|
|
145
145
|
with: string;
|
|
146
146
|
summary: string;
|
|
147
147
|
nextSteps: string[];
|
|
@@ -151,8 +151,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
151
151
|
subject?: string | undefined;
|
|
152
152
|
attachments?: string[] | undefined;
|
|
153
153
|
}, {
|
|
154
|
-
date: string;
|
|
155
154
|
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
155
|
+
date: string;
|
|
156
156
|
with: string;
|
|
157
157
|
summary: string;
|
|
158
158
|
sourceRef: string;
|
|
@@ -214,8 +214,8 @@ declare const TicketSchema: z.ZodObject<{
|
|
|
214
214
|
status: "open" | "in-progress" | "waiting" | "resolved" | "closed";
|
|
215
215
|
id: string;
|
|
216
216
|
title: string;
|
|
217
|
-
created: string;
|
|
218
217
|
priority: "urgent" | "high" | "normal" | "low";
|
|
218
|
+
created: string;
|
|
219
219
|
resolved?: string | undefined;
|
|
220
220
|
assignee?: string | undefined;
|
|
221
221
|
slaDue?: string | undefined;
|
|
@@ -287,11 +287,10 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
287
287
|
htmlPath: z.ZodOptional<z.ZodString>;
|
|
288
288
|
}, "strip", z.ZodTypeAny, {
|
|
289
289
|
status: "draft" | "sent" | "viewed" | "accepted" | "declined";
|
|
290
|
-
createdAt: string;
|
|
291
290
|
currency: string;
|
|
292
|
-
slug: string;
|
|
293
291
|
total: number;
|
|
294
292
|
quoteNumber: string;
|
|
293
|
+
slug: string;
|
|
295
294
|
dealName: string;
|
|
296
295
|
lineItems: {
|
|
297
296
|
description: string;
|
|
@@ -302,16 +301,16 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
302
301
|
subtotal: number;
|
|
303
302
|
vatPercent: number;
|
|
304
303
|
vat: number;
|
|
304
|
+
createdAt: string;
|
|
305
305
|
validUntilDays: number;
|
|
306
306
|
validUntil: string;
|
|
307
307
|
viewedAt?: string | undefined;
|
|
308
308
|
acceptedAt?: string | undefined;
|
|
309
309
|
htmlPath?: string | undefined;
|
|
310
310
|
}, {
|
|
311
|
-
createdAt: string;
|
|
312
|
-
slug: string;
|
|
313
311
|
total: number;
|
|
314
312
|
quoteNumber: string;
|
|
313
|
+
slug: string;
|
|
315
314
|
dealName: string;
|
|
316
315
|
lineItems: {
|
|
317
316
|
description: string;
|
|
@@ -322,6 +321,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
322
321
|
subtotal: number;
|
|
323
322
|
vatPercent: number;
|
|
324
323
|
vat: number;
|
|
324
|
+
createdAt: string;
|
|
325
325
|
validUntil: string;
|
|
326
326
|
status?: "draft" | "sent" | "viewed" | "accepted" | "declined" | undefined;
|
|
327
327
|
currency?: string | undefined;
|
|
@@ -347,10 +347,10 @@ declare const KbArticleSchema: z.ZodObject<{
|
|
|
347
347
|
}, "strip", z.ZodTypeAny, {
|
|
348
348
|
id: string;
|
|
349
349
|
title: string;
|
|
350
|
+
createdAt: string;
|
|
350
351
|
category: string;
|
|
351
352
|
tags: string[];
|
|
352
353
|
public: boolean;
|
|
353
|
-
createdAt: string;
|
|
354
354
|
updatedAt: string;
|
|
355
355
|
sourceTicketId?: string | undefined;
|
|
356
356
|
}, {
|
|
@@ -420,8 +420,8 @@ declare const SurveyResponseSchema: z.ZodObject<{
|
|
|
420
420
|
token: z.ZodString;
|
|
421
421
|
sentAt: z.ZodString;
|
|
422
422
|
}, "strip", z.ZodTypeAny, {
|
|
423
|
-
surveyId: string;
|
|
424
423
|
slug: string;
|
|
424
|
+
surveyId: string;
|
|
425
425
|
contactEmail: string;
|
|
426
426
|
score: number;
|
|
427
427
|
respondedAt: string;
|
|
@@ -429,8 +429,8 @@ declare const SurveyResponseSchema: z.ZodObject<{
|
|
|
429
429
|
sentAt: string;
|
|
430
430
|
comment?: string | undefined;
|
|
431
431
|
}, {
|
|
432
|
-
surveyId: string;
|
|
433
432
|
slug: string;
|
|
433
|
+
surveyId: string;
|
|
434
434
|
contactEmail: string;
|
|
435
435
|
score: number;
|
|
436
436
|
respondedAt: string;
|
|
@@ -543,4 +543,4 @@ declare const VERSION = "0.1.0";
|
|
|
543
543
|
|
|
544
544
|
//#endregion
|
|
545
545
|
export { type GlobalSources, type InteractionEntry, type KbArticle, type MainFacts, type PipelineDeal, type QuoteLineItem, type Quote as QuoteRecord, type SurveyDefinition, type SurveyResponse, type TicketPriority, type Ticket as TicketRecord, type TicketStatus, VERSION, canSeeCustomer, clearSession, createCustomer, customerExists, filterAuditLog, getRbacConfig, getRole, getSession, readAuditLog, readMainFacts, runAudit, runBackup, runValidate, setSession };
|
|
546
|
-
//# sourceMappingURL=index-
|
|
546
|
+
//# sourceMappingURL=index-B5_QnkG8.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-B5_QnkG8.d.cts","names":[],"sources":["../src/schemas/sources.ts","../src/schemas/main-facts.ts","../src/schemas/interaction.ts","../src/schemas/pipeline.ts","../src/schemas/ticket.ts","../src/schemas/quote.ts","../src/schemas/kb-article.ts","../src/schemas/survey.ts","../src/commands/create.ts","../src/commands/backup.ts","../src/commands/audit.ts","../src/commands/validate.ts","../src/fs/customer-dir.ts","../src/fs/audit-log.ts","../src/core/rbac.ts","../src/core/session-store.ts","../src/version.ts"],"mappings":";;;;cAea,qBAAmB,CAAA,CAAA;;IAAA,IAAA,cAAA,CAAA,OAAA,CAAA;IAAA,KAAA,aAAA;IAUpB,OAAA,cAAa,aAAA,CAAA;EAAA,CAAA,EAAA,OAAA,cAAA,EAAA;IAAkB,IAAA,EAAA,OAAA;IAAf,KAAE,EAAA,MAAA;IAAK,OAAA,EAAA,OAAA;;;;ICvBtB,OAAA,CAAA,EAAA,OAoBX,GAAA,SAAA;EAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;SApB0B,EAAA,MAAA;EAAA,OAAA,EAAA,MAAA;EAsBhB,KAAA,CAAA,EAAA;IAAS,IAAA,EAAA,OAAA;IAAkB,KAAA,EAAA,MAAA;IAAf,OAAE,EAAA,OAAA;EAAK,CAAA,GAAA,SAAA;;;;ECtBlB,WAAA,CAAA,EAAA;IAYX,IAAA,EAAA,YAAA;;;;;;;;;;;;;;;;;;IAZiC,OAAA,CAAA,EAAA,OAAA,GAAA,SAAA;IAAA,UAAA,CAAA,EAAA,MAAA,EAAA,GAAA,SAAA;EAcvB,CAAA,GAAA,SAAA;EAAgB,OAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;KFShB,aAAA,GAAgB,CAAA,CAAE,aAAa;;;;cCvB9B,iBAAe,CAAA,CAAA;;EDaf,MAAA,eAAA,YAMX,CAAA;EAAA,KAAA,eAAA,YAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAN8B,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,OAAA,CAAA,EAAA,OAAA;EAUpB,OAAA,CAAA,EAAA,OAAa;EAAA,IAAA,CAAA,EAAA,MAAA,EAAA,GAAA,SAAA;QAAkB,CAAA,EAAA,MAAA,GAAA,SAAA;OAAb,CAAA,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;;;EfeJ,SAAA,EAAA,MAAA;EAMX,KAAA,CAAA,EAAA,MAAA;;iBeZc,UAAA,IAAc;iBAId,UAAA,CAAA,GAAc;iBAId,YAAA,CAAA;;;;cCjBH,OAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -141,8 +141,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
141
141
|
sourceRef: z.ZodString;
|
|
142
142
|
synced: z.ZodString;
|
|
143
143
|
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
145
144
|
date: string;
|
|
145
|
+
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
146
146
|
with: string;
|
|
147
147
|
summary: string;
|
|
148
148
|
nextSteps: string[];
|
|
@@ -152,8 +152,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
152
152
|
subject?: string | undefined;
|
|
153
153
|
attachments?: string[] | undefined;
|
|
154
154
|
}, {
|
|
155
|
-
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
156
155
|
date: string;
|
|
156
|
+
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
157
157
|
with: string;
|
|
158
158
|
summary: string;
|
|
159
159
|
sourceRef: string;
|
|
@@ -544,4 +544,4 @@ declare const VERSION = "0.1.0";
|
|
|
544
544
|
|
|
545
545
|
//#endregion
|
|
546
546
|
export { type GlobalSources, type InteractionEntry, type KbArticle, type MainFacts, type PipelineDeal, type QuoteLineItem, type Quote as QuoteRecord, type SurveyDefinition, type SurveyResponse, type TicketPriority, type Ticket as TicketRecord, type TicketStatus, VERSION, canSeeCustomer, clearSession, createCustomer, customerExists, filterAuditLog, getRbacConfig, getRole, getSession, readAuditLog, readMainFacts, runAudit, runBackup, runValidate, setSession };
|
|
547
|
-
//# sourceMappingURL=index-
|
|
547
|
+
//# sourceMappingURL=index-FzDsNSSb.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-FzDsNSSb.d.ts","names":[],"sources":["../src/schemas/sources.ts","../src/schemas/main-facts.ts","../src/schemas/interaction.ts","../src/schemas/pipeline.ts","../src/schemas/ticket.ts","../src/schemas/quote.ts","../src/schemas/kb-article.ts","../src/schemas/survey.ts","../src/commands/create.ts","../src/commands/backup.ts","../src/commands/audit.ts","../src/commands/validate.ts","../src/fs/customer-dir.ts","../src/fs/audit-log.ts","../src/core/rbac.ts","../src/core/session-store.ts","../src/version.ts"],"mappings":";;;;;cAea,qBAAmB,CAAA,CAAA;;;IAAA,KAAA,aAAA;IAAA,OAAA,cAAA,aAAA,CAAA;EAUpB,CAAA,EAAA,OAAA,cAAa,EAAA;IAAA,IAAA,EAAA,OAAA;IAAkB,KAAA,EAAA,MAAA;IAAf,OAAE,EAAA,OAAA;EAAK,CAAA,EAAA;;;;ECvBtB,CAAA,CAAA,CAAA;EAoBX,QAAA,eAAA,YAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;SApB0B,EAAA,MAAA;EAAA,KAAA,CAAA,EAAA;IAsBhB,IAAA,EAAA,OAAS;IAAA,KAAA,EAAA,MAAA;IAAkB,OAAA,EAAA,OAAA;MAAf,SAAE;EAAK,QAAA,CAAA,EAAA;;;;ICtBlB,IAAA,EAAA,YAAA;IAYX,OAAA,EAAA,OAAA;;;;;;;;;;;;;;;;;;IAZiC,UAAA,CAAA,EAAA,MAAA,EAAA,GAAA,SAAA;EAAA,CAAA,GAAA,SAAA;EAcvB,OAAA,CAAA,EAAA,MAAA,GAAgB,SAAA;CAAA,CAAA;AAAU,KFS1B,aAAA,GAAgB,CAAA,CAAE,KETQ,CAAA,OFSK,mBETL,CAAA;;;;cDdzB,iBAAe,CAAA,CAAA;;;EDaf,KAAA,eAAA,YAMX,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AA,EAAA,MAAA;;iBeNG,UAAA,IAAc;iBAId,UAAA,CAAA,GAAc;iBAId,YAAA,CAAA;;;;cCjBH,OAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { a as buildAuthUrl, d as saveMailboxToken, o as createOAuthClient, r as requestDeviceCode, s as exchangeCodeForTokens, t as pollForToken } from "./microsoft-DgbVlHdT.js";
|
|
2
|
+
//#region src/sync/oauth/login.ts
|
|
3
|
+
/** Accept either a raw auth code or the full loopback redirect URL and return the code. */
|
|
4
|
+
function extractAuthCode(input) {
|
|
5
|
+
const trimmed = input.trim();
|
|
6
|
+
if (trimmed.includes("code=")) {
|
|
7
|
+
const m = trimmed.match(/[?&]code=([^&\s]+)/);
|
|
8
|
+
if (m?.[1]) return decodeURIComponent(m[1]);
|
|
9
|
+
}
|
|
10
|
+
return trimmed;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Drive the Gmail installed-app OAuth flow: show the consent URL, read back the
|
|
14
|
+
* authorization code (or the pasted redirect URL), exchange it for tokens with
|
|
15
|
+
* the full `mail.google.com` IMAP scope, and persist them.
|
|
16
|
+
*/
|
|
17
|
+
async function runGmailLogin(opts) {
|
|
18
|
+
const redirect = opts.redirectUri ?? "http://127.0.0.1";
|
|
19
|
+
const create = opts.createClient ?? createOAuthClient;
|
|
20
|
+
const exchange = opts.exchange ?? exchangeCodeForTokens;
|
|
21
|
+
const client = create(opts.clientId, opts.clientSecret, redirect);
|
|
22
|
+
const authUrl = buildAuthUrl(client, redirect);
|
|
23
|
+
opts.print("Authorize Gmail IMAP access by visiting this URL:\n");
|
|
24
|
+
opts.print(authUrl + "\n");
|
|
25
|
+
opts.print("After approving, your browser is redirected to a 127.0.0.1 URL that won't load — copy that whole URL (or just the code) and paste it here.");
|
|
26
|
+
const code = extractAuthCode(await opts.prompt("Paste the redirect URL or code: "));
|
|
27
|
+
if (!code) throw new Error("No authorization code provided.");
|
|
28
|
+
const tokens = await exchange(client, code);
|
|
29
|
+
if (!tokens.refreshToken) opts.print("Warning: Google did not return a refresh token. Remove the app's access at myaccount.google.com/permissions and log in again to force a fresh consent.");
|
|
30
|
+
const token = {
|
|
31
|
+
provider: "gmail",
|
|
32
|
+
user: opts.user,
|
|
33
|
+
accessToken: tokens.accessToken,
|
|
34
|
+
...tokens.refreshToken ? { refreshToken: tokens.refreshToken } : {},
|
|
35
|
+
expiresAt: tokens.expiresAt,
|
|
36
|
+
scope: "https://mail.google.com/"
|
|
37
|
+
};
|
|
38
|
+
saveMailboxToken(opts.dataDir, token);
|
|
39
|
+
return token;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Drive the Microsoft device-code flow: print the short user code + URL, poll
|
|
43
|
+
* until the user authorizes, and persist the IMAP tokens.
|
|
44
|
+
*/
|
|
45
|
+
async function runMicrosoftLogin(opts) {
|
|
46
|
+
const tenant = opts.tenant ?? "common";
|
|
47
|
+
const requestCode = opts.requestDeviceCodeFn ?? ((id, t) => requestDeviceCode(id, t));
|
|
48
|
+
const poll = opts.pollFn ?? ((o) => pollForToken(o));
|
|
49
|
+
const device = await requestCode(opts.clientId, tenant);
|
|
50
|
+
opts.print(`\nTo sign in, open ${device.verification_uri} and enter code: ${device.user_code}\n`);
|
|
51
|
+
opts.print("Waiting for authorization…");
|
|
52
|
+
const tokens = await poll({
|
|
53
|
+
clientId: opts.clientId,
|
|
54
|
+
deviceCode: device.device_code,
|
|
55
|
+
tenant,
|
|
56
|
+
interval: device.interval,
|
|
57
|
+
expiresIn: device.expires_in
|
|
58
|
+
});
|
|
59
|
+
const token = {
|
|
60
|
+
provider: "microsoft",
|
|
61
|
+
user: opts.user,
|
|
62
|
+
accessToken: tokens.accessToken,
|
|
63
|
+
...tokens.refreshToken ? { refreshToken: tokens.refreshToken } : {},
|
|
64
|
+
expiresAt: tokens.expiresAt,
|
|
65
|
+
scope: "https://outlook.office365.com/IMAP.AccessAsUser.All"
|
|
66
|
+
};
|
|
67
|
+
saveMailboxToken(opts.dataDir, token);
|
|
68
|
+
return token;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { runGmailLogin, runMicrosoftLogin };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=login-CYgla6-A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-CYgla6-A.js","names":[],"sources":["../src/sync/oauth/login.ts"],"sourcesContent":["// src/sync/oauth/login.ts\nimport { saveMailboxToken, type MailboxToken } from \"./token-store.js\";\nimport {\n createOAuthClient,\n buildAuthUrl,\n exchangeCodeForTokens,\n DEFAULT_REDIRECT,\n type GoogleOAuthClient,\n} from \"./google.js\";\nimport {\n requestDeviceCode,\n pollForToken,\n type DeviceCodeResponse,\n type MicrosoftTokens,\n} from \"./microsoft.js\";\n\n/** Accept either a raw auth code or the full loopback redirect URL and return the code. */\nexport function extractAuthCode(input: string): string {\n const trimmed = input.trim();\n if (trimmed.includes(\"code=\")) {\n const m = trimmed.match(/[?&]code=([^&\\s]+)/);\n if (m?.[1]) return decodeURIComponent(m[1]);\n }\n return trimmed;\n}\n\nexport interface GmailLoginOptions {\n dataDir: string;\n clientId: string;\n clientSecret: string;\n user: string;\n prompt: (question: string) => Promise<string>;\n print: (line: string) => void;\n redirectUri?: string;\n // Injection points for tests:\n createClient?: (id: string, secret: string, redirect: string) => GoogleOAuthClient;\n exchange?: typeof exchangeCodeForTokens;\n}\n\n/**\n * Drive the Gmail installed-app OAuth flow: show the consent URL, read back the\n * authorization code (or the pasted redirect URL), exchange it for tokens with\n * the full `mail.google.com` IMAP scope, and persist them.\n */\nexport async function runGmailLogin(opts: GmailLoginOptions): Promise<MailboxToken> {\n const redirect = opts.redirectUri ?? DEFAULT_REDIRECT;\n const create = opts.createClient ?? createOAuthClient;\n const exchange = opts.exchange ?? exchangeCodeForTokens;\n\n const client = create(opts.clientId, opts.clientSecret, redirect);\n const authUrl = buildAuthUrl(client, redirect);\n\n opts.print(\"Authorize Gmail IMAP access by visiting this URL:\\n\");\n opts.print(authUrl + \"\\n\");\n opts.print(\n \"After approving, your browser is redirected to a 127.0.0.1 URL that won't load — \" +\n \"copy that whole URL (or just the code) and paste it here.\"\n );\n\n const answer = await opts.prompt(\"Paste the redirect URL or code: \");\n const code = extractAuthCode(answer);\n if (!code) throw new Error(\"No authorization code provided.\");\n\n const tokens = await exchange(client, code);\n if (!tokens.refreshToken) {\n opts.print(\n \"Warning: Google did not return a refresh token. Remove the app's access at \" +\n \"myaccount.google.com/permissions and log in again to force a fresh consent.\"\n );\n }\n\n const token: MailboxToken = {\n provider: \"gmail\",\n user: opts.user,\n accessToken: tokens.accessToken,\n ...(tokens.refreshToken ? { refreshToken: tokens.refreshToken } : {}),\n expiresAt: tokens.expiresAt,\n scope: \"https://mail.google.com/\",\n };\n saveMailboxToken(opts.dataDir, token);\n return token;\n}\n\nexport interface MicrosoftLoginOptions {\n dataDir: string;\n clientId: string;\n user: string;\n tenant?: string;\n print: (line: string) => void;\n // Injection points for tests:\n requestDeviceCodeFn?: (clientId: string, tenant: string) => Promise<DeviceCodeResponse>;\n pollFn?: (opts: {\n clientId: string;\n deviceCode: string;\n tenant: string;\n interval: number;\n expiresIn: number;\n }) => Promise<MicrosoftTokens>;\n}\n\n/**\n * Drive the Microsoft device-code flow: print the short user code + URL, poll\n * until the user authorizes, and persist the IMAP tokens.\n */\nexport async function runMicrosoftLogin(opts: MicrosoftLoginOptions): Promise<MailboxToken> {\n const tenant = opts.tenant ?? \"common\";\n const requestCode =\n opts.requestDeviceCodeFn ?? ((id: string, t: string) => requestDeviceCode(id, t));\n const poll =\n opts.pollFn ??\n ((o: {\n clientId: string;\n deviceCode: string;\n tenant: string;\n interval: number;\n expiresIn: number;\n }) => pollForToken(o));\n\n const device = await requestCode(opts.clientId, tenant);\n opts.print(`\\nTo sign in, open ${device.verification_uri} and enter code: ${device.user_code}\\n`);\n opts.print(\"Waiting for authorization…\");\n\n const tokens = await poll({\n clientId: opts.clientId,\n deviceCode: device.device_code,\n tenant,\n interval: device.interval,\n expiresIn: device.expires_in,\n });\n\n const token: MailboxToken = {\n provider: \"microsoft\",\n user: opts.user,\n accessToken: tokens.accessToken,\n ...(tokens.refreshToken ? { refreshToken: tokens.refreshToken } : {}),\n expiresAt: tokens.expiresAt,\n scope: \"https://outlook.office365.com/IMAP.AccessAsUser.All\",\n };\n saveMailboxToken(opts.dataDir, token);\n return token;\n}\n"],"mappings":";;;AAiBA,SAAgB,gBAAgB,OAAuB;CACrD,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,QAAQ,SAAS,OAAO,GAAG;EAC7B,MAAM,IAAI,QAAQ,MAAM,oBAAoB;EAC5C,IAAI,IAAI,IAAI,OAAO,mBAAmB,EAAE,EAAE;CAC5C;CACA,OAAO;AACT;;;;;;AAoBA,eAAsB,cAAc,MAAgD;CAClF,MAAM,WAAW,KAAK,eAAA;CACtB,MAAM,SAAS,KAAK,gBAAgB;CACpC,MAAM,WAAW,KAAK,YAAY;CAElC,MAAM,SAAS,OAAO,KAAK,UAAU,KAAK,cAAc,QAAQ;CAChE,MAAM,UAAU,aAAa,QAAQ,QAAQ;CAE7C,KAAK,MAAM,qDAAqD;CAChE,KAAK,MAAM,UAAU,IAAI;CACzB,KAAK,MACH,4IAEF;CAGA,MAAM,OAAO,gBAAgB,MADR,KAAK,OAAO,kCAAkC,CAChC;CACnC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,iCAAiC;CAE5D,MAAM,SAAS,MAAM,SAAS,QAAQ,IAAI;CAC1C,IAAI,CAAC,OAAO,cACV,KAAK,MACH,wJAEF;CAGF,MAAM,QAAsB;EAC1B,UAAU;EACV,MAAM,KAAK;EACX,aAAa,OAAO;EACpB,GAAI,OAAO,eAAe,EAAE,cAAc,OAAO,aAAa,IAAI,CAAC;EACnE,WAAW,OAAO;EAClB,OAAO;CACT;CACA,iBAAiB,KAAK,SAAS,KAAK;CACpC,OAAO;AACT;;;;;AAuBA,eAAsB,kBAAkB,MAAoD;CAC1F,MAAM,SAAS,KAAK,UAAU;CAC9B,MAAM,cACJ,KAAK,yBAAyB,IAAY,MAAc,kBAAkB,IAAI,CAAC;CACjF,MAAM,OACJ,KAAK,YACH,MAMI,aAAa,CAAC;CAEtB,MAAM,SAAS,MAAM,YAAY,KAAK,UAAU,MAAM;CACtD,KAAK,MAAM,sBAAsB,OAAO,iBAAiB,mBAAmB,OAAO,UAAU,GAAG;CAChG,KAAK,MAAM,4BAA4B;CAEvC,MAAM,SAAS,MAAM,KAAK;EACxB,UAAU,KAAK;EACf,YAAY,OAAO;EACnB;EACA,UAAU,OAAO;EACjB,WAAW,OAAO;CACpB,CAAC;CAED,MAAM,QAAsB;EAC1B,UAAU;EACV,MAAM,KAAK;EACX,aAAa,OAAO;EACpB,GAAI,OAAO,eAAe,EAAE,cAAc,OAAO,aAAa,IAAI,CAAC;EACnE,WAAW,OAAO;EAClB,OAAO;CACT;CACA,iBAAiB,KAAK,SAAS,KAAK;CACpC,OAAO;AACT"}
|
package/dist/mcp.cjs
CHANGED
|
@@ -1442,7 +1442,7 @@ function triggerOnQuerySync(dataDir, slug) {
|
|
|
1442
1442
|
const sources = JSON.parse(fs.default.readFileSync(sourcesPath, "utf-8"));
|
|
1443
1443
|
if (!sources.gmail?.enabled || !sources.gmail.query) return;
|
|
1444
1444
|
const query = sources.gmail.query;
|
|
1445
|
-
Promise.resolve().then(() => require("./gmail-sync-
|
|
1445
|
+
Promise.resolve().then(() => require("./gmail-sync-CodrUNR4.cjs")).then(({ syncGmail }) => syncGmail({
|
|
1446
1446
|
slug,
|
|
1447
1447
|
dataDir,
|
|
1448
1448
|
auth,
|
|
@@ -6721,7 +6721,7 @@ async function handleTriggerSync(input, dataDir = DATA_DIR$5) {
|
|
|
6721
6721
|
try {
|
|
6722
6722
|
const sources = JSON.parse(fs.default.readFileSync(sourcesPath, "utf-8"));
|
|
6723
6723
|
if (!sources.gmail?.enabled || !sources.gmail.query) continue;
|
|
6724
|
-
const { syncGmail } = await Promise.resolve().then(() => require("./gmail-sync-
|
|
6724
|
+
const { syncGmail } = await Promise.resolve().then(() => require("./gmail-sync-CodrUNR4.cjs"));
|
|
6725
6725
|
const result = await syncGmail({
|
|
6726
6726
|
slug,
|
|
6727
6727
|
dataDir,
|
package/dist/mcp.js
CHANGED
|
@@ -1435,7 +1435,7 @@ function triggerOnQuerySync(dataDir, slug) {
|
|
|
1435
1435
|
const sources = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
|
|
1436
1436
|
if (!sources.gmail?.enabled || !sources.gmail.query) return;
|
|
1437
1437
|
const query = sources.gmail.query;
|
|
1438
|
-
import("./gmail-sync-
|
|
1438
|
+
import("./gmail-sync-BHLa8v51.js").then(({ syncGmail }) => syncGmail({
|
|
1439
1439
|
slug,
|
|
1440
1440
|
dataDir,
|
|
1441
1441
|
auth,
|
|
@@ -6714,7 +6714,7 @@ async function handleTriggerSync(input, dataDir = DATA_DIR$5) {
|
|
|
6714
6714
|
try {
|
|
6715
6715
|
const sources = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
|
|
6716
6716
|
if (!sources.gmail?.enabled || !sources.gmail.query) continue;
|
|
6717
|
-
const { syncGmail } = await import("./gmail-sync-
|
|
6717
|
+
const { syncGmail } = await import("./gmail-sync-BHLa8v51.js");
|
|
6718
6718
|
const result = await syncGmail({
|
|
6719
6719
|
slug,
|
|
6720
6720
|
dataDir,
|