@fleox-agent-crm/agentcrm 0.4.0 → 0.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 +16 -16
- package/changelog.json +9 -0
- package/dist/admin/admin-files.json +1 -1
- package/dist/agent/agentcrm.mjs +133 -61
- package/dist/agent/chunks/{automations-DwWruxmu.mjs → automations-BqY8EwfJ.mjs} +3 -3
- package/dist/agent/chunks/{backup-W3CjgkAJ.mjs → backup-CO0EzdF_.mjs} +3 -3
- package/dist/agent/chunks/{compact-BGHI92tm.mjs → compact-qF5t42ko.mjs} +3 -3
- package/dist/agent/chunks/{exportCsv-C6e6XEmB.mjs → exportCsv-C-fIHLm1.mjs} +2 -2
- package/dist/agent/chunks/{extCheck-GgHG1dYB.mjs → extCheck-BcbUc7eB.mjs} +4 -4
- package/dist/agent/chunks/{files-D1daDgY0.mjs → files-C4YONVqQ.mjs} +2 -2
- package/dist/agent/chunks/{forms-BfuWaQjA.mjs → forms-DJDop3XY.mjs} +2 -2
- package/dist/agent/chunks/{importCsv-LVmMTaWU.mjs → importCsv-XjQJ9QIR.mjs} +2 -2
- package/dist/agent/chunks/{install-BLNflFes.mjs → install-D1lgtRIH.mjs} +1 -1
- package/dist/agent/chunks/{loader-MPD9iAvh.mjs → loader-Cv0UJf6b.mjs} +11 -11
- package/dist/agent/chunks/{migrate-CsClnnN8.mjs → migrate-Cc_8MHZv.mjs} +1 -1
- package/dist/agent/chunks/{pipelines-BAKpPk1w.mjs → pipelines-DiJ2dLqQ.mjs} +3 -3
- package/dist/agent/chunks/{records-DcHFelq5.mjs → records-CCTxxMWF.mjs} +1 -1
- package/dist/agent/chunks/{registry-COfJrSmg.mjs → registry-ClzNZv9Z.mjs} +10 -10
- package/dist/agent/chunks/{reports-BACHGccj.mjs → reports-WlI_A5Nr.mjs} +3 -3
- package/dist/agent/chunks/{runtime-C0Xf0Axi.mjs → runtime-BAF5vU5D.mjs} +17 -17
- package/dist/agent/chunks/{schema-C4lSslXv.mjs → schema-DOnnH2zL.mjs} +3 -3
- package/dist/agent/chunks/schemaApply-DKHipylx.mjs +164 -0
- package/dist/agent/chunks/{seed-6MRmQQBR.mjs → seed-Bb26Zsni.mjs} +2 -2
- package/dist/agent/chunks/{server-DC3t8r30.mjs → server-Bch4TQon.mjs} +3 -3
- package/dist/agent/chunks/{standardObjects-CheqfDqa.mjs → standardObjects-vrmqIVLH.mjs} +1 -1
- package/dist/agent/chunks/{stats-BfuLWhVV.mjs → stats-DfmDP3tE.mjs} +3 -3
- package/dist/agent/chunks/{tools-iSH-yMpl.mjs → tools-CCk24tdh.mjs} +9 -9
- package/dist/agent/chunks/{views-DH1n9Lrt.mjs → views-BbhmQO3n.mjs} +4 -4
- package/dist/version.json +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agentcrm-admin/SKILL.md +67 -67
- package/plugin/skills/agentcrm-admin/references/records.md +5 -5
- package/plugin/skills/agentcrm-admin/references/schema.md +19 -19
- package/plugin/skills/agentcrm-extensions/SKILL.md +8 -8
- package/plugin/skills/agentcrm-extensions/references/module-recipes.md +2 -2
- package/plugin/skills/agentcrm-extensions/references/testing.md +14 -14
- package/plugin/skills/agentcrm-extensions/references/theme-recipes.md +3 -3
- package/plugin/skills/agentcrm-install/SKILL.md +13 -13
- package/plugin/skills/agentcrm-install/references/firebase.md +1 -1
- package/plugin/skills/agentcrm-install/references/github.md +1 -1
- package/plugin/skills/agentcrm-install/references/mcp.md +2 -2
- package/plugin/skills/agentcrm-install/references/plans.md +1 -1
- package/plugin/skills/agentcrm-install/references/s3.md +1 -1
- package/plugin/skills/agentcrm-manage/SKILL.md +15 -15
- package/plugin/skills/agentcrm-sales/SKILL.md +18 -18
|
@@ -7,7 +7,7 @@ const __dirname = __acrmDirname(__filename);
|
|
|
7
7
|
import { J as JSZip } from "./index-w03ReRs4.mjs";
|
|
8
8
|
import { F as FILE_ID_RE } from "./ids-u-noYcy5.mjs";
|
|
9
9
|
import { assertCan, OpsError } from "./context-CxFfqS4D.mjs";
|
|
10
|
-
import { exportJson, importJson, planImportJson } from "./exportCsv-
|
|
10
|
+
import { exportJson, importJson, planImportJson } from "./exportCsv-C-fIHLm1.mjs";
|
|
11
11
|
import { filesOf } from "./store-5gqRSKXg.mjs";
|
|
12
12
|
import "./_commonjsHelpers-ClciMIcB.mjs";
|
|
13
13
|
import "stream";
|
|
@@ -19,9 +19,9 @@ import "./papaparse-Df7i1dHr.mjs";
|
|
|
19
19
|
import "./fields-B0bitgmr.mjs";
|
|
20
20
|
import "./query-C5nJB_3C.mjs";
|
|
21
21
|
import "./types-BOy9PUl7.mjs";
|
|
22
|
-
import "./records-
|
|
22
|
+
import "./records-CCTxxMWF.mjs";
|
|
23
23
|
import "./ids-CvnmrMJX.mjs";
|
|
24
|
-
import "./standardObjects-
|
|
24
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
25
25
|
import "./relations-B9TynBmA.mjs";
|
|
26
26
|
const BACKUP_DATA_FILE = "data.json";
|
|
27
27
|
const BACKUP_FILES_DIR = "files/";
|
|
@@ -6,8 +6,8 @@ const __filename = __acrmPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
7
|
import { assertCan } from "./context-CxFfqS4D.mjs";
|
|
8
8
|
import { b as fileCleanupMutations } from "./relations-B9TynBmA.mjs";
|
|
9
|
-
import { purgeFiles } from "./files-
|
|
10
|
-
import { hardDeleteMutations } from "./records-
|
|
9
|
+
import { purgeFiles } from "./files-C4YONVqQ.mjs";
|
|
10
|
+
import { hardDeleteMutations } from "./records-CCTxxMWF.mjs";
|
|
11
11
|
import { recordsOf, activitiesOf, automationRunsOf } from "./store-5gqRSKXg.mjs";
|
|
12
12
|
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
13
13
|
import "./fields-B0bitgmr.mjs";
|
|
@@ -27,7 +27,7 @@ import "node:crypto";
|
|
|
27
27
|
import "node:os";
|
|
28
28
|
import "node:child_process";
|
|
29
29
|
import "node:http";
|
|
30
|
-
import "./standardObjects-
|
|
30
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
31
31
|
async function compactData(ctx, opts = {}) {
|
|
32
32
|
assertCan(ctx, "compact");
|
|
33
33
|
const cutoff = ctx.now() - (opts.olderThanDays ?? 0) * 864e5;
|
|
@@ -9,13 +9,13 @@ import { formatAddress, formatFieldValue } from "./fields-B0bitgmr.mjs";
|
|
|
9
9
|
import { a as applySorts, b as applyFilters, r as resolveField, g as getRecordValue } from "./query-C5nJB_3C.mjs";
|
|
10
10
|
import { COLLECTIONS } from "./types-BOy9PUl7.mjs";
|
|
11
11
|
import { assertCan, OpsError } from "./context-CxFfqS4D.mjs";
|
|
12
|
-
import { queryContext } from "./records-
|
|
12
|
+
import { queryContext } from "./records-CCTxxMWF.mjs";
|
|
13
13
|
import { requireObject, recordsOf, userOf } from "./store-5gqRSKXg.mjs";
|
|
14
14
|
import "./_commonjsHelpers-ClciMIcB.mjs";
|
|
15
15
|
import "stream";
|
|
16
16
|
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
17
17
|
import "./ids-CvnmrMJX.mjs";
|
|
18
|
-
import "./standardObjects-
|
|
18
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
19
19
|
import "./relations-B9TynBmA.mjs";
|
|
20
20
|
function exportCsv(ctx, objectId, opts = {}) {
|
|
21
21
|
assertCan(ctx, "export");
|
|
@@ -93,11 +93,11 @@ async function loadInSandbox(report, manifest, files, opts) {
|
|
|
93
93
|
import("./memory-WNR3VHUJ.mjs"),
|
|
94
94
|
import("./context-CxFfqS4D.mjs"),
|
|
95
95
|
import("./pluginRegistry-DyHtlkcr.mjs"),
|
|
96
|
-
import("./seed-
|
|
96
|
+
import("./seed-Bb26Zsni.mjs"),
|
|
97
97
|
import("./store-5gqRSKXg.mjs"),
|
|
98
|
-
import("./loader-
|
|
99
|
-
import("./registry-
|
|
100
|
-
import("./tools-
|
|
98
|
+
import("./loader-Cv0UJf6b.mjs"),
|
|
99
|
+
import("./registry-ClzNZv9Z.mjs"),
|
|
100
|
+
import("./tools-CCk24tdh.mjs"),
|
|
101
101
|
import("./extensionActions-D2HtpQz4.mjs"),
|
|
102
102
|
import("./featureRegistry-DSsZbhrh.mjs"),
|
|
103
103
|
import("./themes-DPZFv3yc.mjs"),
|
|
@@ -11,7 +11,7 @@ import { m as mapLimit } from "./http-Bk9ICb7I.mjs";
|
|
|
11
11
|
import { assertCan, OpsError, actorId } from "./context-CxFfqS4D.mjs";
|
|
12
12
|
import { s as sameTarget, e as fileFieldIds, g as fileIdsIn, f as fileTargetPatch, h as referencedFileIds } from "./relations-B9TynBmA.mjs";
|
|
13
13
|
import { timelineScope } from "./activities-Cj_SIOay.mjs";
|
|
14
|
-
import { updateRecord } from "./records-
|
|
14
|
+
import { updateRecord } from "./records-CCTxxMWF.mjs";
|
|
15
15
|
import { fileOf, requireFile, filesOf, recordOf, activitiesOf, settingsDoc, asDoc, requireRecord, objectOf, requireObject, recordsOf } from "./store-5gqRSKXg.mjs";
|
|
16
16
|
import "./index-BM8qeGOb.mjs";
|
|
17
17
|
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
@@ -26,7 +26,7 @@ import "node:crypto";
|
|
|
26
26
|
import "node:os";
|
|
27
27
|
import "node:child_process";
|
|
28
28
|
import "node:http";
|
|
29
|
-
import "./standardObjects-
|
|
29
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
30
30
|
const ORPHAN_GRACE_MS = 864e5;
|
|
31
31
|
function maxUploadBytes(ctx) {
|
|
32
32
|
const mb = settingsDoc(ctx.store)?.maxUploadMb;
|
|
@@ -8,7 +8,7 @@ import { normalizeEmail, isEmptyFieldValue, normalizeDomain, formatFieldValue, r
|
|
|
8
8
|
import { n as newId } from "./ids-CvnmrMJX.mjs";
|
|
9
9
|
import { addActivity } from "./activities-Cj_SIOay.mjs";
|
|
10
10
|
import { assertCan, OpsError } from "./context-CxFfqS4D.mjs";
|
|
11
|
-
import { createRecord, updateRecord, queryContext } from "./records-
|
|
11
|
+
import { createRecord, updateRecord, queryContext } from "./records-CCTxxMWF.mjs";
|
|
12
12
|
import { formsOf, requireObject, asDoc, objectOf, thaw, userOf, recordsOf, activitiesOf } from "./store-5gqRSKXg.mjs";
|
|
13
13
|
import "./query-C5nJB_3C.mjs";
|
|
14
14
|
import "../agentcrm.mjs";
|
|
@@ -22,7 +22,7 @@ import "node:child_process";
|
|
|
22
22
|
import "node:http";
|
|
23
23
|
import "./relations-B9TynBmA.mjs";
|
|
24
24
|
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
25
|
-
import "./standardObjects-
|
|
25
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
26
26
|
const INBOX_KINDS = ["s3", "firebase", "webhook"];
|
|
27
27
|
const DEFAULT_INBOX_PREFIX = "inbox/";
|
|
28
28
|
const DEFAULT_FIREBASE_INBOX = "inbox";
|
|
@@ -9,13 +9,13 @@ import { findOption, normalizeEmail, coerceFieldValue, recordLabel, normalizeDom
|
|
|
9
9
|
import { n as newId } from "./ids-CvnmrMJX.mjs";
|
|
10
10
|
import { c as camelId } from "./utils-DmI8FtXP.mjs";
|
|
11
11
|
import { assertCan, OpsError, actorId, emit } from "./context-CxFfqS4D.mjs";
|
|
12
|
-
import { prepareRecordFields, recordPatchMutation } from "./records-
|
|
12
|
+
import { prepareRecordFields, recordPatchMutation } from "./records-CCTxxMWF.mjs";
|
|
13
13
|
import { requireObject, thaw, recordsOf, usersOf, asDoc, objectOf } from "./store-5gqRSKXg.mjs";
|
|
14
14
|
import "./_commonjsHelpers-ClciMIcB.mjs";
|
|
15
15
|
import "stream";
|
|
16
16
|
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
17
17
|
import "./query-C5nJB_3C.mjs";
|
|
18
|
-
import "./standardObjects-
|
|
18
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
19
19
|
import "./relations-B9TynBmA.mjs";
|
|
20
20
|
function parseCsv(text, opts = {}) {
|
|
21
21
|
const res = Papa.parse(text.replace(/^/, ""), {
|
|
@@ -162,7 +162,7 @@ async function runInstall(plan, onStep) {
|
|
|
162
162
|
await store.ready();
|
|
163
163
|
const { createOpsContext } = await import("./context-CxFfqS4D.mjs");
|
|
164
164
|
const { createPluginRegistry } = await import("./pluginRegistry-DyHtlkcr.mjs");
|
|
165
|
-
const { seedCrm } = await import("./seed-
|
|
165
|
+
const { seedCrm } = await import("./seed-Bb26Zsni.mjs");
|
|
166
166
|
const { setConfigDoc } = await import("./settings-Di8nzNEL.mjs");
|
|
167
167
|
const system = createOpsContext(store, null, { plugins: createPluginRegistry() });
|
|
168
168
|
onStep(`Seeding the CRM${plan.demo ? " (with demo data)" : ""}`);
|
|
@@ -6,7 +6,7 @@ const __filename = __acrmPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
7
|
import { j as RUNTIME_DIR, h as RUNTIME_MODULES, i as isCompatibleApiVersion, k as RUNTIME_GLOBAL } from "./api-Cz0Ubj-B.mjs";
|
|
8
8
|
import { rewriteRuntimeImports, fingerprint, bundleImports } from "./package-B7mI6HGi.mjs";
|
|
9
|
-
import { listLoadedExtensions, deactivateExtension, getLoadedExtension, setExtensionStatus, activateExtension } from "./registry-
|
|
9
|
+
import { listLoadedExtensions, deactivateExtension, getLoadedExtension, setExtensionStatus, activateExtension } from "./registry-ClzNZv9Z.mjs";
|
|
10
10
|
import "./index-w03ReRs4.mjs";
|
|
11
11
|
import "./_commonjsHelpers-ClciMIcB.mjs";
|
|
12
12
|
import "stream";
|
|
@@ -22,7 +22,7 @@ import "./pluginRegistry-DyHtlkcr.mjs";
|
|
|
22
22
|
import "./settings-Di8nzNEL.mjs";
|
|
23
23
|
import "./store-5gqRSKXg.mjs";
|
|
24
24
|
import "./runtimeConfig-CCOFg1RM.mjs";
|
|
25
|
-
import "./tools-
|
|
25
|
+
import "./tools-CCk24tdh.mjs";
|
|
26
26
|
import "./fields-B0bitgmr.mjs";
|
|
27
27
|
import "./query-C5nJB_3C.mjs";
|
|
28
28
|
import "../agentcrm.mjs";
|
|
@@ -38,23 +38,23 @@ import "./activities-Cj_SIOay.mjs";
|
|
|
38
38
|
import "./ids-CvnmrMJX.mjs";
|
|
39
39
|
import "./relations-B9TynBmA.mjs";
|
|
40
40
|
import "./dedupe-BepmsaHv.mjs";
|
|
41
|
-
import "./importCsv-
|
|
41
|
+
import "./importCsv-XjQJ9QIR.mjs";
|
|
42
42
|
import "./papaparse-Df7i1dHr.mjs";
|
|
43
43
|
import "./utils-DmI8FtXP.mjs";
|
|
44
|
-
import "./records-
|
|
45
|
-
import "./standardObjects-
|
|
46
|
-
import "./pipelines-
|
|
47
|
-
import "./reports-
|
|
48
|
-
import "./schema-
|
|
49
|
-
import "./automations-
|
|
44
|
+
import "./records-CCTxxMWF.mjs";
|
|
45
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
46
|
+
import "./pipelines-DiJ2dLqQ.mjs";
|
|
47
|
+
import "./reports-WlI_A5Nr.mjs";
|
|
48
|
+
import "./schema-DOnnH2zL.mjs";
|
|
49
|
+
import "./automations-BqY8EwfJ.mjs";
|
|
50
50
|
import "./extensionActions-D2HtpQz4.mjs";
|
|
51
|
-
import "./forms-
|
|
51
|
+
import "./forms-DJDop3XY.mjs";
|
|
52
52
|
import "./schema-DnLj8dUO.mjs";
|
|
53
53
|
import "./appearance-BloHbiLA.mjs";
|
|
54
54
|
import "./themes-DPZFv3yc.mjs";
|
|
55
55
|
import "./extensions-Bp72uZ9a.mjs";
|
|
56
56
|
import "./files-CjsPJSR6.mjs";
|
|
57
|
-
import "./files-
|
|
57
|
+
import "./files-C4YONVqQ.mjs";
|
|
58
58
|
import "./index-RCmo-uld.mjs";
|
|
59
59
|
import "./http-Bk9ICb7I.mjs";
|
|
60
60
|
async function prepareRuntime(specifiers) {
|
|
@@ -4,7 +4,7 @@ import { dirname as __acrmDirname } from "node:path";
|
|
|
4
4
|
const require2 = __acrmRequire(import.meta.url);
|
|
5
5
|
const __filename = __acrmPath(import.meta.url);
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
|
-
import { a as standardObjects, S as STANDARD_IMAGE_FIELDS } from "./standardObjects-
|
|
7
|
+
import { a as standardObjects, S as STANDARD_IMAGE_FIELDS } from "./standardObjects-vrmqIVLH.mjs";
|
|
8
8
|
import { assertCan } from "./context-CxFfqS4D.mjs";
|
|
9
9
|
import { settingsDoc, objectOf } from "./store-5gqRSKXg.mjs";
|
|
10
10
|
const FR = {
|
|
@@ -6,10 +6,10 @@ const __filename = __acrmPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
7
|
import { dateValueToMs, colorAt } from "./fields-B0bitgmr.mjs";
|
|
8
8
|
import { s as slugId } from "./ids-CvnmrMJX.mjs";
|
|
9
|
-
import { s as stageOptions, p as pipelineOptions } from "./standardObjects-
|
|
9
|
+
import { s as stageOptions, p as pipelineOptions } from "./standardObjects-vrmqIVLH.mjs";
|
|
10
10
|
import { assertCan, OpsError } from "./context-CxFfqS4D.mjs";
|
|
11
|
-
import { updateRecord } from "./records-
|
|
12
|
-
import {
|
|
11
|
+
import { updateRecord } from "./records-CCTxxMWF.mjs";
|
|
12
|
+
import { pipelinesOf, requireObject, asDoc, requirePipeline, thaw, recordsOf, requireRecord } from "./store-5gqRSKXg.mjs";
|
|
13
13
|
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
14
14
|
import "./query-C5nJB_3C.mjs";
|
|
15
15
|
import "./relations-B9TynBmA.mjs";
|
|
@@ -7,7 +7,7 @@ const __dirname = __acrmDirname(__filename);
|
|
|
7
7
|
import { normalizeDomain, recordLabel, validateRecordFields, defaultFieldValues, isEmptyFieldValue, FieldValidationError, normalizeEmail } from "./fields-B0bitgmr.mjs";
|
|
8
8
|
import { n as newId } from "./ids-CvnmrMJX.mjs";
|
|
9
9
|
import { r as resolveField, b as applyFilters, a as applySorts, p as paginate } from "./query-C5nJB_3C.mjs";
|
|
10
|
-
import { n as normalizeStandardFields } from "./standardObjects-
|
|
10
|
+
import { n as normalizeStandardFields } from "./standardObjects-vrmqIVLH.mjs";
|
|
11
11
|
import { assertCan, OpsError, actorId, emit } from "./context-CxFfqS4D.mjs";
|
|
12
12
|
import { i as inverseRelations, j as expandRelations, l as labelOf, v as validateRelationValue, c as rewriteReferences, b as fileCleanupMutations } from "./relations-B9TynBmA.mjs";
|
|
13
13
|
import { activitiesOf, recordsOf, objectsOf, requireObject, requireRecord, recordOf, asDoc, userOf, pipelinesOf } from "./store-5gqRSKXg.mjs";
|
|
@@ -6,7 +6,7 @@ const __filename = __acrmPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
7
|
import { i as isCompatibleApiVersion } from "./api-Cz0Ubj-B.mjs";
|
|
8
8
|
import { registerExternalFeature } from "./featureRegistry-DSsZbhrh.mjs";
|
|
9
|
-
import { registerAiTool } from "./tools-
|
|
9
|
+
import { registerAiTool } from "./tools-CCk24tdh.mjs";
|
|
10
10
|
import { registerAutomationAction } from "./extensionActions-D2HtpQz4.mjs";
|
|
11
11
|
import { plugins } from "./pluginRegistry-DyHtlkcr.mjs";
|
|
12
12
|
import { registerExternalTheme } from "./themes-DPZFv3yc.mjs";
|
|
@@ -33,17 +33,17 @@ import "./activities-Cj_SIOay.mjs";
|
|
|
33
33
|
import "./ids-CvnmrMJX.mjs";
|
|
34
34
|
import "./relations-B9TynBmA.mjs";
|
|
35
35
|
import "./dedupe-BepmsaHv.mjs";
|
|
36
|
-
import "./importCsv-
|
|
36
|
+
import "./importCsv-XjQJ9QIR.mjs";
|
|
37
37
|
import "./papaparse-Df7i1dHr.mjs";
|
|
38
38
|
import "stream";
|
|
39
39
|
import "./utils-DmI8FtXP.mjs";
|
|
40
|
-
import "./records-
|
|
41
|
-
import "./standardObjects-
|
|
42
|
-
import "./pipelines-
|
|
43
|
-
import "./reports-
|
|
44
|
-
import "./schema-
|
|
45
|
-
import "./automations-
|
|
46
|
-
import "./forms-
|
|
40
|
+
import "./records-CCTxxMWF.mjs";
|
|
41
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
42
|
+
import "./pipelines-DiJ2dLqQ.mjs";
|
|
43
|
+
import "./reports-WlI_A5Nr.mjs";
|
|
44
|
+
import "./schema-DOnnH2zL.mjs";
|
|
45
|
+
import "./automations-BqY8EwfJ.mjs";
|
|
46
|
+
import "./forms-DJDop3XY.mjs";
|
|
47
47
|
import "./schema-DnLj8dUO.mjs";
|
|
48
48
|
import "./appearance-BloHbiLA.mjs";
|
|
49
49
|
import "./extensions-Bp72uZ9a.mjs";
|
|
@@ -53,7 +53,7 @@ import "events";
|
|
|
53
53
|
import "buffer";
|
|
54
54
|
import "util";
|
|
55
55
|
import "./files-CjsPJSR6.mjs";
|
|
56
|
-
import "./files-
|
|
56
|
+
import "./files-C4YONVqQ.mjs";
|
|
57
57
|
import "./index-RCmo-uld.mjs";
|
|
58
58
|
import "./http-Bk9ICb7I.mjs";
|
|
59
59
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -5,11 +5,11 @@ const require2 = __acrmRequire(import.meta.url);
|
|
|
5
5
|
const __filename = __acrmPath(import.meta.url);
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
7
|
import { recordLabel, dateValueToMs } from "./fields-B0bitgmr.mjs";
|
|
8
|
-
import { L as LIFECYCLE_OPTIONS } from "./standardObjects-
|
|
8
|
+
import { L as LIFECYCLE_OPTIONS } from "./standardObjects-vrmqIVLH.mjs";
|
|
9
9
|
import { A as ACTIVITY_TYPES } from "../agentcrm.mjs";
|
|
10
10
|
import { lastActivityAt } from "./activities-Cj_SIOay.mjs";
|
|
11
11
|
import { OpsError, assertCan } from "./context-CxFfqS4D.mjs";
|
|
12
|
-
import { forecast, pipelineOfRecord } from "./pipelines-
|
|
12
|
+
import { forecast, pipelineOfRecord } from "./pipelines-DiJ2dLqQ.mjs";
|
|
13
13
|
import { getSettings } from "./settings-Di8nzNEL.mjs";
|
|
14
14
|
import { objectOf, recordsOf, pipelinesOf, usersOf, activitiesOf, requirePipeline } from "./store-5gqRSKXg.mjs";
|
|
15
15
|
import "node:util";
|
|
@@ -24,7 +24,7 @@ import "./ids-CvnmrMJX.mjs";
|
|
|
24
24
|
import "./query-C5nJB_3C.mjs";
|
|
25
25
|
import "./relations-B9TynBmA.mjs";
|
|
26
26
|
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
27
|
-
import "./records-
|
|
27
|
+
import "./records-CCTxxMWF.mjs";
|
|
28
28
|
import "./runtimeConfig-CCOFg1RM.mjs";
|
|
29
29
|
const DAY = 864e5;
|
|
30
30
|
function defaultPipelineId(ctx, pipelineId) {
|
|
@@ -8,32 +8,32 @@ import { a as requireReact, r as reactExports, R as React } from "./index-Bnmav-
|
|
|
8
8
|
import { j as jsxRuntimeExports, R as ReactJsxRuntime } from "./jsx-runtime-Ca2uwGDr.mjs";
|
|
9
9
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-ClciMIcB.mjs";
|
|
10
10
|
import { OpsError, PERMISSIONS, actorId, assertCan, can, createOpsContext, emit } from "./context-CxFfqS4D.mjs";
|
|
11
|
-
import { bulkDelete, bulkUpdate, createRecord, deleteRecord, getRecord, getRecordDetails, hardDeleteMutations, listRecords, prepareRecordFields, queryContext, recordPatchMutation, restoreRecord, searchRecords, setRecordOwner, updateRecord } from "./records-
|
|
11
|
+
import { bulkDelete, bulkUpdate, createRecord, deleteRecord, getRecord, getRecordDetails, hardDeleteMutations, listRecords, prepareRecordFields, queryContext, recordPatchMutation, restoreRecord, searchRecords, setRecordOwner, updateRecord } from "./records-CCTxxMWF.mjs";
|
|
12
12
|
import { j as expandRelations, b as fileCleanupMutations, e as fileFieldIds, g as fileIdsIn, d as fileMergeMutations, f as fileTargetPatch, i as inverseRelations, l as labelOf, k as linkRecords, h as referencedFileIds, m as relatedRecords, r as relationFields, a as relationIds, c as rewriteReferences, s as sameTarget, t as toRef, u as unlinkRecords, v as validateRelationValue } from "./relations-B9TynBmA.mjs";
|
|
13
13
|
import { addActivity, addNote, completeTask, createTask, deleteActivity, getActivity, lastActivityAt, listActivities, listTasks, timelineScope, updateActivity } from "./activities-Cj_SIOay.mjs";
|
|
14
|
-
import { createPipeline, deletePipeline, forecast, getPipeline, listPipelines, moveStage, pipelineOfRecord, syncPipelineOptions, updatePipeline } from "./pipelines-
|
|
15
|
-
import { addOption, changeFieldType, createField, createObject, deleteField, deleteObject, describeSchema, getObject, listObjects, removeOption, reorderFields, updateField, updateObject, updateOption } from "./schema-
|
|
16
|
-
import { createView, deleteView, duplicateView, getView, listViews, runView, updateView } from "./views-
|
|
14
|
+
import { createPipeline, deletePipeline, forecast, getPipeline, listPipelines, moveStage, pipelineOfRecord, syncPipelineOptions, updatePipeline } from "./pipelines-DiJ2dLqQ.mjs";
|
|
15
|
+
import { addOption, changeFieldType, createField, createObject, deleteField, deleteObject, describeSchema, getObject, listObjects, removeOption, reorderFields, updateField, updateObject, updateOption } from "./schema-DOnnH2zL.mjs";
|
|
16
|
+
import { createView, deleteView, duplicateView, getView, listViews, runView, updateView } from "./views-BbhmQO3n.mjs";
|
|
17
17
|
import { createUser, deleteUser, findUserByEmail, getUser, listUsers, setUserRole, updateUser } from "./users-DI1BvS0f.mjs";
|
|
18
18
|
import { DEFAULT_SETTINGS, SETTINGS_KEYS, assertNoSecrets, getConfigDoc, getSettings, setConfigDoc, updateSettings } from "./settings-Di8nzNEL.mjs";
|
|
19
|
-
import { MAPPING_ID, MAPPING_OWNER, MAPPING_SKIP, importCsv, parseCsv, suggestMapping } from "./importCsv-
|
|
20
|
-
import { exportCsv, exportJson, importJson, planImportJson } from "./exportCsv-
|
|
19
|
+
import { MAPPING_ID, MAPPING_OWNER, MAPPING_SKIP, importCsv, parseCsv, suggestMapping } from "./importCsv-XjQJ9QIR.mjs";
|
|
20
|
+
import { exportCsv, exportJson, importJson, planImportJson } from "./exportCsv-C-fIHLm1.mjs";
|
|
21
21
|
import { findDuplicates, mergeRecords } from "./dedupe-BepmsaHv.mjs";
|
|
22
|
-
import { REPORTS, activityByUser, conversion, leadSources, pipelineByStage, runReport, staleDeals, wonLost } from "./reports-
|
|
23
|
-
import { getStats } from "./stats-
|
|
24
|
-
import { DEFAULT_ADMIN_ID, seedCrm, seedDemoData } from "./seed-
|
|
25
|
-
import { compactData } from "./compact-
|
|
26
|
-
import { ACTION_TYPES, AUTOMATION_TEMPLATES, EVENT_TRIGGERS, MAX_AUTOMATION_DEPTH, MAX_AUTOMATION_RUNS, SCHEDULED_TRIGGERS, TRIGGER_TYPES, automationAssignees, clearAutomationRuns, createAutomation, createAutomationFromTemplate, deleteAutomation, duplicateAutomation, findAutomationTemplate, getAutomation, installAutomations, lastTouchedAt, listAutomationRuns, listAutomations, pruneAutomationRuns, renderTemplate, runAutomationEvent, runScheduled, scheduledCandidates, setAutomationEnabled, setAutomationFetch, templatePlaceholders, testAutomation, triggerMatches, updateAutomation, validateAutomation } from "./automations-
|
|
27
|
-
import { DEFAULT_FIREBASE_INBOX, DEFAULT_FORM_TEXTS, DEFAULT_INBOX_PREFIX, FORM_FIELD_TYPES, FREE_MAIL_DOMAINS, HONEYPOT_NAME, INBOX_KINDS, MIN_FILL_MS, buildFormArtifacts, buildFormHtml, companyDomainOfEmail, connectorInboxSource, createForm, defaultFormPath, deleteForm, escapeHtml, firestoreInboxSource, getForm, ingestInbox, ingestSubmissions, isFormFieldType, listForms, listInbox, memoryInboxSource, parseSubmission, publishForm, resolveInboxSource, setInboxSourceResolver, suggestFormFields, updateForm, validateForm } from "./forms-
|
|
22
|
+
import { REPORTS, activityByUser, conversion, leadSources, pipelineByStage, runReport, staleDeals, wonLost } from "./reports-WlI_A5Nr.mjs";
|
|
23
|
+
import { getStats } from "./stats-DfmDP3tE.mjs";
|
|
24
|
+
import { DEFAULT_ADMIN_ID, seedCrm, seedDemoData } from "./seed-Bb26Zsni.mjs";
|
|
25
|
+
import { compactData } from "./compact-qF5t42ko.mjs";
|
|
26
|
+
import { ACTION_TYPES, AUTOMATION_TEMPLATES, EVENT_TRIGGERS, MAX_AUTOMATION_DEPTH, MAX_AUTOMATION_RUNS, SCHEDULED_TRIGGERS, TRIGGER_TYPES, automationAssignees, clearAutomationRuns, createAutomation, createAutomationFromTemplate, deleteAutomation, duplicateAutomation, findAutomationTemplate, getAutomation, installAutomations, lastTouchedAt, listAutomationRuns, listAutomations, pruneAutomationRuns, renderTemplate, runAutomationEvent, runScheduled, scheduledCandidates, setAutomationEnabled, setAutomationFetch, templatePlaceholders, testAutomation, triggerMatches, updateAutomation, validateAutomation } from "./automations-BqY8EwfJ.mjs";
|
|
27
|
+
import { DEFAULT_FIREBASE_INBOX, DEFAULT_FORM_TEXTS, DEFAULT_INBOX_PREFIX, FORM_FIELD_TYPES, FREE_MAIL_DOMAINS, HONEYPOT_NAME, INBOX_KINDS, MIN_FILL_MS, buildFormArtifacts, buildFormHtml, companyDomainOfEmail, connectorInboxSource, createForm, defaultFormPath, deleteForm, escapeHtml, firestoreInboxSource, getForm, ingestInbox, ingestSubmissions, isFormFieldType, listForms, listInbox, memoryInboxSource, parseSubmission, publishForm, resolveInboxSource, setInboxSourceResolver, suggestFormFields, updateForm, validateForm } from "./forms-DJDop3XY.mjs";
|
|
28
28
|
import { disabledObjectIds, getModule, getModuleConfig, isModuleEnabled, listModules, moduleStates, setModuleConfig, setModuleEnabled } from "./modules-clWdE-K2.mjs";
|
|
29
29
|
import { getExtension, getExtensionPackage, installExtension, listExtensions, setExtensionEnabled, summarizeExtension, uninstallExtension } from "./extensions-Bp72uZ9a.mjs";
|
|
30
30
|
import { applyPreset, getAppearance, getAppearanceDoc, listPresets, resetAppearance, setAppearance, setLogo } from "./appearance-BloHbiLA.mjs";
|
|
31
|
-
import { ORPHAN_GRACE_MS, attachFile, clearRecordImage, deleteFile, detachFile, fileUsage, getFile, getFileBytes, listFiles, maxUploadBytes, purgeFiles, recordImageId, renameFile, restoreFile, setRecordImage, uploadFile } from "./files-
|
|
32
|
-
import { S as SCHEMA_MIGRATIONS, m as migrateSchema, s as schemaMigrationMutations } from "./migrate-
|
|
33
|
-
import { BACKUP_DATA_FILE, BACKUP_FILES_DIR, exportBackupZip, importBackupZip, planBackupZip, readBackupZipInfo } from "./backup-
|
|
31
|
+
import { ORPHAN_GRACE_MS, attachFile, clearRecordImage, deleteFile, detachFile, fileUsage, getFile, getFileBytes, listFiles, maxUploadBytes, purgeFiles, recordImageId, renameFile, restoreFile, setRecordImage, uploadFile } from "./files-C4YONVqQ.mjs";
|
|
32
|
+
import { S as SCHEMA_MIGRATIONS, m as migrateSchema, s as schemaMigrationMutations } from "./migrate-Cc_8MHZv.mjs";
|
|
33
|
+
import { BACKUP_DATA_FILE, BACKUP_FILES_DIR, exportBackupZip, importBackupZip, planBackupZip, readBackupZipInfo } from "./backup-CO0EzdF_.mjs";
|
|
34
34
|
import { getAutomationAction, listAutomationActions, registerAutomationAction, subscribeAutomationActions } from "./extensionActions-D2HtpQz4.mjs";
|
|
35
35
|
import { a as intlLocale, b as activeLocale, i as instance, r as registerI18nNamespace } from "./index-BM8qeGOb.mjs";
|
|
36
|
-
import "./standardObjects-
|
|
36
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
37
37
|
import { useModuleStates, useModuleEnabled } from "./featureRegistry-DSsZbhrh.mjs";
|
|
38
38
|
import { a as cn, i as initials, f as formatRelative, b as formatDateTime, d as formatDate } from "./utils-DmI8FtXP.mjs";
|
|
39
39
|
import { t as toast } from "./http-Bk9ICb7I.mjs";
|
|
@@ -41,7 +41,7 @@ import { isEmptyFieldValue, formatFieldValue, formatAddress, dateValueToMs, form
|
|
|
41
41
|
import { fileKind, isPreviewable, formatBytes } from "./files-CjsPJSR6.mjs";
|
|
42
42
|
import { plugins } from "./pluginRegistry-DyHtlkcr.mjs";
|
|
43
43
|
import { n as newId } from "./ids-CvnmrMJX.mjs";
|
|
44
|
-
import { registerAiTool } from "./tools-
|
|
44
|
+
import { registerAiTool } from "./tools-CCk24tdh.mjs";
|
|
45
45
|
import { a as DEFAULT_APPEARANCE } from "./schema-DnLj8dUO.mjs";
|
|
46
46
|
import { b as EXTENSION_MIN_API_VERSION, E as EXTENSION_API_VERSION, k as RUNTIME_GLOBAL } from "./api-Cz0Ubj-B.mjs";
|
|
47
47
|
import "./query-C5nJB_3C.mjs";
|
|
@@ -7,11 +7,11 @@ const __dirname = __acrmDirname(__filename);
|
|
|
7
7
|
import { c as camelId } from "./utils-DmI8FtXP.mjs";
|
|
8
8
|
import { colorAt, canConvertType, isEmptyFieldValue, convertValue } from "./fields-B0bitgmr.mjs";
|
|
9
9
|
import { s as slugId } from "./ids-CvnmrMJX.mjs";
|
|
10
|
-
import { d as defaultViewFor } from "./standardObjects-
|
|
10
|
+
import { d as defaultViewFor } from "./standardObjects-vrmqIVLH.mjs";
|
|
11
11
|
import { a as FIELD_TYPES } from "../agentcrm.mjs";
|
|
12
12
|
import { assertCan, OpsError } from "./context-CxFfqS4D.mjs";
|
|
13
|
-
import { hardDeleteMutations } from "./records-
|
|
14
|
-
import {
|
|
13
|
+
import { hardDeleteMutations } from "./records-CCTxxMWF.mjs";
|
|
14
|
+
import { objectsOf, asDoc, requireObject, thaw, viewsOf, recordsOf, pipelinesOf } from "./store-5gqRSKXg.mjs";
|
|
15
15
|
import "node:util";
|
|
16
16
|
import "node:fs";
|
|
17
17
|
import "node:path";
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { createRequire as __acrmRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __acrmPath } from "node:url";
|
|
3
|
+
import { dirname as __acrmDirname } from "node:path";
|
|
4
|
+
const require2 = __acrmRequire(import.meta.url);
|
|
5
|
+
const __filename = __acrmPath(import.meta.url);
|
|
6
|
+
const __dirname = __acrmDirname(__filename);
|
|
7
|
+
import { OpsError, assertCan } from "./context-CxFfqS4D.mjs";
|
|
8
|
+
import { listPipelines, createPipeline, updatePipeline } from "./pipelines-DiJ2dLqQ.mjs";
|
|
9
|
+
import { listObjects, createObject, updateObject, createField, updateField } from "./schema-DOnnH2zL.mjs";
|
|
10
|
+
import { listViews, createView, updateView } from "./views-BbhmQO3n.mjs";
|
|
11
|
+
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
12
|
+
import "./fields-B0bitgmr.mjs";
|
|
13
|
+
import "./ids-CvnmrMJX.mjs";
|
|
14
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
15
|
+
import "./records-CCTxxMWF.mjs";
|
|
16
|
+
import "./query-C5nJB_3C.mjs";
|
|
17
|
+
import "./relations-B9TynBmA.mjs";
|
|
18
|
+
import "./store-5gqRSKXg.mjs";
|
|
19
|
+
import "./utils-DmI8FtXP.mjs";
|
|
20
|
+
import "../agentcrm.mjs";
|
|
21
|
+
import "node:util";
|
|
22
|
+
import "node:fs";
|
|
23
|
+
import "node:path";
|
|
24
|
+
import "node:url";
|
|
25
|
+
import "node:crypto";
|
|
26
|
+
import "node:os";
|
|
27
|
+
import "node:child_process";
|
|
28
|
+
import "node:http";
|
|
29
|
+
const same = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
30
|
+
function parseSchemaSpec(raw) {
|
|
31
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new OpsError("validation", "A schema is a JSON object with objects, pipelines and / or views.");
|
|
32
|
+
const spec = raw;
|
|
33
|
+
for (const o of spec.objects ?? []) {
|
|
34
|
+
if (!o.id || !o.labelSingular || !o.labelPlural) throw new OpsError("validation", `Every object needs id, labelSingular and labelPlural (got ${JSON.stringify(o.id ?? o)}).`);
|
|
35
|
+
for (const f of o.fields ?? []) if (!f.id || !f.label || !f.type) throw new OpsError("validation", `Every field of ${o.id} needs id, label and type.`);
|
|
36
|
+
}
|
|
37
|
+
for (const p of spec.pipelines ?? []) {
|
|
38
|
+
if (!p.id || !p.name || !p.object || !p.stages?.length) throw new OpsError("validation", `Every pipeline needs id, name, object and stages (got ${JSON.stringify(p.id ?? p)}).`);
|
|
39
|
+
for (const s of p.stages) if (!s.id || !s.label) throw new OpsError("validation", `Every stage of pipeline ${p.id} needs id and label.`);
|
|
40
|
+
}
|
|
41
|
+
for (const v of spec.views ?? []) if (!v.object || !v.name) throw new OpsError("validation", "Every view needs object and name.");
|
|
42
|
+
return spec;
|
|
43
|
+
}
|
|
44
|
+
function missingOptions(field, wanted) {
|
|
45
|
+
const have = new Set((field.options ?? []).map((o) => o.label.toLowerCase()));
|
|
46
|
+
return (wanted ?? []).map((o) => typeof o === "string" ? o : o.label ?? "").filter((l) => l && !have.has(l.toLowerCase()));
|
|
47
|
+
}
|
|
48
|
+
function fieldPatch(field, spec) {
|
|
49
|
+
const patch = {};
|
|
50
|
+
const changes = [];
|
|
51
|
+
if (spec.label !== field.label) patch.label = spec.label, changes.push("label");
|
|
52
|
+
if (spec.description !== void 0 && spec.description !== field.description) patch.description = spec.description, changes.push("description");
|
|
53
|
+
for (const k of ["required", "unique", "hidden"]) {
|
|
54
|
+
if (spec[k] !== void 0 && !!spec[k] !== !!field[k]) patch[k] = spec[k], changes.push(k);
|
|
55
|
+
}
|
|
56
|
+
if (spec.currency !== void 0 && spec.currency !== field.currency) patch.currency = spec.currency, changes.push("currency");
|
|
57
|
+
const add = missingOptions(field, spec.options);
|
|
58
|
+
if (add.length) {
|
|
59
|
+
patch.options = [...field.options ?? [], ...add];
|
|
60
|
+
changes.push(`options +${add.join(", +")}`);
|
|
61
|
+
}
|
|
62
|
+
return { patch, changes };
|
|
63
|
+
}
|
|
64
|
+
async function applySchema(ctx, spec) {
|
|
65
|
+
assertCan(ctx, "schema.write");
|
|
66
|
+
const report = { changes: [], conflicts: [], extraFields: [] };
|
|
67
|
+
for (const o of spec.objects ?? []) {
|
|
68
|
+
let current = listObjects(ctx).find((x) => x.id === o.id);
|
|
69
|
+
const fields = o.fields ?? [];
|
|
70
|
+
if (!current) {
|
|
71
|
+
const plain = fields.filter((f) => f.type !== "relation" && f.id !== "name");
|
|
72
|
+
current = await createObject(ctx, { id: o.id, labelSingular: o.labelSingular, labelPlural: o.labelPlural, icon: o.icon, color: o.color, fields: plain });
|
|
73
|
+
report.changes.push({ kind: "object", action: "create", target: o.id, changes: plain.map((f) => f.id) });
|
|
74
|
+
} else {
|
|
75
|
+
const patch = {};
|
|
76
|
+
const changes = [];
|
|
77
|
+
if (o.labelSingular !== current.labelSingular) patch.labelSingular = o.labelSingular, changes.push("labelSingular");
|
|
78
|
+
if (o.labelPlural !== current.labelPlural) patch.labelPlural = o.labelPlural, changes.push("labelPlural");
|
|
79
|
+
if (o.icon && o.icon !== current.icon) patch.icon = o.icon, changes.push("icon");
|
|
80
|
+
if (o.color && o.color !== current.color) patch.color = o.color, changes.push("color");
|
|
81
|
+
if (changes.length) {
|
|
82
|
+
current = await updateObject(ctx, o.id, patch);
|
|
83
|
+
report.changes.push({ kind: "object", action: "update", target: o.id, changes });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
for (const o of spec.objects ?? []) {
|
|
88
|
+
for (const f of o.fields ?? []) {
|
|
89
|
+
const current2 = listObjects(ctx).find((x) => x.id === o.id);
|
|
90
|
+
const field = current2.fields.find((x) => x.id === f.id);
|
|
91
|
+
if (!field) {
|
|
92
|
+
await createField(ctx, o.id, f);
|
|
93
|
+
report.changes.push({ kind: "field", action: "create", target: `${o.id}.${f.id}`, changes: [f.type] });
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (field.type !== f.type) {
|
|
97
|
+
report.conflicts.push(`${o.id}.${f.id}: type is ${field.type} in the CRM, ${f.type} in the schema (not changed)`);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const { patch, changes } = fieldPatch(field, f);
|
|
101
|
+
if (changes.length) {
|
|
102
|
+
await updateField(ctx, o.id, f.id, patch);
|
|
103
|
+
report.changes.push({ kind: "field", action: "update", target: `${o.id}.${f.id}`, changes });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const current = listObjects(ctx).find((x) => x.id === o.id);
|
|
107
|
+
if (o.labelField && o.labelField !== current.labelField) {
|
|
108
|
+
await updateObject(ctx, o.id, { labelField: o.labelField });
|
|
109
|
+
report.changes.push({ kind: "object", action: "update", target: o.id, changes: ["labelField"] });
|
|
110
|
+
}
|
|
111
|
+
const listed = new Set((o.fields ?? []).map((f) => f.id));
|
|
112
|
+
for (const f of current.fields) if (!f.standard && !f.system && !listed.has(f.id)) report.extraFields.push(`${o.id}.${f.id}`);
|
|
113
|
+
}
|
|
114
|
+
for (const p of spec.pipelines ?? []) {
|
|
115
|
+
const current = listPipelines(ctx).find((x) => x.id === p.id);
|
|
116
|
+
const stages = p.stages.map((s) => ({ ...s, kind: s.kind ?? "open" }));
|
|
117
|
+
const taken = new Map(listPipelines(ctx).filter((x) => x.id !== p.id).flatMap((x) => x.stages.map((s) => [s.id, x.id])));
|
|
118
|
+
const clash = stages.filter((s) => taken.has(s.id));
|
|
119
|
+
if (clash.length) {
|
|
120
|
+
report.conflicts.push(`pipeline ${p.id}: stage id(s) ${clash.map((s) => `${s.id} (used by ${taken.get(s.id)})`).join(", ")} — stage ids are unique across pipelines, rename them (not applied)`);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (!current) {
|
|
124
|
+
await createPipeline(ctx, { id: p.id, name: p.name, object: p.object, stageField: p.stageField, stages });
|
|
125
|
+
report.changes.push({ kind: "pipeline", action: "create", target: p.id, changes: stages.map((s) => s.id) });
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const changes = [];
|
|
129
|
+
if (p.name !== current.name) changes.push("name");
|
|
130
|
+
const now = current.stages.map((s) => ({ id: s.id, label: s.label, kind: s.kind, probability: s.probability }));
|
|
131
|
+
const want = stages.map((s, i) => ({ id: s.id, label: s.label, kind: s.kind, probability: s.probability ?? current.stages.find((c) => c.id === s.id)?.probability ?? now[i]?.probability }));
|
|
132
|
+
const kept = current.stages.filter((s) => !stages.some((w) => w.id === s.id));
|
|
133
|
+
if (!same(now.filter((s) => stages.some((w) => w.id === s.id)), want)) changes.push("stages");
|
|
134
|
+
if (changes.length) {
|
|
135
|
+
await updatePipeline(ctx, p.id, { name: p.name, stages: [...stages.map((s, i) => ({ ...s, probability: want[i].probability })), ...kept] });
|
|
136
|
+
report.changes.push({ kind: "pipeline", action: "update", target: p.id, changes });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
for (const v of spec.views ?? []) {
|
|
140
|
+
const current = listViews(ctx, v.object).find((x) => x.name === v.name);
|
|
141
|
+
if (!current) {
|
|
142
|
+
await createView(ctx, { ...v });
|
|
143
|
+
report.changes.push({ kind: "view", action: "create", target: `${v.object}: ${v.name}` });
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const changes = [];
|
|
147
|
+
const patch = {};
|
|
148
|
+
for (const k of ["type", "columns", "filters", "sorts", "groupBy", "pipelineId", "shared"]) {
|
|
149
|
+
if (v[k] !== void 0 && !same(v[k], current[k])) {
|
|
150
|
+
patch[k] = v[k];
|
|
151
|
+
changes.push(k);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (changes.length) {
|
|
155
|
+
await updateView(ctx, current.id, patch);
|
|
156
|
+
report.changes.push({ kind: "view", action: "update", target: `${v.object}: ${v.name}`, changes });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return report;
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
applySchema,
|
|
163
|
+
parseSchemaSpec
|
|
164
|
+
};
|
|
@@ -6,8 +6,8 @@ const __filename = __acrmPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
7
|
import { normalizeEmail } from "./fields-B0bitgmr.mjs";
|
|
8
8
|
import { a as seededId } from "./ids-CvnmrMJX.mjs";
|
|
9
|
-
import { l as localizeObjects, S as SCHEMA_MIGRATIONS, a as localizePipeline, b as localizeView } from "./migrate-
|
|
10
|
-
import { a as standardObjects, b as defaultPipeline, c as defaultViews } from "./standardObjects-
|
|
9
|
+
import { l as localizeObjects, S as SCHEMA_MIGRATIONS, a as localizePipeline, b as localizeView } from "./migrate-Cc_8MHZv.mjs";
|
|
10
|
+
import { a as standardObjects, b as defaultPipeline, c as defaultViews } from "./standardObjects-vrmqIVLH.mjs";
|
|
11
11
|
import { assertCan } from "./context-CxFfqS4D.mjs";
|
|
12
12
|
import { sha256Hex } from "./files-CjsPJSR6.mjs";
|
|
13
13
|
import { asDoc, objectOf, usersOf, settingsDoc } from "./store-5gqRSKXg.mjs";
|
|
@@ -97,7 +97,7 @@ function createMcpServer(opts) {
|
|
|
97
97
|
try {
|
|
98
98
|
const run = async () => {
|
|
99
99
|
const ctx = await opts.backend.context();
|
|
100
|
-
const { callTool: call } = await import("./tools-
|
|
100
|
+
const { callTool: call } = await import("./tools-CCk24tdh.mjs");
|
|
101
101
|
return call(ctx, name, args);
|
|
102
102
|
};
|
|
103
103
|
const result = tool.mutating ? await opts.backend.withWrite(run) : await run();
|
|
@@ -112,9 +112,9 @@ function createMcpServer(opts) {
|
|
|
112
112
|
async function readResource(id, uri) {
|
|
113
113
|
const ctx = await opts.backend.context();
|
|
114
114
|
let value;
|
|
115
|
-
if (uri === "agentcrm://schema") value = (await import("./schema-
|
|
115
|
+
if (uri === "agentcrm://schema") value = (await import("./schema-DOnnH2zL.mjs")).describeSchema(ctx);
|
|
116
116
|
else if (uri === "agentcrm://pipelines") {
|
|
117
|
-
const { listPipelines, forecast } = await import("./pipelines-
|
|
117
|
+
const { listPipelines, forecast } = await import("./pipelines-DiJ2dLqQ.mjs");
|
|
118
118
|
value = listPipelines(ctx).map((p) => ({ ...p, forecast: forecast(ctx, { pipelineId: p.id }) }));
|
|
119
119
|
} else if (uri === "agentcrm://modules") {
|
|
120
120
|
const [{ listModules }, { listExtensions }] = await Promise.all([import("./modules-clWdE-K2.mjs"), import("./extensions-Bp72uZ9a.mjs")]);
|
|
@@ -4,7 +4,7 @@ import { dirname as __acrmDirname } from "node:path";
|
|
|
4
4
|
const require2 = __acrmRequire(import.meta.url);
|
|
5
5
|
const __filename = __acrmPath(import.meta.url);
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
|
-
import {
|
|
7
|
+
import { colorAt, normalizeDomain } from "./fields-B0bitgmr.mjs";
|
|
8
8
|
const DEFAULT_PIPELINE_ID = "sales";
|
|
9
9
|
function options(labels) {
|
|
10
10
|
return labels.map((l, i) => {
|
|
@@ -6,7 +6,7 @@ const __filename = __acrmPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __acrmDirname(__filename);
|
|
7
7
|
import { A as ACTIVITY_TYPES } from "../agentcrm.mjs";
|
|
8
8
|
import { assertCan } from "./context-CxFfqS4D.mjs";
|
|
9
|
-
import { forecast } from "./pipelines-
|
|
9
|
+
import { forecast } from "./pipelines-DiJ2dLqQ.mjs";
|
|
10
10
|
import { activitiesOf, pipelinesOf, usersOf, objectsOf, recordsOf } from "./store-5gqRSKXg.mjs";
|
|
11
11
|
import "node:util";
|
|
12
12
|
import "node:fs";
|
|
@@ -19,8 +19,8 @@ import "node:http";
|
|
|
19
19
|
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
20
20
|
import "./fields-B0bitgmr.mjs";
|
|
21
21
|
import "./ids-CvnmrMJX.mjs";
|
|
22
|
-
import "./standardObjects-
|
|
23
|
-
import "./records-
|
|
22
|
+
import "./standardObjects-vrmqIVLH.mjs";
|
|
23
|
+
import "./records-CCTxxMWF.mjs";
|
|
24
24
|
import "./query-C5nJB_3C.mjs";
|
|
25
25
|
import "./relations-B9TynBmA.mjs";
|
|
26
26
|
function getStats(ctx) {
|