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.
Files changed (62) hide show
  1. package/README.md +30 -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 +13 -7
  11. package/core.d.cts +2 -2
  12. package/core.d.mts +2 -2
  13. package/core.mjs +8 -8
  14. package/drizzle.cjs +19 -2
  15. package/drizzle.d.cts +1 -1
  16. package/drizzle.d.mts +1 -1
  17. package/drizzle.mjs +19 -2
  18. package/{entity-config-B74SPOUZ.mjs → entity-config-CusbTOJ1.mjs} +1 -1
  19. package/{entity-config-7sGCk_nw.cjs → entity-config-DE30_RpU.cjs} +1 -1
  20. package/index.cjs +129 -11
  21. package/index.mjs +129 -11
  22. package/internal-BQ47iN6f.cjs +259 -0
  23. package/internal-ChufvXE6.mjs +212 -0
  24. package/{internal-o2M7FGlR.d.mts → internal-CvlFk3KC.d.mts} +82 -2
  25. package/{internal-wCXSELDN.d.cts → internal-DGUOLQAq.d.cts} +82 -2
  26. package/internal-entity-config.cjs +1 -1
  27. package/internal-entity-config.mjs +1 -1
  28. package/internal-entity-heuristics.cjs +1 -1
  29. package/internal-entity-heuristics.mjs +1 -1
  30. package/internal-mappings-config.cjs +1 -1
  31. package/internal-mappings-config.mjs +1 -1
  32. package/internal-sync-engine.cjs +1 -1
  33. package/internal-sync-engine.mjs +1 -1
  34. package/internal-view-compiler.cjs +1 -1
  35. package/internal-view-compiler.mjs +1 -1
  36. package/internal.cjs +13 -7
  37. package/internal.d.cts +2 -2
  38. package/internal.d.mts +2 -2
  39. package/internal.mjs +8 -8
  40. package/{mappings-config-DQS_s4dg.mjs → mappings-config-7qQ47p9K.mjs} +1 -1
  41. package/{mappings-config-CLyEg0sf.cjs → mappings-config-CjCmT-aU.cjs} +1 -1
  42. package/{namespace-probe-Cn7voAd0.d.mts → namespace-probe-Ckn9yJ6F.d.mts} +45 -2
  43. package/{namespace-probe-BoGI18dQ.d.cts → namespace-probe-DaTJINS-.d.cts} +45 -2
  44. package/package.json +1 -1
  45. package/{projection-Dz6_i1-w.cjs → projection-DEwL-D8R.cjs} +6 -0
  46. package/{projection-CSGJbZlZ.mjs → projection-hnPSgH6G.mjs} +1 -1
  47. package/{projection-sql-BgnfiGqF.mjs → projection-sql-9zzTVGvf.mjs} +34 -2
  48. package/{projection-sql-Cl1qIn8m.cjs → projection-sql-iHy-Cx6V.cjs} +45 -1
  49. package/{sdk-DYBDR939.mjs → sdk-Dkq6ELkf.mjs} +32 -8
  50. package/{sdk-CM1UO-I7.cjs → sdk-w8Kv_XnW.cjs} +32 -8
  51. package/sdk.cjs +2 -2
  52. package/sdk.d.cts +2 -2
  53. package/sdk.d.mts +2 -2
  54. package/sdk.mjs +2 -2
  55. package/{sync-engine-C4A5jgA4.cjs → sync-engine-BLgwLpR6.cjs} +1 -1
  56. package/{sync-engine-Dt5QQSKO.mjs → sync-engine-B_IzoUSx.mjs} +1 -1
  57. package/{view-compiler-B5nDal14.cjs → view-compiler-BHI5E4QI.cjs} +2 -2
  58. package/{view-compiler-CSYwEWf5.mjs → view-compiler-D_6gfXFr.mjs} +2 -2
  59. package/vite.d.cts +1 -1
  60. package/vite.d.mts +1 -1
  61. package/internal-CykXpEGk.mjs +0 -68
  62. package/internal-DqduZU3l.cjs +0 -97
@@ -27,10 +27,62 @@ declare function emptyProjectionDraft(baseTable: string): ProjectionDraft;
27
27
  * Returns [] when no FK relates them — the user then picks manually.
28
28
  */
29
29
  declare function suggestJoinConditions(baseTable: string, joinTable: string, schema: DiscoveredSchemaTable[], joinKey: string): ProjectionJoin["on"];
