clivly 0.9.4 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -6
- package/core-entity-config.cjs +1 -1
- package/core-entity-config.mjs +1 -1
- package/core-mappings-config.cjs +1 -1
- package/core-mappings-config.mjs +1 -1
- package/core-sync-engine.cjs +1 -1
- package/core-sync-engine.mjs +1 -1
- package/core-view-compiler.cjs +1 -1
- package/core-view-compiler.mjs +1 -1
- package/core.cjs +13 -7
- package/core.d.cts +2 -2
- package/core.d.mts +2 -2
- package/core.mjs +8 -8
- package/drizzle.cjs +19 -2
- package/drizzle.d.cts +1 -1
- package/drizzle.d.mts +1 -1
- package/drizzle.mjs +19 -2
- package/{entity-config-B74SPOUZ.mjs → entity-config-CusbTOJ1.mjs} +1 -1
- package/{entity-config-7sGCk_nw.cjs → entity-config-DE30_RpU.cjs} +1 -1
- package/index.cjs +129 -11
- package/index.mjs +129 -11
- package/internal-BQ47iN6f.cjs +259 -0
- package/internal-ChufvXE6.mjs +212 -0
- package/{internal-o2M7FGlR.d.mts → internal-CvlFk3KC.d.mts} +82 -2
- package/{internal-wCXSELDN.d.cts → internal-DGUOLQAq.d.cts} +82 -2
- package/internal-entity-config.cjs +1 -1
- package/internal-entity-config.mjs +1 -1
- package/internal-entity-heuristics.cjs +1 -1
- package/internal-entity-heuristics.mjs +1 -1
- package/internal-mappings-config.cjs +1 -1
- package/internal-mappings-config.mjs +1 -1
- package/internal-sync-engine.cjs +1 -1
- package/internal-sync-engine.mjs +1 -1
- package/internal-view-compiler.cjs +1 -1
- package/internal-view-compiler.mjs +1 -1
- package/internal.cjs +13 -7
- package/internal.d.cts +2 -2
- package/internal.d.mts +2 -2
- package/internal.mjs +8 -8
- package/{mappings-config-DQS_s4dg.mjs → mappings-config-7qQ47p9K.mjs} +1 -1
- package/{mappings-config-CLyEg0sf.cjs → mappings-config-CjCmT-aU.cjs} +1 -1
- package/{namespace-probe-Cn7voAd0.d.mts → namespace-probe-Ckn9yJ6F.d.mts} +45 -2
- package/{namespace-probe-BoGI18dQ.d.cts → namespace-probe-DaTJINS-.d.cts} +45 -2
- package/package.json +1 -1
- package/{projection-Dz6_i1-w.cjs → projection-DEwL-D8R.cjs} +6 -0
- package/{projection-CSGJbZlZ.mjs → projection-hnPSgH6G.mjs} +1 -1
- package/{projection-sql-BgnfiGqF.mjs → projection-sql-9zzTVGvf.mjs} +34 -2
- package/{projection-sql-Cl1qIn8m.cjs → projection-sql-iHy-Cx6V.cjs} +45 -1
- package/{sdk-DYBDR939.mjs → sdk-Dkq6ELkf.mjs} +32 -8
- package/{sdk-CM1UO-I7.cjs → sdk-w8Kv_XnW.cjs} +32 -8
- package/sdk.cjs +2 -2
- package/sdk.d.cts +2 -2
- package/sdk.d.mts +2 -2
- package/sdk.mjs +2 -2
- package/{sync-engine-C4A5jgA4.cjs → sync-engine-BLgwLpR6.cjs} +1 -1
- package/{sync-engine-Dt5QQSKO.mjs → sync-engine-B_IzoUSx.mjs} +1 -1
- package/{view-compiler-B5nDal14.cjs → view-compiler-BHI5E4QI.cjs} +2 -2
- package/{view-compiler-CSYwEWf5.mjs → view-compiler-D_6gfXFr.mjs} +2 -2
- package/vite.d.cts +1 -1
- package/vite.d.mts +1 -1
- package/internal-CykXpEGk.mjs +0 -68
- package/internal-DqduZU3l.cjs +0 -97
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as identityRefs, t as BASE_REF } from "./projection-hnPSgH6G.mjs";
|
|
2
2
|
//#region ../core/src/projection-sql.ts
|
|
3
3
|
/**
|
|
4
4
|
* SQL generation for projection-backed entities.
|
|
@@ -61,5 +61,37 @@ function compileProjectionJoins(projection) {
|
|
|
61
61
|
function compileProjectionFrom(projection) {
|
|
62
62
|
return `FROM ${quoteIdent(projection.baseTable)} AS ${quoteIdent(BASE_REF)}`;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Hard ceiling on preview rows, regardless of what a caller asks for.
|
|
66
|
+
*
|
|
67
|
+
* A preview runs against a production database from a button a user can click
|
|
68
|
+
* as often as they like, so the cap belongs beside the query rather than in
|
|
69
|
+
* whichever caller happens to be passing a limit today.
|
|
70
|
+
*/
|
|
71
|
+
const PREVIEW_MAX_ROWS = 50;
|
|
72
|
+
/**
|
|
73
|
+
* One SELECT reading a few rows through an UNSAVED projection, for the derived
|
|
74
|
+
* object builder's preview.
|
|
75
|
+
*
|
|
76
|
+
* Lives here, beside the view compiler, because both sides of the round trip
|
|
77
|
+
* need the identical statement: an embedded org runs it against its own
|
|
78
|
+
* database from `@clivly.com/api`, and a cloud org's host app runs it from
|
|
79
|
+
* `@clivly/sdk`. Two copies would be free to disagree about what the user is
|
|
80
|
+
* being shown, which is the whole value of a preview.
|
|
81
|
+
*
|
|
82
|
+
* Columns are aliased by FIELD NAME, not by ref token. That is the deliberate
|
|
83
|
+
* difference from the push source, which aliases by token because cloud ingest
|
|
84
|
+
* reads `row[token]`; a preview is read by a person, in a table whose headers
|
|
85
|
+
* are the field names they just typed.
|
|
86
|
+
*/
|
|
87
|
+
function compileProjectionPreview(projection, limit) {
|
|
88
|
+
const { selectItems } = compileProjectionSelect(projection, projection.identity.kind === "base_pk" ? projection.identity.column ?? "id" : "id");
|
|
89
|
+
return [
|
|
90
|
+
`SELECT ${selectItems.join(", ")}`,
|
|
91
|
+
compileProjectionFrom(projection),
|
|
92
|
+
...compileProjectionJoins(projection),
|
|
93
|
+
`LIMIT ${Math.max(1, Math.min(Math.floor(limit), 50))}`
|
|
94
|
+
].join(" ");
|
|
95
|
+
}
|
|
64
96
|
//#endregion
|
|
65
|
-
export {
|
|
97
|
+
export { compileProjectionPreview as a, compileProjectionJoins as i, compileProjectionFrom as n, compileProjectionSelect as o, compileProjectionIdentity as r, quoteIdent as s, PREVIEW_MAX_ROWS as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_projection = require("./projection-
|
|
1
|
+
const require_projection = require("./projection-DEwL-D8R.cjs");
|
|
2
2
|
//#region ../core/src/projection-sql.ts
|
|
3
3
|
/**
|
|
4
4
|
* SQL generation for projection-backed entities.
|
|
@@ -61,7 +61,45 @@ function compileProjectionJoins(projection) {
|
|
|
61
61
|
function compileProjectionFrom(projection) {
|
|
62
62
|
return `FROM ${quoteIdent(projection.baseTable)} AS ${quoteIdent(require_projection.BASE_REF)}`;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Hard ceiling on preview rows, regardless of what a caller asks for.
|
|
66
|
+
*
|
|
67
|
+
* A preview runs against a production database from a button a user can click
|
|
68
|
+
* as often as they like, so the cap belongs beside the query rather than in
|
|
69
|
+
* whichever caller happens to be passing a limit today.
|
|
70
|
+
*/
|
|
71
|
+
const PREVIEW_MAX_ROWS = 50;
|
|
72
|
+
/**
|
|
73
|
+
* One SELECT reading a few rows through an UNSAVED projection, for the derived
|
|
74
|
+
* object builder's preview.
|
|
75
|
+
*
|
|
76
|
+
* Lives here, beside the view compiler, because both sides of the round trip
|
|
77
|
+
* need the identical statement: an embedded org runs it against its own
|
|
78
|
+
* database from `@clivly.com/api`, and a cloud org's host app runs it from
|
|
79
|
+
* `@clivly/sdk`. Two copies would be free to disagree about what the user is
|
|
80
|
+
* being shown, which is the whole value of a preview.
|
|
81
|
+
*
|
|
82
|
+
* Columns are aliased by FIELD NAME, not by ref token. That is the deliberate
|
|
83
|
+
* difference from the push source, which aliases by token because cloud ingest
|
|
84
|
+
* reads `row[token]`; a preview is read by a person, in a table whose headers
|
|
85
|
+
* are the field names they just typed.
|
|
86
|
+
*/
|
|
87
|
+
function compileProjectionPreview(projection, limit) {
|
|
88
|
+
const { selectItems } = compileProjectionSelect(projection, projection.identity.kind === "base_pk" ? projection.identity.column ?? "id" : "id");
|
|
89
|
+
return [
|
|
90
|
+
`SELECT ${selectItems.join(", ")}`,
|
|
91
|
+
compileProjectionFrom(projection),
|
|
92
|
+
...compileProjectionJoins(projection),
|
|
93
|
+
`LIMIT ${Math.max(1, Math.min(Math.floor(limit), 50))}`
|
|
94
|
+
].join(" ");
|
|
95
|
+
}
|
|
64
96
|
//#endregion
|
|
97
|
+
Object.defineProperty(exports, "PREVIEW_MAX_ROWS", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function() {
|
|
100
|
+
return PREVIEW_MAX_ROWS;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
65
103
|
Object.defineProperty(exports, "compileProjectionFrom", {
|
|
66
104
|
enumerable: true,
|
|
67
105
|
get: function() {
|
|
@@ -80,6 +118,12 @@ Object.defineProperty(exports, "compileProjectionJoins", {
|
|
|
80
118
|
return compileProjectionJoins;
|
|
81
119
|
}
|
|
82
120
|
});
|
|
121
|
+
Object.defineProperty(exports, "compileProjectionPreview", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function() {
|
|
124
|
+
return compileProjectionPreview;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
83
127
|
Object.defineProperty(exports, "compileProjectionSelect", {
|
|
84
128
|
enumerable: true,
|
|
85
129
|
get: function() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as customObjectDeclarations } from "./entity-config-
|
|
2
|
-
import { t as entitiesToMappings } from "./mappings-config-
|
|
1
|
+
import { o as customObjectDeclarations } from "./entity-config-CusbTOJ1.mjs";
|
|
2
|
+
import { t as entitiesToMappings } from "./mappings-config-7qQ47p9K.mjs";
|
|
3
3
|
import { t as DRIZZLE_META } from "./drizzle-meta-D-5k3n0i.mjs";
|
|
4
4
|
//#region ../sdk/src/deployment-identity.ts
|
|
5
5
|
const MAX_DEPLOYMENT_ID_LENGTH = 128;
|
|
@@ -572,12 +572,21 @@ async function runDoctor(args) {
|
|
|
572
572
|
ok: entityCount > 0,
|
|
573
573
|
detail: entityCount > 0 ? `${entityCount} entit${entityCount === 1 ? "y" : "ies"} configured.` : "No `entities` config — pass defineClivlyConfig(...) as `entities`."
|
|
574
574
|
});
|
|
575
|
+
const sourcesDetail = (count, deferred) => {
|
|
576
|
+
if (deferred) return "Deferred — the coverage check below names the entity and the source key it expected.";
|
|
577
|
+
return count === 0 ? "No `source.contacts` — nothing to sync." : `${count} source(s) to mirror.`;
|
|
578
|
+
};
|
|
579
|
+
const coverage = checkConceptCoverage(config);
|
|
580
|
+
const coverageOwnsIt = !(coverage.ok || coverage.skipped);
|
|
581
|
+
const noSources = sources.length === 0;
|
|
582
|
+
const deferred = noSources && coverageOwnsIt;
|
|
575
583
|
checks.push({
|
|
576
584
|
name: "Sources configured",
|
|
577
|
-
ok:
|
|
578
|
-
|
|
585
|
+
ok: !noSources,
|
|
586
|
+
skipped: deferred,
|
|
587
|
+
detail: sourcesDetail(sources.length, deferred)
|
|
579
588
|
});
|
|
580
|
-
checks.push(
|
|
589
|
+
checks.push(coverage);
|
|
581
590
|
checks.push(...cursorColumnChecks(sources));
|
|
582
591
|
for (const source of sources) {
|
|
583
592
|
const check = cursorMonotonicityCheck(source);
|
|
@@ -1533,6 +1542,15 @@ async function handlePreviewRequest(config, preview) {
|
|
|
1533
1542
|
sampledCount: rows.length
|
|
1534
1543
|
}, 200);
|
|
1535
1544
|
}
|
|
1545
|
+
async function handleProjectionPreviewRequest(config, request) {
|
|
1546
|
+
const run = config.introspector?.runProjection;
|
|
1547
|
+
if (!run) return jsonResponse({ error: "This app cannot preview derived objects. Set `introspector: drizzleIntrospector(db)` in clivly.config.ts, on a clivly version that supports runProjection." }, 400);
|
|
1548
|
+
const rows = await run.call(config.introspector, request.projection, { limit: request.limit });
|
|
1549
|
+
return jsonResponse({
|
|
1550
|
+
rows,
|
|
1551
|
+
sampledCount: rows.length
|
|
1552
|
+
}, 200);
|
|
1553
|
+
}
|
|
1536
1554
|
/**
|
|
1537
1555
|
* Create the Clivly SDK. The implemented surface — heartbeat/discovery reporting
|
|
1538
1556
|
* and the auth-verify handler — connects a developer's app to a running Clivly
|
|
@@ -1662,13 +1680,17 @@ function createClivlySDK(config) {
|
|
|
1662
1680
|
lastPushFailure = null;
|
|
1663
1681
|
if (!await syncOne(resolved.source, resolved.path, "delta", resolved.objectType, runId, SAMPLE_BATCH_SIZE, SAMPLE_BATCH_SIZE, false)) throw new Error(describePushFailure([resolved.source.entity]));
|
|
1664
1682
|
};
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1683
|
+
const describeSyncTrigger = () => ({
|
|
1684
|
+
configured: config.syncTrigger?.url,
|
|
1685
|
+
resolved: resolveTriggerUrl({
|
|
1667
1686
|
configuredUrl: config.syncTrigger?.url,
|
|
1668
1687
|
configuredPath: config.syncTrigger?.path,
|
|
1669
1688
|
env: config.env ?? process.env,
|
|
1670
1689
|
observedUrl
|
|
1671
|
-
})
|
|
1690
|
+
})
|
|
1691
|
+
});
|
|
1692
|
+
const sendHeartbeat = () => {
|
|
1693
|
+
const triggerUrl = describeSyncTrigger().resolved;
|
|
1672
1694
|
return fetcher(`${apiUrl}/clivly/sdk/heartbeat`, {
|
|
1673
1695
|
method: "POST",
|
|
1674
1696
|
headers: {
|
|
@@ -1896,6 +1918,7 @@ function createClivlySDK(config) {
|
|
|
1896
1918
|
const startedAt = Date.now();
|
|
1897
1919
|
try {
|
|
1898
1920
|
if (payload.preview) return await handlePreviewRequest(config, payload.preview);
|
|
1921
|
+
if (payload.previewProjection) return await handleProjectionPreviewRequest(config, payload.previewProjection);
|
|
1899
1922
|
if (payload.sample) await runSampleSync(payload.sample.entityKey, payload.runId);
|
|
1900
1923
|
else await runScheduled({
|
|
1901
1924
|
mode: payload.mode,
|
|
@@ -1991,6 +2014,7 @@ function createClivlySDK(config) {
|
|
|
1991
2014
|
connect,
|
|
1992
2015
|
ping,
|
|
1993
2016
|
doctor,
|
|
2017
|
+
describeSyncTrigger,
|
|
1994
2018
|
runScheduled,
|
|
1995
2019
|
createClivlyHandler,
|
|
1996
2020
|
sync: runSync,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_entity_config = require("./entity-config-
|
|
2
|
-
const require_mappings_config = require("./mappings-config-
|
|
1
|
+
const require_entity_config = require("./entity-config-DE30_RpU.cjs");
|
|
2
|
+
const require_mappings_config = require("./mappings-config-CjCmT-aU.cjs");
|
|
3
3
|
const require_drizzle_meta = require("./drizzle-meta-Bb1JWYqf.cjs");
|
|
4
4
|
//#region ../sdk/src/deployment-identity.ts
|
|
5
5
|
const MAX_DEPLOYMENT_ID_LENGTH = 128;
|
|
@@ -572,12 +572,21 @@ async function runDoctor(args) {
|
|
|
572
572
|
ok: entityCount > 0,
|
|
573
573
|
detail: entityCount > 0 ? `${entityCount} entit${entityCount === 1 ? "y" : "ies"} configured.` : "No `entities` config — pass defineClivlyConfig(...) as `entities`."
|
|
574
574
|
});
|
|
575
|
+
const sourcesDetail = (count, deferred) => {
|
|
576
|
+
if (deferred) return "Deferred — the coverage check below names the entity and the source key it expected.";
|
|
577
|
+
return count === 0 ? "No `source.contacts` — nothing to sync." : `${count} source(s) to mirror.`;
|
|
578
|
+
};
|
|
579
|
+
const coverage = checkConceptCoverage(config);
|
|
580
|
+
const coverageOwnsIt = !(coverage.ok || coverage.skipped);
|
|
581
|
+
const noSources = sources.length === 0;
|
|
582
|
+
const deferred = noSources && coverageOwnsIt;
|
|
575
583
|
checks.push({
|
|
576
584
|
name: "Sources configured",
|
|
577
|
-
ok:
|
|
578
|
-
|
|
585
|
+
ok: !noSources,
|
|
586
|
+
skipped: deferred,
|
|
587
|
+
detail: sourcesDetail(sources.length, deferred)
|
|
579
588
|
});
|
|
580
|
-
checks.push(
|
|
589
|
+
checks.push(coverage);
|
|
581
590
|
checks.push(...cursorColumnChecks(sources));
|
|
582
591
|
for (const source of sources) {
|
|
583
592
|
const check = cursorMonotonicityCheck(source);
|
|
@@ -1533,6 +1542,15 @@ async function handlePreviewRequest(config, preview) {
|
|
|
1533
1542
|
sampledCount: rows.length
|
|
1534
1543
|
}, 200);
|
|
1535
1544
|
}
|
|
1545
|
+
async function handleProjectionPreviewRequest(config, request) {
|
|
1546
|
+
const run = config.introspector?.runProjection;
|
|
1547
|
+
if (!run) return jsonResponse({ error: "This app cannot preview derived objects. Set `introspector: drizzleIntrospector(db)` in clivly.config.ts, on a clivly version that supports runProjection." }, 400);
|
|
1548
|
+
const rows = await run.call(config.introspector, request.projection, { limit: request.limit });
|
|
1549
|
+
return jsonResponse({
|
|
1550
|
+
rows,
|
|
1551
|
+
sampledCount: rows.length
|
|
1552
|
+
}, 200);
|
|
1553
|
+
}
|
|
1536
1554
|
/**
|
|
1537
1555
|
* Create the Clivly SDK. The implemented surface — heartbeat/discovery reporting
|
|
1538
1556
|
* and the auth-verify handler — connects a developer's app to a running Clivly
|
|
@@ -1662,13 +1680,17 @@ function createClivlySDK(config) {
|
|
|
1662
1680
|
lastPushFailure = null;
|
|
1663
1681
|
if (!await syncOne(resolved.source, resolved.path, "delta", resolved.objectType, runId, SAMPLE_BATCH_SIZE, SAMPLE_BATCH_SIZE, false)) throw new Error(describePushFailure([resolved.source.entity]));
|
|
1664
1682
|
};
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1683
|
+
const describeSyncTrigger = () => ({
|
|
1684
|
+
configured: config.syncTrigger?.url,
|
|
1685
|
+
resolved: resolveTriggerUrl({
|
|
1667
1686
|
configuredUrl: config.syncTrigger?.url,
|
|
1668
1687
|
configuredPath: config.syncTrigger?.path,
|
|
1669
1688
|
env: config.env ?? process.env,
|
|
1670
1689
|
observedUrl
|
|
1671
|
-
})
|
|
1690
|
+
})
|
|
1691
|
+
});
|
|
1692
|
+
const sendHeartbeat = () => {
|
|
1693
|
+
const triggerUrl = describeSyncTrigger().resolved;
|
|
1672
1694
|
return fetcher(`${apiUrl}/clivly/sdk/heartbeat`, {
|
|
1673
1695
|
method: "POST",
|
|
1674
1696
|
headers: {
|
|
@@ -1896,6 +1918,7 @@ function createClivlySDK(config) {
|
|
|
1896
1918
|
const startedAt = Date.now();
|
|
1897
1919
|
try {
|
|
1898
1920
|
if (payload.preview) return await handlePreviewRequest(config, payload.preview);
|
|
1921
|
+
if (payload.previewProjection) return await handleProjectionPreviewRequest(config, payload.previewProjection);
|
|
1899
1922
|
if (payload.sample) await runSampleSync(payload.sample.entityKey, payload.runId);
|
|
1900
1923
|
else await runScheduled({
|
|
1901
1924
|
mode: payload.mode,
|
|
@@ -1991,6 +2014,7 @@ function createClivlySDK(config) {
|
|
|
1991
2014
|
connect,
|
|
1992
2015
|
ping,
|
|
1993
2016
|
doctor,
|
|
2017
|
+
describeSyncTrigger,
|
|
1994
2018
|
runScheduled,
|
|
1995
2019
|
createClivlyHandler,
|
|
1996
2020
|
sync: runSync,
|
package/sdk.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_entity_config = require("./entity-config-
|
|
3
|
-
const require_sdk = require("./sdk-
|
|
2
|
+
const require_entity_config = require("./entity-config-DE30_RpU.cjs");
|
|
3
|
+
const require_sdk = require("./sdk-w8Kv_XnW.cjs");
|
|
4
4
|
exports.ClivlyAuthError = require_sdk.ClivlyAuthError;
|
|
5
5
|
exports.ClivlyError = require_sdk.ClivlyError;
|
|
6
6
|
exports.ClivlyNetworkError = require_sdk.ClivlyNetworkError;
|
package/sdk.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as defineClivlyConfig, S as customObjectDeclarations, a as ClivlyEntitiesConfig, f as CustomObjectDeclaration, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, u as ConfigValidationResult } from "./entity-config-B2RA53nw.cjs";
|
|
2
|
-
import { a as ClivlyConnectResult, c as ClivlyUser, d as DiscoveredTable, f as DoctorCheck, g as EnsuredObjectTypeResult, h as EnsuredMappingResult, i as ClivlyConnectReason, l as CreateChatSessionHandlerOptions, m as EnsureSchemaResult, n as ChatSessionRequestBody, o as ClivlySDK, p as DoctorReport, r as ChatWidgetVisitor, s as ClivlySDKConfig, u as CursorStore } from "./namespace-probe-
|
|
2
|
+
import { a as ClivlyConnectResult, c as ClivlyUser, d as DiscoveredTable, f as DoctorCheck, g as EnsuredObjectTypeResult, h as EnsuredMappingResult, i as ClivlyConnectReason, l as CreateChatSessionHandlerOptions, m as EnsureSchemaResult, n as ChatSessionRequestBody, o as ClivlySDK, p as DoctorReport, r as ChatWidgetVisitor, s as ClivlySDKConfig, u as CursorStore, v as SyncTriggerDescription } from "./namespace-probe-DaTJINS-.cjs";
|
|
3
3
|
//#region ../sdk/src/trigger-url.d.ts
|
|
4
4
|
declare function isPlaceholderUrl(value: string): boolean;
|
|
5
5
|
//#endregion
|
|
@@ -36,4 +36,4 @@ declare class ClivlyNetworkError extends ClivlyError {}
|
|
|
36
36
|
*/
|
|
37
37
|
declare function createClivlySDK(config: ClivlySDKConfig): ClivlySDK;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { type ChatSessionRequestBody, type ChatWidgetVisitor, ClivlyAuthError, type ClivlyConnectReason, type ClivlyConnectResult, type ClivlyEntitiesConfig, ClivlyError, ClivlyNetworkError, ClivlyRateLimitError, type ClivlySDK, type ClivlySDKConfig, type ClivlyUser, type ConfigValidationError, type ConfigValidationResult, type CreateChatSessionHandlerOptions, type CursorStore, type CustomObjectDeclaration, type DiscoveredSchemaTable, type DiscoveredTable, type DoctorCheck, type DoctorReport, type EnsureSchemaResult, type EnsuredMappingResult, type EnsuredObjectTypeResult, createChatSessionHandler, createClivlySDK, customObjectDeclarations, defineClivlyConfig, isPlaceholderUrl, validateEntitiesConfig };
|
|
39
|
+
export { type ChatSessionRequestBody, type ChatWidgetVisitor, ClivlyAuthError, type ClivlyConnectReason, type ClivlyConnectResult, type ClivlyEntitiesConfig, ClivlyError, ClivlyNetworkError, ClivlyRateLimitError, type ClivlySDK, type ClivlySDKConfig, type ClivlyUser, type ConfigValidationError, type ConfigValidationResult, type CreateChatSessionHandlerOptions, type CursorStore, type CustomObjectDeclaration, type DiscoveredSchemaTable, type DiscoveredTable, type DoctorCheck, type DoctorReport, type EnsureSchemaResult, type EnsuredMappingResult, type EnsuredObjectTypeResult, type SyncTriggerDescription, createChatSessionHandler, createClivlySDK, customObjectDeclarations, defineClivlyConfig, isPlaceholderUrl, validateEntitiesConfig };
|
package/sdk.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as defineClivlyConfig, S as customObjectDeclarations, a as ClivlyEntitiesConfig, f as CustomObjectDeclaration, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, u as ConfigValidationResult } from "./entity-config-B2RA53nw.mjs";
|
|
2
|
-
import { a as ClivlyConnectResult, c as ClivlyUser, d as DiscoveredTable, f as DoctorCheck, g as EnsuredObjectTypeResult, h as EnsuredMappingResult, i as ClivlyConnectReason, l as CreateChatSessionHandlerOptions, m as EnsureSchemaResult, n as ChatSessionRequestBody, o as ClivlySDK, p as DoctorReport, r as ChatWidgetVisitor, s as ClivlySDKConfig, u as CursorStore } from "./namespace-probe-
|
|
2
|
+
import { a as ClivlyConnectResult, c as ClivlyUser, d as DiscoveredTable, f as DoctorCheck, g as EnsuredObjectTypeResult, h as EnsuredMappingResult, i as ClivlyConnectReason, l as CreateChatSessionHandlerOptions, m as EnsureSchemaResult, n as ChatSessionRequestBody, o as ClivlySDK, p as DoctorReport, r as ChatWidgetVisitor, s as ClivlySDKConfig, u as CursorStore, v as SyncTriggerDescription } from "./namespace-probe-Ckn9yJ6F.mjs";
|
|
3
3
|
//#region ../sdk/src/trigger-url.d.ts
|
|
4
4
|
declare function isPlaceholderUrl(value: string): boolean;
|
|
5
5
|
//#endregion
|
|
@@ -36,4 +36,4 @@ declare class ClivlyNetworkError extends ClivlyError {}
|
|
|
36
36
|
*/
|
|
37
37
|
declare function createClivlySDK(config: ClivlySDKConfig): ClivlySDK;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { type ChatSessionRequestBody, type ChatWidgetVisitor, ClivlyAuthError, type ClivlyConnectReason, type ClivlyConnectResult, type ClivlyEntitiesConfig, ClivlyError, ClivlyNetworkError, ClivlyRateLimitError, type ClivlySDK, type ClivlySDKConfig, type ClivlyUser, type ConfigValidationError, type ConfigValidationResult, type CreateChatSessionHandlerOptions, type CursorStore, type CustomObjectDeclaration, type DiscoveredSchemaTable, type DiscoveredTable, type DoctorCheck, type DoctorReport, type EnsureSchemaResult, type EnsuredMappingResult, type EnsuredObjectTypeResult, createChatSessionHandler, createClivlySDK, customObjectDeclarations, defineClivlyConfig, isPlaceholderUrl, validateEntitiesConfig };
|
|
39
|
+
export { type ChatSessionRequestBody, type ChatWidgetVisitor, ClivlyAuthError, type ClivlyConnectReason, type ClivlyConnectResult, type ClivlyEntitiesConfig, ClivlyError, ClivlyNetworkError, ClivlyRateLimitError, type ClivlySDK, type ClivlySDKConfig, type ClivlyUser, type ConfigValidationError, type ConfigValidationResult, type CreateChatSessionHandlerOptions, type CursorStore, type CustomObjectDeclaration, type DiscoveredSchemaTable, type DiscoveredTable, type DoctorCheck, type DoctorReport, type EnsureSchemaResult, type EnsuredMappingResult, type EnsuredObjectTypeResult, type SyncTriggerDescription, createChatSessionHandler, createClivlySDK, customObjectDeclarations, defineClivlyConfig, isPlaceholderUrl, validateEntitiesConfig };
|
package/sdk.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { o as customObjectDeclarations, p as validateEntitiesConfig, s as defineClivlyConfig } from "./entity-config-
|
|
2
|
-
import { a as ClivlyRateLimitError, i as ClivlyNetworkError, n as ClivlyAuthError, o as createChatSessionHandler, r as ClivlyError, s as isPlaceholderUrl, t as createClivlySDK } from "./sdk-
|
|
1
|
+
import { o as customObjectDeclarations, p as validateEntitiesConfig, s as defineClivlyConfig } from "./entity-config-CusbTOJ1.mjs";
|
|
2
|
+
import { a as ClivlyRateLimitError, i as ClivlyNetworkError, n as ClivlyAuthError, o as createChatSessionHandler, r as ClivlyError, s as isPlaceholderUrl, t as createClivlySDK } from "./sdk-Dkq6ELkf.mjs";
|
|
3
3
|
export { ClivlyAuthError, ClivlyError, ClivlyNetworkError, ClivlyRateLimitError, createChatSessionHandler, createClivlySDK, customObjectDeclarations, defineClivlyConfig, isPlaceholderUrl, validateEntitiesConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_projection = require("./projection-
|
|
2
|
-
const require_projection_sql = require("./projection-sql-
|
|
1
|
+
const require_projection = require("./projection-DEwL-D8R.cjs");
|
|
2
|
+
const require_projection_sql = require("./projection-sql-iHy-Cx6V.cjs");
|
|
3
3
|
//#region ../core/src/view-compiler.ts
|
|
4
4
|
/**
|
|
5
5
|
* View compiler (Phase 2) — turns a validated entity config into read-only
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BASE_REF } from "./projection-
|
|
2
|
-
import {
|
|
1
|
+
import { t as BASE_REF } from "./projection-hnPSgH6G.mjs";
|
|
2
|
+
import { i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, s as quoteIdent } from "./projection-sql-9zzTVGvf.mjs";
|
|
3
3
|
//#region ../core/src/view-compiler.ts
|
|
4
4
|
/**
|
|
5
5
|
* View compiler (Phase 2) — turns a validated entity config into read-only
|
package/vite.d.cts
CHANGED
package/vite.d.mts
CHANGED
package/internal-CykXpEGk.mjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
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
|
-
//#region ../core/src/projection-draft.ts
|
|
4
|
-
function emptyProjectionDraft(baseTable) {
|
|
5
|
-
return {
|
|
6
|
-
baseTable,
|
|
7
|
-
entityKey: "",
|
|
8
|
-
fieldBindings: {},
|
|
9
|
-
identity: { kind: "base_pk" },
|
|
10
|
-
joins: []
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The ON conditions implied by a foreign key between the two tables, so the
|
|
15
|
-
* builder can pre-fill a join instead of making the user hand-pick columns.
|
|
16
|
-
* Returns [] when no FK relates them — the user then picks manually.
|
|
17
|
-
*/
|
|
18
|
-
function suggestJoinConditions(baseTable, joinTable, schema, joinKey) {
|
|
19
|
-
const join = schema.find((t) => t.name === joinTable);
|
|
20
|
-
const conditions = [];
|
|
21
|
-
for (const column of join?.columnsMeta ?? []) if (column.references?.table === baseTable) conditions.push({
|
|
22
|
-
left: {
|
|
23
|
-
table: joinKey,
|
|
24
|
-
column: column.name
|
|
25
|
-
},
|
|
26
|
-
op: "eq",
|
|
27
|
-
right: {
|
|
28
|
-
table: BASE_REF,
|
|
29
|
-
column: column.references.column
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return conditions;
|
|
33
|
-
}
|
|
34
|
-
/** A draft becomes a projection once it has a valid key and ≥1 binding. */
|
|
35
|
-
function draftToProjection(draft) {
|
|
36
|
-
if (!PROJECTION_KEY_PATTERN.test(draft.entityKey)) return null;
|
|
37
|
-
if (Object.keys(draft.fieldBindings).length === 0) return null;
|
|
38
|
-
return {
|
|
39
|
-
version: 1,
|
|
40
|
-
kind: "projection",
|
|
41
|
-
entityKey: draft.entityKey,
|
|
42
|
-
baseTable: draft.baseTable,
|
|
43
|
-
joins: draft.joins,
|
|
44
|
-
fieldBindings: draft.fieldBindings,
|
|
45
|
-
identity: draft.identity
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function draftErrors(draft, schema) {
|
|
49
|
-
const projection = draftToProjection(draft);
|
|
50
|
-
if (!projection) return [{
|
|
51
|
-
path: "projection",
|
|
52
|
-
message: "Name the object and map a field."
|
|
53
|
-
}];
|
|
54
|
-
return validateProjection(projection, schema, "projection");
|
|
55
|
-
}
|
|
56
|
-
/** Per-join fan-out, for the builder's inline cardinality hints. */
|
|
57
|
-
function describeCardinality(draft, schema) {
|
|
58
|
-
const projection = draftToProjection(draft);
|
|
59
|
-
if (!projection) return [];
|
|
60
|
-
const tablesByName = new Map(schema.map((t) => [t.name, t]));
|
|
61
|
-
const fanning = new Set(fanOutJoins(projection, tablesByName).map((j) => j.key));
|
|
62
|
-
return projection.joins.map((join) => ({
|
|
63
|
-
joinKey: join.key,
|
|
64
|
-
fansOut: fanning.has(join.key)
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
export { suggestJoinConditions as a, emptyProjectionDraft as i, draftErrors as n, draftToProjection as r, describeCardinality as t };
|
package/internal-DqduZU3l.cjs
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
const require_projection = require("./projection-Dz6_i1-w.cjs");
|
|
2
|
-
const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
|
|
3
|
-
//#region ../core/src/projection-draft.ts
|
|
4
|
-
function emptyProjectionDraft(baseTable) {
|
|
5
|
-
return {
|
|
6
|
-
baseTable,
|
|
7
|
-
entityKey: "",
|
|
8
|
-
fieldBindings: {},
|
|
9
|
-
identity: { kind: "base_pk" },
|
|
10
|
-
joins: []
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The ON conditions implied by a foreign key between the two tables, so the
|
|
15
|
-
* builder can pre-fill a join instead of making the user hand-pick columns.
|
|
16
|
-
* Returns [] when no FK relates them — the user then picks manually.
|
|
17
|
-
*/
|
|
18
|
-
function suggestJoinConditions(baseTable, joinTable, schema, joinKey) {
|
|
19
|
-
const join = schema.find((t) => t.name === joinTable);
|
|
20
|
-
const conditions = [];
|
|
21
|
-
for (const column of join?.columnsMeta ?? []) if (column.references?.table === baseTable) conditions.push({
|
|
22
|
-
left: {
|
|
23
|
-
table: joinKey,
|
|
24
|
-
column: column.name
|
|
25
|
-
},
|
|
26
|
-
op: "eq",
|
|
27
|
-
right: {
|
|
28
|
-
table: require_projection.BASE_REF,
|
|
29
|
-
column: column.references.column
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return conditions;
|
|
33
|
-
}
|
|
34
|
-
/** A draft becomes a projection once it has a valid key and ≥1 binding. */
|
|
35
|
-
function draftToProjection(draft) {
|
|
36
|
-
if (!require_projection.PROJECTION_KEY_PATTERN.test(draft.entityKey)) return null;
|
|
37
|
-
if (Object.keys(draft.fieldBindings).length === 0) return null;
|
|
38
|
-
return {
|
|
39
|
-
version: 1,
|
|
40
|
-
kind: "projection",
|
|
41
|
-
entityKey: draft.entityKey,
|
|
42
|
-
baseTable: draft.baseTable,
|
|
43
|
-
joins: draft.joins,
|
|
44
|
-
fieldBindings: draft.fieldBindings,
|
|
45
|
-
identity: draft.identity
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function draftErrors(draft, schema) {
|
|
49
|
-
const projection = draftToProjection(draft);
|
|
50
|
-
if (!projection) return [{
|
|
51
|
-
path: "projection",
|
|
52
|
-
message: "Name the object and map a field."
|
|
53
|
-
}];
|
|
54
|
-
return require_entity_config.validateProjection(projection, schema, "projection");
|
|
55
|
-
}
|
|
56
|
-
/** Per-join fan-out, for the builder's inline cardinality hints. */
|
|
57
|
-
function describeCardinality(draft, schema) {
|
|
58
|
-
const projection = draftToProjection(draft);
|
|
59
|
-
if (!projection) return [];
|
|
60
|
-
const tablesByName = new Map(schema.map((t) => [t.name, t]));
|
|
61
|
-
const fanning = new Set(require_entity_config.fanOutJoins(projection, tablesByName).map((j) => j.key));
|
|
62
|
-
return projection.joins.map((join) => ({
|
|
63
|
-
joinKey: join.key,
|
|
64
|
-
fansOut: fanning.has(join.key)
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
Object.defineProperty(exports, "describeCardinality", {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
get: function() {
|
|
71
|
-
return describeCardinality;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
Object.defineProperty(exports, "draftErrors", {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function() {
|
|
77
|
-
return draftErrors;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(exports, "draftToProjection", {
|
|
81
|
-
enumerable: true,
|
|
82
|
-
get: function() {
|
|
83
|
-
return draftToProjection;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
Object.defineProperty(exports, "emptyProjectionDraft", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
get: function() {
|
|
89
|
-
return emptyProjectionDraft;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
Object.defineProperty(exports, "suggestJoinConditions", {
|
|
93
|
-
enumerable: true,
|
|
94
|
-
get: function() {
|
|
95
|
-
return suggestJoinConditions;
|
|
96
|
-
}
|
|
97
|
-
});
|