clivly 0.15.0 → 0.17.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/{adapter-BMAUq4hf.d.mts → adapter-BpAfha3z.d.mts} +1 -3
- package/{adapter-IH3r_I8v.d.cts → adapter-BvSigBPG.d.cts} +1 -3
- package/{auth-adapter-CiEXcweZ.cjs → auth-adapter-CNVuxT9W.cjs} +1 -2
- package/{auth-adapter-Bt1GZiag.d.cts → auth-adapter-CsZE4ugg.d.cts} +1 -3
- package/{auth-adapter-CHy273qb.d.mts → auth-adapter-Q6CL2VHr.d.mts} +1 -3
- package/{auth-adapter-gfVDxf3d.mjs → auth-adapter-u91PByaw.mjs} +1 -2
- package/auth-better-auth.cjs +2 -4
- package/auth-better-auth.d.cts +1 -5
- package/auth-better-auth.d.mts +1 -5
- package/auth-better-auth.mjs +2 -4
- package/auth-clerk.cjs +2 -4
- package/auth-clerk.d.cts +1 -5
- package/auth-clerk.d.mts +1 -5
- package/auth-clerk.mjs +2 -4
- package/auth-workos.cjs +2 -4
- package/auth-workos.d.cts +1 -5
- package/auth-workos.d.mts +1 -5
- package/auth-workos.mjs +2 -4
- package/core-adapter.cjs +2 -3
- package/core-adapter.d.cts +1 -1
- package/core-adapter.d.mts +1 -1
- package/core-adapter.mjs +2 -3
- package/core-auth-adapter.cjs +3 -4
- package/core-auth-adapter.d.cts +1 -1
- package/core-auth-adapter.d.mts +1 -1
- package/core-auth-adapter.mjs +3 -5
- package/core-drizzle.cjs +3 -4
- package/core-drizzle.d.cts +1 -1
- package/core-drizzle.d.mts +1 -1
- package/core-drizzle.mjs +3 -5
- package/core-entity-config.cjs +3 -4
- package/core-entity-config.d.cts +1 -1
- package/core-entity-config.d.mts +1 -1
- package/core-entity-config.mjs +3 -5
- package/core-entity-heuristics.cjs +2 -3
- package/core-entity-heuristics.d.cts +1 -1
- package/core-entity-heuristics.d.mts +1 -1
- package/core-entity-heuristics.mjs +3 -5
- package/core-mapping-form.cjs +3 -4
- package/core-mapping-form.d.cts +1 -1
- package/core-mapping-form.d.mts +1 -1
- package/core-mapping-form.mjs +3 -5
- package/core-mapping-score.cjs +3 -4
- package/core-mapping-score.d.cts +1 -1
- package/core-mapping-score.d.mts +1 -1
- package/core-mapping-score.mjs +3 -5
- package/core-mappings-config.cjs +3 -4
- package/core-mappings-config.d.cts +1 -1
- package/core-mappings-config.d.mts +1 -1
- package/core-mappings-config.mjs +3 -5
- package/core-sync-engine.cjs +3 -4
- package/core-sync-engine.d.cts +1 -1
- package/core-sync-engine.d.mts +1 -1
- package/core-sync-engine.mjs +3 -5
- package/core-types.cjs +3 -4
- package/core-types.d.cts +1 -1
- package/core-types.d.mts +1 -1
- package/core-types.mjs +3 -5
- package/core-view-compiler.cjs +3 -4
- package/core-view-compiler.d.cts +1 -1
- package/core-view-compiler.d.mts +1 -1
- package/core-view-compiler.mjs +3 -5
- package/core.cjs +13 -13
- package/core.d.cts +11 -11
- package/core.d.mts +11 -11
- package/core.mjs +13 -14
- package/{deprecate-subpath-CmvZtCpE.mjs → deprecate-subpath-CK37DKXH.mjs} +1 -2
- package/{deprecate-subpath-B9ngvizt.cjs → deprecate-subpath-dGwDiHKV.cjs} +1 -2
- package/{drizzle-DcB7OfBp.cjs → drizzle-C0bfX-6a.cjs} +1 -2
- package/{drizzle-wbcuG-cy.mjs → drizzle-CZuOzIu4.mjs} +1 -2
- package/{drizzle-CiK37zJm.d.cts → drizzle-MUNZgh1l.d.cts} +1 -3
- package/{drizzle-ehVWLSrN.d.mts → drizzle-UJbPCzPJ.d.mts} +1 -3
- package/{drizzle-meta-Bb1JWYqf.cjs → drizzle-meta-BPnRLpsB.cjs} +1 -2
- package/{drizzle-meta-D-5k3n0i.mjs → drizzle-meta-D00lFvAk.mjs} +1 -2
- package/drizzle.cjs +7 -10
- package/drizzle.d.cts +3 -7
- package/drizzle.d.mts +3 -7
- package/drizzle.mjs +7 -10
- package/entity-config-BF7pcXFB.d.cts +632 -0
- package/{entity-config-Ccfb2IL9.mjs → entity-config-DQVSprlG.mjs} +8 -11
- package/{entity-config-BI4RYNKL.cjs → entity-config-nWWgJXLw.cjs} +8 -11
- package/entity-config-pzamFSKw.d.mts +632 -0
- package/index.cjs +51 -98
- package/index.d.cts +1 -12
- package/index.d.mts +1 -12
- package/index.mjs +51 -98
- package/{integration-state-BA4c0RbD.d.mts → integration-state-xK4PLm5T.d.cts} +0 -2
- package/{integration-state-BA4c0RbD.d.cts → integration-state-xK4PLm5T.d.mts} +0 -2
- package/{internal-C7NlPM3M.d.mts → internal-C-uvosSL.d.cts} +1 -17
- package/{internal-DsArcqkP.cjs → internal-CjJy-cy1.cjs} +42 -8
- package/{internal-CLvZdVj5.mjs → internal-DtLZyjf8.mjs} +37 -9
- package/{internal-D2J4VQWT.d.cts → internal-Gie7hCpK.d.mts} +1 -17
- package/internal-adapter.d.cts +1 -1
- package/internal-adapter.d.mts +1 -1
- package/internal-auth-adapter.cjs +1 -1
- package/internal-auth-adapter.d.cts +1 -1
- package/internal-auth-adapter.d.mts +1 -1
- package/internal-auth-adapter.mjs +1 -2
- package/internal-drizzle.cjs +1 -1
- package/internal-drizzle.d.cts +1 -1
- package/internal-drizzle.d.mts +1 -1
- package/internal-drizzle.mjs +1 -2
- package/internal-entity-config.cjs +1 -1
- package/internal-entity-config.d.cts +1 -1
- package/internal-entity-config.d.mts +1 -1
- package/internal-entity-config.mjs +1 -2
- package/internal-entity-heuristics.cjs +3 -4
- package/internal-entity-heuristics.d.cts +2 -4
- package/internal-entity-heuristics.d.mts +2 -4
- package/internal-entity-heuristics.mjs +3 -4
- package/internal-mapping-form.cjs +1 -1
- package/internal-mapping-form.d.cts +1 -1
- package/internal-mapping-form.d.mts +1 -1
- package/internal-mapping-form.mjs +1 -2
- package/internal-mapping-score.cjs +1 -1
- package/internal-mapping-score.d.cts +1 -1
- package/internal-mapping-score.d.mts +1 -1
- package/internal-mapping-score.mjs +1 -2
- package/internal-mappings-config.cjs +1 -1
- package/internal-mappings-config.d.cts +1 -1
- package/internal-mappings-config.d.mts +1 -1
- package/internal-mappings-config.mjs +1 -2
- package/internal-sync-engine.cjs +1 -1
- package/internal-sync-engine.d.cts +1 -1
- package/internal-sync-engine.d.mts +1 -1
- package/internal-sync-engine.mjs +1 -2
- package/internal-types.cjs +1 -1
- package/internal-types.d.cts +1 -1
- package/internal-types.d.mts +1 -1
- package/internal-types.mjs +1 -2
- package/internal-view-compiler.cjs +1 -1
- package/internal-view-compiler.d.cts +1 -1
- package/internal-view-compiler.d.mts +1 -1
- package/internal-view-compiler.mjs +1 -2
- package/internal.cjs +11 -10
- package/internal.d.cts +11 -11
- package/internal.d.mts +11 -11
- package/internal.mjs +11 -11
- package/{mapping-form-BpfON_ME.cjs → mapping-form-Bs6JQurC.cjs} +1 -2
- package/{mapping-form-XsLLCqW_.d.cts → mapping-form-BymksK7h.d.mts} +1 -3
- package/{mapping-form-DigkuvFc.mjs → mapping-form-C7kDMWzp.mjs} +1 -2
- package/{mapping-form-Btn-7gzv.d.mts → mapping-form-Cmf8y-1m.d.cts} +1 -3
- package/{mapping-score-D7Gzg7Ii.d.cts → mapping-score-BKrxddz0.d.cts} +0 -2
- package/{mapping-score-D7Gzg7Ii.d.mts → mapping-score-BKrxddz0.d.mts} +0 -2
- package/{mapping-score-C68uAqGB.mjs → mapping-score-CS-MTDL9.mjs} +1 -2
- package/{mapping-score-CaB3F4Uu.cjs → mapping-score-D2TCQiOr.cjs} +1 -2
- package/{mappings-config-CwQNQ6bA.mjs → mappings-config-C7FPwrJT.mjs} +3 -4
- package/{mappings-config-BCsRLohT.cjs → mappings-config-DBG-KnYl.cjs} +3 -4
- package/{mappings-config-D6_oCi2Q.d.mts → mappings-config-Dsz6rcJb.d.cts} +1 -3
- package/{mappings-config-iJzbcUMp.d.cts → mappings-config-ktJhxmHm.d.mts} +1 -3
- package/{namespace-probe-DykR0kgh.d.mts → namespace-probe-By8SCnym.d.mts} +2 -8
- package/{namespace-probe-H7yWc0JV.d.cts → namespace-probe-CTkb35Ro.d.cts} +2 -8
- package/package.json +1 -1
- package/{projection-BELgANG2.cjs → projection-B8RtxuEq.cjs} +35 -38
- package/{projection-DvNewmI1.mjs → projection-DNi_2dVa.mjs} +30 -39
- package/{projection-sql-DweUaWRc.mjs → projection-sql-BYv40Hen.mjs} +2 -3
- package/{projection-sql-DuCtFE9t.cjs → projection-sql-SuhzhsMe.cjs} +2 -3
- package/schemas-DySv963y.d.cts +2098 -0
- package/schemas-DySv963y.d.mts +2098 -0
- package/{sdk-ZMy4C4VK.cjs → sdk-BJ3OkhCq.cjs} +27 -50
- package/{sdk-DLoVPlGB.mjs → sdk-CXrarwvs.mjs} +27 -50
- package/sdk.cjs +2 -2
- package/sdk.d.cts +2 -10
- package/sdk.d.mts +2 -10
- package/sdk.mjs +2 -2
- package/{sync-engine-DH058G3w.mjs → sync-engine-BTUoH82k.mjs} +2 -3
- package/{sync-engine-C_5TpvfX.d.mts → sync-engine-C_SwnFgF.d.mts} +2 -4
- package/{sync-engine-CYsWOujz.d.cts → sync-engine-D9ltfqkD.d.cts} +2 -4
- package/{sync-engine-BGVDsrOQ.cjs → sync-engine-DBlSP9r2.cjs} +2 -3
- package/{types-YJTkXKzU.mjs → types-8KSw2AWg.mjs} +1 -2
- package/{types-Cq5gHCTq.cjs → types-B8m39L1s.cjs} +1 -2
- package/{types-CpAtAtxd.d.cts → types-BtQCi_qP.d.cts} +30 -3
- package/{types-CpAtAtxd.d.mts → types-CTOl3pAX.d.mts} +30 -3
- package/{view-compiler-C-6RydKK.mjs → view-compiler-B8tJ5IGw.mjs} +3 -4
- package/{view-compiler-CwKVoK1w.d.mts → view-compiler-BZgZisTG.d.mts} +1 -3
- package/{view-compiler-xiwm5iar.cjs → view-compiler-Ce_QE3dh.cjs} +3 -4
- package/{view-compiler-Cq8apvZ4.d.cts → view-compiler-D7GLf1n8.d.cts} +1 -3
- package/vite.cjs +1 -2
- package/vite.d.cts +2 -4
- package/vite.d.mts +2 -4
- package/vite.mjs +1 -2
- package/entity-config-ApnT5j3X.d.cts +0 -4472
- package/entity-config-CKcj4-M_.d.mts +0 -4473
package/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as CANONICAL_FIELDS } from "./entity-config-
|
|
3
|
-
import "./mapping-score-
|
|
2
|
+
import { t as CANONICAL_FIELDS } from "./entity-config-DQVSprlG.mjs";
|
|
3
|
+
import "./mapping-score-CS-MTDL9.mjs";
|
|
4
4
|
import { hasDefiningColumn, isFrameworkTable, matchesConcept, requiredFieldsFor, scoreFieldMap, scoreRelationships, suggestCursorField, toFieldMap } from "./internal-entity-heuristics.mjs";
|
|
5
|
-
import { n as createClivlySDK, u as isPlaceholderUrl } from "./sdk-
|
|
5
|
+
import { n as createClivlySDK, u as isPlaceholderUrl } from "./sdk-CXrarwvs.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
import { accessSync, constants, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, watch, writeFileSync } from "node:fs";
|
|
@@ -12,7 +12,7 @@ import { createInterface } from "node:readline/promises";
|
|
|
12
12
|
import { createJiti } from "jiti";
|
|
13
13
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
14
|
import { Socket } from "node:net";
|
|
15
|
-
|
|
15
|
+
// ../core/src/env-file.ts
|
|
16
16
|
const ENV_FILES = {
|
|
17
17
|
next: ".env.local",
|
|
18
18
|
"tanstack-start": ".env",
|
|
@@ -57,8 +57,7 @@ function resolveEnvFile(input) {
|
|
|
57
57
|
if (input.existing.includes(conventional)) return conventional;
|
|
58
58
|
return input.existing[0] ?? conventional;
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
//#region src/app-layout.ts
|
|
60
|
+
// src/app-layout.ts
|
|
62
61
|
function resolveAppLayout(cwd, fileExists = existsSync) {
|
|
63
62
|
if (fileExists(join(cwd, "src", "app"))) return "src/app";
|
|
64
63
|
if (fileExists(join(cwd, "app"))) return "app";
|
|
@@ -77,8 +76,7 @@ Nothing was written. Please report this at https://github.com/amani-joseph/clivl
|
|
|
77
76
|
— Clivly should have detected the src/app layout automatically.
|
|
78
77
|
`;
|
|
79
78
|
}
|
|
80
|
-
|
|
81
|
-
//#region src/load-config.ts
|
|
79
|
+
// src/load-config.ts
|
|
82
80
|
const CONFIG_HINT = "Expected clivly.config.ts at your app root exporting `createClivlySDK({...})`.";
|
|
83
81
|
function resolveConfigPath(cwd, configPath) {
|
|
84
82
|
return resolve(cwd, configPath ?? "clivly.config.ts");
|
|
@@ -130,8 +128,7 @@ async function loadConfigSdk(path, requiredMethod) {
|
|
|
130
128
|
if (typeof sdk?.[requiredMethod] !== "function") throw new Error("default export is not a Clivly SDK instance");
|
|
131
129
|
return sdk;
|
|
132
130
|
}
|
|
133
|
-
|
|
134
|
-
//#region src/cli-config.ts
|
|
131
|
+
// src/cli-config.ts
|
|
135
132
|
const CLI_CONFIG_NAMES = [
|
|
136
133
|
"clivly.cli.ts",
|
|
137
134
|
"clivly.cli.js",
|
|
@@ -174,16 +171,14 @@ async function loadCliConfig(cwd) {
|
|
|
174
171
|
const envFiles = readEnvFiles(config);
|
|
175
172
|
return envFiles ? { envFiles } : {};
|
|
176
173
|
}
|
|
177
|
-
|
|
178
|
-
//#region src/dashboard-locations.ts
|
|
174
|
+
// src/dashboard-locations.ts
|
|
179
175
|
/** Secret + publishable keys. The Connect dialog mints them and shows the secret once. */
|
|
180
176
|
const CREDENTIALS_LOCATION = "Clivly dashboard → Connect app (or Settings → API keys)";
|
|
181
177
|
/** The signing secret Clivly Cloud uses on sync-trigger callbacks. */
|
|
182
178
|
const SYNC_SECRET_LOCATION = "Clivly dashboard → Integrations → Remote sync";
|
|
183
179
|
/** Chat widget records and their allowed origins. */
|
|
184
180
|
const WIDGET_LOCATION = "Clivly dashboard → Settings → Chat widget";
|
|
185
|
-
|
|
186
|
-
//#region src/detect.ts
|
|
181
|
+
// src/detect.ts
|
|
187
182
|
const FRAMEWORK_MARKERS = [
|
|
188
183
|
{
|
|
189
184
|
framework: "nextjs",
|
|
@@ -291,8 +286,7 @@ function addCommand(pm, packages) {
|
|
|
291
286
|
args: [pm === "npm" ? "install" : "add", ...packages]
|
|
292
287
|
};
|
|
293
288
|
}
|
|
294
|
-
|
|
295
|
-
//#region src/detect-workspace.ts
|
|
289
|
+
// src/detect-workspace.ts
|
|
296
290
|
const SELECTABLE_FRAMEWORKS = [
|
|
297
291
|
"nextjs",
|
|
298
292
|
"tanstack-start",
|
|
@@ -409,8 +403,7 @@ function detectAcrossWorkspace(appDeps, packages) {
|
|
|
409
403
|
sources
|
|
410
404
|
};
|
|
411
405
|
}
|
|
412
|
-
|
|
413
|
-
//#region src/tick-route.ts
|
|
406
|
+
// src/tick-route.ts
|
|
414
407
|
/**
|
|
415
408
|
* The tick route's public URL path, and the template `clivly login` writes for
|
|
416
409
|
* it.
|
|
@@ -447,8 +440,7 @@ const CLIVLY_TICK_PATH = "/api/clivly/tick";
|
|
|
447
440
|
* auto-detected, and `clivly dev` handles local development.
|
|
448
441
|
*/
|
|
449
442
|
const TRIGGER_URL_PLACEHOLDER = `https://<yourDomain.com>${CLIVLY_TICK_PATH}`;
|
|
450
|
-
|
|
451
|
-
//#region src/dev-tunnel.ts
|
|
443
|
+
// src/dev-tunnel.ts
|
|
452
444
|
const CLOUDFLARE_QUICK_TUNNEL_REGEX = /https:\/\/[a-z0-9-]+\.trycloudflare\.com/;
|
|
453
445
|
const DEFAULT_PORT = "3000";
|
|
454
446
|
/**
|
|
@@ -567,8 +559,7 @@ function cloudflaredMissingMessage() {
|
|
|
567
559
|
"Your app will still run locally; only dashboard-triggered sync is unavailable."
|
|
568
560
|
].join("\n");
|
|
569
561
|
}
|
|
570
|
-
|
|
571
|
-
//#region src/tunnel-identity.ts
|
|
562
|
+
// src/tunnel-identity.ts
|
|
572
563
|
/**
|
|
573
564
|
* Whether the published tunnel actually reaches *this* app's Clivly route.
|
|
574
565
|
*
|
|
@@ -686,8 +677,7 @@ function tunnelMismatchMessage(port) {
|
|
|
686
677
|
" Until then, dashboard-triggered syncs will not reach this app."
|
|
687
678
|
].join("\n");
|
|
688
679
|
}
|
|
689
|
-
|
|
690
|
-
//#region src/dev.ts
|
|
680
|
+
// src/dev.ts
|
|
691
681
|
const UNREACHABLE_RESULT = {
|
|
692
682
|
ok: false,
|
|
693
683
|
kind: "unreachable"
|
|
@@ -769,8 +759,7 @@ async function runDev(options) {
|
|
|
769
759
|
});
|
|
770
760
|
});
|
|
771
761
|
}
|
|
772
|
-
|
|
773
|
-
//#region src/dev-override.ts
|
|
762
|
+
// src/dev-override.ts
|
|
774
763
|
const TRIGGER_URL_PATH = "/clivly/sdk/trigger-url";
|
|
775
764
|
const HTTP_UNAUTHORIZED = 401;
|
|
776
765
|
const HTTP_NOT_FOUND = 404;
|
|
@@ -810,8 +799,7 @@ async function clearTunnelOverride(deps) {
|
|
|
810
799
|
if (res.ok) return { ok: true };
|
|
811
800
|
return failureFor(res.status);
|
|
812
801
|
}
|
|
813
|
-
|
|
814
|
-
//#region src/probe-module.ts
|
|
802
|
+
// src/probe-module.ts
|
|
815
803
|
async function probeModule(opts) {
|
|
816
804
|
for (const candidate of opts.candidates) {
|
|
817
805
|
let mod;
|
|
@@ -827,8 +815,7 @@ async function probeModule(opts) {
|
|
|
827
815
|
}
|
|
828
816
|
return null;
|
|
829
817
|
}
|
|
830
|
-
|
|
831
|
-
//#region src/workspace-graph.ts
|
|
818
|
+
// src/workspace-graph.ts
|
|
832
819
|
const WINDOWS_SEP$3 = /\\/g;
|
|
833
820
|
const MODULE_EXT$1 = /\.(ts|tsx|js|jsx|mjs|cjs|cts|mts)$/;
|
|
834
821
|
const BRACE_GROUP = /\{([^{}]*)\}/;
|
|
@@ -1064,8 +1051,7 @@ function toPackageSpecifier(pkg, absPath) {
|
|
|
1064
1051
|
if (subpath.length === 0) return pkg.name;
|
|
1065
1052
|
return exportsAllowSubpath(pkg.dir, subpath) ? `${pkg.name}/${subpath}` : null;
|
|
1066
1053
|
}
|
|
1067
|
-
|
|
1068
|
-
//#region src/discover-schema.ts
|
|
1054
|
+
// src/discover-schema.ts
|
|
1069
1055
|
const WINDOWS_SEP$2 = /\\/g;
|
|
1070
1056
|
const MODULE_EXT = /\.(ts|js|mjs|cts|mts)$/;
|
|
1071
1057
|
/**
|
|
@@ -1240,8 +1226,7 @@ async function discoverSchema(opts) {
|
|
|
1240
1226
|
db
|
|
1241
1227
|
};
|
|
1242
1228
|
}
|
|
1243
|
-
|
|
1244
|
-
//#region src/engine-check.ts
|
|
1229
|
+
// src/engine-check.ts
|
|
1245
1230
|
const MAJOR = /^v?(\d+)/;
|
|
1246
1231
|
const FIRST_NUMBER = /(\d+)/;
|
|
1247
1232
|
function currentMajor(version) {
|
|
@@ -1263,8 +1248,7 @@ Upgrade with \`nvm install ${need}\` (or your version manager of choice), then r
|
|
|
1263
1248
|
Set CLIVLY_SKIP_ENGINE_CHECK=1 to run anyway — expect unrelated-looking failures.
|
|
1264
1249
|
`;
|
|
1265
1250
|
}
|
|
1266
|
-
|
|
1267
|
-
//#region src/env-file.ts
|
|
1251
|
+
// src/env-file.ts
|
|
1268
1252
|
const REGEX_METACHARACTERS = /[.*+?^${}()|[\]\\]/g;
|
|
1269
1253
|
function escapeForRegExp(key) {
|
|
1270
1254
|
return key.replace(REGEX_METACHARACTERS, "\\$&");
|
|
@@ -1347,8 +1331,7 @@ function upsertEnvValues(existing, entries, options = {}) {
|
|
|
1347
1331
|
written
|
|
1348
1332
|
};
|
|
1349
1333
|
}
|
|
1350
|
-
|
|
1351
|
-
//#region src/help.ts
|
|
1334
|
+
// src/help.ts
|
|
1352
1335
|
const ROOT_HELP = `clivly — embed a CRM in your app
|
|
1353
1336
|
|
|
1354
1337
|
Usage:
|
|
@@ -1477,10 +1460,9 @@ function isHelpRequest(argv) {
|
|
|
1477
1460
|
}
|
|
1478
1461
|
function helpFor(command) {
|
|
1479
1462
|
if (!command) return ROOT_HELP;
|
|
1480
|
-
return COMMAND_HELP[command] ??
|
|
1463
|
+
return COMMAND_HELP[command] ?? "clivly — embed a CRM in your app\n\nUsage:\n clivly init [options] Scaffold Clivly (config, routes, env file) for your app\n clivly add widget [options] Scaffold the chat-session route\n clivly status [options] Check your setup, step by step\n clivly push-schema [options] Push schema, custom objects and mappings to Clivly\n clivly dev [options] Tunnel localhost so remote sync can reach you\n clivly login [options] Pair this machine and write credentials to your env file\n clivly --version Print the installed clivly version\n\nDeprecated aliases — each runs part of `clivly status` and still works:\n clivly ping credential + reachability\n clivly connect the above, plus config and trigger URL\n clivly doctor config, setup checks and edge safety\n\nPrefer `clivly status`: it runs the whole ladder and tells you which step you\nare on. The aliases are kept because output and docs have recommended them.\n\nRun `clivly <command> --help` for details on a command.\n";
|
|
1481
1464
|
}
|
|
1482
|
-
|
|
1483
|
-
//#region src/install.ts
|
|
1465
|
+
// src/install.ts
|
|
1484
1466
|
const defaultRun = (command, args, cwd) => new Promise((resolvePromise, reject) => {
|
|
1485
1467
|
const child = spawn(command, args, {
|
|
1486
1468
|
cwd,
|
|
@@ -1521,8 +1503,7 @@ async function installPackages(options) {
|
|
|
1521
1503
|
};
|
|
1522
1504
|
}
|
|
1523
1505
|
}
|
|
1524
|
-
|
|
1525
|
-
//#region src/install-needed.ts
|
|
1506
|
+
// src/install-needed.ts
|
|
1526
1507
|
/** Exact `name@version` only. Anything else is left for the package manager. */
|
|
1527
1508
|
const EXACT_VERSION = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
|
|
1528
1509
|
/**
|
|
@@ -1561,8 +1542,7 @@ function packagesNeedingInstall(packages, installedVersion) {
|
|
|
1561
1542
|
return present !== version;
|
|
1562
1543
|
});
|
|
1563
1544
|
}
|
|
1564
|
-
|
|
1565
|
-
//#region src/is-entry.ts
|
|
1545
|
+
// src/is-entry.ts
|
|
1566
1546
|
function isEntrypoint(argv1, moduleUrl, realpath = realpathSync) {
|
|
1567
1547
|
if (!argv1) return false;
|
|
1568
1548
|
const modulePath = fileURLToPath(moduleUrl);
|
|
@@ -1575,8 +1555,7 @@ function isEntrypoint(argv1, moduleUrl, realpath = realpathSync) {
|
|
|
1575
1555
|
};
|
|
1576
1556
|
return resolve(argv1) === resolve(modulePath);
|
|
1577
1557
|
}
|
|
1578
|
-
|
|
1579
|
-
//#region src/load-env.ts
|
|
1558
|
+
// src/load-env.ts
|
|
1580
1559
|
const LINE = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)$/;
|
|
1581
1560
|
const NEWLINE$1 = /\r?\n/;
|
|
1582
1561
|
const ESCAPED_NEWLINE = /\\n/g;
|
|
@@ -1651,8 +1630,7 @@ function loadEnv(cwd, env = process.env, options = {}) {
|
|
|
1651
1630
|
files
|
|
1652
1631
|
};
|
|
1653
1632
|
}
|
|
1654
|
-
|
|
1655
|
-
//#region src/secret-key-env.ts
|
|
1633
|
+
// src/secret-key-env.ts
|
|
1656
1634
|
const SECRET_KEY_ENV = "CLIVLY_SECRET_KEY";
|
|
1657
1635
|
const LEGACY_SECRET_KEY_ENV = "CLIVLY_API_KEY";
|
|
1658
1636
|
function readSecretKeyEnv(env) {
|
|
@@ -1660,8 +1638,7 @@ function readSecretKeyEnv(env) {
|
|
|
1660
1638
|
if (next && next.length > 0) return next;
|
|
1661
1639
|
return env[LEGACY_SECRET_KEY_ENV];
|
|
1662
1640
|
}
|
|
1663
|
-
|
|
1664
|
-
//#region src/login.ts
|
|
1641
|
+
// src/login.ts
|
|
1665
1642
|
const POLL_INTERVAL_MS = 2e3;
|
|
1666
1643
|
const POLL_BACKOFF_MULTIPLIER = 1.5;
|
|
1667
1644
|
const POLL_INTERVAL_MAX_MS = 1e4;
|
|
@@ -1804,8 +1781,7 @@ async function runLogin(options) {
|
|
|
1804
1781
|
writeCredentials(options, outcome);
|
|
1805
1782
|
return 0;
|
|
1806
1783
|
}
|
|
1807
|
-
|
|
1808
|
-
//#region src/plan-init.ts
|
|
1784
|
+
// src/plan-init.ts
|
|
1809
1785
|
function toScoredTable(table) {
|
|
1810
1786
|
return {
|
|
1811
1787
|
name: table.tableName,
|
|
@@ -2080,15 +2056,13 @@ function rankContactCandidates(tables) {
|
|
|
2080
2056
|
table
|
|
2081
2057
|
}));
|
|
2082
2058
|
}
|
|
2083
|
-
|
|
2084
|
-
//#region src/config-import.ts
|
|
2059
|
+
// src/config-import.ts
|
|
2085
2060
|
const WINDOWS_SEP$1 = /\\/g;
|
|
2086
2061
|
function configImport(generatedFilePath) {
|
|
2087
2062
|
const rel = relative(dirname(generatedFilePath), "clivly.config").replace(WINDOWS_SEP$1, "/");
|
|
2088
2063
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
2089
2064
|
}
|
|
2090
|
-
|
|
2091
|
-
//#region src/boot-hook.ts
|
|
2065
|
+
// src/boot-hook.ts
|
|
2092
2066
|
const BOOT_HOOK_PATHS = {
|
|
2093
2067
|
nextjs: "instrumentation.ts",
|
|
2094
2068
|
nuxt: "server/plugins/clivly.ts",
|
|
@@ -2237,8 +2211,7 @@ function planBootHook(framework, layout) {
|
|
|
2237
2211
|
owned: true
|
|
2238
2212
|
};
|
|
2239
2213
|
}
|
|
2240
|
-
|
|
2241
|
-
//#region src/render-config.ts
|
|
2214
|
+
// src/render-config.ts
|
|
2242
2215
|
const CLIVLY_ENV_KEYS = [
|
|
2243
2216
|
{
|
|
2244
2217
|
key: "CLIVLY_SECRET_KEY",
|
|
@@ -2363,8 +2336,7 @@ ${sources.join(",\n")},
|
|
|
2363
2336
|
});
|
|
2364
2337
|
`;
|
|
2365
2338
|
}
|
|
2366
|
-
|
|
2367
|
-
//#region src/render-auth.ts
|
|
2339
|
+
// src/render-auth.ts
|
|
2368
2340
|
const RESOLVE_USER = "const resolveUser = (req: Request) => adapter.getUser(req);";
|
|
2369
2341
|
const STUB = {
|
|
2370
2342
|
complete: false,
|
|
@@ -2438,8 +2410,7 @@ function renderAuthWiring(auth, authInstance = null) {
|
|
|
2438
2410
|
default: return STUB;
|
|
2439
2411
|
}
|
|
2440
2412
|
}
|
|
2441
|
-
|
|
2442
|
-
//#region src/tsconfig-alias.ts
|
|
2413
|
+
// src/tsconfig-alias.ts
|
|
2443
2414
|
const LEADING_DOT_SLASH$1 = /^\.\//;
|
|
2444
2415
|
const TRAILING_WILDCARD = /\/?\*$/;
|
|
2445
2416
|
const TRAILING_SLASH = /\/$/;
|
|
@@ -2515,8 +2486,7 @@ function baseReaching(mapped, target) {
|
|
|
2515
2486
|
if (base === "") return target === "" ? null : "";
|
|
2516
2487
|
return target.startsWith(`${base}/`) ? base : null;
|
|
2517
2488
|
}
|
|
2518
|
-
|
|
2519
|
-
//#region src/scaffold.ts
|
|
2489
|
+
// src/scaffold.ts
|
|
2520
2490
|
const TANSTACK_ROUTE_PREFIX = /^src\/routes\//;
|
|
2521
2491
|
const TS_EXTENSION = /\.ts$/;
|
|
2522
2492
|
const ROUTE_PATHS = {
|
|
@@ -2688,8 +2658,7 @@ function planWidgetScaffold(framework, layout = "app") {
|
|
|
2688
2658
|
owned: true
|
|
2689
2659
|
}];
|
|
2690
2660
|
}
|
|
2691
|
-
|
|
2692
|
-
//#region src/vite-boot-patch.ts
|
|
2661
|
+
// src/vite-boot-patch.ts
|
|
2693
2662
|
/** Config filenames to look for, in precedence order. */
|
|
2694
2663
|
const VITE_CONFIG_CANDIDATES = [
|
|
2695
2664
|
"vite.config.ts",
|
|
@@ -2727,8 +2696,7 @@ function patchViteConfig(source) {
|
|
|
2727
2696
|
const separator = rest.startsWith("\n") ? "" : " ";
|
|
2728
2697
|
return insertImports(`${source.slice(0, openBracketEnd)}${PLUGIN_CALL},${separator}${rest}`);
|
|
2729
2698
|
}
|
|
2730
|
-
|
|
2731
|
-
//#region src/plan-mutations.ts
|
|
2699
|
+
// src/plan-mutations.ts
|
|
2732
2700
|
function fileAction(existing, next, force) {
|
|
2733
2701
|
if (existing === null) return "create";
|
|
2734
2702
|
if (existing === next) return "unchanged";
|
|
@@ -2854,8 +2822,7 @@ function planWidgetMutations(args) {
|
|
|
2854
2822
|
};
|
|
2855
2823
|
});
|
|
2856
2824
|
}
|
|
2857
|
-
|
|
2858
|
-
//#region src/port-probe.ts
|
|
2825
|
+
// src/port-probe.ts
|
|
2859
2826
|
const PORT_PROBE_TIMEOUT_MS = 1500;
|
|
2860
2827
|
/** One connect attempt against a single address family. */
|
|
2861
2828
|
function connectsOn(port, host) {
|
|
@@ -2891,8 +2858,7 @@ function connectsOn(port, host) {
|
|
|
2891
2858
|
function isLocalPortListening(port) {
|
|
2892
2859
|
return Promise.all([connectsOn(port, "127.0.0.1"), connectsOn(port, "::1")]).then((results) => results.some(Boolean));
|
|
2893
2860
|
}
|
|
2894
|
-
|
|
2895
|
-
//#region src/quiet-host-output.ts
|
|
2861
|
+
// src/quiet-host-output.ts
|
|
2896
2862
|
/**
|
|
2897
2863
|
* Run `fn` with the process's stdout/stderr captured. Always restores the
|
|
2898
2864
|
* original writers, including when `fn` throws — a leaked patch would silence
|
|
@@ -2934,8 +2900,7 @@ async function quietly(fn) {
|
|
|
2934
2900
|
const { result } = await captureHostOutput(fn);
|
|
2935
2901
|
return result;
|
|
2936
2902
|
}
|
|
2937
|
-
|
|
2938
|
-
//#region src/probe-auth.ts
|
|
2903
|
+
// src/probe-auth.ts
|
|
2939
2904
|
const AUTH_MODULE_PATHS = [
|
|
2940
2905
|
"auth",
|
|
2941
2906
|
"lib/auth",
|
|
@@ -2969,8 +2934,7 @@ function probeAuthInstance(cwd, load) {
|
|
|
2969
2934
|
match: isBetterAuthInstance
|
|
2970
2935
|
}));
|
|
2971
2936
|
}
|
|
2972
|
-
|
|
2973
|
-
//#region src/push-schema.ts
|
|
2937
|
+
// src/push-schema.ts
|
|
2974
2938
|
/**
|
|
2975
2939
|
* "1 mapping" / "3 mappings" — a count nobody has to decode. The plural is
|
|
2976
2940
|
* explicit because appending "s" turns "entity" into "entitys".
|
|
@@ -3048,8 +3012,7 @@ async function runPushSchema(options) {
|
|
|
3048
3012
|
out(" Open Integrations → Mapping to map your tables.\n");
|
|
3049
3013
|
return 0;
|
|
3050
3014
|
}
|
|
3051
|
-
|
|
3052
|
-
//#region src/resolve-schema-path.ts
|
|
3015
|
+
// src/resolve-schema-path.ts
|
|
3053
3016
|
const COMMON_PATHS = [
|
|
3054
3017
|
"src/db/schema.ts",
|
|
3055
3018
|
"src/db/schema",
|
|
@@ -3127,8 +3090,7 @@ function resolveSchemaPath(opts) {
|
|
|
3127
3090
|
}
|
|
3128
3091
|
return null;
|
|
3129
3092
|
}
|
|
3130
|
-
|
|
3131
|
-
//#region src/resolve-target-app.ts
|
|
3093
|
+
// src/resolve-target-app.ts
|
|
3132
3094
|
function packageDeps(dir) {
|
|
3133
3095
|
const pkg = readPackageManifest(dir);
|
|
3134
3096
|
return {
|
|
@@ -3207,8 +3169,7 @@ function resolveTargetApp(start, boundary = homedir()) {
|
|
|
3207
3169
|
candidates: ranked
|
|
3208
3170
|
};
|
|
3209
3171
|
}
|
|
3210
|
-
|
|
3211
|
-
//#region src/status-ladder.ts
|
|
3172
|
+
// src/status-ladder.ts
|
|
3212
3173
|
const SATISFYING = /* @__PURE__ */ new Set(["pass", "warn"]);
|
|
3213
3174
|
function unmetPrerequisites(stage, satisfied) {
|
|
3214
3175
|
return (stage.needs ?? []).filter((id) => !satisfied.has(id));
|
|
@@ -3258,8 +3219,7 @@ async function runLadder(stages, ctx) {
|
|
|
3258
3219
|
function ladderExitCode(results) {
|
|
3259
3220
|
return results.every((result) => result.state !== "fail" && result.state !== "pending") ? 0 : 1;
|
|
3260
3221
|
}
|
|
3261
|
-
|
|
3262
|
-
//#region src/boot-hook-check.ts
|
|
3222
|
+
// src/boot-hook-check.ts
|
|
3263
3223
|
const REMIX_ENTRY_CANDIDATES = [
|
|
3264
3224
|
"app/entry.server.tsx",
|
|
3265
3225
|
"app/entry.server.ts",
|
|
@@ -3355,8 +3315,7 @@ function checkBootHook(readFile) {
|
|
|
3355
3315
|
detail: site
|
|
3356
3316
|
};
|
|
3357
3317
|
}
|
|
3358
|
-
|
|
3359
|
-
//#region src/cursor-store-check.ts
|
|
3318
|
+
// src/cursor-store-check.ts
|
|
3360
3319
|
/**
|
|
3361
3320
|
* Whether a config that will run on a serverless runtime persists its sync
|
|
3362
3321
|
* cursor.
|
|
@@ -3436,8 +3395,7 @@ function cursorStoreDetail(verdict) {
|
|
|
3436
3395
|
if (verdict.edgeRuntime === null) return "in-memory (fine on a long-lived host)";
|
|
3437
3396
|
return `No \`cursorStore\` on ${verdict.edgeRuntime} — memory does not survive between invocations, so every delta sync re-reads your entire source tables.`;
|
|
3438
3397
|
}
|
|
3439
|
-
|
|
3440
|
-
//#region src/edge-safety.ts
|
|
3398
|
+
// src/edge-safety.ts
|
|
3441
3399
|
const NODE_BUILTINS = /* @__PURE__ */ new Set([
|
|
3442
3400
|
"assert",
|
|
3443
3401
|
"buffer",
|
|
@@ -3591,8 +3549,7 @@ function analyzeConfigTree(input) {
|
|
|
3591
3549
|
}
|
|
3592
3550
|
return issues;
|
|
3593
3551
|
}
|
|
3594
|
-
|
|
3595
|
-
//#region src/status-stages.ts
|
|
3552
|
+
// src/status-stages.ts
|
|
3596
3553
|
const MODULE_CANDIDATES = [
|
|
3597
3554
|
".ts",
|
|
3598
3555
|
".tsx",
|
|
@@ -3850,8 +3807,7 @@ const STATUS_STAGES = [
|
|
|
3850
3807
|
function defaultLoadSdk(path) {
|
|
3851
3808
|
return loadConfigSdk(path, "doctor");
|
|
3852
3809
|
}
|
|
3853
|
-
|
|
3854
|
-
//#region src/workspace-section.ts
|
|
3810
|
+
// src/workspace-section.ts
|
|
3855
3811
|
const MARK$1 = {
|
|
3856
3812
|
active: "⏳",
|
|
3857
3813
|
blocked: "🔒",
|
|
@@ -3888,8 +3844,7 @@ function workspaceSection(result) {
|
|
|
3888
3844
|
lines: result.workspace.steps.map((step) => ` ${MARK$1[step.state]} ${step.label}${step.evidence ? ` ${step.evidence}` : ""}`)
|
|
3889
3845
|
};
|
|
3890
3846
|
}
|
|
3891
|
-
|
|
3892
|
-
//#region src/status.ts
|
|
3847
|
+
// src/status.ts
|
|
3893
3848
|
/** Stage ids each legacy command maps onto. */
|
|
3894
3849
|
const ALIAS_STAGE_IDS = {
|
|
3895
3850
|
status: STATUS_STAGES.map((stage) => stage.id),
|
|
@@ -3971,8 +3926,7 @@ async function runStatus(options) {
|
|
|
3971
3926
|
if (code !== 0 && results.some((result) => result.state === "pending")) out("\nSetup is incomplete — finish the steps above and re-run.\n");
|
|
3972
3927
|
return code;
|
|
3973
3928
|
}
|
|
3974
|
-
|
|
3975
|
-
//#region src/index.ts
|
|
3929
|
+
// src/index.ts
|
|
3976
3930
|
const ENV_FILE_CANDIDATES = [
|
|
3977
3931
|
".env",
|
|
3978
3932
|
".env.local",
|
|
@@ -4813,5 +4767,4 @@ async function main(argv) {
|
|
|
4813
4767
|
if (isEntrypoint(process.argv[1], import.meta.url)) main(process.argv.slice(2)).then((code) => {
|
|
4814
4768
|
process.exitCode = code;
|
|
4815
4769
|
});
|
|
4816
|
-
//#endregion
|
|
4817
4770
|
export { KNOWN_COMMANDS, credentialsMissing, main, nearestCommand, runAdd, runInit, runInitFromArgv };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../core/src/integration-state.d.ts
|
|
2
1
|
declare const INTEGRATION_STEPS: readonly ["credential", "application", "schema", "mapping", "trigger", "sync", "widget"];
|
|
3
2
|
type StepId = (typeof INTEGRATION_STEPS)[number];
|
|
4
3
|
/** `blocked` means "prerequisite unmet", never "broken" — see C-19. */
|
|
@@ -169,5 +168,4 @@ interface IntegrationState {
|
|
|
169
168
|
status: IntegrationStatus;
|
|
170
169
|
steps: IntegrationStep[];
|
|
171
170
|
}
|
|
172
|
-
//#endregion
|
|
173
171
|
export { IntegrationStep as a, StepProblem as c, IntegrationStatus as i, StepState as l, IntegrationFacts as n, NextAction as o, IntegrationState as r, StepId as s, ConnectionLiveness as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../core/src/integration-state.d.ts
|
|
2
1
|
declare const INTEGRATION_STEPS: readonly ["credential", "application", "schema", "mapping", "trigger", "sync", "widget"];
|
|
3
2
|
type StepId = (typeof INTEGRATION_STEPS)[number];
|
|
4
3
|
/** `blocked` means "prerequisite unmet", never "broken" — see C-19. */
|
|
@@ -169,5 +168,4 @@ interface IntegrationState {
|
|
|
169
168
|
status: IntegrationStatus;
|
|
170
169
|
steps: IntegrationStep[];
|
|
171
170
|
}
|
|
172
|
-
//#endregion
|
|
173
171
|
export { IntegrationStep as a, StepProblem as c, IntegrationStatus as i, StepState as l, IntegrationFacts as n, NextAction as o, IntegrationState as r, StepId as s, ConnectionLiveness as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { L as ProjectionJoin, R as ProjectionMapping, h as FilterExpr, l as ConfigValidationError, m as DiscoveredSchemaTable, p as DiscoveredColumnMeta } from "./entity-config-
|
|
2
|
-
//#region ../core/src/deal-value.d.ts
|
|
1
|
+
import { L as ProjectionJoin, R as ProjectionMapping, h as FilterExpr, l as ConfigValidationError, m as DiscoveredSchemaTable, p as DiscoveredColumnMeta } from "./entity-config-BF7pcXFB.cjs";
|
|
3
2
|
/**
|
|
4
3
|
* Value derived as a flat fee plus a per-seat price that depends on the plan.
|
|
5
4
|
*
|
|
@@ -35,8 +34,6 @@ interface PerSeatValueSource {
|
|
|
35
34
|
* being written into the data — the same fail-safe `matchesCondition` applies.
|
|
36
35
|
*/
|
|
37
36
|
declare function computeDealValue(source: PerSeatValueSource, fields: Record<string, string | null>, mappedFields: Set<string>, stageType: string): number | null;
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region ../core/src/host-owned-fields.d.ts
|
|
40
37
|
/**
|
|
41
38
|
* Which fields a CRM record lets a user edit.
|
|
42
39
|
*
|
|
@@ -102,13 +99,9 @@ declare function rejectedCompanyFields(company: SourcedRecord, patch: Readonly<R
|
|
|
102
99
|
* they come from, so the reason is actionable rather than a bare "forbidden".
|
|
103
100
|
*/
|
|
104
101
|
declare function hostOwnedFieldMessage(fields: readonly string[]): string;
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region ../core/src/projection-cardinality.d.ts
|
|
107
102
|
declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
|
|
108
103
|
/** Every join in the projection that can multiply rows. */
|
|
109
104
|
declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<string, DiscoveredSchemaTable>): ProjectionJoin[];
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region ../core/src/projection-sql.d.ts
|
|
112
105
|
/**
|
|
113
106
|
* SQL generation for projection-backed entities.
|
|
114
107
|
*
|
|
@@ -163,8 +156,6 @@ declare const PREVIEW_MAX_ROWS = 50;
|
|
|
163
156
|
* are the field names they just typed.
|
|
164
157
|
*/
|
|
165
158
|
declare function compileProjectionPreview(projection: ProjectionMapping, limit: number): string;
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region ../core/src/projection-validate.d.ts
|
|
168
159
|
/**
|
|
169
160
|
* A derived object's filter is evaluated in the cloud against pushed rows, so
|
|
170
161
|
* it can only name columns of the base table.
|
|
@@ -191,8 +182,6 @@ declare function validateProjectionFilter(filter: FilterExpr | undefined, projec
|
|
|
191
182
|
* found (not just the first) so a builder UI can show them all at once.
|
|
192
183
|
*/
|
|
193
184
|
declare function validateProjection(projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
|
|
194
|
-
//#endregion
|
|
195
|
-
//#region ../core/src/schema-meta.d.ts
|
|
196
185
|
/**
|
|
197
186
|
* Accessors over a discovered table's schema-v2 metadata.
|
|
198
187
|
*
|
|
@@ -239,8 +228,6 @@ type RichMetaTable = DiscoveredSchemaTable & {
|
|
|
239
228
|
* never whether the table has keys. Absent metadata stays UNKNOWN.
|
|
240
229
|
*/
|
|
241
230
|
declare function hasRichMeta(table: DiscoveredSchemaTable): table is RichMetaTable;
|
|
242
|
-
//#endregion
|
|
243
|
-
//#region ../core/src/slug.d.ts
|
|
244
231
|
/**
|
|
245
232
|
* The one `slugify`.
|
|
246
233
|
*
|
|
@@ -290,8 +277,6 @@ declare function slugify(value: string): string;
|
|
|
290
277
|
* whether the field is still being edited.
|
|
291
278
|
*/
|
|
292
279
|
declare function toObjectTypeSlug(displayName: string): string;
|
|
293
|
-
//#endregion
|
|
294
|
-
//#region ../core/src/stage-rules.d.ts
|
|
295
280
|
type ConditionOp = "is_empty" | "is_not_empty" | "equals" | "not_equals" | "greater_than" | "less_than" | "before" | "after";
|
|
296
281
|
interface Condition {
|
|
297
282
|
field: string;
|
|
@@ -326,5 +311,4 @@ declare function matchesCondition(condition: Condition, fields: Record<string, s
|
|
|
326
311
|
* a half-written rule should do.
|
|
327
312
|
*/
|
|
328
313
|
declare function evaluateStage(rules: EvaluableRule[], fields: Record<string, string | null>, mappedFields: Set<string>): string | null;
|
|
329
|
-
//#endregion
|
|
330
314
|
export { PerSeatValueSource as A, HostOwnedCompanyField as C, isHostOwned as D, hostOwnedFieldMessage as E, rejectedCompanyFields as O, joinFansOut as S, SourcedRecord as T, compileProjectionJoins as _, matchesCondition as a, quoteIdent as b, columnMetaFor as c, primaryKeyColumns as d, validateProjection as f, compileProjectionIdentity as g, compileProjectionFrom as h, evaluateStage as i, computeDealValue as j, rejectedContactFields as k, coversUniqueKey as l, PREVIEW_MAX_ROWS as m, ConditionOp as n, slugify as o, validateProjectionFilter as p, EvaluableRule as r, toObjectTypeSlug as s, Condition as t, hasRichMeta as u, compileProjectionPreview as v, HostOwnedContactField as w, fanOutJoins as x, compileProjectionSelect as y };
|
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
const require_projection = require("./projection-B8RtxuEq.cjs");
|
|
2
|
+
// ../core/src/contact-segment.ts
|
|
3
|
+
/** AND conditions over deliberately mapped host fields, never SQL identifiers. */
|
|
4
|
+
const contactSegmentSchema = require_projection.array(require_projection.object({
|
|
5
|
+
field: require_projection.string().min(1).max(160),
|
|
6
|
+
operator: require_projection._enum([
|
|
7
|
+
"equals",
|
|
8
|
+
"not_equals",
|
|
9
|
+
"contains",
|
|
10
|
+
"gt",
|
|
11
|
+
"gte",
|
|
12
|
+
"lt",
|
|
13
|
+
"lte",
|
|
14
|
+
"is_set",
|
|
15
|
+
"is_not_set"
|
|
16
|
+
]),
|
|
17
|
+
value: require_projection.string().max(1e3).optional()
|
|
18
|
+
}).strict().superRefine((rule, ctx) => {
|
|
19
|
+
if (!["is_set", "is_not_set"].includes(rule.operator) && rule.value === void 0) ctx.addIssue({
|
|
20
|
+
code: "custom",
|
|
21
|
+
message: "Enter a value for this condition."
|
|
22
|
+
});
|
|
23
|
+
if ([
|
|
24
|
+
"gt",
|
|
25
|
+
"gte",
|
|
26
|
+
"lt",
|
|
27
|
+
"lte"
|
|
28
|
+
].includes(rule.operator) && !(rule.value?.trim() && Number.isFinite(Number(rule.value)))) ctx.addIssue({
|
|
29
|
+
code: "custom",
|
|
30
|
+
message: "Enter a finite number for this comparison."
|
|
31
|
+
});
|
|
32
|
+
})).max(20);
|
|
33
|
+
// ../core/src/deal-value.ts
|
|
2
34
|
const MONTHS_PER_YEAR = 12;
|
|
3
35
|
/** Only two decimal-free seat counts make sense; anything else is bad data. */
|
|
4
36
|
const SEAT_COUNT_REGEX = /^\d+$/;
|
|
@@ -37,8 +69,7 @@ function normalizePrice(monthly, source, fields, mappedFields) {
|
|
|
37
69
|
}
|
|
38
70
|
return source.intervalField !== void 0 && mappedFields.has(source.intervalField) && fields[source.intervalField] === "year" ? Math.round(monthly / MONTHS_PER_YEAR) : monthly;
|
|
39
71
|
}
|
|
40
|
-
|
|
41
|
-
//#region ../core/src/host-owned-fields.ts
|
|
72
|
+
// ../core/src/host-owned-fields.ts
|
|
42
73
|
/**
|
|
43
74
|
* Which fields a CRM record lets a user edit.
|
|
44
75
|
*
|
|
@@ -115,8 +146,7 @@ function rejectedCompanyFields(company, patch) {
|
|
|
115
146
|
function hostOwnedFieldMessage(fields) {
|
|
116
147
|
return `The ${fields.join(", ")} ${fields.length > 1 ? "fields are" : "field is"} synced from your app and cannot be edited here. Change it in your app and it will update on the next sync.`;
|
|
117
148
|
}
|
|
118
|
-
|
|
119
|
-
//#region ../core/src/slug.ts
|
|
149
|
+
// ../core/src/slug.ts
|
|
120
150
|
/**
|
|
121
151
|
* The one `slugify`.
|
|
122
152
|
*
|
|
@@ -184,8 +214,7 @@ function toObjectTypeSlug(displayName) {
|
|
|
184
214
|
if (slug === "") return "";
|
|
185
215
|
return MUST_START_WITH_LETTER.test(slug) ? slug : `${LEADING_DIGIT_PREFIX}${slug}`;
|
|
186
216
|
}
|
|
187
|
-
|
|
188
|
-
//#region ../core/src/stage-rules.ts
|
|
217
|
+
// ../core/src/stage-rules.ts
|
|
189
218
|
const CONDITION_OPS = /* @__PURE__ */ new Set([
|
|
190
219
|
"is_empty",
|
|
191
220
|
"is_not_empty",
|
|
@@ -258,13 +287,18 @@ function evaluateStage(rules, fields, mappedFields) {
|
|
|
258
287
|
}
|
|
259
288
|
return null;
|
|
260
289
|
}
|
|
261
|
-
//#endregion
|
|
262
290
|
Object.defineProperty(exports, "computeDealValue", {
|
|
263
291
|
enumerable: true,
|
|
264
292
|
get: function() {
|
|
265
293
|
return computeDealValue;
|
|
266
294
|
}
|
|
267
295
|
});
|
|
296
|
+
Object.defineProperty(exports, "contactSegmentSchema", {
|
|
297
|
+
enumerable: true,
|
|
298
|
+
get: function() {
|
|
299
|
+
return contactSegmentSchema;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
268
302
|
Object.defineProperty(exports, "evaluateStage", {
|
|
269
303
|
enumerable: true,
|
|
270
304
|
get: function() {
|