clivly 0.9.3 → 0.9.5

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.
Files changed (60) hide show
  1. package/README.md +23 -6
  2. package/core-entity-config.cjs +1 -1
  3. package/core-entity-config.mjs +1 -1
  4. package/core-mappings-config.cjs +1 -1
  5. package/core-mappings-config.mjs +1 -1
  6. package/core-sync-engine.cjs +1 -1
  7. package/core-sync-engine.mjs +1 -1
  8. package/core-view-compiler.cjs +1 -1
  9. package/core-view-compiler.mjs +1 -1
  10. package/core.cjs +11 -6
  11. package/core.d.cts +2 -2
  12. package/core.d.mts +2 -2
  13. package/core.mjs +8 -7
  14. package/drizzle.cjs +74 -9
  15. package/drizzle.d.cts +83 -7
  16. package/drizzle.d.mts +83 -7
  17. package/drizzle.mjs +74 -10
  18. package/{entity-config-DtBsl2MQ.cjs → entity-config-7sGCk_nw.cjs} +1 -1
  19. package/{entity-config-kUHri9yA.mjs → entity-config-B74SPOUZ.mjs} +1 -1
  20. package/index.cjs +180 -21
  21. package/index.mjs +180 -21
  22. package/{internal-Df-PtOH_.mjs → internal-CykXpEGk.mjs} +2 -2
  23. package/{internal-CwnEG6Wl.cjs → internal-DqduZU3l.cjs} +2 -2
  24. package/internal-entity-config.cjs +1 -1
  25. package/internal-entity-config.mjs +1 -1
  26. package/internal-entity-heuristics.cjs +1 -1
  27. package/internal-entity-heuristics.mjs +1 -1
  28. package/internal-mappings-config.cjs +1 -1
  29. package/internal-mappings-config.mjs +1 -1
  30. package/{internal-CDY8g9Ic.d.mts → internal-o2M7FGlR.d.mts} +29 -1
  31. package/internal-sync-engine.cjs +1 -1
  32. package/internal-sync-engine.mjs +1 -1
  33. package/internal-view-compiler.cjs +1 -1
  34. package/internal-view-compiler.mjs +1 -1
  35. package/{internal-Da_dlcQ_.d.cts → internal-wCXSELDN.d.cts} +29 -1
  36. package/internal.cjs +11 -6
  37. package/internal.d.cts +2 -2
  38. package/internal.d.mts +2 -2
  39. package/internal.mjs +8 -7
  40. package/{mappings-config-B0RqFLxu.cjs → mappings-config-CLyEg0sf.cjs} +1 -1
  41. package/{mappings-config-B1b1HVBg.mjs → mappings-config-DQS_s4dg.mjs} +1 -1
  42. package/{namespace-probe-EYyxWZnf.d.cts → namespace-probe-BoGI18dQ.d.cts} +8 -0
  43. package/{namespace-probe-BmdGnYMn.d.mts → namespace-probe-Cn7voAd0.d.mts} +8 -0
  44. package/package.json +1 -1
  45. package/{projection-D7xmQP4S.mjs → projection-CSGJbZlZ.mjs} +25 -4
  46. package/{projection-C5244vGa.cjs → projection-Dz6_i1-w.cjs} +25 -4
  47. package/projection-sql-BgnfiGqF.mjs +65 -0
  48. package/projection-sql-Cl1qIn8m.cjs +94 -0
  49. package/{sdk-COLUHhJq.cjs → sdk-CM1UO-I7.cjs} +58 -15
  50. package/{sdk-CZNXBsgA.mjs → sdk-DYBDR939.mjs} +53 -16
  51. package/sdk.cjs +3 -2
  52. package/sdk.d.cts +5 -2
  53. package/sdk.d.mts +5 -2
  54. package/sdk.mjs +3 -3
  55. package/{sync-engine-abE94g6X.cjs → sync-engine-C4A5jgA4.cjs} +1 -1
  56. package/{sync-engine-SuxSzbZ4.mjs → sync-engine-Dt5QQSKO.mjs} +1 -1
  57. package/{view-compiler-Blu4OXJ7.cjs → view-compiler-B5nDal14.cjs} +21 -74
  58. package/{view-compiler-CQx8TRrW.mjs → view-compiler-CSYwEWf5.mjs} +2 -55
  59. package/vite.d.cts +1 -1
  60. package/vite.d.mts +1 -1
package/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { t as CANONICAL_FIELDS } from "./entity-config-kUHri9yA.mjs";
2
+ import { t as CANONICAL_FIELDS } from "./entity-config-B74SPOUZ.mjs";
3
3
  import "./mapping-score-C68uAqGB.mjs";
4
4
  import { matchesConcept, requiredFieldsFor, scoreFieldMap, scoreRelationships, suggestCursorField, toFieldMap } from "./internal-entity-heuristics.mjs";
5
- import { t as createClivlySDK } from "./sdk-CZNXBsgA.mjs";
5
+ import { s as isPlaceholderUrl, t as createClivlySDK } from "./sdk-DYBDR939.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";
@@ -291,10 +291,37 @@ function addCommand(pm, packages) {
291
291
  };
292
292
  }
293
293
  //#endregion
