@fleox-agent-crm/agentcrm 0.0.0-stage → 0.3.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/LICENSE +143 -0
- package/README.md +223 -2
- package/changelog.json +57 -0
- package/dist/admin/admin-files.json +26 -0
- package/dist/admin/assets/chartsImpl-CE2akJat.js +91 -0
- package/dist/admin/assets/firebase-BHSUggRo.js +2 -0
- package/dist/admin/assets/gitJson-BulGh2KV.js +3 -0
- package/dist/admin/assets/index-DidVVK7L.js +1181 -0
- package/dist/admin/assets/index-hMXwHSvN.css +1 -0
- package/dist/admin/assets/index.esm-BFc7vwnl.js +400 -0
- package/dist/admin/assets/index.esm-CtEQZRb1.js +1651 -0
- package/dist/admin/assets/index.esm-Dum0J07z.js +16 -0
- package/dist/admin/assets/index.esm2017-EOzKbpUS.js +390 -0
- package/dist/admin/assets/lucide-react.min-DEDlHCPj.js +6 -0
- package/dist/admin/assets/sdk-CnrLnlRo.js +1717 -0
- package/dist/admin/config.js +3 -0
- package/dist/admin/favicon.svg +1 -0
- package/dist/admin/index.html +139 -0
- package/dist/admin/runtime/agentcrm-runtime.js +104 -0
- package/dist/admin/runtime/lucide-react.js +791 -0
- package/dist/admin/runtime/react-dom-client.js +17 -0
- package/dist/admin/runtime/react-dom.js +20 -0
- package/dist/admin/runtime/react-i18next.js +19 -0
- package/dist/admin/runtime/react-jsx-runtime.js +17 -0
- package/dist/admin/runtime/react.js +22 -0
- package/dist/agent/agentcrm.mjs +3932 -0
- package/dist/agent/chunks/_commonjsHelpers-ClciMIcB.mjs +14 -0
- package/dist/agent/chunks/activities-Cj_SIOay.mjs +227 -0
- package/dist/agent/chunks/api-B6OqNVWp.mjs +97 -0
- package/dist/agent/chunks/appearance-BaShelzt.mjs +174 -0
- package/dist/agent/chunks/automations-BWrvLqP6.mjs +698 -0
- package/dist/agent/chunks/backup-ClSmxmFZ.mjs +103 -0
- package/dist/agent/chunks/batch-CVETiJj5.mjs +142 -0
- package/dist/agent/chunks/compact-CsFPaAAq.mjs +69 -0
- package/dist/agent/chunks/context-CxFfqS4D.mjs +65 -0
- package/dist/agent/chunks/core-Dy7vY9H6.mjs +255 -0
- package/dist/agent/chunks/dedupe-BepmsaHv.mjs +123 -0
- package/dist/agent/chunks/encoding-C9MzdP95.mjs +36 -0
- package/dist/agent/chunks/exportCsv-B5hRvkNm.mjs +95 -0
- package/dist/agent/chunks/extCheck--7lmVvl7.mjs +193 -0
- package/dist/agent/chunks/extPackage-BGl5Oqs8.mjs +115 -0
- package/dist/agent/chunks/extScaffold-DqxI7R1e.mjs +320 -0
- package/dist/agent/chunks/extensionActions-D2HtpQz4.mjs +48 -0
- package/dist/agent/chunks/extensions-BP1k60md.mjs +151 -0
- package/dist/agent/chunks/featureRegistry-C9nbVShp.mjs +149 -0
- package/dist/agent/chunks/fields-B0bitgmr.mjs +476 -0
- package/dist/agent/chunks/files-CjsPJSR6.mjs +158 -0
- package/dist/agent/chunks/files-q8Xu5bft.mjs +367 -0
- package/dist/agent/chunks/firebase-DxGVQV9E.mjs +454 -0
- package/dist/agent/chunks/firebaseRules-iori-s7U.mjs +221 -0
- package/dist/agent/chunks/forms-BKU5F9WF.mjs +847 -0
- package/dist/agent/chunks/gitJson-fjr8mcHe.mjs +528 -0
- package/dist/agent/chunks/hosting-Bme7LxPc.mjs +144 -0
- package/dist/agent/chunks/http-Bk9ICb7I.mjs +127 -0
- package/dist/agent/chunks/ids-CvnmrMJX.mjs +59 -0
- package/dist/agent/chunks/ids-u-noYcy5.mjs +14 -0
- package/dist/agent/chunks/importCsv-DmE_sBch.mjs +334 -0
- package/dist/agent/chunks/index-B-4W0-P4.mjs +535 -0
- package/dist/agent/chunks/index-BM8qeGOb.mjs +2489 -0
- package/dist/agent/chunks/index-Bnmav-Oh.mjs +311 -0
- package/dist/agent/chunks/index-CRkw3_iF.mjs +147 -0
- package/dist/agent/chunks/index-CWrrF1wl.mjs +111 -0
- package/dist/agent/chunks/index-DUSdTBkz.mjs +2988 -0
- package/dist/agent/chunks/index-RCmo-uld.mjs +26 -0
- package/dist/agent/chunks/index-w03ReRs4.mjs +9780 -0
- package/dist/agent/chunks/install-CpHoUFtL.mjs +188 -0
- package/dist/agent/chunks/jsx-runtime-Ca2uwGDr.mjs +76 -0
- package/dist/agent/chunks/loader-C9nm3iwx.mjs +184 -0
- package/dist/agent/chunks/lucide-react.min-Bt3gtepY.mjs +64 -0
- package/dist/agent/chunks/memory-WNR3VHUJ.mjs +56 -0
- package/dist/agent/chunks/migrate-CsClnnN8.mjs +182 -0
- package/dist/agent/chunks/modules-CqdVQVJb.mjs +177 -0
- package/dist/agent/chunks/nodeImport-BPCt5uMu.mjs +38 -0
- package/dist/agent/chunks/package-DWbn3t2R.mjs +194 -0
- package/dist/agent/chunks/papaparse-DjBYnQM2.mjs +1285 -0
- package/dist/agent/chunks/pipelines-DCdRBNBV.mjs +234 -0
- package/dist/agent/chunks/plan-C0TBrU92.mjs +254 -0
- package/dist/agent/chunks/pluginRegistry-DyHtlkcr.mjs +83 -0
- package/dist/agent/chunks/query-C5nJB_3C.mjs +192 -0
- package/dist/agent/chunks/records-DoqiT9xR.mjs +2191 -0
- package/dist/agent/chunks/registry-Ceexawxl.mjs +182 -0
- package/dist/agent/chunks/registry-DijAKZ24.mjs +431 -0
- package/dist/agent/chunks/relations-B9TynBmA.mjs +191 -0
- package/dist/agent/chunks/reports-BB59N6ke.mjs +189 -0
- package/dist/agent/chunks/runtime-DHo7ZEEO.mjs +14852 -0
- package/dist/agent/chunks/runtimeConfig-CCOFg1RM.mjs +250 -0
- package/dist/agent/chunks/s3-Dz50-NuA.mjs +903 -0
- package/dist/agent/chunks/schema-7-4-qtSS.mjs +203 -0
- package/dist/agent/chunks/schema-DlHt2PxI.mjs +367 -0
- package/dist/agent/chunks/sdk-whvfg786.mjs +43644 -0
- package/dist/agent/chunks/seed-CugPGYZL.mjs +523 -0
- package/dist/agent/chunks/server-ISwlDRCN.mjs +242 -0
- package/dist/agent/chunks/settings-BtvR_jdm.mjs +76 -0
- package/dist/agent/chunks/standardObjects-CheqfDqa.mjs +243 -0
- package/dist/agent/chunks/stats-CfeJssSS.mjs +51 -0
- package/dist/agent/chunks/store-5gqRSKXg.mjs +122 -0
- package/dist/agent/chunks/themes-DPZFv3yc.mjs +43 -0
- package/dist/agent/chunks/tools-Bew8lxKx.mjs +844 -0
- package/dist/agent/chunks/types-BOy9PUl7.mjs +44 -0
- package/dist/agent/chunks/users-DI1BvS0f.mjs +107 -0
- package/dist/agent/chunks/utils-DmI8FtXP.mjs +83 -0
- package/dist/agent/chunks/views-fO_BM5U_.mjs +109 -0
- package/dist/version.json +7 -0
- package/package.json +97 -4
- package/plugin/.claude-plugin/plugin.json +17 -0
- package/plugin/skills/agentcrm-admin/SKILL.md +191 -0
- package/plugin/skills/agentcrm-admin/references/appearance.md +26 -0
- package/plugin/skills/agentcrm-admin/references/import.md +16 -0
- package/plugin/skills/agentcrm-admin/references/records.md +30 -0
- package/plugin/skills/agentcrm-admin/references/schema.md +59 -0
- package/plugin/skills/agentcrm-extensions/SKILL.md +93 -0
- package/plugin/skills/agentcrm-extensions/references/module-recipes.md +213 -0
- package/plugin/skills/agentcrm-extensions/references/runtime-api.md +41 -0
- package/plugin/skills/agentcrm-extensions/references/testing.md +76 -0
- package/plugin/skills/agentcrm-extensions/references/theme-recipes.md +65 -0
- package/plugin/skills/agentcrm-install/SKILL.md +116 -0
- package/plugin/skills/agentcrm-install/references/firebase.md +18 -0
- package/plugin/skills/agentcrm-install/references/github.md +20 -0
- package/plugin/skills/agentcrm-install/references/mcp.md +17 -0
- package/plugin/skills/agentcrm-install/references/plans.md +45 -0
- package/plugin/skills/agentcrm-install/references/s3.md +24 -0
- package/plugin/skills/agentcrm-manage/SKILL.md +108 -0
- package/plugin/skills/agentcrm-manage/references/cron.md +11 -0
- package/plugin/skills/agentcrm-manage/references/doctor.md +18 -0
- package/plugin/skills/agentcrm-sales/SKILL.md +92 -0
- package/plugin/skills/agentcrm-sales/references/enrichment.md +13 -0
- package/plugin/skills/agentcrm-sales/references/playbooks.md +29 -0
- package/plugin/skills/agentcrm-sales/references/weekly-report.md +27 -0
- package/types/agentcrm-runtime.d.ts +894 -0
|
@@ -0,0 +1,188 @@
|
|
|
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 { generatePassphrase } from "./index-CWrrF1wl.mjs";
|
|
8
|
+
import { r as resolveGitPagesToken, c as createRemoteGitTransport } from "./s3-Dz50-NuA.mjs";
|
|
9
|
+
import { i as instantiateStorageConnector } from "./registry-DijAKZ24.mjs";
|
|
10
|
+
import { S as StorageError, s as subscribeToToasts } from "./http-Bk9ICb7I.mjs";
|
|
11
|
+
import { s as setCredential, h as openStore } from "../agentcrm.mjs";
|
|
12
|
+
import { adminOps, applyOps, buildConnector } from "./hosting-Bme7LxPc.mjs";
|
|
13
|
+
import "./index-BM8qeGOb.mjs";
|
|
14
|
+
import "./runtimeConfig-CCOFg1RM.mjs";
|
|
15
|
+
import "./encoding-C9MzdP95.mjs";
|
|
16
|
+
import "./index-w03ReRs4.mjs";
|
|
17
|
+
import "./_commonjsHelpers-ClciMIcB.mjs";
|
|
18
|
+
import "stream";
|
|
19
|
+
import "events";
|
|
20
|
+
import "buffer";
|
|
21
|
+
import "util";
|
|
22
|
+
import "node:util";
|
|
23
|
+
import "node:fs";
|
|
24
|
+
import "node:path";
|
|
25
|
+
import "node:url";
|
|
26
|
+
import "node:crypto";
|
|
27
|
+
import "node:os";
|
|
28
|
+
import "node:child_process";
|
|
29
|
+
import "node:http";
|
|
30
|
+
const PROBE_PATH = ".agentcrm-probe.txt";
|
|
31
|
+
const REQUIRED = {
|
|
32
|
+
"git-pages": (s) => [...s.provider === "gitlab" ? ["project"] : ["owner", "repo"], "branch", "siteUrl"],
|
|
33
|
+
s3: () => ["bucket", "accessKeyId", "secretAccessKey", "siteUrl"]
|
|
34
|
+
};
|
|
35
|
+
function missingFields(connectorId, settings, ignore = []) {
|
|
36
|
+
const required = (REQUIRED[connectorId]?.(settings) ?? []).filter((k) => !ignore.includes(k));
|
|
37
|
+
return required.filter((k) => typeof settings[k] !== "string" || !settings[k].trim());
|
|
38
|
+
}
|
|
39
|
+
async function testStorageConnection(connectorId, settings, opts = {}) {
|
|
40
|
+
const missing = missingFields(connectorId, settings, opts.ignore);
|
|
41
|
+
if (missing.length) return { ok: false, detail: `missing: ${missing.join(", ")}` };
|
|
42
|
+
try {
|
|
43
|
+
if (connectorId === "git-pages") ;
|
|
44
|
+
const connector = instantiateStorageConnector(connectorId, settings);
|
|
45
|
+
if (connectorId === "browser-mirror") ;
|
|
46
|
+
await connector.put({ path: PROBE_PATH, content: `AgentCRM connection test ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
47
|
+
` });
|
|
48
|
+
const echoed = await connector.get(PROBE_PATH).catch(() => null);
|
|
49
|
+
const listed = connector.listPrefix ? await connector.listPrefix(".agentcrm-").catch(() => null) : [PROBE_PATH];
|
|
50
|
+
await connector.delete(PROBE_PATH);
|
|
51
|
+
if (echoed === null) return { ok: false, detail: "write succeeded but read-back failed" };
|
|
52
|
+
if (!listed || !listed.includes(PROBE_PATH)) return { ok: false, detail: "write succeeded but listing failed (ListBucket permission / CORS)" };
|
|
53
|
+
return { ok: true, detail: await connector.publicUrl("") };
|
|
54
|
+
} catch (err) {
|
|
55
|
+
const status = err instanceof StorageError ? ` (${err.status})` : "";
|
|
56
|
+
return { ok: false, detail: `${err.message}${status}` };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function collectToasts() {
|
|
60
|
+
const notices = [];
|
|
61
|
+
const stop = subscribeToToasts((t) => notices.push({ level: t.level, message: t.message }));
|
|
62
|
+
return { notices, stop };
|
|
63
|
+
}
|
|
64
|
+
function gitTransport(settings) {
|
|
65
|
+
const s = settings;
|
|
66
|
+
return createRemoteGitTransport(
|
|
67
|
+
s.provider === "gitlab" ? { provider: "gitlab", project: s.project ?? "", branch: s.branch ?? "main", token: s.token ?? "", apiBaseUrl: s.apiBaseUrl } : { provider: "github", owner: s.owner ?? "", repo: s.repo ?? "", branch: s.branch ?? "main", token: s.token ?? "", apiBaseUrl: s.apiBaseUrl }
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
async function probeTarget(target, opts) {
|
|
71
|
+
try {
|
|
72
|
+
if (target.connectorId === "git-pages") {
|
|
73
|
+
const transport = gitTransport(target.settings);
|
|
74
|
+
const perms = await transport.permissions();
|
|
75
|
+
if (!perms.canWrite) return { ok: false, detail: `${perms.login}: read-only access to ${transport.label}` };
|
|
76
|
+
if (opts.requirePrivate && perms.visibility === "public") {
|
|
77
|
+
return { ok: false, detail: `${transport.label} is PUBLIC: CRM data (personal data) must live in a private repository. Make it private (Settings → General → Danger Zone) and retry.` };
|
|
78
|
+
}
|
|
79
|
+
return { ok: true, detail: `${perms.login} → ${transport.label}${perms.visibility ? ` (${perms.visibility})` : ""}` };
|
|
80
|
+
}
|
|
81
|
+
if (target.connectorId === "s3") {
|
|
82
|
+
return await testStorageConnection("s3", target.settings, { ignore: opts.requireSiteUrl ? [] : ["siteUrl"] });
|
|
83
|
+
}
|
|
84
|
+
const connector = buildConnector(target);
|
|
85
|
+
const probe = ".agentcrm-probe.txt";
|
|
86
|
+
await connector.put({ path: probe, content: `AgentCRM connection test ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
87
|
+
` });
|
|
88
|
+
const back = await connector.getBytes?.(probe);
|
|
89
|
+
const listed = await connector.listPrefix?.(".agentcrm-");
|
|
90
|
+
await connector.delete(probe);
|
|
91
|
+
if (!back || !listed?.includes(probe)) return { ok: false, detail: "write succeeded but read-back / listing failed" };
|
|
92
|
+
return { ok: true, detail: await connector.publicUrl("") };
|
|
93
|
+
} catch (err) {
|
|
94
|
+
const status = err.status;
|
|
95
|
+
return { ok: false, detail: `${err.message}${status ? ` (${status})` : ""}` };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function checkPlan(plan) {
|
|
99
|
+
let data;
|
|
100
|
+
if (plan.runtime.backend === "journal" && plan.dataTarget) {
|
|
101
|
+
const access = await probeTarget(plan.dataTarget, { requireSiteUrl: false, requirePrivate: true });
|
|
102
|
+
if (!access.ok) data = { ...access, existing: false };
|
|
103
|
+
else {
|
|
104
|
+
try {
|
|
105
|
+
const connector = buildConnector(plan.dataTarget);
|
|
106
|
+
const root = plan.runtime.journal.root;
|
|
107
|
+
const keyinfo = await connector.getBytes(`${root ? `${root}/` : ""}keyinfo.json`);
|
|
108
|
+
if (!keyinfo) {
|
|
109
|
+
data = { ok: true, detail: `${access.detail} — new ${plan.runtime.journal.encrypted ? "encrypted " : ""}dataset in "${root || "/"}"`, existing: false };
|
|
110
|
+
} else {
|
|
111
|
+
const info = JSON.parse(new TextDecoder().decode(keyinfo));
|
|
112
|
+
if (info.encrypted && !plan.passphrase) {
|
|
113
|
+
data = { ok: false, detail: `an encrypted dataset already exists in "${root}": store its passphrase as ${plan.passphraseAccount ?? "passphrase:<alias>"} and set data.encryption.credential`, existing: true };
|
|
114
|
+
} else {
|
|
115
|
+
const store = await openStore(plan.runtime, { dataTarget: plan.dataTarget, passphrase: plan.passphrase });
|
|
116
|
+
try {
|
|
117
|
+
await store.ready();
|
|
118
|
+
const count = store.list("records").length;
|
|
119
|
+
data = { ok: true, detail: `${access.detail} — existing ${info.encrypted ? "encrypted " : ""}dataset (${count} records): it is kept, only what's missing is seeded`, existing: true };
|
|
120
|
+
} finally {
|
|
121
|
+
store.close?.();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} catch (err) {
|
|
126
|
+
const e = err;
|
|
127
|
+
data = { ok: false, detail: e.name === "PassphraseError" ? `wrong passphrase in ${plan.passphraseAccount}` : e.message, existing: false };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
} else if (plan.runtime.backend === "git-json") {
|
|
131
|
+
const access = await probeTarget({ connectorId: "git-pages", settings: { ...plan.runtime.git, ...plan.backendSecrets ?? {} } }, { requireSiteUrl: false, requirePrivate: true });
|
|
132
|
+
data = { ...access, existing: false };
|
|
133
|
+
} else {
|
|
134
|
+
data = { ok: true, detail: `Firebase project ${plan.runtime.firebase.projectId} (checked at install: sign-in + rules)`, existing: false };
|
|
135
|
+
}
|
|
136
|
+
const hosting = plan.hostingTarget ? await probeTarget(plan.hostingTarget, { requireSiteUrl: plan.hostingTarget.connectorId !== "local-folder" }) : null;
|
|
137
|
+
return { data, hosting };
|
|
138
|
+
}
|
|
139
|
+
async function runInstall(plan, onStep) {
|
|
140
|
+
const toasts = collectToasts();
|
|
141
|
+
try {
|
|
142
|
+
let generatedPassphrase = false;
|
|
143
|
+
if (plan.passphraseAccount && !plan.passphrase) {
|
|
144
|
+
plan.passphrase = generatePassphrase();
|
|
145
|
+
setCredential(plan.passphraseAccount, { passphrase: plan.passphrase });
|
|
146
|
+
generatedPassphrase = true;
|
|
147
|
+
onStep(`Generated the dataset passphrase (stored as ${plan.passphraseAccount})`);
|
|
148
|
+
}
|
|
149
|
+
onStep("Opening the dataset");
|
|
150
|
+
const store = await openStore(plan.runtime, { dataTarget: plan.dataTarget, secrets: plan.backendSecrets, passphrase: plan.passphrase });
|
|
151
|
+
let seed;
|
|
152
|
+
try {
|
|
153
|
+
await store.ready();
|
|
154
|
+
const { createOpsContext } = await import("./context-CxFfqS4D.mjs");
|
|
155
|
+
const { createPluginRegistry } = await import("./pluginRegistry-DyHtlkcr.mjs");
|
|
156
|
+
const { seedCrm } = await import("./seed-CugPGYZL.mjs");
|
|
157
|
+
const { setConfigDoc } = await import("./settings-BtvR_jdm.mjs");
|
|
158
|
+
const system = createOpsContext(store, null, { plugins: createPluginRegistry() });
|
|
159
|
+
onStep(`Seeding the CRM${plan.demo ? " (with demo data)" : ""}`);
|
|
160
|
+
const identity = plan.backend === "journal" ? null : await store.identity().catch(() => null);
|
|
161
|
+
const admin = identity?.uid ? { ...plan.owner, id: identity.uid } : plan.owner;
|
|
162
|
+
seed = await seedCrm(system, { name: plan.name, admin, demo: plan.demo, currency: plan.currency, locale: plan.locale });
|
|
163
|
+
if (plan.hosting) {
|
|
164
|
+
await setConfigDoc(system, "hosting", { connectorId: plan.hosting.connectorId, settings: plan.hosting.settings, folder: plan.hosting.folder, type: plan.hosting.type });
|
|
165
|
+
}
|
|
166
|
+
} finally {
|
|
167
|
+
store.close?.();
|
|
168
|
+
}
|
|
169
|
+
let adminVersion = null;
|
|
170
|
+
let files = 0;
|
|
171
|
+
if (plan.hostingTarget && plan.hosting) {
|
|
172
|
+
const { ops, version } = adminOps(plan.hosting.folder, plan.runtime);
|
|
173
|
+
onStep(`Uploading the admin (${ops.length} files) to ${plan.hosting.type}`);
|
|
174
|
+
await applyOps(buildConnector(plan.hostingTarget), ops);
|
|
175
|
+
adminVersion = version;
|
|
176
|
+
files = ops.length;
|
|
177
|
+
}
|
|
178
|
+
return { seed, adminVersion, files, generatedPassphrase, notices: toasts.notices };
|
|
179
|
+
} finally {
|
|
180
|
+
toasts.stop();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
export {
|
|
184
|
+
checkPlan,
|
|
185
|
+
collectToasts,
|
|
186
|
+
probeTarget,
|
|
187
|
+
runInstall
|
|
188
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { g as getDefaultExportFromCjs } from "./_commonjsHelpers-ClciMIcB.mjs";
|
|
8
|
+
import { a as requireReact } from "./index-Bnmav-Oh.mjs";
|
|
9
|
+
function _mergeNamespaces(n, m) {
|
|
10
|
+
for (var i = 0; i < m.length; i++) {
|
|
11
|
+
const e = m[i];
|
|
12
|
+
if (typeof e !== "string" && !Array.isArray(e)) {
|
|
13
|
+
for (const k in e) {
|
|
14
|
+
if (k !== "default" && !(k in n)) {
|
|
15
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
if (d) {
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: () => e[k]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
|
|
27
|
+
}
|
|
28
|
+
var jsxRuntime$1 = { exports: {} };
|
|
29
|
+
var reactJsxRuntime_production_min = {};
|
|
30
|
+
/**
|
|
31
|
+
* @license React
|
|
32
|
+
* react-jsx-runtime.production.min.js
|
|
33
|
+
*
|
|
34
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the MIT license found in the
|
|
37
|
+
* LICENSE file in the root directory of this source tree.
|
|
38
|
+
*/
|
|
39
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
40
|
+
function requireReactJsxRuntime_production_min() {
|
|
41
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
42
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
43
|
+
var f = requireReact(), k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
44
|
+
function q(c, a, g) {
|
|
45
|
+
var b, d = {}, e = null, h = null;
|
|
46
|
+
void 0 !== g && (e = "" + g);
|
|
47
|
+
void 0 !== a.key && (e = "" + a.key);
|
|
48
|
+
void 0 !== a.ref && (h = a.ref);
|
|
49
|
+
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
50
|
+
if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
|
|
51
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
52
|
+
}
|
|
53
|
+
reactJsxRuntime_production_min.Fragment = l;
|
|
54
|
+
reactJsxRuntime_production_min.jsx = q;
|
|
55
|
+
reactJsxRuntime_production_min.jsxs = q;
|
|
56
|
+
return reactJsxRuntime_production_min;
|
|
57
|
+
}
|
|
58
|
+
var hasRequiredJsxRuntime;
|
|
59
|
+
function requireJsxRuntime() {
|
|
60
|
+
if (hasRequiredJsxRuntime) return jsxRuntime$1.exports;
|
|
61
|
+
hasRequiredJsxRuntime = 1;
|
|
62
|
+
{
|
|
63
|
+
jsxRuntime$1.exports = requireReactJsxRuntime_production_min();
|
|
64
|
+
}
|
|
65
|
+
return jsxRuntime$1.exports;
|
|
66
|
+
}
|
|
67
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
68
|
+
const jsxRuntime = /* @__PURE__ */ getDefaultExportFromCjs(jsxRuntimeExports);
|
|
69
|
+
const ReactJsxRuntime = /* @__PURE__ */ _mergeNamespaces({
|
|
70
|
+
__proto__: null,
|
|
71
|
+
default: jsxRuntime
|
|
72
|
+
}, [jsxRuntimeExports]);
|
|
73
|
+
export {
|
|
74
|
+
ReactJsxRuntime as R,
|
|
75
|
+
jsxRuntimeExports as j
|
|
76
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
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 { h as RUNTIME_DIR, g as RUNTIME_MODULES, i as isCompatibleApiVersion, j as RUNTIME_GLOBAL } from "./api-B6OqNVWp.mjs";
|
|
8
|
+
import { rewriteRuntimeImports, fingerprint, bundleImports } from "./package-DWbn3t2R.mjs";
|
|
9
|
+
import { listLoadedExtensions, deactivateExtension, getLoadedExtension, setExtensionStatus, activateExtension } from "./registry-Ceexawxl.mjs";
|
|
10
|
+
import "./index-w03ReRs4.mjs";
|
|
11
|
+
import "./_commonjsHelpers-ClciMIcB.mjs";
|
|
12
|
+
import "stream";
|
|
13
|
+
import "events";
|
|
14
|
+
import "buffer";
|
|
15
|
+
import "util";
|
|
16
|
+
import "./featureRegistry-C9nbVShp.mjs";
|
|
17
|
+
import "./index-Bnmav-Oh.mjs";
|
|
18
|
+
import "./index-BM8qeGOb.mjs";
|
|
19
|
+
import "./modules-CqdVQVJb.mjs";
|
|
20
|
+
import "./context-CxFfqS4D.mjs";
|
|
21
|
+
import "./pluginRegistry-DyHtlkcr.mjs";
|
|
22
|
+
import "./settings-BtvR_jdm.mjs";
|
|
23
|
+
import "./store-5gqRSKXg.mjs";
|
|
24
|
+
import "./runtimeConfig-CCOFg1RM.mjs";
|
|
25
|
+
import "./tools-Bew8lxKx.mjs";
|
|
26
|
+
import "./fields-B0bitgmr.mjs";
|
|
27
|
+
import "./query-C5nJB_3C.mjs";
|
|
28
|
+
import "../agentcrm.mjs";
|
|
29
|
+
import "node:util";
|
|
30
|
+
import "node:fs";
|
|
31
|
+
import "node:path";
|
|
32
|
+
import "node:url";
|
|
33
|
+
import "node:crypto";
|
|
34
|
+
import "node:os";
|
|
35
|
+
import "node:child_process";
|
|
36
|
+
import "node:http";
|
|
37
|
+
import "./activities-Cj_SIOay.mjs";
|
|
38
|
+
import "./ids-CvnmrMJX.mjs";
|
|
39
|
+
import "./relations-B9TynBmA.mjs";
|
|
40
|
+
import "./dedupe-BepmsaHv.mjs";
|
|
41
|
+
import "./importCsv-DmE_sBch.mjs";
|
|
42
|
+
import "./papaparse-DjBYnQM2.mjs";
|
|
43
|
+
import "./utils-DmI8FtXP.mjs";
|
|
44
|
+
import "./records-DoqiT9xR.mjs";
|
|
45
|
+
import "./standardObjects-CheqfDqa.mjs";
|
|
46
|
+
import "./pipelines-DCdRBNBV.mjs";
|
|
47
|
+
import "./reports-BB59N6ke.mjs";
|
|
48
|
+
import "./schema-DlHt2PxI.mjs";
|
|
49
|
+
import "./automations-BWrvLqP6.mjs";
|
|
50
|
+
import "./extensionActions-D2HtpQz4.mjs";
|
|
51
|
+
import "./forms-BKU5F9WF.mjs";
|
|
52
|
+
import "./schema-7-4-qtSS.mjs";
|
|
53
|
+
import "./appearance-BaShelzt.mjs";
|
|
54
|
+
import "./themes-DPZFv3yc.mjs";
|
|
55
|
+
import "./extensions-BP1k60md.mjs";
|
|
56
|
+
import "./files-CjsPJSR6.mjs";
|
|
57
|
+
import "./files-q8Xu5bft.mjs";
|
|
58
|
+
import "./index-RCmo-uld.mjs";
|
|
59
|
+
import "./http-Bk9ICb7I.mjs";
|
|
60
|
+
async function prepareRuntime(specifiers) {
|
|
61
|
+
const g = globalThis;
|
|
62
|
+
await g[RUNTIME_GLOBAL]?.prepare?.(specifiers);
|
|
63
|
+
}
|
|
64
|
+
function createBrowserImportBundle(baseUrl) {
|
|
65
|
+
return async (code) => {
|
|
66
|
+
const base = baseUrl ?? document.baseURI;
|
|
67
|
+
const rewritten = rewriteRuntimeImports(code, (spec) => new URL(`${RUNTIME_DIR}/${RUNTIME_MODULES[spec]}`, base).href);
|
|
68
|
+
const url = URL.createObjectURL(new Blob([rewritten], { type: "text/javascript" }));
|
|
69
|
+
try {
|
|
70
|
+
return await import(
|
|
71
|
+
/* @vite-ignore */
|
|
72
|
+
url
|
|
73
|
+
);
|
|
74
|
+
} finally {
|
|
75
|
+
URL.revokeObjectURL(url);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
let shiftHeldAtBoot = false;
|
|
80
|
+
function trackSafeModeKey(win = window) {
|
|
81
|
+
const on = (e) => {
|
|
82
|
+
if (e.key === "Shift" || e.shiftKey) shiftHeldAtBoot = true;
|
|
83
|
+
};
|
|
84
|
+
win.addEventListener("keydown", on);
|
|
85
|
+
const t = setTimeout(() => win.removeEventListener("keydown", on), 2500);
|
|
86
|
+
return () => {
|
|
87
|
+
clearTimeout(t);
|
|
88
|
+
win.removeEventListener("keydown", on);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function isSafeMode(loc = typeof location !== "undefined" ? location : void 0) {
|
|
92
|
+
if (shiftHeldAtBoot) return true;
|
|
93
|
+
if (!loc) return false;
|
|
94
|
+
const hashQuery = loc.hash.includes("?") ? loc.hash.slice(loc.hash.indexOf("?")) : "";
|
|
95
|
+
return [loc.search, hashQuery].some((q) => {
|
|
96
|
+
const v = new URLSearchParams(q).get("safe");
|
|
97
|
+
return v === "1" || v === "true";
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function resetSafeModeKey() {
|
|
101
|
+
shiftHeldAtBoot = false;
|
|
102
|
+
}
|
|
103
|
+
function wantedDocs(store) {
|
|
104
|
+
return store.list("extensions").filter((d) => d && typeof d.id === "string" && d.manifest);
|
|
105
|
+
}
|
|
106
|
+
async function loadOne(doc, importBundle) {
|
|
107
|
+
const code = doc.files?.["bundle.js"];
|
|
108
|
+
if (typeof code !== "string" || !code) throw new Error("bundle.js is missing (upload incomplete?).");
|
|
109
|
+
await prepareRuntime(bundleImports(code));
|
|
110
|
+
const mod = await importBundle(code, { id: doc.id, version: doc.manifest.version });
|
|
111
|
+
activateExtension(doc, mod, fingerprint(doc.manifest, doc.files));
|
|
112
|
+
}
|
|
113
|
+
let queue = Promise.resolve();
|
|
114
|
+
function syncExtensions(store, opts = {}) {
|
|
115
|
+
const run = async () => {
|
|
116
|
+
const report = { loaded: [], unloaded: [], failed: [], skipped: [] };
|
|
117
|
+
const importBundle = opts.importBundle ?? createBrowserImportBundle();
|
|
118
|
+
const docs = wantedDocs(store);
|
|
119
|
+
const ids = new Set(docs.map((d) => d.id));
|
|
120
|
+
for (const e of listLoadedExtensions()) {
|
|
121
|
+
if (!ids.has(e.id)) {
|
|
122
|
+
if (e.status === "loaded") report.unloaded.push(e.id);
|
|
123
|
+
deactivateExtension(e.id);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (const doc of docs) {
|
|
127
|
+
const current = getLoadedExtension(doc.id);
|
|
128
|
+
if (opts.safeMode) {
|
|
129
|
+
if (current?.status !== "skipped") setExtensionStatus(doc, "skipped");
|
|
130
|
+
report.skipped.push(doc.id);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (!doc.enabled) {
|
|
134
|
+
if (current?.status === "loaded") report.unloaded.push(doc.id);
|
|
135
|
+
if (current?.status !== "disabled") setExtensionStatus(doc, "disabled");
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (!isCompatibleApiVersion(doc.manifest.apiVersion)) {
|
|
139
|
+
if (current?.status !== "incompatible") setExtensionStatus(doc, "incompatible", `apiVersion ${doc.manifest.apiVersion} is not supported.`);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const fp = doc.files?.["bundle.js"] ? fingerprint(doc.manifest, doc.files) : "";
|
|
143
|
+
if (current?.status === "loaded" && current.fingerprint === fp) continue;
|
|
144
|
+
if (current?.status === "error" && current.fingerprint === fp) continue;
|
|
145
|
+
try {
|
|
146
|
+
await loadOne(doc, importBundle);
|
|
147
|
+
report.loaded.push(doc.id);
|
|
148
|
+
} catch (err) {
|
|
149
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
150
|
+
console.error(`[extensions] ${doc.id} failed to load:`, error);
|
|
151
|
+
setExtensionStatus(doc, "error", error.message);
|
|
152
|
+
const st = getLoadedExtension(doc.id);
|
|
153
|
+
if (st) st.fingerprint = fp;
|
|
154
|
+
report.failed.push({ id: doc.id, error: error.message });
|
|
155
|
+
opts.onError?.(doc.id, error);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return report;
|
|
159
|
+
};
|
|
160
|
+
const next = queue.then(run, run);
|
|
161
|
+
queue = next.catch(() => void 0);
|
|
162
|
+
return next;
|
|
163
|
+
}
|
|
164
|
+
function watchExtensions(store, opts = {}) {
|
|
165
|
+
let stopped = false;
|
|
166
|
+
const sync = () => void syncExtensions(store, opts).then((r) => {
|
|
167
|
+
if (!stopped) opts.onSync?.(r);
|
|
168
|
+
});
|
|
169
|
+
const off = store.subscribe((changed) => {
|
|
170
|
+
if (changed.has("extensions")) sync();
|
|
171
|
+
});
|
|
172
|
+
return () => {
|
|
173
|
+
stopped = true;
|
|
174
|
+
off();
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
createBrowserImportBundle,
|
|
179
|
+
isSafeMode,
|
|
180
|
+
resetSafeModeKey,
|
|
181
|
+
syncExtensions,
|
|
182
|
+
trackSafeModeKey,
|
|
183
|
+
watchExtensions
|
|
184
|
+
};
|