30
+ /**
31
+ * Add a join on `joinTable`, keyed and pre-filled.
32
+ *
33
+ * The key is the table's own name where that is free, because it is what the
34
+ * user already calls the table; a collision falls back to `_2`, `_3` and so on.
35
+ * Uniqueness is not cosmetic — the key is the SQL alias and the name every ref
36
+ * addresses the table by, so two joins sharing one would make every ref
37
+ * ambiguous. `base` is reserved for the base table and can never be taken.
38
+ */
39
+ declare function addDraftJoin(draft: ProjectionDraft, joinTable: string, schema: DiscoveredSchemaTable[]): ProjectionDraft;
40
+ /**
41
+ * Remove a join, and everything that addressed it.
42
+ *
43
+ * Refs to a removed join are refs to a table the projection no longer declares.
44
+ * Left in place they fail validation as "unknown ref table", which blames the
45
+ * field — or, worse, the identity — for the join's removal. Identity falls back
46
+ * to the base primary key, the same default a new draft starts from.
47
+ */
48
+ declare function removeDraftJoin(draft: ProjectionDraft, joinKey: string): ProjectionDraft;
49
+ /** One selectable table in the builder's column pickers. */
50
+ interface DraftRefOption {
51
+ columns: string[];
52
+ label: string;
53
+ ref: string;
54
+ }
55
+ /**
56
+ * Every table a field or identity may currently read from, in ref order: the
57
+ * base table first, then each join.
58
+ *
59
+ * Returns [] when the base table is not in the discovered schema — there is
60
+ * nothing truthful to offer, and inventing columns would let someone build a
61
+ * projection that cannot compile.
62
+ */
63
+ declare function draftRefOptions(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): DraftRefOption[];
30
64
  /** A draft becomes a projection once it has a valid key and ≥1 binding. */
31
65
  declare function draftToProjection(draft: ProjectionDraft): ProjectionMapping | null;
66
+ /**
67
+ * Every reason this draft cannot be saved, one per cause and each anchored to
68
+ * the section that owns it.
69
+ *
70
+ * One lumped "Name the object and map a field." was all this used to return for
71
+ * an incomplete draft, at the bare path "projection". Two consequences, both
72
+ * bad: a builder had nowhere to attach the message, and — because it returned
73
+ * before validating — a fanning join under a `base_pk` identity stayed silent
74
+ * until the draft was otherwise complete, which is well after the point where
75
+ * the user chose the join.
76
+ */
32
77
  declare function draftErrors(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): ConfigValidationError[];
33
- /** Per-join fan-out, for the builder's inline cardinality hints. */
78
+ /**
79
+ * Per-join fan-out, for the builder's inline cardinality hints.
80
+ *
81
+ * Answered from the joins alone. Joins are chosen before the key and the fields
82
+ * are filled in, and a fan-out warning is precisely what should steer the
83
+ * identity choice while it is being made — requiring a complete draft put the
84
+ * hint after the decision it exists to inform.
85
+ */
34
86
  declare function describeCardinality(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): Array<{
35
87
  fansOut: boolean;
36
88
  joinKey: string;
@@ -60,9 +112,37 @@ declare function quoteIdent(name: string): string;
60
112
  * a pushed row's `id` identical to the one the view would have produced.
61
113
  */
62
114
  declare function compileProjectionIdentity(projection: ProjectionMapping, basePkColumn: string): string;
115
+ declare function compileProjectionSelect(projection: ProjectionMapping, basePkColumn: string): {
116
+ columns: string[];
117
+ selectItems: string[];
118
+ };
63
119
  declare function compileProjectionJoins(projection: ProjectionMapping): string[];
64
120
  /** `FROM <baseTable> AS "base"` — the alias every ref resolves against. */
65
121
  declare function compileProjectionFrom(projection: ProjectionMapping): string;
122
+ /**
123
+ * Hard ceiling on preview rows, regardless of what a caller asks for.
124
+ *
125
+ * A preview runs against a production database from a button a user can click
126
+ * as often as they like, so the cap belongs beside the query rather than in
127
+ * whichever caller happens to be passing a limit today.
128
+ */
129
+ declare const PREVIEW_MAX_ROWS = 50;
130
+ /**
131
+ * One SELECT reading a few rows through an UNSAVED projection, for the derived
132
+ * object builder's preview.
133
+ *
134
+ * Lives here, beside the view compiler, because both sides of the round trip
135
+ * need the identical statement: an embedded org runs it against its own
136
+ * database from `@clivly.com/api`, and a cloud org's host app runs it from
137
+ * `@clivly/sdk`. Two copies would be free to disagree about what the user is
138
+ * being shown, which is the whole value of a preview.
139
+ *
140
+ * Columns are aliased by FIELD NAME, not by ref token. That is the deliberate
141
+ * difference from the push source, which aliases by token because cloud ingest
142
+ * reads `row[token]`; a preview is read by a person, in a table whose headers
143
+ * are the field names they just typed.
144
+ */
145
+ declare function compileProjectionPreview(projection: ProjectionMapping, limit: number): string;
66
146
  //#endregion
67
147
  //#region ../core/src/projection-validate.d.ts
68
148
  /**
@@ -97,4 +177,4 @@ declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]
97
177
  /** Is this table's payload rich enough to validate a projection against? */
98
178
  declare function hasRichMeta(table: DiscoveredSchemaTable): boolean;
99
179
  //#endregion
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 };
180
+ export { fanOutJoins as C, suggestJoinConditions as S, draftErrors as _, validateProjection as a, emptyProjectionDraft as b, compileProjectionIdentity as c, compileProjectionSelect as d, quoteIdent as f, describeCardinality as g, addDraftJoin as h, primaryKeyColumns as i, compileProjectionJoins as l, ProjectionDraft as m, coversUniqueKey as n, PREVIEW_MAX_ROWS as o, DraftRefOption as p, hasRichMeta as r, compileProjectionFrom as s, columnMetaFor as t, compileProjectionPreview as u, draftRefOptions as v, joinFansOut as w, removeDraftJoin as x, draftToProjection as y };
@@ -27,10 +27,62 @@ declare function emptyProjectionDraft(baseTable: string): ProjectionDraft;
27
27
  * Returns [] when no FK relates them — the user then picks manually.