294
+ //#region src/tick-route.ts
295
+ /**
296
+ * The tick route's public URL path, and the template `clivly login` writes for
297
+ * it.
298
+ *
299
+ * Every framework the CLI scaffolds mounts the tick handler at the same URL —
300
+ * the *files* differ (`app/api/clivly/tick/route.ts`,
301
+ * `src/routes/api/clivly/tick.ts`, `app/routes/api.clivly.tick.ts`, …) but each
302
+ * one resolves to `/api/clivly/tick`. So this is a constant, not a per-framework
303
+ * lookup, and `clivly dev`, the generated config and the `.env` template can all
304
+ * read from one place instead of repeating the string and drifting.
305
+ */
306
+ const CLIVLY_TICK_PATH = "/api/clivly/tick";
307
+ /**
308
+ * What `clivly login` writes into `.env` for `CLIVLY_SYNC_TRIGGER_URL`.
309
+ *
310
+ * A visible template beats an empty line: the developer sees the shape they
311
+ * eventually need — a public origin plus the tick path — instead of an unhelpful
312
+ * `CLIVLY_SYNC_TRIGGER_URL=` they have to go and look up.
313
+ *
314
+ * It is safe to ship a truthy non-address here only because the SDK refuses to
315
+ * treat a bracketed value as configured (`isPlaceholderUrl` in
316
+ * `@clivly/sdk/trigger-url`). Change the brackets here and that guard stops
317
+ * matching, so the two must stay in step.
318
+ */
319
+ const TRIGGER_URL_PLACEHOLDER = `https://<yourDomain.com>${CLIVLY_TICK_PATH}`;
320
+ //#endregion
294
321
  //#region src/dev-tunnel.ts
295
322
  const CLOUDFLARE_QUICK_TUNNEL_REGEX = /https:\/\/[a-z0-9-]+\.trycloudflare\.com/;
296
323
  const DEFAULT_PORT = "3000";
