@datasynx/agentic-crm 0.1.0 → 1.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 +264 -670
- package/dist/{approvals-DpjxGHFp.js → approvals-CmDT2eUg.js} +7 -24
- package/dist/approvals-CmDT2eUg.js.map +1 -0
- package/dist/{ask-CID3jnuL.js → ask-D8iYqDAr.js} +6 -6
- package/dist/{ask-CID3jnuL.js.map → ask-D8iYqDAr.js.map} +1 -1
- package/dist/atomic-write-8yjqqLtS.js +29 -0
- package/dist/atomic-write-8yjqqLtS.js.map +1 -0
- package/dist/atomic-write-BYmF-ThH.cjs +37 -0
- package/dist/atomic-write-BYmF-ThH.cjs.map +1 -0
- package/dist/auth-B5DcjJ_6.js +2 -0
- package/dist/{auth-DFWwWcYD.js → auth-DDXZTwS0.js} +4 -13
- package/dist/auth-DDXZTwS0.js.map +1 -0
- package/dist/{autofill-Di_-SP7t.js → autofill-B9VtlR2j.js} +2 -2
- package/dist/{autofill-Di_-SP7t.js.map → autofill-B9VtlR2j.js.map} +1 -1
- package/dist/{backup-CeMk9z86.js → backup-CTlIxUdO.js} +5 -7
- package/dist/backup-CTlIxUdO.js.map +1 -0
- package/dist/backup-LFnC09oV.js +2 -0
- package/dist/{churn-C28IgnAj.js → churn-DN9WDGNM.js} +3 -3
- package/dist/{churn-C28IgnAj.js.map → churn-DN9WDGNM.js.map} +1 -1
- package/dist/cli.js +282 -184
- package/dist/cli.js.map +1 -1
- package/dist/{compliance-CKSBoQUe.js → compliance-Bc12Hn9a.js} +3 -3
- package/dist/{compliance-CKSBoQUe.js.map → compliance-Bc12Hn9a.js.map} +1 -1
- package/dist/{compliance-CujOqAKk.js → compliance-TqYQXhBj.js} +1 -1
- package/dist/{compliance-B1kk5-YS.js → compliance-kq0xHRw3.js} +3 -3
- package/dist/{compliance-B1kk5-YS.js.map → compliance-kq0xHRw3.js.map} +1 -1
- package/dist/{compliance-B91zNvCR.cjs → compliance-pAj9FcGI.cjs} +3 -3
- package/dist/{compliance-B91zNvCR.cjs.map → compliance-pAj9FcGI.cjs.map} +1 -1
- package/dist/{context-builder-BzWAp3Zs.js → context-builder-7Uab5-G4.js} +3 -2
- package/dist/context-builder-7Uab5-G4.js.map +1 -0
- package/dist/context-builder-hmOPvgso.js +2 -0
- package/dist/{custom-fields-CzNeD3_v.js → custom-fields-BMyz5Ruh.js} +1 -1
- package/dist/{custom-fields-Pl2t9xzp.js → custom-fields-GzpOHW_2.js} +4 -13
- package/dist/custom-fields-GzpOHW_2.js.map +1 -0
- package/dist/{custom-objects-CIFrmQ2V.js → custom-objects-BNy-ayR-.js} +1 -1
- package/dist/{custom-objects-BHgn1GEX.js → custom-objects-CxW1gHwJ.js} +10 -25
- package/dist/custom-objects-CxW1gHwJ.js.map +1 -0
- package/dist/{customer-dir-DIylZ8Q6.js → customer-dir-CkMMXhb0.js} +9 -4
- package/dist/customer-dir-CkMMXhb0.js.map +1 -0
- package/dist/daemon/worker.js +66 -40
- package/dist/daemon/worker.js.map +1 -1
- package/dist/doctor-C14-vnJ1.js +103 -0
- package/dist/doctor-C14-vnJ1.js.map +1 -0
- package/dist/{enrichment-3XvgGDfB.js → enrichment-CDFdWmvD.js} +3 -3
- package/dist/{enrichment-3XvgGDfB.js.map → enrichment-CDFdWmvD.js.map} +1 -1
- package/dist/{file-lock-B_zi7NQl.js → file-lock-CcHotQkZ.js} +3 -4
- package/dist/file-lock-CcHotQkZ.js.map +1 -0
- package/dist/{gmail-sync-rQaVqKWd.js → gmail-sync-C-NmibzS.js} +13 -9
- package/dist/gmail-sync-C-NmibzS.js.map +1 -0
- package/dist/{gmail-sync-DIaxInDT.js → gmail-sync-DueE6tl5.js} +14 -10
- package/dist/gmail-sync-DueE6tl5.js.map +1 -0
- package/dist/{gmail-sync-hHm9gaWd.cjs → gmail-sync-GEy3oVvw.cjs} +13 -9
- package/dist/gmail-sync-GEy3oVvw.cjs.map +1 -0
- package/dist/{gmail-webhook-handler-DS7OlRPX.js → gmail-webhook-handler-B26COilD.js} +2 -2
- package/dist/{gmail-webhook-handler-e5Od25FX.js → gmail-webhook-handler-kGKpbY9h.js} +4 -4
- package/dist/{gmail-webhook-handler-e5Od25FX.js.map → gmail-webhook-handler-kGKpbY9h.js.map} +1 -1
- package/dist/{goal-engine-KpBftn4V.js → goal-engine-BbroPhqm.js} +10 -11
- package/dist/goal-engine-BbroPhqm.js.map +1 -0
- package/dist/{goal-engine-CUZSpERI.js → goal-engine-CfDAJTFt.js} +1 -1
- package/dist/{google-drive-sync-DEPcqFca.js → google-drive-sync-D1n7WKZn.js} +3 -3
- package/dist/{google-drive-sync-DEPcqFca.js.map → google-drive-sync-D1n7WKZn.js.map} +1 -1
- package/dist/{hygiene-DZqfYpFf.js → hygiene-DzQPnc6P.js} +3 -3
- package/dist/{hygiene-DZqfYpFf.js.map → hygiene-DzQPnc6P.js.map} +1 -1
- package/dist/identity-CB7j-Zr1.js +2 -0
- package/dist/{identity-CI6olMNm.js → identity-_uZ3Lbr2.js} +2 -2
- package/dist/{identity-CI6olMNm.js.map → identity-_uZ3Lbr2.js.map} +1 -1
- package/dist/{import-hubspot-BaK71U_K.js → import-hubspot-DB4n89jy.js} +51 -45
- package/dist/import-hubspot-DB4n89jy.js.map +1 -0
- package/dist/{index-V8BFaH-b.d.ts → index-B0IMMrp_.d.ts} +8 -4
- package/dist/{index-V8BFaH-b.d.ts.map → index-B0IMMrp_.d.ts.map} +1 -1
- package/dist/{index-YqwMd6aQ.d.cts → index-pY7tYXwH.d.cts} +8 -4
- package/dist/{index-YqwMd6aQ.d.cts.map → index-pY7tYXwH.d.cts.map} +1 -1
- package/dist/index.cjs +19 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -21
- package/dist/index.js.map +1 -1
- package/dist/{interactions-writer-DO3KcSR3.js → interactions-writer-BZzUIgJd.js} +5 -2
- package/dist/interactions-writer-BZzUIgJd.js.map +1 -0
- package/dist/{interactions-writer-SLHnoEeE.js → interactions-writer-DbSyI2rt.js} +32 -3
- package/dist/interactions-writer-DbSyI2rt.js.map +1 -0
- package/dist/interactions-writer-RJB8SWf2.js +2 -0
- package/dist/{interactions-writer-CrPStUll.cjs → interactions-writer-a2yzBd7T.cjs} +5 -2
- package/dist/interactions-writer-a2yzBd7T.cjs.map +1 -0
- package/dist/json-store-WWsFzXub.js +43 -0
- package/dist/json-store-WWsFzXub.js.map +1 -0
- package/dist/{knowledge-base-D0Fh40kc.js → knowledge-base-DHNc4hVj.js} +43 -16
- package/dist/knowledge-base-DHNc4hVj.js.map +1 -0
- package/dist/{lancedb-CCBbpulq.js → lancedb-CswQEE5K.js} +1 -1
- package/dist/{lancedb-rlvWoPwl.js → lancedb-CuHKNsNZ.js} +4 -3
- package/dist/lancedb-CuHKNsNZ.js.map +1 -0
- package/dist/{lead-model-BCFzyktm.js → lead-model-CEmx7te7.js} +6 -14
- package/dist/lead-model-CEmx7te7.js.map +1 -0
- package/dist/{llm-Z8RIYkpF.js → llm-BnSUBisu.js} +2 -2
- package/dist/{llm-Z8RIYkpF.js.map → llm-BnSUBisu.js.map} +1 -1
- package/dist/{llm-iijeXmgq.cjs → llm-CXycmEl9.cjs} +2 -2
- package/dist/{llm-iijeXmgq.cjs.map → llm-CXycmEl9.cjs.map} +1 -1
- package/dist/{llm-DEjWcqmW.js → llm-DSX1-wFu.js} +1 -1
- package/dist/{llm-DvzZqva0.js → llm-PZzgPphl.js} +3 -3
- package/dist/{llm-DvzZqva0.js.map → llm-PZzgPphl.js.map} +1 -1
- package/dist/logger-BkInaGoV.cjs +167 -0
- package/dist/logger-BkInaGoV.cjs.map +1 -0
- package/dist/logger-Dyl4VcLO.js +147 -0
- package/dist/logger-Dyl4VcLO.js.map +1 -0
- package/dist/logger-UaF5p9d1.js +147 -0
- package/dist/logger-UaF5p9d1.js.map +1 -0
- package/dist/logger-vKQS34w9.js +2 -0
- package/dist/mcp-CdTJWTJf.d.cts.map +1 -1
- package/dist/mcp-CdTJWTJf.d.ts.map +1 -1
- package/dist/mcp.cjs +327 -303
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +327 -303
- package/dist/mcp.js.map +1 -1
- package/dist/{memory-Cy6-Tbyl.js → memory-D8hmgD9d.js} +1 -1
- package/dist/{memory-Bb6ky3kb.js → memory-Dzr9dXSM.js} +4 -11
- package/dist/memory-Dzr9dXSM.js.map +1 -0
- package/dist/{microsoft-calendar-B6MMtUQK.js → microsoft-calendar-jIu9K5zX.js} +4 -4
- package/dist/{microsoft-calendar-B6MMtUQK.js.map → microsoft-calendar-jIu9K5zX.js.map} +1 -1
- package/dist/{microsoft-sync-CpZVoSuq.js → microsoft-sync-R_r8HL-B.js} +5 -5
- package/dist/{microsoft-sync-CpZVoSuq.js.map → microsoft-sync-R_r8HL-B.js.map} +1 -1
- package/dist/{nba-3wanmJ0U.js → nba-mTJ4yEqD.js} +3 -3
- package/dist/{nba-3wanmJ0U.js.map → nba-mTJ4yEqD.js.map} +1 -1
- package/dist/{notification-dispatcher-0vYNngWe.js → notification-dispatcher-inpKyuBz.js} +7 -3
- package/dist/notification-dispatcher-inpKyuBz.js.map +1 -0
- package/dist/{pipeline-writer-BqBrYrQc.js → pipeline-writer-0LJ6Qkat.js} +1 -1
- package/dist/{pipeline-writer-N2omexxp.cjs → pipeline-writer-B1tRAhuD.cjs} +11 -3
- package/dist/pipeline-writer-B1tRAhuD.cjs.map +1 -0
- package/dist/{pipeline-writer-BvVquKIe.js → pipeline-writer-CIllfnZl.js} +5 -3
- package/dist/pipeline-writer-CIllfnZl.js.map +1 -0
- package/dist/{pipeline-writer-eufx_0o1.js → pipeline-writer-rDj-ni6q.js} +6 -4
- package/dist/pipeline-writer-rDj-ni6q.js.map +1 -0
- package/dist/{proactive-agent-BgQXw3ac.js → proactive-agent-B7u3Bj_l.js} +6 -6
- package/dist/{proactive-agent-BgQXw3ac.js.map → proactive-agent-B7u3Bj_l.js.map} +1 -1
- package/dist/{proactive-worker-BrLHNhjH.js → proactive-worker-1zkm6aJD.js} +7 -8
- package/dist/proactive-worker-1zkm6aJD.js.map +1 -0
- package/dist/{push-manager-CowY-0IK.js → push-manager-BXM-IHfP.js} +1 -1
- package/dist/{push-manager-CdqIIkuh.js → push-manager-C0ECQgva.js} +4 -4
- package/dist/push-manager-C0ECQgva.js.map +1 -0
- package/dist/{quote-generator-OhSFsi3x.js → quote-generator-ByUyIYtw.js} +1 -1
- package/dist/{quote-generator-BfwENXzg.js → quote-generator-CTdR8eEI.js} +5 -5
- package/dist/quote-generator-CTdR8eEI.js.map +1 -0
- package/dist/rbac-DzbyFhVH.js +2 -0
- package/dist/{rbac-CTIktZaC.js → rbac-msmBc_tK.js} +19 -12
- package/dist/rbac-msmBc_tK.js.map +1 -0
- package/dist/regex-Jt5DatPi.js +13 -0
- package/dist/regex-Jt5DatPi.js.map +1 -0
- package/dist/{relationship-health-odxEoQdJ.js → relationship-health-ZZNXR1RZ.js} +8 -16
- package/dist/relationship-health-ZZNXR1RZ.js.map +1 -0
- package/dist/{revenue-simulation-Bqf2DLVB.js → revenue-simulation-D8f_YkUY.js} +9 -19
- package/dist/revenue-simulation-D8f_YkUY.js.map +1 -0
- package/dist/{revenue-simulation-BJdRTEHc.js → revenue-simulation-njJZlTqm.js} +1 -1
- package/dist/safe-path-mpp0dKtO.js +18 -0
- package/dist/safe-path-mpp0dKtO.js.map +1 -0
- package/dist/{segments-BqcD5HIl.js → segments-DI3LOQNe.js} +5 -14
- package/dist/segments-DI3LOQNe.js.map +1 -0
- package/dist/sequence-engine-C6nnewHX.js +2 -0
- package/dist/{sequence-engine-J1lTW_in.js → sequence-engine-DNTVLq7o.js} +15 -8
- package/dist/sequence-engine-DNTVLq7o.js.map +1 -0
- package/dist/{sequence-store-DaaWr0Os.js → sequence-store-CmYb6s0g.js} +6 -5
- package/dist/sequence-store-CmYb6s0g.js.map +1 -0
- package/dist/{server-Dyva03K8.js → server-DqSMYhSA.js} +278 -220
- package/dist/server-DqSMYhSA.js.map +1 -0
- package/dist/{session-D9ub6Wl1.js → session-B6XaP83h.js} +3 -3
- package/dist/session-B6XaP83h.js.map +1 -0
- package/dist/{session-B9AilxOE.js → session-BgGDyP2C.js} +3 -3
- package/dist/session-BgGDyP2C.js.map +1 -0
- package/dist/session-Bp4zTh4l.js +2 -0
- package/dist/{session-D0qFkBla.cjs → session-Mm7GQbSH.cjs} +3 -3
- package/dist/session-Mm7GQbSH.cjs.map +1 -0
- package/dist/{session-store-C8tEvMPw.js → session-store-DWxJ5Pof.js} +79 -17
- package/dist/session-store-DWxJ5Pof.js.map +1 -0
- package/dist/{session-store-B0QZE8Bx.cjs → session-store-yfwnj0OC.cjs} +126 -16
- package/dist/session-store-yfwnj0OC.cjs.map +1 -0
- package/dist/{sla-engine-5IhTsBUR.js → sla-engine-CP2KiKDS.js} +1 -1
- package/dist/{sla-engine-BqX-7u-7.js → sla-engine-O-A1ntu_.js} +2 -2
- package/dist/{sla-engine-BqX-7u-7.js.map → sla-engine-O-A1ntu_.js.map} +1 -1
- package/dist/{sop-Vp0UPWFW.js → sop-BV7ICAFR.js} +4 -11
- package/dist/sop-BV7ICAFR.js.map +1 -0
- package/dist/{sop-DkhVChGy.js → sop-D33qTHUb.js} +1 -1
- package/dist/survey-engine-DKctGcLQ.js +2 -0
- package/dist/{survey-engine-DBjCYqCv.js → survey-engine-DngXBv47.js} +5 -4
- package/dist/survey-engine-DngXBv47.js.map +1 -0
- package/dist/{sync-state-CwLSt_1m.js → sync-state-BaA8LbTI.js} +1 -1
- package/dist/{sync-state-ChaLbamC.js → sync-state-DMZgzpez.js} +4 -12
- package/dist/sync-state-DMZgzpez.js.map +1 -0
- package/dist/{ticket-writer-CjqKeIRD.js → ticket-writer-DsfpeLGZ.js} +1 -1
- package/dist/{ticket-writer-j2oX_Wal.js → ticket-writer-a9on36Wb.js} +12 -24
- package/dist/ticket-writer-a9on36Wb.js.map +1 -0
- package/dist/{tone-Bdm5uaht.js → tone-C7bqK69y.js} +5 -12
- package/dist/tone-C7bqK69y.js.map +1 -0
- package/dist/{tone-DRKlZgPr.cjs → tone-Cmc7O2Fx.cjs} +3 -9
- package/dist/tone-Cmc7O2Fx.cjs.map +1 -0
- package/dist/{tone-vNb2DAAD.js → tone-mXSftvTn.js} +3 -8
- package/dist/tone-mXSftvTn.js.map +1 -0
- package/dist/{transcript-watcher-CL2QUygI.js → transcript-watcher-0mh2ZhmH.js} +18 -11
- package/dist/transcript-watcher-0mh2ZhmH.js.map +1 -0
- package/dist/unmatched-transcripts-C92zAoM4.js +2 -0
- package/dist/unmatched-transcripts-DC-VQ9YS.js +16 -0
- package/dist/unmatched-transcripts-DC-VQ9YS.js.map +1 -0
- package/dist/update-deal-CWy1eLJI.js +2 -0
- package/dist/{update-deal-DKC79skb.js → update-deal-DSzr_Aau.js} +3 -3
- package/dist/{update-deal-DKC79skb.js.map → update-deal-DSzr_Aau.js.map} +1 -1
- package/dist/{usage-D0-TYJkw.js → usage-BVlFlKW_.js} +8 -6
- package/dist/usage-BVlFlKW_.js.map +1 -0
- package/dist/usage-CClTf5e6.cjs.map +1 -1
- package/dist/usage-D0u9a-lV.js.map +1 -1
- package/dist/{vault-DXCg29W-.js → vault-CfwZdNzC.js} +3 -4
- package/dist/vault-CfwZdNzC.js.map +1 -0
- package/dist/{vault-C1D3zScD.js → vault-DxKP4_R2.js} +1 -1
- package/dist/{webhooks-Xn6zO6kd.cjs → webhooks-CwW-3kvG.cjs} +5 -19
- package/dist/webhooks-CwW-3kvG.cjs.map +1 -0
- package/dist/{webhooks-7EpA05Qr.js → webhooks-DXr1IoKn.js} +8 -21
- package/dist/webhooks-DXr1IoKn.js.map +1 -0
- package/dist/{webhooks-BO2UAnmn.js → webhooks-sWZ8CJtR.js} +5 -18
- package/dist/webhooks-sWZ8CJtR.js.map +1 -0
- package/package.json +11 -2
- package/dist/approvals-DpjxGHFp.js.map +0 -1
- package/dist/auth-CyFuu9X_.js +0 -2
- package/dist/auth-DFWwWcYD.js.map +0 -1
- package/dist/backup-CeMk9z86.js.map +0 -1
- package/dist/backup-f_hC7rBV.js +0 -2
- package/dist/context-builder-BzWAp3Zs.js.map +0 -1
- package/dist/context-builder-DlrRcqmJ.js +0 -2
- package/dist/custom-fields-Pl2t9xzp.js.map +0 -1
- package/dist/custom-objects-BHgn1GEX.js.map +0 -1
- package/dist/customer-dir-DIylZ8Q6.js.map +0 -1
- package/dist/file-lock-B_zi7NQl.js.map +0 -1
- package/dist/gmail-sync-DIaxInDT.js.map +0 -1
- package/dist/gmail-sync-hHm9gaWd.cjs.map +0 -1
- package/dist/gmail-sync-rQaVqKWd.js.map +0 -1
- package/dist/goal-engine-KpBftn4V.js.map +0 -1
- package/dist/identity-gyfWdrcX.js +0 -2
- package/dist/import-hubspot-BaK71U_K.js.map +0 -1
- package/dist/interactions-writer-CrPStUll.cjs.map +0 -1
- package/dist/interactions-writer-DO3KcSR3.js.map +0 -1
- package/dist/interactions-writer-SLHnoEeE.js.map +0 -1
- package/dist/interactions-writer-dSPy1XfO.js +0 -2
- package/dist/knowledge-base-D0Fh40kc.js.map +0 -1
- package/dist/lancedb-rlvWoPwl.js.map +0 -1
- package/dist/lead-model-BCFzyktm.js.map +0 -1
- package/dist/memory-Bb6ky3kb.js.map +0 -1
- package/dist/notification-dispatcher-0vYNngWe.js.map +0 -1
- package/dist/pipeline-writer-BvVquKIe.js.map +0 -1
- package/dist/pipeline-writer-N2omexxp.cjs.map +0 -1
- package/dist/pipeline-writer-eufx_0o1.js.map +0 -1
- package/dist/proactive-worker-BrLHNhjH.js.map +0 -1
- package/dist/push-manager-CdqIIkuh.js.map +0 -1
- package/dist/quote-generator-BfwENXzg.js.map +0 -1
- package/dist/rbac-C7c8tcES.js +0 -2
- package/dist/rbac-CTIktZaC.js.map +0 -1
- package/dist/relationship-health-odxEoQdJ.js.map +0 -1
- package/dist/revenue-simulation-Bqf2DLVB.js.map +0 -1
- package/dist/segments-BqcD5HIl.js.map +0 -1
- package/dist/sequence-engine-CCTHEBgi.js +0 -2
- package/dist/sequence-engine-J1lTW_in.js.map +0 -1
- package/dist/sequence-store-DaaWr0Os.js.map +0 -1
- package/dist/server-Dyva03K8.js.map +0 -1
- package/dist/session-B9AilxOE.js.map +0 -1
- package/dist/session-D0qFkBla.cjs.map +0 -1
- package/dist/session-D9ub6Wl1.js.map +0 -1
- package/dist/session-mWHA71Lw.js +0 -2
- package/dist/session-store-B0QZE8Bx.cjs.map +0 -1
- package/dist/session-store-C8tEvMPw.js.map +0 -1
- package/dist/sop-Vp0UPWFW.js.map +0 -1
- package/dist/survey-engine-C06hcQt3.js +0 -2
- package/dist/survey-engine-DBjCYqCv.js.map +0 -1
- package/dist/sync-state-ChaLbamC.js.map +0 -1
- package/dist/ticket-writer-j2oX_Wal.js.map +0 -1
- package/dist/tone-Bdm5uaht.js.map +0 -1
- package/dist/tone-DRKlZgPr.cjs.map +0 -1
- package/dist/tone-vNb2DAAD.js.map +0 -1
- package/dist/transcript-watcher-CL2QUygI.js.map +0 -1
- package/dist/unmatched-transcripts-BsH5bhkU.js +0 -26
- package/dist/unmatched-transcripts-BsH5bhkU.js.map +0 -1
- package/dist/unmatched-transcripts-D0PrJ9iz.js +0 -2
- package/dist/update-deal-BNwPGaTV.js +0 -2
- package/dist/usage-D0-TYJkw.js.map +0 -1
- package/dist/vault-DXCg29W-.js.map +0 -1
- package/dist/webhooks-7EpA05Qr.js.map +0 -1
- package/dist/webhooks-BO2UAnmn.js.map +0 -1
- package/dist/webhooks-Xn6zO6kd.cjs.map +0 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { t as assertSafeSlug } from "./customer-dir-CkMMXhb0.js";
|
|
2
|
+
import { t as writeFileAtomic } from "./atomic-write-8yjqqLtS.js";
|
|
3
|
+
import { i as writeJsonFile, n as readJsonFile } from "./json-store-WWsFzXub.js";
|
|
4
|
+
import { t as escapeRegExp } from "./regex-Jt5DatPi.js";
|
|
1
5
|
import path from "path";
|
|
2
6
|
import fs from "fs";
|
|
3
7
|
import { z } from "zod";
|
|
@@ -64,20 +68,15 @@ function contactsPath(dataDir, slug) {
|
|
|
64
68
|
return path.join(dataDir, "customers", slug, "contacts.json");
|
|
65
69
|
}
|
|
66
70
|
function listContacts(dataDir, slug) {
|
|
67
|
-
const
|
|
68
|
-
if (!
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const r = CustomerContactSchema.safeParse(item);
|
|
74
|
-
return r.success ? [r.data] : [];
|
|
75
|
-
});
|
|
76
|
-
} catch {
|
|
77
|
-
return [];
|
|
78
|
-
}
|
|
71
|
+
const raw = readJsonFile(contactsPath(dataDir, slug), []);
|
|
72
|
+
if (!Array.isArray(raw)) return [];
|
|
73
|
+
return raw.flatMap((item) => {
|
|
74
|
+
const r = CustomerContactSchema.safeParse(item);
|
|
75
|
+
return r.success ? [r.data] : [];
|
|
76
|
+
});
|
|
79
77
|
}
|
|
80
78
|
function upsertContact(dataDir, slug, contact) {
|
|
79
|
+
assertSafeSlug(slug);
|
|
81
80
|
const contacts = listContacts(dataDir, slug);
|
|
82
81
|
const idx = contacts.findIndex((c) => c.email.toLowerCase() === contact.email.toLowerCase());
|
|
83
82
|
if (idx >= 0) contacts[idx] = {
|
|
@@ -88,9 +87,7 @@ function upsertContact(dataDir, slug, contact) {
|
|
|
88
87
|
if (contact.isPrimary) {
|
|
89
88
|
for (const c of contacts) if (c.email.toLowerCase() !== contact.email.toLowerCase()) c.isPrimary = false;
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
93
|
-
fs.writeFileSync(contactsPath(dataDir, slug), JSON.stringify(contacts, null, 2), "utf-8");
|
|
90
|
+
writeJsonFile(contactsPath(dataDir, slug), contacts);
|
|
94
91
|
}
|
|
95
92
|
//#endregion
|
|
96
93
|
//#region src/commands/import-hubspot.ts
|
|
@@ -195,7 +192,7 @@ function ensureCustomer(dataDir, name, domain, email, dryRun) {
|
|
|
195
192
|
};
|
|
196
193
|
fs.mkdirSync(customerDir, { recursive: true });
|
|
197
194
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
198
|
-
|
|
195
|
+
writeFileAtomic(mainFactsPath, `${[
|
|
199
196
|
"---",
|
|
200
197
|
`name: ${name}`,
|
|
201
198
|
domain ? `domain: ${domain}` : null,
|
|
@@ -207,11 +204,10 @@ function ensureCustomer(dataDir, name, domain, email, dryRun) {
|
|
|
207
204
|
"tags: []",
|
|
208
205
|
"currency: EUR",
|
|
209
206
|
"---"
|
|
210
|
-
].filter(Boolean).join("\n");
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
fs.writeFileSync(path.join(customerDir, "sources.json"), JSON.stringify({
|
|
207
|
+
].filter(Boolean).join("\n")}\n\n# Customer: ${name}\n`);
|
|
208
|
+
writeFileAtomic(path.join(customerDir, "interactions.md"), `# Interactions — ${name}\n\n`);
|
|
209
|
+
writeFileAtomic(path.join(customerDir, "pipeline.md"), `# Pipeline — ${name}\n\n`);
|
|
210
|
+
writeJsonFile(path.join(customerDir, "sources.json"), {
|
|
215
211
|
gmail: {
|
|
216
212
|
query: domain ? `from:${domain} OR to:${domain}` : email ? `from:${email} OR to:${email}` : "",
|
|
217
213
|
enabled: true
|
|
@@ -221,7 +217,7 @@ function ensureCustomer(dataDir, name, domain, email, dryRun) {
|
|
|
221
217
|
extensions: [".txt", ".vtt"],
|
|
222
218
|
enabled: false
|
|
223
219
|
}
|
|
224
|
-
}
|
|
220
|
+
});
|
|
225
221
|
return {
|
|
226
222
|
slug,
|
|
227
223
|
created: true
|
|
@@ -231,18 +227,23 @@ function readMainFactsRaw(dataDir, slug) {
|
|
|
231
227
|
const p = path.join(dataDir, "customers", slug, "main_facts.md");
|
|
232
228
|
return fs.existsSync(p) ? fs.readFileSync(p, "utf-8") : "";
|
|
233
229
|
}
|
|
234
|
-
|
|
230
|
+
/** Patch several frontmatter fields in main_facts.md with a single read+write. */
|
|
231
|
+
function updateMainFactsFields(dataDir, slug, fields) {
|
|
232
|
+
const entries = Object.entries(fields).filter((e) => e[1] !== void 0 && e[1] !== "");
|
|
233
|
+
if (entries.length === 0) return;
|
|
235
234
|
const p = path.join(dataDir, "customers", slug, "main_facts.md");
|
|
236
235
|
if (!fs.existsSync(p)) return;
|
|
237
236
|
let content = fs.readFileSync(p, "utf-8");
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
237
|
+
for (const [field, value] of entries) {
|
|
238
|
+
const regex = new RegExp(`^${escapeRegExp(field)}:.*$`, "m");
|
|
239
|
+
if (regex.test(content)) content = content.replace(regex, `${field}: ${value}`);
|
|
240
|
+
else {
|
|
241
|
+
const firstDash = content.indexOf("---");
|
|
242
|
+
const secondDash = content.indexOf("---", firstDash + 3);
|
|
243
|
+
if (secondDash >= 0) content = content.slice(0, secondDash) + `${field}: ${value}\n` + content.slice(secondDash);
|
|
244
|
+
}
|
|
244
245
|
}
|
|
245
|
-
|
|
246
|
+
writeFileAtomic(p, content);
|
|
246
247
|
}
|
|
247
248
|
function saveCustomProperties(dataDir, slug, props) {
|
|
248
249
|
if (Object.keys(props).length === 0) return;
|
|
@@ -253,15 +254,14 @@ function saveCustomProperties(dataDir, slug, props) {
|
|
|
253
254
|
} catch {
|
|
254
255
|
existing = {};
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
+
writeJsonFile(p, {
|
|
257
258
|
source: "hubspot-import",
|
|
258
259
|
importedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
259
260
|
properties: {
|
|
260
261
|
...existing["properties"] ?? {},
|
|
261
262
|
...props
|
|
262
263
|
}
|
|
263
|
-
};
|
|
264
|
-
fs.writeFileSync(p, JSON.stringify(merged, null, 2), "utf-8");
|
|
264
|
+
});
|
|
265
265
|
}
|
|
266
266
|
function progressPath(dataDir) {
|
|
267
267
|
return path.join(dataDir, ".agentic", "import-progress.json");
|
|
@@ -277,7 +277,7 @@ function readProgress(dataDir) {
|
|
|
277
277
|
}
|
|
278
278
|
function writeProgress(dataDir, progress) {
|
|
279
279
|
fs.mkdirSync(path.dirname(progressPath(dataDir)), { recursive: true });
|
|
280
|
-
|
|
280
|
+
writeJsonFile(progressPath(dataDir), progress);
|
|
281
281
|
}
|
|
282
282
|
function clearProgress(dataDir) {
|
|
283
283
|
const p = progressPath(dataDir);
|
|
@@ -387,16 +387,18 @@ async function runHubSpotCsvImport(exportDir, dataDir, opts = {}) {
|
|
|
387
387
|
companySlugMap.set(name.toLowerCase(), slug);
|
|
388
388
|
result.companiesProcessed++;
|
|
389
389
|
if (!dryRun && created) {
|
|
390
|
+
const factsPatch = {};
|
|
390
391
|
for (const [hsKey, dxKey] of Object.entries(COMPANY_FIELD_MAP)) {
|
|
391
392
|
const val = row[hsKey] ?? "";
|
|
392
|
-
if (val)
|
|
393
|
+
if (val) factsPatch[dxKey] = val;
|
|
393
394
|
}
|
|
394
395
|
const ownerEmail = row["hubspot_owner_email"] ?? row["HubSpot Owner Email"] ?? "";
|
|
395
396
|
if (ownerEmail && ownerMap[ownerEmail]) {
|
|
396
|
-
|
|
397
|
+
factsPatch["assigned_rep"] = ownerMap[ownerEmail];
|
|
397
398
|
result.ownersResolved++;
|
|
398
399
|
}
|
|
399
|
-
if (hubspotId)
|
|
400
|
+
if (hubspotId) factsPatch["hubspot_company_id"] = hubspotId;
|
|
401
|
+
updateMainFactsFields(dataDir, slug, factsPatch);
|
|
400
402
|
const customProps = {};
|
|
401
403
|
for (const [key, val] of Object.entries(row)) if (!KNOWN_COMPANY_COLUMNS.has(key) && val) customProps[key] = val;
|
|
402
404
|
if (Object.keys(customProps).length > 0) {
|
|
@@ -465,14 +467,16 @@ async function runHubSpotCsvImport(exportDir, dataDir, opts = {}) {
|
|
|
465
467
|
} catch {}
|
|
466
468
|
}
|
|
467
469
|
const existing = readMainFactsRaw(dataDir, slug);
|
|
468
|
-
|
|
469
|
-
if (
|
|
470
|
-
if (
|
|
470
|
+
const factsPatch = {};
|
|
471
|
+
if (email && !existing.includes("email:")) factsPatch["email"] = email;
|
|
472
|
+
if (phone && !existing.includes("phone:")) factsPatch["phone"] = phone;
|
|
473
|
+
if (contactName && !existing.includes("primary_contact:")) factsPatch["primary_contact"] = contactName;
|
|
471
474
|
const ownerEmail = row["contact_owner"] ?? row["Contact Owner"] ?? "";
|
|
472
475
|
if (ownerEmail && ownerMap[ownerEmail] && !existing.includes("assigned_rep:")) {
|
|
473
|
-
|
|
476
|
+
factsPatch["assigned_rep"] = ownerMap[ownerEmail];
|
|
474
477
|
result.ownersResolved++;
|
|
475
478
|
}
|
|
479
|
+
updateMainFactsFields(dataDir, slug, factsPatch);
|
|
476
480
|
}
|
|
477
481
|
if (email) emailSlugMap.set(email.toLowerCase(), slug);
|
|
478
482
|
result.contactsImported++;
|
|
@@ -483,7 +487,7 @@ async function runHubSpotCsvImport(exportDir, dataDir, opts = {}) {
|
|
|
483
487
|
}
|
|
484
488
|
const dealsPath = path.join(exportDir, "deals.csv");
|
|
485
489
|
if (fs.existsSync(dealsPath) && progress.phases.deals.status !== "done") if (!dryRun) {
|
|
486
|
-
const { upsertDeal } = await import("./pipeline-writer-
|
|
490
|
+
const { upsertDeal } = await import("./pipeline-writer-0LJ6Qkat.js");
|
|
487
491
|
progress.phases.deals.status = "in-progress";
|
|
488
492
|
writeProgress(dataDir, progress);
|
|
489
493
|
for await (const row of streamCSV(dealsPath)) {
|
|
@@ -531,7 +535,8 @@ async function runHubSpotCsvImport(exportDir, dataDir, opts = {}) {
|
|
|
531
535
|
}
|
|
532
536
|
const engagementsPath = path.join(exportDir, "engagements.csv");
|
|
533
537
|
if (fs.existsSync(engagementsPath) && progress.phases.engagements.status !== "done") if (!dryRun) {
|
|
534
|
-
const { appendInteraction,
|
|
538
|
+
const { appendInteraction, InteractionDedup } = await import("./interactions-writer-RJB8SWf2.js");
|
|
539
|
+
const dedup = new InteractionDedup(dataDir);
|
|
535
540
|
progress.phases.engagements.status = "in-progress";
|
|
536
541
|
writeProgress(dataDir, progress);
|
|
537
542
|
for await (const row of streamCSV(engagementsPath)) {
|
|
@@ -548,7 +553,7 @@ async function runHubSpotCsvImport(exportDir, dataDir, opts = {}) {
|
|
|
548
553
|
if (!slug) continue;
|
|
549
554
|
const sourceRef = `hubspot://engagement/${engId}`;
|
|
550
555
|
try {
|
|
551
|
-
if (
|
|
556
|
+
if (await dedup.seen(slug, sourceRef)) continue;
|
|
552
557
|
const date = coerceDate(timestamp);
|
|
553
558
|
const type = TYPE_MAP[engType] ?? "Note";
|
|
554
559
|
const summaryParts = [];
|
|
@@ -567,6 +572,7 @@ async function runHubSpotCsvImport(exportDir, dataDir, opts = {}) {
|
|
|
567
572
|
sourceRef,
|
|
568
573
|
synced: (/* @__PURE__ */ new Date()).toISOString()
|
|
569
574
|
});
|
|
575
|
+
dedup.markAppended(slug, sourceRef);
|
|
570
576
|
result.engagementsImported++;
|
|
571
577
|
} catch (err) {
|
|
572
578
|
result.errors.push(`Engagement ${engId}: ${err.message}`);
|
|
@@ -585,4 +591,4 @@ async function runHubSpotCsvImport(exportDir, dataDir, opts = {}) {
|
|
|
585
591
|
//#endregion
|
|
586
592
|
export { analyzeHubSpotExport, runHubSpotCsvImport };
|
|
587
593
|
|
|
588
|
-
//# sourceMappingURL=import-hubspot-
|
|
594
|
+
//# sourceMappingURL=import-hubspot-DB4n89jy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-hubspot-DB4n89jy.js","names":[],"sources":["../src/core/csv-stream.ts","../src/fs/contacts-writer.ts","../src/commands/import-hubspot.ts"],"sourcesContent":["import fs from \"fs\";\nimport readline from \"readline\";\n\nexport interface CsvStreamOptions {\n delimiter?: string;\n}\n\nfunction parseCSVLine(line: string, delimiter = \",\"): string[] {\n const result: string[] = [];\n let current = \"\";\n let inQuotes = false;\n for (let i = 0; i < line.length; i++) {\n const ch = line[i]!;\n if (ch === '\"') {\n if (inQuotes && line[i + 1] === '\"') {\n current += '\"';\n i++;\n } else {\n inQuotes = !inQuotes;\n }\n } else if (ch === delimiter && !inQuotes) {\n result.push(current.trim());\n current = \"\";\n } else {\n current += ch;\n }\n }\n result.push(current.trim());\n return result;\n}\n\n/** Streaming line-by-line CSV parser — O(1) memory for arbitrarily large files. */\nexport async function* streamCSV(\n filePath: string,\n opts: CsvStreamOptions = {}\n): AsyncGenerator<Record<string, string>> {\n const delimiter = opts.delimiter ?? \",\";\n const stream = fs.createReadStream(filePath, { encoding: \"utf-8\" });\n const rl = readline.createInterface({ input: stream, crlfDelay: Infinity });\n\n let headers: string[] | null = null;\n\n for await (const line of rl) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n const values = parseCSVLine(trimmed, delimiter);\n if (!headers) {\n headers = values.map((h) => h.replace(/^\"|\"$/g, \"\").trim());\n continue;\n }\n const row: Record<string, string> = {};\n headers.forEach((h, i) => {\n row[h] = values[i] ?? \"\";\n });\n yield row;\n }\n}\n\n/** Synchronous full-load parser — for small files (<10MB). */\nexport function parseCSVSync(content: string, delimiter = \",\"): Array<Record<string, string>> {\n const lines = content.trim().split(\"\\n\");\n if (lines.length < 2) return [];\n const headers = (lines[0] ?? \"\").split(delimiter).map((h) => h.trim().replace(/^\"|\"$/g, \"\"));\n return lines.slice(1).map((line) => {\n const values = parseCSVLine(line, delimiter);\n const row: Record<string, string> = {};\n headers.forEach((h, i) => {\n row[h] = values[i] ?? \"\";\n });\n return row;\n });\n}\n","import path from \"path\";\nimport { z } from \"zod\";\nimport { readJsonFile, writeJsonFile } from \"./json-store.js\";\nimport { assertSafeSlug } from \"./customer-dir.js\";\n\nexport const CustomerContactSchema = z.object({\n email: z.string().email(),\n name: z.string().min(1),\n title: z.string().optional(),\n phone: z.string().optional(),\n department: z.string().optional(),\n linkedinUrl: z.string().url().optional(),\n isPrimary: z.boolean().default(false),\n hubspotId: z.string().optional(),\n hubspotOwnerId: z.string().optional(),\n createdAt: z.string().optional(),\n});\n\nexport type CustomerContact = z.infer<typeof CustomerContactSchema>;\n\nfunction contactsPath(dataDir: string, slug: string): string {\n return path.join(dataDir, \"customers\", slug, \"contacts.json\");\n}\n\nexport function listContacts(dataDir: string, slug: string): CustomerContact[] {\n const raw = readJsonFile<unknown>(contactsPath(dataDir, slug), []);\n if (!Array.isArray(raw)) return [];\n return raw.flatMap((item) => {\n const r = CustomerContactSchema.safeParse(item);\n return r.success ? [r.data] : [];\n });\n}\n\nexport function upsertContact(dataDir: string, slug: string, contact: CustomerContact): void {\n assertSafeSlug(slug);\n const contacts = listContacts(dataDir, slug);\n const idx = contacts.findIndex((c) => c.email.toLowerCase() === contact.email.toLowerCase());\n if (idx >= 0) {\n contacts[idx] = { ...contacts[idx], ...contact };\n } else {\n contacts.push(contact);\n }\n // Ensure only one primary\n if (contact.isPrimary) {\n for (const c of contacts) {\n if (c.email.toLowerCase() !== contact.email.toLowerCase()) {\n c.isPrimary = false;\n }\n }\n }\n writeJsonFile(contactsPath(dataDir, slug), contacts);\n}\n\nexport function getPrimaryContact(dataDir: string, slug: string): CustomerContact | null {\n const contacts = listContacts(dataDir, slug);\n return contacts.find((c) => c.isPrimary) ?? contacts[0] ?? null;\n}\n","import fs from \"fs\";\nimport path from \"path\";\nimport { createHash } from \"crypto\";\nimport { streamCSV } from \"../core/csv-stream.js\";\nimport { escapeRegExp } from \"../core/regex.js\";\nimport { writeFileAtomic } from \"../fs/atomic-write.js\";\nimport { writeJsonFile } from \"../fs/json-store.js\";\nimport { upsertContact } from \"../fs/contacts-writer.js\";\nimport type { PipelineDeal } from \"../schemas/pipeline.js\";\nimport type { InteractionEntry } from \"../schemas/interaction.js\";\n\nexport interface HubSpotImportResult {\n companiesProcessed: number;\n contactsImported: number;\n dealsImported: number;\n engagementsImported: number;\n errors: string[];\n customPropertiesSaved: number;\n ownersResolved: number;\n}\n\nexport interface HubSpotImportOptions {\n dryRun?: boolean;\n ownerMap?: Record<string, string>; // hubspot email → dxcrm actor\n resume?: boolean;\n analyzeOnly?: boolean;\n}\n\nexport interface HubSpotAnalysis {\n companiesFound: number;\n contactsFound: number;\n dealsFound: number;\n engagementsFound: number;\n customPropertiesDetected: string[];\n ownersDetected: string[];\n unknownStages: string[];\n unmappedContacts: number;\n estimatedMinutes: number;\n}\n\n// ─── Stage + Type maps ────────────────────────────────────────────────────────\n\nconst STAGE_MAP: Record<string, PipelineDeal[\"stage\"]> = {\n appointmentscheduled: \"qualified\",\n qualifiedtobuy: \"qualified\",\n presentationscheduled: \"proposal\",\n decisionmakerboughtin: \"negotiation\",\n contractsent: \"negotiation\",\n closedwon: \"won\",\n closedlost: \"lost\",\n // Additional HubSpot stages\n prospecting: \"lead\",\n qualification: \"qualified\",\n proposal: \"proposal\",\n negotiation: \"negotiation\",\n closedwon2: \"won\",\n closedlost2: \"lost\",\n};\n\nconst TYPE_MAP: Record<string, InteractionEntry[\"type\"]> = {\n NOTE: \"Note\",\n CALL: \"Call\",\n EMAIL: \"Email\",\n MEETING: \"Meeting\",\n TASK: \"Note\",\n LINKEDIN_MESSAGE: \"Email\",\n WHATSAPP_MESSAGE: \"Email\",\n POSTAL_MAIL: \"Note\",\n};\n\n// Known HubSpot columns → dxcrm main_facts fields\nconst COMPANY_FIELD_MAP: Record<string, string> = {\n hs_annual_revenue: \"annual_revenue\",\n num_associated_contacts: \"contact_count\",\n industry: \"industry\",\n city: \"city\",\n country: \"country\",\n hs_lead_status: \"lead_status\",\n lifecyclestage: \"lifecycle_stage\",\n numberofemployees: \"employee_count\",\n phone: \"phone\",\n address: \"address\",\n zip: \"zip\",\n state: \"state\",\n};\n\nconst KNOWN_COMPANY_COLUMNS = new Set([\n \"name\",\n \"Name\",\n \"domain\",\n \"Domain\",\n \"website\",\n \"Website\",\n \"phone\",\n \"Phone\",\n \"address\",\n \"Address\",\n \"city\",\n \"City\",\n \"country\",\n \"Country\",\n \"state\",\n \"State\",\n \"zip\",\n \"Zip\",\n \"industry\",\n \"Industry\",\n \"numberofemployees\",\n \"Number of Employees\",\n \"hs_annual_revenue\",\n \"Annual Revenue\",\n \"lifecyclestage\",\n \"Lifecycle Stage\",\n \"hubspot_owner_email\",\n \"HubSpot Owner Email\",\n \"create_date\",\n \"createdate\",\n \"hs_lastmodifieddate\",\n \"hs_object_id\",\n \"Record ID\",\n]);\n\n// ─── Utilities ────────────────────────────────────────────────────────────────\n\nfunction slugify(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 60);\n}\n\nfunction hashStr(s: string): string {\n return createHash(\"sha256\").update(s).digest(\"hex\").slice(0, 16);\n}\n\nfunction coerceDate(raw: string): string {\n if (!raw) return new Date().toISOString().slice(0, 10);\n // HubSpot timestamps: \"2026-01-15 14:30:00 UTC\", \"1705318200000\" (ms), \"2026-01-15\"\n if (/^\\d{13}$/.test(raw.trim())) {\n return new Date(parseInt(raw, 10)).toISOString().slice(0, 10);\n }\n const d = new Date(raw.trim());\n if (!isNaN(d.getTime())) return d.toISOString().slice(0, 10);\n return new Date().toISOString().slice(0, 10);\n}\n\n// ─── Customer creation ────────────────────────────────────────────────────────\n\nfunction ensureCustomer(\n dataDir: string,\n name: string,\n domain: string,\n email: string,\n dryRun: boolean\n): { slug: string; created: boolean } {\n const slug = slugify(name || \"unknown\");\n const customerDir = path.join(dataDir, \"customers\", slug);\n const mainFactsPath = path.join(customerDir, \"main_facts.md\");\n if (fs.existsSync(mainFactsPath)) return { slug, created: false };\n if (dryRun) return { slug, created: true };\n\n fs.mkdirSync(customerDir, { recursive: true });\n const today = new Date().toISOString().slice(0, 10);\n const lines = [\n \"---\",\n `name: ${name}`,\n domain ? `domain: ${domain}` : null,\n email ? `email: ${email}` : null,\n \"relationship_stage: prospect\",\n `created: ${today}`,\n `updated: ${today}`,\n `last_touchpoint: ${today}`,\n \"tags: []\",\n \"currency: EUR\",\n \"---\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n writeFileAtomic(mainFactsPath, `${lines}\\n\\n# Customer: ${name}\\n`);\n writeFileAtomic(path.join(customerDir, \"interactions.md\"), `# Interactions — ${name}\\n\\n`);\n writeFileAtomic(path.join(customerDir, \"pipeline.md\"), `# Pipeline — ${name}\\n\\n`);\n writeJsonFile(path.join(customerDir, \"sources.json\"), {\n gmail: {\n query: domain\n ? `from:${domain} OR to:${domain}`\n : email\n ? `from:${email} OR to:${email}`\n : \"\",\n enabled: true,\n },\n transcripts: { paths: [], extensions: [\".txt\", \".vtt\"], enabled: false },\n });\n return { slug, created: true };\n}\n\nfunction readMainFactsRaw(dataDir: string, slug: string): string {\n const p = path.join(dataDir, \"customers\", slug, \"main_facts.md\");\n return fs.existsSync(p) ? (fs.readFileSync(p, \"utf-8\") as string) : \"\";\n}\n\n/** Patch several frontmatter fields in main_facts.md with a single read+write. */\nfunction updateMainFactsFields(\n dataDir: string,\n slug: string,\n fields: Record<string, string | undefined>\n): void {\n const entries = Object.entries(fields).filter(\n (e): e is [string, string] => e[1] !== undefined && e[1] !== \"\"\n );\n if (entries.length === 0) return;\n const p = path.join(dataDir, \"customers\", slug, \"main_facts.md\");\n if (!fs.existsSync(p)) return;\n let content = fs.readFileSync(p, \"utf-8\") as string;\n for (const [field, value] of entries) {\n const regex = new RegExp(`^${escapeRegExp(field)}:.*$`, \"m\");\n if (regex.test(content)) {\n content = content.replace(regex, `${field}: ${value}`);\n } else {\n const firstDash = content.indexOf(\"---\");\n const secondDash = content.indexOf(\"---\", firstDash + 3);\n if (secondDash >= 0) {\n content = content.slice(0, secondDash) + `${field}: ${value}\\n` + content.slice(secondDash);\n }\n }\n }\n writeFileAtomic(p, content);\n}\n\n// ─── Custom Properties ────────────────────────────────────────────────────────\n\nfunction saveCustomProperties(dataDir: string, slug: string, props: Record<string, string>): void {\n if (Object.keys(props).length === 0) return;\n const p = path.join(dataDir, \"customers\", slug, \"custom_properties.json\");\n let existing: Record<string, unknown> = {};\n if (fs.existsSync(p)) {\n try {\n existing = JSON.parse(fs.readFileSync(p, \"utf-8\") as string) as Record<string, unknown>;\n } catch {\n existing = {};\n }\n }\n const merged = {\n source: \"hubspot-import\",\n importedAt: new Date().toISOString(),\n properties: { ...((existing[\"properties\"] as Record<string, string>) ?? {}), ...props },\n };\n writeJsonFile(p, merged);\n}\n\n// ─── Progress / Resume ────────────────────────────────────────────────────────\n\ninterface ImportProgress {\n importId: string;\n source: string;\n startedAt: string;\n phases: {\n companies: { status: \"done\" | \"in-progress\" | \"pending\"; processed: number };\n contacts: { status: \"done\" | \"in-progress\" | \"pending\"; processed: number };\n deals: { status: \"done\" | \"in-progress\" | \"pending\"; processed: number };\n engagements: { status: \"done\" | \"in-progress\" | \"pending\"; processed: number };\n };\n}\n\nfunction progressPath(dataDir: string): string {\n return path.join(dataDir, \".agentic\", \"import-progress.json\");\n}\n\nfunction readProgress(dataDir: string): ImportProgress | null {\n const p = progressPath(dataDir);\n if (!fs.existsSync(p)) return null;\n try {\n return JSON.parse(fs.readFileSync(p, \"utf-8\") as string) as ImportProgress;\n } catch {\n return null;\n }\n}\n\nfunction writeProgress(dataDir: string, progress: ImportProgress): void {\n fs.mkdirSync(path.dirname(progressPath(dataDir)), { recursive: true });\n writeJsonFile(progressPath(dataDir), progress);\n}\n\nfunction clearProgress(dataDir: string): void {\n const p = progressPath(dataDir);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n}\n\n// ─── Analyze ──────────────────────────────────────────────────────────────────\n\nexport async function analyzeHubSpotExport(exportDir: string): Promise<HubSpotAnalysis> {\n const analysis: HubSpotAnalysis = {\n companiesFound: 0,\n contactsFound: 0,\n dealsFound: 0,\n engagementsFound: 0,\n customPropertiesDetected: [],\n ownersDetected: [],\n unknownStages: [],\n unmappedContacts: 0,\n estimatedMinutes: 0,\n };\n\n const customProps = new Set<string>();\n const owners = new Set<string>();\n const unknownStages = new Set<string>();\n const companyNames = new Set<string>();\n\n // Companies\n const companiesPath = path.join(exportDir, \"companies.csv\");\n if (fs.existsSync(companiesPath)) {\n for await (const row of streamCSV(companiesPath)) {\n analysis.companiesFound++;\n const name = (row[\"name\"] ?? row[\"Name\"] ?? \"\").trim();\n if (name) companyNames.add(name.toLowerCase());\n const owner = row[\"hubspot_owner_email\"] ?? row[\"HubSpot Owner Email\"] ?? \"\";\n if (owner) owners.add(owner);\n // Detect custom columns\n for (const key of Object.keys(row)) {\n if (!KNOWN_COMPANY_COLUMNS.has(key) && row[key]) customProps.add(key);\n }\n }\n }\n\n // Contacts\n const contactsPath = path.join(exportDir, \"contacts.csv\");\n if (fs.existsSync(contactsPath)) {\n for await (const row of streamCSV(contactsPath)) {\n analysis.contactsFound++;\n const company = (row[\"company\"] ?? row[\"Company\"] ?? row[\"associated_company\"] ?? \"\").trim();\n if (company && !companyNames.has(company.toLowerCase())) analysis.unmappedContacts++;\n const owner = row[\"contact_owner\"] ?? row[\"Contact Owner\"] ?? \"\";\n if (owner) owners.add(owner);\n }\n }\n\n // Deals\n const dealsPath = path.join(exportDir, \"deals.csv\");\n if (fs.existsSync(dealsPath)) {\n for await (const row of streamCSV(dealsPath)) {\n analysis.dealsFound++;\n const stage = (row[\"dealstage\"] ?? row[\"Deal Stage\"] ?? \"\").trim().toLowerCase();\n if (stage && !STAGE_MAP[stage]) unknownStages.add(stage);\n }\n }\n\n // Engagements\n const engagementsPath = path.join(exportDir, \"engagements.csv\");\n if (fs.existsSync(engagementsPath)) {\n for await (const _row of streamCSV(engagementsPath)) {\n analysis.engagementsFound++;\n }\n }\n\n analysis.customPropertiesDetected = Array.from(customProps).slice(0, 50);\n analysis.ownersDetected = Array.from(owners);\n analysis.unknownStages = Array.from(unknownStages);\n\n const totalRows =\n analysis.companiesFound +\n analysis.contactsFound +\n analysis.dealsFound +\n analysis.engagementsFound;\n analysis.estimatedMinutes = Math.ceil(totalRows / 2000); // ~2000 rows/min\n\n return analysis;\n}\n\n// ─── Main Import ──────────────────────────────────────────────────────────────\n\nexport async function runHubSpotCsvImport(\n exportDir: string,\n dataDir: string,\n opts: HubSpotImportOptions = {}\n): Promise<HubSpotImportResult> {\n const result: HubSpotImportResult = {\n companiesProcessed: 0,\n contactsImported: 0,\n dealsImported: 0,\n engagementsImported: 0,\n errors: [],\n customPropertiesSaved: 0,\n ownersResolved: 0,\n };\n\n const dryRun = opts.dryRun ?? false;\n const ownerMap = opts.ownerMap ?? {};\n\n // Resume handling\n let progress: ImportProgress | null = null;\n if (opts.resume) {\n progress = readProgress(dataDir);\n if (progress) {\n console.error(`[import] Resuming import ${progress.importId}...`);\n }\n }\n\n if (!progress) {\n progress = {\n importId: `hs-import-${new Date().toISOString().replace(/[:.]/g, \"-\").slice(0, 19)}`,\n source: exportDir,\n startedAt: new Date().toISOString(),\n phases: {\n companies: { status: \"pending\", processed: 0 },\n contacts: { status: \"pending\", processed: 0 },\n deals: { status: \"pending\", processed: 0 },\n engagements: { status: \"pending\", processed: 0 },\n },\n };\n }\n\n const companySlugMap = new Map<string, string>(); // name.lower → slug\n const emailSlugMap = new Map<string, string>(); // email.lower → slug\n\n // ── Phase 1: Companies ──────────────────────────────────────────────────────\n const companiesPath = path.join(exportDir, \"companies.csv\");\n if (fs.existsSync(companiesPath) && progress.phases.companies.status !== \"done\") {\n progress.phases.companies.status = \"in-progress\";\n if (!dryRun) writeProgress(dataDir, progress);\n\n for await (const row of streamCSV(companiesPath)) {\n const name = (row[\"name\"] ?? row[\"Name\"] ?? \"\").trim();\n if (!name) continue;\n\n const domain = (\n row[\"domain\"] ??\n row[\"Domain\"] ??\n row[\"website\"] ??\n row[\"Website\"] ??\n \"\"\n ).trim();\n const hubspotId = (row[\"hs_object_id\"] ?? row[\"Record ID\"] ?? \"\").trim();\n\n try {\n const { slug, created } = ensureCustomer(dataDir, name, domain, \"\", dryRun);\n companySlugMap.set(name.toLowerCase(), slug);\n result.companiesProcessed++;\n\n if (!dryRun && created) {\n // Map known fields + owner + HubSpot id, batched into one read+write.\n const factsPatch: Record<string, string | undefined> = {};\n for (const [hsKey, dxKey] of Object.entries(COMPANY_FIELD_MAP)) {\n const val = row[hsKey] ?? \"\";\n if (val) factsPatch[dxKey] = val;\n }\n\n const ownerEmail = row[\"hubspot_owner_email\"] ?? row[\"HubSpot Owner Email\"] ?? \"\";\n if (ownerEmail && ownerMap[ownerEmail]) {\n factsPatch[\"assigned_rep\"] = ownerMap[ownerEmail]!;\n result.ownersResolved++;\n }\n\n if (hubspotId) factsPatch[\"hubspot_company_id\"] = hubspotId;\n\n updateMainFactsFields(dataDir, slug, factsPatch);\n\n // Custom properties — everything not in known columns\n const customProps: Record<string, string> = {};\n for (const [key, val] of Object.entries(row)) {\n if (!KNOWN_COMPANY_COLUMNS.has(key) && val) customProps[key] = val;\n }\n if (Object.keys(customProps).length > 0) {\n saveCustomProperties(dataDir, slug, customProps);\n result.customPropertiesSaved += Object.keys(customProps).length;\n }\n }\n } catch (err) {\n result.errors.push(`Company '${name}': ${(err as Error).message}`);\n }\n\n progress.phases.companies.processed++;\n }\n\n progress.phases.companies.status = \"done\";\n if (!dryRun) writeProgress(dataDir, progress);\n } else if (progress.phases.companies.status === \"done\") {\n // Rebuild maps from disk for resume\n const customersDir = path.join(dataDir, \"customers\");\n if (fs.existsSync(customersDir)) {\n for (const slug of fs.readdirSync(customersDir)) {\n const mf = path.join(customersDir, slug, \"main_facts.md\");\n if (!fs.existsSync(mf)) continue;\n const content = fs.readFileSync(mf, \"utf-8\") as string;\n const nameMatch = content.match(/^name:\\s*(.+)$/m);\n if (nameMatch?.[1]) companySlugMap.set(nameMatch[1].trim().toLowerCase(), slug);\n }\n }\n }\n\n // ── Phase 2: Contacts ───────────────────────────────────────────────────────\n const contactsPath = path.join(exportDir, \"contacts.csv\");\n if (fs.existsSync(contactsPath) && progress.phases.contacts.status !== \"done\") {\n progress.phases.contacts.status = \"in-progress\";\n if (!dryRun) writeProgress(dataDir, progress);\n\n for await (const row of streamCSV(contactsPath)) {\n const firstName = (row[\"firstname\"] ?? row[\"First Name\"] ?? \"\").trim();\n const lastName = (row[\"lastname\"] ?? row[\"Last Name\"] ?? \"\").trim();\n const email = (row[\"email\"] ?? row[\"Email\"] ?? \"\").trim();\n const companyName = (\n row[\"company\"] ??\n row[\"Company\"] ??\n row[\"associated_company\"] ??\n row[\"Associated Company\"] ??\n \"\"\n ).trim();\n const phone = (row[\"phone\"] ?? row[\"Phone\"] ?? row[\"mobilephone\"] ?? \"\").trim();\n const title = (row[\"jobtitle\"] ?? row[\"Job Title\"] ?? \"\").trim();\n const department = (row[\"department\"] ?? row[\"Department\"] ?? \"\").trim();\n const hubspotId = (row[\"vid\"] ?? row[\"Contact ID\"] ?? row[\"hs_object_id\"] ?? \"\").trim();\n\n let slug = companySlugMap.get(companyName.toLowerCase());\n\n if (!slug && companyName) {\n const domain = (row[\"website\"] ?? \"\").trim();\n try {\n const { slug: newSlug, created } = ensureCustomer(\n dataDir,\n companyName,\n domain,\n email,\n dryRun\n );\n slug = newSlug;\n companySlugMap.set(companyName.toLowerCase(), newSlug);\n if (created) result.companiesProcessed++;\n } catch (err) {\n result.errors.push(`Auto-company '${companyName}': ${(err as Error).message}`);\n }\n }\n\n if (!slug) continue;\n\n if (!dryRun) {\n const contactName = [firstName, lastName].filter(Boolean).join(\" \");\n const isFirst = !fs.existsSync(path.join(dataDir, \"customers\", slug, \"contacts.json\"));\n\n // Multi-contact support\n if (email || contactName) {\n const contactEntry = {\n email: email || `${slugify(contactName)}@unknown.local`,\n name: contactName || email,\n ...(title ? { title } : {}),\n ...(phone ? { phone } : {}),\n ...(department ? { department } : {}),\n ...(hubspotId ? { hubspotId } : {}),\n isPrimary: isFirst,\n createdAt: new Date().toISOString(),\n };\n try {\n upsertContact(dataDir, slug, contactEntry);\n } catch {\n /* skip invalid */\n }\n }\n\n // Update main_facts primary contact (first contact only) — batched into\n // a single read+write instead of one per field.\n const existing = readMainFactsRaw(dataDir, slug);\n const factsPatch: Record<string, string | undefined> = {};\n if (email && !existing.includes(\"email:\")) factsPatch[\"email\"] = email;\n if (phone && !existing.includes(\"phone:\")) factsPatch[\"phone\"] = phone;\n if (contactName && !existing.includes(\"primary_contact:\"))\n factsPatch[\"primary_contact\"] = contactName;\n\n // Owner mapping\n const ownerEmail = row[\"contact_owner\"] ?? row[\"Contact Owner\"] ?? \"\";\n if (ownerEmail && ownerMap[ownerEmail] && !existing.includes(\"assigned_rep:\")) {\n factsPatch[\"assigned_rep\"] = ownerMap[ownerEmail]!;\n result.ownersResolved++;\n }\n updateMainFactsFields(dataDir, slug, factsPatch);\n }\n\n if (email) emailSlugMap.set(email.toLowerCase(), slug);\n result.contactsImported++;\n progress.phases.contacts.processed++;\n }\n\n progress.phases.contacts.status = \"done\";\n if (!dryRun) writeProgress(dataDir, progress);\n }\n\n // ── Phase 3: Deals ──────────────────────────────────────────────────────────\n const dealsPath = path.join(exportDir, \"deals.csv\");\n if (fs.existsSync(dealsPath) && progress.phases.deals.status !== \"done\") {\n if (!dryRun) {\n const { upsertDeal } = await import(\"../fs/pipeline-writer.js\");\n progress.phases.deals.status = \"in-progress\";\n writeProgress(dataDir, progress);\n\n for await (const row of streamCSV(dealsPath)) {\n const dealName = (row[\"dealname\"] ?? row[\"Deal Name\"] ?? row[\"name\"] ?? \"\").trim();\n if (!dealName) continue;\n\n const companyName = (\n row[\"associated_company\"] ??\n row[\"Associated Company\"] ??\n row[\"company\"] ??\n \"\"\n ).trim();\n const amountStr = (row[\"amount\"] ?? row[\"Amount\"] ?? \"0\").trim().replace(/[^0-9.]/g, \"\");\n const stageRaw = (row[\"dealstage\"] ?? row[\"Deal Stage\"] ?? \"\").trim().toLowerCase();\n const closeDateRaw = (\n row[\"closedate\"] ??\n row[\"Close Date\"] ??\n row[\"close_date\"] ??\n \"\"\n ).trim();\n const currency = (row[\"deal_currency_code\"] ?? row[\"Currency\"] ?? \"EUR\").trim();\n const dealId = (row[\"hs_deal_id\"] ?? row[\"hs_object_id\"] ?? row[\"Record ID\"] ?? \"\").trim();\n const ownerEmail = (row[\"hubspot_owner_email\"] ?? row[\"HubSpot Owner Email\"] ?? \"\").trim();\n const description = (row[\"description\"] ?? row[\"Description\"] ?? \"\").trim();\n\n const slug =\n companySlugMap.get(companyName.toLowerCase()) ?? slugify(companyName || \"unknown\");\n const stage = STAGE_MAP[stageRaw] ?? \"qualified\";\n const amount = parseFloat(amountStr) || 0;\n const closeDate = coerceDate(closeDateRaw);\n\n const notesParts: string[] = [];\n if (dealId) notesParts.push(`hubspot://deal/${dealId}`);\n if (description) notesParts.push(description.slice(0, 200));\n if (ownerEmail && ownerMap[ownerEmail]) notesParts.push(`owner:${ownerMap[ownerEmail]}`);\n\n const deal: PipelineDeal = {\n name: dealName,\n stage,\n value: amount,\n currency: currency || \"EUR\",\n probability: stage === \"won\" ? 1 : stage === \"lost\" ? 0 : 0.5,\n close_date: closeDate,\n updated: new Date().toISOString().slice(0, 10),\n ...(notesParts.length > 0 ? { notes: notesParts.join(\" | \") } : {}),\n };\n\n try {\n await upsertDeal(dataDir, slug, deal);\n result.dealsImported++;\n } catch (err) {\n result.errors.push(`Deal '${dealName}': ${(err as Error).message}`);\n }\n\n progress.phases.deals.processed++;\n }\n\n progress.phases.deals.status = \"done\";\n writeProgress(dataDir, progress);\n } else {\n // Dry run count\n for await (const row of streamCSV(dealsPath)) {\n if ((row[\"dealname\"] ?? row[\"name\"] ?? \"\").trim()) result.dealsImported++;\n }\n progress.phases.deals.status = \"done\";\n }\n }\n\n // ── Phase 4: Engagements ────────────────────────────────────────────────────\n const engagementsPath = path.join(exportDir, \"engagements.csv\");\n if (fs.existsSync(engagementsPath) && progress.phases.engagements.status !== \"done\") {\n if (!dryRun) {\n const { appendInteraction, InteractionDedup } = await import(\"../fs/interactions-writer.js\");\n const dedup = new InteractionDedup(dataDir);\n progress.phases.engagements.status = \"in-progress\";\n writeProgress(dataDir, progress);\n\n for await (const row of streamCSV(engagementsPath)) {\n const engType = (\n row[\"engagement_type\"] ??\n row[\"Engagement Type\"] ??\n row[\"type\"] ??\n row[\"Type\"] ??\n \"NOTE\"\n )\n .trim()\n .toUpperCase();\n const timestamp = (\n row[\"hs_timestamp\"] ??\n row[\"Timestamp\"] ??\n row[\"date\"] ??\n row[\"createdate\"] ??\n \"\"\n ).trim();\n const body = (\n row[\"hs_body_preview\"] ??\n row[\"Body\"] ??\n row[\"notes\"] ??\n row[\"Notes\"] ??\n row[\"hs_note_body\"] ??\n \"\"\n ).trim();\n const subject = (row[\"subject\"] ?? row[\"Subject\"] ?? \"\").trim();\n const contactEmail = (\n row[\"associated_contact_email\"] ??\n row[\"Contact Email\"] ??\n row[\"from_email\"] ??\n \"\"\n )\n .trim()\n .toLowerCase();\n const engId = (\n row[\"id\"] ??\n row[\"engagement_id\"] ??\n row[\"hs_object_id\"] ??\n hashStr(timestamp + body)\n ).trim();\n const callDuration = (row[\"call_duration\"] ?? row[\"hs_call_duration\"] ?? \"\").trim();\n const callOutcome = (row[\"call_outcome\"] ?? row[\"hs_call_disposition\"] ?? \"\").trim();\n const callRecording = (\n row[\"call_recording_url\"] ??\n row[\"hs_call_recording_url\"] ??\n \"\"\n ).trim();\n\n const slug =\n emailSlugMap.get(contactEmail) ??\n companySlugMap.get((row[\"associated_company\"] ?? \"\").toLowerCase().trim());\n if (!slug) continue;\n\n const sourceRef = `hubspot://engagement/${engId}`;\n try {\n if (await dedup.seen(slug, sourceRef)) continue;\n\n const date = coerceDate(timestamp);\n const type = TYPE_MAP[engType] ?? \"Note\";\n\n // Build rich summary\n const summaryParts: string[] = [];\n if (subject) summaryParts.push(`Subject: ${subject}`);\n if (body) summaryParts.push(body.slice(0, 500));\n if (callDuration) summaryParts.push(`Duration: ${callDuration}s`);\n if (callOutcome) summaryParts.push(`Outcome: ${callOutcome}`);\n if (callRecording) summaryParts.push(`Recording: ${callRecording}`);\n\n const summary = summaryParts.join(\" | \") || `${type} imported from HubSpot`;\n\n await appendInteraction(dataDir, slug, {\n date,\n type,\n with: contactEmail || slug,\n summary,\n nextSteps: [],\n sourceRef,\n synced: new Date().toISOString(),\n });\n dedup.markAppended(slug, sourceRef);\n result.engagementsImported++;\n } catch (err) {\n result.errors.push(`Engagement ${engId}: ${(err as Error).message}`);\n }\n\n progress.phases.engagements.processed++;\n }\n\n progress.phases.engagements.status = \"done\";\n writeProgress(dataDir, progress);\n } else {\n for await (const _row of streamCSV(engagementsPath)) result.engagementsImported++;\n progress.phases.engagements.status = \"done\";\n }\n }\n\n // Done — clear progress file\n if (!dryRun) clearProgress(dataDir);\n\n return result;\n}\n"],"mappings":";;;;;;;;;;AAOA,SAAS,aAAa,MAAc,YAAY,KAAe;CAC7D,MAAM,SAAmB,CAAC;CAC1B,IAAI,UAAU;CACd,IAAI,WAAW;CACf,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,KAAK,KAAK;EAChB,IAAI,OAAO,MACT,IAAI,YAAY,KAAK,IAAI,OAAO,MAAK;GACnC,WAAW;GACX;EACF,OACE,WAAW,CAAC;OAET,IAAI,OAAO,aAAa,CAAC,UAAU;GACxC,OAAO,KAAK,QAAQ,KAAK,CAAC;GAC1B,UAAU;EACZ,OACE,WAAW;CAEf;CACA,OAAO,KAAK,QAAQ,KAAK,CAAC;CAC1B,OAAO;AACT;;AAGA,gBAAuB,UACrB,UACA,OAAyB,CAAC,GACc;CACxC,MAAM,YAAY,KAAK,aAAa;CACpC,MAAM,SAAS,GAAG,iBAAiB,UAAU,EAAE,UAAU,QAAQ,CAAC;CAClE,MAAM,KAAK,SAAS,gBAAgB;EAAE,OAAO;EAAQ,WAAW;CAAS,CAAC;CAE1E,IAAI,UAA2B;CAE/B,WAAW,MAAM,QAAQ,IAAI;EAC3B,MAAM,UAAU,KAAK,KAAK;EAC1B,IAAI,CAAC,SAAS;EACd,MAAM,SAAS,aAAa,SAAS,SAAS;EAC9C,IAAI,CAAC,SAAS;GACZ,UAAU,OAAO,KAAK,MAAM,EAAE,QAAQ,UA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MAAM;KACrC;KACA;KACA,MAAM,gBAAgB;KACtB;KACA,WAAW,CAAC;KACZ;KACA,yBAAQ,IAAI,KAAK,GAAE,YAAY;IACjC,CAAC;IACD,MAAM,aAAa,MAAM,SAAS;IAClC,OAAO;GACT,SAAS,KAAK;IACZ,OAAO,OAAO,KAAK,cAAc,MAAM,IAAK,IAAc,SAAS;GACrE;GAEA,SAAS,OAAO,YAAY;EAC9B;EAEA,SAAS,OAAO,YAAY,SAAS;EACrC,cAAc,SAAS,QAAQ;CACjC,OAAO;EACL,WAAW,MAAM,QAAQ,UAAU,eAAe,GAAG,OAAO;EAC5D,SAAS,OAAO,YAAY,SAAS;CACvC;CAIF,IAAI,CAAC,QAAQ,cAAc,OAAO;CAElC,OAAO;AACT"}
|
|
@@ -139,8 +139,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
139
139
|
sourceRef: z.ZodString;
|
|
140
140
|
synced: z.ZodString;
|
|
141
141
|
}, "strip", z.ZodTypeAny, {
|
|
142
|
-
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
143
142
|
date: string;
|
|
143
|
+
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
144
144
|
with: string;
|
|
145
145
|
summary: string;
|
|
146
146
|
nextSteps: string[];
|
|
@@ -149,8 +149,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
149
149
|
direction?: "inbound" | "outbound" | undefined;
|
|
150
150
|
subject?: string | undefined;
|
|
151
151
|
}, {
|
|
152
|
-
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
153
152
|
date: string;
|
|
153
|
+
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
154
154
|
with: string;
|
|
155
155
|
summary: string;
|
|
156
156
|
sourceRef: string;
|
|
@@ -516,7 +516,11 @@ interface RbacConfig {
|
|
|
516
516
|
declare function getRbacConfig(dataDir: string): RbacConfig;
|
|
517
517
|
declare function getRole(dataDir: string, actor: string): Role;
|
|
518
518
|
declare function canSeeCustomer(dataDir: string, actor: string, slug: string): boolean;
|
|
519
|
-
/**
|
|
519
|
+
/**
|
|
520
|
+
* Build a once-loaded predicate for which customers `actor` may see. Equivalent
|
|
521
|
+
* to calling canSeeCustomer per slug, but reads/parses rbac.json a single time
|
|
522
|
+
* (and uses O(1) Set membership) — for hot loops like list_customers.
|
|
523
|
+
*/
|
|
520
524
|
//#endregion
|
|
521
525
|
//#region src/core/session-store.d.ts
|
|
522
526
|
interface Session {
|
|
@@ -536,4 +540,4 @@ declare const VERSION = "0.1.0";
|
|
|
536
540
|
|
|
537
541
|
//#endregion
|
|
538
542
|
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 };
|
|
539
|
-
//# sourceMappingURL=index-
|
|
543
|
+
//# sourceMappingURL=index-B0IMMrp_.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-B0IMMrp_.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,OAA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B,GAAA,IAAA,CAAA;;;iBUpBR,QAAA;;;EVUT,KAAA,CAAA,EAAA,MAAA;EAMX,IAAA,CAAA,EAAA,OAAA;sBURC;;;AVQD,iBWoBoB,WAAA,CXpBpB,IAAA,EAAA;;qBWoB2E;;;AXpB3E,iBYCc,cAAA,CZDd,OAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;;iBYuCoB,aAAA,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"}
|
|
@@ -138,8 +138,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
138
138
|
sourceRef: z.ZodString;
|
|
139
139
|
synced: z.ZodString;
|
|
140
140
|
}, "strip", z.ZodTypeAny, {
|
|
141
|
-
date: string;
|
|
142
141
|
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
142
|
+
date: string;
|
|
143
143
|
with: string;
|
|
144
144
|
summary: string;
|
|
145
145
|
nextSteps: string[];
|
|
@@ -148,8 +148,8 @@ declare const InteractionEntrySchema: z.ZodObject<{
|
|
|
148
148
|
direction?: "inbound" | "outbound" | undefined;
|
|
149
149
|
subject?: string | undefined;
|
|
150
150
|
}, {
|
|
151
|
-
date: string;
|
|
152
151
|
type: "Email" | "Call" | "Meeting" | "Note" | "Demo" | "Proposal" | "Contract" | "Other";
|
|
152
|
+
date: string;
|
|
153
153
|
with: string;
|
|
154
154
|
summary: string;
|
|
155
155
|
sourceRef: string;
|
|
@@ -515,7 +515,11 @@ interface RbacConfig {
|
|
|
515
515
|
declare function getRbacConfig(dataDir: string): RbacConfig;
|
|
516
516
|
declare function getRole(dataDir: string, actor: string): Role;
|
|
517
517
|
declare function canSeeCustomer(dataDir: string, actor: string, slug: string): boolean;
|
|
518
|
-
/**
|
|
518
|
+
/**
|
|
519
|
+
* Build a once-loaded predicate for which customers `actor` may see. Equivalent
|
|
520
|
+
* to calling canSeeCustomer per slug, but reads/parses rbac.json a single time
|
|
521
|
+
* (and uses O(1) Set membership) — for hot loops like list_customers.
|
|
522
|
+
*/
|
|
519
523
|
//#endregion
|
|
520
524
|
//#region src/core/session-store.d.ts
|
|
521
525
|
interface Session {
|
|
@@ -535,4 +539,4 @@ declare const VERSION = "0.1.0";
|
|
|
535
539
|
|
|
536
540
|
//#endregion
|
|
537
541
|
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 };
|
|
538
|
-
//# sourceMappingURL=index-
|
|
542
|
+
//# sourceMappingURL=index-pY7tYXwH.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-pY7tYXwH.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.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A,GAAc;iBAId,YAAA,CAAA;;;;cCjBH,OAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-DakpK96I.cjs");
|
|
3
|
-
const require_session_store = require("./session-store-
|
|
3
|
+
const require_session_store = require("./session-store-yfwnj0OC.cjs");
|
|
4
|
+
const require_atomic_write = require("./atomic-write-BYmF-ThH.cjs");
|
|
4
5
|
let commander = require("commander");
|
|
5
6
|
let path = require("path");
|
|
6
7
|
path = require_chunk.__toESM(path, 1);
|
|
@@ -28,28 +29,25 @@ async function createCustomer(opts) {
|
|
|
28
29
|
updated: today
|
|
29
30
|
});
|
|
30
31
|
const interactionsPath = path.default.join(dir, "interactions.md");
|
|
31
|
-
if (!fs.default.existsSync(interactionsPath))
|
|
32
|
+
if (!fs.default.existsSync(interactionsPath)) require_atomic_write.writeFileAtomic(interactionsPath, `# Interactions — ${opts.name}\n\n`);
|
|
32
33
|
const pipelinePath = path.default.join(dir, "pipeline.md");
|
|
33
|
-
if (!fs.default.existsSync(pipelinePath))
|
|
34
|
+
if (!fs.default.existsSync(pipelinePath)) require_atomic_write.writeFileAtomic(pipelinePath, `# Pipeline — ${opts.name}\n\n| Deal | Stage | Value | Currency | Probability | Close Date | Updated | Notes |\n|---|---|---|---|---|---|---|---|\n`);
|
|
34
35
|
const sourcesPath = path.default.join(dir, "sources.json");
|
|
35
|
-
if (!fs.default.existsSync(sourcesPath)) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
fs.default.writeFileSync(sourcesPath, JSON.stringify(sources, null, 2));
|
|
46
|
-
}
|
|
36
|
+
if (!fs.default.existsSync(sourcesPath)) require_session_store.writeJsonFile(sourcesPath, {
|
|
37
|
+
gmail: {
|
|
38
|
+
type: "gmail",
|
|
39
|
+
query: opts.domain ? `from:${opts.domain} OR to:${opts.domain}` : opts.email ? `from:${opts.email} OR to:${opts.email}` : "",
|
|
40
|
+
enabled: true
|
|
41
|
+
},
|
|
42
|
+
version: 1,
|
|
43
|
+
created: (/* @__PURE__ */ new Date()).toISOString()
|
|
44
|
+
});
|
|
47
45
|
return {
|
|
48
46
|
id,
|
|
49
47
|
dir
|
|
50
48
|
};
|
|
51
49
|
}
|
|
52
|
-
new commander.Command("create").argument("<name>", "Customer name").option("--domain <domain>", "Primary domain (for Gmail sync)").option("--email <email>", "Primary contact email").action(async (name, opts) => {
|
|
50
|
+
new commander.Command("create").description("Create a new customer").argument("<name>", "Customer name").option("--domain <domain>", "Primary domain (for Gmail sync)").option("--email <email>", "Primary contact email").action(async (name, opts) => {
|
|
53
51
|
try {
|
|
54
52
|
const { id, dir } = await createCustomer({
|
|
55
53
|
name,
|
|
@@ -135,17 +133,17 @@ async function runValidate(opts, dataDir) {
|
|
|
135
133
|
}
|
|
136
134
|
try {
|
|
137
135
|
let content = fs.default.readFileSync(factsPath, "utf-8");
|
|
138
|
-
|
|
136
|
+
let parsed = (0, gray_matter.default)(content);
|
|
139
137
|
if (opts.fix) {
|
|
140
|
-
const result = applyFix(factsPath, content, data);
|
|
138
|
+
const result = applyFix(factsPath, content, parsed.data);
|
|
141
139
|
if (result) {
|
|
142
140
|
content = result.content;
|
|
141
|
+
parsed = (0, gray_matter.default)(content);
|
|
143
142
|
fixedCount++;
|
|
144
143
|
console.log(require_session_store.info(`⚙ ${slug}: fixed ${result.fixed.join(", ")}`));
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
|
-
|
|
148
|
-
require_session_store.MainFactsSchema.parse(refetchedData);
|
|
146
|
+
require_session_store.MainFactsSchema.parse(parsed.data);
|
|
149
147
|
if (!fs.default.existsSync(interactionsPath)) console.log(require_session_store.warning(`⚠ ${slug}: missing interactions.md`));
|
|
150
148
|
else console.log(require_session_store.success(`✓ ${slug}`));
|
|
151
149
|
} catch (err) {
|
|
@@ -159,7 +157,7 @@ async function runValidate(opts, dataDir) {
|
|
|
159
157
|
process.exit(1);
|
|
160
158
|
} else console.log(require_session_store.success("\n✓ All customers valid."));
|
|
161
159
|
}
|
|
162
|
-
new commander.Command("validate").option("--fix", "Auto-fix recoverable issues").action(async (opts) => {
|
|
160
|
+
new commander.Command("validate").description("Validate all customer data against schemas").option("--fix", "Auto-fix recoverable issues").action(async (opts) => {
|
|
163
161
|
await runValidate(opts, process.env["DXCRM_DATA_DIR"] ?? process.cwd());
|
|
164
162
|
});
|
|
165
163
|
//#endregion
|