28
28
  */
29
29
  declare function suggestJoinConditions(baseTable: string, joinTable: string, schema: DiscoveredSchemaTable[], joinKey: string): ProjectionJoin["on"];
30
+ /**
31
+ * Add a join on `joinTable`, keyed and pre-filled.
32
+ *
33
+ * The key is the table's own name where that is free, because it is what the
34
+ * user already calls the table; a collision falls back to `_2`, `_3` and so on.
35
+ * Uniqueness is not cosmetic — the key is the SQL alias and the name every ref
36
+ * addresses the table by, so two joins sharing one would make every ref
37
+ * ambiguous. `base` is reserved for the base table and can never be taken.
38
+ */
39
+ declare function addDraftJoin(draft: ProjectionDraft, joinTable: string, schema: DiscoveredSchemaTable[]): ProjectionDraft;
40
+ /**
41
+ * Remove a join, and everything that addressed it.
42
+ *
43
+ * Refs to a removed join are refs to a table the projection no longer declares.
44
+ * Left in place they fail validation as "unknown ref table", which blames the
45
+ * field — or, worse, the identity — for the join's removal. Identity falls back
46
+ * to the base primary key, the same default a new draft starts from.
47
+ */
48
+ declare function removeDraftJoin(draft: ProjectionDraft, joinKey: string): ProjectionDraft;
49
+ /** One selectable table in the builder's column pickers. */
50
+ interface DraftRefOption {
51
+ columns: string[];
52
+ label: string;
53
+ ref: string;
54
+ }
55
+ /**
56
+ * Every table a field or identity may currently read from, in ref order: the
57
+ * base table first, then each join.
58
+ *
59
+ * Returns [] when the base table is not in the discovered schema — there is
60
+ * nothing truthful to offer, and inventing columns would let someone build a
61
+ * projection that cannot compile.
62
+ */
63
+ declare function draftRefOptions(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): DraftRefOption[];
30
64
  /** A draft becomes a projection once it has a valid key and ≥1 binding. */
31
65
  declare function draftToProjection(draft: ProjectionDraft): ProjectionMapping | null;
66
+ /**
67
+ * Every reason this draft cannot be saved, one per cause and each anchored to
68
+ * the section that owns it.
69
+ *
70
+ * One lumped "Name the object and map a field." was all this used to return for
71
+ * an incomplete draft, at the bare path "projection". Two consequences, both
72
+ * bad: a builder had nowhere to attach the message, and — because it returned
73
+ * before validating — a fanning join under a `base_pk` identity stayed silent
74
+ * until the draft was otherwise complete, which is well after the point where
75
+ * the user chose the join.
76
+ */
32
77
  declare function draftErrors(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): ConfigValidationError[];