297
- const DEFAULT_ROUTE_PATH = "/api/clivly/tick";
324
+ const DEFAULT_ROUTE_PATH = CLIVLY_TICK_PATH;
298
325
  function parseTunnelUrl(chunk) {
299
326
  const match = chunk.match(CLOUDFLARE_QUICK_TUNNEL_REGEX);
300
327
  return match ? match[0] : null;
@@ -946,7 +973,7 @@ function isKeySet(contents, key) {
946
973
  function appendEnvKeys(existing, entries) {
947
974
  const missing = entries.filter((e) => !hasKey$1(existing, e.key));
948
975
  if (missing.length === 0) return existing;
949
- const block = missing.map((e) => `${e.comment ? `# ${e.comment}\n` : ""}${e.key}=`).join("\n");
976
+ const block = missing.map((e) => `${e.comment ? `# ${e.comment}\n` : ""}${e.key}=${e.value ?? ""}`).join("\n");
950
977
  return `${existing}${existing.length > 0 && !existing.endsWith("\n") ? "\n" : ""}${existing.length > 0 ? "\n" : ""}# Clivly\n${block}\n`;
951
978
  }
952
979
  /**
@@ -1399,15 +1426,23 @@ async function confirmWorkspace(deps, credentials) {
1399
1426
  return await deps.confirm("Write this workspace's credentials to .env? [y/N] ");
1400
1427
  }
1401
1428
  function credentialEntries(credentials) {
1402
- return [{
1403
- key: SECRET_KEY_ENV,
1404
- value: credentials.apiKey,
1405
- comment: `Org secret key — ${CREDENTIALS_LOCATION}`
1406
- }, {
1407
- key: "CLIVLY_SYNC_TRIGGER_SECRET",
1408
- value: credentials.triggerSecret,
1409
- comment: `Signing secret — ${SYNC_SECRET_LOCATION}`
1410
- }];
1429
+ return [
1430
+ {
1431
+ key: SECRET_KEY_ENV,
1432
+ value: credentials.apiKey,
1433
+ comment: `Org secret key — ${CREDENTIALS_LOCATION}`
1434
+ },
1435
+ {
1436
+ key: "CLIVLY_SYNC_TRIGGER_SECRET",
1437
+ value: credentials.triggerSecret,
1438
+ comment: `Signing secret — ${SYNC_SECRET_LOCATION}`
1439
+ },
1440
+ {
1441
+ key: "CLIVLY_SYNC_TRIGGER_URL",
1442
+ value: TRIGGER_URL_PLACEHOLDER,
1443
+ comment: "Public URL of your tick route — replace <yourDomain.com> once deployed. Local dev: run `clivly dev` instead."
1444
+ }
1445
+ ];
1411
1446
  }
1412
1447
  function writeCredentials(options, credentials) {
1413
1448
  const { deps } = options;
@@ -1774,7 +1809,8 @@ const CLIVLY_ENV_KEYS = [
1774
1809
  },
1775
1810
  {
1776
1811
  key: "CLIVLY_SYNC_TRIGGER_URL",
1777
- comment: "Public URL of your mounted tick route (e.g. https://app.example.com/api/clivly/tick)"
1812
+ value: TRIGGER_URL_PLACEHOLDER,
1813
+ comment: "Public URL of your tick route — replace <yourDomain.com> once deployed. Local dev: run `clivly dev` instead."
1778
1814
  },
1779
1815
  {
1780
1816
  key: "CLIVLY_SYNC_TRIGGER_SECRET",
@@ -1872,7 +1908,13 @@ export default createClivlySDK({
1872
1908
  ${sources.join(",\n")},
1873
1909
  },
1874
1910
  syncTrigger: {
1875
- // The public URL Clivly Cloud calls to trigger a sync — your mounted tick route.
1911
+ // Where Clivly Cloud calls to start a sync — your mounted tick route.
1912
+ //
1913
+ // \`path\` lets the SDK build its own public URL from the hosting platform's
1914
+ // environment (VERCEL_URL, CF_PAGES_URL, RAILWAY_PUBLIC_DOMAIN,
1915
+ // RENDER_EXTERNAL_URL, FLY_APP_NAME), so on those platforms you never have
1916
+ // to set the URL by hand. \`url\` overrides that when you do.
1917
+ path: "${CLIVLY_TICK_PATH}",
1876
1918
  url: process.env.CLIVLY_SYNC_TRIGGER_URL,
1877
1919
  secret: process.env.CLIVLY_SYNC_TRIGGER_SECRET,
1878
1920
  },
@@ -2699,6 +2741,103 @@ function ladderExitCode(results) {
2699
2741
  return results.every((result) => result.state !== "fail" && result.state !== "pending") ? 0 : 1;
2700
2742
  }
2701
2743
  //#endregion
2744
+ //#region src/boot-hook-check.ts
2745
+ const REMIX_ENTRY_CANDIDATES = [
2746
+ "app/entry.server.tsx",
2747
+ "app/entry.server.ts",
2748
+ "app/entry.server.jsx",
2749
+ "app/entry.server.js"
2750
+ ];
2751
+ const NEXT_CONFIG_CANDIDATES = [
2752
+ "next.config.ts",
2753
+ "next.config.mjs",
2754
+ "next.config.js",
2755
+ "next.config.cjs",
2756
+ "next.config.mts"
2757
+ ];
2758
+ const CLIVLY_MENTION = /clivly/i;
2759
+ const INSTRUMENTATION_HOOK_ENABLED = /instrumentationHook\s*:\s*true/;
2760
+ /**
2761
+ * Where this framework's boot hook lives, most likely location first.
2762
+ *
2763
+ * The file-owning frameworks are asked of `boot-hook.ts` rather than restated,
2764
+ * so a path change there cannot leave this check hunting for a file `init` no
2765
+ * longer writes. The other two are patched into a file the app already owns.
2766
+ */
2767
+ function bootSiteCandidates(framework) {
2768
+ const owned = [bootHookPath(framework, "app"), bootHookPath(framework, "src/app")].filter((path) => path !== null);
2769
+ if (owned.length > 0) return [...new Set(owned)];
2770
+ if (framework === "tanstack-start") return [...VITE_CONFIG_CANDIDATES];
2771
+ if (framework === "remix") return REMIX_ENTRY_CANDIDATES;
2772
+ return [];
2773
+ }
2774
+ function declaredDeps(readFile) {
2775
+ const raw = readFile("package.json");
2776
+ if (raw === null) return null;
2777
+ try {
2778
+ const pkg = JSON.parse(raw);
2779
+ return {
2780
+ ...pkg.dependencies,
2781
+ ...pkg.devDependencies
2782
+ };
2783
+ } catch {
2784
+ return null;
2785
+ }
2786
+ }
2787
+ function findBootSite(readFile, framework) {
2788
+ for (const candidate of bootSiteCandidates(framework)) {
2789
+ const source = readFile(candidate);
2790
+ if (source !== null && CLIVLY_MENTION.test(source)) return candidate;
2791
+ }
2792
+ return null;
2793
+ }
2794
+ /**
2795
+ * On Next.js below 15 the hook file is ignored unless the flag is on, so a
2796
+ * present-and-correct instrumentation.ts is not evidence of anything. A missing
2797
+ * next.config is the same failure as one without the flag: either way nothing
2798
+ * switches the hook on.
2799
+ */
2800
+ function nextFlagVerdict(readFile, version, site) {
2801
+ if (!nextNeedsInstrumentationFlag(version)) return null;
2802
+ for (const candidate of NEXT_CONFIG_CANDIDATES) {
2803
+ const source = readFile(candidate);
2804
+ if (source !== null && INSTRUMENTATION_HOOK_ENABLED.test(source)) return null;
2805
+ }
2806
+ return {
2807
+ state: "broken",
2808
+ detail: `${site} exists, but Next.js ${version} ignores it — experimental.instrumentationHook is not enabled in next.config.`,
2809
+ hint: NEXT_INSTRUMENTATION_FLAG_STEP
2810
+ };
2811
+ }
2812
+ function checkBootHook(readFile) {
2813
+ const deps = declaredDeps(readFile);
2814
+ if (deps === null) return {
2815
+ state: "unknown",
2816
+ detail: "package.json not readable — cannot tell how this app boots."
2817
+ };
2818
+ const framework = detectFramework(deps);
2819
+ if (framework === "unknown") return {
2820
+ state: "unknown",
2821
+ detail: "No supported framework detected, so there is no known place to check."
2822
+ };
2823
+ const label = FRAMEWORK_LABELS[framework];
2824
+ const site = findBootSite(readFile, framework);
2825
+ if (site === null) return {
2826
+ state: "broken",
2827
+ detail: `No Clivly boot hook found in this ${label} app.`,
2828
+ hint: `Nothing starts the SDK, so your app never tells Clivly it is running — the dashboard stays silent with no error anywhere. Run \`clivly init\` to scaffold it, or call \`clivly.start()\` where your server boots (${bootSiteCandidates(framework)[0]}).`
2829
+ };
2830
+ const nextVersion = deps.next;
2831
+ if (framework === "nextjs" && nextVersion) {
2832
+ const broken = nextFlagVerdict(readFile, nextVersion, site);
2833
+ if (broken) return broken;
2834
+ }
2835
+ return {
2836
+ state: "ok",
2837
+ detail: site
2838
+ };
2839
+ }
2840
+ //#endregion
2702
2841
  //#region src/edge-safety.ts
2703
2842
  const NODE_BUILTINS = /* @__PURE__ */ new Set([
2704
2843
  "assert",
@@ -2885,7 +3024,7 @@ function pingOnce(ctx) {
2885
3024
  }
2886
3025
  const REASON_HINT = {
2887
3026
  ok: "",
2888
- invalid_api_key: "The key was rejected (401). Check CLIVLY_SECRET_KEY (or legacy CLIVLY_API_KEY).",
3027
+ invalid_api_key: "The key was rejected (401). Run `clivly login` to re-pair and rewrite the credentials, and check CLIVLY_SECRET_KEY (or legacy CLIVLY_API_KEY) belongs to the org whose dashboard you are watching.",
2889
3028
  forbidden: "The key is valid but lacks access to this org (403).",
2890
3029
  rate_limited: "Rate limited (429). Wait a moment and retry.",
2891
3030
  server_error: "Clivly returned a server error (5xx). Retry shortly.",
@@ -2985,14 +3124,15 @@ const triggerUrlStage = {
2985
3124
  needs: [configStage.id],
2986
3125
  run(ctx) {
2987
3126
  const url = ctx.sdk?.syncTrigger?.url;
2988
- if (url) return Promise.resolve({
3127
+ if (url && !isPlaceholderUrl(url)) return Promise.resolve({
2989
3128
  state: "pass",
2990
3129
  detail: url
2991
3130
  });
3131
+ const isPlaceholder = url !== void 0;
2992
3132
  return Promise.resolve({
2993
3133
  state: "warn",
2994
- detail: "Not set — remote sync cannot call back into this app.",
2995
- hint: "Set CLIVLY_SYNC_TRIGGER_URL once the app is deployed. For local development run `clivly dev` — it opens a tunnel and registers the URL for you. Push-only setups can ignore this."
3134
+ detail: isPlaceholder ? `Still the placeholder (${url}) — remote sync cannot call back into this app.` : "Not set — remote sync cannot call back into this app.",
3135
+ hint: "Replace <yourDomain.com> with your deployed origin, or delete the line — on Vercel, Cloudflare Pages, Railway, Render and Fly the SDK derives the URL from the platform. For local development run `clivly dev`: it opens a tunnel and registers the URL for you, outranking whatever is in .env. Push-only setups can ignore this."
2996
3136
  });
2997
3137
  }
2998
3138
  };
@@ -3040,6 +3180,24 @@ const STATUS_STAGES = [
3040
3180
  });
3041
3181
  }
3042
3182
  },
3183
+ {
3184
+ id: "boot-hook",
3185
+ label: "Boot hook wired",
3186
+ run(ctx) {
3187
+ const read = ctx.readConfigSource ?? defaultReadConfigSource;
3188
+ const root = dirname(ctx.configPath);
3189
+ const verdict = checkBootHook((relative) => read(resolve(root, relative)));
3190
+ if (verdict.state === "ok") return Promise.resolve({
3191
+ state: "pass",
3192
+ detail: `starts Clivly from ${verdict.detail}`
3193
+ });
3194
+ return Promise.resolve({
3195
+ state: verdict.state === "unknown" ? "skip" : "fail",
3196
+ detail: verdict.detail,
3197
+ hint: verdict.hint
3198
+ });
3199
+ }
3200
+ },
3043
3201
  sdkChecksStage,
3044
3202
  triggerUrlStage
3045
3203
  ];
@@ -3093,6 +3251,7 @@ const ALIAS_STAGE_IDS = {
3093
3251
  doctor: [
3094
3252
  "config",
3095
3253
  "runtime",
3254
+ "boot-hook",
3096
3255
  "setup-checks"
3097
3256
  ],
3098
3257
  connect: [
@@ -3546,8 +3705,8 @@ function previewMutations(deps, mutations, options) {
3546
3705
  function printNextSteps(out, authComplete, loginRan, envFile) {
3547
3706
  out("\nNext steps:\n");
3548
3707
  out(loginRan ? " 1. Credentials written by `clivly login`\n" : ` 1. Add CLIVLY_SECRET_KEY to ${envFile} — create one at\n ${CREDENTIALS_LOCATION}\n (the legacy CLIVLY_API_KEY is still accepted)\n`);
3549
- out(" 2. Set CLIVLY_SYNC_TRIGGER_URL to your public tick route\n");
3550
- out(" Local dev? Run `clivly dev` to open a tunnel, or skip this step until you deploy (remote sync is deploy-only locally).\n");
3708
+ out(" 2. Local dev: run `clivly dev` for dashboard-triggered sync\n");
3709
+ out(" It tunnels your app and registers the URL for you — remote sync is\n deploy-only otherwise, so nothing is broken if you skip it. Once deployed\n to Vercel/Cloudflare/Railway/Render/Fly the URL is detected automatically;\n set CLIVLY_SYNC_TRIGGER_URL by hand only for a custom domain.\n");
3551
3710
  const step = authComplete ? 3 : 4;
3552
3711
  if (!authComplete) out(" 3. Finish resolveUser in the auth/verify route\n");
3553
3712
  out(` ${step}. Run \`clivly status\` to see where you are\n`);
@@ -1,5 +1,5 @@
1
- import { n as PROJECTION_KEY_PATTERN, t as BASE_REF } from "./projection-D7xmQP4S.mjs";
2
- import { h as fanOutJoins, m as validateProjection } from "./entity-config-kUHri9yA.mjs";
1
+ import { n as PROJECTION_KEY_PATTERN, t as BASE_REF } from "./projection-CSGJbZlZ.mjs";
2
+ import { h as fanOutJoins, m as validateProjection } from "./entity-config-B74SPOUZ.mjs";
3
3
  //#region ../core/src/projection-draft.ts
4
4
  function emptyProjectionDraft(baseTable) {
5
5
  return {
@@ -1,5 +1,5 @@
1
- const require_projection = require("./projection-C5244vGa.cjs");
2
- const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
1
+ const require_projection = require("./projection-Dz6_i1-w.cjs");
2
+ const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
3
3
  //#region ../core/src/projection-draft.ts
4
4
  function emptyProjectionDraft(baseTable) {
5
5
  return {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
2
+ const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
3
3
  exports.CANONICAL_FIELDS = require_entity_config.CANONICAL_FIELDS;
4
4
  exports.CRM_CONCEPTS = require_entity_config.CRM_CONCEPTS;
5
5
  exports.CUSTOM_CONCEPT = require_entity_config.CUSTOM_CONCEPT;
@@ -1,2 +1,2 @@
1
- import { a as MATERIALIZING_CONCEPTS, c as entitiesConfigSchema, d as relationshipSchema, f as relationshipsSchema, i as ClivlyConfigError, l as filterSchema, n as CRM_CONCEPTS, o as customObjectDeclarations, p as validateEntitiesConfig, r as CUSTOM_CONCEPT, s as defineClivlyConfig, t as CANONICAL_FIELDS, u as projectionFields } from "./entity-config-kUHri9yA.mjs";
1
+ import { a as MATERIALIZING_CONCEPTS, c as entitiesConfigSchema, d as relationshipSchema, f as relationshipsSchema, i as ClivlyConfigError, l as filterSchema, n as CRM_CONCEPTS, o as customObjectDeclarations, p as validateEntitiesConfig, r as CUSTOM_CONCEPT, s as defineClivlyConfig, t as CANONICAL_FIELDS, u as projectionFields } from "./entity-config-B74SPOUZ.mjs";
2
2
  export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, MATERIALIZING_CONCEPTS, customObjectDeclarations, defineClivlyConfig, entitiesConfigSchema, filterSchema, projectionFields, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
2
+ const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
3
3
  const require_mapping_score = require("./mapping-score-CaB3F4Uu.cjs");
4
4
  //#region ../core/src/entity-heuristics.ts
5
5
  const TARGET_CONCEPTS = [
@@ -1,4 +1,4 @@
1
- import { a as MATERIALIZING_CONCEPTS } from "./entity-config-kUHri9yA.mjs";
1
+ import { a as MATERIALIZING_CONCEPTS } from "./entity-config-B74SPOUZ.mjs";
2
2
  import { a as W, c as isTextLike, i as RELATIONSHIP_TIERS, l as isTimestampLike, n as CONCEPT_TIERS, o as isAmbiguous, r as FIELD_TIERS, s as isNumericLike, u as tierFor } from "./mapping-score-C68uAqGB.mjs";
3
3
  //#region ../core/src/entity-heuristics.ts
4
4
  const TARGET_CONCEPTS = [
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mappings_config = require("./mappings-config-B0RqFLxu.cjs");
2
+ const require_mappings_config = require("./mappings-config-CLyEg0sf.cjs");
3
3
  exports.entitiesToMappings = require_mappings_config.entitiesToMappings;
4
4
  exports.mappingsToEntitiesConfig = require_mappings_config.mappingsToEntitiesConfig;
@@ -1,2 +1,2 @@
1
- import { n as mappingsToEntitiesConfig, t as entitiesToMappings } from "./mappings-config-B1b1HVBg.mjs";
1
+ import { n as mappingsToEntitiesConfig, t as entitiesToMappings } from "./mappings-config-DQS_s4dg.mjs";
2
2
  export { entitiesToMappings, mappingsToEntitiesConfig };
@@ -36,6 +36,34 @@ declare function describeCardinality(draft: ProjectionDraft, schema: DiscoveredS
36
36
  joinKey: string;
37
37
  }>;
38
38
  //#endregion
39
+ //#region ../core/src/projection-sql.d.ts
40
+ /**
41
+ * SQL generation for projection-backed entities.
42
+ *
43
+ * Base and joins are aliased by their ref key (`base`, then each join's `key`),
44
+ * which is what allows the same table to be joined twice and keeps generated
45
+ * SQL independent of host table names.
46
+ *
47
+ * Pure string generation — no DB access. Identifiers are escaped so output is
48
+ * deterministic and injection-safe.
49
+ */
50
+ /** Quote a single identifier part, escaping embedded double-quotes. */
51
+ declare function quoteIdent(name: string): string;
52
+ /**
53
+ * The identity expression. Composite identities concatenate their parts with
54
+ * `::`; validation guarantees every part is NOT NULL and non-text, which is
55
+ * what makes the concatenation collision-free.
56
+ *
57
+ * Exported unaliased because two paths need the same expression under different
58
+ * names: the view compiler aliases it `id`, and the SDK's projection push source
59
+ * also orders and keyset-paginates by it. Sharing one definition is what keeps
60
+ * a pushed row's `id` identical to the one the view would have produced.
61
+ */
62
+ declare function compileProjectionIdentity(projection: ProjectionMapping, basePkColumn: string): string;
63
+ declare function compileProjectionJoins(projection: ProjectionMapping): string[];
64
+ /** `FROM <baseTable> AS "base"` — the alias every ref resolves against. */
65
+ declare function compileProjectionFrom(projection: ProjectionMapping): string;
66
+ //#endregion
39
67
  //#region ../core/src/projection-validate.d.ts
40
68
  /**
41
69
  * Validate a projection against the discovered schema. Returns every error
@@ -69,4 +97,4 @@ declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]
69
97
  /** Is this table's payload rich enough to validate a projection against? */
70
98
  declare function hasRichMeta(table: DiscoveredSchemaTable): boolean;
71
99
  //#endregion
72
- export { validateProjection as a, draftErrors as c, suggestJoinConditions as d, fanOutJoins as f, primaryKeyColumns as i, draftToProjection as l, coversUniqueKey as n, ProjectionDraft as o, joinFansOut as p, hasRichMeta as r, describeCardinality as s, columnMetaFor as t, emptyProjectionDraft as u };
100
+ export { joinFansOut as _, validateProjection as a, compileProjectionJoins as c, describeCardinality as d, draftErrors as f, fanOutJoins as g, suggestJoinConditions as h, primaryKeyColumns as i, quoteIdent as l, emptyProjectionDraft as m, coversUniqueKey as n, compileProjectionFrom as o, draftToProjection as p, hasRichMeta as r, compileProjectionIdentity as s, columnMetaFor as t, ProjectionDraft as u };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sync_engine = require("./sync-engine-abE94g6X.cjs");
2
+ const require_sync_engine = require("./sync-engine-C4A5jgA4.cjs");
3
3
  exports.computeSampleWarnings = require_sync_engine.computeSampleWarnings;
4
4
  exports.previewSync = require_sync_engine.previewSync;
5
5
  exports.reconcile = require_sync_engine.reconcile;
@@ -1,2 +1,2 @@
1
- import { i as runSync, n as previewSync, r as reconcile, t as computeSampleWarnings } from "./sync-engine-SuxSzbZ4.mjs";
1
+ import { i as runSync, n as previewSync, r as reconcile, t as computeSampleWarnings } from "./sync-engine-Dt5QQSKO.mjs";
2
2
  export { computeSampleWarnings, previewSync, reconcile, runSync };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_view_compiler = require("./view-compiler-Blu4OXJ7.cjs");
2
+ const require_view_compiler = require("./view-compiler-B5nDal14.cjs");
3
3
  exports.DEFAULT_VIEW_PREFIX = require_view_compiler.DEFAULT_VIEW_PREFIX;
4
4
  exports.compileEntityView = require_view_compiler.compileEntityView;
5
5
  exports.compileEntityViews = require_view_compiler.compileEntityViews;
@@ -1,2 +1,2 @@
1
- import { a as explainViewExecutionError, i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-CQx8TRrW.mjs";
1
+ import { a as explainViewExecutionError, i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-CSYwEWf5.mjs";
2
2
  export { DEFAULT_VIEW_PREFIX, compileEntityView, compileEntityViews, explainEntitiesConfig, explainViewExecutionError };
@@ -36,6 +36,34 @@ declare function describeCardinality(draft: ProjectionDraft, schema: DiscoveredS
36
36
  joinKey: string;
37
37
  }>;
38
38
  //#endregion
39
+ //#region ../core/src/projection-sql.d.ts
40
+ /**
41
+ * SQL generation for projection-backed entities.
42
+ *
43
+ * Base and joins are aliased by their ref key (`base`, then each join's `key`),
44
+ * which is what allows the same table to be joined twice and keeps generated
45
+ * SQL independent of host table names.
46
+ *
47
+ * Pure string generation — no DB access. Identifiers are escaped so output is
48
+ * deterministic and injection-safe.
49
+ */
50
+ /** Quote a single identifier part, escaping embedded double-quotes. */
51
+ declare function quoteIdent(name: string): string;
52
+ /**
53
+ * The identity expression. Composite identities concatenate their parts with
54
+ * `::`; validation guarantees every part is NOT NULL and non-text, which is
55
+ * what makes the concatenation collision-free.
56
+ *
57
+ * Exported unaliased because two paths need the same expression under different
58
+ * names: the view compiler aliases it `id`, and the SDK's projection push source
59
+ * also orders and keyset-paginates by it. Sharing one definition is what keeps
60
+ * a pushed row's `id` identical to the one the view would have produced.
61
+ */
62
+ declare function compileProjectionIdentity(projection: ProjectionMapping, basePkColumn: string): string;
63
+ declare function compileProjectionJoins(projection: ProjectionMapping): string[];
64
+ /** `FROM <baseTable> AS "base"` — the alias every ref resolves against. */
65
+ declare function compileProjectionFrom(projection: ProjectionMapping): string;
66
+ //#endregion
39
67
  //#region ../core/src/projection-validate.d.ts
40
68
  /**
41
69
  * Validate a projection against the discovered schema. Returns every error
@@ -69,4 +97,4 @@ declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]
69
97
  /** Is this table's payload rich enough to validate a projection against? */
70
98
  declare function hasRichMeta(table: DiscoveredSchemaTable): boolean;
71
99
  //#endregion
72
- export { validateProjection as a, draftErrors as c, suggestJoinConditions as d, fanOutJoins as f, primaryKeyColumns as i, draftToProjection as l, coversUniqueKey as n, ProjectionDraft as o, joinFansOut as p, hasRichMeta as r, describeCardinality as s, columnMetaFor as t, emptyProjectionDraft as u };
100
+ export { joinFansOut as _, validateProjection as a, compileProjectionJoins as c, describeCardinality as d, draftErrors as f, fanOutJoins as g, suggestJoinConditions as h, primaryKeyColumns as i, quoteIdent as l, emptyProjectionDraft as m, coversUniqueKey as n, compileProjectionFrom as o, draftToProjection as p, hasRichMeta as r, compileProjectionIdentity as s, columnMetaFor as t, ProjectionDraft as u };
package/internal.cjs CHANGED
@@ -1,12 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_projection = require("./projection-C5244vGa.cjs");
3
- const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
4
- const require_mappings_config = require("./mappings-config-B0RqFLxu.cjs");
2
+ const require_projection = require("./projection-Dz6_i1-w.cjs");
3
+ const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
4
+ const require_mappings_config = require("./mappings-config-CLyEg0sf.cjs");
5
5
  const require_auth_adapter = require("./auth-adapter-CiEXcweZ.cjs");
6
6
  const require_mapping_form = require("./mapping-form-BpfON_ME.cjs");
7
- const require_internal = require("./internal-CwnEG6Wl.cjs");
8
- const require_view_compiler = require("./view-compiler-Blu4OXJ7.cjs");
9
- const require_sync_engine = require("./sync-engine-abE94g6X.cjs");
7
+ const require_internal = require("./internal-DqduZU3l.cjs");
8
+ const require_projection_sql = require("./projection-sql-Cl1qIn8m.cjs");
9
+ const require_view_compiler = require("./view-compiler-B5nDal14.cjs");
10
+ const require_sync_engine = require("./sync-engine-C4A5jgA4.cjs");
10
11
  exports.BASE_REF = require_projection.BASE_REF;
11
12
  exports.CANONICAL_FIELDS = require_entity_config.CANONICAL_FIELDS;
12
13
  exports.CRM_CONCEPTS = require_entity_config.CRM_CONCEPTS;
@@ -19,6 +20,9 @@ exports.buildRelationships = require_mapping_form.buildRelationships;
19
20
  exports.columnMetaFor = require_entity_config.columnMetaFor;
20
21
  exports.compileEntityView = require_view_compiler.compileEntityView;
21
22
  exports.compileEntityViews = require_view_compiler.compileEntityViews;
23
+ exports.compileProjectionFrom = require_projection_sql.compileProjectionFrom;
24
+ exports.compileProjectionIdentity = require_projection_sql.compileProjectionIdentity;
25
+ exports.compileProjectionJoins = require_projection_sql.compileProjectionJoins;
22
26
  exports.coversUniqueKey = require_entity_config.coversUniqueKey;
23
27
  exports.defineClivlyConfig = require_entity_config.defineClivlyConfig;
24
28
  exports.describeCardinality = require_internal.describeCardinality;
@@ -35,6 +39,7 @@ exports.joinFansOut = require_entity_config.joinFansOut;
35
39
  exports.mappingsToEntitiesConfig = require_mappings_config.mappingsToEntitiesConfig;
36
40
  exports.primaryKeyColumns = require_entity_config.primaryKeyColumns;
37
41
  exports.projectionSchema = require_projection.projectionSchema;
42
+ exports.quoteIdent = require_projection_sql.quoteIdent;
38
43
  exports.reconcile = require_sync_engine.reconcile;
39
44
  exports.relationshipSchema = require_entity_config.relationshipSchema;
40
45
  exports.relationshipViaSignature = require_mapping_form.relationshipViaSignature;
package/internal.d.cts CHANGED
@@ -7,5 +7,5 @@ import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings
7
7
  import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-CmEdAMwj.cjs";
8
8
  import { c as SyncResult, f as reconcile, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult } from "./sync-engine-BG2O1an2.cjs";
9
9
  import { a as IntegrationStep, c as StepProblem, i as IntegrationStatus, l as StepState, n as IntegrationFacts, o as NextAction, r as IntegrationState, s as StepId, t as ConnectionLiveness } from "./integration-state-BK-riZnm.cjs";
10
- import { a as validateProjection, c as draftErrors, d as suggestJoinConditions, f as fanOutJoins, i as primaryKeyColumns, l as draftToProjection, n as coversUniqueKey, o as ProjectionDraft, p as joinFansOut, r as hasRichMeta, s as describeCardinality, t as columnMetaFor, u as emptyProjectionDraft } from "./internal-Da_dlcQ_.cjs";
11
- export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompileOptions, type CompiledView, type ConfigValidationError, type ConfigValidationResult, type ConnectionLiveness, type Contact, type ContactFilters, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type ExplainResult, type FilterExpr, type FilterValue, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, type PersistAction, type ProjectionDraft, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type StepId, type StepProblem, type StepState, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
10
+ import { _ as joinFansOut, a as validateProjection, c as compileProjectionJoins, d as describeCardinality, f as draftErrors, g as fanOutJoins, h as suggestJoinConditions, i as primaryKeyColumns, l as quoteIdent, m as emptyProjectionDraft, n as coversUniqueKey, o as compileProjectionFrom, p as draftToProjection, r as hasRichMeta, s as compileProjectionIdentity, t as columnMetaFor, u as ProjectionDraft } from "./internal-wCXSELDN.cjs";
11
+ export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompileOptions, type CompiledView, type ConfigValidationError, type ConfigValidationResult, type ConnectionLiveness, type Contact, type ContactFilters, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type ExplainResult, type FilterExpr, type FilterValue, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, type PersistAction, type ProjectionDraft, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type StepId, type StepProblem, type StepState, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
package/internal.d.mts CHANGED
@@ -7,5 +7,5 @@ import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings
7
7
  import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-Bo7pqXW3.mjs";
8
8
  import { c as SyncResult, f as reconcile, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult } from "./sync-engine-DgQbrJON.mjs";
9
9
  import { a as IntegrationStep, c as StepProblem, i as IntegrationStatus, l as StepState, n as IntegrationFacts, o as NextAction, r as IntegrationState, s as StepId, t as ConnectionLiveness } from "./integration-state-BK-riZnm.mjs";
10
- import { a as validateProjection, c as draftErrors, d as suggestJoinConditions, f as fanOutJoins, i as primaryKeyColumns, l as draftToProjection, n as coversUniqueKey, o as ProjectionDraft, p as joinFansOut, r as hasRichMeta, s as describeCardinality, t as columnMetaFor, u as emptyProjectionDraft } from "./internal-CDY8g9Ic.mjs";
11
- export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompileOptions, type CompiledView, type ConfigValidationError, type ConfigValidationResult, type ConnectionLiveness, type Contact, type ContactFilters, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type ExplainResult, type FilterExpr, type FilterValue, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, type PersistAction, type ProjectionDraft, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type StepId, type StepProblem, type StepState, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
10
+ import { _ as joinFansOut, a as validateProjection, c as compileProjectionJoins, d as describeCardinality, f as draftErrors, g as fanOutJoins, h as suggestJoinConditions, i as primaryKeyColumns, l as quoteIdent, m as emptyProjectionDraft, n as coversUniqueKey, o as compileProjectionFrom, p as draftToProjection, r as hasRichMeta, s as compileProjectionIdentity, t as columnMetaFor, u as ProjectionDraft } from "./internal-o2M7FGlR.mjs";
11
+ export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompileOptions, type CompiledView, type ConfigValidationError, type ConfigValidationResult, type ConnectionLiveness, type Contact, type ContactFilters, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type ExplainResult, type FilterExpr, type FilterValue, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, type PersistAction, type ProjectionDraft, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type StepId, type StepProblem, type StepState, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
package/internal.mjs CHANGED
@@ -1,9 +1,10 @@
1
- import { i as projectionSchema, r as identityRefs, t as BASE_REF } from "./projection-D7xmQP4S.mjs";
2
- import { _ as columnMetaFor, a as MATERIALIZING_CONCEPTS, b as primaryKeyColumns, c as entitiesConfigSchema, d as relationshipSchema, f as relationshipsSchema, g as joinFansOut, h as fanOutJoins, i as ClivlyConfigError, l as filterSchema, m as validateProjection, n as CRM_CONCEPTS, p as validateEntitiesConfig, s as defineClivlyConfig, t as CANONICAL_FIELDS, v as coversUniqueKey, y as hasRichMeta } from "./entity-config-kUHri9yA.mjs";
3
- import { n as mappingsToEntitiesConfig } from "./mappings-config-B1b1HVBg.mjs";
1
+ import { i as projectionSchema, r as identityRefs, t as BASE_REF } from "./projection-CSGJbZlZ.mjs";
2
+ import { _ as columnMetaFor, a as MATERIALIZING_CONCEPTS, b as primaryKeyColumns, c as entitiesConfigSchema, d as relationshipSchema, f as relationshipsSchema, g as joinFansOut, h as fanOutJoins, i as ClivlyConfigError, l as filterSchema, m as validateProjection, n as CRM_CONCEPTS, p as validateEntitiesConfig, s as defineClivlyConfig, t as CANONICAL_FIELDS, v as coversUniqueKey, y as hasRichMeta } from "./entity-config-B74SPOUZ.mjs";
3
+ import { n as mappingsToEntitiesConfig } from "./mappings-config-DQS_s4dg.mjs";
4
4
  import { t as authCustom } from "./auth-adapter-gfVDxf3d.mjs";
5
5
  import { n as buildRelationships, r as relationshipViaSignature, t as buildFilterFromDiscriminator } from "./mapping-form-DigkuvFc.mjs";
6
- import { a as suggestJoinConditions, i as emptyProjectionDraft, n as draftErrors, r as draftToProjection, t as describeCardinality } from "./internal-Df-PtOH_.mjs";
7
- import { i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-CQx8TRrW.mjs";
8
- import { i as runSync, r as reconcile } from "./sync-engine-SuxSzbZ4.mjs";
9
- export { BASE_REF, CANONICAL_FIELDS, CRM_CONCEPTS, ClivlyConfigError, DEFAULT_VIEW_PREFIX, MATERIALIZING_CONCEPTS, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
6
+ import { a as suggestJoinConditions, i as emptyProjectionDraft, n as draftErrors, r as draftToProjection, t as describeCardinality } from "./internal-CykXpEGk.mjs";
7
+ import { a as quoteIdent, n as compileProjectionIdentity, r as compileProjectionJoins, t as compileProjectionFrom } from "./projection-sql-BgnfiGqF.mjs";
8
+ import { i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-CSYwEWf5.mjs";
9
+ import { i as runSync, r as reconcile } from "./sync-engine-Dt5QQSKO.mjs";
10
+ export { BASE_REF, CANONICAL_FIELDS, CRM_CONCEPTS, ClivlyConfigError, DEFAULT_VIEW_PREFIX, MATERIALIZING_CONCEPTS, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
@@ -1,4 +1,4 @@
1
- const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
1
+ const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
2
2
  //#region ../core/src/mappings-config.ts
3
3
  const RESERVED_FIELD = "id";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as CANONICAL_FIELDS } from "./entity-config-kUHri9yA.mjs";
1
+ import { t as CANONICAL_FIELDS } from "./entity-config-B74SPOUZ.mjs";
2
2
  //#region ../core/src/mappings-config.ts
3
3
  const RESERVED_FIELD = "id";
4
4
  /**
@@ -324,6 +324,14 @@ interface SyncSource {
324
324
  }): Promise<Record<string, unknown>[]>;
325
325
  /** Stable, unique tie-breaker column for keyset paging. Defaults to "id". */
326
326
  idField?: string;
327
+ /**
328
+ * Custom-object slug this source mirrors into. Only meaningful for entries in
329
+ * `source.custom`, whose element type narrows it to required — declared here
330
+ * because the sync and readiness paths read `source.objectType` off a plain
331
+ * `SyncSource`, so leaving it off left the property required by one type,
332
+ * absent from another, and read by the runtime.
333
+ */
334
+ objectType?: string;
327
335
  /** Set by `fromDrizzle`; lets `doctor` introspect the backing table. */
328
336
  [DRIZZLE_META]?: DrizzleSourceMeta;
329
337
  }
@@ -324,6 +324,14 @@ interface SyncSource {
324
324
  }): Promise<Record<string, unknown>[]>;
325
325
  /** Stable, unique tie-breaker column for keyset paging. Defaults to "id". */
326
326
  idField?: string;
327
+ /**
328
+ * Custom-object slug this source mirrors into. Only meaningful for entries in
329
+ * `source.custom`, whose element type narrows it to required — declared here
330
+ * because the sync and readiness paths read `source.objectType` off a plain
331
+ * `SyncSource`, so leaving it off left the property required by one type,
332
+ * absent from another, and read by the runtime.
333
+ */
334
+ objectType?: string;
327
335
  /** Set by `fromDrizzle`; lets `doctor` introspect the backing table. */
328
336
  [DRIZZLE_META]?: DrizzleSourceMeta;
329
337
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clivly",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Clivly CLI — scaffold a CRM into your app (clivly init).",