33
- /** Per-join fan-out, for the builder's inline cardinality hints. */
78
+ /**
79
+ * Per-join fan-out, for the builder's inline cardinality hints.
80
+ *
81
+ * Answered from the joins alone. Joins are chosen before the key and the fields
82
+ * are filled in, and a fan-out warning is precisely what should steer the
83
+ * identity choice while it is being made — requiring a complete draft put the
84
+ * hint after the decision it exists to inform.
85
+ */
34
86
  declare function describeCardinality(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): Array<{
35
87
  fansOut: boolean;
36
88
  joinKey: string;
@@ -60,9 +112,37 @@ declare function quoteIdent(name: string): string;
60
112
  * a pushed row's `id` identical to the one the view would have produced.
61
113
  */
62
114
  declare function compileProjectionIdentity(projection: ProjectionMapping, basePkColumn: string): string;
115
+ declare function compileProjectionSelect(projection: ProjectionMapping, basePkColumn: string): {
116
+ columns: string[];
117
+ selectItems: string[];
118
+ };
63
119
  declare function compileProjectionJoins(projection: ProjectionMapping): string[];
64
120
  /** `FROM <baseTable> AS "base"` — the alias every ref resolves against. */
65
121
  declare function compileProjectionFrom(projection: ProjectionMapping): string;
122
+ /**
123
+ * Hard ceiling on preview rows, regardless of what a caller asks for.
124
+ *
125
+ * A preview runs against a production database from a button a user can click
126
+ * as often as they like, so the cap belongs beside the query rather than in
127
+ * whichever caller happens to be passing a limit today.
128
+ */
129
+ declare const PREVIEW_MAX_ROWS = 50;
130
+ /**
131
+ * One SELECT reading a few rows through an UNSAVED projection, for the derived
132
+ * object builder's preview.
133
+ *
134
+ * Lives here, beside the view compiler, because both sides of the round trip
135
+ * need the identical statement: an embedded org runs it against its own
136
+ * database from `@clivly.com/api`, and a cloud org's host app runs it from
137
+ * `@clivly/sdk`. Two copies would be free to disagree about what the user is
138
+ * being shown, which is the whole value of a preview.
139
+ *
140
+ * Columns are aliased by FIELD NAME, not by ref token. That is the deliberate
141
+ * difference from the push source, which aliases by token because cloud ingest
142
+ * reads `row[token]`; a preview is read by a person, in a table whose headers
143
+ * are the field names they just typed.
144
+ */
145
+ declare function compileProjectionPreview(projection: ProjectionMapping, limit: number): string;
66
146
  //#endregion
67
147
  //#region ../core/src/projection-validate.d.ts
68
148
  /**
@@ -97,4 +177,4 @@ declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]
97
177
  /** Is this table's payload rich enough to validate a projection against? */
98
178
  declare function hasRichMeta(table: DiscoveredSchemaTable): boolean;
99
179
  //#endregion
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 };
180
+ export { fanOutJoins as C, suggestJoinConditions as S, draftErrors as _, validateProjection as a, emptyProjectionDraft as b, compileProjectionIdentity as c, compileProjectionSelect as d, quoteIdent as f, describeCardinality as g, addDraftJoin as h, primaryKeyColumns as i, compileProjectionJoins as l, ProjectionDraft as m, coversUniqueKey as n, PREVIEW_MAX_ROWS as o, DraftRefOption as p, hasRichMeta as r, compileProjectionFrom as s, columnMetaFor as t, compileProjectionPreview as u, draftRefOptions as v, joinFansOut as w, removeDraftJoin as x, draftToProjection as y };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
2
+ const require_entity_config = require("./entity-config-DE30_RpU.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-B74SPOUZ.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-CusbTOJ1.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-7sGCk_nw.cjs");
2
+ const require_entity_config = require("./entity-config-DE30_RpU.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-B74SPOUZ.mjs";
1
+ import { a as MATERIALIZING_CONCEPTS } from "./entity-config-CusbTOJ1.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-CLyEg0sf.cjs");
2
+ const require_mappings_config = require("./mappings-config-CjCmT-aU.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-DQS_s4dg.mjs";
1
+ import { n as mappingsToEntitiesConfig, t as entitiesToMappings } from "./mappings-config-7qQ47p9K.mjs";
2
2
  export { entitiesToMappings, mappingsToEntitiesConfig };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sync_engine = require("./sync-engine-C4A5jgA4.cjs");
2
+ const require_sync_engine = require("./sync-engine-BLgwLpR6.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-Dt5QQSKO.mjs";
1
+ import { i as runSync, n as previewSync, r as reconcile, t as computeSampleWarnings } from "./sync-engine-B_IzoUSx.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-B5nDal14.cjs");
2
+ const require_view_compiler = require("./view-compiler-BHI5E4QI.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-CSYwEWf5.mjs";
1
+ import { a as explainViewExecutionError, i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-D_6gfXFr.mjs";
2
2
  export { DEFAULT_VIEW_PREFIX, compileEntityView, compileEntityViews, explainEntitiesConfig, explainViewExecutionError };
package/internal.cjs CHANGED
@@ -1,19 +1,21 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
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");
2
+ const require_projection = require("./projection-DEwL-D8R.cjs");
3
+ const require_entity_config = require("./entity-config-DE30_RpU.cjs");
4
+ const require_mappings_config = require("./mappings-config-CjCmT-aU.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-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");
7
+ const require_internal = require("./internal-BQ47iN6f.cjs");
8
+ const require_projection_sql = require("./projection-sql-iHy-Cx6V.cjs");
9
+ const require_view_compiler = require("./view-compiler-BHI5E4QI.cjs");
10
+ const require_sync_engine = require("./sync-engine-BLgwLpR6.cjs");
11
11
  exports.BASE_REF = require_projection.BASE_REF;
12
12
  exports.CANONICAL_FIELDS = require_entity_config.CANONICAL_FIELDS;
13
13
  exports.CRM_CONCEPTS = require_entity_config.CRM_CONCEPTS;
14
14
  exports.ClivlyConfigError = require_entity_config.ClivlyConfigError;
15
15
  exports.DEFAULT_VIEW_PREFIX = require_view_compiler.DEFAULT_VIEW_PREFIX;
16
16
  exports.MATERIALIZING_CONCEPTS = require_entity_config.MATERIALIZING_CONCEPTS;
17
+ exports.PREVIEW_MAX_ROWS = require_projection_sql.PREVIEW_MAX_ROWS;
18
+ exports.addDraftJoin = require_internal.addDraftJoin;
17
19
  exports.authCustom = require_auth_adapter.authCustom;
18
20
  exports.buildFilterFromDiscriminator = require_mapping_form.buildFilterFromDiscriminator;
19
21
  exports.buildRelationships = require_mapping_form.buildRelationships;
@@ -23,10 +25,13 @@ exports.compileEntityViews = require_view_compiler.compileEntityViews;
23
25
  exports.compileProjectionFrom = require_projection_sql.compileProjectionFrom;
24
26
  exports.compileProjectionIdentity = require_projection_sql.compileProjectionIdentity;
25
27
  exports.compileProjectionJoins = require_projection_sql.compileProjectionJoins;
28
+ exports.compileProjectionPreview = require_projection_sql.compileProjectionPreview;
29
+ exports.compileProjectionSelect = require_projection_sql.compileProjectionSelect;
26
30
  exports.coversUniqueKey = require_entity_config.coversUniqueKey;
27
31
  exports.defineClivlyConfig = require_entity_config.defineClivlyConfig;
28
32
  exports.describeCardinality = require_internal.describeCardinality;
29
33
  exports.draftErrors = require_internal.draftErrors;
34
+ exports.draftRefOptions = require_internal.draftRefOptions;
30
35
  exports.draftToProjection = require_internal.draftToProjection;
31
36
  exports.emptyProjectionDraft = require_internal.emptyProjectionDraft;
32
37
  exports.entitiesConfigSchema = require_entity_config.entitiesConfigSchema;
@@ -44,6 +49,7 @@ exports.reconcile = require_sync_engine.reconcile;
44
49
  exports.relationshipSchema = require_entity_config.relationshipSchema;
45
50
  exports.relationshipViaSignature = require_mapping_form.relationshipViaSignature;
46
51
  exports.relationshipsSchema = require_entity_config.relationshipsSchema;
52
+ exports.removeDraftJoin = require_internal.removeDraftJoin;
47
53
  exports.runSync = require_sync_engine.runSync;
48
54
  exports.suggestJoinConditions = require_internal.suggestJoinConditions;
49
55
  exports.validateEntitiesConfig = require_entity_config.validateEntitiesConfig;
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 { _ 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 };
10
+ import { C as fanOutJoins, S as suggestJoinConditions, _ as draftErrors, a as validateProjection, b as emptyProjectionDraft, c as compileProjectionIdentity, d as compileProjectionSelect, f as quoteIdent, g as describeCardinality, h as addDraftJoin, i as primaryKeyColumns, l as compileProjectionJoins, m as ProjectionDraft, n as coversUniqueKey, o as PREVIEW_MAX_ROWS, p as DraftRefOption, r as hasRichMeta, s as compileProjectionFrom, t as columnMetaFor, u as compileProjectionPreview, v as draftRefOptions, w as joinFansOut, x as removeDraftJoin, y as draftToProjection } from "./internal-DGUOLQAq.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 DraftRefOption, 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, PREVIEW_MAX_ROWS, 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, addDraftJoin, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftRefOptions, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, removeDraftJoin, 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 { _ 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 };
10
+ import { C as fanOutJoins, S as suggestJoinConditions, _ as draftErrors, a as validateProjection, b as emptyProjectionDraft, c as compileProjectionIdentity, d as compileProjectionSelect, f as quoteIdent, g as describeCardinality, h as addDraftJoin, i as primaryKeyColumns, l as compileProjectionJoins, m as ProjectionDraft, n as coversUniqueKey, o as PREVIEW_MAX_ROWS, p as DraftRefOption, r as hasRichMeta, s as compileProjectionFrom, t as columnMetaFor, u as compileProjectionPreview, v as draftRefOptions, w as joinFansOut, x as removeDraftJoin, y as draftToProjection } from "./internal-CvlFk3KC.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 DraftRefOption, 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, PREVIEW_MAX_ROWS, 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, addDraftJoin, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftRefOptions, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, removeDraftJoin, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
package/internal.mjs CHANGED
@@ -1,10 +1,10 @@
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";
1
+ import { a as projectionSchema, i as identityRefs, t as BASE_REF } from "./projection-hnPSgH6G.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-CusbTOJ1.mjs";
3
+ import { n as mappingsToEntitiesConfig } from "./mappings-config-7qQ47p9K.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-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 };
6
+ import { a as draftToProjection, c as suggestJoinConditions, i as draftRefOptions, n as describeCardinality, o as emptyProjectionDraft, r as draftErrors, s as removeDraftJoin, t as addDraftJoin } from "./internal-ChufvXE6.mjs";
7
+ import { a as compileProjectionPreview, i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, r as compileProjectionIdentity, s as quoteIdent, t as PREVIEW_MAX_ROWS } from "./projection-sql-9zzTVGvf.mjs";
8
+ import { i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-D_6gfXFr.mjs";
9
+ import { i as runSync, r as reconcile } from "./sync-engine-B_IzoUSx.mjs";
10
+ export { BASE_REF, CANONICAL_FIELDS, CRM_CONCEPTS, ClivlyConfigError, DEFAULT_VIEW_PREFIX, MATERIALIZING_CONCEPTS, PREVIEW_MAX_ROWS, addDraftJoin, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftRefOptions, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, removeDraftJoin, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
@@ -1,4 +1,4 @@
1
- import { t as CANONICAL_FIELDS } from "./entity-config-B74SPOUZ.mjs";
1
+ import { t as CANONICAL_FIELDS } from "./entity-config-CusbTOJ1.mjs";
2
2
  //#region ../core/src/mappings-config.ts
3
3
  const RESERVED_FIELD = "id";
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
1
+ const require_entity_config = require("./entity-config-DE30_RpU.cjs");
2
2
  //#region ../core/src/mappings-config.ts
3
3
  const RESERVED_FIELD = "id";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.mjs";
1
+ import { P as ProjectionMapping, a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.mjs";
2
2
  import { r as IntegrationState } from "./integration-state-BK-riZnm.mjs";
3
3
  //#region ../sdk/src/drizzle-meta.d.ts
4
4
  declare const DRIZZLE_META: "__clivly_drizzle_source_meta__";
@@ -340,6 +340,20 @@ interface CursorStore {
340
340
  get(entity: string): Promise<SyncCursor | null> | SyncCursor | null;
341
341
  set(entity: string, cursor: SyncCursor | null): Promise<void> | void;
342
342
  }
343
+ /** @see ClivlySDK.describeSyncTrigger */
344
+ interface SyncTriggerDescription {
345
+ /**
346
+ * `syncTrigger.url` exactly as configured, placeholder and all. The raw
347
+ * value, so a caller can say what is in the file rather than what survived
348
+ * resolution.
349
+ */
350
+ configured?: string;
351
+ /**
352
+ * The URL that would be reported to Clivly on the next heartbeat, or
353
+ * `undefined` when nothing resolves. An unedited placeholder never resolves.
354
+ */
355
+ resolved?: string;
356
+ }
343
357
  interface ClivlySDK {
344
358
  /**
345
359
  * Send a single heartbeat and report the outcome richly: `ok`, the HTTP
@@ -375,6 +389,18 @@ interface ClivlySDK {
375
389
  * anyone who can reach it — set a secret if it's publicly routable.
376
390
  */
377
391
  createClivlyHandler(): (req: Request) => Promise<Response>;
392
+ /**
393
+ * What this app would tell Clivly about its sync trigger route, right now.
394
+ *
395
+ * Computed per call rather than frozen at creation: `resolved` can start as
396
+ * `undefined` and become a real URL once the mounted route has served its
397
+ * first request and observed its own origin.
398
+ *
399
+ * Exists for `clivly status`, which has to tell "no trigger configured"
400
+ * apart from "configured, but still the scaffolded placeholder" — a
401
+ * distinction `resolved` alone erases, since it skips placeholders by design.
402
+ */
403
+ describeSyncTrigger(): SyncTriggerDescription;
378
404
  /** Validate this setup end-to-end (read-only) before the first sync. */
379
405
  doctor(): Promise<DoctorReport>;
380
406
  /**
@@ -451,8 +477,25 @@ interface ClivlySDK {
451
477
  interface NamespaceIntrospector {
452
478
  /** All base table names in the reachable schema. */
453
479
  listTables(): Promise<string[]>;
480
+ /**
481
+ * Read a few rows through an unsaved projection, for the dashboard's derived
482
+ * object preview. Rows are keyed by field name.
483
+ *
484
+ * Optional because it is the only capability here that needs more than a
485
+ * table name, and because an introspector may be hand-written. Absent, the
486
+ * dashboard says preview is unavailable rather than failing — see
487
+ * `previewProjection`.
488
+ *
489
+ * This is what makes preview cost the host an SDK upgrade and nothing else:
490
+ * `drizzleIntrospector(db)` already closes over the connection, so a config
491
+ * that set `introspector` for the "Namespace reachable" check gains preview
492
+ * without touching a line.
493
+ */
494
+ runProjection?(projection: ProjectionMapping, opts: {
495
+ limit: number;
496
+ }): Promise<Record<string, unknown>[]>;
454
497
  /** Prove a table is genuinely selectable (SELECT ... LIMIT 1). Throws if unreachable/denied. */
455
498
  sampleSelect(table: string): Promise<void>;
456
499
  }
457
500
  //#endregion
458
- export { SyncSource as _, ClivlyConnectResult as a, ClivlyUser as c, DiscoveredTable as d, DoctorCheck as f, EnsuredObjectTypeResult as g, EnsuredMappingResult as h, ClivlyConnectReason as i, CreateChatSessionHandlerOptions as l, EnsureSchemaResult as m, ChatSessionRequestBody as n, ClivlySDK as o, DoctorReport as p, ChatWidgetVisitor as r, ClivlySDKConfig as s, NamespaceIntrospector as t, CursorStore as u };
501
+ export { SyncSource as _, ClivlyConnectResult as a, ClivlyUser as c, DiscoveredTable as d, DoctorCheck as f, EnsuredObjectTypeResult as g, EnsuredMappingResult as h, ClivlyConnectReason as i, CreateChatSessionHandlerOptions as l, EnsureSchemaResult as m, ChatSessionRequestBody as n, ClivlySDK as o, DoctorReport as p, ChatWidgetVisitor as r, ClivlySDKConfig as s, NamespaceIntrospector as t, CursorStore as u, SyncTriggerDescription as v };
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.cjs";
1
+ import { P as ProjectionMapping, a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.cjs";
2
2
  import { r as IntegrationState } from "./integration-state-BK-riZnm.cjs";
3
3
  //#region ../sdk/src/drizzle-meta.d.ts
4
4
  declare const DRIZZLE_META: "__clivly_drizzle_source_meta__";
@@ -340,6 +340,20 @@ interface CursorStore {
340
340
  get(entity: string): Promise<SyncCursor | null> | SyncCursor | null;
341
341
  set(entity: string, cursor: SyncCursor | null): Promise<void> | void;
342
342
  }
343
+ /** @see ClivlySDK.describeSyncTrigger */
344
+ interface SyncTriggerDescription {
345
+ /**
346
+ * `syncTrigger.url` exactly as configured, placeholder and all. The raw
347
+ * value, so a caller can say what is in the file rather than what survived
348
+ * resolution.
349
+ */
350
+ configured?: string;
351
+ /**
352
+ * The URL that would be reported to Clivly on the next heartbeat, or
353
+ * `undefined` when nothing resolves. An unedited placeholder never resolves.
354
+ */
355
+ resolved?: string;
356
+ }
343
357
  interface ClivlySDK {
344
358
  /**
345
359
  * Send a single heartbeat and report the outcome richly: `ok`, the HTTP
@@ -375,6 +389,18 @@ interface ClivlySDK {
375
389
  * anyone who can reach it — set a secret if it's publicly routable.
376
390
  */
377
391
  createClivlyHandler(): (req: Request) => Promise<Response>;
392
+ /**
393
+ * What this app would tell Clivly about its sync trigger route, right now.
394
+ *
395
+ * Computed per call rather than frozen at creation: `resolved` can start as
396
+ * `undefined` and become a real URL once the mounted route has served its
397
+ * first request and observed its own origin.
398
+ *
399
+ * Exists for `clivly status`, which has to tell "no trigger configured"
400
+ * apart from "configured, but still the scaffolded placeholder" — a
401
+ * distinction `resolved` alone erases, since it skips placeholders by design.
402
+ */
403
+ describeSyncTrigger(): SyncTriggerDescription;
378
404
  /** Validate this setup end-to-end (read-only) before the first sync. */
379
405
  doctor(): Promise<DoctorReport>;
380
406
  /**
@@ -451,8 +477,25 @@ interface ClivlySDK {
451
477
  interface NamespaceIntrospector {
452
478
  /** All base table names in the reachable schema. */
453
479
  listTables(): Promise<string[]>;
480
+ /**
481
+ * Read a few rows through an unsaved projection, for the dashboard's derived
482
+ * object preview. Rows are keyed by field name.
483
+ *
484
+ * Optional because it is the only capability here that needs more than a
485
+ * table name, and because an introspector may be hand-written. Absent, the
486
+ * dashboard says preview is unavailable rather than failing — see
487
+ * `previewProjection`.
488
+ *
489
+ * This is what makes preview cost the host an SDK upgrade and nothing else:
490
+ * `drizzleIntrospector(db)` already closes over the connection, so a config
491
+ * that set `introspector` for the "Namespace reachable" check gains preview
492
+ * without touching a line.
493
+ */
494
+ runProjection?(projection: ProjectionMapping, opts: {
495
+ limit: number;
496
+ }): Promise<Record<string, unknown>[]>;
454
497
  /** Prove a table is genuinely selectable (SELECT ... LIMIT 1). Throws if unreachable/denied. */
455
498
  sampleSelect(table: string): Promise<void>;
456
499
  }
457
500
  //#endregion
458
- export { SyncSource as _, ClivlyConnectResult as a, ClivlyUser as c, DiscoveredTable as d, DoctorCheck as f, EnsuredObjectTypeResult as g, EnsuredMappingResult as h, ClivlyConnectReason as i, CreateChatSessionHandlerOptions as l, EnsureSchemaResult as m, ChatSessionRequestBody as n, ClivlySDK as o, DoctorReport as p, ChatWidgetVisitor as r, ClivlySDKConfig as s, NamespaceIntrospector as t, CursorStore as u };
501
+ export { SyncSource as _, ClivlyConnectResult as a, ClivlyUser as c, DiscoveredTable as d, DoctorCheck as f, EnsuredObjectTypeResult as g, EnsuredMappingResult as h, ClivlyConnectReason as i, CreateChatSessionHandlerOptions as l, EnsureSchemaResult as m, ChatSessionRequestBody as n, ClivlySDK as o, DoctorReport as p, ChatWidgetVisitor as r, ClivlySDKConfig as s, NamespaceIntrospector as t, CursorStore as u, SyncTriggerDescription as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clivly",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Clivly CLI — scaffold a CRM into your app (clivly init).",
@@ -4303,6 +4303,12 @@ Object.defineProperty(exports, "BASE_REF", {
4303
4303
  return BASE_REF;
4304
4304
  }
4305
4305
  });
4306
+ Object.defineProperty(exports, "PROJECTION_KEY_MESSAGE", {
4307
+ enumerable: true,
4308
+ get: function() {
4309
+ return PROJECTION_KEY_MESSAGE;
4310
+ }
4311
+ });
4306
4312
  Object.defineProperty(exports, "PROJECTION_KEY_PATTERN", {
4307
4313
  enumerable: true,
4308
4314
  get: function() {
@@ -4297,4 +4297,4 @@ function identityRefs(identity, basePkColumn) {
4297
4297
  return identity.parts;
4298
4298
  }
4299
4299
  //#endregion
4300
- export { _enum as a, literal as c, strictObject as d, string as f, projectionSchema as i, number as l, PROJECTION_KEY_PATTERN as n, array as o, union as p, identityRefs as r, boolean as s, BASE_REF as t, record as u };
4300
+ export { projectionSchema as a, boolean as c, record as d, strictObject as f, identityRefs as i, literal as l, union as m, PROJECTION_KEY_MESSAGE as n, _enum as o, string as p, PROJECTION_KEY_PATTERN as r, array as s, BASE_REF as t, number as u };